Jelajahi Sumber

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 tahun lalu
induk
melakukan
1b8a695571
1 mengubah file dengan 4 tambahan dan 2 penghapusan
  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
 	/* 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
 	 * 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
 	 * 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");
 	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);
 		setenv("QT_QPA_PLATFORM", "wayland", false);
 #endif
 #endif
 #endif
 #endif