]> Dogcows Code - chaz/openbox/blobdiff - openbox/window.c
make an event queue for X events. the queue's min size is 16 XEvents (~3k)
[chaz/openbox] / openbox / window.c
index 19b362edd14e26fda80d5a1ee6fc5c2d1e680e65..ad61294d3ef734343904cdaab162e19a95c9673f 100644 (file)
@@ -26,6 +26,7 @@
 #include "prompt.h"
 #include "debug.h"
 #include "grab.h"
+#include "obt/xqueue.h"
 
 static GHashTable *window_map;
 
@@ -146,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;
@@ -158,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);
+    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;
This page took 0.023168 seconds and 4 git commands to generate.