Don't use both mouse events for the same task
authorPatrice Mandin <patmandin@gmail.com>
Thu, 07 Jul 2005 13:38:22 +0000
changeset 1089b3f7c4af00e0
parent 1088 6091b9ca1a97
child 1090 37fc855580af
Don't use both mouse events for the same task
src/video/gem/SDL_gemevents.c
     1.1 --- a/src/video/gem/SDL_gemevents.c	Thu Jul 07 12:10:30 2005 +0000
     1.2 +++ b/src/video/gem/SDL_gemevents.c	Thu Jul 07 13:38:22 2005 +0000
     1.3 @@ -142,21 +142,26 @@
     1.4  		short buffer[8], kc;
     1.5  		short x2,y2,w2,h2;
     1.6  
     1.7 -		quit = 0;
     1.8 +		quit =
     1.9 +			mouse_event =
    1.10 +			x2=y2=w2=h2 = 0;
    1.11  
    1.12  		event_mask = MU_MESAG|MU_TIMER|MU_KEYBD;
    1.13  		if (!GEM_fullscreen && (GEM_handle>=0)) {
    1.14  			wind_get (GEM_handle, WF_WORKXYWH, &x2, &y2, &w2, &h2);
    1.15 -			event_mask |= MU_M1|MU_M2;
    1.16 -		} else {
    1.17 -			x2=y2=w2=h2=0;
    1.18 +			event_mask |= MU_M1;
    1.19 +			if ( (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
    1.20 +				mouse_event = MO_LEAVE;				
    1.21 +			} else {
    1.22 +				mouse_event = MO_ENTER;				
    1.23 +			}
    1.24  		}
    1.25  
    1.26  		resultat = evnt_multi(
    1.27  			event_mask,
    1.28  			0,0,0,
    1.29 -			MO_ENTER,x2,y2,w2,h2,
    1.30 -			MO_LEAVE,x2,y2,w2,h2,
    1.31 +			mouse_event,x2,y2,w2,h2,
    1.32 +			0,0,0,0,0,
    1.33  			buffer,
    1.34  			10,
    1.35  			&dummy,&dummy,&dummy,&kstate,&kc,&dummy
    1.36 @@ -179,18 +184,13 @@
    1.37  		/* Mouse entering/leaving window */
    1.38  		if (resultat & MU_M1) {
    1.39  			if (this->input_grab == SDL_GRAB_OFF) {
    1.40 -				if ( !(SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
    1.41 +				if (SDL_GetAppState() & SDL_APPMOUSEFOCUS) {
    1.42 +					SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
    1.43 +				} else {
    1.44  					SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
    1.45  				}
    1.46  			}
    1.47  		}
    1.48 -		if (resultat & MU_M2) {
    1.49 -			if (this->input_grab == SDL_GRAB_OFF) {
    1.50 -				if ( (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
    1.51 -					SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
    1.52 -				]
    1.53 -			}
    1.54 -		}
    1.55  
    1.56  		/* Timer event ? */
    1.57  		if ((resultat & MU_TIMER) || quit)