From e731522578c664c615d3db81d3cc161790d59357 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 17 Feb 2020 15:02:37 -0500 Subject: [PATCH] x11: Don't delay an extra 10ms if we were just going to break out of the loop. --- src/video/x11/SDL_x11window.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c index d3ffb786b14d9..eca7bdf1c6f84 100644 --- a/src/video/x11/SDL_x11window.c +++ b/src/video/x11/SDL_x11window.c @@ -824,7 +824,7 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) /* Wait a brief time to see if the window manager decided to let this move happen. If the window changes at all, even to an unexpected value, we break out. */ timeout = SDL_GetTicks() + 100; - do { + while (SDL_TRUE) { int x, y; X11_XSync(display, False); X11_XGetWindowAttributes(display, data->xwindow, &attrs); @@ -839,8 +839,12 @@ X11_SetWindowPosition(_THIS, SDL_Window * window) break; /* we're at the place we wanted to be anyhow, drop out. */ } + if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { + break; + } + SDL_Delay(10); - } while (!SDL_TICKS_PASSED(SDL_GetTicks(), timeout)); + } } void