]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Restore color palette when stopping text plugin
authorRay Strode <rstrode@redhat.com>
Fri, 8 Aug 2008 18:19:20 +0000 (14:19 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 12 Aug 2008 15:08:08 +0000 (11:08 -0400)
If we don't restore the color palette then the
details view / post boot up messages get drawn
with the wrong colors.

src/libplybootsplash/ply-window.c
src/libplybootsplash/ply-window.h
src/splash-plugins/text/plugin.c

index b123de452c3823a630c0801578bbaa30b1a83051..61a3e4c19285cde6c0c471a25b51752cb7d52e3f 100644 (file)
@@ -195,6 +195,14 @@ ply_window_restore_color_palette (ply_window_t *window)
   ply_window_change_color_palette (window);
 }
 
+void
+ply_window_reset_colors (ply_window_t *window)
+{
+  assert (window != NULL);
+
+  ply_window_restore_color_palette (window);
+}
+
 static void
 process_backspace (ply_window_t *window)
 {
@@ -442,9 +450,16 @@ ply_window_open (ply_window_t *window)
 
   if (window->vt_number == 0)
     {
+      char tty_name[512] = "";
+
       window->vt_number = get_active_vt ();
       free (window->tty_name);
-      asprintf (&window->tty_name, "/dev/tty%d", window->vt_number);
+      window->tty_name = NULL;
+
+      if (readlink ("/proc/self/fd/0", tty_name, sizeof (tty_name) - 1) < 0)
+        return false;
+
+      window->tty_name = strdup (tty_name);
     }
 
   window->tty_fd = open (window->tty_name, O_RDWR | O_NOCTTY);
index 2cf7875bfeee822077b4b9399a855771ec363649..dcbfdd8d390a34e0cabe687c331dc28c4755e851 100644 (file)
@@ -135,6 +135,7 @@ uint32_t ply_window_get_color_hex_value (ply_window_t       *window,
 void ply_window_set_color_hex_value (ply_window_t       *window,
                                      ply_window_color_t  color,
                                      uint32_t            hex_value);
+void ply_window_reset_colors (ply_window_t *window);
 
 void ply_window_attach_to_event_loop (ply_window_t     *window,
                                       ply_event_loop_t *loop);
index 2b02e556fee68516d15d3608c34f3e1273d34f7a..d5c011bbc404a322c539f8a84b571d255ec2c442 100644 (file)
@@ -273,6 +273,7 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
   ply_window_set_background_color (plugin->window, PLY_WINDOW_COLOR_DEFAULT);
   ply_window_clear_screen (plugin->window);
   ply_window_show_text_cursor (plugin->window);
+  ply_window_reset_colors (plugin->window);
 
   plugin->window = NULL;
 }