sdl2 relative mouse mode fixes.

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJTR8W+AAoJEEy22O7T6HE4HIcP/34b4OIyEed1ijyg733YGHDf
 CTWOEX58MSbh0YoWjmU0sVhyTSOmpVznKS0mjxGiH87fksrkEpUkfUdHhhSFY/gJ
 +E6JEKafyWn0PSaAOA9aHB5WCQE1W59crNU2oFdO8CRe276Dody4uMyIEv5xy4PO
 N2qw7NgqyymPEXKi811ew9YO9zSYkfH62sLBmu57sCo9daOx5dExQ4cRMoZhG45v
 +TEWRy+DMQVJOBC4Exuk849Em1F25q95soAFqcWvE+HVeQ/i0twI4+Wyw0396IXb
 heWMfcE00bxrHxfwDTLMELwRN1s9KFko87h6O8ehyJUqW91ecJFHTS65OOFPFAXp
 RjWCdYWveazsfPPQaaTZ6/eh2Nhjh8u2FCXWyhkpl2m4LpT/AOuK2khVA0Bdv9Y2
 hqCqQ65DzCSPWc9tzPqxSKlfDGmq8SCECikHMpk4bhzkIvPQTXP9p8tZubHYlW9Q
 GyU6l3sY8rqYS3SOa9/96FDIxuZF7DWGmt6zEhrD4yDFibNBBoFtj3KtnEdB/ohF
 dQlCNGXXb8r3d6KFwa1uP8dGH73Yhd+npOxZ7xMdvInDdYVB+8WZKQT0rWRne8fR
 5R7VUk/ugKzIiHitKIpe0F2cVDpq71hN3aZBmkV+jN+cShUir1wPjm+DWw0uxMG7
 kpBpjDsVV/ymKOjyH7kz
 =DPcI
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kraxel/tags/pull-sdl-1' into staging

sdl2 relative mouse mode fixes.

# gpg: Signature made Fri 11 Apr 2014 11:36:46 BST using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>"

* remotes/kraxel/tags/pull-sdl-1:
  input: sdl2: Fix relative mode to match SDL1 behavior
  input: sdl2: Fix guest_cursor logic

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2014-04-11 13:51:15 +01:00
commit 80fc7b1755

View File

@ -278,7 +278,7 @@ static void sdl_hide_cursor(void)
SDL_ShowCursor(1);
SDL_SetCursor(sdl_cursor_hidden);
} else {
SDL_ShowCursor(0);
SDL_SetRelativeMouseMode(SDL_TRUE);
}
}
@ -289,6 +289,7 @@ static void sdl_show_cursor(void)
}
if (!qemu_input_is_absolute()) {
SDL_SetRelativeMouseMode(SDL_FALSE);
SDL_ShowCursor(1);
if (guest_cursor &&
(gui_grab || qemu_input_is_absolute() || absolute_enabled)) {
@ -403,13 +404,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();
}