client_validate should return FALSE only for UnmapNotifies that will cause the window...
authorDana Jansens <danakj@orodu.net>
Fri, 3 Jul 2009 22:58:21 +0000 (18:58 -0400)
committerMikael Magnusson <mikachu@gmail.com>
Sat, 4 Jul 2009 10:38:53 +0000 (12:38 +0200)
openbox/client.c

index 789a034..c1af196 100644 (file)
@@ -3591,18 +3591,38 @@ ObClient *client_search_modal_child(ObClient *self)
     return NULL;
 }
 
+static gboolean client_validate_unmap(ObClient *self, int n)
+{
+    XEvent e;
+    gboolean ret = TRUE;
+
+    if (XCheckTypedWindowEvent(ob_display, self->window, UnmapNotify, &e)) {
+        if (n < self->ignore_unmaps) // ignore this one, but look for more
+            ret = client_validate_unmap(self, n+1);
+        else
+            ret = FALSE; // the window is going to become unmanaged
+
+        /* put them back on the event stack so they end up in the same order */
+        XPutBackEvent(ob_display, &e);
+    }
+
+    return ret;
+}
+
 gboolean client_validate(ObClient *self)
 {
     XEvent e;
 
     XSync(ob_display, FALSE); /* get all events on the server */
 
-    if (XCheckTypedWindowEvent(ob_display, self->window, DestroyNotify, &e) ||
-        XCheckTypedWindowEvent(ob_display, self->window, UnmapNotify, &e)) {
+    if (XCheckTypedWindowEvent(ob_display, self->window, DestroyNotify, &e)) {
         XPutBackEvent(ob_display, &e);
         return FALSE;
     }
 
+    if (!client_validate_unmap(self, 0))
+        return FALSE;
+
     return TRUE;
 }