[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC 8/8] monitor: Fix mouse_button command for absol
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH RFC 8/8] monitor: Fix mouse_button command for absolute coordinates |
Date: |
Sun, 16 Jun 2013 05:40:05 +0200 |
When using a virtual mouse device with absolute coordinates (tablet) the
mouse_button command would raise a mouse event at coordinates (0,0,0),
breaking openQA among others.
Use a new kbd_mouse_button_event() to obtain the current position with
the new MouseOps::get_position() callback when in absolute mode.
This allows both switching mice via mouse_set and mixing mouse_move with
interactive GUI/VNC mouse movements.
Addresses LP#752476 / BNC#813642.
Reported-by: Brad Hards <address@hidden>
Reported-by: Ludwig Nussel <address@hidden>
Signed-off-by: Andreas Färber <address@hidden>
---
include/ui/console.h | 1 +
monitor.c | 2 +-
ui/input.c | 17 +++++++++++++++++
3 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/include/ui/console.h b/include/ui/console.h
index d41dd1d..f912ad6 100644
--- a/include/ui/console.h
+++ b/include/ui/console.h
@@ -64,6 +64,7 @@ void kbd_put_keycode(int keycode);
void kbd_put_ledstate(int ledstate);
void kbd_mouse_event(int dx, int dy, int dz, int buttons_state);
void kbd_mouse_move_event(int dx, int dy, int dz);
+void kbd_mouse_button_event(int buttons_state);
/* Does the current mouse generate absolute events */
bool kbd_mouse_is_absolute(void);
diff --git a/monitor.c b/monitor.c
index 6816e82..97ca8a8 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1284,7 +1284,7 @@ static void do_mouse_move(Monitor *mon, const QDict
*qdict)
static void do_mouse_button(Monitor *mon, const QDict *qdict)
{
int button_state = qdict_get_int(qdict, "button_state");
- kbd_mouse_event(0, 0, 0, button_state);
+ kbd_mouse_button_event(button_state);
}
static void do_ioport_read(Monitor *mon, const QDict *qdict)
diff --git a/ui/input.c b/ui/input.c
index 366f3c0..a02160d 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -491,6 +491,23 @@ void kbd_mouse_move_event(int dx, int dy, int dz)
kbd_mouse_event(dx, dy, dz, buttons_state);
}
+void kbd_mouse_button_event(int buttons_state)
+{
+ QEMUPutMouseEntry *mouse;
+ int dx = 0, dy = 0;
+
+ if (QTAILQ_EMPTY(&mouse_handlers)) {
+ return;
+ }
+
+ mouse = QTAILQ_FIRST(&mouse_handlers);
+ if (mouse->absolute && mouse->ops->get_position != NULL) {
+ mouse->ops->get_position(mouse->opaque, &dx, &dy);
+ }
+
+ kbd_mouse_event(dx, dy, 0, buttons_state);
+}
+
bool kbd_mouse_is_absolute(void)
{
if (QTAILQ_EMPTY(&mouse_handlers)) {
--
1.8.1.4
- [Qemu-devel] [PATCH RFC 0/8] monitor: Fix mouse_button and improve mouse_move commands, Andreas Färber, 2013/06/15
- [Qemu-devel] [PATCH RFC 2/8] ui/input: Simplify kbd_mouse_event(), Andreas Färber, 2013/06/15
- [Qemu-devel] [PATCH RFC 1/8] ui/input: Clean up QEMUPutMouseEntry struct, Andreas Färber, 2013/06/15
- [Qemu-devel] [PATCH RFC 3/8] ui/input: Use bool for qemu_add_mouse_event_handler(), Andreas Färber, 2013/06/15
- [Qemu-devel] [PATCH RFC 4/8] ui/input: Introduce MouseOps for qemu_add_mouse_event_handler(), Andreas Färber, 2013/06/15
- [Qemu-devel] [PATCH RFC 6/8] monitor: Eliminate global mouse buttons state for mouse_move, Andreas Färber, 2013/06/15
- [Qemu-devel] [PATCH RFC 8/8] monitor: Fix mouse_button command for absolute coordinates,
Andreas Färber <=
- [Qemu-devel] [PATCH RFC 5/8] ui/input: Introduce MouseOps::get_buttons_state(), Andreas Färber, 2013/06/15
- [Qemu-devel] [PATCH RFC 7/8] ui/input: Introduce MouseOps::get_position(), Andreas Färber, 2013/06/15
- Re: [Qemu-devel] [PATCH RFC 0/8] monitor: Fix mouse_button and improve mouse_move commands, Gerd Hoffmann, 2013/06/17