From 64e8db8432158e5115df18a03bb87ecc1d58ae63 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Mon, 11 Feb 2019 10:32:55 -0500 Subject: [PATCH 3/3] session: ensure login screen over XDMCP connects to its session Right now GTK preferentially picks the wayland display over an X11 display if it finds one. That causes a problem for XDMCP sessions, since there may be a wayland display running on the local console for the GDM user. This commit addresses the issue by forcing the X11 backend if the session is X11. --- daemon/gdm-session.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c index 77d6b8ff0..357e4a297 100644 --- a/daemon/gdm-session.c +++ b/daemon/gdm-session.c @@ -2697,60 +2697,79 @@ set_up_session_environment (GdmSession *self) } static void send_display_mode (GdmSession *self, GdmSessionConversation *conversation) { GdmSessionDisplayMode mode; mode = gdm_session_get_display_mode (self); gdm_dbus_worker_call_set_session_display_mode (conversation->worker_proxy, gdm_session_display_mode_to_string (mode), conversation->worker_cancellable, NULL, NULL); } static void send_session_type (GdmSession *self, GdmSessionConversation *conversation) { const char *session_type = "x11"; if (self->session_type != NULL) { session_type = self->session_type; } gdm_dbus_worker_call_set_environment_variable (conversation->worker_proxy, "XDG_SESSION_TYPE", session_type, conversation->worker_cancellable, NULL, NULL); + + /* If the session type is x11, then set GDK_BACKEND to x11 as well. + * This is so gnome-session-check-accelerated from an XDMCP connection doesn't + * try to use the wayland display running on the local console for the gdm + * user login screen session. + * + * That's the only case where we let a user log in more than once, so it's + * the only situation that matters. + * + * We can drop this code if we ever switch the login screen to use systemd's + * DynamicUser feature. + */ + if (g_strcmp0 (session_type, "x11") == 0) { + gdm_dbus_worker_call_set_environment_variable (conversation->worker_proxy, + "GDK_BACKEND", + "x11", + conversation->worker_cancellable, + NULL, NULL); + } } void gdm_session_open_session (GdmSession *self, const char *service_name) { GdmSessionConversation *conversation; g_return_if_fail (GDM_IS_SESSION (self)); conversation = find_conversation_by_name (self, service_name); if (conversation != NULL) { send_display_mode (self, conversation); send_session_type (self, conversation); gdm_dbus_worker_call_open (conversation->worker_proxy, conversation->worker_cancellable, (GAsyncReadyCallback) on_opened, conversation); } } static void stop_all_other_conversations (GdmSession *self, GdmSessionConversation *conversation_to_keep, gboolean now) { GHashTableIter iter; gpointer key, value; -- 2.30.1