Initial patch for QEMU GTK support on Windows

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQEcBAABAgAGBQJS3XsWAAoJEC+DHmz61iBpbSoH/05bF5kfogHUuqXdF/pGPB8H
 LmnaodaC0dnigKnEpwQrpiq5ZwkzRek4J35txrRKZcD+M5awjEnZEUJ9fP1sDTMi
 rxgewWIbUnISVtvw9pxz4CJumH3nRaVz7wmtcMd+4LNEuRhgwszfedDAQRLUKCmB
 xViGQeuauqUm0m12qx4F7rE7Dq5ru8uOl8Zf0u9QPpIreLmN8f/VZzE5NzApw0YV
 EZKpMsOPWs6mBUO978yjOH/wjncBoJp/dE2wkZm/LzCQtiNGMxTBlU7qvrxaID/O
 dVHtQGCRarStM3lkJhq3to3EXS9PtuLJ0zeWwAgncdGG+tw0becNfBEA4XLkudY=
 =CmlU
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'sweil/tags/for_anthony' into staging

Initial patch for QEMU GTK support on Windows

# gpg: Signature made Mon 20 Jan 2014 11:37:58 AM PST using RSA key ID FAD62069
# gpg: Can't check signature: public key not found

* sweil/tags/for_anthony:
  gtk: Support keyboard translation for hosts running Windows

Message-id: 1390246909-18757-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@amazon.com>
This commit is contained in:
Anthony Liguori 2014-01-24 15:52:08 -08:00
commit 7d64b2c2e2
1 changed files with 15 additions and 3 deletions

View File

@ -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");