Blob Blame History Raw
From 2af482af166dbb18816b6f9fbee2b8ea6dc1a355 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 5 Oct 2009 16:51:40 -0400
Subject: [PATCH] [main] Properly reinitialize environment on show splash

Before we were tearing down the displays and keyboard on hide
splash but not bringing them back on subsequent show splashes.

This fixes that.  We can probably throw less stuff away on
hide splash, but this is a more conservative fix for now.
---
 src/main.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/src/main.c b/src/main.c
index 08ec1ae..e827da4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -131,6 +131,8 @@ static void on_error_message (ply_buffer_t *debug_buffer,
                               size_t        number_of_bytes);
 static ply_buffer_t *debug_buffer;
 static char *debug_buffer_path = NULL;
+static void check_for_consoles (state_t    *state,
+                                const char *default_tty);
 
 static void
 on_session_output (state_t    *state,
@@ -560,6 +562,8 @@ on_show_splash (state_t *state)
       return;
     }
 
+  check_for_consoles (state, state->default_tty);
+
   has_display = ply_list_get_length (state->pixel_displays) > 0 ||
                 ply_list_get_length (state->text_displays) > 0;
 
@@ -597,9 +601,6 @@ quit_splash (state_t *state)
       state->boot_splash = NULL;
     }
 
-  ply_trace ("removing displays and keyboard");
-  remove_displays_and_keyboard (state);
-
   if (state->renderer != NULL)
     {
       ply_renderer_close (state->renderer);
@@ -607,6 +608,9 @@ quit_splash (state_t *state)
       state->renderer = NULL;
     }
 
+  ply_trace ("removing displays and keyboard");
+  remove_displays_and_keyboard (state);
+
   if (state->session != NULL)
     {
       ply_trace ("detaching session");
@@ -1265,9 +1269,11 @@ check_for_consoles (state_t    *state,
 
   ply_trace ("checking if splash screen should be disabled");
 
-  state->console = ply_console_new ();
+  if (state->console == NULL)
+    state->console = ply_console_new ();
 
-  if (!ply_console_open (state->console))
+  if (!ply_console_is_open (state->console) &&
+      !ply_console_open (state->console))
     {
       ply_trace ("could not open /dev/tty0");
       ply_console_free (state->console);
-- 
1.6.5.rc2