bbc35a
Makes SDL-1.2 SDL_WM_GrabInput() non-blocking in case of SDL window is not
bbc35a
viewable. Patch provided by <pbonzini@redhat.com>.
bbc35a
See <http://bugzilla.libsdl.org/show_bug.cgi?id=1155>.
bbc35a
bbc35a
--- ./src/video/x11/SDL_x11wm.c	2007-12-31 04:48:13.000000000 +0000
bbc35a
+++ ./src/video/x11/SDL_x11wm.c	2009-01-15 10:27:14.000000000 +0000
bbc35a
@@ -351,13 +351,14 @@ SDL_GrabMode X11_GrabInputNoLock(_THIS, 
bbc35a
 			result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
bbc35a
 						GrabModeAsync, GrabModeAsync,
bbc35a
 						SDL_Window, None, CurrentTime);
bbc35a
-			if ( result == GrabSuccess ) {
bbc35a
+			if ( result == GrabSuccess || result == GrabNotViewable ) {
bbc35a
 				break;
bbc35a
 			}
bbc35a
 			SDL_Delay(100);
bbc35a
 		}
bbc35a
 		if ( result != GrabSuccess ) {
bbc35a
 			/* Uh, oh, what do we do here? */ ;
bbc35a
+			return(SDL_GRAB_OFF);
bbc35a
 		}
bbc35a
 		/* Now grab the keyboard */
bbc35a
 		XGrabKeyboard(SDL_Display, WMwindow, True,