From f145f4c593760f410220b299e8358fa26da1824b Mon Sep 17 00:00:00 2001 From: Frederic Crozat <fcrozat@mandriva.com> Date: Tue, 30 Mar 2010 15:28:34 +0200 Subject: [PATCH] check for active-vt (Ubuntu) --- daemon/gdm-simple-slave.c | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-) diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c index 68d0474..2910d8e 100644 --- a/daemon/gdm-simple-slave.c +++ b/daemon/gdm-simple-slave.c @@ -915,6 +915,25 @@ plymouth_is_running (void) return WIFEXITED (status) && WEXITSTATUS (status) == 0; } +static gboolean +plymouth_has_active_vt (void) +{ + int status; + gboolean res; + GError *error; + + error = NULL; + res = g_spawn_command_line_sync ("/bin/plymouth --has-active-vt", + NULL, NULL, &status, &error); + if (! res) { + g_debug ("Could not ask plymouth: %s", error->message); + g_error_free (error); + return FALSE; + } + + return WIFEXITED (status) && WEXITSTATUS (status) == 0; +} + static void plymouth_prepare_for_transition (GdmSimpleSlave *slave) { @@ -1241,7 +1260,13 @@ gdm_simple_slave_run (GdmSimpleSlave *slave) if (slave->priv->plymouth_is_running) { plymouth_prepare_for_transition (slave); - res = gdm_server_start_on_active_vt (slave->priv->server); + if (plymouth_has_active_vt ()) { + res = gdm_server_start_on_active_vt (slave->priv->server); + } else { + plymouth_quit_without_transition (slave); + slave->priv->plymouth_is_running = 0; + res = gdm_server_start (slave->priv->server); + } } else { if (force_active_vt) res = gdm_server_start_on_active_vt (slave->priv->server); -- 1.7.0.3