Fixed bug #294 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Sat, 23 Sep 2006 23:07:52 +0000
branchSDL-1.2
changeset 3868b2f59aadec0d
parent 3867 4dae257a9cbf
child 3869 b0955ae208f3
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
src/video/windib/SDL_dibevents.c
src/video/windib/SDL_dibvideo.c
test/testalpha.c
     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 */
     2.1 --- a/src/video/windib/SDL_dibvideo.c	Sat Sep 16 12:00:03 2006 +0000
     2.2 +++ b/src/video/windib/SDL_dibvideo.c	Sat Sep 23 23:07:52 2006 +0000
     2.3 @@ -785,7 +785,12 @@
     2.4  		bounds.top = SDL_windowY;
     2.5  		bounds.right = SDL_windowX+video->w;
     2.6  		bounds.bottom = SDL_windowY+video->h;
     2.7 +#ifndef _WIN32_WCE
     2.8  		AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), (GetMenu(SDL_Window) != NULL), 0);
     2.9 +#else
    2.10 +		// The bMenu parameter must be FALSE; menu bars are not supported
    2.11 +		AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), 0, 0);
    2.12 +#endif
    2.13  		width = bounds.right-bounds.left;
    2.14  		height = bounds.bottom-bounds.top;
    2.15  		if ( (flags & SDL_FULLSCREEN) ) {
     3.1 --- a/test/testalpha.c	Sat Sep 16 12:00:03 2006 +0000
     3.2 +++ b/test/testalpha.c	Sat Sep 23 23:07:52 2006 +0000
     3.3 @@ -505,9 +505,14 @@
     3.4  					}
     3.5  					break;
     3.6  				case SDL_KEYDOWN:
     3.7 +#ifndef _WIN32_WCE
     3.8  					if ( event.key.keysym.sym == SDLK_ESCAPE ) {
     3.9  						done = 1;
    3.10  					}
    3.11 +#else
    3.12 +					// there is no ESC key at all
    3.13 +					done = 1;
    3.14 +#endif
    3.15  					break;
    3.16  				case SDL_QUIT:
    3.17  					done = 1;