]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
a more correct for the missing frame problem. don't restack windows when changing...
[chaz/openbox] / openbox / client.c
index c9b7baa135510b90393c5d29babe289bf0e5953f..47be1bd957bc33379ee841f89b895da2f8683291 100644 (file)
@@ -1,4 +1,5 @@
 #include "client.h"
+#include "startup.h"
 #include "screen.h"
 #include "moveresize.h"
 #include "prop.h"
@@ -26,9 +27,6 @@
 GList      *client_list      = NULL;
 GHashTable *client_map       = NULL;
 
-static Window *client_startup_stack_order = NULL;
-static guint  client_startup_stack_size = 0;
-
 static void client_get_all(Client *self);
 static void client_toggle_border(Client *self, gboolean show);
 static void client_get_area(Client *self);
@@ -53,11 +51,6 @@ void client_startup()
     client_map = g_hash_table_new((GHashFunc)map_hash,
                                  (GEqualFunc)map_key_comp);
 
-    /* save the stacking order on startup! */
-    PROP_GETA32(ob_root, net_client_list_stacking, window,
-                (guint32**)&client_startup_stack_order,
-                &client_startup_stack_size);
-
     client_set_list();
 }
 
@@ -95,6 +88,7 @@ void client_manage_all()
     Window w, *children;
     XWMHints *wmhints;
     XWindowAttributes attrib;
+    Client *active;
 
     XQueryTree(ob_display, ob_root, &w, &w, &children, &nchild);
 
@@ -130,19 +124,22 @@ void client_manage_all()
        why with stacking_lower? Why, because then windows who aren't in the
        stacking list are on the top where you can see them instead of buried
        at the bottom! */
-    for (i = client_startup_stack_size; i > 0; --i) {
+    for (i = startup_stack_size; i > 0; --i) {
         Client *c;
 
-        w = client_startup_stack_order[i-1];
+        w = startup_stack_order[i-1];
         c = g_hash_table_lookup(client_map, &w);
         if (c) stacking_lower(c);
     }
-    g_free(client_startup_stack_order);
-    client_startup_stack_order = NULL;
-    client_startup_stack_size = 0;
+    g_free(startup_stack_order);
+    startup_stack_order = NULL;
+    startup_stack_size = 0;
 
-    if (config_focus_new)
-        focus_fallback(Fallback_NoFocus);
+    if (config_focus_new) {
+        active = g_hash_table_lookup(client_map, &startup_active);
+        if (!active || !client_focus(active))
+            focus_fallback(Fallback_NoFocus);
+    }
 }
 
 void client_manage(Window window)
@@ -1359,7 +1356,8 @@ static Client *search_focus_tree(Client *node, Client *skip)
     return NULL;
 }
 
-static void calc_recursive(Client *self, StackLayer l, gboolean raised)
+static void calc_recursive(Client *self, Client *orig, StackLayer l,
+                           gboolean raised)
 {
     StackLayer old;
     GSList *it;
@@ -1368,10 +1366,10 @@ static void calc_recursive(Client *self, StackLayer l, gboolean raised)
     self->layer = l;
 
     for (it = self->transients; it; it = it->next)
-        calc_recursive(it->data, l, raised ? raised : l != old);
+        calc_recursive(it->data, orig, l, raised ? raised : l != old);
 
     if (!raised && l != old)
-       if (self->frame)
+       if (orig->frame) /* only restack if the original window is managed */
            stacking_raise(self);
 }
 
@@ -1379,6 +1377,9 @@ void client_calc_layer(Client *self)
 {
     StackLayer l;
     gboolean f;
+    Client *orig;
+
+    orig = self;
 
     /* transients take on the layer of their parents */
     if (self->transient_for) {
@@ -1416,7 +1417,7 @@ void client_calc_layer(Client *self)
     else if (self->below) l = Layer_Below;
     else l = Layer_Normal;
 
-    calc_recursive(self, l, FALSE);
+    calc_recursive(self, orig, l, FALSE);
 }
 
 gboolean client_should_show(Client *self)
This page took 0.022947 seconds and 4 git commands to generate.