qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] input: sdl: fix guest_cursor logic.
@ 2014-03-10  8:23 Gerd Hoffmann
  2014-03-12 22:13 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Gerd Hoffmann @ 2014-03-10  8:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori

Unbreaks relative mouse mode with SDL.

Reported-by: Gabriel L. Somlo <gsomlo@gmail.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/ui/sdl.c b/ui/sdl.c
index c1a16be..4e7f920 100644
--- a/ui/sdl.c
+++ b/ui/sdl.c
@@ -455,13 +455,17 @@ static void sdl_send_mouse_event(int dx, int dy, int x, int y, int state)
                              real_screen->w);
         qemu_input_queue_abs(dcl->con, INPUT_AXIS_Y, y,
                              real_screen->h);
-    } else if (guest_cursor) {
-        x -= guest_x;
-        y -= guest_y;
-        guest_x += x;
-        guest_y += y;
-        qemu_input_queue_rel(dcl->con, INPUT_AXIS_X, x);
-        qemu_input_queue_rel(dcl->con, INPUT_AXIS_Y, y);
+    } else {
+        if (guest_cursor) {
+            x -= guest_x;
+            y -= guest_y;
+            guest_x += x;
+            guest_y += y;
+            dx = x;
+            dy = y;
+        }
+        qemu_input_queue_rel(dcl->con, INPUT_AXIS_X, dx);
+        qemu_input_queue_rel(dcl->con, INPUT_AXIS_Y, dy);
     }
     qemu_input_event_sync();
 }
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PATCH] input: sdl: fix guest_cursor logic.
  2014-03-10  8:23 [Qemu-devel] [PATCH] input: sdl: fix guest_cursor logic Gerd Hoffmann
@ 2014-03-12 22:13 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2014-03-12 22:13 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel; +Cc: Anthony Liguori

On 03/10/2014 01:23 AM, Gerd Hoffmann wrote:
> +        if (guest_cursor) {
> +            x -= guest_x;
> +            y -= guest_y;
> +            guest_x += x;
> +            guest_y += y;
> +            dx = x;
> +            dy = y;
> +        }

Why write it in this funny way?  Surely better as

  dx = x - guest_x;
  dy = y - guest_y;
  guest_x = x;
  guest_y = y;


r~

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

end of thread, other threads:[~2014-03-12 22:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-10  8:23 [Qemu-devel] [PATCH] input: sdl: fix guest_cursor logic Gerd Hoffmann
2014-03-12 22:13 ` Richard Henderson

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).