From: Dana Jansens Date: Wed, 5 Mar 2008 15:13:34 +0000 (-0500) Subject: fix cases of getting confused if something is mapped or not. only use the mapped... X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=740138d2ff9758f7c625f1e6fa284283712a2269;p=dana%2Fdcompmgr.git fix cases of getting confused if something is mapped or not. only use the mapped value from xgetwindowattributes when we start up, otherwise it may just have mapped quickly after creating itself. --- diff --git a/dcompmgr.c b/dcompmgr.c index c878649..0957069 100644 --- a/dcompmgr.c +++ b/dcompmgr.c @@ -350,12 +350,8 @@ main(int argc, char **argv) d_screen_t *sc = sc_it->data; d_list_it_t *it; for (it = list_bottom(sc->stacking); it; it = it->prev) - if (window_is_mapped(it->data)) { - /* make the window think it is unmapped so that the - show works right */ - window_fake_unmapped(it->data); + if (window_is_attr_mapped(it->data)) sc->window_show(it->data); - } } } diff --git a/window.c b/window.c index 2c55b10..138c1fe 100644 --- a/window.c +++ b/window.c @@ -21,13 +21,14 @@ typedef struct { /* queried things, don't read them directly from the struct */ int x, y, w, h, bw; - gboolean mapped; + gboolean attr_mapped; gboolean input_only; xcb_visualid_t visual; xcb_pixmap_t pixmap; double opacity; + gboolean mapped; gboolean zombie; d_list_t *plugin_data; @@ -55,6 +56,7 @@ window_new(xcb_window_t id, struct d_screen *sc) w->ref = 1; w->sc = sc; w->zombie = FALSE; + w->mapped = FALSE; w->pixmap = XCB_NONE; w->damage = XCB_NONE; @@ -131,7 +133,6 @@ window_show(d_window_t *pubw) { d_window_priv_t *w = (d_window_priv_t*)pubw; - window_is_mapped(pubw); /* kill any ongoing request */ assert(!w->mapped); //printf("show window 0x%x\n", w->id); @@ -145,7 +146,6 @@ window_hide(d_window_t *pubw) { d_window_priv_t *w = (d_window_priv_t*)pubw; - window_is_mapped(pubw); /* kill any ongoing request */ assert(w->mapped); //printf("hide window 0x%x\n", w->id); @@ -213,14 +213,14 @@ window_get_attributes_reply(d_window_priv_t *w) if (rep) { w->input_only = rep->_class == XCB_WINDOW_CLASS_INPUT_ONLY; - w->mapped = rep->map_state != XCB_MAP_STATE_UNMAPPED; + w->attr_mapped = rep->map_state != XCB_MAP_STATE_UNMAPPED; w->visual = rep->visual; //printf("0x%x attributes mapped %d\n", w->id, w->mapped); free(rep); } else { w->input_only = TRUE; - w->mapped = FALSE; + w->attr_mapped = FALSE; w->visual = XCB_NONE; } if (err) { @@ -262,11 +262,18 @@ window_get_geometry_reply(d_window_priv_t *w) gboolean window_is_mapped(d_window_t *pubw) +{ + d_window_priv_t *w = (d_window_priv_t*)pubw; + return w->mapped; +} + +gboolean +window_is_attr_mapped(d_window_t *pubw) { d_window_priv_t *w = (d_window_priv_t*)pubw; if (w->waiting_attr) window_get_attributes_reply(w); - return w->mapped; + return w->attr_mapped; } xcb_pixmap_t diff --git a/window.h b/window.h index 59a8749..7e6784a 100644 --- a/window.h +++ b/window.h @@ -30,6 +30,7 @@ void window_resize(d_window_t *w); gboolean window_is_zombie(d_window_t *w); gboolean window_is_input_only(d_window_t *w); gboolean window_is_mapped(d_window_t *w); +gboolean window_is_attr_mapped(d_window_t *w); void window_get_area(d_window_t *pubw, int *x, int *y, int *width, int *height, int *border_width);