From: Ray Strode Date: Thu, 19 Jun 2008 02:45:49 +0000 (-0400) Subject: Hide cursor and clear screen in text plugin X-Git-Tag: 0.4.0~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6bda9aa4d1bb949cc9aa448b2b43fbb46e667691;p=thirdparty%2Fplymouth.git Hide cursor and clear screen in text plugin --- diff --git a/src/splash-plugins/text/plugin.c b/src/splash-plugins/text/plugin.c index 7e8a4e6d..83f5e60e 100644 --- a/src/splash-plugins/text/plugin.c +++ b/src/splash-plugins/text/plugin.c @@ -54,6 +54,9 @@ #include #define CLEAR_LINE_SEQUENCE "\033[2K\r\n" +#define CLEAR_SCREEN_SEQUENCE "\033[2J" +#define HIDE_CURSOR_SEQUENCE "\033[?25l" +#define SHOW_CURSOR_SEQUENCE "\033[?25h" #define BACKSPACE "\b\033[0K" struct _ply_boot_splash_plugin @@ -126,6 +129,24 @@ on_enter (ply_boot_splash_plugin_t *plugin, } } +static void +clear_screen (ply_boot_splash_plugin_t *plugin) +{ + write (STDOUT_FILENO, CLEAR_SCREEN_SEQUENCE, strlen (CLEAR_SCREEN_SEQUENCE)); +} + +static void +hide_cursor (ply_boot_splash_plugin_t *plugin) +{ + write (STDOUT_FILENO, HIDE_CURSOR_SEQUENCE, strlen (HIDE_CURSOR_SEQUENCE)); +} + +static void +show_cursor (ply_boot_splash_plugin_t *plugin) +{ + write (STDOUT_FILENO, SHOW_CURSOR_SEQUENCE, strlen (SHOW_CURSOR_SEQUENCE)); +} + bool show_splash_screen (ply_boot_splash_plugin_t *plugin, ply_event_loop_t *loop, @@ -149,6 +170,9 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin, detach_from_event_loop, plugin); + clear_screen (plugin); + hide_cursor (plugin); + return true; } @@ -183,6 +207,9 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin, plugin); detach_from_event_loop (plugin); } + + clear_screen (plugin); + show_cursor (plugin); } void