[mutter/benzea/xwayland-non-systemd-startup] xwayland: Start Xwayland for services and never stop on non-systemd
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/benzea/xwayland-non-systemd-startup] xwayland: Start Xwayland for services and never stop on non-systemd
- Date: Thu, 11 Mar 2021 11:01:32 +0000 (UTC)
commit acd2551bbba3c31c0b672a971adee3c6efcf828e
Author: Benjamin Berg <bberg redhat com>
Date: Thu Mar 11 11:23:55 2021 +0100
xwayland: Start Xwayland for services and never stop on non-systemd
The (gnome-shell) handling to start the X11 related services (i.e.
gsd-xsettings) requires running in a systemd managed session. If this is
not the case, we must start Xwayland already for gsd-xsettings and we
cannot auto-shutdown Xwayland.
As such, we get three common cases:
* Fully working Xwayland on demand on systemd
* gsd-xsettings starting Xwayland immediately at login time
(this is currently the case for the gnome-initial-setup session)
* Xwayland remaining dormand as nothing ever requires it
(this is the case for the GDM greeter)
src/wayland/meta-wayland.c | 11 ++++++++++-
src/wayland/meta-xwayland.c | 7 +++++++
2 files changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index b032a8bfce..787ec91f73 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -28,6 +28,8 @@
#include <stdlib.h>
#include <wayland-server.h>
+#include <systemd/sd-login.h>
+
#include "clutter/clutter.h"
#include "clutter/wayland/clutter-wayland-compositor.h"
#include "compositor/meta-surface-actor-wayland.h"
@@ -470,6 +472,7 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
{
ClutterActor *stage = meta_backend_get_stage (compositor->backend);
GSource *wayland_event_source;
+ MetaDisplayPolicy policy;
wayland_event_source = wayland_event_source_new (compositor->wayland_display);
@@ -557,7 +560,13 @@ meta_wayland_compositor_setup (MetaWaylandCompositor *compositor)
if (meta_get_x11_display_policy () != META_DISPLAY_POLICY_DISABLED)
{
- set_gnome_env ("GNOME_SETUP_DISPLAY", compositor->xwayland_manager.private_connection.name);
+ g_autofree char *unit = NULL;
+
+ /* On non-systemd, we need to start-up for the services,
+ * so don't set GNOME_SETUP_DISPLAY to the private connection.
+ */
+ if (sd_pid_get_user_unit (0, &unit) >= 0)
+ set_gnome_env ("GNOME_SETUP_DISPLAY", compositor->xwayland_manager.private_connection.name);
set_gnome_env ("DISPLAY", compositor->xwayland_manager.public_connection.name);
set_gnome_env ("XAUTHORITY", meta_wayland_get_xwayland_auth_file (compositor));
}
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 48fabbfb33..88c1aad557 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -45,6 +45,8 @@
#include <xcb/res.h>
+#include <systemd/sd-login.h>
+
#include "backends/meta-monitor-manager-private.h"
#include "backends/meta-settings-private.h"
#include "core/main-private.h"
@@ -577,6 +579,11 @@ shutdown_xwayland_cb (gpointer data)
MetaXWaylandManager *manager = data;
MetaDisplay *display = meta_get_display ();
MetaBackend *backend = meta_get_backend ();
+ g_autofree char* unit = NULL;
+
+ /* Never shutdown on non-systemd */
+ if (sd_pid_get_user_unit (0, &unit) < 0)
+ return G_SOURCE_REMOVE;
if (!meta_settings_is_experimental_feature_enabled (meta_backend_get_settings (backend),
META_EXPERIMENTAL_FEATURE_AUTOCLOSE_XWAYLAND))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]