Blame SOURCES/0038-manager-don-t-kill-initial-setup-before-starting-use.patch

e0b6b0
From c65a0dbd195be52f0db0c49ea0355fe1b5eb4c09 Mon Sep 17 00:00:00 2001
c90517
From: Ray Strode <rstrode@redhat.com>
c90517
Date: Fri, 31 Aug 2018 15:48:38 -0400
e0b6b0
Subject: [PATCH 38/51] manager: don't kill initial-setup before starting user
c90517
 session on wayland
c90517
c90517
Right now we kill initial-setup before starting the session for the user
c90517
initial-setup created.  This is the right thing to do for Xorg, since
c90517
Xorg can't be killed in the background, but it adds unncessary flicker
c90517
for wayland.
c90517
c90517
This commit checks if it's wayland and avoids killing it right away
c90517
in that case.
c90517
---
c90517
 daemon/gdm-manager.c | 26 +++++++++++++++++++++-----
c90517
 1 file changed, 21 insertions(+), 5 deletions(-)
c90517
c90517
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c
c90517
index e896c8945..0823e8638 100644
c90517
--- a/daemon/gdm-manager.c
c90517
+++ b/daemon/gdm-manager.c
c90517
@@ -1639,105 +1639,121 @@ create_display_for_user_session (GdmManager *self,
c90517
         GdmDisplay *display;
c90517
         /* at the moment we only create GdmLocalDisplay objects on seat0 */
c90517
         const char *seat_id = "seat0";
c90517
 
c90517
         display = gdm_local_display_new ();
c90517
 
c90517
         g_object_set (G_OBJECT (display),
c90517
                       "session-class", "user",
c90517
                       "seat-id", seat_id,
c90517
                       "session-id", session_id,
c90517
                       NULL);
c90517
         gdm_display_store_add (self->priv->display_store,
c90517
                                display);
c90517
         g_object_set_data (G_OBJECT (session), "gdm-display", display);
c90517
         g_object_set_data_full (G_OBJECT (display),
c90517
                                 "gdm-user-session",
c90517
                                 g_object_ref (session),
c90517
                                 (GDestroyNotify)
c90517
                                 clean_user_session);
c90517
 }
c90517
 
c90517
 static gboolean
c90517
 on_start_user_session (StartUserSessionOperation *operation)
c90517
 {
c90517
         GdmManager *self = operation->manager;
c90517
         gboolean migrated;
c90517
         gboolean fail_if_already_switched = TRUE;
c90517
         gboolean doing_initial_setup = FALSE;
c90517
         GdmDisplay *display;
c90517
         const char *session_id;
c90517
+#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
c90517
+        g_autofree char *display_session_type = NULL;
c90517
+#endif
c90517
 
c90517
         g_debug ("GdmManager: start or jump to session");
c90517
 
c90517
         /* If there's already a session running, jump to it.
c90517
          * If the only session running is the one we just opened,
c90517
          * start a session on it.
c90517
          */
c90517
         migrated = switch_to_compatible_user_session (operation->manager, operation->session, fail_if_already_switched);
c90517
 
c90517
         g_debug ("GdmManager: migrated: %d", migrated);
c90517
         if (migrated) {
c90517
                 /* We don't stop the manager here because
c90517
                    when Xorg exits it switches to the VT it was
c90517
                    started from.  That interferes with fast
c90517
                    user switching. */
c90517
                 gdm_session_reset (operation->session);
c90517
                 destroy_start_user_session_operation (operation);
c90517
                 goto out;
c90517
         }
c90517
 
c90517
         display = get_display_for_user_session (operation->session);
c90517
 
c90517
-        g_object_get (G_OBJECT (display), "doing-initial-setup", &doing_initial_setup, NULL);
c90517
+        g_object_get (G_OBJECT (display),
c90517
+                      "doing-initial-setup", &doing_initial_setup,
c90517
+#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
c90517
+                      "session-type", &display_session_type,
c90517
+#endif
c90517
+                      NULL);
c90517
 
c90517
         session_id = gdm_session_get_conversation_session_id (operation->session,
c90517
                                                               operation->service_name);
c90517
 
c90517
         if (gdm_session_get_display_mode (operation->session) == GDM_SESSION_DISPLAY_MODE_REUSE_VT) {
c90517
                 /* In this case, the greeter's display is morphing into
c90517
                  * the user session display. Kill the greeter on this session
c90517
                  * and let the user session follow the same display. */
c90517
                 gdm_display_stop_greeter_session (display);
c90517
                 g_object_set (G_OBJECT (display),
c90517
                                 "session-class", "user",
c90517
                                 "session-id", session_id,
c90517
                                 NULL);
c90517
         } else {
c90517
                 uid_t allowed_uid;
c90517
 
c90517
                 g_object_ref (display);
c90517
                 if (doing_initial_setup) {
c90517
-                        g_debug ("GdmManager: closing down initial setup display");
c90517
-                        gdm_display_stop_greeter_session (display);
c90517
-                        gdm_display_unmanage (display);
c90517
-                        gdm_display_finish (display);
c90517
+#if defined(ENABLE_WAYLAND_SUPPORT) && defined(ENABLE_USER_DISPLAY_SERVER)
c90517
+                        if (g_strcmp0 (display_session_type, "wayland") == 0) {
c90517
+                                g_debug ("GdmManager: closing down initial setup display in background");
c90517
+                                g_object_set (G_OBJECT (display), "status", GDM_DISPLAY_WAITING_TO_FINISH, NULL);
c90517
+                        }
c90517
+#endif
c90517
+                        if (gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
c90517
+                                g_debug ("GdmManager: closing down initial setup display");
c90517
+                                gdm_display_stop_greeter_session (display);
c90517
+                                gdm_display_unmanage (display);
c90517
+                                gdm_display_finish (display);
c90517
+                        }
c90517
                 } else {
c90517
                         g_debug ("GdmManager: session has its display server, reusing our server for another login screen");
c90517
                 }
c90517
 
c90517
                 /* The user session is going to follow the session worker
c90517
                  * into the new display. Untie it from this display and
c90517
                  * create a new session for a future user login. */
c90517
                 allowed_uid = gdm_session_get_allowed_user (operation->session);
c90517
                 g_object_set_data (G_OBJECT (display), "gdm-user-session", NULL);
c90517
                 g_object_set_data (G_OBJECT (operation->session), "gdm-display", NULL);
c90517
                 create_user_session_for_display (operation->manager, display, allowed_uid);
c90517
 
c90517
                 /* Give the user session a new display object for bookkeeping purposes */
c90517
                 create_display_for_user_session (operation->manager,
c90517
                                                  operation->session,
c90517
                                                  session_id);
c90517
 
c90517
                 if ((g_strcmp0 (operation->service_name, "gdm-autologin") == 0) &&
c90517
                     !gdm_session_client_is_connected (operation->session)) {
c90517
                         /* remove the unused prepared greeter display since we're not going
c90517
                          * to have a greeter */
c90517
                         gdm_display_store_remove (self->priv->display_store, display);
c90517
                         g_object_unref (display);
c90517
 
c90517
                         self->priv->automatic_login_display = g_object_get_data (G_OBJECT (operation->session), "gdm-display");
c90517
                         g_object_add_weak_pointer (G_OBJECT (self->priv->automatic_login_display), (gpointer *) &self->priv->automatic_login_display);
c90517
                 }
c90517
         }
c90517
 
c90517
         start_user_session (operation->manager, operation);
c90517
-- 
e0b6b0
2.27.0
c90517