[mutter] prefs: Add dynamic-workspaces setting
- From: Florian MÃllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] prefs: Add dynamic-workspaces setting
- Date: Sun, 11 Mar 2012 21:55:59 +0000 (UTC)
commit 607dbf0f43a59a96f6902398441efb351c4b00ef
Author: Florian MÃllner <fmuellner gnome org>
Date: Thu Mar 8 01:29:58 2012 +0100
prefs: Add dynamic-workspaces setting
We currently sync the number of workspaces with the corresponding
preference. This is not really useful with GNOME Shell's dynamic
handling of workspaces, not least as the setting is effectively
ignored. Worse, it will trigger writes to dconf on login, slowing
down startup, so add a setting to indicate that workspaces are managed
dynamically and really ignore the num-workspaces setting when set.
https://bugzilla.gnome.org/show_bug.cgi?id=671568
src/core/prefs.c | 14 ++++++++++++++
src/core/screen.c | 12 +++++++++---
src/meta/prefs.h | 2 ++
src/org.gnome.mutter.gschema.xml.in | 10 ++++++++++
4 files changed, 35 insertions(+), 3 deletions(-)
---
diff --git a/src/core/prefs.c b/src/core/prefs.c
index 92aec45..58ee473 100644
--- a/src/core/prefs.c
+++ b/src/core/prefs.c
@@ -82,6 +82,7 @@ static int num_workspaces = 4;
static GDesktopTitlebarAction action_double_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE;
static GDesktopTitlebarAction action_middle_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_LOWER;
static GDesktopTitlebarAction action_right_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_MENU;
+static gboolean dynamic_workspaces = FALSE;
static gboolean application_based = FALSE;
static gboolean disable_workarounds = FALSE;
static gboolean auto_raise = FALSE;
@@ -281,6 +282,13 @@ static MetaBoolPreference preferences_bool[] =
&use_system_font,
},
{
+ { "dynamic-workspaces",
+ SCHEMA_MUTTER,
+ META_PREF_DYNAMIC_WORKSPACES,
+ },
+ &dynamic_workspaces,
+ },
+ {
{ "application-based",
SCHEMA_GENERAL,
META_PREF_APPLICATION_BASED,
@@ -1499,6 +1507,12 @@ meta_prefs_get_num_workspaces (void)
}
gboolean
+meta_prefs_get_dynamic_workspaces (void)
+{
+ return dynamic_workspaces;
+}
+
+gboolean
meta_prefs_get_application_based (void)
{
return FALSE; /* For now, we never want this to do anything */
diff --git a/src/core/screen.c b/src/core/screen.c
index 4010c7a..ba2b967 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1173,7 +1173,9 @@ prefs_changed_callback (MetaPreference pref,
{
MetaScreen *screen = data;
- if (pref == META_PREF_NUM_WORKSPACES)
+ if ((pref == META_PREF_NUM_WORKSPACES ||
+ pref == META_PREF_DYNAMIC_WORKSPACES) &&
+ !meta_prefs_get_dynamic_workspaces ())
{
/* GSettings doesn't provide timestamps, but luckily update_num_workspaces
* often doesn't need it...
@@ -1483,7 +1485,9 @@ meta_screen_remove_workspace (MetaScreen *screen, MetaWorkspace *workspace,
new_num = g_list_length (screen->workspaces);
set_number_of_spaces_hint (screen, new_num);
- meta_prefs_set_num_workspaces (new_num);
+
+ if (!meta_prefs_get_dynamic_workspaces ())
+ meta_prefs_set_num_workspaces (new_num);
/* If deleting a workspace before the current workspace, the active
* workspace index changes, so we need to update that hint */
@@ -1538,7 +1542,9 @@ meta_screen_append_new_workspace (MetaScreen *screen, gboolean activate,
new_num = g_list_length (screen->workspaces);
set_number_of_spaces_hint (screen, new_num);
- meta_prefs_set_num_workspaces (new_num);
+
+ if (!meta_prefs_get_dynamic_workspaces ())
+ meta_prefs_set_num_workspaces (new_num);
meta_screen_queue_workarea_recalc (screen);
diff --git a/src/meta/prefs.h b/src/meta/prefs.h
index 8232a72..bfdc726 100644
--- a/src/meta/prefs.h
+++ b/src/meta/prefs.h
@@ -47,6 +47,7 @@ typedef enum
META_PREF_THEME,
META_PREF_TITLEBAR_FONT,
META_PREF_NUM_WORKSPACES,
+ META_PREF_DYNAMIC_WORKSPACES,
META_PREF_APPLICATION_BASED,
META_PREF_KEYBINDINGS,
META_PREF_DISABLE_WORKAROUNDS,
@@ -94,6 +95,7 @@ const char* meta_prefs_get_theme (void);
/* returns NULL if GTK default should be used */
const PangoFontDescription* meta_prefs_get_titlebar_font (void);
int meta_prefs_get_num_workspaces (void);
+gboolean meta_prefs_get_dynamic_workspaces (void);
gboolean meta_prefs_get_application_based (void);
gboolean meta_prefs_get_disable_workarounds (void);
gboolean meta_prefs_get_auto_raise (void);
diff --git a/src/org.gnome.mutter.gschema.xml.in b/src/org.gnome.mutter.gschema.xml.in
index 8d11154..e3c5590 100644
--- a/src/org.gnome.mutter.gschema.xml.in
+++ b/src/org.gnome.mutter.gschema.xml.in
@@ -45,6 +45,16 @@
</_description>
</key>
+ <key name="dynamic-workspaces" type="b">
+ <default>false</default>
+ <_summary>Workspaces are managed dynamically</_summary>
+ <_description>
+ Determines whether workspaces are managed dynamically or
+ whether there's a static number of workspaces (determined
+ by the num-workspaces key in org.gnome.desktop.wm.preferences).
+ </_description>
+ </key>
+
<key name="workspaces-only-on-primary" type="b">
<default>false</default>
<_summary>Workspaces only on primary</_summary>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]