From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>, Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PATCH 1/5] gtk: factor out keycode mapping
Date: Tue, 3 Jun 2014 10:01:38 +0200 [thread overview]
Message-ID: <1401782502-29772-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1401782502-29772-1-git-send-email-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
ui/gtk.c | 23 ++++++++++++++++-------
1 file changed, 16 insertions(+), 7 deletions(-)
diff --git a/ui/gtk.c b/ui/gtk.c
index b908936..01d48cc 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -877,22 +877,18 @@ static gboolean gd_scroll_event(GtkWidget *widget, GdkEventScroll *scroll,
return TRUE;
}
-static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
+static int gd_map_keycode(GtkDisplayState *s, int gdk_keycode)
{
- VirtualConsole *vc = opaque;
- GtkDisplayState *s = vc->s;
- int gdk_keycode = key->hardware_keycode;
- int i;
+ int qemu_keycode;
#ifdef _WIN32
- UINT qemu_keycode = MapVirtualKey(gdk_keycode, MAPVK_VK_TO_VSC);
+ 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;
@@ -913,6 +909,19 @@ static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
}
#endif
+ return qemu_keycode;
+}
+
+static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
+{
+ VirtualConsole *vc = opaque;
+ GtkDisplayState *s = vc->s;
+ int gdk_keycode = key->hardware_keycode;
+ int qemu_keycode;
+ int i;
+
+ qemu_keycode = gd_map_keycode(s, gdk_keycode);
+
trace_gd_key_event(vc->label, gdk_keycode, qemu_keycode,
(key->type == GDK_KEY_PRESS) ? "down" : "up");
--
1.8.3.1
next prev parent reply other threads:[~2014-06-03 8:02 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-03 8:01 [Qemu-devel] [PATCH 0/5] gtk: fixes, cleanups and text consoles without vte Gerd Hoffmann
2014-06-03 8:01 ` Gerd Hoffmann [this message]
2014-06-03 8:01 ` [Qemu-devel] [PATCH 2/5] gtk: cleanup backend dependencies Gerd Hoffmann
2014-06-03 15:17 ` Richard Henderson
2014-06-03 8:01 ` [Qemu-devel] [PATCH 3/5] gtk: factor out gtk3 grab into the new gd_grab_devices function Gerd Hoffmann
2014-06-03 8:01 ` [Qemu-devel] [PATCH 4/5] gtk: update window size after showing/hiding tabs Gerd Hoffmann
2014-06-03 8:01 ` [Qemu-devel] [PATCH 5/5] gtk: bind to text terminal consoles too Gerd Hoffmann
2014-06-04 7:25 ` [Qemu-devel] [PATCH 0/5] gtk: fixes, cleanups and text consoles without vte Stefan Weil
2014-06-04 7:40 ` Gerd Hoffmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401782502-29772-2-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=aliguori@amazon.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).