diff src/video/windib/SDL_dibevents.c @ 1280:f61f045343d3

Re-query the SDL_WINDOWID each time we initialize the video
author Sam Lantinga <slouken@libsdl.org>
date Sun, 29 Jan 2006 06:11:38 +0000
parents f3a3f1890b91
children 217f5d5a49e5
line wrap: on
line diff
--- a/src/video/windib/SDL_dibevents.c	Sat Jan 28 05:47:11 2006 +0000
+++ b/src/video/windib/SDL_dibevents.c	Sun Jan 29 06:11:38 2006 +0000
@@ -404,24 +404,23 @@
 
 int DIB_CreateWindow(_THIS)
 {
-#if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
-	wchar_t *SDL_windowid_t;
-#endif
+	char *windowid = getenv("SDL_WINDOWID");
 
 #ifndef CS_BYTEALIGNCLIENT
 #define CS_BYTEALIGNCLIENT	0
 #endif
 	SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0);
+
+	SDL_windowid = (windowid != NULL);
 	if ( SDL_windowid ) {
-
-// wince 2.1 does not have strtol
 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
-		SDL_windowid_t = malloc((strlen(SDL_windowid) + 1) * sizeof(wchar_t));
-		MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, SDL_windowid, -1, SDL_windowid_t, strlen(SDL_windowid) + 1);
-		SDL_Window = (HWND)wcstol(SDL_windowid_t, NULL, 0);
-		free(SDL_windowid_t);
+		/* wince 2.1 does not have strtol */
+		wchar_t *windowid_t = malloc((strlen(windowid) + 1) * sizeof(wchar_t));
+		MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, windowid, -1, windowid_t, strlen(windowid) + 1);
+		SDL_Window = (HWND)wcstol(windowid_t, NULL, 0);
+		free(windowid_t);
 #else
-		SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0);
+		SDL_Window = (HWND)strtol(windowid, NULL, 0);
 #endif
 		if ( SDL_Window == NULL ) {
 			SDL_SetError("Couldn't get user specified window");