Fixed bug #716 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Sun, 27 Sep 2009 23:22:57 +0000
branchSDL-1.2
changeset 42555a203e2b0162
parent 4254 8afecb86be35
child 4256 ba587a51f899
Fixed bug #716

Armin Burgmeier 2009-03-15 04:35:45 PDT

When I hold a mouse button down on another (non-SDL) window, then move the
mouse over an SDL window and releasing the mouse button there, then the
application does not receive an SDL_ACTIVEEVENT with state SDL_APPMOUSEFOCUS
and gain 1.

Furthermore, SDL_GetAppState() reports the application not having mouse focus
until moving the mouse out of the window and back in again.
src/video/x11/SDL_x11events.c
     1.1 --- a/src/video/x11/SDL_x11events.c	Sun Sep 27 22:41:34 2009 +0000
     1.2 +++ b/src/video/x11/SDL_x11events.c	Sun Sep 27 23:22:57 2009 +0000
     1.3 @@ -423,15 +423,12 @@
     1.4  if ( xevent.xcrossing.mode == NotifyUngrab )
     1.5  printf("Mode: NotifyUngrab\n");
     1.6  #endif
     1.7 -		if ( (xevent.xcrossing.mode != NotifyGrab) &&
     1.8 -		     (xevent.xcrossing.mode != NotifyUngrab) ) {
     1.9 -			if ( this->input_grab == SDL_GRAB_OFF ) {
    1.10 -				posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
    1.11 -			}
    1.12 -			posted = SDL_PrivateMouseMotion(0, 0,
    1.13 -					xevent.xcrossing.x,
    1.14 -					xevent.xcrossing.y);
    1.15 +		if ( this->input_grab == SDL_GRAB_OFF ) {
    1.16 +			posted = SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
    1.17  		}
    1.18 +		posted = SDL_PrivateMouseMotion(0, 0,
    1.19 +				xevent.xcrossing.x,
    1.20 +				xevent.xcrossing.y);
    1.21  	    }
    1.22  	    break;
    1.23  
    1.24 @@ -444,9 +441,7 @@
    1.25  if ( xevent.xcrossing.mode == NotifyUngrab )
    1.26  printf("Mode: NotifyUngrab\n");
    1.27  #endif
    1.28 -		if ( (xevent.xcrossing.mode != NotifyGrab) &&
    1.29 -		     (xevent.xcrossing.mode != NotifyUngrab) &&
    1.30 -		     (xevent.xcrossing.detail != NotifyInferior) ) {
    1.31 +		if ( xevent.xcrossing.detail != NotifyInferior ) {
    1.32  			if ( this->input_grab == SDL_GRAB_OFF ) {
    1.33  				posted = SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
    1.34  			} else {