src/video/windib/SDL_dibevents.c
changeset 1251 86d0d01290ea
parent 1152 51a8702d8ecd
child 1253 7c7ddaf195bf
     1.1 --- a/src/video/windib/SDL_dibevents.c	Thu Jan 19 08:36:41 2006 +0000
     1.2 +++ b/src/video/windib/SDL_dibevents.c	Thu Jan 19 08:43:00 2006 +0000
     1.3 @@ -59,6 +59,31 @@
     1.4     and give him a chance to handle some messages. */
     1.5  static WNDPROC userWindowProc = NULL;
     1.6  
     1.7 +
     1.8 +#ifdef _WIN32_WCE
     1.9 +
    1.10 +WPARAM rotateKey(WPARAM key,SDL_ScreenOrientation direction) 
    1.11 +{
    1.12 +	if (direction != SDL_ORIENTATION_LEFT)
    1.13 +		return key;
    1.14 +
    1.15 +	switch (key) {
    1.16 +		case 0x26: /* up */
    1.17 +			return 0x27;
    1.18 +		case 0x27: /* right */
    1.19 +			return 0x28;
    1.20 +		case 0x28: /* down */
    1.21 +			return 0x25;
    1.22 +		case 0x25: /* left */
    1.23 +			return 0x26;
    1.24 +	}
    1.25 +
    1.26 +	return key;
    1.27 +}
    1.28 +
    1.29 +#endif 
    1.30 +
    1.31 +
    1.32  /* The main Win32 event handler */
    1.33  LONG
    1.34   DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    1.35 @@ -70,6 +95,15 @@
    1.36  		case WM_KEYDOWN: {
    1.37  			SDL_keysym keysym;
    1.38  
    1.39 +#ifdef _WIN32_WCE
    1.40 +			// Drop GAPI artefacts
    1.41 +			if (wParam == 0x84 || wParam == 0x5B)
    1.42 +				return 0;
    1.43 +
    1.44 +			// Rotate key if necessary
    1.45 +			if (this->hidden->orientation != SDL_ORIENTATION_UP)
    1.46 +				wParam = rotateKey(wParam, this->hidden->orientation);	
    1.47 +#endif 
    1.48  			/* Ignore repeated keys */
    1.49  			if ( lParam&REPEATED_KEYMASK ) {
    1.50  				return(0);
    1.51 @@ -127,6 +161,16 @@
    1.52  		case WM_KEYUP: {
    1.53  			SDL_keysym keysym;
    1.54  
    1.55 +#ifdef _WIN32_WCE
    1.56 +			// Drop GAPI artefacts
    1.57 +			if (wParam == 0x84 || wParam == 0x5B)
    1.58 +				return 0;
    1.59 +
    1.60 +			// Rotate key if necessary
    1.61 +			if (this->hidden->orientation != SDL_ORIENTATION_UP)
    1.62 +				wParam = rotateKey(wParam, this->hidden->orientation);	
    1.63 +#endif
    1.64 +
    1.65  			switch (wParam) {
    1.66  				case VK_CONTROL:
    1.67  					if ( lParam&EXTENDED_KEYMASK )