Parcourir la source

x11: Fix boolean/enum comparison

This could set the pending flag even if there was no state change requested, which would cause errant sync timeouts in certain situations.
Frank Praznik il y a 22 heures
Parent
commit
6a3b0413dc
1 fichiers modifiés avec 2 ajouts et 1 suppressions
  1. 2 1
      src/video/x11/SDL_x11window.c

+ 2 - 1
src/video/x11/SDL_x11window.c

@@ -1891,7 +1891,8 @@ static SDL_FullscreenResult X11_SetWindowFullscreenViaWM(SDL_VideoDevice *_this,
         X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
         X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0,
                        SubstructureNotifyMask | SubstructureRedirectMask, &e);
                        SubstructureNotifyMask | SubstructureRedirectMask, &e);
 
 
-        if (!!(window->flags & SDL_WINDOW_FULLSCREEN) != fullscreen) {
+        // Only set the pending flag if the fullscreen state actually changed.
+        if (((window->flags & SDL_WINDOW_FULLSCREEN) != 0) != (fullscreen != 0)) {
             data->pending_operation |= X11_PENDING_OP_FULLSCREEN;
             data->pending_operation |= X11_PENDING_OP_FULLSCREEN;
         }
         }