[Spice-commits] src/vncdisplaykeymap.c

Christophe Fergau teuf at kemper.freedesktop.org
Thu Mar 15 13:05:37 UTC 2018


 src/vncdisplaykeymap.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 28e3dc34424f5e5b0441f2341d777ae4362363f0
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Fri Mar 9 09:30:00 2018 +0100

    Use scancode instead of keycode names
    
    When running on Xwayland, the keycode mapping property is not available,
    which causes unknown keycode mapping errors and the keyboard doesn't
    work.
    
    Check for a known scancode (“XK_Page_Up”) which differs to distinguish
    between “xfree86” and “evdev” when the there is no keycode name.
    
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
    Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
    Acked-by: Christophe Fergeau <cfergeau at redhat.com>

diff --git a/src/vncdisplaykeymap.c b/src/vncdisplaykeymap.c
index 2a79213..86cc6bd 100644
--- a/src/vncdisplaykeymap.c
+++ b/src/vncdisplaykeymap.c
@@ -174,11 +174,13 @@ const guint16 *vnc_display_keymap_gdk2xtkbd_table(GdkWindow *window,
 			VNC_DEBUG("Using xquartz keycode mapping");
 			*maplen = G_N_ELEMENTS(keymap_xorgxquartz2xtkbd);
 			return keymap_xorgxquartz2xtkbd;
-		} else if (keycodes && STRPREFIX(keycodes, "evdev")) {
+		} else if ((keycodes && STRPREFIX(keycodes, "evdev")) ||
+			   (XKeysymToKeycode(xdisplay, XK_Page_Up) == 0x70)) {
 			VNC_DEBUG("Using evdev keycode mapping");
 			*maplen = G_N_ELEMENTS(keymap_xorgevdev2xtkbd);
 			return keymap_xorgevdev2xtkbd;
-		} else if (keycodes && STRPREFIX(keycodes, "xfree86")) {
+		} else if ((keycodes && STRPREFIX(keycodes, "xfree86")) ||
+			   (XKeysymToKeycode(xdisplay, XK_Page_Up) == 0x63)) {
 			VNC_DEBUG("Using xfree86 keycode mapping");
 			*maplen = G_N_ELEMENTS(keymap_xorgkbd2xtkbd);
 			return keymap_xorgkbd2xtkbd;


More information about the Spice-commits mailing list