summaryrefslogtreecommitdiff
path: root/0003-common-Reload-settings-when-graphics-initialize.patch
blob: 41139583d1b2afb7de97cdb703c2d5b8d3fa72a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
From a9928bfcc9c6d81d60e047b7838d4107835b8f89 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Tue, 15 Feb 2022 14:33:22 -0500
Subject: [PATCH 3/4] common: Reload settings when graphics initialize

If GDM starts faster than graphics initialize, then the
udev rules that write out /run/gdm/custom.conf might get
run too late for GDM to notice.

This commit changes GDM to reread its config after graphicals
initialization completes.

https://gitlab.gnome.org/GNOME/gdm/-/issues/763
---
 daemon/gdm-local-display-factory.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index 0b1d3482..8bca8ce9 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -1023,64 +1023,66 @@ on_seat_properties_changed (GDBusConnection *connection,
         g_autoptr(GVariant) changed_prop = NULL;
         g_autofree const gchar **invalidated_props = NULL;
         gboolean changed = FALSE;
         int ret;
 
         /* Extract seat id, i.e. the last element of the object path. */
         seat = strrchr (object_path, '/');
         if (seat == NULL)
                 return;
         seat += 1;
 
         /* Valid seat IDs must start with seat, i.e. ignore "auto" */
         if (!g_str_has_prefix (seat, "seat"))
                 return;
 
         g_variant_get (parameters, "(s@a{sv}^a&s)", NULL, &changed_props, &invalidated_props);
 
         changed_prop = g_variant_lookup_value (changed_props, "CanGraphical", NULL);
         if (changed_prop)
                 changed = TRUE;
         if (!changed && g_strv_contains (invalidated_props, "CanGraphical"))
                 changed = TRUE;
 
         if (!changed)
                 return;
 
         ret = sd_seat_can_graphical (seat);
         if (ret < 0)
                 return;
 
-        if (ret != 0)
+        if (ret != 0) {
+                gdm_settings_direct_reload ();
                 ensure_display_for_seat (GDM_LOCAL_DISPLAY_FACTORY (user_data), seat);
-        else
+        } else {
                 delete_display (GDM_LOCAL_DISPLAY_FACTORY (user_data), seat);
+        }
 }
 
 static gboolean
 lookup_by_session_id (const char *id,
                       GdmDisplay *display,
                       gpointer    user_data)
 {
         const char *looking_for = user_data;
         const char *current;
 
         current = gdm_display_get_session_id (display);
         return g_strcmp0 (current, looking_for) == 0;
 }
 
 static gboolean
 lookup_by_tty (const char *id,
               GdmDisplay *display,
               gpointer    user_data)
 {
         const char *tty_to_find = user_data;
         g_autofree char *tty_to_check = NULL;
         const char *session_id;
         int ret;
 
         session_id = gdm_display_get_session_id (display);
 
         if (!session_id)
                 return FALSE;
 
         ret = sd_session_get_tty (session_id, &tty_to_check);
@@ -1260,60 +1262,61 @@ on_vt_changed (GIOChannel    *source,
         }
 
         g_debug ("GdmLocalDisplayFactory: creating new display on seat0 because of VT change");
 
         ensure_display_for_seat (factory, "seat0");
 
         return G_SOURCE_CONTINUE;
 }
 #endif
 
 #ifdef HAVE_UDEV
 static void
 on_uevent (GUdevClient *client,
            const char  *action,
            GUdevDevice *device,
            GdmLocalDisplayFactory *factory)
 {
         if (!g_udev_device_get_device_file (device))
                 return;
 
         if (g_strcmp0 (action, "add") != 0 &&
             g_strcmp0 (action, "change") != 0)
                 return;
 
         if (!udev_is_settled (factory))
                 return;
 
         g_signal_handler_disconnect (factory->gudev_client, factory->uevent_handler_id);
         factory->uevent_handler_id = 0;
 
+        gdm_settings_direct_reload ();
         ensure_display_for_seat (factory, "seat0");
 }
 #endif
 
 static void
 gdm_local_display_factory_start_monitor (GdmLocalDisplayFactory *factory)
 {
         g_autoptr (GIOChannel) io_channel = NULL;
         const char *subsystems[] = { "drm", NULL };
 
         factory->seat_new_id = g_dbus_connection_signal_subscribe (factory->connection,
                                                                          "org.freedesktop.login1",
                                                                          "org.freedesktop.login1.Manager",
                                                                          "SeatNew",
                                                                          "/org/freedesktop/login1",
                                                                          NULL,
                                                                          G_DBUS_SIGNAL_FLAGS_NONE,
                                                                          on_seat_new,
                                                                          g_object_ref (factory),
                                                                          g_object_unref);
         factory->seat_removed_id = g_dbus_connection_signal_subscribe (factory->connection,
                                                                              "org.freedesktop.login1",
                                                                              "org.freedesktop.login1.Manager",
                                                                              "SeatRemoved",
                                                                              "/org/freedesktop/login1",
                                                                              NULL,
                                                                              G_DBUS_SIGNAL_FLAGS_NONE,
                                                                              on_seat_removed,
                                                                              g_object_ref (factory),
                                                                              g_object_unref);
-- 
2.34.1