diff options
author | Illia Danko <[email protected]> | 2016-10-28 19:27:37 +0300 |
---|---|---|
committer | raveit65 <[email protected]> | 2017-01-17 20:22:29 +0100 |
commit | 238373df58d4ba275b7aead36f4d47971fbed18d (patch) | |
tree | 975bdff6ecfd6f57bb1755afc6f36544f9532596 /src | |
parent | fc8b044ed84265918f10674fc5a502bfada367bb (diff) | |
download | marco-238373df58d4ba275b7aead36f4d47971fbed18d.tar.bz2 marco-238373df58d4ba275b7aead36f4d47971fbed18d.tar.xz |
Added functionality to ignore applications while show-desktop is triggered
Diffstat (limited to 'src')
-rw-r--r-- | src/core/prefs.c | 50 | ||||
-rw-r--r-- | src/core/screen.c | 5 | ||||
-rw-r--r-- | src/include/prefs.h | 4 | ||||
-rw-r--r-- | src/org.mate.marco.gschema.xml | 5 |
4 files changed, 61 insertions, 3 deletions
diff --git a/src/core/prefs.c b/src/core/prefs.c index 8dd1008a..61c957ad 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -121,6 +121,7 @@ static gboolean show_tab_border = FALSE; static gboolean center_new_windows = FALSE; static gboolean force_fullscreen = TRUE; static gboolean side_by_side_tiling = FALSE; +static GList *show_desktop_skip_list = NULL; static MetaVisualBellType visual_bell_type = META_VISUAL_BELL_FULLSCREEN_FLASH; static MetaButtonLayout button_layout; @@ -159,6 +160,7 @@ static void titlebar_handler (MetaPreference, const gchar*, gboolean*); static void theme_name_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 void show_desktop_skip_list_handler (MetaPreference, const gchar*, gboolean*); static gboolean update_binding (MetaKeyPref *binding, gchar *value); @@ -467,6 +469,12 @@ static MetaStringPreference preferences_string[] = NULL, &cursor_theme, }, + { "show-desktop-skip-list", + KEY_GENERAL_SCHEMA, + META_PREF_SHOW_DESKTOP_SKIP_LIST, + &show_desktop_skip_list_handler, + NULL, + }, { NULL, NULL, 0, NULL, NULL }, }; @@ -1085,6 +1093,18 @@ meta_prefs_get_cursor_size (void) return cursor_size; } +gboolean +meta_prefs_is_in_skip_list (char *class) +{ + GList *item; + + for (item = show_desktop_skip_list; item; item = item->next) + { + if (!g_ascii_strcasecmp (class, item->data)) + return TRUE; + } + return FALSE; +} /****************************************************************************/ /* Handlers for string preferences. */ @@ -1172,6 +1192,33 @@ mouse_button_mods_handler (MetaPreference pref, } } +static void +show_desktop_skip_list_handler (MetaPreference pref, + const gchar *string_value, + gboolean *inform_listeners) +{ + gchar **tokens; + gchar **tok; + GList *item; + + if (show_desktop_skip_list) + { + for (item = show_desktop_skip_list; item; item = item->next) + g_free (item->data); + g_list_free (show_desktop_skip_list); + show_desktop_skip_list = NULL; + } + + if (!(tokens = g_strsplit (string_value, ",", -1))) + return; + for (tok = tokens; tok && *tok; tok++) + { + gchar *stripped = g_strstrip (g_strdup (*tok)); + show_desktop_skip_list = g_list_prepend (show_desktop_skip_list, stripped); + } + g_strfreev (tokens); +} + static gboolean button_layout_equal (const MetaButtonLayout *a, const MetaButtonLayout *b) @@ -1576,6 +1623,9 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_PLACEMENT_MODE: return "PLACEMENT_MODE"; + + case META_PREF_SHOW_DESKTOP_SKIP_LIST: + return "SHOW_DESKTOP_SKIP_LIST"; } return "(unknown)"; diff --git a/src/core/screen.c b/src/core/screen.c index 34016d51..98ecf4db 100644 --- a/src/core/screen.c +++ b/src/core/screen.c @@ -2447,7 +2447,7 @@ queue_windows_showing (MetaScreen *screen) { MetaWindow *w = tmp->data; - if (w->screen == screen) + if (w->screen == screen && !meta_prefs_is_in_skip_list (w->res_class)) meta_window_queue (w, META_QUEUE_CALC_SHOWING); tmp = tmp->next; @@ -2501,7 +2501,8 @@ meta_screen_show_desktop (MetaScreen *screen, MetaWindow *w = windows->data; if (w->screen == screen && - w->type == META_WINDOW_DESKTOP) + w->type == META_WINDOW_DESKTOP && + !meta_prefs_is_in_skip_list (w->res_class)) { meta_window_focus (w, timestamp); break; diff --git a/src/include/prefs.h b/src/include/prefs.h index 08983087..86178647 100644 --- a/src/include/prefs.h +++ b/src/include/prefs.h @@ -66,7 +66,8 @@ typedef enum META_PREF_CENTER_NEW_WINDOWS, META_PREF_SIDE_BY_SIDE_TILING, META_PREF_FORCE_FULLSCREEN, - META_PREF_PLACEMENT_MODE + META_PREF_PLACEMENT_MODE, + META_PREF_SHOW_DESKTOP_SKIP_LIST } MetaPreference; typedef void (* MetaPrefsChangedFunc) (MetaPreference pref, @@ -129,6 +130,7 @@ gboolean meta_prefs_get_compositing_fast_alt_tab (void); gboolean meta_prefs_get_center_new_windows (void); gboolean meta_prefs_get_force_fullscreen (void); gboolean meta_prefs_show_tab_border (void); +gboolean meta_prefs_is_in_skip_list (char *class); /** * Sets whether the compositor is turned on. diff --git a/src/org.mate.marco.gschema.xml b/src/org.mate.marco.gschema.xml index 5ffb0624..cfa4feb9 100644 --- a/src/org.mate.marco.gschema.xml +++ b/src/org.mate.marco.gschema.xml @@ -186,6 +186,11 @@ <summary>Window placement mode</summary> <description>The window placement mode indicates how new windows are positioned. "automatic" means the system chooses a location automatically based on the space available on the desktop, or by a simple cascade if there is no space; "pointer" means that new windows are placed according to the mouse pointer position; "manual" means that the user must manually place the new window with the mouse or keyboard.</description> </key> + <key name="show-desktop-skip-list" type="s"> + <default>''</default> + <summary>List of applications ignored by show-desktop</summary> + <description>Comma separated class list. Each running GUI application referenced to given windows manager class will be ignored by 'Show Desktop' functionality.</description> + </key> </schema> <schema id="org.mate.Marco.workspace-names" path="/org/mate/marco/workspace-names/"> |