double start_time;
double now;
+ uint32_t needs_redraw : 1;
uint32_t is_animating : 1;
uint32_t is_visible : 1;
static void hide_console_messages (ply_boot_splash_plugin_t *plugin);
static void unhide_console_messages (ply_boot_splash_plugin_t *plugin);
+static void
+view_show_prompt_on_console_viewer (view_t *view,
+ const char *prompt,
+ const char *entry_text,
+ int number_of_bullets)
+{
+ ply_boot_splash_plugin_t *plugin = view->plugin;
+
+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
+ ply_console_viewer_print (view->console_viewer, "\n");
+
+ ply_console_viewer_clear_line (view->console_viewer);
+
+ ply_console_viewer_print (view->console_viewer, prompt);
+
+ ply_console_viewer_print (view->console_viewer, ": ");
+ if (entry_text)
+ ply_console_viewer_print (view->console_viewer, "%s", entry_text);
+
+ for (int i = 0; i < number_of_bullets; i++) {
+ ply_console_viewer_print (view->console_viewer, " ");
+ }
+
+ ply_console_viewer_print (view->console_viewer, "_");
+}
+
static void
view_show_prompt (view_t *view,
const char *prompt)
static void
view_hide_prompt (view_t *view)
{
+ ply_boot_splash_plugin_t *plugin;
+
assert (view != NULL);
+ plugin = view->plugin;
+
+ /* Obscure the password length in the scroll back */
+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY)
+ ply_console_viewer_clear_line (view->console_viewer);
+
+ ply_console_viewer_print (view->console_viewer, "\n");
+
+ if (ply_entry_is_hidden (view->entry))
+ return;
+
ply_entry_hide (view->entry);
ply_label_hide (view->label);
}
plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL;
plugin->views = ply_list_new ();
+ plugin->needs_redraw = true;
+
return plugin;
}
static void
redraw_views (ply_boot_splash_plugin_t *plugin)
+{
+ plugin->needs_redraw = true;
+}
+
+static void
+process_needed_redraws (ply_boot_splash_plugin_t *plugin)
{
ply_list_node_t *node;
+ if (!plugin->needs_redraw)
+ return;
+
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
ply_list_node_t *next_node;
node = next_node;
}
+
+ plugin->needs_redraw = false;
}
static void
int width,
int height)
{
+ ply_boot_splash_plugin_t *plugin;
ply_rectangle_t area;
area.x = x;
area.width = width;
area.height = height;
- ply_pixel_buffer_fill_with_gradient (pixel_buffer, &area,
- PLYMOUTH_BACKGROUND_START_COLOR,
- PLYMOUTH_BACKGROUND_END_COLOR);
+ plugin = view->plugin;
+
+ if (plugin->should_show_console_messages) {
+ ply_pixel_buffer_fill_with_hex_color (pixel_buffer, &area, 0);
+ } else {
+ ply_pixel_buffer_fill_with_gradient (pixel_buffer, &area,
+ PLYMOUTH_BACKGROUND_START_COLOR,
+ PLYMOUTH_BACKGROUND_END_COLOR);
+ }
}
static void
draw_background (view, pixel_buffer, x, y, width, height);
- if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
- draw_normal_view (view, pixel_buffer, x, y, width, height);
- else
- draw_prompt_view (view, pixel_buffer, x, y, width, height);
+ if (!plugin->should_show_console_messages) {
+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
+ draw_normal_view (view, pixel_buffer, x, y, width, height);
+ else
+ draw_prompt_view (view, pixel_buffer, x, y, width, height);
- ply_label_draw_area (view->message_label,
- pixel_buffer,
- x, y, width, height);
+ ply_label_draw_area (view->message_label,
+ pixel_buffer,
+ x, y, width, height);
+ }
if (plugin->plugin_console_messages_updating == false && view->console_viewer) {
ply_console_viewer_draw_area (view->console_viewer, pixel_buffer, x, y, width, height);
ply_pixel_display_draw_area (view->display, 10, 10,
ply_label_get_width (view->message_label),
ply_label_get_height (view->message_label));
+
+
+ ply_console_viewer_print (view->console_viewer, "\n%s\n", message);
node = next_node;
}
}
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
+ view_show_prompt_on_console_viewer (view, text, NULL, number_of_bullets);
view_show_prompt (view, text);
ply_entry_set_bullet_count (view->entry, number_of_bullets);
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
+ view_show_prompt_on_console_viewer (view, prompt, entry_text, -1);
view_show_prompt (view, prompt);
ply_entry_set_text (view->entry, entry_text);
hide_prompt (plugin);
plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL;
- if (!plugin->should_show_console_messages) {
+ if (!plugin->should_show_console_messages)
start_animation (plugin);
- } else {
- unhide_console_messages (plugin);
- }
redraw_views (plugin);
+
+ if (plugin->should_show_console_messages)
+ display_console_messages (plugin);
+
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
plugin->state = PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY;
show_password_prompt (plugin, prompt, bullets);
redraw_views (plugin);
+
+ if (plugin->should_show_console_messages)
+ display_console_messages (plugin);
+
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
plugin->state = PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY;
show_prompt (plugin, prompt, entry_text);
redraw_views (plugin);
+
+ if (plugin->should_show_console_messages)
+ display_console_messages (plugin);
+
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
pause_views (plugin);
+ if (plugin->should_show_console_messages)
+ stop_animation (plugin);
+
plugin->plugin_console_messages_updating = true;
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
plugin->plugin_console_messages_updating = false;
redraw_views (plugin);
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
unhide_console_messages (ply_boot_splash_plugin_t *plugin)
{
plugin->should_show_console_messages = true;
- stop_animation (plugin);
display_console_messages (plugin);
}
plugin->should_show_console_messages = false;
+ pause_views (plugin);
plugin->plugin_console_messages_updating = true;
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
plugin->plugin_console_messages_updating = false;
if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
start_animation (plugin);
+
+ redraw_views (plugin);
+ process_needed_redraws (plugin);
+ unpause_views (plugin);
}
static void
double progress_target;
uint32_t root_is_mounted : 1;
+ uint32_t needs_redraw : 1;
uint32_t is_visible : 1;
uint32_t is_animating : 1;
static void
redraw_views (ply_boot_splash_plugin_t *plugin)
+{
+ plugin->needs_redraw = true;
+}
+
+static void
+process_needed_redraws (ply_boot_splash_plugin_t *plugin)
{
ply_list_node_t *node;
+ if (!plugin->needs_redraw)
+ return;
+
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
ply_list_node_t *next_node;
node = next_node;
}
+
+ plugin->needs_redraw = false;
}
static void
screen_width, screen_height);
}
+static void
+view_show_prompt_on_console_viewer (view_t *view,
+ const char *prompt,
+ const char *entry_text,
+ int number_of_bullets)
+{
+ ply_boot_splash_plugin_t *plugin = view->plugin;
+
+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
+ ply_console_viewer_print (view->console_viewer, "\n");
+
+ ply_console_viewer_clear_line (view->console_viewer);
+
+ ply_console_viewer_print (view->console_viewer, prompt);
+
+ ply_console_viewer_print (view->console_viewer, ": ");
+ if (entry_text)
+ ply_console_viewer_print (view->console_viewer, "%s", entry_text);
+
+ for (int i = 0; i < number_of_bullets; i++) {
+ ply_console_viewer_print (view->console_viewer, " ");
+ }
+
+ ply_console_viewer_print (view->console_viewer, "_");
+}
+
static void
view_show_prompt (view_t *view,
const char *prompt)
static void
view_hide_prompt (view_t *view)
{
+ ply_boot_splash_plugin_t *plugin;
+
assert (view != NULL);
+ plugin = view->plugin;
+
+ /* Obscure the password length in the scroll back */
+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY)
+ ply_console_viewer_clear_line (view->console_viewer);
+
+ ply_console_viewer_print (view->console_viewer, "\n");
+
ply_entry_hide (view->entry);
ply_label_hide (view->label);
}
plugin->views = ply_list_new ();
+ plugin->needs_redraw = true;
+
return plugin;
}
if (width == 1 && height == 1)
single_pixel = true;
- if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY ||
- plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY) {
- uint32_t *box_data, *lock_data;
+ draw_background (view, pixel_buffer, x, y, width, height);
- draw_background (view, pixel_buffer, x, y, width, height);
+ if ((plugin->state == PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY ||
+ plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY) &&
+ !plugin->should_show_console_messages) {
+ uint32_t *box_data, *lock_data;
box_data = ply_image_get_data (plugin->box_image);
ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
&view->lock_area,
lock_data);
- } else {
+ } else if (!plugin->should_show_console_messages) {
ply_list_node_t *node;
- draw_background (view, pixel_buffer, x, y, width, height);
for (node = ply_list_get_first_node (view->sprites); node; node = ply_list_get_next_node (view->sprites, node)) {
sprite_t *sprite = ply_list_node_get_data (node);
}
if (single_pixel)
ply_pixel_buffer_fill_with_color (pixel_buffer, &clip_area, pixel_r, pixel_g, pixel_b, 1.0);
- ply_label_draw_area (view->message_label,
- pixel_buffer,
- x, y, width, height);
+
+ if (!plugin->should_show_console_messages)
+ ply_label_draw_area (view->message_label,
+ pixel_buffer,
+ x, y, width, height);
if (plugin->plugin_console_messages_updating == false && view->console_viewer) {
ply_console_viewer_draw_area (view->console_viewer, pixel_buffer, x, y, width, height);
image_area.width = ply_image_get_width (view->scaled_background_image);
image_area.height = ply_image_get_height (view->scaled_background_image);
+ if (plugin->should_show_console_messages) {
+ ply_pixel_buffer_fill_with_hex_color (pixel_buffer, &area, 0);
+ return;
+ }
+
ply_pixel_buffer_fill_with_argb32_data_with_clip (pixel_buffer,
&image_area, &area,
ply_image_get_data (view->scaled_background_image));
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
+ view_show_prompt_on_console_viewer (view, text, NULL, number_of_bullets);
view_show_prompt (view, text);
ply_entry_set_bullet_count (view->entry, number_of_bullets);
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
+ view_show_prompt_on_console_viewer (view, prompt, entry_text, -1);
view_show_prompt (view, prompt);
ply_entry_set_text (view->entry, entry_text);
next_node = ply_list_get_next_node (plugin->views, node);
ply_label_set_text (view->message_label, message);
ply_label_show (view->message_label, view->display, 10, 10);
+ ply_console_viewer_print (view->console_viewer, "\n%s\n", message);
ply_pixel_display_draw_area (view->display, 10, 10,
ply_label_get_width (view->message_label),
hide_prompt (plugin);
plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL;
- if (!plugin->should_show_console_messages) {
+ if (!plugin->should_show_console_messages)
start_animation (plugin);
- } else {
- unhide_console_messages (plugin);
- }
redraw_views (plugin);
+
+ if (plugin->should_show_console_messages)
+ display_console_messages (plugin);
+
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
plugin->state = PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY;
show_password_prompt (plugin, prompt, bullets);
redraw_views (plugin);
+
+ if (plugin->should_show_console_messages)
+ display_console_messages (plugin);
+
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
plugin->state = PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY;
show_prompt (plugin, prompt, entry_text);
redraw_views (plugin);
+
+ if (plugin->should_show_console_messages)
+ display_console_messages (plugin);
+
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
pause_views (plugin);
+ if (plugin->should_show_console_messages)
+ stop_animation (plugin);
+
plugin->plugin_console_messages_updating = true;
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
plugin->plugin_console_messages_updating = false;
redraw_views (plugin);
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
unhide_console_messages (ply_boot_splash_plugin_t *plugin)
{
plugin->should_show_console_messages = true;
- stop_animation (plugin);
display_console_messages (plugin);
}
plugin->should_show_console_messages = false;
+ pause_views (plugin);
plugin->plugin_console_messages_updating = true;
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
plugin->plugin_console_messages_updating = false;
if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
start_animation (plugin);
+
+ redraw_views (plugin);
+ process_needed_redraws (plugin);
+ unpause_views (plugin);
}
static void
ply_trigger_t *stop_trigger;
uint32_t root_is_mounted : 1;
+ uint32_t needs_redraw : 1;
uint32_t is_visible : 1;
uint32_t is_animating : 1;
uint32_t is_idle : 1;
static void
redraw_views (ply_boot_splash_plugin_t *plugin)
+{
+ plugin->needs_redraw = true;
+}
+
+static void
+process_needed_redraws (ply_boot_splash_plugin_t *plugin)
{
ply_list_node_t *node;
view_t *view;
+ if (!plugin->needs_redraw)
+ return;
+
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
view = ply_list_node_get_data (node);
view_redraw (view);
node = ply_list_get_next_node (plugin->views, node);
}
+
+ plugin->needs_redraw = false;
}
static void
}
}
+static void
+view_show_prompt_on_console_viewer (view_t *view,
+ const char *prompt,
+ const char *entry_text,
+ int number_of_bullets)
+{
+ ply_boot_splash_plugin_t *plugin = view->plugin;
+
+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
+ ply_console_viewer_print (view->console_viewer, "\n");
+
+ ply_console_viewer_clear_line (view->console_viewer);
+
+ ply_console_viewer_print (view->console_viewer, prompt);
+
+ ply_console_viewer_print (view->console_viewer, ": ");
+ if (entry_text)
+ ply_console_viewer_print (view->console_viewer, "%s", entry_text);
+
+ for (int i = 0; i < number_of_bullets; i++) {
+ ply_console_viewer_print (view->console_viewer, " ");
+ }
+
+ ply_console_viewer_print (view->console_viewer, "_");
+}
+
static void
view_show_prompt (view_t *view,
const char *prompt,
static void
view_hide_prompt (view_t *view)
{
+ ply_boot_splash_plugin_t *plugin;
+
assert (view != NULL);
+ plugin = view->plugin;
+
+ /* Obscure the password length in the scroll back */
+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY)
+ ply_console_viewer_clear_line (view->console_viewer);
+
+ ply_console_viewer_print (view->console_viewer, "\n");
+
ply_entry_hide (view->entry);
+
ply_capslock_icon_hide (view->capslock_icon);
ply_keymap_icon_hide (view->keymap_icon);
ply_label_hide (view->label);
plugin->views = ply_list_new ();
+ plugin->needs_redraw = true;
+
return plugin;
}
using_fw_background && plugin->dialog_clears_firmware_background)
use_black_background = true;
- if (plugin->should_show_console_messages)
+ if (plugin->should_show_console_messages) {
use_black_background = true;
+ }
if (use_black_background)
ply_pixel_buffer_fill_with_hex_color (pixel_buffer, &area, 0);
ply_pixel_buffer_get_size (pixel_buffer, &screen_area);
- if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY ||
- plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY) {
+ if ((plugin->state == PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY ||
+ plugin->state == PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY) &&
+ !plugin->should_show_console_messages) {
uint32_t *box_data, *lock_data;
if (plugin->box_image) {
ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
&view->lock_area,
lock_data);
- } else {
+ } else if (!plugin->should_show_console_messages) {
if (plugin->mode_settings[plugin->mode].use_progress_bar)
ply_progress_bar_draw_area (view->progress_bar, pixel_buffer,
x, y, width, height);
pixel_buffer,
x, y, width, height);
}
- ply_label_draw_area (view->message_label,
- pixel_buffer,
- x, y, width, height);
+ if (!plugin->should_show_console_messages)
+ ply_label_draw_area (view->message_label,
+ pixel_buffer,
+ x, y, width, height);
- if (!plugin->plugin_console_messages_updating && view->console_viewer) {
+ if (!plugin->plugin_console_messages_updating && view->console_viewer)
ply_console_viewer_draw_area (view->console_viewer, pixel_buffer, x, y, width, height);
- }
}
static void
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
view = ply_list_node_get_data (node);
+ view_show_prompt_on_console_viewer (view, prompt, entry_text, number_of_bullets);
view_show_prompt (view, prompt, entry_text, number_of_bullets);
node = ply_list_get_next_node (plugin->views, node);
}
ply_label_show (view->message_label, view->display, x, y);
ply_pixel_display_draw_area (view->display, x, y, width, height);
+
+ ply_console_viewer_print (view->console_viewer, "\n%s\n", message);
}
static void
plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL;
- if (!plugin->should_show_console_messages) {
+ if (!plugin->should_show_console_messages)
start_progress_animation (plugin);
- } else {
- unhide_console_messages (plugin);
- }
redraw_views (plugin);
+
+ if (plugin->should_show_console_messages)
+ display_console_messages (plugin);
+
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
plugin->state = PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY;
show_prompt (plugin, prompt, NULL, bullets);
redraw_views (plugin);
+
+ if (plugin->should_show_console_messages)
+ display_console_messages (plugin);
+
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
plugin->state = PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY;
show_prompt (plugin, prompt, entry_text, -1);
redraw_views (plugin);
+
+ if (plugin->should_show_console_messages)
+ display_console_messages (plugin);
+
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
pause_views (plugin);
+ if (plugin->should_show_console_messages)
+ stop_animation (plugin);
+
plugin->plugin_console_messages_updating = true;
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
plugin->plugin_console_messages_updating = false;
redraw_views (plugin);
+ process_needed_redraws (plugin);
unpause_views (plugin);
}
unhide_console_messages (ply_boot_splash_plugin_t *plugin)
{
plugin->should_show_console_messages = true;
- stop_animation (plugin);
display_console_messages (plugin);
}
plugin->should_show_console_messages = false;
+ pause_views (plugin);
plugin->plugin_console_messages_updating = true;
node = ply_list_get_first_node (plugin->views);
while (node != NULL) {
plugin->plugin_console_messages_updating = false;
if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
start_progress_animation (plugin);
+
+ redraw_views (plugin);
+ process_needed_redraws (plugin);
+ unpause_views (plugin);
}
static void