Fix keyboard input under Xwayland

Resolves: rhbz#1512564
This commit is contained in:
Christophe Fergeau 2018-05-30 11:12:02 +02:00
parent 3a1ac02575
commit 9f70971206
2 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,42 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Fri, 9 Mar 2018 09:30:00 +0100
Subject: [spice-gtk] Use scancode instead of keycode names
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
---
src/vncdisplaykeymap.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/vncdisplaykeymap.c b/src/vncdisplaykeymap.c
index 2a792136..86cc6bde 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;

View File

@ -2,7 +2,7 @@
Name: spice-gtk
Version: 0.34
Release: 4%{?dist}
Release: 5%{?dist}
Summary: A GTK+ widget for SPICE clients
Group: System Environment/Libraries
@ -10,6 +10,7 @@ License: LGPLv2+
URL: http://spice-space.org/page/Spice-Gtk
#VCS: git:git://anongit.freedesktop.org/spice/spice-gtk
Source0: http://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2
Patch1: 0001-Use-scancode-instead-of-keycode-names.patch
BuildRequires: git-core
BuildRequires: intltool
@ -182,6 +183,10 @@ rm -f %{buildroot}%{_libdir}/*.la
%{_bindir}/spicy-stats
%changelog
* Wed May 30 2018 Christophe Fergeau <cfergeau@redhat.com> - 0.34-5
- Fix keyboard input under Xwayland
Resolves: rhbz#1512564
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.34-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild