x11: Improve sync algorithm

Track and check move and resize requests separately, and consider them done if either the window is already at the expected location, or at least one configure event which moved or resized the window was processed. The avoids a timeout condition if resizing the window caused it to be implicitly moved in order to keep it within desktop bounds.

The automated positioning test now runs on GNOME/X11 without any sync requests timing out.
This commit is contained in:
Frank Praznik
2023-12-08 12:37:10 -05:00
parent 7e5511d3cd
commit 63ae84e140
4 changed files with 32 additions and 14 deletions

View File

@@ -1134,10 +1134,9 @@ static int video_getSetWindowSize(void *arg)
SDL_SetWindowSize(window, desiredW, desiredH);
SDLTest_AssertPass("Call to SDL_SetWindowSize(...,%d,%d)", desiredW, desiredH);
/* The sync may time out if changing the size changes the window position. */
result = SDL_SyncWindow(window);
SDLTest_AssertPass("SDL_SyncWindow()");
SDLTest_AssertCheck(result >= 0, "Verify return value; expected: >=0, got: %d", result);
SDLTest_AssertCheck(result == 0, "Verify return value; expected: 0, got: %d", result);
/* Get size */
currentW = desiredW + 1;