Blame SOURCES/0003-daemon-Infer-session-type-from-desktop-file-if-user-.patch

1f0c33
From 3eea287750d63cfe94fe777111e1cd04141eecb3 Mon Sep 17 00:00:00 2001
1f0c33
From: Ray Strode <rstrode@redhat.com>
1f0c33
Date: Wed, 29 Sep 2021 11:03:41 -0400
1f0c33
Subject: [PATCH 3/3] daemon: Infer session type from desktop file if user has
1f0c33
 no saved session type
1f0c33
1f0c33
The accountsservice user cache file can specify a session type
1f0c33
associated with the saved session.  This is optional though. If one
1f0c33
isn't specified GDM needs to figure out the session type based on the
1f0c33
list of preferred session types for the system and the session file
1f0c33
itself.
1f0c33
1f0c33
It was failing to do the latter, though.  This commit fixes that.
1f0c33
---
1f0c33
 daemon/gdm-session.c | 2 ++
1f0c33
 1 file changed, 2 insertions(+)
1f0c33
1f0c33
diff --git a/daemon/gdm-session.c b/daemon/gdm-session.c
1f0c33
index b54687d5..a65fa0f9 100644
1f0c33
--- a/daemon/gdm-session.c
1f0c33
+++ b/daemon/gdm-session.c
1f0c33
@@ -1009,60 +1009,62 @@ worker_on_saved_language_name_read (GdmDBusWorker          *worker,
1f0c33
                 }
1f0c33
         }
1f0c33
 }
1f0c33
 
1f0c33
 static void
1f0c33
 worker_on_saved_session_name_read (GdmDBusWorker          *worker,
1f0c33
                                    const char             *session_name,
1f0c33
                                    GdmSessionConversation *conversation)
1f0c33
 {
1f0c33
         GdmSession *self = conversation->session;
1f0c33
 
1f0c33
         if (! get_session_command_for_name (self, session_name, self->saved_session_type, NULL)) {
1f0c33
                 /* ignore sessions that don't exist */
1f0c33
                 g_debug ("GdmSession: not using invalid .dmrc session: %s", session_name);
1f0c33
                 g_free (self->saved_session);
1f0c33
                 self->saved_session = NULL;
1f0c33
                 update_session_type (self);
1f0c33
         } else {
1f0c33
                 if (strcmp (session_name,
1f0c33
                             get_default_session_name (self)) != 0) {
1f0c33
                         g_free (self->saved_session);
1f0c33
                         self->saved_session = g_strdup (session_name);
1f0c33
 
1f0c33
                         if (self->greeter_interface != NULL) {
1f0c33
                                 gdm_dbus_greeter_emit_default_session_name_changed (self->greeter_interface,
1f0c33
                                                                                     session_name);
1f0c33
                         }
1f0c33
                 }
1f0c33
                 if (self->saved_session_type != NULL)
1f0c33
                         set_session_type (self, self->saved_session_type);
1f0c33
+                else
1f0c33
+                        update_session_type (self);
1f0c33
         }
1f0c33
 
1f0c33
 }
1f0c33
 
1f0c33
 static void
1f0c33
 worker_on_saved_session_type_read (GdmDBusWorker          *worker,
1f0c33
                                    const char             *session_type,
1f0c33
                                    GdmSessionConversation *conversation)
1f0c33
 {
1f0c33
         GdmSession *self = conversation->session;
1f0c33
 
1f0c33
         g_free (self->saved_session_type);
1f0c33
         self->saved_session_type = g_strdup (session_type);
1f0c33
 }
1f0c33
 
1f0c33
 static GdmSessionConversation *
1f0c33
 find_conversation_by_pid (GdmSession *self,
1f0c33
                           GPid        pid)
1f0c33
 {
1f0c33
         GHashTableIter iter;
1f0c33
         gpointer key, value;
1f0c33
 
1f0c33
         g_hash_table_iter_init (&iter, self->conversations);
1f0c33
         while (g_hash_table_iter_next (&iter, &key, &value)) {
1f0c33
                 GdmSessionConversation *conversation;
1f0c33
 
1f0c33
                 conversation = (GdmSessionConversation *) value;
1f0c33
 
1f0c33
                 if (conversation->worker_pid == pid) {
1f0c33
                         return conversation;
1f0c33
-- 
1f0c33
2.31.1
1f0c33