[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 28/42] input: mouse: switch monitor to new core
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 28/42] input: mouse: switch monitor to new core |
Date: |
Mon, 16 Dec 2013 11:49:04 +0100 |
Signed-off-by: Gerd Hoffmann <address@hidden>
---
monitor.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
diff --git a/monitor.c b/monitor.c
index 845f608..d22e720 100644
--- a/monitor.c
+++ b/monitor.c
@@ -39,6 +39,7 @@
#include "monitor/monitor.h"
#include "monitor/readline.h"
#include "ui/console.h"
+#include "ui/input.h"
#include "sysemu/blockdev.h"
#include "audio/audio.h"
#include "disas/disas.h"
@@ -1457,23 +1458,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)
--
1.8.3.1
- [Qemu-devel] [PATCH 20/42] input: mouse: add graphic_rotate support, (continued)
- [Qemu-devel] [PATCH 20/42] input: mouse: add graphic_rotate support, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 35/42] input-legacy: remove kbd_mouse_event, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 22/42] input: mouse: switch legacy handlers to new core, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 27/42] input: mouse: switch spice ui to new core, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 08/42] input: qapi: add pause key, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 01/42] ui/sdl2 : initial port to SDL 2.0 (v2.0), Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 28/42] input: mouse: switch monitor to new core,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 24/42] input: mouse: switch sdl ui to new core, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 36/42] input: move mouse mode notifier to new core, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 31/42] input: trace events, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 33/42] input-legacy: remove kbd_mouse_has_absolute, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 37/42] input: add input_mouse_mode tracepoint, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 41/42] input: move do_mouse_set to new core, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 34/42] input-legacy: remove kbd_mouse_is_absolute, Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 30/42] input: mouse: switch cocoa ui to new core [untested], Gerd Hoffmann, 2013/12/16
- [Qemu-devel] [PATCH 07/42] input: qapi: add unmapped key, Gerd Hoffmann, 2013/12/16