mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
backends/x11: Fix key repeat of on-screen keyboard for second level keysyms
Certains keys (such as ~ and |) are in the keyboard map behind the second shift level. This means in order for them to be input, the shift key needs to be held down by the user. The GNOME Shell on-screen keyboard presents these keys separately on a page of keys that has no shift key. Instead, it relies on mutter to set a shift latch before the key event is emitted. A shift latch is a virtual press of the shift key that automatically gets released after the next key press (in our case the ~ or | key). The problem is using a shift latch doesn't work very well in the face of key repeat. The latch is automatically released after the first press, and subsequent repeats of that press no longer have shift latched to them. This commit fixes the problem by using a shift lock instead of a shift latch. A shift lock is never implicitly released, so it remains in place for the duration of key repeat. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2045>
This commit is contained in:
parent
8e1a125f70
commit
6060b6a240
@ -869,7 +869,7 @@ meta_keymap_x11_release_keycode_if_needed (MetaKeymapX11 *keymap_x11,
|
||||
}
|
||||
|
||||
void
|
||||
meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
|
||||
meta_keymap_x11_lock_modifiers (MetaKeymapX11 *keymap_x11,
|
||||
uint32_t level,
|
||||
gboolean enable)
|
||||
{
|
||||
@ -891,7 +891,7 @@ meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
|
||||
else
|
||||
value = 0;
|
||||
|
||||
XkbLatchModifiers (meta_clutter_x11_get_default_display (),
|
||||
XkbLockModifiers (meta_clutter_x11_get_default_display (),
|
||||
XkbUseCoreKbd, modifiers[level],
|
||||
value);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ gboolean meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11,
|
||||
guint keyval,
|
||||
guint *keycode_out,
|
||||
guint *level_out);
|
||||
void meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
|
||||
void meta_keymap_x11_lock_modifiers (MetaKeymapX11 *keymap_x11,
|
||||
uint32_t level,
|
||||
gboolean enable);
|
||||
gboolean meta_keymap_x11_reserve_keycode (MetaKeymapX11 *keymap_x11,
|
||||
|
@ -186,7 +186,7 @@ meta_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtual_
|
||||
|
||||
if (!meta_keymap_x11_get_is_modifier (keymap, keycode) &&
|
||||
key_state == CLUTTER_KEY_STATE_PRESSED)
|
||||
meta_keymap_x11_latch_modifiers (keymap, level, TRUE);
|
||||
meta_keymap_x11_lock_modifiers (keymap, level, TRUE);
|
||||
|
||||
XTestFakeKeyEvent (meta_clutter_x11_get_default_display (),
|
||||
(KeyCode) keycode,
|
||||
@ -196,7 +196,7 @@ meta_virtual_input_device_x11_notify_keyval (ClutterVirtualInputDevice *virtual_
|
||||
if (key_state == CLUTTER_KEY_STATE_RELEASED)
|
||||
{
|
||||
if (!meta_keymap_x11_get_is_modifier (keymap, keycode))
|
||||
meta_keymap_x11_latch_modifiers (keymap, level, FALSE);
|
||||
meta_keymap_x11_lock_modifiers (keymap, level, FALSE);
|
||||
meta_keymap_x11_release_keycode_if_needed (keymap, keycode);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user