add the root window to the stacking list and everything like it's a normal window
authorDana Jansens <danakj@orodu.net>
Wed, 5 Mar 2008 02:20:08 +0000 (21:20 -0500)
committerDana Jansens <danakj@orodu.net>
Wed, 5 Mar 2008 02:20:08 +0000 (21:20 -0500)
screen.c
screen.h

index 9ea9cca..2323f8b 100644 (file)
--- a/screen.c
+++ b/screen.c
@@ -37,6 +37,7 @@ screen_new(struct d_display *dpy, int num, xcb_screen_t *xcb)
     sc->ref = 1;
     sc->dpy = dpy;
     sc->num = num;
+    sc->root = NULL;
 
     gettimeofday(&sc->next_repaint, NULL);
     sc->need_repaint = TRUE;
@@ -61,6 +62,9 @@ void
 screen_unref(d_screen_t *sc)
 {
     if (sc && --sc->ref == 0) {
+        if (sc->root)
+            screen_remove_window(sc, sc->root);
+
         g_hash_table_unref(sc->winhash);
         list_unref(sc->stacking);
         g_hash_table_unref(sc->plugin_data);
@@ -177,7 +181,7 @@ screen_init(d_screen_t *sc)
     return TRUE;
 }
 
-void
+d_window_t*
 screen_add_window(d_screen_t *sc, xcb_window_t wid)
 {
     d_window_t *w;
@@ -188,6 +192,7 @@ screen_add_window(d_screen_t *sc, xcb_window_t wid)
     g_hash_table_insert(sc->winhash, &w->id, w);
 
     printf("screen added window 0x%x\n", w->id);
+    return w;
 }
 
 static void
@@ -196,12 +201,13 @@ screen_add_existing_windows(d_screen_t *sc)
     xcb_query_tree_cookie_t ck;
     xcb_query_tree_reply_t *rep;
 
+    sc->root = screen_add_window(sc, sc->super.root);
+
     ck = xcb_query_tree(sc->dpy->conn, sc->super.root);
     rep = xcb_query_tree_reply(sc->dpy->conn, ck, NULL);
     if (rep) {
         xcb_window_iterator_t it;
 
-        printf("query\n");
         it = xcb_query_tree_children_iterator(rep);
         for (; it.rem; xcb_window_next(&it))
             screen_add_window(sc, *it.data);
index e0f6508..4c6d5c8 100644 (file)
--- a/screen.h
+++ b/screen.h
@@ -20,6 +20,7 @@ typedef struct d_screen {
     xcb_atom_t        selatom; /* ditto.. */
 
     xcb_window_t      overlay;
+    struct d_window  *root;
 
     struct timeval    next_repaint;
     gboolean          need_repaint;
@@ -44,7 +45,7 @@ void screen_unref(d_screen_t *sc);
 */
 gboolean screen_register(d_screen_t *sc);
 
-void screen_add_window(d_screen_t *sc, xcb_window_t wid);
+struct d_window* screen_add_window(d_screen_t *sc, xcb_window_t wid);
 void screen_remove_window(d_screen_t *sc, struct d_window *w);
 
 struct d_window* screen_find_window(d_screen_t *sc, xcb_window_t id);