qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
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] [PULL 1/4] gtk: factor out keycode mapping
Date: Thu, 12 Jun 2014 10:38:20 +0200	[thread overview]
Message-ID: <1402562303-16930-2-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1402562303-16930-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

  reply	other threads:[~2014-06-12  8:38 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-12  8:38 [Qemu-devel] [PULL 0/4] gtk patch queue Gerd Hoffmann
2014-06-12  8:38 ` Gerd Hoffmann [this message]
2014-06-12  8:38 ` [Qemu-devel] [PULL 2/4] gtk: cleanup backend dependencies Gerd Hoffmann
2014-06-12  8:38 ` [Qemu-devel] [PULL 3/4] gtk: factor out gtk3 grab into the new gd_grab_devices function Gerd Hoffmann
2014-06-12  8:38 ` [Qemu-devel] [PULL 4/4] gtk: update window size after showing/hiding tabs Gerd Hoffmann
2014-06-12  9:49 ` [Qemu-devel] [PULL 0/4] gtk patch queue Peter Maydell

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=1402562303-16930-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).