summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2021-03-11 18:52:48 +0100
committerBenjamin Berg <bberg@redhat.com>2021-03-12 19:28:25 +0100
commit9b25248c96129641ba2b1b0b64c21a1dc41e38ae (patch)
treeefb865521bed7356686e5394fde20cae5ae60750
parent7c6860d9b5893777e0327b331002c6a142470581 (diff)
downloadmutter-9b25248c96129641ba2b1b0b64c21a1dc41e38ae.tar.gz
main: Force Xwayland startup if not on systemd
In non-systemd managed session we are unable to start services on demand. Instead, gnome-session will start everything at login time, including any X11 related service (i.e. gsd-xsettings). However, in order to start gsd-xsettings, Xwayland needs to be started already. Otherwise it will connect to GNOME_SETUP_DISPLAY and login will hang at that point. Fix this by detecting whether mutter is running in a systemd unit. If it is, we assume that we are systemd managed and the machinery to start the services works fine. If not, we assume that the session management may unconditionally try to start X11 related services and Xwayland must be started in order to not block this. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1771>
-rw-r--r--src/core/main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 6b26990c6..c189eceb5 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -1014,11 +1014,18 @@ meta_get_x11_display_policy (void)
#ifdef HAVE_WAYLAND
if (meta_is_wayland_compositor ())
{
+#ifdef HAVE_XWAYLAND_INITFD
+ g_autofree char *unit = NULL;
+#endif
+
if (opt_no_x11)
return META_DISPLAY_POLICY_DISABLED;
#ifdef HAVE_XWAYLAND_INITFD
- return META_DISPLAY_POLICY_ON_DEMAND;
+ if (sd_pid_get_user_unit (0, &unit) < 0)
+ return META_DISPLAY_POLICY_MANDATORY;
+ else
+ return META_DISPLAY_POLICY_ON_DEMAND;
#endif
}
#endif