diff options
Diffstat (limited to 'Add-nofocuswindows-preference-to-list-windows-that.patch')
-rw-r--r-- | Add-nofocuswindows-preference-to-list-windows-that.patch | 197 |
1 files changed, 108 insertions, 89 deletions
diff --git a/Add-nofocuswindows-preference-to-list-windows-that.patch b/Add-nofocuswindows-preference-to-list-windows-that.patch index de0eed4..bca6f10 100644 --- a/Add-nofocuswindows-preference-to-list-windows-that.patch +++ b/Add-nofocuswindows-preference-to-list-windows-that.patch @@ -1,14 +1,15 @@ -From 88c66808ec5f2bfba425fc6d6f0b9ac43ed44696 Mon Sep 17 00:00:00 2001 -From: Owen W. Taylor <otaylor@fishsoup.net> +From 60d38a7c6683001ee2beb72b8f0b0beee4f04bb4 Mon Sep 17 00:00:00 2001 +From: "Owen W. Taylor" <otaylor@fishsoup.net> Date: Wed, 21 Oct 2009 18:07:12 -0400 -Subject: [PATCH] Add no_focus_windows preference to list windows that shouldn't be focused +Subject: [PATCH] Add no-focus-windows preference to list windows that + shouldn't be focused Notification windows from legacy software that don't set _NET_WM_USER_TIME can be a huge annoyance for users, since they will pop up and steal focus. Add: - /apps/metacity/general/no_focus_windows + no-focus-windows which is a list of expressions identifying new windows that shouldn't ever be focused. For example: @@ -17,22 +18,23 @@ be focused. For example: https://bugzilla.gnome.org/show_bug.cgi?id=599248 --- - src/Makefile.am | 2 + - src/core/prefs.c | 43 ++++ - src/core/window-matcher.c | 582 ++++++++++++++++++++++++++++++++++++++++++++ - src/core/window-matcher.h | 46 ++++ - src/core/window.c | 9 +- - src/include/prefs.h | 6 +- - src/metacity.schemas.in.in | 28 ++ - 7 files changed, 714 insertions(+), 2 deletions(-) + src/Makefile.am | 2 + + src/core/prefs.c | 55 +++ + src/core/window-matcher.c | 582 +++++++++++++++++++++++++++++++++ + src/core/window-matcher.h | 46 +++ + src/core/window.c | 9 +- + src/include/prefs.h | 6 +- + src/metacity-schemas.convert | 1 + + src/org.gnome.metacity.gschema.xml.in | 21 ++ + 8 files changed, 720 insertions(+), 2 deletions(-) create mode 100644 src/core/window-matcher.c create mode 100644 src/core/window-matcher.h diff --git a/src/Makefile.am b/src/Makefile.am -index bd3420f..3baf422 100644 +index 4d405bf..2befe33 100644 --- a/src/Makefile.am +++ b/src/Makefile.am -@@ -65,6 +65,8 @@ metacity_SOURCES= \ +@@ -66,6 +66,8 @@ metacity_SOURCES= \ core/stack.h \ core/util.c \ include/util.h \ @@ -42,53 +44,61 @@ index bd3420f..3baf422 100644 core/window-props.h \ core/window.c \ diff --git a/src/core/prefs.c b/src/core/prefs.c -index 6e41b3c..e03c816 100644 +index 58f11e9..24a98cd 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c -@@ -25,6 +25,7 @@ +@@ -26,6 +26,7 @@ #include <config.h> #include "prefs.h" +#include "window-matcher.h" #include "ui.h" #include "util.h" - #ifdef HAVE_GCONF -@@ -76,6 +77,7 @@ static PangoFontDescription *titlebar_font = NULL; + #include <glib.h> +@@ -70,6 +71,7 @@ static PangoFontDescription *titlebar_font = NULL; static MetaVirtualModifier mouse_button_mods = Mod1Mask; - static MetaFocusMode focus_mode = META_FOCUS_MODE_CLICK; - static MetaFocusNewWindows focus_new_windows = META_FOCUS_NEW_WINDOWS_SMART; + static GDesktopFocusMode focus_mode = G_DESKTOP_FOCUS_MODE_CLICK; + static GDesktopFocusNewWindows focus_new_windows = G_DESKTOP_FOCUS_NEW_WINDOWS_SMART; +static GSList *no_focus_windows = NULL; static gboolean raise_on_click = TRUE; static char* current_theme = NULL; static int num_workspaces = 4; -@@ -147,6 +149,7 @@ static void maybe_give_disable_workarounds_warning (void); +@@ -120,6 +122,7 @@ static void maybe_give_disable_workarounds_warning (void); - static void titlebar_handler (MetaPreference, const gchar*, gboolean*); - static void theme_name_handler (MetaPreference, const gchar*, gboolean*); -+static void no_focus_windows_handler (MetaPreference, const gchar*, gboolean*); - static void mouse_button_mods_handler (MetaPreference, const gchar*, gboolean*); - static void button_layout_handler (MetaPreference, const gchar*, gboolean*); + static gboolean titlebar_handler (GVariant*, gpointer*, gpointer); + static gboolean theme_name_handler (GVariant*, gpointer*, gpointer); ++static gboolean no_focus_windows_handler (GVariant*, gpointer*, gpointer); + static gboolean mouse_button_mods_handler (GVariant*, gpointer*, gpointer); + static gboolean button_layout_handler (GVariant*, gpointer*, gpointer); -@@ -425,6 +428,11 @@ static MetaStringPreference preferences_string[] = - theme_name_handler, +@@ -367,6 +370,14 @@ static MetaStringPreference preferences_string[] = NULL, }, -+ { "/apps/metacity/general/no_focus_windows", -+ META_PREF_NO_FOCUS_WINDOWS, + { ++ { "no-focus-windows", ++ SCHEMA_METACITY, ++ META_PREF_NO_FOCUS_WINDOWS, ++ }, + no_focus_windows_handler, + NULL + }, - { KEY_TITLEBAR_FONT, - META_PREF_TITLEBAR_FONT, - titlebar_handler, -@@ -1344,6 +1352,30 @@ theme_name_handler (MetaPreference pref, ++ { + { KEY_TITLEBAR_FONT, + SCHEMA_GENERAL, + META_PREF_TITLEBAR_FONT, +@@ -998,6 +1009,39 @@ theme_name_handler (GVariant *value, } - static void -+no_focus_windows_handler (MetaPreference pref, -+ const gchar *string_value, -+ gboolean *inform_listeners) + static gboolean ++no_focus_windows_handler (GVariant *value, ++ gpointer *result, ++ gpointer data) +{ ++ const gchar *string_value; ++ ++ *result = NULL; /* ignored */ ++ string_value = g_variant_get_string (value, NULL); ++ + if (no_focus_windows) + { + meta_window_matcher_list_free (no_focus_windows); @@ -104,15 +114,19 @@ index 6e41b3c..e03c816 100644 + meta_warning ("Error parsing no_focus_windows='%s': %s\n", + string_value, error->message); + g_error_free (error); ++ ++ return FALSE; + } + } ++ ++ return TRUE; +} + -+static void - mouse_button_mods_handler (MetaPreference pref, - const gchar *string_value, - gboolean *inform_listeners) -@@ -1755,6 +1787,9 @@ meta_preference_to_string (MetaPreference pref) ++static gboolean + mouse_button_mods_handler (GVariant *value, + gpointer *result, + gpointer data) +@@ -1414,6 +1458,9 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_FORCE_FULLSCREEN: return "FORCE_FULLSCREEN"; @@ -122,7 +136,7 @@ index 6e41b3c..e03c816 100644 } return "(unknown)"; -@@ -2633,6 +2668,14 @@ meta_prefs_get_action_right_click_titlebar (void) +@@ -1710,6 +1757,14 @@ meta_prefs_get_action_right_click_titlebar (void) } gboolean @@ -139,7 +153,7 @@ index 6e41b3c..e03c816 100644 return auto_raise; diff --git a/src/core/window-matcher.c b/src/core/window-matcher.c new file mode 100644 -index 0000000..e2fd293 +index 0000000..df889eb --- /dev/null +++ b/src/core/window-matcher.c @@ -0,0 +1,582 @@ @@ -778,10 +792,10 @@ index 0000000..7fc7826 + const char *window_class); +#endif /* META_WINDOW_MATCHER_H */ diff --git a/src/core/window.c b/src/core/window.c -index 8d029a2..10da47a 100644 +index 2f2f800..5440160 100644 --- a/src/core/window.c +++ b/src/core/window.c -@@ -1965,7 +1965,14 @@ window_state_on_map (MetaWindow *window, +@@ -1981,7 +1981,14 @@ window_state_on_map (MetaWindow *window, { gboolean intervening_events; @@ -798,7 +812,7 @@ index 8d029a2..10da47a 100644 *takes_focus = !intervening_events; *places_on_top = *takes_focus; diff --git a/src/include/prefs.h b/src/include/prefs.h -index a4193ff..6698dfe 100644 +index 673cb36..b86843c 100644 --- a/src/include/prefs.h +++ b/src/include/prefs.h @@ -60,7 +60,8 @@ typedef enum @@ -811,9 +825,9 @@ index a4193ff..6698dfe 100644 } MetaPreference; typedef void (* MetaPrefsChangedFunc) (MetaPreference pref, -@@ -106,6 +107,9 @@ MetaActionTitlebar meta_prefs_get_action_double_click_titlebar (void); - MetaActionTitlebar meta_prefs_get_action_middle_click_titlebar (void); - MetaActionTitlebar meta_prefs_get_action_right_click_titlebar (void); +@@ -105,6 +106,9 @@ GDesktopTitlebarAction meta_prefs_get_action_double_click_titlebar (void); + GDesktopTitlebarAction meta_prefs_get_action_middle_click_titlebar (void); + GDesktopTitlebarAction meta_prefs_get_action_right_click_titlebar (void); +gboolean meta_prefs_window_is_no_focus (const char *window_name, + const char *window_class); @@ -821,42 +835,47 @@ index a4193ff..6698dfe 100644 void meta_prefs_set_num_workspaces (int n_workspaces); const char* meta_prefs_get_workspace_name (int i); -diff --git a/src/metacity.schemas.in.in b/src/metacity.schemas.in.in -index a9dd397..34cd7d6 100644 ---- a/src/metacity.schemas.in.in -+++ b/src/metacity.schemas.in.in -@@ -100,6 +100,34 @@ - </schema> +diff --git a/src/metacity-schemas.convert b/src/metacity-schemas.convert +index 46f3104..9c271c6 100644 +--- a/src/metacity-schemas.convert ++++ b/src/metacity-schemas.convert +@@ -1,3 +1,4 @@ + [org.gnome.metacity] + compositing-manager = /apps/metacity/general/compositing_manager + reduced-resources = /apps/metacity/general/reduced_resources ++no-focus-windows = /apps/metacity/general/no_focus_windows +diff --git a/src/org.gnome.metacity.gschema.xml.in b/src/org.gnome.metacity.gschema.xml.in +index 8fcdd7c..6900fa6 100644 +--- a/src/org.gnome.metacity.gschema.xml.in ++++ b/src/org.gnome.metacity.gschema.xml.in +@@ -22,6 +22,27 @@ + However, the wireframe feature is disabled when accessibility is on. + </_description> + </key> ++ <key name="no-focus-windows" type="s"> ++ <default>''</default> ++ <_summary>New windows that shouldn't get focus</_summary> ++ <_description> ++ This option provides a way to specify new windows that shouldn't get ++ focus. Normally an application specifies whether or not it gets focus ++ by setting the _NET_WM_USER_TIME property, but legacy applications ++ may not set this, which can cause unwanted focus stealing. ++ ++ The contents of this property is a space-separated list of expressions ++ to match against windows. If any of the expressions match a window ++ then the window will not get focus. The syntax of expressions is: ++ ++ (eq [name|class] "<value>"): window name (title) or the class from ++ WM_CLASS matches <value> exactly. ++ (glob [name|class] "<glob>"): window name (title) or the class from ++ WM_CLASS matches the shell-style glob pattern <glob>. ++ (and <expr> <expr>) (or <expr> <expr>) (not <expr): Boolean combinations ++ of expressions. ++ </_description> ++ </key> + </schema> - <schema> -+ <key>/schemas/apps/metacity/general/no_focus_windows</key> -+ <applyto>/apps/metacity/general/no_focus_windows</applyto> -+ <owner>metacity</owner> -+ <type>string</type> -+ <default></default> -+ <locale name="C"> -+ <short>New windows that shouldn't get focus</short> -+ <long> -+ This option provides a way to specify new windows that shouldn't get -+ focus. Normally an application specifies whether or not it gets focus -+ by setting the _NET_WM_USER_TIME property, but legacy applications -+ may not set this, which can cause unwanted focus stealing. -+ -+ The contents of this property is a space-separated list of expressions -+ to match against windows. If any of the expressions match a window -+ then the window will not get focus. The syntax of expressions is: -+ -+ (eq [name|class] "<value>"): window name (title) or the class from -+ WM_CLASS matches <value> exactly. -+ (glob [name|class] "<glob>"): window name (title) or the class from -+ WM_CLASS matches the shell-style glob pattern <glob>. -+ (and <expr> <expr>) (or <expr> <expr>) (not <expr): Boolean combinations -+ of expressions. -+ </long> -+ </locale> -+ </schema> -+ -+ <schema> - <key>/schemas/apps/metacity/general/raise_on_click</key> - <applyto>/apps/metacity/general/raise_on_click</applyto> - <owner>metacity</owner> + </schemalist> +-- +1.7.9 + |