diff options
-rw-r--r-- | daemon/gdm-manager.c | 46 |
1 files changed, 35 insertions, 11 deletions
diff --git a/daemon/gdm-manager.c b/daemon/gdm-manager.c index 20a9ba7d..ea328381 100644 --- a/daemon/gdm-manager.c +++ b/daemon/gdm-manager.c @@ -78,6 +78,7 @@ struct GdmManagerPrivate #ifdef HAVE_LIBXDMCP GdmXdmcpDisplayFactory *xdmcp_factory; #endif + GdmDisplay *automatic_login_display; GList *user_sessions; GHashTable *transient_sessions; GHashTable *open_reauthentication_requests; @@ -92,7 +93,7 @@ struct GdmManagerPrivate #ifdef WITH_PLYMOUTH guint plymouth_is_running : 1; #endif - guint ran_once : 1; + guint did_automatic_login : 1; }; enum { @@ -1380,13 +1381,20 @@ set_up_session (GdmManager *manager, ActUserManager *user_manager; ActUser *user; gboolean loaded; - gboolean is_initial_display = FALSE; + gboolean seat_can_autologin = FALSE, seat_did_autologin = FALSE; gboolean autologin_enabled = FALSE; + g_autofree char *seat_id = NULL; char *username = NULL; - g_object_get (G_OBJECT (display), "is-initial", &is_initial_display, NULL); + g_object_get (G_OBJECT (display), "seat-id", &seat_id, NULL); + + if (g_strcmp0 (seat_id, "seat0") == 0) + seat_can_autologin = TRUE; + + if (manager->priv->did_automatic_login || manager->priv->automatic_login_display != NULL) + seat_did_autologin = TRUE; - if (!manager->priv->ran_once && is_initial_display) + if (seat_can_autologin && !seat_did_autologin) autologin_enabled = get_automatic_login_details (manager, &username); if (!autologin_enabled) { @@ -1477,8 +1485,18 @@ on_display_status_changed (GdmDisplay *display, } #endif - if (!doing_initial_setup && (status == GDM_DISPLAY_FINISHED || g_strcmp0 (session_type, "x11") == 0)) { - manager->priv->ran_once = TRUE; + if (display == manager->priv->automatic_login_display) { + g_clear_weak_pointer (&manager->priv->automatic_login_display); + + manager->priv->did_automatic_login = TRUE; + +#ifdef ENABLE_WAYLAND_SUPPORT + if (g_strcmp0 (session_type, "wayland") != 0 && status == GDM_DISPLAY_FAILED) { + /* we're going to fall back to X11, so try to autologin again + */ + manager->priv->did_automatic_login = FALSE; + } +#endif } break; default: @@ -1661,17 +1679,21 @@ on_start_user_session (StartUserSessionOperation *operation) 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) { /* 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); - } - /* Give the user session a new display object for bookkeeping purposes */ - create_display_for_user_session (operation->manager, - operation->session, - session_id); + self->priv->automatic_login_display = g_object_get_data (G_OBJECT (operation->session), "gdm-display"); + g_object_add_weak_pointer (G_OBJECT (display), (gpointer *) &self->priv->automatic_login_display); + } } start_user_session (operation->manager, operation); @@ -2565,6 +2587,8 @@ gdm_manager_dispose (GObject *object) g_return_if_fail (manager->priv != NULL); + g_clear_weak_pointer (&manager->priv->automatic_login_display); + #ifdef HAVE_LIBXDMCP g_clear_object (&manager->priv->xdmcp_factory); #endif |