From: Gerd Hoffmann Date: Mon, 10 Mar 2014 08:22:16 +0000 (+0100) Subject: input: sdl: fix guest_cursor logic. X-Git-Tag: qemu-xen-4.5.0-rc1~132^2~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=c3aa84b68f45d915160a523b4d7b9c6f4cf2219c;p=qemu-upstream-4.5-testing.git input: sdl: fix guest_cursor logic. Unbreaks relative mouse mode with SDL. Reported-by: Gabriel L. Somlo Signed-off-by: Gerd Hoffmann --- diff --git a/ui/sdl.c b/ui/sdl.c index c1a16bebd..4e7f920e3 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(); }