sc->ref = 1;
sc->dpy = dpy;
sc->num = num;
+ sc->root = NULL;
gettimeofday(&sc->next_repaint, NULL);
sc->need_repaint = TRUE;
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);
return TRUE;
}
-void
+d_window_t*
screen_add_window(d_screen_t *sc, xcb_window_t wid)
{
d_window_t *w;
g_hash_table_insert(sc->winhash, &w->id, w);
printf("screen added window 0x%x\n", w->id);
+ return w;
}
static void
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);
xcb_atom_t selatom; /* ditto.. */
xcb_window_t overlay;
+ struct d_window *root;
struct timeval next_repaint;
gboolean need_repaint;
*/
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);