From 5496f1a623ae8e16347b8e78929d0fc6d2c7972b Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 23 Sep 2006 23:07:52 +0000 Subject: [PATCH] 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 | 23 ++++++++++++++++++++++- src/video/windib/SDL_dibvideo.c | 5 +++++ test/testalpha.c | 5 +++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/video/windib/SDL_dibevents.c b/src/video/windib/SDL_dibevents.c index ce903c573..1d18f86f0 100644 --- a/src/video/windib/SDL_dibevents.c +++ b/src/video/windib/SDL_dibevents.c @@ -273,18 +273,35 @@ static HKL hLayoutUS = NULL; 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; iw; bounds.bottom = SDL_windowY+video->h; +#ifndef _WIN32_WCE 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; height = bounds.bottom-bounds.top; if ( (flags & SDL_FULLSCREEN) ) { diff --git a/test/testalpha.c b/test/testalpha.c index 0bdb7725c..4af5c10fa 100644 --- a/test/testalpha.c +++ b/test/testalpha.c @@ -505,9 +505,14 @@ fprintf(stderr, "Slept %d ticks\n", (SDL_GetTicks()-ticks)); } break; case SDL_KEYDOWN: +#ifndef _WIN32_WCE if ( event.key.keysym.sym == SDLK_ESCAPE ) { done = 1; } +#else + // there is no ESC key at all + done = 1; +#endif break; case SDL_QUIT: done = 1;