Blame SOURCES/0003-common-Reload-settings-when-graphics-initialize.patch

84adb8
From a9928bfcc9c6d81d60e047b7838d4107835b8f89 Mon Sep 17 00:00:00 2001
84adb8
From: Ray Strode <rstrode@redhat.com>
84adb8
Date: Tue, 15 Feb 2022 14:33:22 -0500
84adb8
Subject: [PATCH 3/4] common: Reload settings when graphics initialize
84adb8
84adb8
If GDM starts faster than graphics initialize, then the
84adb8
udev rules that write out /run/gdm/custom.conf might get
84adb8
run too late for GDM to notice.
84adb8
84adb8
This commit changes GDM to reread its config after graphicals
84adb8
initialization completes.
84adb8
84adb8
https://gitlab.gnome.org/GNOME/gdm/-/issues/763
84adb8
---
84adb8
 daemon/gdm-local-display-factory.c | 7 +++++--
84adb8
 1 file changed, 5 insertions(+), 2 deletions(-)
84adb8
84adb8
diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
84adb8
index 0b1d3482..8bca8ce9 100644
84adb8
--- a/daemon/gdm-local-display-factory.c
84adb8
+++ b/daemon/gdm-local-display-factory.c
84adb8
@@ -1023,64 +1023,66 @@ on_seat_properties_changed (GDBusConnection *connection,
84adb8
         g_autoptr(GVariant) changed_prop = NULL;
84adb8
         g_autofree const gchar **invalidated_props = NULL;
84adb8
         gboolean changed = FALSE;
84adb8
         int ret;
84adb8
 
84adb8
         /* Extract seat id, i.e. the last element of the object path. */
84adb8
         seat = strrchr (object_path, '/');
84adb8
         if (seat == NULL)
84adb8
                 return;
84adb8
         seat += 1;
84adb8
 
84adb8
         /* Valid seat IDs must start with seat, i.e. ignore "auto" */
84adb8
         if (!g_str_has_prefix (seat, "seat"))
84adb8
                 return;
84adb8
 
84adb8
         g_variant_get (parameters, "(s@a{sv}^a&s)", NULL, &changed_props, &invalidated_props);
84adb8
 
84adb8
         changed_prop = g_variant_lookup_value (changed_props, "CanGraphical", NULL);
84adb8
         if (changed_prop)
84adb8
                 changed = TRUE;
84adb8
         if (!changed && g_strv_contains (invalidated_props, "CanGraphical"))
84adb8
                 changed = TRUE;
84adb8
 
84adb8
         if (!changed)
84adb8
                 return;
84adb8
 
84adb8
         ret = sd_seat_can_graphical (seat);
84adb8
         if (ret < 0)
84adb8
                 return;
84adb8
 
84adb8
-        if (ret != 0)
84adb8
+        if (ret != 0) {
84adb8
+                gdm_settings_direct_reload ();
84adb8
                 ensure_display_for_seat (GDM_LOCAL_DISPLAY_FACTORY (user_data), seat);
84adb8
-        else
84adb8
+        } else {
84adb8
                 delete_display (GDM_LOCAL_DISPLAY_FACTORY (user_data), seat);
84adb8
+        }
84adb8
 }
84adb8
 
84adb8
 static gboolean
84adb8
 lookup_by_session_id (const char *id,
84adb8
                       GdmDisplay *display,
84adb8
                       gpointer    user_data)
84adb8
 {
84adb8
         const char *looking_for = user_data;
84adb8
         const char *current;
84adb8
 
84adb8
         current = gdm_display_get_session_id (display);
84adb8
         return g_strcmp0 (current, looking_for) == 0;
84adb8
 }
84adb8
 
84adb8
 static gboolean
84adb8
 lookup_by_tty (const char *id,
84adb8
               GdmDisplay *display,
84adb8
               gpointer    user_data)
84adb8
 {
84adb8
         const char *tty_to_find = user_data;
84adb8
         g_autofree char *tty_to_check = NULL;
84adb8
         const char *session_id;
84adb8
         int ret;
84adb8
 
84adb8
         session_id = gdm_display_get_session_id (display);
84adb8
 
84adb8
         if (!session_id)
84adb8
                 return FALSE;
84adb8
 
84adb8
         ret = sd_session_get_tty (session_id, &tty_to_check);
84adb8
@@ -1260,60 +1262,61 @@ on_vt_changed (GIOChannel    *source,
84adb8
         }
84adb8
 
84adb8
         g_debug ("GdmLocalDisplayFactory: creating new display on seat0 because of VT change");
84adb8
 
84adb8
         ensure_display_for_seat (factory, "seat0");
84adb8
 
84adb8
         return G_SOURCE_CONTINUE;
84adb8
 }
84adb8
 #endif
84adb8
 
84adb8
 #ifdef HAVE_UDEV
84adb8
 static void
84adb8
 on_uevent (GUdevClient *client,
84adb8
            const char  *action,
84adb8
            GUdevDevice *device,
84adb8
            GdmLocalDisplayFactory *factory)
84adb8
 {
84adb8
         if (!g_udev_device_get_device_file (device))
84adb8
                 return;
84adb8
 
84adb8
         if (g_strcmp0 (action, "add") != 0 &&
84adb8
             g_strcmp0 (action, "change") != 0)
84adb8
                 return;
84adb8
 
84adb8
         if (!udev_is_settled (factory))
84adb8
                 return;
84adb8
 
84adb8
         g_signal_handler_disconnect (factory->gudev_client, factory->uevent_handler_id);
84adb8
         factory->uevent_handler_id = 0;
84adb8
 
84adb8
+        gdm_settings_direct_reload ();
84adb8
         ensure_display_for_seat (factory, "seat0");
84adb8
 }
84adb8
 #endif
84adb8
 
84adb8
 static void
84adb8
 gdm_local_display_factory_start_monitor (GdmLocalDisplayFactory *factory)
84adb8
 {
84adb8
         g_autoptr (GIOChannel) io_channel = NULL;
84adb8
         const char *subsystems[] = { "drm", NULL };
84adb8
 
84adb8
         factory->seat_new_id = g_dbus_connection_signal_subscribe (factory->connection,
84adb8
                                                                          "org.freedesktop.login1",
84adb8
                                                                          "org.freedesktop.login1.Manager",
84adb8
                                                                          "SeatNew",
84adb8
                                                                          "/org/freedesktop/login1",
84adb8
                                                                          NULL,
84adb8
                                                                          G_DBUS_SIGNAL_FLAGS_NONE,
84adb8
                                                                          on_seat_new,
84adb8
                                                                          g_object_ref (factory),
84adb8
                                                                          g_object_unref);
84adb8
         factory->seat_removed_id = g_dbus_connection_signal_subscribe (factory->connection,
84adb8
                                                                              "org.freedesktop.login1",
84adb8
                                                                              "org.freedesktop.login1.Manager",
84adb8
                                                                              "SeatRemoved",
84adb8
                                                                              "/org/freedesktop/login1",
84adb8
                                                                              NULL,
84adb8
                                                                              G_DBUS_SIGNAL_FLAGS_NONE,
84adb8
                                                                              on_seat_removed,
84adb8
                                                                              g_object_ref (factory),
84adb8
                                                                              g_object_unref);
84adb8
-- 
84adb8
2.34.1
84adb8