set the root event mask to listen for substructure events
authorDana Jansens <danakj@orodu.net>
Mon, 3 Mar 2008 04:16:40 +0000 (23:16 -0500)
committerDana Jansens <danakj@orodu.net>
Mon, 3 Mar 2008 04:16:40 +0000 (23:16 -0500)
dcompmgr.c
screen.c
screen.h

index 12a711b..38f96e7 100644 (file)
@@ -25,6 +25,8 @@ all_screens(xcb_connection_t *conn, d_screen_t **list)
             *list = g_renew(d_screen_t, *list, count);
             (*list)[count-1] = sc;
             printf(_("managing screen %d\n"), sc.num);
+
+            screen_listen(conn, &sc);
         }
     }
     return count;
index e223467..f268ede 100644 (file)
--- a/screen.c
+++ b/screen.c
@@ -3,6 +3,8 @@
 #include <string.h>
 #include <stdio.h>
 
+#define ROOT_MASK (XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY)
+
 gboolean
 screen_register(xcb_connection_t *conn, d_screen_t *sc)
 {
@@ -48,3 +50,10 @@ screen_register(xcb_connection_t *conn, d_screen_t *sc)
         return FALSE;
     }
 }
+
+void screen_listen(xcb_connection_t *conn, d_screen_t *sc)
+{
+    const uint32_t mask = ROOT_MASK;
+    xcb_change_window_attributes(conn, sc->super.root,
+                                 XCB_CW_EVENT_MASK, &mask);
+}
index bdf54be..5aed2af 100644 (file)
--- a/screen.h
+++ b/screen.h
@@ -16,4 +16,6 @@ typedef struct {
 */
 gboolean screen_register(xcb_connection_t *conn, d_screen_t *sc);
 
+void screen_listen(xcb_connection_t *conn, d_screen_t *sc);
+
 #endif