From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jindrich Makovicka <makovick@gmail.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PULL 8/9] sdl2 uses surface relative coordinates
Date: Fri, 12 Jan 2018 15:52:57 +0100 [thread overview]
Message-ID: <20180112145258.10578-9-kraxel@redhat.com> (raw)
In-Reply-To: <20180112145258.10578-1-kraxel@redhat.com>
From: Jindrich Makovicka <makovick@gmail.com>
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>
---
ui/sdl2.c | 30 ++++--------------------------
1 file changed, 4 insertions(+), 26 deletions(-)
diff --git a/ui/sdl2.c b/ui/sdl2.c
index 62a75318dd..8a0bd9149b 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;
--
2.9.3
next prev parent reply other threads:[~2018-01-12 14:53 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-12 14:52 [Qemu-devel] [PULL 0/9] Ui 20180112 patches Gerd Hoffmann
2018-01-12 14:52 ` [Qemu-devel] [PULL 1/9] input: fix memory leak Gerd Hoffmann
2018-01-12 14:52 ` [Qemu-devel] [PULL 2/9] ui: deprecate use of GTK 2.x in favour of 3.x series Gerd Hoffmann
2018-01-12 14:52 ` [Qemu-devel] [PULL 3/9] spice: remove QXLWorker interface field Gerd Hoffmann
2018-01-12 14:52 ` [Qemu-devel] [PULL 4/9] spice: remove unused watch list Gerd Hoffmann
2018-01-12 14:52 ` [Qemu-devel] [PULL 5/9] spice: remove only written event_mask field Gerd Hoffmann
2018-01-12 14:52 ` [Qemu-devel] [PULL 6/9] spice: remove unused timer list Gerd Hoffmann
2018-01-12 14:52 ` [Qemu-devel] [PULL 7/9] sdl2: Do not hide the cursor on auxilliary windows Gerd Hoffmann
2018-01-12 14:52 ` Gerd Hoffmann [this message]
2018-01-12 14:52 ` [Qemu-devel] [PULL 9/9] sdl2: Ignore UI hotkeys after a focus change when GUI modifier is held Gerd Hoffmann
2018-01-15 9:36 ` [Qemu-devel] [PULL 0/9] Ui 20180112 patches Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180112145258.10578-9-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=makovick@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).