mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
core: Ignore locked modifiers in keycombo machinery
Locked modifiers should probably not have an effect on keybindings while toggled. this is most relevant for modifiers that can be either/both pressed or locked (e.g. Caps Lock key), if used in keybindings. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3369>
This commit is contained in:
parent
38228da550
commit
8cae7ff0f6
@ -1896,6 +1896,16 @@ meta_key_binding_has_handler_func (MetaKeyBinding *binding)
|
|||||||
return (!!binding->handler->func || !!binding->handler->default_func);
|
return (!!binding->handler->func || !!binding->handler->default_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static ClutterModifierType
|
||||||
|
get_modifiers (ClutterEvent *event)
|
||||||
|
{
|
||||||
|
ClutterModifierType pressed, latched;
|
||||||
|
|
||||||
|
clutter_event_get_key_state (event, &pressed, &latched, NULL);
|
||||||
|
|
||||||
|
return pressed | latched;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
process_event (MetaDisplay *display,
|
process_event (MetaDisplay *display,
|
||||||
MetaWindow *window,
|
MetaWindow *window,
|
||||||
@ -1906,14 +1916,14 @@ process_event (MetaDisplay *display,
|
|||||||
(xkb_keycode_t) clutter_event_get_key_code ((ClutterEvent *) event);
|
(xkb_keycode_t) clutter_event_get_key_code ((ClutterEvent *) event);
|
||||||
MetaResolvedKeyCombo resolved_combo = { &keycode, 1 };
|
MetaResolvedKeyCombo resolved_combo = { &keycode, 1 };
|
||||||
MetaKeyBinding *binding;
|
MetaKeyBinding *binding;
|
||||||
|
ClutterModifierType modifiers;
|
||||||
|
|
||||||
/* we used to have release-based bindings but no longer. */
|
/* we used to have release-based bindings but no longer. */
|
||||||
if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE)
|
if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
resolved_combo.mask =
|
modifiers = get_modifiers ((ClutterEvent *) event);
|
||||||
mask_from_event_params (keys,
|
resolved_combo.mask = mask_from_event_params (keys, modifiers);
|
||||||
clutter_event_get_state ((ClutterEvent *) event));
|
|
||||||
|
|
||||||
binding = get_keybinding (keys, &resolved_combo);
|
binding = get_keybinding (keys, &resolved_combo);
|
||||||
|
|
||||||
@ -1995,7 +2005,7 @@ process_special_modifier_key (MetaDisplay *display,
|
|||||||
hardware_keycode = clutter_event_get_key_code ((ClutterEvent *) event);
|
hardware_keycode = clutter_event_get_key_code ((ClutterEvent *) event);
|
||||||
time_ms = clutter_event_get_time ((ClutterEvent *) event);
|
time_ms = clutter_event_get_time ((ClutterEvent *) event);
|
||||||
device = clutter_event_get_device ((ClutterEvent *) event);
|
device = clutter_event_get_device ((ClutterEvent *) event);
|
||||||
modifiers = clutter_event_get_state ((ClutterEvent *) event);
|
modifiers = get_modifiers ((ClutterEvent *) event);
|
||||||
|
|
||||||
if (*modifier_press_only)
|
if (*modifier_press_only)
|
||||||
{
|
{
|
||||||
@ -2167,6 +2177,7 @@ process_iso_next_group (MetaDisplay *display,
|
|||||||
gboolean activate;
|
gboolean activate;
|
||||||
xkb_keycode_t keycode =
|
xkb_keycode_t keycode =
|
||||||
(xkb_keycode_t) clutter_event_get_key_code ((ClutterEvent *) event);
|
(xkb_keycode_t) clutter_event_get_key_code ((ClutterEvent *) event);
|
||||||
|
ClutterModifierType modifiers;
|
||||||
xkb_mod_mask_t mask;
|
xkb_mod_mask_t mask;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
@ -2174,8 +2185,8 @@ process_iso_next_group (MetaDisplay *display,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
activate = FALSE;
|
activate = FALSE;
|
||||||
mask = mask_from_event_params (keys,
|
modifiers = get_modifiers ((ClutterEvent *) event);
|
||||||
clutter_event_get_state ((ClutterEvent *) event));
|
mask = mask_from_event_params (keys, modifiers);
|
||||||
|
|
||||||
for (i = 0; i < keys->n_iso_next_group_combos; ++i)
|
for (i = 0; i < keys->n_iso_next_group_combos; ++i)
|
||||||
{
|
{
|
||||||
@ -3954,15 +3965,15 @@ process_keybinding_key_event (MetaDisplay *display,
|
|||||||
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
||||||
xkb_keycode_t keycode =
|
xkb_keycode_t keycode =
|
||||||
(xkb_keycode_t) clutter_event_get_key_code ((ClutterEvent *) event);
|
(xkb_keycode_t) clutter_event_get_key_code ((ClutterEvent *) event);
|
||||||
|
ClutterModifierType modifiers;
|
||||||
MetaResolvedKeyCombo resolved_combo = { &keycode, 1 };
|
MetaResolvedKeyCombo resolved_combo = { &keycode, 1 };
|
||||||
MetaKeyBinding *binding;
|
MetaKeyBinding *binding;
|
||||||
|
|
||||||
if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE)
|
if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
resolved_combo.mask =
|
modifiers = get_modifiers ((ClutterEvent *) event);
|
||||||
mask_from_event_params (keys,
|
resolved_combo.mask = mask_from_event_params (keys, modifiers);
|
||||||
clutter_event_get_state ((ClutterEvent *) event));
|
|
||||||
|
|
||||||
binding = get_keybinding (keys, &resolved_combo);
|
binding = get_keybinding (keys, &resolved_combo);
|
||||||
if (!binding)
|
if (!binding)
|
||||||
|
Loading…
Reference in New Issue
Block a user