aboutsummaryrefslogtreecommitdiff
path: root/ui/sdl.c
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2014-03-10 09:22:16 +0100
committerGerd Hoffmann <kraxel@redhat.com>2014-03-10 13:49:44 +0100
commitc3aa84b68f45d915160a523b4d7b9c6f4cf2219c (patch)
tree058c123365cd4ac7201bd7063f5c5479e56414a0 /ui/sdl.c
parentf53f3d0a00b6df39ce8dfca942608e5b6a9a4f71 (diff)
input: sdl: fix guest_cursor logic.
Unbreaks relative mouse mode with SDL. Reported-by: Gabriel L. Somlo <gsomlo@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/sdl.c')
-rw-r--r--ui/sdl.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/sdl.c b/ui/sdl.c
index c1a16bebdc..4e7f920e37 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();
}