src/video/windib/SDL_dibevents.c
branchSDL-1.2
changeset 3868 b2f59aadec0d
parent 1852 eb2d5480ae95
child 3981 b0d021cf41b6
     1.1 --- a/src/video/windib/SDL_dibevents.c	Sat Sep 16 12:00:03 2006 +0000
     1.2 +++ b/src/video/windib/SDL_dibevents.c	Sat Sep 23 23:07:52 2006 +0000
     1.3 @@ -273,18 +273,35 @@
     1.4  void DIB_InitOSKeymap(_THIS)
     1.5  {
     1.6  	int	i;
     1.7 -	char	current_layout[256];
     1.8 +#ifndef _WIN32_WCE
     1.9 +	char	current_layout[KL_NAMELENGTH];
    1.10  
    1.11  	GetKeyboardLayoutName(current_layout);
    1.12  	//printf("Initial Keyboard Layout Name: '%s'\n", current_layout);
    1.13  
    1.14  	hLayoutUS = LoadKeyboardLayout("00000409", KLF_NOTELLSHELL);
    1.15 +
    1.16  	if (!hLayoutUS) {
    1.17  		//printf("Failed to load US keyboard layout. Using current.\n");
    1.18  		hLayoutUS = GetKeyboardLayout(0);
    1.19  	}
    1.20  	LoadKeyboardLayout(current_layout, KLF_ACTIVATE);
    1.21 +#else
    1.22 +#if _WIN32_WCE >=420
    1.23 +	TCHAR	current_layout[KL_NAMELENGTH];
    1.24  
    1.25 +	GetKeyboardLayoutName(current_layout);
    1.26 +	//printf("Initial Keyboard Layout Name: '%s'\n", current_layout);
    1.27 +
    1.28 +	hLayoutUS = LoadKeyboardLayout(L"00000409", 0);
    1.29 +
    1.30 +	if (!hLayoutUS) {
    1.31 +		//printf("Failed to load US keyboard layout. Using current.\n");
    1.32 +		hLayoutUS = GetKeyboardLayout(0);
    1.33 +	}
    1.34 +	LoadKeyboardLayout(current_layout, 0);
    1.35 +#endif // _WIN32_WCE >=420
    1.36 +#endif
    1.37  	/* Map the VK keysyms */
    1.38  	for ( i=0; i<SDL_arraysize(VK_keymap); ++i )
    1.39  		VK_keymap[i] = SDLK_UNKNOWN;
    1.40 @@ -414,7 +431,11 @@
    1.41  
    1.42  static int SDL_MapVirtualKey(int scancode, int vkey)
    1.43  {
    1.44 +#ifndef _WIN32_WCE
    1.45  	int	mvke  = MapVirtualKeyEx(scancode & 0xFF, 1, hLayoutUS);
    1.46 +#else
    1.47 +	int	mvke  = MapVirtualKey(scancode & 0xFF, 1);
    1.48 +#endif
    1.49  
    1.50  	switch(vkey) {
    1.51  		/* These are always correct */