diff src/video/windib/SDL_dibevents.c @ 3868:b2f59aadec0d SDL-1.2

Fixed bug #294 Can't build SDL 1.2.11(and svn) for Pocket PC 2003 with Visual Studio 2005 Fix contributed by Dmitry Yakimov
author Sam Lantinga <slouken@libsdl.org>
date Sat, 23 Sep 2006 23:07:52 +0000
parents eb2d5480ae95
children b0d021cf41b6
line wrap: on
line diff
--- a/src/video/windib/SDL_dibevents.c	Sat Sep 16 12:00:03 2006 +0000
+++ b/src/video/windib/SDL_dibevents.c	Sat Sep 23 23:07:52 2006 +0000
@@ -273,18 +273,35 @@
 void DIB_InitOSKeymap(_THIS)
 {
 	int	i;
-	char	current_layout[256];
+#ifndef _WIN32_WCE
+	char	current_layout[KL_NAMELENGTH];
 
 	GetKeyboardLayoutName(current_layout);
 	//printf("Initial Keyboard Layout Name: '%s'\n", current_layout);
 
 	hLayoutUS = LoadKeyboardLayout("00000409", KLF_NOTELLSHELL);
+
 	if (!hLayoutUS) {
 		//printf("Failed to load US keyboard layout. Using current.\n");
 		hLayoutUS = GetKeyboardLayout(0);
 	}
 	LoadKeyboardLayout(current_layout, KLF_ACTIVATE);
+#else
+#if _WIN32_WCE >=420
+	TCHAR	current_layout[KL_NAMELENGTH];
 
+	GetKeyboardLayoutName(current_layout);
+	//printf("Initial Keyboard Layout Name: '%s'\n", current_layout);
+
+	hLayoutUS = LoadKeyboardLayout(L"00000409", 0);
+
+	if (!hLayoutUS) {
+		//printf("Failed to load US keyboard layout. Using current.\n");
+		hLayoutUS = GetKeyboardLayout(0);
+	}
+	LoadKeyboardLayout(current_layout, 0);
+#endif // _WIN32_WCE >=420
+#endif
 	/* Map the VK keysyms */
 	for ( i=0; i<SDL_arraysize(VK_keymap); ++i )
 		VK_keymap[i] = SDLK_UNKNOWN;
@@ -414,7 +431,11 @@
 
 static int SDL_MapVirtualKey(int scancode, int vkey)
 {
+#ifndef _WIN32_WCE
 	int	mvke  = MapVirtualKeyEx(scancode & 0xFF, 1, hLayoutUS);
+#else
+	int	mvke  = MapVirtualKey(scancode & 0xFF, 1);
+#endif
 
 	switch(vkey) {
 		/* These are always correct */