Commit 3bd4407f authored by Ray Strode's avatar Ray Strode

local-display-factory: add more debug messages to new vt handling code

commit c0188a70 added some complex code for starting and stopping
the login screen based on VT changes.

That code currently has zero debug statements in it making it trickier
than necessary to debug.

This commit sprinkles some g_debug's throughout the function.
parent 8b163aac
......@@ -552,8 +552,10 @@ maybe_stop_greeter_display (GdmDisplay *display)
{
g_autofree char *display_session_type = NULL;
if (gdm_display_get_status (display) != GDM_DISPLAY_MANAGED)
if (gdm_display_get_status (display) != GDM_DISPLAY_MANAGED) {
g_debug ("GdmLocalDisplayFactory: login window not in managed state, so ignoring");
return;
}
g_object_get (G_OBJECT (display),
"session-type", &display_session_type,
......@@ -561,9 +563,12 @@ maybe_stop_greeter_display (GdmDisplay *display)
/* we can only stop greeter for wayland sessions, since
* X server would jump back on exit */
if (g_strcmp0 (display_session_type, "wayland") != 0)
if (g_strcmp0 (display_session_type, "wayland") != 0) {
g_debug ("GdmLocalDisplayFactory: login window is running on Xorg, so ignoring");
return;
}
g_debug ("GdmLocalDisplayFactory: killing login window since its now unused");
gdm_display_stop_greeter_session (display);
gdm_display_unmanage (display);
gdm_display_finish (display);
......@@ -583,6 +588,7 @@ on_vt_changed (GIOChannel *source,
const char *session_type = NULL;
int ret;
g_debug ("GdmLocalDisplayFactory: received VT change event");
g_io_channel_seek_position (source, 0, G_SEEK_SET, NULL);
if (condition & G_IO_PRI) {
......@@ -604,21 +610,31 @@ on_vt_changed (GIOChannel *source,
}
}
if ((condition & G_IO_ERR) || (condition & G_IO_HUP))
if ((condition & G_IO_ERR) || (condition & G_IO_HUP)) {
g_debug ("GdmLocalDisplayFactory: kernel hung up active vt watch");
return G_SOURCE_REMOVE;
}
if (tty_of_active_vt == NULL)
if (tty_of_active_vt == NULL) {
g_debug ("GdmLocalDisplayFactory: unable to read active VT from kernel");
return G_SOURCE_CONTINUE;
}
g_strchomp (tty_of_active_vt);
/* don't do anything if we're on the same VT we were before */
if (g_strcmp0 (tty_of_active_vt, factory->priv->tty_of_active_vt) == 0)
return G_SOURCE_CONTINUE;
tty_of_previous_vt = g_steal_pointer (&factory->priv->tty_of_active_vt);
factory->priv->tty_of_active_vt = g_steal_pointer (&tty_of_active_vt);
/* don't do anything at start up */
if (tty_of_previous_vt == NULL) {
g_debug ("GdmLocalDisplayFactory: VT is %s at startup",
factory->priv->tty_of_active_vt);
return G_SOURCE_CONTINUE;
}
g_debug ("GdmLocalDisplayFactory: VT changed from %s to %s",
tty_of_previous_vt, factory->priv->tty_of_active_vt);
/* if the old VT was running a wayland login screen kill it
*/
if (gdm_get_login_window_session_id ("seat0", &login_session_id)) {
......@@ -630,10 +646,13 @@ on_vt_changed (GIOChannel *source,
tty_of_login_window_vt = g_strdup_printf ("tty%u", vt);
g_debug ("GdmLocalDisplayFactory: tty of login window is %s", tty_of_login_window_vt);
if (g_strcmp0 (tty_of_login_window_vt, tty_of_previous_vt) == 0) {
GdmDisplayStore *store;
GdmDisplay *display;
g_debug ("GdmLocalDisplayFactory: VT switched from login window");
store = gdm_display_factory_get_display_store (GDM_DISPLAY_FACTORY (factory));
display = gdm_display_store_find (store,
lookup_by_session_id,
......@@ -641,6 +660,8 @@ on_vt_changed (GIOChannel *source,
if (display != NULL)
maybe_stop_greeter_display (display);
} else {
g_debug ("GdmLocalDisplayFactory: VT not switched from login window");
}
}
}
......@@ -650,6 +671,7 @@ on_vt_changed (GIOChannel *source,
* jump to that login screen)
*/
if (strcmp (factory->priv->tty_of_active_vt, tty_of_initial_vt) != 0) {
g_debug ("GdmLocalDisplayFactory: active VT is not initial VT, so ignoring");
return G_SOURCE_CONTINUE;
}
......@@ -660,13 +682,17 @@ on_vt_changed (GIOChannel *source,
ret = sd_session_get_state (active_session_id, &state);
/* if there's something already running on the active VT then bail */
if (ret == 0 && g_strcmp0 (state, "closing") != 0)
if (ret == 0 && g_strcmp0 (state, "closing") != 0) {
g_debug ("GdmLocalDisplayFactory: initial VT is in use, so ignoring");
return G_SOURCE_CONTINUE;
}
}
if (gdm_local_display_factory_use_wayland ())
session_type = "wayland";
g_debug ("GdmLocalDisplayFactory: creating new display on seat0 because of VT change");
create_display (factory, "seat0", session_type, TRUE);
return G_SOURCE_CONTINUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment