Commit a7123784 authored by Sam Lantinga's avatar Sam Lantinga

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

--HG--
branch : SDL-1.2
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/branches/SDL-1.2%402102
parent 9cc61d56
...@@ -273,18 +273,35 @@ static HKL hLayoutUS = NULL; ...@@ -273,18 +273,35 @@ static HKL hLayoutUS = NULL;
void DIB_InitOSKeymap(_THIS) void DIB_InitOSKeymap(_THIS)
{ {
int i; int i;
char current_layout[256]; #ifndef _WIN32_WCE
char current_layout[KL_NAMELENGTH];
GetKeyboardLayoutName(current_layout); GetKeyboardLayoutName(current_layout);
//printf("Initial Keyboard Layout Name: '%s'\n", current_layout); //printf("Initial Keyboard Layout Name: '%s'\n", current_layout);
hLayoutUS = LoadKeyboardLayout("00000409", KLF_NOTELLSHELL); hLayoutUS = LoadKeyboardLayout("00000409", KLF_NOTELLSHELL);
if (!hLayoutUS) { if (!hLayoutUS) {
//printf("Failed to load US keyboard layout. Using current.\n"); //printf("Failed to load US keyboard layout. Using current.\n");
hLayoutUS = GetKeyboardLayout(0); hLayoutUS = GetKeyboardLayout(0);
} }
LoadKeyboardLayout(current_layout, KLF_ACTIVATE); 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 */ /* Map the VK keysyms */
for ( i=0; i<SDL_arraysize(VK_keymap); ++i ) for ( i=0; i<SDL_arraysize(VK_keymap); ++i )
VK_keymap[i] = SDLK_UNKNOWN; VK_keymap[i] = SDLK_UNKNOWN;
...@@ -414,7 +431,11 @@ void DIB_InitOSKeymap(_THIS) ...@@ -414,7 +431,11 @@ void DIB_InitOSKeymap(_THIS)
static int SDL_MapVirtualKey(int scancode, int vkey) static int SDL_MapVirtualKey(int scancode, int vkey)
{ {
#ifndef _WIN32_WCE
int mvke = MapVirtualKeyEx(scancode & 0xFF, 1, hLayoutUS); int mvke = MapVirtualKeyEx(scancode & 0xFF, 1, hLayoutUS);
#else
int mvke = MapVirtualKey(scancode & 0xFF, 1);
#endif
switch(vkey) { switch(vkey) {
/* These are always correct */ /* These are always correct */
......
...@@ -785,7 +785,12 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current, ...@@ -785,7 +785,12 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
bounds.top = SDL_windowY; bounds.top = SDL_windowY;
bounds.right = SDL_windowX+video->w; bounds.right = SDL_windowX+video->w;
bounds.bottom = SDL_windowY+video->h; bounds.bottom = SDL_windowY+video->h;
#ifndef _WIN32_WCE
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), (GetMenu(SDL_Window) != NULL), 0); AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), (GetMenu(SDL_Window) != NULL), 0);
#else
// The bMenu parameter must be FALSE; menu bars are not supported
AdjustWindowRectEx(&bounds, GetWindowLong(SDL_Window, GWL_STYLE), 0, 0);
#endif
width = bounds.right-bounds.left; width = bounds.right-bounds.left;
height = bounds.bottom-bounds.top; height = bounds.bottom-bounds.top;
if ( (flags & SDL_FULLSCREEN) ) { if ( (flags & SDL_FULLSCREEN) ) {
......
...@@ -505,9 +505,14 @@ fprintf(stderr, "Slept %d ticks\n", (SDL_GetTicks()-ticks)); ...@@ -505,9 +505,14 @@ fprintf(stderr, "Slept %d ticks\n", (SDL_GetTicks()-ticks));
} }
break; break;
case SDL_KEYDOWN: case SDL_KEYDOWN:
#ifndef _WIN32_WCE
if ( event.key.keysym.sym == SDLK_ESCAPE ) { if ( event.key.keysym.sym == SDLK_ESCAPE ) {
done = 1; done = 1;
} }
#else
// there is no ESC key at all
done = 1;
#endif
break; break;
case SDL_QUIT: case SDL_QUIT:
done = 1; done = 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment