From: Ray Strode Date: Fri, 8 Aug 2008 18:19:20 +0000 (-0400) Subject: Restore color palette when stopping text plugin X-Git-Tag: 0.6.0~210 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77247462fa52dc0b5e333395fd289b2f6d4a73d7;p=thirdparty%2Fplymouth.git Restore color palette when stopping text plugin If we don't restore the color palette then the details view / post boot up messages get drawn with the wrong colors. --- diff --git a/src/libplybootsplash/ply-window.c b/src/libplybootsplash/ply-window.c index b123de45..61a3e4c1 100644 --- a/src/libplybootsplash/ply-window.c +++ b/src/libplybootsplash/ply-window.c @@ -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); diff --git a/src/libplybootsplash/ply-window.h b/src/libplybootsplash/ply-window.h index 2cf7875b..dcbfdd8d 100644 --- a/src/libplybootsplash/ply-window.h +++ b/src/libplybootsplash/ply-window.h @@ -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); diff --git a/src/splash-plugins/text/plugin.c b/src/splash-plugins/text/plugin.c index 2b02e556..d5c011bb 100644 --- a/src/splash-plugins/text/plugin.c +++ b/src/splash-plugins/text/plugin.c @@ -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; }