mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-12 22:38:13 +00:00
Added SDL_CreateWindowWithPosition()
It turns out there's a race condition on X11 where the window could be placed by the window manager while being placed by the application, so we need to have the initial position available at window creation.
This commit is contained in:
@@ -1312,15 +1312,12 @@ SDLTest_CommonInit(SDLTest_CommonState *state)
|
||||
} else {
|
||||
SDL_strlcpy(title, state->window_title, SDL_arraysize(title));
|
||||
}
|
||||
state->windows[i] = SDL_CreateWindow(title, r.w, r.h, state->window_flags);
|
||||
state->windows[i] = SDL_CreateWindowWithPosition(title, r.x, r.y, r.w, r.h, state->window_flags);
|
||||
if (!state->windows[i]) {
|
||||
SDL_Log("Couldn't create window: %s\n",
|
||||
SDL_GetError());
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if (r.x != SDL_WINDOWPOS_UNDEFINED || r.y != SDL_WINDOWPOS_UNDEFINED) {
|
||||
SDL_SetWindowPosition(state->windows[i], r.x, r.y);
|
||||
}
|
||||
if (state->window_minW || state->window_minH) {
|
||||
SDL_SetWindowMinimumSize(state->windows[i], state->window_minW, state->window_minH);
|
||||
}
|
||||
|
Reference in New Issue
Block a user