Skip to content

Commit 0657ece

Browse files
committed
x11: Always send fullscreen dimensions except on XWayland
More non-compositing window managers than just openbox seem to need this, so always force sending the window position and dimensions when entering/leaving fullscreen. If they are wrong, they will be immediately overwritten by the correct dimensions from a subsequent ConfigureNotify event. This is disabled on XWayland, as it seems to cause hitching on some compositors.
1 parent 1f6b5c6 commit 0657ece

File tree

1 file changed

+2
-25
lines changed

1 file changed

+2
-25
lines changed

src/video/x11/SDL_x11video.c

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -77,23 +77,6 @@ static bool X11_IsXWayland(Display *d)
7777
return X11_XQueryExtension(d, "XWAYLAND", &opcode, &event, &error) == True;
7878
}
7979

80-
static bool X11_CheckCurrentDesktop(const char *name)
81-
{
82-
SDL_Environment *env = SDL_GetEnvironment();
83-
84-
const char *desktopVar = SDL_GetEnvironmentVariable(env, "DESKTOP_SESSION");
85-
if (desktopVar && SDL_strcasecmp(desktopVar, name) == 0) {
86-
return true;
87-
}
88-
89-
desktopVar = SDL_GetEnvironmentVariable(env, "XDG_CURRENT_DESKTOP");
90-
if (desktopVar && SDL_strcasestr(desktopVar, name)) {
91-
return true;
92-
}
93-
94-
return false;
95-
}
96-
9780
static SDL_VideoDevice *X11_CreateDevice(void)
9881
{
9982
SDL_VideoDevice *device;
@@ -275,19 +258,13 @@ static SDL_VideoDevice *X11_CreateDevice(void)
275258

276259
device->device_caps = VIDEO_DEVICE_CAPS_HAS_POPUP_WINDOW_SUPPORT;
277260

278-
/* Openbox doesn't send the new window dimensions when entering fullscreen, so the events must be synthesized.
279-
* This is otherwise not wanted, as it can break fullscreen window positioning on multi-monitor configurations.
280-
*/
281-
if (!X11_CheckCurrentDesktop("openbox")) {
282-
device->device_caps |= VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS;
283-
}
284-
285261
data->is_xwayland = X11_IsXWayland(x11_display);
286262
if (data->is_xwayland) {
287263
SDL_LogInfo(SDL_LOG_CATEGORY_VIDEO, "Detected XWayland");
288264

289265
device->device_caps |= VIDEO_DEVICE_CAPS_MODE_SWITCHING_EMULATED |
290-
VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS;
266+
VIDEO_DEVICE_CAPS_DISABLE_MOUSE_WARP_ON_FULLSCREEN_TRANSITIONS |
267+
VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS;
291268
}
292269

293270
return device;

0 commit comments

Comments
 (0)