From 2de2e9d031cf7195ccdcf434538ea6b742035ca4 Mon Sep 17 00:00:00 2001
From: Dan Ginsburg <[EMAIL REDACTED]>
Date: Fri, 1 Sep 2023 16:21:44 -0400
Subject: [PATCH] Fix flickering of window when using desktop-fullscreen and
borderless window on multiple monitors on Linux. Closes #8186.
---
src/video/x11/SDL_x11window.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/video/x11/SDL_x11window.c b/src/video/x11/SDL_x11window.c
index 7c211de23d4c..a1c5bb82198a 100644
--- a/src/video/x11/SDL_x11window.c
+++ b/src/video/x11/SDL_x11window.c
@@ -604,8 +604,14 @@ int X11_CreateWindow(SDL_VideoDevice *_this, SDL_Window *window)
return SDL_SetError("Couldn't create window");
}
- SetWindowBordered(display, screen, w,
- !(window->flags & SDL_WINDOW_BORDERLESS));
+ /* Do not set borderless window if in desktop fullscreen, this causes
+ flickering in multi-monitor setups */
+ if (!((window->pending_flags & SDL_WINDOW_FULLSCREEN) &&
+ (window->flags & SDL_WINDOW_BORDERLESS) &&
+ !window->fullscreen_exclusive)) {
+ SetWindowBordered(display, screen, w,
+ !(window->flags & SDL_WINDOW_BORDERLESS));
+ }
sizehints = X11_XAllocSizeHints();
/* Setup the normal size hints */