]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
remove the obconf stuff
[chaz/openbox] / openbox / client.c
index 6de12d19f855c4a99215d338f6562b0d381234d1..bc3c6f0d76bb17bca9646245b7035e333230e95d 100644 (file)
@@ -401,6 +401,25 @@ void client_unmanage(ObClient *self)
        influence */
     screen_update_areas();
 
+    for (it = client_destructors; it; it = g_slist_next(it)) {
+        GDestroyNotify func = (GDestroyNotify) it->data;
+        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;
@@ -410,8 +429,8 @@ void client_unmanage(ObClient *self)
                 ((ObClient*)it->data)->transients =
                     g_slist_remove(((ObClient*)it->data)->transients, self);
     } else if (self->transient_for) {        /* transient of window */
-       self->transient_for->transients =
-           g_slist_remove(self->transient_for->transients, self);
+        self->transient_for->transients =
+            g_slist_remove(self->transient_for->transients, self);
     }
 
     /* tell our transients that we're gone */
@@ -422,20 +441,6 @@ void client_unmanage(ObClient *self)
         }
     }
 
-    for (it = client_destructors; it; it = g_slist_next(it)) {
-        GDestroyNotify func = (GDestroyNotify) it->data;
-        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));
-        client_unfocus(self);
-    }
-
     /* remove from its group */
     if (self->group) {
         group_remove(self->group, self);
@@ -824,7 +829,7 @@ void client_update_transient_for(ObClient *self)
     ObClient *target = NULL;
 
     if (XGetTransientForHint(ob_display, self->window, &t)) {
-       self->transient = TRUE;
+        self->transient = TRUE;
         if (t != self->window) { /* cant be transient to itself! */
             target = g_hash_table_lookup(window_map, &t);
             /* if this happens then we need to check for it*/
@@ -840,14 +845,15 @@ void client_update_transient_for(ObClient *self)
                    group */
                 if (t == self->group->leader ||
                     t == None ||
-                    t == RootWindow(ob_display, ob_screen)) {
+                    t == RootWindow(ob_display, ob_screen))
+                {
                     /* window is a transient for its group! */
                     target = OB_TRAN_GROUP;
                 }
             }
         }
     } else
-       self->transient = FALSE;
+        self->transient = FALSE;
 
     /* if anything has changed... */
     if (target != self->transient_for) {
@@ -1278,6 +1284,18 @@ void client_update_wmhints(ObClient *self)
                 for (it = self->group->members; it; it = it->next)
                     self->transients = g_slist_remove(self->transients,
                                                       it->data);
+
+                /* remove myself from parents in the group */
+                if (self->transient_for == OB_TRAN_GROUP) {
+                    for (it = self->group->members; it; it = it->next) {
+                        ObClient *c = it->data;
+
+                        if (c != self && !c->transient_for)
+                            c->transients = g_slist_remove(c->transients,
+                                                           self);
+                    }
+                }
+
                 group_remove(self->group, self);
                 self->group = NULL;
             }
@@ -2289,7 +2307,7 @@ void client_set_desktop_recursive(ObClient *self,
             client_showhide(self);
         /* raise if it was not already on the desktop */
         if (old != DESKTOP_ALL)
-            action_run_string("Raise", self);
+            client_raise(self);
         screen_update_areas();
 
         /* add to the new desktop(s) */
@@ -2492,7 +2510,7 @@ ObClient *client_focus_target(ObClient *self)
     ObClient *child;
      
     /* if we have a modal child, then focus it, not us */
-    child = client_search_modal_child(self);
+    child = client_search_modal_child(client_search_top_transient(self));
     if (child) return child;
     return self;
 }
@@ -2511,24 +2529,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;
@@ -2602,7 +2620,7 @@ void client_activate(ObClient *self, gboolean here)
     if (client_normal(self) && screen_showing_desktop)
         screen_show_desktop(FALSE);
     if (self->iconic)
-        client_iconify(self, FALSE, FALSE);
+        client_iconify(self, FALSE, here);
     if (self->desktop != DESKTOP_ALL &&
         self->desktop != screen_desktop) {
         if (here)
@@ -2623,6 +2641,16 @@ void client_activate(ObClient *self, gboolean here)
        about raising the window. when a fullscreen window loses focus, we need
        this or else the raise wont be able to raise above the to-lose-focus
        fullscreen window. */
+    client_raise(self);
+}
+
+void client_raise(ObClient *self)
+{
+    action_run_string("Raise", self);
+}
+
+void client_lower(ObClient *self)
+{
     action_run_string("Raise", self);
 }
 
@@ -2799,6 +2827,8 @@ ObClient *client_search_top_transient(ObClient *self)
         } else {
             GSList *it;
 
+            g_assert(self->group);
+
             for (it = self->group->members; it; it = it->next) {
                 ObClient *c = it->data;
 
This page took 0.029663 seconds and 4 git commands to generate.