浏览代码

UI: Restrict GNOME wayland override

Some wayland compositors exclusively use xwayland such as gamescope.
This allows us to fallback to the platform determined by Qt, which will
detect these exotic compositors and handle them correctly when not
overidden by this envvar.

Qt preserves this undesired behavior until 6.3. With ubuntu 22 on 6.2
this workaround needs to be preserved.

fixes #6386
Kurt Kartaltepe 2 年之前
父节点
当前提交
1b8a695571
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      UI/obs-app.cpp

+ 4 - 2
UI/obs-app.cpp

@@ -2306,10 +2306,12 @@ static int run_program(fstream &logFile, int argc, char *argv[])
 	/* NOTE: Qt doesn't use the Wayland platform on GNOME, so we have to
 	 * force it using the QT_QPA_PLATFORM env var. It's still possible to
 	 * use other QPA platforms using this env var, or the -platform command
-	 * line option. */
+	 * line option. Remove after Qt 6.3 is everywhere. */
 
+	const char *desktop = getenv("XDG_CURRENT_DESKTOP");
 	const char *session_type = getenv("XDG_SESSION_TYPE");
-	if (session_type && strcmp(session_type, "wayland") == 0)
+	if (session_type && desktop && strcmp(desktop, "GNOME") == 0 &&
+	    strcmp(session_type, "wayland") == 0)
 		setenv("QT_QPA_PLATFORM", "wayland", false);
 #endif
 #endif