]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
indenting
[chaz/openbox] / openbox / client.c
index 19b8c122a1b9392cc8af273b11920e1f983e8069..e6265e93664226f5049f82660eb0d6c1ac317826 100644 (file)
@@ -406,6 +406,20 @@ void client_unmanage(ObClient *self)
         func(self);
     }
         
+    if (focus_client == self) {
+        XEvent e;
+
+        /* focus the last focused window on the desktop, and ignore enter
+           events from the unmap so it doesnt mess with the focus */
+        while (XCheckTypedEvent(ob_display, EnterNotify, &e));
+        /* remove these flags so we don't end up getting focused in the
+           fallback! */
+        self->can_focus = FALSE;
+        self->focus_notify = FALSE;
+        self->modal = FALSE;
+        client_unfocus(self);
+    }
+
     /* tell our parent(s) that we're gone */
     if (self->transient_for == OB_TRAN_GROUP) { /* transient of group */
         GSList *it;
@@ -433,15 +447,6 @@ void client_unmanage(ObClient *self)
         self->group = NULL;
     }
 
-    if (focus_client == self) {
-        XEvent e;
-
-        /* focus the last focused window on the desktop, and ignore enter
-           events from the unmap so it doesnt mess with the focus */
-        while (XCheckTypedEvent(ob_display, EnterNotify, &e));
-        client_unfocus(self);
-    }
-
     /* give the client its border back */
     client_toggle_border(self, TRUE);
 
@@ -2511,24 +2516,24 @@ gboolean client_can_focus(ObClient *self)
           (self->desktop == screen_desktop ||
            self->desktop == DESKTOP_ALL) &&
           !self->iconic))
-       return FALSE;
+        return FALSE;
 
     /* do a check to see if the window has already been unmapped or destroyed
        do this intelligently while watching out for unmaps we've generated
        (ignore_unmaps > 0) */
     if (XCheckTypedWindowEvent(ob_display, self->window,
-                              DestroyNotify, &ev)) {
-       XPutBackEvent(ob_display, &ev);
-       return FALSE;
+                               DestroyNotify, &ev)) {
+        XPutBackEvent(ob_display, &ev);
+        return FALSE;
     }
     while (XCheckTypedWindowEvent(ob_display, self->window,
-                                 UnmapNotify, &ev)) {
-       if (self->ignore_unmaps) {
-           self->ignore_unmaps--;
-       } else {
-           XPutBackEvent(ob_display, &ev);
-           return FALSE;
-       }
+                                  UnmapNotify, &ev)) {
+        if (self->ignore_unmaps) {
+            self->ignore_unmaps--;
+        } else {
+            XPutBackEvent(ob_display, &ev);
+            return FALSE;
+        }
     }
 
     return TRUE;
This page took 0.02562 seconds and 4 git commands to generate.