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>
This commit is contained in:
Gerd Hoffmann 2014-03-10 09:22:16 +01:00
parent f53f3d0a00
commit c3aa84b68f
1 changed files with 11 additions and 7 deletions

View File

@ -455,13 +455,17 @@ static void sdl_send_mouse_event(int dx, int dy, int x, int y, int state)
real_screen->w); real_screen->w);
qemu_input_queue_abs(dcl->con, INPUT_AXIS_Y, y, qemu_input_queue_abs(dcl->con, INPUT_AXIS_Y, y,
real_screen->h); real_screen->h);
} else if (guest_cursor) { } else {
x -= guest_x; if (guest_cursor) {
y -= guest_y; x -= guest_x;
guest_x += x; y -= guest_y;
guest_y += y; guest_x += x;
qemu_input_queue_rel(dcl->con, INPUT_AXIS_X, x); guest_y += y;
qemu_input_queue_rel(dcl->con, INPUT_AXIS_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(); qemu_input_event_sync();
} }