[PATCH] [main] queue 'message' requests before show-splash instead of discarding them
Steve Langasek
steve.langasek at canonical.com
Tue Apr 20 02:17:46 PDT 2010
If 'plymouth message' is called before 'plymouth show-splash', we should queue
the messages instead of dropping them, since they might include important
information - e.g., telling the user what keypresses we're waiting for.
---
src/main.c | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
diff --git a/src/main.c b/src/main.c
index 40fff0f..a05e3b0 100644
--- a/src/main.c
+++ b/src/main.c
@@ -116,6 +116,7 @@ typedef struct
const char *default_tty;
int number_of_errors;
+ ply_list_t *pending_messages;
} state_t;
static ply_boot_splash_t *start_boot_splash (state_t *state,
@@ -172,6 +173,25 @@ on_update (state_t *state,
}
static void
+flush_pending_messages (state_t *state)
+{
+ ply_list_node_t *node = ply_list_get_first_node (state->pending_messages);
+ while (node != NULL)
+ {
+ ply_list_node_t *next_node;
+ char *message = ply_list_node_get_data (node);
+
+ ply_trace ("displaying queued message");
+
+ ply_boot_splash_display_message (state->boot_splash, message);
+ next_node = ply_list_get_next_node (state->pending_messages, node);
+ ply_list_remove_node (state->pending_messages, node);
+ free(message);
+ node = next_node;
+ }
+}
+
+static void
show_detailed_splash (state_t *state)
{
if (state->boot_splash != NULL)
@@ -374,6 +394,8 @@ on_display_message (state_t *state,
ply_trace ("displaying message %s", message);
if (state->boot_splash != NULL)
ply_boot_splash_display_message (state->boot_splash, message);
+ else
+ ply_list_append_data (state->pending_messages, strdup(message));
}
static void
@@ -719,6 +741,7 @@ on_show_splash (state_t *state)
show_detailed_splash (state);
state->showing_details = true;
}
+ flush_pending_messages (state);
}
static void
@@ -1680,6 +1703,7 @@ initialize_environment (state_t *state)
state->entry_buffer = ply_buffer_new();
state->pixel_displays = ply_list_new ();
state->text_displays = ply_list_new ();
+ state->pending_messages = ply_list_new ();
state->keyboard = NULL;
if (!state->default_tty)
--
1.6.5
--
Steve Langasek Give me a lever long enough and a Free OS
Debian Developer to set it on, and I can move the world.
Ubuntu Developer http://www.debian.org/
slangasek at ubuntu.com vorlon at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 828 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/plymouth/attachments/20100420/74af2ac6/attachment.pgp>
More information about the plymouth
mailing list