Skip to content

Commit

Permalink
ui: use evdev keymap when running under wayland
Browse files Browse the repository at this point in the history
Wayland always uses evdev as its input source, so QEMU
can use the existing evdev keymap data

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Tested-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20161201094117.16407-1-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit a8ffb37)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
berrange authored and mdroth committed Mar 16, 2017
1 parent 50b468d commit 3b33cba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/ui/gtk.h
Expand Up @@ -18,6 +18,10 @@
#include <X11/XKBlib.h>
#endif

#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif

#if defined(CONFIG_OPENGL)
#include "ui/egl-helpers.h"
#include "ui/egl-context.h"
Expand Down
7 changes: 7 additions & 0 deletions ui/gtk.c
Expand Up @@ -90,6 +90,9 @@
#ifndef GDK_IS_X11_DISPLAY
#define GDK_IS_X11_DISPLAY(dpy) (dpy == dpy)
#endif
#ifndef GDK_IS_WAYLAND_DISPLAY
#define GDK_IS_WAYLAND_DISPLAY(dpy) (dpy == dpy)
#endif
#ifndef GDK_IS_WIN32_DISPLAY
#define GDK_IS_WIN32_DISPLAY(dpy) (dpy == dpy)
#endif
Expand Down Expand Up @@ -1053,6 +1056,10 @@ static int gd_map_keycode(GtkDisplayState *s, GdkDisplay *dpy, int gdk_keycode)
} else {
qemu_keycode = translate_xfree86_keycode(gdk_keycode - 97);
}
#endif
#ifdef GDK_WINDOWING_WAYLAND
} else if (GDK_IS_WAYLAND_DISPLAY(dpy) && gdk_keycode < 158) {
qemu_keycode = translate_evdev_keycode(gdk_keycode - 97);
#endif
} else if (gdk_keycode == 208) { /* Hiragana_Katakana */
qemu_keycode = 0x70;
Expand Down

0 comments on commit 3b33cba

Please sign in to comment.