summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Bosveld <Joel.Bosveld@gmail.com>2008-06-03 17:20:39 +0800
committerJoel Bosveld <Joel.Bosveld@gmail.com>2008-06-03 17:20:39 +0800
commit2ddbea151b07bb4829c10c3c40a4d1aed73a8bc6 (patch)
treeca2898a01913cb9fc22752e2cf5a17868c9ab04a
parent6fa9984c87408b0dd70e26f895bfe56104602ace (diff)
downloadjasper-2ddbea151b07bb4829c10c3c40a4d1aed73a8bc6.tar.gz
jasper-2ddbea151b07bb4829c10c3c40a4d1aed73a8bc6.tar.bz2
Atoms should be per display, not per window
-rw-r--r--plugins/text.c36
1 files changed, 26 insertions, 10 deletions
diff --git a/plugins/text.c b/plugins/text.c
index 8aa720e..4cfb02b 100644
--- a/plugins/text.c
+++ b/plugins/text.c
@@ -56,15 +56,17 @@ static int corePrivateIndex;
typedef struct _TextCore
{
int windowPrivateIndex;
+
+ Atom nameAtom;
+ Atom XA_UTF8_STRING;
+
+ mainLoopInitProc mainLoopInit;
} TextCore;
typedef struct _TextWindow
{
int buttonPrivateIndex; //XXX - this is important (it must be here) - see below
- Atom nameAtom;
- Atom XA_UTF8_STRING;
-
} TextWindow;
typedef struct _TextButton
@@ -80,7 +82,6 @@ typedef struct _TextButton
static char
*getName (JasperWindow *w, int width)
{
- TEXT_WINDOW (w);
Atom type;
int format;
unsigned long nitems;
@@ -88,16 +89,17 @@ static char
char *s;
int result;
JasperCore *c = (JasperCore *) w->base.parent;
+ TEXT_CORE (c);
type = None;
result = XGetWindowProperty (c->display,
w->id,
- tw->nameAtom,
+ tc->nameAtom,
0, 2048L,
- false, tw->XA_UTF8_STRING, &type, &format, &nitems,
+ false, tc->XA_UTF8_STRING, &type, &format, &nitems,
&bytes_after, (void*) &s);
- if (type != tw->XA_UTF8_STRING)
+ if (type != tc->XA_UTF8_STRING)
{
XFree (s);
return NULL;
@@ -160,6 +162,19 @@ textDrawDecoration (JasperWindow *w, JasperButton *b)
free(s);
}
+static void
+coreMainLoopInit (JasperCore *core)
+{
+ TEXT_CORE (core);
+
+ UNWRAP (tc, core, mainLoopInit);
+ core->mainLoopInit (core);
+ WRAP (tc, core, mainLoopInit, coreMainLoopInit);
+
+ tc->nameAtom = XInternAtom (core->display, "_NET_WM_NAME", false);
+ tc->XA_UTF8_STRING = XInternAtom (core->display, "UTF8_STRING", false);
+}
+
/*******************************
* Init and fini functions for
* both plugins and objects
@@ -235,9 +250,6 @@ textInitWindow (JasperWindow *window)
tw->buttonPrivateIndex = allocatePrivateIndex ((JasperObject *) window);
if(tw->buttonPrivateIndex < 0) return false; //ERROR
- JasperCore *c = (JasperCore *) window->base.parent;
- tw->nameAtom = XInternAtom (c->display, "_NET_WM_NAME", false);
- tw->XA_UTF8_STRING = XInternAtom (c->display, "UTF8_STRING", false);
return true;
}
@@ -259,6 +271,8 @@ textInitCore (JasperCore *core)
tc->windowPrivateIndex = allocatePrivateIndex ((JasperObject *) core);
if(tc->windowPrivateIndex < 0) return false; //ERROR
+
+ WRAP (tc, core, mainLoopInit, coreMainLoopInit);
return true;
}
@@ -267,6 +281,8 @@ static void
textFiniCore (JasperCore *core)
{
TEXT_CORE (core);
+
+ UNWRAP (tc, core, mainLoopInit);
freePrivateIndex ((JasperObject *) core, tc->windowPrivateIndex);
free(tc);