diff src/video/windib/SDL_dibevents.c @ 1251:86d0d01290ea

Updated Windows CE/PocketPC support...adds GAPI driver, landscape mode, updated project files, VS2005 support, VGA mode, more device support, etc, etc, etc. Fixes Bugzilla #47 and #28. --ryan.
author Ryan C. Gordon <icculus@icculus.org>
date Thu, 19 Jan 2006 08:43:00 +0000
parents 51a8702d8ecd
children 7c7ddaf195bf
line wrap: on
line diff
--- a/src/video/windib/SDL_dibevents.c	Thu Jan 19 08:36:41 2006 +0000
+++ b/src/video/windib/SDL_dibevents.c	Thu Jan 19 08:43:00 2006 +0000
@@ -59,6 +59,31 @@
    and give him a chance to handle some messages. */
 static WNDPROC userWindowProc = NULL;
 
+
+#ifdef _WIN32_WCE
+
+WPARAM rotateKey(WPARAM key,SDL_ScreenOrientation direction) 
+{
+	if (direction != SDL_ORIENTATION_LEFT)
+		return key;
+
+	switch (key) {
+		case 0x26: /* up */
+			return 0x27;
+		case 0x27: /* right */
+			return 0x28;
+		case 0x28: /* down */
+			return 0x25;
+		case 0x25: /* left */
+			return 0x26;
+	}
+
+	return key;
+}
+
+#endif 
+
+
 /* The main Win32 event handler */
 LONG
  DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -70,6 +95,15 @@
 		case WM_KEYDOWN: {
 			SDL_keysym keysym;
 
+#ifdef _WIN32_WCE
+			// Drop GAPI artefacts
+			if (wParam == 0x84 || wParam == 0x5B)
+				return 0;
+
+			// Rotate key if necessary
+			if (this->hidden->orientation != SDL_ORIENTATION_UP)
+				wParam = rotateKey(wParam, this->hidden->orientation);	
+#endif 
 			/* Ignore repeated keys */
 			if ( lParam&REPEATED_KEYMASK ) {
 				return(0);
@@ -127,6 +161,16 @@
 		case WM_KEYUP: {
 			SDL_keysym keysym;
 
+#ifdef _WIN32_WCE
+			// Drop GAPI artefacts
+			if (wParam == 0x84 || wParam == 0x5B)
+				return 0;
+
+			// Rotate key if necessary
+			if (this->hidden->orientation != SDL_ORIENTATION_UP)
+				wParam = rotateKey(wParam, this->hidden->orientation);	
+#endif
+
 			switch (wParam) {
 				case VK_CONTROL:
 					if ( lParam&EXTENDED_KEYMASK )