Blob Blame History Raw
From c65a0dbd195be52f0db0c49ea0355fe1b5eb4c09 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Fri, 31 Aug 2018 15:48:38 -0400
Subject: [PATCH 38/51] manager: don't kill initial-setup before starting user
 session on wayland

Right now we kill initial-setup before starting the session for the user
initial-setup created.  This is the right thing to do for Xorg, since
Xorg can't be killed in the background, but it adds unncessary flicker
for wayland.

This commit checks if it's wayland and avoids killing it right away
in that case.
---
 daemon/gdm-manager.c | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
index e896c8945..0823e8638 100644
--- a/daemon/gdm-manager.c
+++ b/daemon/gdm-manager.c
@@ -1639,105 +1639,121 @@ create_display_for_user_session (GdmManager *self,
         GdmDisplay *display;
         /* at the moment we only create GdmLocalDisplay objects on seat0 */
         const char *seat_id = "seat0";
 
         display = gdm_local_display_new ();
 
         g_object_set (G_OBJECT (display),
                       "session-class", "user",
                       "seat-id", seat_id,
                       "session-id", session_id,
                       NULL);
         gdm_display_store_add (self->priv->display_store,
                                display);
         g_object_set_data (G_OBJECT (session), "gdm-display", display);
         g_object_set_data_full (G_OBJECT (display),
                                 "gdm-user-session",
                                 g_object_ref (session),
                                 (GDestroyNotify)
                                 clean_user_session);
 }
 
 static gboolean
 on_start_user_session (StartUserSessionOperation *operation)
 {
         GdmManager *self = operation->manager;
         gboolean migrated;
         gboolean fail_if_already_switched = TRUE;
         gboolean doing_initial_setup = FALSE;
         GdmDisplay *display;
         const char *session_id;
+#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
+        g_autofree char *display_session_type = NULL;
+#endif
 
         g_debug ("GdmManager: start or jump to session");
 
         /* If there's already a session running, jump to it.
          * If the only session running is the one we just opened,
          * start a session on it.
          */
         migrated = switch_to_compatible_user_session (operation->manager, operation->session, fail_if_already_switched);
 
         g_debug ("GdmManager: migrated: %d", migrated);
         if (migrated) {
                 /* We don't stop the manager here because
                    when Xorg exits it switches to the VT it was
                    started from.  That interferes with fast
                    user switching. */
                 gdm_session_reset (operation->session);
                 destroy_start_user_session_operation (operation);
                 goto out;
         }
 
         display = get_display_for_user_session (operation->session);
 
-        g_object_get (G_OBJECT (display), "doing-initial-setup", &doing_initial_setup, NULL);
+        g_object_get (G_OBJECT (display),
+                      "doing-initial-setup", &doing_initial_setup,
+#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
+                      "session-type", &display_session_type,
+#endif
+                      NULL);
 
         session_id = gdm_session_get_conversation_session_id (operation->session,
                                                               operation->service_name);
 
         if (gdm_session_get_display_mode (operation->session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) {
                 /* In this case, the greeter's display is morphing into
                  * the user session display. Kill the greeter on this session
                  * and let the user session follow the same display. */
                 gdm_display_stop_greeter_session (display);
                 g_object_set (G_OBJECT (display),
                                 "session-class", "user",
                                 "session-id", session_id,
                                 NULL);
         } else {
                 uid_t allowed_uid;
 
                 g_object_ref (display);
                 if (doing_initial_setup) {
-                        g_debug ("GdmManager: closing down initial setup display");
-                        gdm_display_stop_greeter_session (display);
-                        gdm_display_unmanage (display);
-                        gdm_display_finish (display);
+#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
+                        if (g_strcmp0 (display_session_type, "wayland") == 0) {
+                                g_debug ("GdmManager: closing down initial setup display in background");
+                                g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_WAITING_TO_FINISH, NULL);
+                        }
+#endif
+                        if (gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
+                                g_debug ("GdmManager: closing down initial setup display");
+                                gdm_display_stop_greeter_session (display);
+                                gdm_display_unmanage (display);
+                                gdm_display_finish (display);
+                        }
                 } else {
                         g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
                 }
 
                 /* The user session is going to follow the session worker
                  * into the new display. Untie it from this display and
                  * create a new session for a future user login. */
                 allowed_uid = gdm_session_get_allowed_user (operation->session);
                 g_object_set_data (G_OBJECT (display), "gdm-user-session", NULL);
                 g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
                 create_user_session_for_display (operation->manager, display, allowed_uid);
 
                 /* Give the user session a new display object for bookkeeping purposes */
                 create_display_for_user_session (operation->manager,
                                                  operation->session,
                                                  session_id);
 
                 if ((g_strcmp0 (operation->service_name, "gdm-autologin") == 0) &&
                     !gdm_session_client_is_connected (operation->session)) {
                         /* remove the unused prepared greeter display since we're not going
                          * to have a greeter */
                         gdm_display_store_remove (self->priv->display_store, display);
                         g_object_unref (display);
 
                         self->priv->automatic_login_display = g_object_get_data (G_OBJECT (operation->session), "gdm-display");
                         g_object_add_weak_pointer (G_OBJECT (self->priv->automatic_login_display), (gpointer *) &self->priv->automatic_login_display);
                 }
         }
 
         start_user_session (operation->manager, operation);
-- 
2.27.0