qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] monitor: avoid moving cursor during "mouse_button" command
@ 2011-04-08  7:44 Brad Hards
  2011-04-08  9:07 ` Brad Hards
  2011-04-08 14:34 ` Markus Armbruster
  0 siblings, 2 replies; 8+ messages in thread
From: Brad Hards @ 2011-04-08  7:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: armbru, Brad Hards, lcapitulino

This addresses https://bugs.launchpad.net/qemu/+bug/752476 which
basically points out that using the mouse_button command causes
the mouse cursor to warp to the origin (when using absolute
pointing device).

I've tested this with a kubuntu 10.10 guest and it works fine
for me with both relative and absolute pointing devices. Note
that testing with realtive pointing device was relatively
light.

Signed-off-by: Brad Hards <bradh@frogmouth.net>
---
 monitor.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/monitor.c b/monitor.c
index f1a08dc..0ce162b 100644
--- a/monitor.c
+++ b/monitor.c
@@ -1879,6 +1879,9 @@ static void do_sendkey(Monitor *mon, const QDict *qdict)
                    muldiv64(get_ticks_per_sec(), hold_time, 1000));
 }
 
+static int mouse_x;
+static int mouse_y;
+static int mouse_z;
 static int mouse_button_state;
 
 static void do_mouse_move(Monitor *mon, const QDict *qdict)
@@ -1893,13 +1896,22 @@ static void do_mouse_move(Monitor *mon, const QDict *qdict)
     if (dz_str)
         dz = strtol(dz_str, NULL, 0);
     kbd_mouse_event(dx, dy, dz, mouse_button_state);
+    if (kbd_mouse_is_absolute()) {
+        mouse_x = dx;
+        mouse_y = dy;
+        mouse_z = dz;
+    }
 }
 
 static void do_mouse_button(Monitor *mon, const QDict *qdict)
 {
     int button_state = qdict_get_int(qdict, "button_state");
     mouse_button_state = button_state;
-    kbd_mouse_event(0, 0, 0, mouse_button_state);
+    if (kbd_mouse_is_absolute()) {
+        kbd_mouse_event(mouse_x, mouse_y, mouse_z, mouse_button_state);
+    } else {
+        kbd_mouse_event(0, 0, 0, mouse_button_state);
+    }
 }
 
 static void do_ioport_read(Monitor *mon, const QDict *qdict)
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-05-02  6:58 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-08  7:44 [Qemu-devel] [PATCH] monitor: avoid moving cursor during "mouse_button" command Brad Hards
2011-04-08  9:07 ` Brad Hards
2011-04-08 14:34 ` Markus Armbruster
2011-04-08 16:37   ` Luiz Capitulino
2011-04-28 10:46     ` Gerd Hoffmann
2011-04-30  0:09       ` Brad Hards
2011-05-02  6:57         ` Gerd Hoffmann
2011-04-09  0:21   ` Brad Hards

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).