plymouth new theme

This commit is contained in:
alihanozturk
2016-04-21 21:21:57 +03:00
parent 8bb1155fa3
commit 13706dac2d
7 changed files with 173 additions and 301 deletions
+114 -221
View File
@@ -1,244 +1,137 @@
From fceb77c9dffd6644944bfd26e77ace64aba3f96f Mon Sep 17 00:00:00 2001
From 6ccedf7b6ecdc8314ed97355cfe5499fffb13a1e Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 26 Oct 2015 13:20:18 -0400
Subject: [PATCH 1/2] two-step: don't tank in updates mode when there's no
progress animations
Date: Thu, 1 Nov 2012 17:04:33 -0400
Subject: [PATCH 1/3] main: if deactivate when already deactivated return
immediately
Right now we try to use the progress animation in updates mode, even
if there's not one. This commit makes the progress animation truely
optional.
We were trying to ignore second deactivate requests, but
were instead crashing because we're trying to use a nullified
trigger.
This commit makes sure things don't go crashy when a user
does "plymouth deactivate" on an already deactivated plymouthd.
---
src/plugins/splash/two-step/plugin.c | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
src/main.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/main.c b/src/main.c
index 88e5002..60ca28f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1135,7 +1135,13 @@ static void
on_deactivate (state_t *state,
ply_trigger_t *deactivate_trigger)
{
- if ((state->deactivate_trigger != NULL) || state->is_inactive)
+ if (state->is_inactive)
+ {
+ ply_trigger_pull (deactivate_trigger, NULL);
+ return;
+ }
+
+ if (state->deactivate_trigger != NULL)
{
ply_trigger_add_handler (state->deactivate_trigger,
(ply_trigger_handler_t)
--
1.7.12.1
From b3548ebaf76d222f56d6a7b34c5940b930d47609 Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Thu, 1 Nov 2012 17:16:07 -0400
Subject: [PATCH 2/3] two-step: don't update progress when idle
We've already reach a state where we aren't drawing anymore, etc,
so don't update progress and potentially fire off animations
that won't be seen.
---
src/plugins/splash/two-step/plugin.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c
index 541a108..ceca101 100644
index 2998beb..541a108 100644
--- a/src/plugins/splash/two-step/plugin.c
+++ b/src/plugins/splash/two-step/plugin.c
@@ -180,66 +180,73 @@ view_free (view_t *view)
}
static bool
view_load (view_t *view)
{
ply_trace ("loading entry");
if (!ply_entry_load (view->entry))
return false;
ply_trace ("loading animation");
if (!ply_animation_load (view->end_animation))
{
ply_trace ("Default animation wouldn't load, "
"falling back to old naming scheme");
/* fallback to throbber- for compatibility
*/
ply_animation_free (view->end_animation);
view->end_animation = ply_animation_new (view->plugin->animation_dir,
"throbber-");
if (!ply_animation_load (view->end_animation))
{
ply_trace ("old naming scheme didn't work either");
return false;
}
ply_throbber_free (view->throbber);
view->throbber = NULL;
}
- ply_trace ("loading progress animation");
- if (!ply_progress_animation_load (view->progress_animation))
+ if (view->progress_animation != NULL)
+ {
+ ply_trace ("loading progress animation");
+ if (!ply_progress_animation_load (view->progress_animation))
+ {
+ ply_trace ("optional progress animation wouldn't load");
+ ply_progress_animation_free (view->progress_animation);
+ view->progress_animation = NULL;
+ }
+ }
+ else
{
- ply_trace ("optional progress animation wouldn't load");
- ply_progress_animation_free (view->progress_animation);
- view->progress_animation = NULL;
+ ply_trace ("this theme has no progress animation\n");
}
if (view->throbber != NULL)
{
ply_trace ("loading throbber");
if (!ply_throbber_load (view->throbber))
{
ply_trace ("optional throbber was not loaded");
ply_throbber_free (view->throbber);
view->throbber = NULL;
}
}
else
{
ply_trace ("this theme has no throbber\n");
}
return true;
}
static bool
load_views (ply_boot_splash_plugin_t *plugin)
{
ply_list_node_t *node;
bool view_loaded;
view_loaded = false;
node = ply_list_get_first_node (plugin->views);
while (node != NULL)
@@ -1249,62 +1256,63 @@ show_message (ply_boot_splash_plugin_t *plugin,
view = ply_list_node_get_data (node);
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_pixel_display_draw_area (view->display, 10, 10,
ply_label_get_width (view->message_label),
ply_label_get_height(view->message_label));
node = next_node;
}
}
static void
system_update (ply_boot_splash_plugin_t *plugin,
int progress)
{
ply_list_node_t *node;
if (plugin->mode != PLY_BOOT_SPLASH_MODE_UPDATES)
@@ -1067,6 +1067,9 @@ on_boot_progress (ply_boot_splash_plugin_t *plugin,
if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL)
return;
node = ply_list_get_first_node (plugin->views);
while (node != NULL)
+ if (plugin->is_idle)
+ return;
+
if (percent_done >= SHOW_ANIMATION_PERCENT)
{
ply_list_node_t *next_node;
view_t *view;
view = ply_list_node_get_data (node);
next_node = ply_list_get_next_node (plugin->views, node);
- ply_progress_animation_set_percent_done (view->progress_animation,
- (double) progress / 100.f);
+ if (view->progress_animation != NULL)
+ ply_progress_animation_set_percent_done (view->progress_animation,
+ (double) progress / 100.f);
node = next_node;
}
}
static void
display_normal (ply_boot_splash_plugin_t *plugin)
{
pause_views (plugin);
if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL)
hide_prompt (plugin);
plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL;
start_progress_animation (plugin);
redraw_views (plugin);
unpause_views (plugin);
}
static void
display_password (ply_boot_splash_plugin_t *plugin,
const char *prompt,
int bullets)
{
pause_views (plugin);
if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
stop_animation (plugin, NULL);
plugin->state = PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY;
show_password_prompt (plugin, prompt, bullets);
redraw_views (plugin);
unpause_views (plugin);
if (plugin->stop_trigger == NULL)
--
2.5.0
1.7.12.1
From 5de88b84ee949aaa80fafbf9e794bc2b9eddb6a6 Mon Sep 17 00:00:00 2001
From a6129abfc527ac247685d80fc5c20144be1badca Mon Sep 17 00:00:00 2001
From: Ray Strode <rstrode@redhat.com>
Date: Mon, 26 Oct 2015 13:28:33 -0400
Subject: [PATCH 2/2] script: only support one message at a time
Date: Fri, 2 Nov 2012 17:26:41 -0400
Subject: [PATCH 3/3] main: make plymouth show-splash idempotent
That's the other themes do, and callers
expect it.
plymouth show-splash causes hairy things, that should only happen once,
like activating renderers to happen.
This commit makes subsequent show-splash calls be no-ops.
---
themes/script/script.script | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
src/main.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/themes/script/script.script b/themes/script/script.script
index 7ea9d5e..25a2f2b 100644
--- a/themes/script/script.script
+++ b/themes/script/script.script
@@ -125,55 +125,47 @@ progress_box.sprite.SetPosition(progress_box.x, progress_box.y, 0);
diff --git a/src/main.c b/src/main.c
index 60ca28f..ff06163 100644
--- a/src/main.c
+++ b/src/main.c
@@ -113,6 +113,7 @@ typedef struct
uint32_t should_be_attached : 1;
uint32_t should_retain_splash : 1;
uint32_t is_inactive : 1;
+ uint32_t is_shown : 1;
uint32_t should_force_details : 1;
progress_bar.original_image = Image("progress_bar.png");
progress_bar.sprite = Sprite();
progress_bar.x = Window.GetX() + Window.GetWidth() / 2 - progress_bar.original_image.GetWidth() / 2;
progress_bar.y = Window.GetY() + Window.GetHeight() / 2 * 1.5 - progress_box.image.GetHeight() / 2 + (progress_box.image.GetHeight() - progress_bar.original_image.GetHeight()) / 2;
progress_bar.sprite.SetPosition(progress_bar.x, progress_bar.y, 1);
fun progress_callback (duration, progress)
{
if (progress_bar.image.GetWidth () != Math.Int (progress_bar.original_image.GetWidth () * progress))
{
progress_bar.image = progress_bar.original_image.Scale(progress_bar.original_image.GetWidth(progress_bar.original_image) * progress, progress_bar.original_image.GetHeight());
progress_bar.sprite.SetImage (progress_bar.image);
}
}
Plymouth.SetBootProgressFunction(progress_callback);
#----------------------------------------- Quit --------------------------------
fun quit_callback ()
char *kernel_console_tty;
@@ -871,6 +872,12 @@ on_show_splash (state_t *state)
{
logo.sprite.SetOpacity (1);
bool has_display;
+ if (state->is_shown)
+ {
+ ply_trace ("show splash called while already shown");
+ return;
+ }
+
if (state->is_inactive)
{
ply_trace ("show splash called while inactive");
@@ -884,6 +891,8 @@ on_show_splash (state_t *state)
return;
}
+ state->is_shown = true;
+
check_for_consoles (state, state->default_tty, true);
has_display = ply_list_get_length (state->pixel_displays) > 0 ||
@@ -1012,6 +1021,8 @@ dump_details_and_quit_splash (state_t *state)
if (state->boot_splash != NULL)
ply_boot_splash_hide (state->boot_splash);
+ state->is_shown = false;
+
quit_splash (state);
}
Plymouth.SetQuitFunction(quit_callback);
@@ -1116,6 +1127,8 @@ on_boot_splash_idle (state_t *state)
ply_renderer_deactivate (state->renderer);
if (state->boot_splash != NULL)
ply_boot_splash_hide (state->boot_splash);
+
+ state->is_shown = false;
}
#----------------------------------------- Message --------------------------------
-message_sprites = [];
-message_sprite_count = 0;
-message_sprite_y = 10;
+message_sprite = Sprite();
+message_sprite.SetPosition(10, 10, 10000);
fun display_message_callback (text)
{
my_image = Image.Text(text, 1, 1, 1);
- message_sprites[message_sprite_count] = Sprite(my_image);
- message_sprites[message_sprite_count].SetPosition(10, message_sprite_y, 10000);
- message_sprites[message_sprite_count].text = text;
- message_sprite_count++;
- message_sprite_y += my_image.GetHeight();
+ message_sprite.SetImage(my_image);
}
fun hide_message_callback (text)
{
- for (i = 0; i < message_sprite_count; i++)
- {
- if (message_sprites[i].text == text)
- message_sprites[i] = NULL;
- }
+ message_sprite = Sprite();
+ message_sprite.SetPosition(10, 10, 10000);
}
Plymouth.SetDisplayMessageFunction (display_message_callback);
Plymouth.SetHideMessageFunction (hide_message_callback);
ply_trace ("quitting splash");
--
2.5.0
1.7.12.1