[Spice-devel] [PATCH spice-gtk] vncdisplaykeymap: add wayland support

Marc-André Lureau marcandre.lureau at gmail.com
Sun May 12 16:13:21 PDT 2013


The Wayland keycode are just Linux evdev, but the Gdk backend
add the +8 offset used by Xorg evdev.
---
 gtk/vncdisplaykeymap.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/gtk/vncdisplaykeymap.c b/gtk/vncdisplaykeymap.c
index 8b01294..6d75424 100644
--- a/gtk/vncdisplaykeymap.c
+++ b/gtk/vncdisplaykeymap.c
@@ -59,10 +59,19 @@ static struct {
 
 static unsigned int ref_count_for_untranslated_keys = 0;
 
+#ifdef GDK_WINDOWING_WAYLAND
+#include <gdk/gdkwayland.h>
+#endif
+
 #ifdef GDK_WINDOWING_BROADWAY
 #include <gdk/gdkbroadway.h>
 #endif
 
+#if defined(GDK_WINDOWING_X11) || defined(GDK_WINDOWING_WAYLAND)
+/* Xorg Linux + evdev (offset evdev keycodes) */
+#include "vncdisplaykeymap_xorgevdev2xtkbd.c"
+#endif
+
 #ifdef GDK_WINDOWING_X11
 #include <gdk/gdkx.h>
 #include <X11/XKBlib.h>
@@ -225,6 +234,14 @@ const guint16 const *vnc_display_keymap_gdk2xtkbd_table(GdkWindow *window,
 	}
 #endif
 
+#ifdef GDK_WINDOWING_WAYLAND
+	if (GDK_IS_WAYLAND_WINDOW(window)) {
+		VNC_DEBUG("Using Wayland Xorg/evdev virtual keycode mapping");
+		*maplen = G_N_ELEMENTS(keymap_xorgevdev2xtkbd);
+		return keymap_xorgevdev2xtkbd;
+        }
+#endif
+
 #ifdef GDK_WINDOWING_BROADWAY
 	if (GDK_IS_BROADWAY_WINDOW(window)) {
                 g_warning("experimental: using broadway, x11 virtual keysym mapping - with very limited support. See also https://bugzilla.gnome.org/show_bug.cgi?id=700105");
-- 
1.8.2.1.342.gfa7285d



More information about the Spice-devel mailing list