src/video/windib/SDL_dibevents.c
changeset 1280 f61f045343d3
parent 1264 f3a3f1890b91
child 1282 217f5d5a49e5
equal deleted inserted replaced
1279:e867f327aa54 1280:f61f045343d3
   402 	return(keysym);
   402 	return(keysym);
   403 }
   403 }
   404 
   404 
   405 int DIB_CreateWindow(_THIS)
   405 int DIB_CreateWindow(_THIS)
   406 {
   406 {
   407 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
   407 	char *windowid = getenv("SDL_WINDOWID");
   408 	wchar_t *SDL_windowid_t;
       
   409 #endif
       
   410 
   408 
   411 #ifndef CS_BYTEALIGNCLIENT
   409 #ifndef CS_BYTEALIGNCLIENT
   412 #define CS_BYTEALIGNCLIENT	0
   410 #define CS_BYTEALIGNCLIENT	0
   413 #endif
   411 #endif
   414 	SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0);
   412 	SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0);
       
   413 
       
   414 	SDL_windowid = (windowid != NULL);
   415 	if ( SDL_windowid ) {
   415 	if ( SDL_windowid ) {
   416 
       
   417 // wince 2.1 does not have strtol
       
   418 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
   416 #if defined(_WIN32_WCE) && (_WIN32_WCE < 300)
   419 		SDL_windowid_t = malloc((strlen(SDL_windowid) + 1) * sizeof(wchar_t));
   417 		/* wince 2.1 does not have strtol */
   420 		MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, SDL_windowid, -1, SDL_windowid_t, strlen(SDL_windowid) + 1);
   418 		wchar_t *windowid_t = malloc((strlen(windowid) + 1) * sizeof(wchar_t));
   421 		SDL_Window = (HWND)wcstol(SDL_windowid_t, NULL, 0);
   419 		MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, windowid, -1, windowid_t, strlen(windowid) + 1);
   422 		free(SDL_windowid_t);
   420 		SDL_Window = (HWND)wcstol(windowid_t, NULL, 0);
       
   421 		free(windowid_t);
   423 #else
   422 #else
   424 		SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0);
   423 		SDL_Window = (HWND)strtol(windowid, NULL, 0);
   425 #endif
   424 #endif
   426 		if ( SDL_Window == NULL ) {
   425 		if ( SDL_Window == NULL ) {
   427 			SDL_SetError("Couldn't get user specified window");
   426 			SDL_SetError("Couldn't get user specified window");
   428 			return(-1);
   427 			return(-1);
   429 		}
   428 		}