diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-03-07 18:29:32 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-03-07 18:29:33 +0000 |
commit | 6fc0303b95c873d9e384d7fb51e412ac2e53b9c1 (patch) | |
tree | 7d815af24450845341cb1a703f3e5e6058937abf /monitor.c | |
parent | bb2b04503497608cdc5fa4c990d26e936f9d2102 (diff) | |
parent | 47c03744b37c72b8f633b03380d5a323615b9ac4 (diff) |
Merge remote-tracking branch 'remotes/kraxel/tags/pull-input-4' into staging
Input handling rewrite.
SDL2 support.
# gpg: Signature made Wed 05 Mar 2014 11:16:08 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-4: (38 commits)
ui/sdl2 : initial port to SDL 2.0 (v2.0)
console: add QemuUIInfo
console: add head to index to qemu consoles.
input: remove index_from_keycode (no users)
input: move do_mouse_set to new core
input: move qmp_query_mice to new core
input: add input_mouse_mode tracepoint
input: move mouse mode notifier to new core
input-legacy: remove kbd_mouse_event
input-legacy: remove kbd_mouse_is_absolute
input-legacy: remove kbd_mouse_has_absolute
input-legacy: remove kbd_put_keycode
input: trace events
input: mouse: switch cocoa ui to new core
input: keyboard: switch cocoa ui to new core
input: mouse: switch monitor to new core
input: mouse: switch spice ui to new core
input: mouse: switch vnc ui to new core
input: mouse: switch sdl ui to new core
input: mouse: switch gtk ui to new core
...
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'monitor.c')
-rw-r--r-- | monitor.c | 31 |
1 files changed, 26 insertions, 5 deletions
@@ -39,6 +39,7 @@ #include "monitor/monitor.h" #include "qemu/readline.h" #include "ui/console.h" +#include "ui/input.h" #include "sysemu/blockdev.h" #include "audio/audio.h" #include "disas/disas.h" @@ -1463,23 +1464,43 @@ static int mouse_button_state; static void do_mouse_move(Monitor *mon, const QDict *qdict) { - int dx, dy, dz; + int dx, dy, dz, button; const char *dx_str = qdict_get_str(qdict, "dx_str"); const char *dy_str = qdict_get_str(qdict, "dy_str"); const char *dz_str = qdict_get_try_str(qdict, "dz_str"); + dx = strtol(dx_str, NULL, 0); dy = strtol(dy_str, NULL, 0); - dz = 0; - if (dz_str) + qemu_input_queue_rel(NULL, INPUT_AXIS_X, dx); + qemu_input_queue_rel(NULL, INPUT_AXIS_Y, dy); + + if (dz_str) { dz = strtol(dz_str, NULL, 0); - kbd_mouse_event(dx, dy, dz, mouse_button_state); + if (dz != 0) { + button = (dz > 0) ? INPUT_BUTTON_WHEEL_UP : INPUT_BUTTON_WHEEL_DOWN; + qemu_input_queue_btn(NULL, button, true); + qemu_input_event_sync(); + qemu_input_queue_btn(NULL, button, false); + } + } + qemu_input_event_sync(); } static void do_mouse_button(Monitor *mon, const QDict *qdict) { + static uint32_t bmap[INPUT_BUTTON_MAX] = { + [INPUT_BUTTON_LEFT] = MOUSE_EVENT_LBUTTON, + [INPUT_BUTTON_MIDDLE] = MOUSE_EVENT_MBUTTON, + [INPUT_BUTTON_RIGHT] = MOUSE_EVENT_RBUTTON, + }; int button_state = qdict_get_int(qdict, "button_state"); + + if (mouse_button_state == button_state) { + return; + } + qemu_input_update_buttons(NULL, bmap, mouse_button_state, button_state); + qemu_input_event_sync(); mouse_button_state = button_state; - kbd_mouse_event(0, 0, 0, mouse_button_state); } static void do_ioport_read(Monitor *mon, const QDict *qdict) |