]> Dogcows Code - chaz/openbox/blobdiff - openbox/window.c
don't use XPutBackEvent and mess up timestamp order in the event queue
[chaz/openbox] / openbox / window.c
index b90dc5093836c68db66136ad10e46be2c7da176d..c8cb348c7cdc36950b46bed21c9675bb7907ad1b 100644 (file)
@@ -146,6 +146,13 @@ void window_manage_all(void)
     if (children) XFree(children);
 }
 
+static Bool check_unmap(Display *d, XEvent *e, XPointer arg)
+{
+    const Window win = *(Window*)arg;
+    return ((e->type == DestroyNotify && e->xdestroywindow.window == win) ||
+            (e->type == UnmapNotify && e->xunmap.window == win));
+}
+
 void window_manage(Window win)
 {
     XEvent e;
@@ -158,11 +165,8 @@ 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 (XCheckIfEvent(obt_display, &e, check_unmap, (XPointer)&win)) {
+        ob_debug("Trying to manage unmapped window. Aborting that.");
         no_manage = TRUE;
     }
 
@@ -187,7 +191,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) {
@@ -200,7 +204,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);
     }
 }
 
This page took 0.02438 seconds and 4 git commands to generate.