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:
1 parent
b6ae281e97
commit
2aa2fa5449
9 files changed
+88
-20
No files matched your search
@@ -1672,14 +1672,10 @@ static int video_setWindowCenteredOnDisplay(void *arg)
|
||||
expectedX = (expectedDisplayRect.x + ((expectedDisplayRect.w - w) / 2));
|
||||
expectedY = (expectedDisplayRect.y + ((expectedDisplayRect.h - h) / 2));
|
||||
|
||||
window = SDL_CreateWindow(title, w, h, SDL_WINDOW_HIDDEN);
|
||||
window = SDL_CreateWindowWithPosition(title, x, y, w, h, 0);
|
||||
SDLTest_AssertPass("Call to SDL_CreateWindow('Title',%d,%d,%d,%d,SHOWN)", x, y, w, h);
|
||||
SDLTest_AssertCheck(window != NULL, "Validate that returned window struct is not NULL");
|
||||
|
||||
/* Set the desired position */
|
||||
SDL_SetWindowPosition(window, x, y);
|
||||
SDL_ShowWindow(window);
|
||||
|
||||
/* Check the window is centered on the requested display */
|
||||
currentDisplay = SDL_GetDisplayForWindow(window);
|
||||
SDL_GetWindowSize(window, ¤tW, ¤tH);
|
||||
|
||||
Reference in new issue
Block a user