aboutsummaryrefslogtreecommitdiff
path: root/ui/sdl2.c
diff options
context:
space:
mode:
Diffstat (limited to 'ui/sdl2.c')
-rw-r--r--ui/sdl2.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/ui/sdl2.c b/ui/sdl2.c
index f1532e9d2c..e4cb9fbba6 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -403,13 +403,17 @@ static void sdl_send_mouse_event(struct sdl2_state *scon, int dx, int dy,
}
qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_X, off_x + x, max_w);
qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_Y, off_y + y, max_h);
- } else if (guest_cursor) {
- x -= guest_x;
- y -= guest_y;
- guest_x += x;
- guest_y += y;
- qemu_input_queue_rel(scon->dcl.con, INPUT_AXIS_X, x);
- qemu_input_queue_rel(scon->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(scon->dcl.con, INPUT_AXIS_X, dx);
+ qemu_input_queue_rel(scon->dcl.con, INPUT_AXIS_Y, dy);
}
qemu_input_event_sync();
}