aboutsummaryrefslogtreecommitdiff
path: root/ui/sdl2.c
diff options
context:
space:
mode:
authorJindrich Makovicka <makovick@gmail.com>2017-11-17 12:22:57 +0100
committerGerd Hoffmann <kraxel@redhat.com>2018-01-12 15:51:05 +0100
commitd9f0626280fb5224071415e6fd82cc0c2e9d6590 (patch)
treecb8212d0f586d2f5f8340240ea640f0ea74efb3c /ui/sdl2.c
parent2821671629531184d9fa2f8fcc3cea1bd605b872 (diff)
downloadqemu-d9f0626280fb5224071415e6fd82cc0c2e9d6590.zip
qemu-d9f0626280fb5224071415e6fd82cc0c2e9d6590.tar.gz
qemu-d9f0626280fb5224071415e6fd82cc0c2e9d6590.tar.bz2
sdl2 uses surface relative coordinates
This patch fixes mouse positioning with -device usb-tablet and fullscreen or resized window. Fixes: 46522a82236ea0cf9011b89896d2d8f8ddaf2443 Signed-off-by: Jindrich Makovicka <makovick@gmail.com> Message-Id: <20171117112258.5888-3-makovick@gmail.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'ui/sdl2.c')
-rw-r--r--ui/sdl2.c30
1 files changed, 4 insertions, 26 deletions
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 62a7531..8a0bd91 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -276,32 +276,10 @@ static void sdl_send_mouse_event(struct sdl2_console *scon, int dx, int dy,
}
if (qemu_input_is_absolute()) {
- int scr_w, scr_h;
- int max_w = 0, max_h = 0;
- int off_x = 0, off_y = 0;
- int cur_off_x = 0, cur_off_y = 0;
- int i;
-
- for (i = 0; i < sdl2_num_outputs; i++) {
- struct sdl2_console *thiscon = &sdl2_console[i];
- if (thiscon->real_window && thiscon->surface) {
- SDL_GetWindowSize(thiscon->real_window, &scr_w, &scr_h);
- cur_off_x = thiscon->x;
- cur_off_y = thiscon->y;
- if (scr_w + cur_off_x > max_w) {
- max_w = scr_w + cur_off_x;
- }
- if (scr_h + cur_off_y > max_h) {
- max_h = scr_h + cur_off_y;
- }
- if (i == scon->idx) {
- off_x = cur_off_x;
- off_y = cur_off_y;
- }
- }
- }
- qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_X, off_x + x, 0, max_w);
- qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_Y, off_y + y, 0, max_h);
+ qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_X,
+ x, 0, surface_width(scon->surface));
+ qemu_input_queue_abs(scon->dcl.con, INPUT_AXIS_Y,
+ y, 0, surface_height(scon->surface));
} else {
if (guest_cursor) {
x -= guest_x;