]> Dogcows Code - chaz/openbox/blobdiff - openbox/screen.c
check for damage and render extensions if going to use composite. require them for...
[chaz/openbox] / openbox / screen.c
index d092ec288934bcd072b2b87ebf4364e4362859d8..1ef080752dbfdb50a885b10e27f83d7b3a39a23a 100644 (file)
@@ -364,6 +364,15 @@ void screen_startup(gboolean reconfig)
         return;
     }
 
+#ifdef USE_XCOMPOSITE
+    if (extensions_comp) {
+        /* Redirect window contents to offscreen pixmaps */
+        XCompositeRedirectSubwindows(ob_display,
+                                     RootWindow(ob_display, ob_screen),
+                                     CompositeRedirectAutomatic);
+    }
+#endif
+
     /* get the initial size */
     screen_resize();
 
@@ -496,7 +505,7 @@ void screen_set_num_desktops(guint num)
 {
     guint old;
     gulong *viewport;
-    GList *it;
+    GList *it, *stacking_copy;
 
     g_assert(num > 0);
 
@@ -516,11 +525,21 @@ void screen_set_num_desktops(guint num)
     /* the number of rows/columns will differ */
     screen_update_layout();
 
-    /* move windows on desktops that will no longer exist! */
-    for (it = client_list; it; it = g_list_next(it)) {
-        ObClient *c = it->data;
-        if (c->desktop >= num && c->desktop != DESKTOP_ALL)
-            client_set_desktop(c, num - 1, FALSE, TRUE);
+    /* move windows on desktops that will no longer exist!
+       make a copy of the list cuz we're changing it */
+    stacking_copy = g_list_copy(stacking_list);
+    for (it = g_list_last(stacking_copy); it; it = g_list_previous(it)) {
+        if (WINDOW_IS_CLIENT(it->data)) {
+            ObClient *c = it->data;
+            if (c->desktop != DESKTOP_ALL && c->desktop >= num)
+                client_set_desktop(c, num - 1, FALSE, TRUE);
+            /* raise all the windows that are on the current desktop which
+               is being merged */
+            else if (screen_desktop == num - 1 &&
+                     (c->desktop == DESKTOP_ALL ||
+                      c->desktop == screen_desktop))
+                stacking_raise(WINDOW_AS_CLIENT(c));
+        }
     }
  
     /* change our struts/area to match (after moving windows) */
This page took 0.022669 seconds and 4 git commands to generate.