>From edec88edb24f5ec9abede2f3de7767f294c6cbc1 Mon Sep 17 00:00:00 2001 From: Remi Thebault Date: Sun, 21 Dec 2014 17:15:56 +0100 Subject: [PATCH 1/3] input: gtk win32 ui sends r-ctrl and r-alt key events gtk ui on win32 only sent left ctrl and alt code, whatever the keystroke. In case of a right keystroke and left scan code, this commit corrects the qemu code to fit the actual keystroke. Signed-off-by: Remi Thebault --- ui/gtk.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ui/gtk.c b/ui/gtk.c index 0385757..27696fa 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -901,7 +901,21 @@ static int gd_map_keycode(GtkDisplayState *s, GdkDisplay *dpy, int gdk_keycode) #ifdef GDK_WINDOWING_WIN32 if (GDK_IS_WIN32_DISPLAY(dpy)) { qemu_keycode = MapVirtualKey(gdk_keycode, MAPVK_VK_TO_VSC); + /* + * MapVirtualKey maps same code for left and right ctrl and alt keys. + * Following switch disambiguates the left and right codes. + */ switch (qemu_keycode) { + case 0x1d: /* L-ctrl */ + if (gdk_keycode == VK_RCONTROL) { + qemu_keycode |= SCANCODE_GREY; + } + break; + case 0x38: /* L-alt */ + if (gdk_keycode == VK_RMENU) { + qemu_keycode |= SCANCODE_GREY; + } + break; case 103: /* alt gr */ qemu_keycode = 56 | SCANCODE_GREY; break; -- 1.8.5.2.msysgit.0