[gnome-shell/wip/carlosg/xwayland-startup-side-channel: 254/254] windowManager: Implement MetaDisplay::init-xserver hook



commit ad9b89b1a77f886449469a5cefd03d4ea318dbb0
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Nov 14 23:56:42 2019 +0100

    windowManager: Implement MetaDisplay::init-xserver hook
    
    We do spawn gsd-xsettings, and watch its name before notifying on the
    given task, so the mutter bits can proceed with X11 startup.
    
    One notable change is that we only start gsd-xsettings, instead of the
    generic gnome-session-x11-services target. We do so as we have to wait
    on a dbus name to appear in order to deem the initialization done, and
    making it all depend on gsd-xsettings seems tidier.
    
    https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/836

 js/ui/windowManager.js | 25 ++++++++++++++++++++++---
 1 file changed, 22 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index ea106a67b3..5d92751493 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -897,11 +897,30 @@ var WindowManager = class {
             }
         });
 
-        global.display.connect('x11-display-opened', () => {
-            Shell.util_start_systemd_unit('gnome-session-x11-services.target', 'fail');
+        global.display.connect('init-xserver', (_display, task) => {
+            Shell.util_start_systemd_unit('gsd-xsettings.target', 'fail');
+            let timeoutId = -1;
+
+            /* When gsd-xsettings daemon is started, we are good to resume */
+            let watchId = Gio.DBus.session.watch_name('org.gnome.SettingsDaemon.XSettings',
+                                                      Gio.BusNameWatcherFlags.NONE,
+                                                      () => {
+                                                          task.return_boolean(true);
+                                                          Gio.DBus.session.unwatch_name(watchId);
+                                                          if (timeoutId > 0)
+                                                              GLib.source_remove(timeoutId);
+                                                      },
+                                                      null);
+            /* Anyway, leave this watchdog timeout so don't block indefinitely here */
+            timeoutId = GLib.timeout_add_seconds(GLib.PRIORITY_DEFAULT, 5, () => {
+                Gio.DBus.session.unwatch_name(watchId);
+                task.return_boolean(false);
+                return GLib.SOURCE_REMOVE;
+            });
+            return true;
         });
         global.display.connect('x11-display-closing', () => {
-            Shell.util_stop_systemd_unit('gnome-session-x11-services.target', 'fail');
+            Shell.util_stop_systemd_unit('gsd-xsettings.target', 'fail');
         });
 
         Main.overview.connect('showing', () => {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]