[mutter/fix-key-repeat] backends/x11: Fix key repeat of on-screen keyboard for second level keysyms
- From: Ray Strode <halfline src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/fix-key-repeat] backends/x11: Fix key repeat of on-screen keyboard for second level keysyms
- Date: Thu, 7 Oct 2021 02:14:29 +0000 (UTC)
commit b68bf37069fd7fd6d0149019e5975e83b922f5f7
Author: Ray Strode <rstrode redhat com>
Date: Wed Oct 6 15:31:30 2021 -0400
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.
src/backends/x11/meta-keymap-x11.c | 12 ++++++------
src/backends/x11/meta-keymap-x11.h | 2 +-
src/backends/x11/meta-virtual-input-device-x11.c | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/src/backends/x11/meta-keymap-x11.c b/src/backends/x11/meta-keymap-x11.c
index 89542e8593..d29a858fee 100644
--- a/src/backends/x11/meta-keymap-x11.c
+++ b/src/backends/x11/meta-keymap-x11.c
@@ -869,9 +869,9 @@ meta_keymap_x11_release_keycode_if_needed (MetaKeymapX11 *keymap_x11,
}
void
-meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
- uint32_t level,
- gboolean enable)
+meta_keymap_x11_lock_modifiers (MetaKeymapX11 *keymap_x11,
+ uint32_t level,
+ gboolean enable)
{
uint32_t modifiers[] = {
0,
@@ -891,9 +891,9 @@ meta_keymap_x11_latch_modifiers (MetaKeymapX11 *keymap_x11,
else
value = 0;
- XkbLatchModifiers (meta_clutter_x11_get_default_display (),
- XkbUseCoreKbd, modifiers[level],
- value);
+ XkbLockModifiers (meta_clutter_x11_get_default_display (),
+ XkbUseCoreKbd, modifiers[level],
+ value);
}
static uint32_t
diff --git a/src/backends/x11/meta-keymap-x11.h b/src/backends/x11/meta-keymap-x11.h
index 67a5f8eb92..899c6a46ce 100644
--- a/src/backends/x11/meta-keymap-x11.h
+++ b/src/backends/x11/meta-keymap-x11.h
@@ -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,
diff --git a/src/backends/x11/meta-virtual-input-device-x11.c
b/src/backends/x11/meta-virtual-input-device-x11.c
index 54bb43ad1b..f6464fb918 100644
--- a/src/backends/x11/meta-virtual-input-device-x11.c
+++ b/src/backends/x11/meta-virtual-input-device-x11.c
@@ -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);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]