x11-display: Unset GDK_BACKEND environment variable
mutter needs GDK to use the x11 backend. It already calls gdk_set_allowed_backends ("x11") for this purpose; however, if GDK_BACKEND=wayland (or any other non-x11 backend possibly) happened to be in the environment, GDK would fail to initialize at all. This would result in mutter not registering as X11 window manager, and all X11 clients hanging. Big thanks to Olivier Fourdan for figuring this out! v2: * Restore original value of GDK_BACKEND environment variable after initializing GDK. Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2022283 Bug: https://bugs.debian.org/1008992 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2496>
This commit is contained in:
parent
efaf5a25b3
commit
23526a99c7
@ -1009,6 +1009,7 @@ meta_x11_init_gdk_display (GError **error)
|
||||
{
|
||||
const char *xdisplay_name;
|
||||
GdkDisplay *gdk_display;
|
||||
const char *gdk_backend_env = NULL;
|
||||
const char *gdk_gl_env = NULL;
|
||||
const char *old_no_at_bridge;
|
||||
Display *xdisplay;
|
||||
@ -1023,6 +1024,10 @@ meta_x11_init_gdk_display (GError **error)
|
||||
|
||||
gdk_set_allowed_backends ("x11");
|
||||
|
||||
gdk_backend_env = g_getenv ("GDK_BACKEND");
|
||||
/* GDK would fail to initialize with e.g. GDK_BACKEND=wayland */
|
||||
g_unsetenv ("GDK_BACKEND");
|
||||
|
||||
gdk_gl_env = g_getenv ("GDK_GL");
|
||||
g_setenv ("GDK_GL", "disable", TRUE);
|
||||
|
||||
@ -1053,6 +1058,9 @@ meta_x11_init_gdk_display (GError **error)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (gdk_backend_env)
|
||||
g_setenv("GDK_BACKEND", gdk_backend_env, TRUE);
|
||||
|
||||
if (gdk_gl_env)
|
||||
g_setenv("GDK_GL", gdk_gl_env, TRUE);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user