|
|
8063f1 |
From 861a3efb0f531eae767926d18c4d690366306bfe Mon Sep 17 00:00:00 2001
|
|
|
8063f1 |
From: "Owen W. Taylor" <otaylor@fishsoup.net>
|
|
|
8063f1 |
Date: Wed, 21 Oct 2009 19:22:35 -0400
|
|
|
8063f1 |
Subject: [PATCH] Add a new-windows-always-on-top preference
|
|
|
8063f1 |
|
|
|
8063f1 |
Add a new-windows-always-on-top preference. When set, new windows
|
|
|
8063f1 |
are always placed on top, even if they are denied focus.
|
|
|
8063f1 |
|
|
|
8063f1 |
This is useful on large screens and multihead setups where the
|
|
|
8063f1 |
tasklist can be hard to notice and difficult to mouse to, so the
|
|
|
8063f1 |
normal behavior of flashing in the tasklist is less effective.
|
|
|
8063f1 |
---
|
|
|
8063f1 |
src/core/prefs.c | 20 +++++++++++++++++++-
|
|
|
8063f1 |
src/core/window.c | 6 +++++-
|
|
|
8063f1 |
src/include/prefs.h | 2 ++
|
|
|
8063f1 |
src/metacity-schemas.convert | 1 +
|
|
|
8063f1 |
src/org.gnome.metacity.gschema.xml.in | 22 ++++++++++++++++++++++
|
|
|
8063f1 |
5 files changed, 49 insertions(+), 2 deletions(-)
|
|
|
8063f1 |
|
|
|
8063f1 |
diff --git a/src/core/prefs.c b/src/core/prefs.c
|
|
|
8063f1 |
index 24a98cd..949f6ed 100644
|
|
|
8063f1 |
--- a/src/core/prefs.c
|
|
|
8063f1 |
+++ b/src/core/prefs.c
|
|
|
8063f1 |
@@ -73,6 +73,7 @@ static GDesktopFocusMode focus_mode = G_DESKTOP_FOCUS_MODE_CLICK;
|
|
|
8063f1 |
static GDesktopFocusNewWindows focus_new_windows = G_DESKTOP_FOCUS_NEW_WINDOWS_SMART;
|
|
|
8063f1 |
static GSList *no_focus_windows = NULL;
|
|
|
8063f1 |
static gboolean raise_on_click = TRUE;
|
|
|
8063f1 |
+static gboolean new_windows_always_on_top = TRUE;
|
|
|
8063f1 |
static char* current_theme = NULL;
|
|
|
8063f1 |
static int num_workspaces = 4;
|
|
|
8063f1 |
static GDesktopTitlebarAction action_double_click_titlebar = G_DESKTOP_TITLEBAR_ACTION_TOGGLE_MAXIMIZE;
|
|
|
8063f1 |
@@ -261,6 +262,14 @@ static MetaBoolPreference preferences_bool[] =
|
|
|
8063f1 |
TRUE,
|
|
|
8063f1 |
},
|
|
|
8063f1 |
{
|
|
|
8063f1 |
+ { "new-windows-always-on-top",
|
|
|
8063f1 |
+ SCHEMA_METACITY,
|
|
|
8063f1 |
+ META_PREF_NEW_WINDOWS_ALWAYS_ON_TOP,
|
|
|
8063f1 |
+ },
|
|
|
8063f1 |
+ &new_windows_always_on_top,
|
|
|
8063f1 |
+ TRUE,
|
|
|
8063f1 |
+ },
|
|
|
8063f1 |
+ {
|
|
|
8063f1 |
{ "titlebar-uses-system-font",
|
|
|
8063f1 |
SCHEMA_GENERAL,
|
|
|
8063f1 |
META_PREF_TITLEBAR_FONT, /* note! shares a pref */
|
|
|
8063f1 |
@@ -920,6 +929,12 @@ meta_prefs_get_raise_on_click (void)
|
|
|
8063f1 |
return raise_on_click || focus_mode == G_DESKTOP_FOCUS_MODE_CLICK;
|
|
|
8063f1 |
}
|
|
|
8063f1 |
|
|
|
8063f1 |
+gboolean
|
|
|
8063f1 |
+meta_prefs_get_new_windows_always_on_top (void)
|
|
|
8063f1 |
+{
|
|
|
8063f1 |
+ return new_windows_always_on_top;
|
|
|
8063f1 |
+}
|
|
|
8063f1 |
+
|
|
|
8063f1 |
const char*
|
|
|
8063f1 |
meta_prefs_get_theme (void)
|
|
|
8063f1 |
{
|
|
|
8063f1 |
@@ -1386,7 +1401,10 @@ meta_preference_to_string (MetaPreference pref)
|
|
|
8063f1 |
|
|
|
8063f1 |
case META_PREF_RAISE_ON_CLICK:
|
|
|
8063f1 |
return "RAISE_ON_CLICK";
|
|
|
8063f1 |
-
|
|
|
8063f1 |
+
|
|
|
8063f1 |
+ case META_PREF_NEW_WINDOWS_ALWAYS_ON_TOP:
|
|
|
8063f1 |
+ return "NEW_WINDOWS_ALWAYS_ON_TOP";
|
|
|
8063f1 |
+
|
|
|
8063f1 |
case META_PREF_THEME:
|
|
|
8063f1 |
return "THEME";
|
|
|
8063f1 |
|
|
|
8063f1 |
diff --git a/src/core/window.c b/src/core/window.c
|
|
|
8063f1 |
index 6f5c280..b6a69b0 100644
|
|
|
8063f1 |
--- a/src/core/window.c
|
|
|
8063f1 |
+++ b/src/core/window.c
|
|
|
8063f1 |
@@ -2008,7 +2008,7 @@ window_state_on_map (MetaWindow *window,
|
|
|
8063f1 |
if (!(window->input || window->take_focus))
|
|
|
8063f1 |
{
|
|
|
8063f1 |
*takes_focus = FALSE;
|
|
|
8063f1 |
- return;
|
|
|
8063f1 |
+ goto out;
|
|
|
8063f1 |
}
|
|
|
8063f1 |
|
|
|
8063f1 |
/* Terminal usage may be different; some users intend to launch
|
|
|
8063f1 |
@@ -2055,6 +2055,10 @@ window_state_on_map (MetaWindow *window,
|
|
|
8063f1 |
/* The default is correct for these */
|
|
|
8063f1 |
break;
|
|
|
8063f1 |
}
|
|
|
8063f1 |
+
|
|
|
8063f1 |
+ out:
|
|
|
8063f1 |
+ if (meta_prefs_get_new_windows_always_on_top ())
|
|
|
8063f1 |
+ *places_on_top = TRUE;
|
|
|
8063f1 |
}
|
|
|
8063f1 |
|
|
|
8063f1 |
static gboolean
|
|
|
8063f1 |
diff --git a/src/include/prefs.h b/src/include/prefs.h
|
|
|
8063f1 |
index b86843c..c49e93d 100644
|
|
|
8063f1 |
--- a/src/include/prefs.h
|
|
|
8063f1 |
+++ b/src/include/prefs.h
|
|
|
8063f1 |
@@ -37,6 +37,7 @@ typedef enum
|
|
|
8063f1 |
META_PREF_FOCUS_MODE,
|
|
|
8063f1 |
META_PREF_FOCUS_NEW_WINDOWS,
|
|
|
8063f1 |
META_PREF_RAISE_ON_CLICK,
|
|
|
8063f1 |
+ META_PREF_NEW_WINDOWS_ALWAYS_ON_TOP,
|
|
|
8063f1 |
META_PREF_ACTION_DOUBLE_CLICK_TITLEBAR,
|
|
|
8063f1 |
META_PREF_ACTION_MIDDLE_CLICK_TITLEBAR,
|
|
|
8063f1 |
META_PREF_ACTION_RIGHT_CLICK_TITLEBAR,
|
|
|
8063f1 |
@@ -81,6 +82,7 @@ guint meta_prefs_get_mouse_button_menu (void);
|
|
|
8063f1 |
GDesktopFocusMode meta_prefs_get_focus_mode (void);
|
|
|
8063f1 |
GDesktopFocusNewWindows meta_prefs_get_focus_new_windows (void);
|
|
|
8063f1 |
gboolean meta_prefs_get_raise_on_click (void);
|
|
|
8063f1 |
+gboolean meta_prefs_get_new_windows_always_on_top (void);
|
|
|
8063f1 |
const char* meta_prefs_get_theme (void);
|
|
|
8063f1 |
/* returns NULL if GTK default should be used */
|
|
|
8063f1 |
const PangoFontDescription* meta_prefs_get_titlebar_font (void);
|
|
|
8063f1 |
diff --git a/src/metacity-schemas.convert b/src/metacity-schemas.convert
|
|
|
8063f1 |
index 9c271c6..f1fce08 100644
|
|
|
8063f1 |
--- a/src/metacity-schemas.convert
|
|
|
8063f1 |
+++ b/src/metacity-schemas.convert
|
|
|
8063f1 |
@@ -2,3 +2,4 @@
|
|
|
8063f1 |
compositing-manager = /apps/metacity/general/compositing_manager
|
|
|
8063f1 |
reduced-resources = /apps/metacity/general/reduced_resources
|
|
|
8063f1 |
no-focus-windows = /apps/metacity/general/no_focus_windows
|
|
|
8063f1 |
+new-windows-always-on-top = /apps/metacity/general/new_windows_always_on_top
|
|
|
8063f1 |
diff --git a/src/org.gnome.metacity.gschema.xml.in b/src/org.gnome.metacity.gschema.xml.in
|
|
|
8063f1 |
index e4f86bd..d69d525 100644
|
|
|
8063f1 |
--- a/src/org.gnome.metacity.gschema.xml.in
|
|
|
8063f1 |
+++ b/src/org.gnome.metacity.gschema.xml.in
|
|
|
8063f1 |
@@ -46,6 +46,28 @@
|
|
|
8063f1 |
this setting.
|
|
|
8063f1 |
</_description>
|
|
|
8063f1 |
</key>
|
|
|
8063f1 |
+ <key name="new-windows-always-on-top" type="b">
|
|
|
8063f1 |
+ <default>false</default>
|
|
|
8063f1 |
+ <_summary>Whether new windows should always be placed on top</_summary>
|
|
|
8063f1 |
+ <_description>
|
|
|
8063f1 |
+ The normal behavior is that if a new window is not given the
|
|
|
8063f1 |
+ focus (since, for example, the user has interacted with another
|
|
|
8063f1 |
+ window after launching an application), then if the window would
|
|
|
8063f1 |
+ be stacked on top of the focus window, the window is instead
|
|
|
8063f1 |
+ stacked beneath and flashed in the taskbar. This behavior can
|
|
|
8063f1 |
+ be annoying on large screens and multihead setups where the
|
|
|
8063f1 |
+ taskbar is hard to notice and difficult to get to, so this option,
|
|
|
8063f1 |
+ if set, disables this behavior, and new windows are always placed
|
|
|
8063f1 |
+ on top, whether or not they get focus.
|
|
|
8063f1 |
+
|
|
|
8063f1 |
+ Note that if this option is set, a new window may completely hide
|
|
|
8063f1 |
+ the focus window but not get focus itself, which can be quite confusing
|
|
|
8063f1 |
+ to users. Also, note that setting this option breaks the normal
|
|
|
8063f1 |
+ invariant in the 'click' focus mode that the topmost window always
|
|
|
8063f1 |
+ has focus, so its most suitable for use with the 'mouse' and
|
|
|
8063f1 |
+ 'sloppy' focus modes.
|
|
|
8063f1 |
+ </_description>
|
|
|
8063f1 |
+ </key>
|
|
|
8063f1 |
</schema>
|
|
|
8063f1 |
|
|
|
8063f1 |
</schemalist>
|
|
|
8063f1 |
--
|
|
|
8063f1 |
1.7.9
|
|
|
8063f1 |
|