summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRay Strode <rstrode@redhat.com>2008-06-27 14:20:56 -0400
committerRay Strode <rstrode@redhat.com>2008-06-27 14:20:56 -0400
commitc46f2a10a707f3386d17aec9da0ab304615f8230 (patch)
tree5d33d904008095c2bea9205b2ce7ff94d24f02e2
parentf1378a5218bc7a89d7acadcd2089bb18413cd693 (diff)
downloadplymouth-c46f2a10a707f3386d17aec9da0ab304615f8230.tar.gz
plymouth-c46f2a10a707f3386d17aec9da0ab304615f8230.tar.xz
plymouth-c46f2a10a707f3386d17aec9da0ab304615f8230.zip
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.
-rw-r--r--src/client/ply-boot-client.c12
-rw-r--r--src/client/ply-boot-client.h4
-rw-r--r--src/client/plymouth.c10
-rw-r--r--src/libplybootsplash/ply-window.c6
-rw-r--r--src/main.c19
-rw-r--r--src/ply-boot-protocol.h1
-rw-r--r--src/ply-boot-server.c16
-rw-r--r--src/ply-boot-server.h4
8 files changed, 68 insertions, 4 deletions
diff --git a/src/client/ply-boot-client.c b/src/client/ply-boot-client.c
index e75309d..7604e27 100644
--- a/src/client/ply-boot-client.c
+++ b/src/client/ply-boot-client.c
@@ -497,6 +497,18 @@ ply_boot_client_tell_daemon_to_show_splash (ply_boot_client_t *
}
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,
ply_boot_client_response_handler_t failed_handler,
diff --git a/src/client/ply-boot-client.h b/src/client/ply-boot-client.h
index 8ee6718..2142691 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 f5a201b..56be753 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 23db760..5f65ef1 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 a79cf35..65af748 100644
--- a/src/main.c
+++ b/src/main.c
@@ -173,6 +173,24 @@ on_show_splash (state_t *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)
{
ply_trace ("time to quit, closing boot.log");
@@ -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 de31699..e8af75a 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 64ecf6c..c161ae7 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)
@@ -415,6 +424,12 @@ on_show_splash (ply_event_loop_t *loop)
}
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)
{
printf ("got quit request, quiting...\n");
@@ -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 d2e2418..eccef5c 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,