>From 3ecdd74fd12f33b6c00b66fce2e082c7fe9b273e Mon Sep 17 00:00:00 2001 From: Remi Thebault Date: Sun, 25 Jan 2015 16:57:45 +0100 Subject: [PATCH 1/4 v2] 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 | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/ui/gtk.c b/ui/gtk.c index 0385757..da593f7 100644 --- a/ui/gtk.c +++ b/ui/gtk.c @@ -900,10 +900,26 @@ 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); - switch (qemu_keycode) { - case 103: /* alt gr */ - qemu_keycode = 56 | SCANCODE_GREY; + /* + testing for right ctrl and right alt and give corresponding code. + for all other keystrokes, scan code is given by MapVirtualKey. + (MapVirtualKey maps same code for left and right ctrl and alt keys) + */ + switch (gdk_keycode) { + case 0xa3: // r-ctrl + qemu_keycode = 0x9d; + break; + case 0xa5: // r-alt + qemu_keycode = 0xb8; + break; + default: + qemu_keycode = MapVirtualKey(gdk_keycode, MAPVK_VK_TO_VSC); + /* FIXME: is following check still needed? */ + switch (qemu_keycode) { + case 103: /* alt gr */ + qemu_keycode = 56 | SCANCODE_GREY; + break; + } break; } return qemu_keycode; -- 1.8.5.2.msysgit.0