فهرست منبع

x11: Synthesize fullscreen size events on Openbox

Openbox doesn't send size events when entering fullscreen, so they must be synthesized. This is not desirable on any other window manager, as it can break fullscreen positioning on multi-monitor configurations.

(cherry picked from commit e7abbf158a2fd07785423b945240dd967a99b49d)
Frank Praznik 1 ماه پیش
والد
کامیت
26d1afa29c
1فایلهای تغییر یافته به همراه25 افزوده شده و 2 حذف شده
  1. 25 2
      src/video/x11/SDL_x11video.c

+ 25 - 2
src/video/x11/SDL_x11video.c

@@ -78,6 +78,23 @@ static bool X11_IsXWayland(Display *d)
     return X11_XQueryExtension(d, "XWAYLAND", &opcode, &event, &error) == True;
 }
 
+static bool X11_CheckCurrentDesktop(const char *name)
+{
+    SDL_Environment *env = SDL_GetEnvironment();
+
+    const char *desktopVar = SDL_GetEnvironmentVariable(env, "DESKTOP_SESSION");
+    if (desktopVar && SDL_strcasecmp(desktopVar, name) == 0) {
+        return true;
+    }
+
+    desktopVar = SDL_GetEnvironmentVariable(env, "XDG_CURRENT_DESKTOP");
+    if (desktopVar && SDL_strcasestr(desktopVar, name)) {
+        return true;
+    }
+
+    return false;
+}
+
 static SDL_VideoDevice *X11_CreateDevice(void)
 {
     SDL_VideoDevice *device;
@@ -256,8 +273,14 @@ static SDL_VideoDevice *X11_CreateDevice(void)
         device->system_theme = SDL_SystemTheme_Get();
 #endif
 
-    device->device_caps = VIDEO_DEVICE_CAPS_HAS_POPUP_WINDOW_SUPPORT |
-                          VIDEO_DEVICE_CAPS_SENDS_FULLSCREEN_DIMENSIONS;
+    device->device_caps = VIDEO_DEVICE_CAPS_HAS_POPUP_WINDOW_SUPPORT;
+
+    /* Openbox doesn't send the new window dimensions when entering fullscreen, so the events must be synthesized.
+     * This is otherwise not wanted, as it can break fullscreen window positioning on multi-monitor configurations.
+     */
+    if (!X11_CheckCurrentDesktop("openbox")) {
+        device->device_caps |= VIDEO_DEVICE_CAPS_SENDS_DISPLAY_CHANGES;
+    }
 
     data->is_xwayland = X11_IsXWayland(x11_display);
     if (data->is_xwayland) {