* [Qemu-devel] [PULL 0/1] MinGW patch
@ 2014-01-20 19:41 Stefan Weil
2014-01-20 19:41 ` [Qemu-devel] [PULL 1/1] gtk: Support keyboard translation for hosts running Windows Stefan Weil
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2014-01-20 19:41 UTC (permalink / raw)
To: Anthony Liguori; +Cc: qemu-devel
The following changes since commit 1cf892ca2689c84960b4ce4d2723b6bee453711c:
SPARC: Fix LEON3 power down instruction (2014-01-15 15:37:33 +1000)
are available in the git repository at:
git://qemu.weilnetz.de/qemu.git tags/for_anthony
for you to fetch changes up to 2777ccc55bfe90bfa813b01faf36fa6ea16fbea8:
gtk: Support keyboard translation for hosts running Windows (2014-01-20 19:30:28 +0100)
----------------------------------------------------------------
Initial patch for QEMU GTK support on Windows
----------------------------------------------------------------
Stefan Weil (1):
gtk: Support keyboard translation for hosts running Windows
ui/gtk.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Qemu-devel] [PULL 1/1] gtk: Support keyboard translation for hosts running Windows
2014-01-20 19:41 [Qemu-devel] [PULL 0/1] MinGW patch Stefan Weil
@ 2014-01-20 19:41 ` Stefan Weil
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Weil @ 2014-01-20 19:41 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Stefan Weil, qemu-devel
GTK uses different hardware keycodes on Windows hosts, so some special
handling is needed to get the QEMU keycode.
Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
ui/gtk.c | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index 6316f5b..a633d89 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -34,6 +34,10 @@
#define GETTEXT_PACKAGE "qemu"
#define LOCALEDIR "po"
+#ifdef _WIN32
+# define _WIN32_WINNT 0x0601 /* needed to get definition of MAPVK_VK_TO_VSC */
+#endif
+
#include "qemu-common.h"
#ifdef CONFIG_PRAGMA_DIAGNOSTIC_AVAILABLE
@@ -704,11 +708,18 @@ static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button,
static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
{
GtkDisplayState *s = opaque;
- int gdk_keycode;
- int qemu_keycode;
+ int gdk_keycode = key->hardware_keycode;
int i;
- gdk_keycode = key->hardware_keycode;
+#ifdef _WIN32
+ UINT qemu_keycode = MapVirtualKey(gdk_keycode, MAPVK_VK_TO_VSC);
+ switch (qemu_keycode) {
+ case 103: /* alt gr */
+ qemu_keycode = 56 | SCANCODE_GREY;
+ break;
+ }
+#else
+ int qemu_keycode;
if (gdk_keycode < 9) {
qemu_keycode = 0;
@@ -723,6 +734,7 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
} else {
qemu_keycode = 0;
}
+#endif
trace_gd_key_event(gdk_keycode, qemu_keycode,
(key->type == GDK_KEY_PRESS) ? "down" : "up");
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-20 19:42 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-20 19:41 [Qemu-devel] [PULL 0/1] MinGW patch Stefan Weil
2014-01-20 19:41 ` [Qemu-devel] [PULL 1/1] gtk: Support keyboard translation for hosts running Windows Stefan Weil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).