src/video/windib/SDL_dibevents.c
changeset 1251 86d0d01290ea
parent 1152 51a8702d8ecd
child 1253 7c7ddaf195bf
equal deleted inserted replaced
1250:a4d515d0fc3a 1251:86d0d01290ea
    57 
    57 
    58 /* DJM: If the user setup the window for us, we want to save his window proc,
    58 /* DJM: If the user setup the window for us, we want to save his window proc,
    59    and give him a chance to handle some messages. */
    59    and give him a chance to handle some messages. */
    60 static WNDPROC userWindowProc = NULL;
    60 static WNDPROC userWindowProc = NULL;
    61 
    61 
       
    62 
       
    63 #ifdef _WIN32_WCE
       
    64 
       
    65 WPARAM rotateKey(WPARAM key,SDL_ScreenOrientation direction) 
       
    66 {
       
    67 	if (direction != SDL_ORIENTATION_LEFT)
       
    68 		return key;
       
    69 
       
    70 	switch (key) {
       
    71 		case 0x26: /* up */
       
    72 			return 0x27;
       
    73 		case 0x27: /* right */
       
    74 			return 0x28;
       
    75 		case 0x28: /* down */
       
    76 			return 0x25;
       
    77 		case 0x25: /* left */
       
    78 			return 0x26;
       
    79 	}
       
    80 
       
    81 	return key;
       
    82 }
       
    83 
       
    84 #endif 
       
    85 
       
    86 
    62 /* The main Win32 event handler */
    87 /* The main Win32 event handler */
    63 LONG
    88 LONG
    64  DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    89  DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
    65 {
    90 {
    66 	extern int posted;
    91 	extern int posted;
    68 	switch (msg) {
    93 	switch (msg) {
    69 		case WM_SYSKEYDOWN:
    94 		case WM_SYSKEYDOWN:
    70 		case WM_KEYDOWN: {
    95 		case WM_KEYDOWN: {
    71 			SDL_keysym keysym;
    96 			SDL_keysym keysym;
    72 
    97 
       
    98 #ifdef _WIN32_WCE
       
    99 			// Drop GAPI artefacts
       
   100 			if (wParam == 0x84 || wParam == 0x5B)
       
   101 				return 0;
       
   102 
       
   103 			// Rotate key if necessary
       
   104 			if (this->hidden->orientation != SDL_ORIENTATION_UP)
       
   105 				wParam = rotateKey(wParam, this->hidden->orientation);	
       
   106 #endif 
    73 			/* Ignore repeated keys */
   107 			/* Ignore repeated keys */
    74 			if ( lParam&REPEATED_KEYMASK ) {
   108 			if ( lParam&REPEATED_KEYMASK ) {
    75 				return(0);
   109 				return(0);
    76 			}
   110 			}
    77 			switch (wParam) {
   111 			switch (wParam) {
   124 		return(0);
   158 		return(0);
   125 
   159 
   126 		case WM_SYSKEYUP:
   160 		case WM_SYSKEYUP:
   127 		case WM_KEYUP: {
   161 		case WM_KEYUP: {
   128 			SDL_keysym keysym;
   162 			SDL_keysym keysym;
       
   163 
       
   164 #ifdef _WIN32_WCE
       
   165 			// Drop GAPI artefacts
       
   166 			if (wParam == 0x84 || wParam == 0x5B)
       
   167 				return 0;
       
   168 
       
   169 			// Rotate key if necessary
       
   170 			if (this->hidden->orientation != SDL_ORIENTATION_UP)
       
   171 				wParam = rotateKey(wParam, this->hidden->orientation);	
       
   172 #endif
   129 
   173 
   130 			switch (wParam) {
   174 			switch (wParam) {
   131 				case VK_CONTROL:
   175 				case VK_CONTROL:
   132 					if ( lParam&EXTENDED_KEYMASK )
   176 					if ( lParam&EXTENDED_KEYMASK )
   133 						wParam = VK_RCONTROL;
   177 						wParam = VK_RCONTROL;