]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add clear screen method to window class
authorRay Strode <rstrode@redhat.com>
Fri, 20 Jun 2008 16:18:10 +0000 (12:18 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 20 Jun 2008 17:48:40 +0000 (13:48 -0400)
Just a convenience function for the plugins

src/libplybootsplash/ply-window.c
src/libplybootsplash/ply-window.h

index 712992f75b0f6717e767b1864ee7fe743db623b2..7ac22d1fa32931f190e8c18ef05ec2c81b3e15cc 100644 (file)
@@ -53,6 +53,7 @@
 #define KEY_RETURN '\r'
 #define KEY_BACKSPACE '\177'
 
+#define CLEAR_SCREEN_SEQUENCE "\033[2J"
 #define MOVE_CURSOR_SEQUENCE "\033[%d;%df"
 
 struct _ply_window
@@ -454,6 +455,15 @@ ply_window_set_text_cursor_position (ply_window_t *window,
   free (sequence);
 }
 
+void
+ply_window_clear_screen (ply_window_t *window)
+{
+  write (window->tty_fd, CLEAR_SCREEN_SEQUENCE, strlen (CLEAR_SCREEN_SEQUENCE));
+
+  if (ply_frame_buffer_device_is_open (window->frame_buffer))
+    ply_frame_buffer_fill_with_color (window->frame_buffer, NULL, 0.0, 0.0, 0.0, 1.0);
+}
+
 static void
 ply_window_detach_from_event_loop (ply_window_t *window)
 {
index ff45aaee929f2c835fd6d9693f4294bd6817545f..36817afffbbcd9d3e66b51dc73fb7647dd41933a 100644 (file)
@@ -77,6 +77,7 @@ int  ply_window_get_number_of_text_columns (ply_window_t *window);
 void ply_window_set_text_cursor_position (ply_window_t *window,
                                           int           column,
                                           int           row);
+void ply_window_clear_screen (ply_window_t *window);
 
 void ply_window_attach_to_event_loop (ply_window_t     *window,
                                       ply_event_loop_t *loop);