From: Ray Strode Date: Fri, 27 Jun 2008 18:20:56 +0000 (-0400) Subject: Add --hide-splash option X-Git-Tag: 0.5.0~11 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c46f2a10a707f3386d17aec9da0ab304615f8230;p=thirdparty%2Fplymouth.git Add --hide-splash option We want to be able to hide the splash screen in the event the user needs to interact with start up from the console. --- diff --git a/src/client/ply-boot-client.c b/src/client/ply-boot-client.c index e75309de..7604e274 100644 --- a/src/client/ply-boot-client.c +++ b/src/client/ply-boot-client.c @@ -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, diff --git a/src/client/ply-boot-client.h b/src/client/ply-boot-client.h index 8ee6718c..21426910 100644 --- a/src/client/ply-boot-client.h +++ b/src/client/ply-boot-client.h @@ -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, diff --git a/src/client/plymouth.c b/src/client/plymouth.c index f5a201b0..56be7531 100644 --- a/src/client/plymouth.c +++ b/src/client/plymouth.c @@ -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) diff --git a/src/libplybootsplash/ply-window.c b/src/libplybootsplash/ply-window.c index 23db760f..5f65ef1e 100644 --- a/src/libplybootsplash/ply-window.c +++ b/src/libplybootsplash/ply-window.c @@ -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 diff --git a/src/main.c b/src/main.c index a79cf35e..65af7483 100644 --- a/src/main.c +++ b/src/main.c @@ -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, diff --git a/src/ply-boot-protocol.h b/src/ply-boot-protocol.h index de316992..e8af75a2 100644 --- a/src/ply-boot-protocol.h +++ b/src/ply-boot-protocol.h @@ -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" diff --git a/src/ply-boot-server.c b/src/ply-boot-server.c index 64ecf6c9..c161ae7a 100644 --- a/src/ply-boot-server.c +++ b/src/ply-boot-server.c @@ -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, diff --git a/src/ply-boot-server.h b/src/ply-boot-server.h index d2e2418b..eccef5c3 100644 --- a/src/ply-boot-server.h +++ b/src/ply-boot-server.h @@ -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,