src/video/windx5/SDL_dx5events.c
changeset 460 a888b3ae31ff
parent 458 a8a0a4f19df7
child 491 da6a7e859616
     1.1 --- a/src/video/windx5/SDL_dx5events.c	Tue Aug 20 05:59:31 2002 +0000
     1.2 +++ b/src/video/windx5/SDL_dx5events.c	Tue Aug 20 06:01:20 2002 +0000
     1.3 @@ -221,33 +221,6 @@
     1.4  	return(0);
     1.5  }
     1.6  
     1.7 -/* Change cooperative level based on whether or not we are fullscreen */
     1.8 -void DX5_DInputReset(_THIS, int fullscreen)
     1.9 -{
    1.10 -	DWORD level;
    1.11 -	int i;
    1.12 -	HRESULT result;
    1.13 -
    1.14 -	for ( i=0; i<MAX_INPUTS; ++i ) {
    1.15 -		if ( SDL_DIdev[i] != NULL ) {
    1.16 -			if ( fullscreen ) {
    1.17 -				level = inputs[i].raw_level;
    1.18 -			} else {
    1.19 -				level = inputs[i].win_level;
    1.20 -			}
    1.21 -			IDirectInputDevice2_Unacquire(SDL_DIdev[i]);
    1.22 -			result = IDirectInputDevice2_SetCooperativeLevel(
    1.23 -					SDL_DIdev[i], SDL_Window, level);
    1.24 -			IDirectInputDevice2_Acquire(SDL_DIdev[i]);
    1.25 -			if ( result != DI_OK ) {
    1.26 -				SetDIerror(
    1.27 -			"DirectInputDevice::SetCooperativeLevel", result);
    1.28 -			}
    1.29 -		}
    1.30 -	}
    1.31 -	mouse_lost = 1;
    1.32 -}
    1.33 -
    1.34  /* Clean up DirectInput */
    1.35  static void DX5_DInputQuit(_THIS)
    1.36  {
    1.37 @@ -396,10 +369,10 @@
    1.38  					yrel = 0;
    1.39  				}
    1.40  				if((int)ptrbuf[i].dwData > 0)
    1.41 -					button = 4;
    1.42 +					button = SDL_BUTTON_WHEELUP;
    1.43  				else
    1.44 -					button = 5;
    1.45 -					posted = SDL_PrivateMouseButton(
    1.46 +					button = SDL_BUTTON_WHEELDOWN;
    1.47 +				posted = SDL_PrivateMouseButton(
    1.48  						SDL_PRESSED, button, 0, 0);
    1.49  				posted |= SDL_PrivateMouseButton(
    1.50  						SDL_RELEASED, button, 0, 0);
    1.51 @@ -543,7 +516,7 @@
    1.52     1 if there was input, 0 if there was no input, or -1 if the application has
    1.53     posted a quit message.
    1.54  */
    1.55 -static int DX5_CheckInput(_THIS, int timeout)
    1.56 +static int DX5_CheckInput(_THIS, int timeout, BOOL processInput)
    1.57  {
    1.58  	MSG msg;
    1.59  	int      i;
    1.60 @@ -602,7 +575,7 @@
    1.61  							evtbuf, &numevents, 0);
    1.62  		}
    1.63  		/* Handle the events */
    1.64 -		if ( result == DI_OK ) {
    1.65 +		if ( result == DI_OK && processInput ) {
    1.66  			/* Note: This can post multiple events to event queue
    1.67  			 */
    1.68  			(*SDL_DIfun[event])((int)numevents, evtbuf);
    1.69 @@ -623,10 +596,40 @@
    1.70  	return(0);
    1.71  }
    1.72  
    1.73 +/* Change cooperative level based on whether or not we are fullscreen */
    1.74 +void DX5_DInputReset(_THIS, int fullscreen)
    1.75 +{
    1.76 +	DWORD level;
    1.77 +	int i;
    1.78 +	HRESULT result;
    1.79 +
    1.80 +	for ( i=0; i<MAX_INPUTS; ++i ) {
    1.81 +		if ( SDL_DIdev[i] != NULL ) {
    1.82 +			if ( fullscreen ) {
    1.83 +				level = inputs[i].raw_level;
    1.84 +			} else {
    1.85 +				level = inputs[i].win_level;
    1.86 +			}
    1.87 +			IDirectInputDevice2_Unacquire(SDL_DIdev[i]);
    1.88 +			result = IDirectInputDevice2_SetCooperativeLevel(
    1.89 +					SDL_DIdev[i], SDL_Window, level);
    1.90 +			IDirectInputDevice2_Acquire(SDL_DIdev[i]);
    1.91 +			if ( result != DI_OK ) {
    1.92 +				SetDIerror(
    1.93 +			"DirectInputDevice::SetCooperativeLevel", result);
    1.94 +			}
    1.95 +		}
    1.96 +	}
    1.97 +	mouse_lost = 1;
    1.98 +
    1.99 +	/* Flush pending input */
   1.100 +	DX5_CheckInput(this, 0, FALSE);
   1.101 +}
   1.102 +
   1.103  void DX5_PumpEvents(_THIS)
   1.104  {
   1.105  	/* Wait for messages and DirectInput */
   1.106 -	while ( DX5_CheckInput(this, 0) > 0 ) {
   1.107 +	while ( DX5_CheckInput(this, 0, TRUE) > 0 ) {
   1.108  		/* Loop and check again */;
   1.109  	}
   1.110  }