summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Bosveld <Joel.Bosveld@gmail.com>2008-06-03 22:42:11 +0800
committerJoel Bosveld <Joel.Bosveld@gmail.com>2008-06-03 22:42:11 +0800
commit319da00356764a33eb5d368f4c90d85ae091ee75 (patch)
treeaa3857ece63a4a2e1b97818b467f72ef4dedf645
parent6ef03fc28c501b8f706ec37569c01afb562243a6 (diff)
downloadjasper-319da00356764a33eb5d368f4c90d85ae091ee75.tar.gz
jasper-319da00356764a33eb5d368f4c90d85ae091ee75.tar.bz2
Redraw title when it is changed
-rw-r--r--plugins/text.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/text.c b/plugins/text.c
index c96ab8a..c152ac0 100644
--- a/plugins/text.c
+++ b/plugins/text.c
@@ -68,7 +68,10 @@ typedef struct _TextCore
typedef struct _TextWindow
{
int buttonPrivateIndex; //XXX - this is important (it must be here) - see below
- char *title;
+ char *title;
+
+ JasperButton **b; //An array of buttons which need to be updated when the title changes
+ int nB;
} TextWindow;
typedef struct _TextButton
@@ -185,6 +188,9 @@ textHandleEvent (JasperCore *core, XEvent *event)
TEXT_WINDOW (w);
if(tw->title) free(tw->title);
tw->title = getName(w);
+
+ int i;
+ for(i=0; i < tw->nB; i++) if(tw->b[i]) textDrawDecoration (w, tw->b[i]);
}
}
}
@@ -232,6 +238,16 @@ textInitButton (JasperButton *button)
for(opt=button->options->children;opt;opt=opt->next) if(!strcmp(opt->name, "title"))
{
handled=true;
+
+ /* XXX - we get tw from temp, which itself is ugly */
+ JasperButton **tmp = realloc (tw->b, sizeof(JasperButton *) * (tw->nB+1));
+ if(tmp)
+ {
+ tw->b = tmp;
+ tw->b[tw->nB] = button;
+ tw->nB++;
+ }
+
JasperOption *co;
for(co=opt->children; co; co=co->next)
{
@@ -278,6 +294,8 @@ textInitWindow (JasperWindow *window)
TEXT_WINDOW (window);
tw->title = getName (window);
+ tw->b = NULL;
+ tw->nB = 0;
tw->buttonPrivateIndex = allocatePrivateIndex ((JasperObject *) window);
if(tw->buttonPrivateIndex < 0) return false; //ERROR