keybindings: Check for ISO_Next_Group keysym
In process_iso_next_group(), we would use try to match mask and keycode of ISO_Next_Group to tell whether the key combo has been activated. That works on X11, but not on Wayland with the native backend, because the keycode does not match. But we do not need to go all through that burden to match the key combo we could just use the keysym instead, which would work even when there is no physical key for ISO_Next_Group. All we need to do is check whether the symbol is ISO_Next_Group and the modifier mask matches, which simplifies the code as well. (Note that we still need to keep the resolved iso_next_group_combo key combo around because the X11 backend grabs that key combo.) Closes: https://gitlab.gnome.org/GNOME/mutter/-/issues/3883 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4232>
This commit is contained in:
parent
1463ddde66
commit
48d070dae7
@ -1701,40 +1701,34 @@ process_iso_next_group (MetaDisplay *display,
|
||||
MetaContext *context = meta_display_get_context (display);
|
||||
MetaBackend *backend = meta_context_get_backend (context);
|
||||
MetaKeyBindingManager *keys = &display->key_binding_manager;
|
||||
gboolean activate;
|
||||
xkb_keycode_t keycode =
|
||||
(xkb_keycode_t) clutter_event_get_key_code (event);
|
||||
uint32_t keyval = clutter_event_get_key_symbol (event);
|
||||
ClutterModifierType modifiers;
|
||||
xkb_mod_mask_t mask;
|
||||
int i, j;
|
||||
xkb_mod_mask_t iso_next_group_combo_mask;
|
||||
int i;
|
||||
|
||||
if (clutter_event_type (event) == CLUTTER_KEY_RELEASE)
|
||||
return FALSE;
|
||||
|
||||
activate = FALSE;
|
||||
modifiers = get_modifiers (event);
|
||||
mask = mask_from_event_params (keys, modifiers);
|
||||
|
||||
iso_next_group_combo_mask = 0;
|
||||
for (i = 0; i < keys->n_iso_next_group_combos; ++i)
|
||||
iso_next_group_combo_mask |= keys->iso_next_group_combo[i].mask;
|
||||
|
||||
if (keyval == XKB_KEY_ISO_Next_Group &&
|
||||
(mask & iso_next_group_combo_mask) == iso_next_group_combo_mask)
|
||||
{
|
||||
for (j = 0; j < keys->iso_next_group_combo[i].len; ++j)
|
||||
{
|
||||
if (keycode == keys->iso_next_group_combo[i].keycodes[j] &&
|
||||
mask == keys->iso_next_group_combo[i].mask)
|
||||
{
|
||||
/* If the signal handler returns TRUE the keyboard will
|
||||
remain frozen. It's the signal handler's responsibility
|
||||
to unfreeze it. */
|
||||
if (!meta_display_modifiers_accelerator_activate (display))
|
||||
meta_backend_unfreeze_keyboard (backend,
|
||||
clutter_event_get_time (event));
|
||||
activate = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* If the signal handler returns TRUE the keyboard will
|
||||
remain frozen. It's the signal handler's responsibility
|
||||
to unfreeze it. */
|
||||
if (!meta_display_modifiers_accelerator_activate (display))
|
||||
meta_backend_unfreeze_keyboard (backend,
|
||||
clutter_event_get_time (event));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return activate;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
Loading…
x
Reference in New Issue
Block a user