]> rtime.felk.cvut.cz Git - lisovros/qemu_apohw.git/commitdiff
input: sdl: fix guest_cursor logic.
authorGerd Hoffmann <kraxel@redhat.com>
Mon, 10 Mar 2014 08:22:16 +0000 (09:22 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Mon, 10 Mar 2014 12:49:44 +0000 (13:49 +0100)
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

index c1a16bebdcf9d8a6cdc1fd7643ac97d0e91fab66..4e7f920e375c308df8117da0102ab5ff4b263453 100644 (file)
--- 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();
 }