diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2014-04-11 13:51:15 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2014-04-11 13:51:16 +0100 |
commit | 80fc7b1755492a3698f78f7c4973751f6cf02e14 (patch) | |
tree | ac2f3a64ea475d0efff239f406ee008b59e6d892 | |
parent | f516a5cc051db6e999e9e60dc968dcb5aeffe11f (diff) | |
parent | 2d968ffbae6b7899064f9f86f8508d9c19021e39 (diff) |
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>
-rw-r--r-- | ui/sdl2.c | 21 |
1 files changed, 13 insertions, 8 deletions
@@ -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(); } |