Fixed bug 1155 - Should SDL_WM_GrabInput()/X11_GrabInputNoLock() block? SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Tue, 28 Aug 2018 13:07:26 -0700
branchSDL-1.2
changeset 121570f469a8b5110
parent 12076 3e05d58dc84f
child 12301 d782ee1f09aa
Fixed bug 1155 - Should SDL_WM_GrabInput()/X11_GrabInputNoLock() block?

Makes SDL-1.2 SDL_WM_GrabInput() non-blocking in case of SDL window is not
viewable. Patch provided by <pbonzini@redhat.com>.
src/video/x11/SDL_x11wm.c
     1.1 --- a/src/video/x11/SDL_x11wm.c	Tue Aug 07 10:10:02 2018 +0300
     1.2 +++ b/src/video/x11/SDL_x11wm.c	Tue Aug 28 13:07:26 2018 -0700
     1.3 @@ -352,13 +352,14 @@
     1.4  			result = XGrabPointer(SDL_Display, SDL_Window, True, 0,
     1.5  						GrabModeAsync, GrabModeAsync,
     1.6  						SDL_Window, None, CurrentTime);
     1.7 -			if ( result == GrabSuccess ) {
     1.8 +			if ( result == GrabSuccess || result == GrabNotViewable ) {
     1.9  				break;
    1.10  			}
    1.11  			SDL_Delay(100);
    1.12  		}
    1.13  		if ( result != GrabSuccess ) {
    1.14  			/* Uh, oh, what do we do here? */ ;
    1.15 +			return(SDL_GRAB_OFF);
    1.16  		}
    1.17  		/* Now grab the keyboard */
    1.18  		XGrabKeyboard(SDL_Display, WMwindow, True,