diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-03-13 18:37:00 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-03-13 18:37:01 +0000 |
commit | d7f0a59ff02affb8270ad9b6ee7e60974ac92df0 (patch) | |
tree | 851e2f982d96e4b68dbc3956282fe45f77c7d3ac | |
parent | 4a9a1f49c58fb0cbdd17ad3de2cc682aad3230b8 (diff) | |
parent | d58b9122716bc444305515ead3a69b91d807bf3c (diff) | |
download | hqemu-d7f0a59ff02affb8270ad9b6ee7e60974ac92df0.zip hqemu-d7f0a59ff02affb8270ad9b6ee7e60974ac92df0.tar.gz |
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-6' into staging
input: activate legacy kbd
gtk: Add mouse wheel support
# gpg: Signature made Thu 13 Mar 2014 10:34:17 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
* remotes/kraxel/tags/pull-input-6:
gtk: Add mouse wheel support
input: activate legacy kbd
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
-rw-r--r-- | ui/gtk.c | 23 | ||||
-rw-r--r-- | ui/input-legacy.c | 1 |
2 files changed, 24 insertions, 0 deletions
@@ -683,6 +683,27 @@ static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button, return TRUE; } +static gboolean gd_scroll_event(GtkWidget *widget, GdkEventScroll *scroll, + void *opaque) +{ + GtkDisplayState *s = opaque; + InputButton btn; + + if (scroll->direction == GDK_SCROLL_UP) { + btn = INPUT_BUTTON_WHEEL_UP; + } else if (scroll->direction == GDK_SCROLL_DOWN) { + btn = INPUT_BUTTON_WHEEL_DOWN; + } else { + return TRUE; + } + + qemu_input_queue_btn(s->dcl.con, btn, true); + qemu_input_event_sync(); + qemu_input_queue_btn(s->dcl.con, btn, false); + qemu_input_event_sync(); + return TRUE; +} + static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque) { GtkDisplayState *s = opaque; @@ -1229,6 +1250,8 @@ static void gd_connect_signals(GtkDisplayState *s) G_CALLBACK(gd_button_event), s); g_signal_connect(s->drawing_area, "button-release-event", G_CALLBACK(gd_button_event), s); + g_signal_connect(s->drawing_area, "scroll-event", + G_CALLBACK(gd_scroll_event), s); g_signal_connect(s->drawing_area, "key-press-event", G_CALLBACK(gd_key_event), s); g_signal_connect(s->drawing_area, "key-release-event", diff --git a/ui/input-legacy.c b/ui/input-legacy.c index 7dc486b..1aa2605 100644 --- a/ui/input-legacy.c +++ b/ui/input-legacy.c @@ -333,6 +333,7 @@ QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque) entry->opaque = opaque; entry->s = qemu_input_handler_register((DeviceState *)entry, &legacy_kbd_handler); + qemu_input_handler_activate(entry->s); return entry; } |