[mutter/fix-key-repeat: 1/2] keymap-x11: Don't update key types when adding key to keymap




commit bd83494c1683eb7dfb65cd5bc44ea828bdbd2064
Author: Ray Strode <rstrode redhat com>
Date:   Mon Oct 4 14:53:04 2021 -0400

    keymap-x11: Don't update key types when adding key to keymap
    
    meta_keymap_x11_replace_keycode currently reports to the X server
    that the key types data is changed when adding a key to the keymap.
    
    It's not changed. The number of key types is the same, and none of
    them are modified.
    
    This has two bad side effects:
    
    1) It sends all of the key types data into the request
    2) It hits a bug in the X server leading to the request getting
    rejected entirely.  See:
    
    https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/761
    
    Furthmore, the changed structure used to report to the X server
    that the key types data is changed doesn't actually need to modified
    at all in the function.  It's already prepped by libX11 with the
    correct state for the changes mutter is doing when
    XkbChangeTypesOfKey is called.
    
    This commit addresses the above two problems by just removing the
    lines causing the issues.

 src/backends/x11/meta-keymap-x11.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/backends/x11/meta-keymap-x11.c b/src/backends/x11/meta-keymap-x11.c
index 994ad85943..bea8f4dd22 100644
--- a/src/backends/x11/meta-keymap-x11.c
+++ b/src/backends/x11/meta-keymap-x11.c
@@ -462,8 +462,13 @@ meta_keymap_x11_replace_keycode (MetaKeymapX11 *keymap_x11,
       if (keysym != NoSymbol)
         {
           int types[XkbNumKbdGroups] = { XkbOneLevelIndex };
-          XkbChangeTypesOfKey (xkb, keycode, 1, XkbGroup1Mask, types, &changes);
+
           XkbKeySymEntry (xkb, keycode, 0, 0) = keysym;
+          changes.changed = XkbKeySymsMask;
+          changes.first_key_sym = keycode;
+          changes.num_key_syms = 1;
+
+          XkbChangeTypesOfKey (xkb, keycode, 1, XkbGroup1Mask, types, &changes);
         }
       else
         {
@@ -471,11 +476,6 @@ meta_keymap_x11_replace_keycode (MetaKeymapX11 *keymap_x11,
           XkbChangeTypesOfKey (xkb, keycode, 0, XkbGroup1Mask, NULL, &changes);
         }
 
-      changes.changed = XkbKeySymsMask | XkbKeyTypesMask;
-      changes.first_key_sym = keycode;
-      changes.num_key_syms = 1;
-      changes.first_type = 0;
-      changes.num_types = xkb->map->num_types;
       XkbChangeMap (xdisplay, xkb, &changes);
 
       XFlush (xdisplay);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]