Blob Blame History Raw
From 94207dd5699f1cd2fe7d516c20e1de2b2e2778fb Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 9 Aug 2018 12:48:25 -0400
Subject: [PATCH 20/51] local-display-factory: add some more debug statements

This commit just sprinkles in a few more `g_debug`'s for
log file clarity.
---
 daemon/gdm-local-display-factory.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/daemon/gdm-local-display-factory.c b/daemon/gdm-local-display-factory.c
index c58de9c17..6f3a4c391 100644
--- a/daemon/gdm-local-display-factory.c
+++ b/daemon/gdm-local-display-factory.c
@@ -364,76 +364,80 @@ on_display_status_changed (GdmDisplay             *display,
 
 static gboolean
 lookup_by_seat_id (const char *id,
                    GdmDisplay *display,
                    gpointer    user_data)
 {
         const char *looking_for = user_data;
         char *current;
         gboolean res;
 
         g_object_get (G_OBJECT (display), "seat-id", &current, NULL);
 
         res = g_strcmp0 (current, looking_for) == 0;
 
         g_free(current);
 
         return res;
 }
 
 static GdmDisplay *
 create_display (GdmLocalDisplayFactory *factory,
                 const char             *seat_id,
                 const char             *session_type,
                 gboolean                initial)
 {
         GdmDisplayStore *store;
         GdmDisplay      *display = NULL;
         char            *active_session_id = NULL;
         int              ret;
 
+        g_debug ("GdmLocalDisplayFactory: %s login display for seat %s requested",
+                 session_type? : "X11", seat_id);
         store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
 
         ret = sd_seat_get_active (seat_id, &active_session_id, NULL);
 
         if (ret == 0) {
                 char *login_session_id = NULL;
 
                 /* If we already have a login window, switch to it */
                 if (gdm_get_login_window_session_id (seat_id, &login_session_id)) {
                         GdmDisplay *display;
 
                         display = gdm_display_store_find (store,
                                                           lookup_by_session_id,
                                                           (gpointer) login_session_id);
                         if (display != NULL && gdm_display_get_status (display) == GDM_DISPLAY_MANAGED) {
                                 if (g_strcmp0 (active_session_id, login_session_id) != 0) {
+                                        g_debug ("GdmLocalDisplayFactory: session %s found, activating.",
+                                                 login_session_id);
                                         gdm_activate_session_by_id (factory->priv->connection, seat_id, login_session_id);
                                 }
                                 g_clear_pointer (&login_session_id, g_free);
                                 g_clear_pointer (&active_session_id, g_free);
                                 return NULL;
                         }
                         g_clear_pointer (&login_session_id, g_free);
                 }
                 g_clear_pointer (&active_session_id, g_free);
         } else if (!sd_seat_can_multi_session (seat_id)) {
                 /* Ensure we don't create the same display more than once */
                 display = gdm_display_store_find (store, lookup_by_seat_id, (gpointer) seat_id);
 
                 if (display != NULL) {
                         return NULL;
                 }
         }
 
         g_debug ("GdmLocalDisplayFactory: Adding display on seat %s", seat_id);
 
 #ifdef ENABLE_USER_DISPLAY_SERVER
         if (g_strcmp0 (seat_id, "seat0") == 0) {
                 display = gdm_local_display_new ();
                 if (session_type != NULL) {
                         g_object_set (G_OBJECT (display), "session-type", session_type, NULL);
                 }
         }
 #endif
 
         if (display == NULL) {
@@ -453,60 +457,61 @@ create_display (GdmLocalDisplayFactory *factory,
         g_object_unref (display);
 
         if (! gdm_display_manage (display)) {
                 gdm_display_unmanage (display);
         }
 
         return display;
 }
 
 static void
 delete_display (GdmLocalDisplayFactory *factory,
                 const char             *seat_id) {
 
         GdmDisplayStore *store;
 
         g_debug ("GdmLocalDisplayFactory: Removing used_display_numbers on seat %s", seat_id);
 
         store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
         gdm_display_store_foreach_remove (store, lookup_by_seat_id, (gpointer) seat_id);
 }
 
 static gboolean
 gdm_local_display_factory_sync_seats (GdmLocalDisplayFactory *factory)
 {
         GError *error = NULL;
         GVariant *result;
         GVariant *array;
         GVariantIter iter;
         const char *seat;
 
+        g_debug ("GdmLocalDisplayFactory: enumerating seats from logind");
         result = g_dbus_connection_call_sync (factory->priv->connection,
                                               "org.freedesktop.login1",
                                               "/org/freedesktop/login1",
                                               "org.freedesktop.login1.Manager",
                                               "ListSeats",
                                               NULL,
                                               G_VARIANT_TYPE ("(a(so))"),
                                               G_DBUS_CALL_FLAGS_NONE,
                                               -1,
                                               NULL, &error);
 
         if (!result) {
                 g_warning ("GdmLocalDisplayFactory: Failed to issue method call: %s", error->message);
                 g_clear_error (&error);
                 return FALSE;
         }
 
         array = g_variant_get_child_value (result, 0);
         g_variant_iter_init (&iter, array);
 
         while (g_variant_iter_loop (&iter, "(&so)", &seat, NULL)) {
                 gboolean is_initial;
                 const char *session_type = NULL;
 
                 if (g_strcmp0 (seat, "seat0") == 0) {
                         is_initial = TRUE;
                         if (gdm_local_display_factory_use_wayland ())
                                 session_type = "wayland";
                 } else {
                         is_initial = FALSE;
-- 
2.27.0