[mutter] screen: Ignore num-workspaces when using dynamic workspaces



commit 2717a02a8d5da27364ad7a345944a407d0e6f2bd
Author: Florian MÃllner <fmuellner gnome org>
Date:   Wed Oct 17 20:15:10 2012 +0200

    screen: Ignore num-workspaces when using dynamic workspaces
    
    On startup, workspaces are initialized according to the num-workspaces
    preference. However when using dynamic workspaces, the actual number
    of workspaces in use might be greater than the preference (when
    replacing the window manager), forcing windows on those workspaces
    to the first workspace.
    To fix, ignore the preference completely when using dynamic workspaces
    and try to restore the previous number of workspaces (as read from
    _NET_NUMBER_OF_DESKTOPS).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=685439

 src/core/screen.c |   25 ++++++++++++++++++++++++-
 1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/src/core/screen.c b/src/core/screen.c
index e49f7d0..03adfef 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1464,7 +1464,30 @@ update_num_workspaces (MetaScreen *screen,
   MetaWorkspace *last_remaining;
   gboolean need_change_space;
   
-  new_num = meta_prefs_get_num_workspaces ();
+  if (meta_prefs_get_dynamic_workspaces ())
+    {
+      int n_items;
+      gulong *list;
+
+      n_items = 0;
+      list = NULL;
+
+      if (meta_prop_get_cardinal_list (screen->display, screen->xroot,
+                                       screen->display->atom__NET_NUMBER_OF_DESKTOPS,
+                                       &list, &n_items))
+        {
+          new_num = list[0];
+          meta_XFree (list);
+        }
+      else
+        {
+          new_num = 1;
+        }
+    }
+  else
+    {
+      new_num = meta_prefs_get_num_workspaces ();
+    }
 
   g_assert (new_num > 0);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]