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