input: activate legacy kbd
gtk: Add mouse wheel support -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJTIYmpAAoJEEy22O7T6HE4Tw8QAKxNxojUR6d1h8d1VhOX8IBH g8DFn2YnClKWEFa/jVLmiKetVsp7WkFnyxIiIbW8BU9HjIGtVIdv9FeJdW+/GN2n RP1DQearQ8gLluqZ5cOYKhG5xYGV+t9JUmFFKlMriLwnJJ34oDzN05zq7WOuaB70 E7lSLya/hvCm5PqraSr9B1dCVc5kLLqhO0doZZWVJF12EFypKBtRV9BgaPhuGYQ2 nGtkGl64ijn9Bz8HmKvkt6R6mtqYb2/ww4AP+4eplk00kw2LzDBhhVOnPBFUCWwG I1NSZtEH8Jy2znBPQQ4NTodUzj/sd20xYY6e22Ti5mZwUEWTIj8qYZIjiI3NxEjy lx3Ba0yvAGtpA5hFl0tpPEB+R3h0bhxtRErbaLsj3m6pQ++fkUVzXH5MFne2g/lG 1TyZIkXvYRPncrKGn8WBcJMJv4CCN309QhcmyYzCLEwzS38F6mG9HPyu4AMP/dRw M6CtSiMeo9Pw1IPGcXJorZSo/4RBe6zgExqldN6mxnKjnLyzGogSmQ7w2N2JSHH7 t3QiDQOzobqTz4yVjhxWBEdxZ3DpMNw5a38OloiMQvwUf+0t292qYy9FwnUCIEMU PWKzPBHkq3Kgye6Hz5LMe4/fioNY0tXBQdknKk1mMHwmSIj8ZFiuzoVwKpUFeMAX jkEqkhzTmCnvoqzG5j+g =bVKB -----END PGP SIGNATURE----- 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>
This commit is contained in:
commit
d7f0a59ff0
23
ui/gtk.c
23
ui/gtk.c
|
@ -683,6 +683,27 @@ static gboolean gd_button_event(GtkWidget *widget, GdkEventButton *button,
|
||||||
return TRUE;
|
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)
|
static gboolean gd_key_event(GtkWidget *widget, GdkEventKey *key, void *opaque)
|
||||||
{
|
{
|
||||||
GtkDisplayState *s = opaque;
|
GtkDisplayState *s = opaque;
|
||||||
|
@ -1229,6 +1250,8 @@ static void gd_connect_signals(GtkDisplayState *s)
|
||||||
G_CALLBACK(gd_button_event), s);
|
G_CALLBACK(gd_button_event), s);
|
||||||
g_signal_connect(s->drawing_area, "button-release-event",
|
g_signal_connect(s->drawing_area, "button-release-event",
|
||||||
G_CALLBACK(gd_button_event), s);
|
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_signal_connect(s->drawing_area, "key-press-event",
|
||||||
G_CALLBACK(gd_key_event), s);
|
G_CALLBACK(gd_key_event), s);
|
||||||
g_signal_connect(s->drawing_area, "key-release-event",
|
g_signal_connect(s->drawing_area, "key-release-event",
|
||||||
|
|
|
@ -333,6 +333,7 @@ QEMUPutKbdEntry *qemu_add_kbd_event_handler(QEMUPutKBDEvent *func, void *opaque)
|
||||||
entry->opaque = opaque;
|
entry->opaque = opaque;
|
||||||
entry->s = qemu_input_handler_register((DeviceState *)entry,
|
entry->s = qemu_input_handler_register((DeviceState *)entry,
|
||||||
&legacy_kbd_handler);
|
&legacy_kbd_handler);
|
||||||
|
qemu_input_handler_activate(entry->s);
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue