Incorporated slightly modified version of Rainer's WinCE patch
authorSam Lantinga <slouken@lokigames.com>
Wed, 18 Jul 2001 20:04:23 +0000
changeset 1129ef74357a5fb
parent 111 53e3d8ba4321
child 113 e21ac1dd30f1
Incorporated slightly modified version of Rainer's WinCE patch
src/main/win32/SDL_main.c
src/video/windib/SDL_dibevents.c
src/video/windib/SDL_dibvideo.c
     1.1 --- a/src/main/win32/SDL_main.c	Sat Jul 14 20:37:24 2001 +0000
     1.2 +++ b/src/main/win32/SDL_main.c	Wed Jul 18 20:04:23 2001 +0000
     1.3 @@ -16,8 +16,10 @@
     1.4  #include "SDL.h"
     1.5  #include "SDL_main.h"
     1.6  #ifdef main
     1.7 +#ifndef _WIN32_WCE_EMULATION
     1.8  #undef main
     1.9  #endif
    1.10 +#endif
    1.11  
    1.12  /* Do we really not want stdio redirection with Windows CE? */
    1.13  #ifdef _WIN32_WCE
    1.14 @@ -28,7 +30,7 @@
    1.15  #define STDOUT_FILE	TEXT("stdout.txt")
    1.16  #define STDERR_FILE	TEXT("stderr.txt")
    1.17  
    1.18 -#ifdef _WIN32_WCE
    1.19 +#if defined(_WIN32_WCE) && _WIN32_WCE < 300
    1.20  /* seems to be undefined in Win CE although in online help */
    1.21  #define isspace(a) (((CHAR)a == ' ') || ((CHAR)a == '\t'))
    1.22  
    1.23 @@ -52,7 +54,7 @@
    1.24  	}
    1.25  	return p;
    1.26  }
    1.27 -#endif /* _WIN32_WCE */
    1.28 +#endif /* _WIN32_WCE < 300 */
    1.29  
    1.30  /* Parse a command line buffer into arguments */
    1.31  static int ParseCommandLine(char *cmdline, char **argv)
    1.32 @@ -274,7 +276,7 @@
    1.33  	nLen = wcslen(szCmdLine)+128+1;
    1.34  	bufp = (wchar_t *)alloca(nLen*2);
    1.35  	GetModuleFileName(NULL, bufp, 128);
    1.36 -	wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen);
    1.37 +	wcsncpy(bufp+wcslen(bufp), szCmdLine,nLen-wcslen(bufp));
    1.38  	nLen = wcslen(bufp)+1;
    1.39  	cmdline = (char *)alloca(nLen);
    1.40  	if ( cmdline == NULL ) {
     2.1 --- a/src/video/windib/SDL_dibevents.c	Sat Jul 14 20:37:24 2001 +0000
     2.2 +++ b/src/video/windib/SDL_dibevents.c	Wed Jul 18 20:04:23 2001 +0000
     2.3 @@ -87,6 +87,26 @@
     2.4  						wParam = VK_LMENU;
     2.5  					break;
     2.6  			}
     2.7 +#ifdef NO_GETKEYBOARDSTATE
     2.8 +			/* this is the workaround for the missing ToAscii() and ToUnicode() in CE (not necessary at KEYUP!) */
     2.9 +			if ( SDL_TranslateUNICODE ) {
    2.10 +				MSG msg;
    2.11 +
    2.12 +				msg.hwnd = hwnd;
    2.13 +				msg.message = msg;
    2.14 +				msg.wParam = wParam;
    2.15 +				msg.lParam = lParam;
    2.16 +				msg.time = 0;
    2.17 +				if ( TranslateMessage(&m) && PeekMessage(&msg, hwnd, 0, WM_USER, PM_NOREMOVE) && (m.message == WM_CHAR) ) {
    2.18 +					GetMessage(&m, hwnd, 0, WM_USER);
    2.19 +			    		wParam = m.wParam;
    2.20 +				} else {
    2.21 +					wParam = 0;
    2.22 +				}
    2.23 +			} else {
    2.24 +				wParam = 0;
    2.25 +			}
    2.26 +#endif /* NO_GETKEYBOARDSTATE */
    2.27  			posted = SDL_PrivateKeyboard(SDL_PRESSED,
    2.28  				TranslateKey(wParam,HIWORD(lParam),&keysym,1));
    2.29  		}
     3.1 --- a/src/video/windib/SDL_dibvideo.c	Sat Jul 14 20:37:24 2001 +0000
     3.2 +++ b/src/video/windib/SDL_dibvideo.c	Wed Jul 18 20:04:23 2001 +0000
     3.3 @@ -375,9 +375,12 @@
     3.4  	hdc = GetDC(SDL_Window);
     3.5  	depth = GetDeviceCaps(hdc, PLANES) * GetDeviceCaps(hdc, BITSPIXEL);
     3.6  	ReleaseDC(SDL_Window, hdc);
     3.7 +#ifndef _WIN32_WCE
     3.8 +	// AFAIK 16 bit CE devices have indeed RGB 565
     3.9  	if ( depth == 16 ) {
    3.10  		depth = 15;	/* GDI defined as RGB 555 */
    3.11  	}
    3.12 +#endif
    3.13  	return(depth);
    3.14  #else
    3.15      int dib_size;