[Spice-devel] [PATCH v2] Use scancode instead of keycode names
Daniel P. Berrangé
berrange at redhat.com
Mon Mar 12 16:41:52 UTC 2018
On Fri, Mar 09, 2018 at 09:30:00AM +0100, Olivier Fourdan wrote:
> 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>
> ---
> v2: Keep old code as requested, use scancodes to complement the check
> instead of replacing the previous logic entirely, as per the review
> on https://patchwork.freedesktop.org/patch/209141/.
>
> src/vncdisplaykeymap.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/src/vncdisplaykeymap.c b/src/vncdisplaykeymap.c
> index 9ee501d..c86364b 100644
> --- a/src/vncdisplaykeymap.c
> +++ b/src/vncdisplaykeymap.c
> @@ -195,11 +195,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;
Thanks, v2 looks alot nicer to me
Reviewed-by: Daniel P. Berrangé <berrange at redhat.com>
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the Spice-devel
mailing list