mirror of
https://github.com/yawut/SDL.git
synced 2026-08-25 02:05:07 -05:00
Re-query the SDL_WINDOWID each time we initialize the video
This commit is contained in:
@@ -61,7 +61,7 @@ extern LPSTR SDL_Appname;
|
||||
#endif
|
||||
extern HINSTANCE SDL_Instance;
|
||||
extern HWND SDL_Window;
|
||||
extern const char *SDL_windowid;
|
||||
extern BOOL SDL_windowid;
|
||||
|
||||
/* Variables and functions exported to other parts of the native video
|
||||
subsystem (SDL_sysevents.c)
|
||||
|
||||
@@ -672,7 +672,7 @@ void *SDL_GetModuleHandle(void)
|
||||
}
|
||||
|
||||
/* This allows the SDL_WINDOWID hack */
|
||||
const char *SDL_windowid = NULL;
|
||||
BOOL SDL_windowid = FALSE;
|
||||
|
||||
static int app_registered = 0;
|
||||
|
||||
@@ -743,9 +743,6 @@ int SDL_RegisterApp(char *name, Uint32 style, void *hInst)
|
||||
}
|
||||
#endif /* WM_MOUSELEAVE */
|
||||
|
||||
/* Check for SDL_WINDOWID hack */
|
||||
SDL_windowid = getenv("SDL_WINDOWID");
|
||||
|
||||
#ifndef NO_GETKEYBOARDSTATE
|
||||
/* Initialise variables for SDL_ToUnicode() */
|
||||
codepage = GetCodePage();
|
||||
|
||||
@@ -44,15 +44,11 @@ static char rcsid =
|
||||
static int WIN_GL_ResetWindow(_THIS)
|
||||
{
|
||||
int status = 0;
|
||||
int can_reset = 1;
|
||||
|
||||
/* If we were passed a window, then we can't create a new one */
|
||||
if ( SDL_windowid ) {
|
||||
can_reset = 0;
|
||||
}
|
||||
#if 0 /* This doesn't work with DirectX code (see CVS comments) */
|
||||
#ifndef _WIN32_WCE /* FIXME WinCE needs the UNICODE version of CreateWindow() */
|
||||
if ( can_reset ) {
|
||||
/* If we were passed a window, then we can't create a new one */
|
||||
if ( !SDL_windowid ) {
|
||||
/* Save the existing window attributes */
|
||||
LONG style;
|
||||
RECT rect = { 0, 0, 0, 0 };
|
||||
|
||||
@@ -404,24 +404,23 @@ static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, in
|
||||
|
||||
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);
|
||||
if ( SDL_windowid ) {
|
||||
|
||||
// wince 2.1 does not have strtol
|
||||
SDL_windowid = (windowid != NULL);
|
||||
if ( SDL_windowid ) {
|
||||
#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");
|
||||
|
||||
@@ -589,7 +589,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
}
|
||||
|
||||
/* DJM: Don't piss of anyone who has setup his own window */
|
||||
if ( SDL_windowid == NULL )
|
||||
if ( !SDL_windowid )
|
||||
SetWindowLong(SDL_Window, GWL_STYLE, style);
|
||||
|
||||
/* Delete the old bitmap if necessary */
|
||||
@@ -665,7 +665,7 @@ SDL_Surface *DIB_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
}
|
||||
|
||||
/* Resize the window */
|
||||
if ( SDL_windowid == NULL ) {
|
||||
if ( !SDL_windowid ) {
|
||||
HWND top;
|
||||
UINT swp_flags;
|
||||
const char *window = getenv("SDL_VIDEO_WINDOW_POS");
|
||||
|
||||
@@ -848,6 +848,7 @@ static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed)
|
||||
|
||||
int DX5_CreateWindow(_THIS)
|
||||
{
|
||||
char *windowid = getenv("SDL_WINDOWID");
|
||||
int i;
|
||||
|
||||
/* Clear out DirectInput variables in case we fail */
|
||||
@@ -861,8 +862,10 @@ int DX5_CreateWindow(_THIS)
|
||||
#define CS_BYTEALIGNCLIENT 0
|
||||
#endif
|
||||
SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0);
|
||||
|
||||
SDL_windowid = (windowid != NULL);
|
||||
if ( SDL_windowid ) {
|
||||
SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0);
|
||||
SDL_Window = (HWND)strtol(windowid, NULL, 0);
|
||||
if ( SDL_Window == NULL ) {
|
||||
SDL_SetError("Couldn't get user specified window");
|
||||
return(-1);
|
||||
|
||||
@@ -1133,11 +1133,11 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
}
|
||||
|
||||
/* DJM: Don't piss of anyone who has setup his own window */
|
||||
if ( SDL_windowid == NULL )
|
||||
if ( !SDL_windowid )
|
||||
SetWindowLong(SDL_Window, GWL_STYLE, style);
|
||||
|
||||
/* Resize the window (copied from SDL WinDIB driver) */
|
||||
if ( SDL_windowid == NULL ) {
|
||||
if ( !SDL_windowid ) {
|
||||
HWND top;
|
||||
UINT swp_flags;
|
||||
const char *window = getenv("SDL_VIDEO_WINDOW_POS");
|
||||
@@ -1223,7 +1223,7 @@ SDL_Surface *DX5_SetVideoMode(_THIS, SDL_Surface *current,
|
||||
#endif
|
||||
}
|
||||
/* DJM: Don't piss of anyone who has setup his own window */
|
||||
if ( SDL_windowid == NULL )
|
||||
if ( !SDL_windowid )
|
||||
SetWindowLong(SDL_Window, GWL_STYLE, style);
|
||||
|
||||
/* Set DirectDraw sharing mode.. exclusive when fullscreen */
|
||||
|
||||
Reference in New Issue
Block a user