summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon TURNEY <jon.turney@dronecode.org.uk>2012-11-08 18:33:17 +0000
committerJon TURNEY <jon.turney@dronecode.org.uk>2012-11-30 14:26:52 +0000
commit2cd75a6a80373fb77f0ffd77ac070897ed548a0f (patch)
treed8010951033da11337d39272f85ff615134f69f6
parent20907431b9d182d82469b48ea7b7918dc7a97347 (diff)
Use xcwm_atom_register() to register interest appearance atoms
-rw-r--r--src/global.h3
-rw-r--r--src/main.c6
-rw-r--r--src/wndproc.c13
3 files changed, 11 insertions, 11 deletions
diff --git a/src/global.h b/src/global.h
index 14d13ff..8b0e388 100644
--- a/src/global.h
+++ b/src/global.h
@@ -20,3 +20,6 @@
#include <xcwm/xcwm.h>
extern xcwm_context_t *context;
+
+extern xcb_atom_t motif_wm_hints;
+extern xcb_atom_t windowState;
diff --git a/src/main.c b/src/main.c
index 68b4e04..9e98c52 100644
--- a/src/main.c
+++ b/src/main.c
@@ -32,6 +32,8 @@
#define WM_XCWM_DESTROY (WM_USER+1)
xcwm_context_t *context;
+xcb_atom_t motif_wm_hints = 0;
+xcb_atom_t windowState = 0;
DWORD msgPumpThread;
static sem_t semaphore;
@@ -162,6 +164,10 @@ int main(int argc, char **argv)
// create the global xcwm context
context = xcwm_context_open(screen);
+ // register interest in some atoms
+ motif_wm_hints = xcwm_atom_register(context, "_MOTIF_WM_HINTS", XCWM_EVENT_WINDOW_APPEARANCE);
+ windowState = xcwm_atom_register(context, "_NET_WM_STATE", XCWM_EVENT_WINDOW_APPEARANCE);
+
// spawn the event loop thread, and set the callback function
xcwm_event_start_loop(context, eventHandler);
diff --git a/src/wndproc.c b/src/wndproc.c
index 75157bf..55ed66f 100644
--- a/src/wndproc.c
+++ b/src/wndproc.c
@@ -36,6 +36,7 @@
#include "winkeybd.h"
#include "winicons.h"
#include "wndproc.h"
+#include "global.h"
#define WINDOW_CLASS_X "xtow"
#define WINDOW_TITLE_X "X"
@@ -45,7 +46,6 @@
int blur = 0;
PFNDWMENABLEBLURBEHINDWINDOW pDwmEnableBlurBehindWindow = NULL;
-extern xcwm_context_t *context;
/*
* ValidateSizing - Ensures size request respects hints
@@ -438,12 +438,6 @@ winApplyStyle(xcwm_window_t *window)
}
/* Allow explicit style specification in _MOTIF_WM_HINTS to override the semantic style specified by _NET_WM_WINDOW_TYPE */
- /* XXX: we also need to get told if _MOTIF_WM_HINTS property changes */
- static xcb_atom_t motif_wm_hints = 0;
-
- if (!motif_wm_hints)
- motif_wm_hints = atom_get(window->context, "_MOTIF_WM_HINTS");
-
xcb_get_property_cookie_t cookie_mwm_hint = xcb_get_property(window->context->conn, FALSE, window->window_id, motif_wm_hints, motif_wm_hints, 0L, sizeof(MwmHints));
xcb_get_property_reply_t *reply = xcb_get_property_reply(window->context->conn, cookie_mwm_hint, NULL);
if (reply)
@@ -485,10 +479,7 @@ winApplyStyle(xcwm_window_t *window)
}
/* _NET_WM_WINDOW_STATE */
- /* XXX: we also need to get told the _NET_WM_WINDOW_STATE property changes */
- static xcb_atom_t windowState, belowState, aboveState, skiptaskbarState;
- if (!windowState)
- windowState = atom_get(window->context, "_NET_WM_STATE");
+ static xcb_atom_t belowState, aboveState, skiptaskbarState;
if (!belowState)
belowState = atom_get(window->context, "_NET_WM_STATE_BELOW");
if (!aboveState)