]> Dogcows Code - chaz/openbox/commitdiff
stacking fixes for layers
authorDana Jansens <danakj@orodu.net>
Thu, 10 May 2007 20:23:27 +0000 (20:23 +0000)
committerDana Jansens <danakj@orodu.net>
Thu, 10 May 2007 20:23:27 +0000 (20:23 +0000)
openbox/client.c
openbox/stacking.c

index 8fb481600da65c09f6067e272365593ac4541743..6bc2b630f00046ccf5b7f9d10e7bb0c13d971a0e 100644 (file)
@@ -282,7 +282,6 @@ void client_manage(Window window)
 
     /* non-zero defaults */
     self->wmstate = WithdrawnState; /* make sure it gets updated first time */
-    self->layer = -1;
     self->desktop = screen_num_desktops; /* always an invalid value */
     self->user_time = focus_client ? focus_client->user_time : CurrentTime;
 
@@ -295,8 +294,6 @@ void client_manage(Window window)
 
     client_setup_decor_and_functions(self);
 
-    client_calc_layer(self);
-
     {
         Time t = sn_app_started(self->startup_id, self->class);
         if (t) self->user_time = t;
@@ -324,7 +321,8 @@ void client_manage(Window window)
 
     grab_server(FALSE);
 
-    stacking_add_nonintrusive(CLIENT_AS_WINDOW(self));
+    /* do this to add ourselves to the stacking list in a non-intrusive way */
+    client_calc_layer(self);
 
     /* focus the new window? */
     if (ob_state() != OB_STATE_STARTING &&
@@ -2298,7 +2296,7 @@ static ObStackingLayer calc_layer(ObClient *self)
 }
 
 static void client_calc_layer_recursive(ObClient *self, ObClient *orig,
-                                        ObStackingLayer min, gboolean raised)
+                                        ObStackingLayer min)
 {
     ObStackingLayer old, own;
     GSList *it;
@@ -2307,28 +2305,14 @@ static void client_calc_layer_recursive(ObClient *self, ObClient *orig,
     own = calc_layer(self);
     self->layer = MAX(own, min);
 
+    if (self->layer != old) {
+        stacking_remove(CLIENT_AS_WINDOW(self));
+        stacking_add_nonintrusive(CLIENT_AS_WINDOW(self));
+    }
+
     for (it = self->transients; it; it = g_slist_next(it))
         client_calc_layer_recursive(it->data, orig,
-                                    self->layer,
-                                    raised ? raised : self->layer > old);
-
-    /* restack. but only if the original window is managed.
-
-       raised is used so that only the bottom-most window in the stacking
-       order is raised, the others will automatically come with it.
-
-       also only the highest windows in the stacking order (no transients)
-       are lowered, cuz the rest come for free
-    */
-    if (!raised && orig->frame) {
-        if (self->layer > old) {
-            stacking_remove(CLIENT_AS_WINDOW(self));
-            stacking_add_nonintrusive(CLIENT_AS_WINDOW(self));
-        } else if (self->layer < old && self->transients == NULL) {
-            stacking_remove(CLIENT_AS_WINDOW(self));
-            stacking_add_nonintrusive(CLIENT_AS_WINDOW(self));
-        }
-    }
+                                    self->layer);
 }
 
 void client_calc_layer(ObClient *self)
@@ -2342,7 +2326,7 @@ void client_calc_layer(ObClient *self)
     it = client_search_all_top_parents(self);
 
     for (; it; it = g_slist_next(it))
-        client_calc_layer_recursive(it->data, orig, 0, FALSE);
+        client_calc_layer_recursive(it->data, orig, 0);
 }
 
 gboolean client_should_show(ObClient *self)
index c4fb06a2b3d81bc4cb67d8b9244803acd7b1c893..c9ca514bc3ddc6c09ab66e513b2ee567a6a4267e 100644 (file)
@@ -426,7 +426,7 @@ void stacking_add_nonintrusive(ObWindow *win)
         }
     }
     if (!it_below) {
-        if (client == focus_client) {
+        if (client_search_transient(client, focus_client)) {
             /* it's focused so put it at the top */
             stacking_list = g_list_append(stacking_list, win);
             stacking_raise(win);
This page took 0.031272 seconds and 4 git commands to generate.