diff options
author | sparkida <[email protected]> | 2022-01-15 23:14:19 +0000 |
---|---|---|
committer | Luke from DC <[email protected]> | 2023-01-18 04:15:33 +0000 |
commit | d83cb24a27b1864be035868354a806287dbfaa92 (patch) | |
tree | 1e8987cd34887cdde1d31ad59f1dabcf7d57dc85 /src/core | |
parent | dcd5d21e4c53f1670b33cec78c96bdd3da87037d (diff) | |
download | marco-d83cb24a27b1864be035868354a806287dbfaa92.tar.bz2 marco-d83cb24a27b1864be035868354a806287dbfaa92.tar.xz |
Add setting to raise windows on alt+tab popup
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/keybindings.c | 19 | ||||
-rw-r--r-- | src/core/prefs.c | 17 |
2 files changed, 33 insertions, 3 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 2f782fa3..fb3131c2 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -2128,12 +2128,16 @@ process_tab_grab (MetaDisplay *display, return TRUE; key = meta_ui_tab_popup_get_selected (screen->tab_popup); - prev_window = meta_display_lookup_x_window (display, (Window) key); + prev_window = meta_display_lookup_x_window (display, (Window) key); action = display_get_keybinding_action (display, keysym, event->xkey.keycode, display->grab_mask); + gboolean raise_windows; + raise_windows = meta_prefs_get_alt_tab_raise_windows (); + gboolean escaped_alt_tab = FALSE; + /* Cancel when alt-Escape is pressed during using alt-Tab, and vice * versa. */ @@ -2153,6 +2157,15 @@ process_tab_grab (MetaDisplay *display, case META_GRAB_OP_KEYBOARD_ESCAPING_DOCK: /* carry on */ break; + case META_GRAB_OP_KEYBOARD_TABBING_NORMAL: + // handle escape pressed when using raise_windows with alt+tab + // in order to restore selected window in stack + if (raise_windows) + { + escaped_alt_tab = TRUE; + break; + } + return FALSE; default: return FALSE; } @@ -2223,7 +2236,7 @@ process_tab_grab (MetaDisplay *display, case META_KEYBINDING_ACTION_CYCLE_WINDOWS: case META_KEYBINDING_ACTION_CYCLE_GROUP: popup_not_showing = TRUE; - key_used = TRUE; + key_used = !escaped_alt_tab; break; case META_KEYBINDING_ACTION_CYCLE_PANELS_BACKWARD: case META_KEYBINDING_ACTION_CYCLE_WINDOWS_BACKWARD: @@ -2288,7 +2301,7 @@ process_tab_grab (MetaDisplay *display, else if (direction == UP) meta_ui_tab_popup_up (screen->tab_popup); - if (popup_not_showing) + if (popup_not_showing || raise_windows) { /* We can't actually change window focus, due to the grab. * but raise the window. diff --git a/src/core/prefs.c b/src/core/prefs.c index 1198113a..032bba8f 100644 --- a/src/core/prefs.c +++ b/src/core/prefs.c @@ -56,6 +56,7 @@ #define KEY_GENERAL_CENTER_NEW_WINDOWS "center-new-windows" #define KEY_GENERAL_ICON_SIZE "icon-size" #define KEY_GENERAL_ALT_TAB_MAX_COLUMNS "alt-tab-max-columns" +#define KEY_GENERAL_ALT_TAB_RAISE_WINDOWS "alt-tab-raise-windows" #define KEY_GENERAL_ALT_TAB_EXPAND_TO_FIT_TITLE "alt-tab-expand-to-fit-title" #define KEY_COMMAND_SCHEMA "org.mate.Marco.keybinding-commands" @@ -121,6 +122,7 @@ static char *cursor_theme = NULL; static int cursor_size = 24; static int icon_size = META_DEFAULT_ICON_SIZE; static int alt_tab_max_columns = META_DEFAULT_ALT_TAB_MAX_COLUMNS; +static gboolean alt_tab_raise_windows = META_DEFAULT_ALT_TAB_RAISE_WINDOWS; static gboolean alt_tab_expand_to_fit_title = META_DEFAULT_ALT_TAB_EXPAND_TO_FIT_TITLE; static gboolean use_force_compositor_manager = FALSE; static gboolean force_compositor_manager = FALSE; @@ -458,6 +460,12 @@ static MetaBoolPreference preferences_bool[] = &alt_tab_expand_to_fit_title, META_DEFAULT_ALT_TAB_EXPAND_TO_FIT_TITLE, }, + { "alt-tab-raise-windows", + KEY_GENERAL_SCHEMA, + META_PREF_ALT_TAB_RAISE_WINDOWS, + &alt_tab_raise_windows, + META_DEFAULT_ALT_TAB_RAISE_WINDOWS, + }, { NULL, NULL, 0, NULL, FALSE }, }; @@ -1162,6 +1170,12 @@ meta_prefs_get_alt_tab_expand_to_fit_title (void) } gboolean +meta_prefs_get_alt_tab_raise_windows (void) +{ + return alt_tab_raise_windows; +} + +gboolean meta_prefs_is_in_skip_list (char *class) { GList *item; @@ -1682,6 +1696,9 @@ meta_preference_to_string (MetaPreference pref) case META_PREF_ALT_TAB_EXPAND_TO_FIT_TITLE: return "ALT_TAB_EXPAND_TO_FIT_TITLE"; + case META_PREF_ALT_TAB_RAISE_WINDOWS: + return "ALT_TAB_RAISE_WINDOWS"; + case META_PREF_COMPOSITING_MANAGER: return "COMPOSITING_MANAGER"; |