]> Dogcows Code - chaz/openbox/blobdiff - openbox/stacking.c
all my changes while i was offline.
[chaz/openbox] / openbox / stacking.c
index 4702baa3e017dafe1f54064d77ef8a03b5299ca1..ab1e19553de40bad90a0971d25c27d6fcf847352 100644 (file)
@@ -8,6 +8,24 @@
 
 GList  *stacking_list = NULL;
 
+static Window top_window = None;
+
+void stacking_startup()
+{
+    XSetWindowAttributes attrib;
+    attrib.override_redirect = TRUE;
+    top_window =  XCreateWindow(ob_display, ob_root,
+                                -100, -100, 1, 1, 0,
+                                CopyFromParent, InputOutput, CopyFromParent,
+                                CWOverrideRedirect, &attrib);
+    XMapWindow(ob_display, top_window);
+}
+
+void stacking_shutdown()
+{
+    XDestroyWindow(ob_display, top_window);
+}
+
 void stacking_set_list()
 {
     Window *windows, *win_it;
@@ -30,7 +48,8 @@ void stacking_set_list()
     } else
        windows = NULL;
 
-    PROP_SETA32(ob_root, net_client_list_stacking, window, windows, size);
+    PROP_SETA32(ob_root, net_client_list_stacking, window,
+                (guint32*)windows, size);
 
     if (windows)
        g_free(windows);
@@ -51,7 +70,7 @@ static GList *find_lowest_transient(Client *c)
 static void raise_recursive(Client *client)
 {
     Window wins[2];  /* only ever restack 2 windows. */
-    GList *it;
+    GList *it, *low;
     GSList *sit;
 
     g_assert(stacking_list != NULL); /* this would be bad */
@@ -67,15 +86,15 @@ static void raise_recursive(Client *client)
     /* find 'it' where it is the positiion in the stacking order where
        'client' will be inserted *before* */
 
-    it = find_lowest_transient(client);
-    if (it)
-        it = it->next;
-    else {
-        /* the stacking list is from highest to lowest */
-        for (it = stacking_list; it; it = it->next) {
-            if (client->layer >= ((Client*)it->data)->layer)
-                break;
+    low = find_lowest_transient(client);
+    /* the stacking list is from highest to lowest */
+    for (it = g_list_last(stacking_list); it; it = it->prev) {
+        if (it == low || client->layer < ((Client*)it->data)->layer) {
+            it = it->next;
+            break;
         }
+        if (it == stacking_list)
+            break;
     }
 
     /*
@@ -183,3 +202,12 @@ void stacking_lower(Client *client)
     stacking_set_list();
 }
 
+void stacking_raise_internal(Window win)
+{
+    Window wins[2];  /* only ever restack 2 windows. */
+
+    wins[0] = top_window;
+    wins[1] = win;
+
+    XRestackWindows(ob_display, wins, 2);
+}
This page took 0.021417 seconds and 4 git commands to generate.