keybindings: Add "no-auto-grab" type

Some special modifiers (typically "Control_L" used for locate-pointer in
mutter/gnome-shell or "Super_L" for overlay) must be handled separately
from the rest of the key bindings.

Add a new flag `META_KEY_BINDING_NO_AUTO_GRAB` so we can tell when
dealing with that special keybinding which should not be grabbed
automatically like the rest of the keybindings, and skip those when
changing the grabs of all keybindings.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/685
This commit is contained in:
Olivier Fourdan 2019-07-15 17:24:35 +02:00 committed by Carlos Garnacho
parent b2ae03c428
commit 1c3d8defb5
2 changed files with 8 additions and 0 deletions

View File

@ -1463,6 +1463,12 @@ change_keygrab_foreach (gpointer key,
if (data->only_per_window != binding_is_per_window) if (data->only_per_window != binding_is_per_window)
return; return;
/* Ignore the key bindings marked as META_KEY_BINDING_NO_AUTO_GRAB,
* those are handled separately
*/
if (binding->flags & META_KEY_BINDING_NO_AUTO_GRAB)
return;
if (binding->resolved_combo.len == 0) if (binding->resolved_combo.len == 0)
return; return;

View File

@ -436,6 +436,7 @@ typedef enum _MetaKeyBindingAction
* @META_KEY_BINDING_BUILTIN: built-in * @META_KEY_BINDING_BUILTIN: built-in
* @META_KEY_BINDING_IS_REVERSED: is reversed * @META_KEY_BINDING_IS_REVERSED: is reversed
* @META_KEY_BINDING_NON_MASKABLE: always active * @META_KEY_BINDING_NON_MASKABLE: always active
* @META_KEY_BINDING_NO_AUTO_GRAB: not grabbed automatically
*/ */
typedef enum typedef enum
{ {
@ -445,6 +446,7 @@ typedef enum
META_KEY_BINDING_IS_REVERSED = 1 << 2, META_KEY_BINDING_IS_REVERSED = 1 << 2,
META_KEY_BINDING_NON_MASKABLE = 1 << 3, META_KEY_BINDING_NON_MASKABLE = 1 << 3,
META_KEY_BINDING_IGNORE_AUTOREPEAT = 1 << 4, META_KEY_BINDING_IGNORE_AUTOREPEAT = 1 << 4,
META_KEY_BINDING_NO_AUTO_GRAB = 1 << 5,
} MetaKeyBindingFlags; } MetaKeyBindingFlags;
/** /**