Mouse wheel sends mouse button (4/5) events on Windows
authorSam Lantinga <slouken@lokigames.com>
Sat, 16 Jun 2001 01:01:42 +0000
changeset 61994ed1d668e7
parent 60 e093bbc72ab9
child 62 1f9c87186707
Mouse wheel sends mouse button (4/5) events on Windows
docs.html
src/video/wincommon/SDL_sysevents.c
src/video/windx5/SDL_dx5events.c
     1.1 --- a/docs.html	Mon Jun 11 22:54:34 2001 +0000
     1.2 +++ b/docs.html	Sat Jun 16 01:01:42 2001 +0000
     1.3 @@ -16,6 +16,7 @@
     1.4  Major changes since SDL 1.0.0:
     1.5  </H2>
     1.6  <UL>
     1.7 +	<LI> 1.2.1: Mouse wheel sends mouse button (4/5) events on Windows
     1.8  	<LI> 1.2.1: Added MacOS X Project Builder projects (thanks Darrell!)
     1.9  	<LI> 1.2.1: Added initial support for Quartz video (thanks Darrell!)
    1.10  	<LI> 1.2.1: Disabled Linux /dev/event joystick interface by default
     2.1 --- a/src/video/wincommon/SDL_sysevents.c	Mon Jun 11 22:54:34 2001 +0000
     2.2 +++ b/src/video/wincommon/SDL_sysevents.c	Sat Jun 16 01:01:42 2001 +0000
     2.3 @@ -321,6 +321,34 @@
     2.4  		}
     2.5  		return(0);
     2.6  
     2.7 +
     2.8 +#if (_WIN32_WINNT >= 0x0400) || (_WIN32_WINDOWS > 0x0400)
     2.9 +		case WM_MOUSEWHEEL: 
    2.10 +			if ( SDL_VideoSurface && ! DINPUT_FULLSCREEN() ) {
    2.11 +				Sint16 x, y;
    2.12 +				Uint8 button = 0;
    2.13 +				int move = (short)HIWORD(wParam);
    2.14 +				if(move > 0)
    2.15 +					button = 4;
    2.16 +				else if(move < 0)
    2.17 +					button = 5;
    2.18 +				if(button)
    2.19 +				{
    2.20 +					if ( mouse_relative ) {
    2.21 +					/*	RJR: March 28, 2000
    2.22 +						report internal mouse position if in relative mode */
    2.23 +						x = 0; y = 0;
    2.24 +					} else {
    2.25 +						x = (Sint16)LOWORD(lParam);
    2.26 +						y = (Sint16)HIWORD(lParam);
    2.27 +					}
    2.28 +					posted = SDL_PrivateMouseButton(
    2.29 +								SDL_PRESSED, button, x, y);
    2.30 +				}
    2.31 +			}
    2.32 +			return(0);
    2.33 +#endif
    2.34 +
    2.35  #ifdef WM_GETMINMAXINFO
    2.36  		/* This message is sent as a way for us to "check" the values
    2.37  		 * of a position change.  If we don't like it, we can adjust
     3.1 --- a/src/video/windx5/SDL_dx5events.c	Mon Jun 11 22:54:34 2001 +0000
     3.2 +++ b/src/video/windx5/SDL_dx5events.c	Sat Jun 16 01:01:42 2001 +0000
     3.3 @@ -379,6 +379,20 @@
     3.4  			case DIMOFS_Y:
     3.5  				yrel += (Sint16)ptrbuf[i].dwData;
     3.6  				break;
     3.7 +			case DIMOFS_Z:
     3.8 +				if ( xrel || yrel ) {
     3.9 +					posted = SDL_PrivateMouseMotion(
    3.10 +							0, 1, xrel, yrel);
    3.11 +					xrel = 0;
    3.12 +					yrel = 0;
    3.13 +				}
    3.14 +				if((int)ptrbuf[i].dwData > 0)
    3.15 +					posted = SDL_PrivateMouseButton(
    3.16 +							SDL_PRESSED, 4, 0, 0);
    3.17 +				else if((int)ptrbuf[i].dwData < 0)
    3.18 +					posted = SDL_PrivateMouseButton(
    3.19 +							SDL_PRESSED, 5, 0, 0);
    3.20 +				break;
    3.21  			case DIMOFS_BUTTON0:
    3.22  			case DIMOFS_BUTTON1:
    3.23  			case DIMOFS_BUTTON2: