]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add --hide-splash option
authorRay Strode <rstrode@redhat.com>
Fri, 27 Jun 2008 18:20:56 +0000 (14:20 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 27 Jun 2008 18:20:56 +0000 (14:20 -0400)
We want to be able to hide the splash screen in the event
the user needs to interact with start up from the console.

src/client/ply-boot-client.c
src/client/ply-boot-client.h
src/client/plymouth.c
src/libplybootsplash/ply-window.c
src/main.c
src/ply-boot-protocol.h
src/ply-boot-server.c
src/ply-boot-server.h

index e75309de2163e3ad162f1614abffcb5bb88f7d8d..7604e2745b1024a0f1f7d1da9ffb2e3261b251aa 100644 (file)
@@ -496,6 +496,18 @@ ply_boot_client_tell_daemon_to_show_splash (ply_boot_client_t                  *
                                  NULL, handler, failed_handler, user_data);
 }
 
+void
+ply_boot_client_tell_daemon_to_hide_splash (ply_boot_client_t                  *client,
+                                            ply_boot_client_response_handler_t  handler,
+                                            ply_boot_client_response_handler_t  failed_handler,
+                                            void                               *user_data)
+{
+  assert (client != NULL);
+
+  ply_boot_client_queue_request (client, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HIDE_SPLASH,
+                                 NULL, handler, failed_handler, user_data);
+}
+
 void
 ply_boot_client_tell_daemon_to_quit (ply_boot_client_t                  *client,
                                      ply_boot_client_response_handler_t  handler,
index 8ee6718c12a1fbe19b4ff3bf89bdc4963d56990b..214269103a50722115f6b1323d7f6d5e2105cf54 100644 (file)
@@ -71,6 +71,10 @@ void ply_boot_client_tell_daemon_to_show_splash (ply_boot_client_t
                                                  ply_boot_client_response_handler_t  handler,
                                                  ply_boot_client_response_handler_t  failed_handler,
                                                  void                               *user_data);
+void ply_boot_client_tell_daemon_to_hide_splash (ply_boot_client_t                  *client,
+                                                 ply_boot_client_response_handler_t  handler,
+                                                 ply_boot_client_response_handler_t  failed_handler,
+                                                 void                               *user_data);
 void ply_boot_client_tell_daemon_to_quit (ply_boot_client_t                  *client,
                                           ply_boot_client_response_handler_t  handler,
                                           ply_boot_client_response_handler_t  failed_handler,
index f5a201b05ef6fd6c0c09e6fe26ed6187db7d559f..56be7531123dbf67acd089e09ab073f478e94332 100644 (file)
@@ -72,7 +72,7 @@ main (int    argc,
   ply_event_loop_t *loop;
   ply_boot_client_t *client;
   ply_command_parser_t *command_parser;
-  bool should_help, should_quit, should_ping, should_sysinit, should_ask_for_password, should_show_splash;
+  bool should_help, should_quit, should_ping, should_sysinit, should_ask_for_password, should_show_splash, should_hide_splash;
   char *status, *chroot_dir;
   int exit_code;
 
@@ -95,6 +95,7 @@ main (int    argc,
                                   "ping", "Check of boot daemon is running", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "sysinit", "Tell boot daemon root filesystem is mounted read-write", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "show-splash", "Show splash screen", PLY_COMMAND_OPTION_TYPE_FLAG,
+                                  "hide-splash", "Hide splash screen", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "ask-for-password", "Ask user for password", PLY_COMMAND_OPTION_TYPE_FLAG,
                                   "update", "Tell boot daemon an update about boot progress", PLY_COMMAND_OPTION_TYPE_STRING,
                                   NULL);
@@ -118,6 +119,7 @@ main (int    argc,
                                   "ping", &should_ping,
                                   "sysinit", &should_sysinit,
                                   "show-splash", &should_show_splash,
+                                  "hide-splash", &should_hide_splash,
                                   "ask-for-password", &should_ask_for_password,
                                   "update", &status,
                                   NULL);
@@ -162,6 +164,12 @@ main (int    argc,
                                                on_success,
                                                (ply_boot_client_response_handler_t)
                                                on_failure, loop);
+  else if (should_hide_splash)
+    ply_boot_client_tell_daemon_to_hide_splash (client,
+                                               (ply_boot_client_response_handler_t)
+                                               on_success,
+                                               (ply_boot_client_response_handler_t)
+                                               on_failure, loop);
   else if (should_quit)
     ply_boot_client_tell_daemon_to_quit (client,
                                          (ply_boot_client_response_handler_t)
index 23db760f5a62253bbf1828e9bd42d8c975329368..5f65ef1e9e4319144692d7be36748ecfd5212a71 100644 (file)
@@ -537,12 +537,12 @@ ply_window_set_text_cursor_position (ply_window_t *window,
 void
 ply_window_clear_screen (ply_window_t *window)
 {
+  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);
+
   write (window->tty_fd, CLEAR_SCREEN_SEQUENCE, strlen (CLEAR_SCREEN_SEQUENCE));
 
   ply_window_set_text_cursor_position (window, 0, 0);
-
-  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);
 }
 
 void
index a79cf35e06259dd91843c9ca979c59807de25765..65af7483f151eb16b74c79a97a867ca77aa104a2 100644 (file)
@@ -172,6 +172,24 @@ on_show_splash (state_t *state)
   show_default_splash (state);
 }
 
+static void
+on_hide_splash (state_t *state)
+{
+
+  if (state->boot_splash != NULL)
+    {
+      ply_boot_splash_hide (state->boot_splash);
+      ply_boot_splash_free (state->boot_splash);
+      state->boot_splash = NULL;
+    }
+
+  if (state->window != NULL)
+    {
+      ply_window_free (state->window);
+      state->window = NULL;
+    }
+}
+
 static void
 on_quit (state_t *state)
 {
@@ -195,6 +213,7 @@ start_boot_server (state_t *state)
   server = ply_boot_server_new ((ply_boot_server_update_handler_t) on_update,
                                 (ply_boot_server_ask_for_password_handler_t) on_ask_for_password,
                                 (ply_boot_server_show_splash_handler_t) on_show_splash,
+                                (ply_boot_server_hide_splash_handler_t) on_hide_splash,
                                 (ply_boot_server_newroot_handler_t) on_newroot,
                                 (ply_boot_server_system_initialized_handler_t) on_system_initialized,
                                 (ply_boot_server_quit_handler_t) on_quit,
index de3169927714d505f295b15ee54c62fcc881d01a..e8af75a2597949584236751558b4138617993d17 100644 (file)
@@ -29,6 +29,7 @@
 #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT "Q"
 #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD "*"
 #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_SHOW_SPLASH "$"
+#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_HIDE_SPLASH "H"
 #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_NEWROOT "R"
 #define PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK "\x6"
 #define PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NAK "\x15"
index 64ecf6c9bb0aace40b91167277d0d8d19130eace..c161ae7abb3839b067482044199fcbdfc0fac13a 100644 (file)
@@ -53,6 +53,7 @@ struct _ply_boot_server
   ply_boot_server_newroot_handler_t newroot_handler;
   ply_boot_server_system_initialized_handler_t system_initialized_handler;
   ply_boot_server_show_splash_handler_t show_splash_handler;
+  ply_boot_server_hide_splash_handler_t hide_splash_handler;
   ply_boot_server_ask_for_password_handler_t ask_for_password_handler;
   ply_boot_server_quit_handler_t quit_handler;
   void *user_data;
@@ -64,6 +65,7 @@ ply_boot_server_t *
 ply_boot_server_new (ply_boot_server_update_handler_t  update_handler,
                      ply_boot_server_ask_for_password_handler_t ask_for_password_handler,
                      ply_boot_server_show_splash_handler_t show_splash_handler,
+                     ply_boot_server_hide_splash_handler_t hide_splash_handler,
                      ply_boot_server_newroot_handler_t newroot_handler,
                      ply_boot_server_system_initialized_handler_t initialized_handler,
                      ply_boot_server_quit_handler_t    quit_handler,
@@ -80,6 +82,7 @@ ply_boot_server_new (ply_boot_server_update_handler_t  update_handler,
   server->newroot_handler = newroot_handler;
   server->system_initialized_handler = initialized_handler;
   server->show_splash_handler = show_splash_handler;
+  server->hide_splash_handler = hide_splash_handler;
   server->quit_handler = quit_handler;
   server->user_data = user_data;
 
@@ -254,6 +257,12 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection)
       if (server->show_splash_handler != NULL)
         server->show_splash_handler (server->user_data, server);
     }
+  else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_HIDE_SPLASH) == 0)
+    {
+      ply_trace ("got hide splash request");
+      if (server->hide_splash_handler != NULL)
+        server->hide_splash_handler (server->user_data, server);
+    }
   else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT) == 0)
     {
       if (server->quit_handler != NULL)
@@ -414,6 +423,12 @@ on_show_splash (ply_event_loop_t *loop)
   printf ("got show splash request\n");
 }
 
+static void
+on_hide_splash (ply_event_loop_t *loop)
+{
+  printf ("got hide splash request\n");
+}
+
 static void
 on_quit (ply_event_loop_t *loop)
 {
@@ -444,6 +459,7 @@ main (int    argc,
   server = ply_boot_server_new ((ply_boot_server_update_handler_t) on_update,
                                 (ply_boot_server_ask_for_password_handler_t) on_ask_for_password,
                                 (ply_boot_server_show_splash_handler_t) on_show_splash,
+                                (ply_boot_server_hide_splash_handler_t) on_hide_splash,
                                 (ply_boot_server_newroot_handler_t) on_newroot,
                                 (ply_boot_server_system_initialized_handler_t) on_system_initialized,
                                 (ply_boot_server_quit_handler_t) on_quit,
index d2e2418b0e35158329fb7452b1075426ace99170..eccef5c38329de279fc4f3a958aed1a4d9863c36 100644 (file)
@@ -43,6 +43,9 @@ typedef void (* ply_boot_server_newroot_handler_t) (void              *user_data
 typedef void (* ply_boot_server_show_splash_handler_t) (void              *user_data,
                                                         ply_boot_server_t *server);
 
+typedef void (* ply_boot_server_hide_splash_handler_t) (void              *user_data,
+                                                        ply_boot_server_t *server);
+
 typedef void (* ply_boot_server_password_answer_handler_t) (void              *answer_data,
                                                             const char        *password,
                                                             ply_boot_server_t *server);
@@ -60,6 +63,7 @@ typedef void (* ply_boot_server_quit_handler_t) (void              *user_data,
 ply_boot_server_t *ply_boot_server_new (ply_boot_server_update_handler_t update_handler,
                                         ply_boot_server_ask_for_password_handler_t ask_for_password_handler,
                                         ply_boot_server_show_splash_handler_t show_splash_handler,
+                                        ply_boot_server_hide_splash_handler_t hide_splash_handler,
                                         ply_boot_server_newroot_handler_t newroot_handler,
                                         ply_boot_server_system_initialized_handler_t initialized_handler,
                                         ply_boot_server_quit_handler_t quit_handler,