X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fwindow.c;h=ad61294d3ef734343904cdaab162e19a95c9673f;hb=194bb32cf65d16a4ebec2b96ccad6f3c8c4be9b3;hp=c8951741bf44fa72713a54b697f713943eeb286d;hpb=f5c2d6d3798fdc70c8bbc5d8205cf20e2b2a7cd3;p=chaz%2Fopenbox diff --git a/openbox/window.c b/openbox/window.c index c8951741..ad61294d 100644 --- a/openbox/window.c +++ b/openbox/window.c @@ -26,6 +26,7 @@ #include "prompt.h" #include "debug.h" #include "grab.h" +#include "obt/xqueue.h" static GHashTable *window_map; @@ -74,8 +75,11 @@ ObStackingLayer window_layer(ObWindow *self) return ((ObClient*)self)->layer; case OB_WINDOW_CLASS_MENUFRAME: case OB_WINDOW_CLASS_INTERNAL: - case OB_WINDOW_CLASS_PROMPT: return OB_STACKING_LAYER_INTERNAL; + case OB_WINDOW_CLASS_PROMPT: + /* not used directly for stacking, prompts are managed as clients */ + g_assert_not_reached(); + break; } g_assert_not_reached(); return None; @@ -143,9 +147,15 @@ void window_manage_all(void) if (children) XFree(children); } +static gboolean check_unmap(XEvent *e, gpointer data) +{ + const Window win = *(Window*)data; + return ((e->type == DestroyNotify && e->xdestroywindow.window == win) || + (e->type == UnmapNotify && e->xunmap.window == win)); +} + void window_manage(Window win) { - XEvent e; XWindowAttributes attrib; gboolean no_manage = FALSE; gboolean is_dockapp = FALSE; @@ -155,15 +165,11 @@ void window_manage(Window win) /* check if it has already been unmapped by the time we started mapping. the grab does a sync so we don't have to here */ - if (XCheckTypedWindowEvent(obt_display, win, DestroyNotify, &e) || - XCheckTypedWindowEvent(obt_display, win, UnmapNotify, &e)) - { - XPutBackEvent(obt_display, &e); - ob_debug("Trying to manage unmapped window. Aborting that.\n"); + if (xqueue_exists_local(check_unmap, &win)) { + ob_debug("Trying to manage unmapped window. Aborting that."); no_manage = TRUE; } - - if (!XGetWindowAttributes(obt_display, win, &attrib)) + else if (!XGetWindowAttributes(obt_display, win, &attrib)) no_manage = TRUE; else { XWMHints *wmhints; @@ -184,7 +190,7 @@ void window_manage(Window win) if (!no_manage) { if (attrib.override_redirect) { - ob_debug("not managing override redirect window 0x%x\n", win); + ob_debug("not managing override redirect window 0x%x", win); grab_server(FALSE); } else if (is_dockapp) { @@ -197,7 +203,7 @@ void window_manage(Window win) } else { grab_server(FALSE); - ob_debug("FAILED to manage window 0x%x\n", win); + ob_debug("FAILED to manage window 0x%x", win); } }