[mutter/wip/carlosg/locate-pointer-in-other-keybindings: 225/225] keybindings: Check the special modifiers specifically
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/carlosg/locate-pointer-in-other-keybindings: 225/225] keybindings: Check the special modifiers specifically
- Date: Thu, 12 Mar 2020 19:04:35 +0000 (UTC)
commit 4d81d541f1caaabdcb37082f66d7a718e1104ca0
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Mar 12 19:43:15 2020 +0100
keybindings: Check the special modifiers specifically
Make it sure it is only the special modifier (optimized to 1 currently)
which is being pressed before notifying that the special modifier is
pressed, as we are interested on it being pressed alone and not in
combination with other modifiers.
This helps in two ways:
- Pressing alt, then ctrl, then releasing both won't trigger the locate
pointer action.
- Pressing alt, then ctrl, then down/up to switch workspace won't interpret
the last up/down keypress as an additional key on top of the special ctrl
modifier, thus won't be forwarded down to the focused client in the last
second.
Closes: https://gitlab.gnome.org/GNOME/mutter/issues/812
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1014
src/core/keybindings.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
---
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index 2d1697efc..a486a0fc1 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -101,6 +101,16 @@ resolved_key_combo_has_keycode (MetaResolvedKeyCombo *resolved_combo,
return FALSE;
}
+static gboolean
+resolved_key_combo_is_keycode (MetaResolvedKeyCombo *resolved_combo,
+ int keycode)
+{
+ if (resolved_combo->len > 1)
+ return FALSE;
+
+ return resolved_combo->keycodes[0] == keycode;
+}
+
static gboolean
resolved_key_combo_intersect (MetaResolvedKeyCombo *a,
MetaResolvedKeyCombo *b)
@@ -2114,8 +2124,9 @@ process_special_modifier_key (MetaDisplay *display,
return TRUE;
}
else if (event->type == CLUTTER_KEY_PRESS &&
- resolved_key_combo_has_keycode (resolved_key_combo,
- event->hardware_keycode))
+ event->modifier_state == 0 &&
+ resolved_key_combo_is_keycode (resolved_key_combo,
+ event->hardware_keycode))
{
*modifier_press_only = TRUE;
/* We keep the keyboard frozen - this allows us to use ReplayKeyboard
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]