aboutsummaryrefslogtreecommitdiff
path: root/sdl.c
diff options
context:
space:
mode:
authoraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-15 20:47:45 +0000
committeraliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>2009-01-15 20:47:45 +0000
commit6bb816031f8bc0aafc3476e6dfa4293ee3a5f106 (patch)
treef7bdb231cac1d303309d089c563134ca203217e3 /sdl.c
parent4141d4c2517b685484e323aeddd1051be3bc7294 (diff)
downloadqemu-6bb816031f8bc0aafc3476e6dfa4293ee3a5f106.zip
qemu-6bb816031f8bc0aafc3476e6dfa4293ee3a5f106.tar.gz
qemu-6bb816031f8bc0aafc3476e6dfa4293ee3a5f106.tar.bz2
Handle SDL grabs failing (Mark McLoughlin)
If a X window is not viewable, XGrabPointer() fails and returns GrabNotViewable. SDL's X backend currently handles this by retrying the grab until the window becomes viewable again. This means e.g. if you Ctrl-Alt-RightArrow to switch workspaces, QEMU tries to grab, SDL blocks because the window isn't viewable and your guest stops executing until you switch back to that workspace again. See this Fedora bug for the gory details: https://bugzilla.redhat.com/480065 Some SDL backends will return SDL_GRAB_OFF from SDL_WM_GrabInput(), so the fix is to make the X backend do this if the grab fails. The only side-effect in QEMU is that if SDL_WM_GrabInput() fails we still change the window title to indicate that it's grabbed, when in fact it's not. This patch fixes that minor issue. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6325 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'sdl.c')
-rw-r--r--sdl.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sdl.c b/sdl.c
index 15427c5..2ce6e81 100644
--- a/sdl.c
+++ b/sdl.c
@@ -286,9 +286,12 @@ static void sdl_grab_start(void)
SDL_WarpMouse(guest_x, guest_y);
} else
sdl_hide_cursor();
- SDL_WM_GrabInput(SDL_GRAB_ON);
- gui_grab = 1;
- sdl_update_caption();
+
+ if (SDL_WM_GrabInput(SDL_GRAB_ON) == SDL_GRAB_ON) {
+ gui_grab = 1;
+ sdl_update_caption();
+ } else
+ sdl_show_cursor();
}
static void sdl_grab_end(void)