Sync kylin-desktop

This commit is contained in:
luoyaoming 2022-08-31 13:59:44 +08:00
parent 18fab0024a
commit aad0c7c3f3
18 changed files with 1 additions and 3545 deletions

View File

@ -1,88 +0,0 @@
Author: Laurent Bigonville <bigon@debian.org
Description:
Handle 'nosplash' boot parameter as 'plymouth.enable=0' in system unit
Index: plymouth-0.9.4git20200109/systemd-units/plymouth-halt.service.in
===================================================================
--- plymouth-0.9.4git20200109.orig/systemd-units/plymouth-halt.service.in
+++ plymouth-0.9.4git20200109/systemd-units/plymouth-halt.service.in
@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager
Before=systemd-halt.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
+ConditionKernelCommandLine=!nosplash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200109/systemd-units/plymouth-kexec.service.in
===================================================================
--- plymouth-0.9.4git20200109.orig/systemd-units/plymouth-kexec.service.in
+++ plymouth-0.9.4git20200109/systemd-units/plymouth-kexec.service.in
@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager
Before=systemd-kexec.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
+ConditionKernelCommandLine=!nosplash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200109/systemd-units/plymouth-poweroff.service.in
===================================================================
--- plymouth-0.9.4git20200109.orig/systemd-units/plymouth-poweroff.service.in
+++ plymouth-0.9.4git20200109/systemd-units/plymouth-poweroff.service.in
@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager
Before=systemd-poweroff.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
+ConditionKernelCommandLine=!nosplash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200109/systemd-units/plymouth-reboot.service.in
===================================================================
--- plymouth-0.9.4git20200109.orig/systemd-units/plymouth-reboot.service.in
+++ plymouth-0.9.4git20200109/systemd-units/plymouth-reboot.service.in
@@ -4,6 +4,7 @@ After=getty@tty1.service display-manager
Before=systemd-reboot.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
+ConditionKernelCommandLine=!nosplash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200109/systemd-units/plymouth-start.service.in
===================================================================
--- plymouth-0.9.4git20200109.orig/systemd-units/plymouth-start.service.in
+++ plymouth-0.9.4git20200109/systemd-units/plymouth-start.service.in
@@ -5,6 +5,7 @@ Wants=systemd-ask-password-plymouth.path
After=systemd-vconsole-setup.service systemd-udev-trigger.service systemd-udevd.service
Before=systemd-ask-password-plymouth.service
ConditionKernelCommandLine=!plymouth.enable=0
+ConditionKernelCommandLine=!nosplash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200109/systemd-units/systemd-ask-password-plymouth.path.in
===================================================================
--- plymouth-0.9.4git20200109.orig/systemd-units/systemd-ask-password-plymouth.path.in
+++ plymouth-0.9.4git20200109/systemd-units/systemd-ask-password-plymouth.path.in
@@ -6,6 +6,7 @@ Conflicts=shutdown.target
After=plymouth-start.service
Before=basic.target shutdown.target
ConditionKernelCommandLine=!plymouth.enable=0
+ConditionKernelCommandLine=!nosplash
ConditionPathExists=/run/plymouth/pid
ConditionVirtualization=!container
Index: plymouth-0.9.4git20200109/systemd-units/systemd-ask-password-plymouth.service.in
===================================================================
--- plymouth-0.9.4git20200109.orig/systemd-units/systemd-ask-password-plymouth.service.in
+++ plymouth-0.9.4git20200109/systemd-units/systemd-ask-password-plymouth.service.in
@@ -6,6 +6,7 @@ Conflicts=shutdown.target
After=plymouth-start.service
Before=shutdown.target
ConditionKernelCommandLine=!plymouth.enable=0
+ConditionKernelCommandLine=!nosplash
ConditionVirtualization=!container
ConditionPathExists=@plymouthruntimedir@/pid

View File

@ -1,21 +0,0 @@
Description: Removed explicit printing of ':'
Removed the explicit printing of ':'. Expected to be a part of the prompt.
Author: Surbhi Palande <surbhi.palande@canonical.com>
Index: plymouth-0.9.4/src/plugins/splash/details/plugin.c
===================================================================
--- plymouth-0.9.4.orig/src/plugins/splash/details/plugin.c
+++ plymouth-0.9.4/src/plugins/splash/details/plugin.c
@@ -383,10 +383,8 @@ display_password (ply_boot_splash_plugin
strlen (prompt));
else
write_on_views (plugin,
- "Password",
- strlen ("Password"));
-
- write_on_views (plugin, ":", strlen (":"));
+ "Password:",
+ strlen ("Password:"));
for (i = 0; i < bullets; i++) {
write_on_views (plugin, "*", strlen ("*"));

View File

@ -1,36 +0,0 @@
Description: Implement update status (U) splash plugin function for details plugins
Author: Dmitrijs Ledkovs <xnox@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/540645
--- a/src/plugins/splash/details/plugin.c
+++ b/src/plugins/splash/details/plugin.c
@@ -81,6 +81,9 @@
ply_buffer_t *boot_buffer;
};
+static void display_message (ply_boot_splash_plugin_t *plugin,
+ const char *message);
+
static view_t *
view_new (ply_boot_splash_plugin_t *plugin,
ply_text_display_t *display)
@@ -309,6 +312,19 @@
assert (plugin != NULL);
ply_trace ("status update");
+
+ int progress = 0;
+
+ if (! strncmp("fsck:", status, 5)) {
+ /* Chop localised formatted string */
+ /* fsck:sda1:50:Checking disk %1$d of %2$d (%3$d%% complete) */
+ sscanf(status, "fsck:.*:%d:.*", &progress);
+ char *end = strrchr(status, ':');
+ strncpy (end, "%\0", 2);
+ }
+
+ if (progress < 100)
+ display_message (plugin, status);
}
static void

View File

@ -1,21 +0,0 @@
Description: Remove systemd-vconsole-setup.service as it's not shipped in Debian
Remove systemd-vconsole-setup.service as it's not shipped in Debian and add
After=keyboard-setup.service
Author: Laurent Bigonville <bigon@debian.org>
Forwarded: not-needed
Index: plymouth-0.9.4git20190712/systemd-units/plymouth-start.service.in
===================================================================
--- plymouth-0.9.4git20190712.orig/systemd-units/plymouth-start.service.in
+++ plymouth-0.9.4git20190712/systemd-units/plymouth-start.service.in
@@ -1,8 +1,8 @@
[Unit]
Description=Show Plymouth Boot Screen
DefaultDependencies=no
-Wants=systemd-ask-password-plymouth.path systemd-vconsole-setup.service
-After=systemd-vconsole-setup.service systemd-udev-trigger.service systemd-udevd.service
+Wants=systemd-ask-password-plymouth.path
+After=systemd-udev-trigger.service systemd-udevd.service keyboard-setup.service
Before=systemd-ask-password-plymouth.service
ConditionKernelCommandLine=!plymouth.enable=0
ConditionKernelCommandLine=!nosplash

View File

@ -1,242 +0,0 @@
From b1273639823f4010d88557ab716c41aa200c5d76 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Mon, 23 Mar 2020 17:38:18 +0100
Subject: [PATCH 1/2] ply-device-manager: Only consume one udev event at a time
Commit f9e376797a91 ("ply-device-manager: Consume all events in one go")
changed ply-device-manager to consume all pending udev events in one go
instead of consuming only 1 and then returning back to the mainloop.
The idea here was to avoid the overhead of returning back to the mainloop,
doing the poll again, seeing more events were pending and then re-enter
ply-device-manager.
In retrospect this is not a good idea. Systemd waits for oneshot units
like plymouth-switch-root.service to finish and this can block the boot.
Specifically plymouth-switch-root.service must complete before systemd in
the initrd will exec the systemd from the real rootfs. This means that
systemd inside the initrd waits for the:
ExecStart=-/usr/bin/plymouth update-root-fs --new-root-dir=/sysroot
Command to complete, if this command runs while we are consuming udev
events from the graphics card (which sends a change event per probed
connector during the initial probe), then plymouth will not send the ack
to the plymouth boot-client (completing the ExecStart) until all udev
events are consumed.
On my main workstation with i915 graphics and 2 HDMI connected FHD monitors,
this delays the actual switching of the root by 1.9 - 2.1 seconds,
because the re-enumaration of the connectors in the drm plugin takes
about 0.4 seconds per run.
Other upcoming changes will greatly reduce that 0.4 seconds, but still
returning to the main-loop after a single udev event so that we can
answer any waiting boot-clients ASAP is a good idea.
This reverts commit f9e376797a91ad5fbc1f8e8e4aea778f4f22397c.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/libply-splash-core/ply-device-manager.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
index 160b8cb..f65d731 100644
--- a/src/libply-splash-core/ply-device-manager.c
+++ b/src/libply-splash-core/ply-device-manager.c
@@ -415,7 +415,7 @@ on_drm_udev_add_or_change (ply_device_manager_t *manager,
}
}
-static bool
+static void
on_udev_event (ply_device_manager_t *manager)
{
struct udev_device *device;
@@ -423,14 +423,14 @@ on_udev_event (ply_device_manager_t *manager)
device = udev_monitor_receive_device (manager->udev_monitor);
if (device == NULL)
- return false;
+ return;
action = udev_device_get_action (device);
ply_trace ("got %s event for device %s", action, udev_device_get_sysname (device));
if (action == NULL)
- return false;
+ return;
if (strcmp (action, "add") == 0 || strcmp (action, "change") == 0) {
const char *subsystem;
@@ -450,14 +450,6 @@ on_udev_event (ply_device_manager_t *manager)
}
udev_device_unref (device);
- return true;
-}
-
-static void
-on_udev_event_loop (ply_device_manager_t *manager)
-{
- /* Call on_udev_event until all events are consumed */
- while (on_udev_event (manager)) {}
}
static void
@@ -487,7 +479,7 @@ watch_for_udev_events (ply_device_manager_t *manager)
fd,
PLY_EVENT_LOOP_FD_STATUS_HAS_DATA,
(ply_event_handler_t)
- on_udev_event_loop,
+ on_udev_event,
NULL,
manager);
}
--
2.24.1
From 3aa76fcd872b5a528bf99a740cbdb2b443434ac0 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Tue, 24 Mar 2020 23:17:42 +0100
Subject: [PATCH 2/2] drm: Do not unnecessarily get output info twice
When a kernel-mode-setting driver loads it will trigger an add udev event
for /dev/dri/card0, followed by one udev change event per connector on the
card. This means that after our initial probe of the card,
create_heads_for_active_connectors is called a number of times for all the
udev change events.
After the initial enum our outputs array will contain active entries for
all connected displays. Meaning that the first loop in
create_heads_for_active_connectors would call get_output_info for
these outputs. Under the hood this does a number of ioctls and especially
the drmModeGetConnector call can be quite expensive.
Then in the second loop create_heads_for_active_connectors would call
get_output_info for all connectors, including for the once which were
checked in the first loop.
There is no reason why we cannot check if active connectors in the
old outputs array have changed when we are calling get_output_info for
all connectors to build the new array. This avoids unnecessarily making
the expensive get_output_info call twice for active connectors in the
old outputs array.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
src/plugins/renderers/drm/plugin.c | 72 +++++++++++++++++++-----------
1 file changed, 46 insertions(+), 26 deletions(-)
diff --git a/src/plugins/renderers/drm/plugin.c b/src/plugins/renderers/drm/plugin.c
index 1ef2802..4dbf8da 100644
--- a/src/plugins/renderers/drm/plugin.c
+++ b/src/plugins/renderers/drm/plugin.c
@@ -1333,6 +1333,34 @@ remove_output (ply_renderer_backend_t *backend, ply_output_t *output)
ply_renderer_head_remove_connector (backend, head, output->connector_id);
}
+/* Check if an output has changed since we last enumerated it; and if
+ * it has changed remove it from the head it is part of.
+ */
+static bool
+check_if_output_has_changed (ply_renderer_backend_t *backend,
+ ply_output_t *new_output)
+{
+ ply_output_t *old_output = NULL;
+ int i;
+
+ for (i = 0; i < backend->outputs_len; i++) {
+ if (backend->outputs[i].connector_id == new_output->connector_id) {
+ old_output = &backend->outputs[i];
+ break;
+ }
+ }
+
+ if (!old_output || !old_output->controller_id)
+ return false;
+
+ if (memcmp(old_output, new_output, sizeof(ply_output_t)) == 0)
+ return false;
+
+ ply_trace ("Output for connector %u changed, removing", old_output->connector_id);
+ remove_output (backend, old_output);
+ return true;
+}
+
/* Update our outputs array to match the hardware state and
* create and/or remove heads as necessary.
* Returns true if any heads were modified.
@@ -1341,37 +1369,18 @@ static bool
create_heads_for_active_connectors (ply_renderer_backend_t *backend, bool change)
{
int i, j, number_of_setup_outputs, outputs_len;
- ply_output_t output, *outputs;
+ ply_output_t *outputs;
bool changed = false;
/* Step 1:
- * Remove existing outputs from heads if they have changed.
- */
- ply_trace ("Checking currently connected outputs for changes");
- for (i = 0; i < backend->outputs_len; i++) {
- if (!backend->outputs[i].controller_id)
- continue;
-
- get_output_info (backend, backend->outputs[i].connector_id, &output);
-
- if (memcmp(&backend->outputs[i], &output, sizeof(ply_output_t))) {
- ply_trace ("Output for connector %u changed, removing",
- backend->outputs[i].connector_id);
- remove_output (backend, &backend->outputs[i]);
- changed = true;
- }
- }
-
- /* Step 2:
- * Now that we've removed changed connectors from the heads, we can
- * simply rebuild the outputs array from scratch. For any unchanged
- * outputs for which we already have a head, we will end up in
- * ply_renderer_head_add_connector which will ignore the already
- * added connector.
+ * Query all outputs and:
+ * 1.1 Remove currently connected outputs from their heads if changed.
+ * 1.2 Build a new outputs array from scratch. For any unchanged
+ * outputs for which we already have a head, we will end up in
+ * ply_renderer_head_add_connector which will ignore the already
+ * added connector.
*/
ply_trace ("(Re)enumerating all outputs");
- free (backend->outputs);
- backend->outputs = NULL;
outputs = calloc (backend->resources->count_connectors, sizeof(*outputs));
outputs_len = backend->resources->count_connectors;
@@ -1379,10 +1388,21 @@ create_heads_for_active_connectors (ply_renderer_backend_t *backend, bool change
backend->connected_count = 0;
for (i = 0; i < outputs_len; i++) {
get_output_info (backend, backend->resources->connectors[i], &outputs[i]);
+
+ if (check_if_output_has_changed (backend, &outputs[i]))
+ changed = true;
+
if (outputs[i].connected)
backend->connected_count++;
}
+ /* Step 2:
+ * Free the old outputs array, now that we have checked for changes
+ * we no longer need it.
+ */
+ free (backend->outputs);
+ backend->outputs = NULL;
+
/* Step 3:
* Drop controllers for clones for which we've picked different modes.
*/
--
2.24.1

View File

@ -1,28 +0,0 @@
From d42ed5e4efdfee8cbd291101c5f269d3108f5b27 Mon Sep 17 00:00:00 2001
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
Date: Mon, 30 Mar 2020 18:52:39 +0800
Subject: [PATCH] two-step: Center message text within labels if labels are
centered
This makes a difference when you start rendering multiple lines in
a single label. For a single line label you won't see any difference.
Upstream: https://gitlab.freedesktop.org/plymouth/plymouth/-/merge_requests/103
---
src/plugins/splash/two-step/plugin.c | 3 +++
1 file changed, 3 insertions(+)
Index: plymouth-0.9.4git20200323/src/plugins/splash/two-step/plugin.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/plugins/splash/two-step/plugin.c
+++ plymouth-0.9.4git20200323/src/plugins/splash/two-step/plugin.c
@@ -1876,6 +1876,9 @@ view_show_message (view_t *view,
ply_boot_splash_plugin_t *plugin = view->plugin;
int x, y, width, height;
+ if (plugin->message_below_animation)
+ ply_label_set_alignment (view->message_label, PLY_LABEL_ALIGN_CENTER);
+
ply_label_set_text (view->message_label, message);
width = ply_label_get_width (view->message_label);
height = ply_label_get_height (view->message_label);

View File

@ -1,49 +0,0 @@
Author: Steve Langasek <steve.langasek@canonical.com>
Description: support initramfsless boot
Don't fail if --attach-to-session is passed and /dev/pts isn't mounted
yet, as this breaks booting without an initramfs.
Bug-Ubuntu: https://bugs.launchpad.net/bugs/981314
Index: plymouth-0.9.4git20200323/src/main.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/main.c
+++ plymouth-0.9.4git20200323/src/main.c
@@ -1780,6 +1780,7 @@ attach_to_running_session (state_t *stat
session = ply_terminal_session_new (NULL);
ply_terminal_session_attach_to_event_loop (session, state->loop);
+ state->session = session;
} else {
session = state->session;
ply_trace ("session already created");
@@ -1791,12 +1792,6 @@ attach_to_running_session (state_t *stat
(ply_terminal_session_hangup_handler_t)
(should_be_redirected ? on_session_hangup : NULL),
-1, state)) {
- ply_save_errno ();
- ply_terminal_session_free (session);
- ply_buffer_free (state->boot_buffer);
- state->boot_buffer = NULL;
- ply_restore_errno ();
-
state->is_redirected = false;
state->is_attached = false;
return false;
@@ -1808,7 +1803,6 @@ attach_to_running_session (state_t *stat
state->is_redirected = should_be_redirected;
state->is_attached = true;
- state->session = session;
return true;
}
@@ -2248,9 +2242,6 @@ main (int argc,
state.should_be_attached = attach_to_session;
if (!attach_to_running_session (&state)) {
ply_trace ("could not redirect console session: %m");
- if (!no_daemon)
- ply_detach_daemon (daemon_handle, EX_UNAVAILABLE);
- return EX_UNAVAILABLE;
}
}

View File

@ -1,366 +0,0 @@
Description: Undocumented changes
This patch contains undocumented changes accumulated during previous
versions of the Ubuntu plymouth package, that have not yet been split up
into individually-documented patches. Please try not to add further things
to this patch. Using quilt for new changes is recommended, but if you
don't, they'll end up in a separate debian-changes patch at the end of the
patch series.
Last-Update: 2011-01-21
Index: plymouth-0.9.4git20200323/src/main.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/main.c
+++ plymouth-0.9.4git20200323/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 void show_splash (state_t *state);
@@ -180,8 +181,9 @@ on_update (state_t *state,
const char *status)
{
ply_trace ("updating status to '%s'", status);
- ply_progress_status_update (state->progress,
- status);
+ if (strncmp (status, "fsck:", 5))
+ ply_progress_status_update (state->progress,
+ status);
if (state->boot_splash != NULL)
ply_boot_splash_update_status (state->boot_splash,
status);
@@ -235,6 +237,25 @@ on_system_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_messages (state_t *state)
{
if (state->boot_splash == NULL) {
@@ -464,7 +485,7 @@ show_default_splash (state_t *state)
if (state->boot_splash == NULL) {
ply_trace ("Could not start default splash screen,"
"showing text splash screen");
- state->boot_splash = show_theme (state, PLYMOUTH_THEME_PATH "text/text.plymouth");
+ state->boot_splash = show_theme (state, PLYMOUTH_THEME_PATH "text.plymouth");
}
if (state->boot_splash == NULL) {
@@ -474,7 +495,8 @@ show_default_splash (state_t *state)
}
if (state->boot_splash == NULL) {
- ply_error ("plymouthd: could not start boot splash: %m");
+ if (errno != ENOENT)
+ ply_error ("plymouthd: could not start boot splash: %m");
return;
}
@@ -561,8 +583,8 @@ on_display_message (state_t *state,
ply_boot_splash_display_message (state->boot_splash, message);
} else {
ply_trace ("not displaying message %s as no splash", message);
+ ply_list_append_data (state->messages, strdup (message));
}
- ply_list_append_data (state->messages, strdup (message));
}
static void
@@ -791,6 +813,7 @@ prepare_logging (state_t *state)
if (state->number_of_errors > 0)
spool_error (state);
}
+ flush_pending_messages (state);
}
static void
@@ -1966,6 +1989,7 @@ initialize_environment (state_t *state)
state->keystroke_triggers = ply_list_new ();
state->entry_triggers = ply_list_new ();
state->entry_buffer = ply_buffer_new ();
+ state->pending_messages = ply_list_new ();
state->messages = ply_list_new ();
if (!ply_is_tracing ())
Index: plymouth-0.9.4git20200323/src/plugins/splash/script/script-lib-image.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/plugins/splash/script/script-lib-image.c
+++ plymouth-0.9.4git20200323/src/plugins/splash/script/script-lib-image.c
@@ -200,7 +200,7 @@ static script_return_t image_text (scrip
alpha_obj = script_obj_hash_peek_element (state->local, "alpha");
- if (script_obj_is_number (alpha_obj))
+ if (alpha_obj && script_obj_is_number (alpha_obj))
alpha = CLAMP (script_obj_as_number (alpha_obj), 0, 1);
else
alpha = 1;
Index: plymouth-0.9.4git20200323/src/plugins/splash/script/script-lib-sprite.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/plugins/splash/script/script-lib-sprite.c
+++ plymouth-0.9.4git20200323/src/plugins/splash/script/script-lib-sprite.c
@@ -387,6 +387,45 @@ static script_return_t sprite_window_set
return script_return_obj_null ();
}
+static script_return_t sprite_window_get_bits_per_pixel (script_state_t *state,
+ void *user_data)
+{
+ script_lib_sprite_data_t *data = user_data;
+ ply_list_node_t *node;
+ int index;
+ script_obj_t *index_obj;
+ script_lib_display_t *display;
+ unsigned int bits_per_pixel;
+
+ index_obj = script_obj_hash_peek_element (state->local, "window");
+
+ if (index_obj)
+ {
+ index = script_obj_as_number (index_obj);
+ script_obj_unref(index_obj);
+ if (index < 0)
+ return script_return_obj_null ();
+ node = ply_list_get_nth_node (data->displays, index);
+ if (node == NULL)
+ return script_return_obj_null ();
+ display = ply_list_node_get_data (node);
+ bits_per_pixel = ply_pixel_display_get_bits_per_pixel (display->pixel_display);
+ return script_return_obj (script_obj_new_number (bits_per_pixel));
+ }
+
+ bits_per_pixel = 0;
+ for (node = ply_list_get_first_node (data->displays);
+ node;
+ node = ply_list_get_next_node (data->displays, node))
+ {
+ display = ply_list_node_get_data (node);
+ bits_per_pixel = ply_pixel_display_get_bits_per_pixel (display->pixel_display);
+ if (bits_per_pixel)
+ break;
+ }
+ return script_return_obj (script_obj_new_number (bits_per_pixel));
+}
+
static uint32_t extract_rgb_color (script_state_t *state)
{
uint8_t red = CLAMP (255 * script_obj_hash_get_number (state->local, "red"), 0, 255);
@@ -663,6 +702,12 @@ script_lib_sprite_data_t *script_lib_spr
"value",
NULL);
script_add_native_function (window_hash,
+ "GetBitsPerPixel",
+ sprite_window_get_bits_per_pixel,
+ data,
+ "window",
+ NULL);
+ script_add_native_function (window_hash,
"SetBackgroundTopColor",
sprite_window_set_background_top_color,
data,
Index: plymouth-0.9.4git20200323/src/plugins/splash/text/plugin.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/plugins/splash/text/plugin.c
+++ plymouth-0.9.4git20200323/src/plugins/splash/text/plugin.c
@@ -465,8 +465,10 @@ add_text_display (ply_boot_splash_plugin
view = view_new (plugin, display);
terminal = ply_text_display_get_terminal (view->display);
- if (ply_terminal_open (terminal))
+ if (ply_terminal_open (terminal)) {
+ ply_terminal_set_mode (terminal, PLY_TERMINAL_MODE_TEXT);
ply_terminal_activate_vt (terminal);
+ }
ply_text_display_set_draw_handler (view->display,
(ply_text_display_draw_handler_t)
Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-renderer.c
+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer.c
@@ -353,6 +353,21 @@ ply_renderer_get_buffer_for_head (ply_re
head);
}
+unsigned int
+ply_renderer_get_bits_per_pixel_for_head (ply_renderer_t *renderer,
+ ply_renderer_head_t *head)
+{
+ assert (renderer != NULL);
+ assert (renderer->plugin_interface != NULL);
+ assert (head != NULL);
+
+ if (!renderer->plugin_interface->get_bits_per_pixel_for_head)
+ return 0;
+
+ return renderer->plugin_interface->get_bits_per_pixel_for_head (renderer->backend,
+ head);
+}
+
void
ply_renderer_flush_head (ply_renderer_t *renderer,
ply_renderer_head_t *head)
Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer.h
===================================================================
--- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-renderer.h
+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer.h
@@ -64,6 +64,8 @@ const char *ply_renderer_get_device_name
ply_list_t *ply_renderer_get_heads (ply_renderer_t *renderer);
ply_pixel_buffer_t *ply_renderer_get_buffer_for_head (ply_renderer_t *renderer,
ply_renderer_head_t *head);
+unsigned int ply_renderer_get_bits_per_pixel_for_head (ply_renderer_t *renderer,
+ ply_renderer_head_t *head);
void ply_renderer_flush_head (ply_renderer_t *renderer,
ply_renderer_head_t *head);
Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-pixel-display.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-pixel-display.c
+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-pixel-display.c
@@ -52,6 +52,7 @@ struct _ply_pixel_display
unsigned long width;
unsigned long height;
int device_scale;
+ unsigned int bits_per_pixel;
ply_pixel_display_draw_handler_t draw_handler;
void *draw_handler_user_data;
@@ -80,6 +81,9 @@ ply_pixel_display_new (ply_renderer_t
display->height = size.height;
display->device_scale = ply_pixel_buffer_get_device_scale (pixel_buffer);
+ display->bits_per_pixel = ply_renderer_get_bits_per_pixel_for_head (renderer,
+ head);
+
return display;
}
@@ -113,6 +117,12 @@ ply_pixel_display_get_device_scale (ply_
return display->device_scale;
}
+unsigned int
+ply_pixel_display_get_bits_per_pixel (ply_pixel_display_t *display)
+{
+ return display->bits_per_pixel;
+}
+
static void
ply_pixel_display_flush (ply_pixel_display_t *display)
{
Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer-plugin.h
===================================================================
--- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-renderer-plugin.h
+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-renderer-plugin.h
@@ -55,6 +55,8 @@ typedef struct
ply_pixel_buffer_t * (*get_buffer_for_head)(ply_renderer_backend_t * backend,
ply_renderer_head_t * head);
+ unsigned int (*get_bits_per_pixel_for_head)(ply_renderer_backend_t * backend,
+ ply_renderer_head_t * head);
ply_renderer_input_source_t * (*get_input_source)(ply_renderer_backend_t * backend);
bool (*open_input_source)(ply_renderer_backend_t *backend,
Index: plymouth-0.9.4git20200323/src/client/ply-boot-client.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/client/ply-boot-client.c
+++ plymouth-0.9.4git20200323/src/client/ply-boot-client.c
@@ -262,14 +262,30 @@ ply_boot_client_process_incoming_replies
return;
}
- request_node = ply_list_get_first_node (client->requests_waiting_for_replies);
- assert (request_node != NULL);
+ if (!ply_read (client->socket_fd, byte, sizeof(uint8_t))) {
+ ply_error ("could not read response from boot status daemon");
+ return;
+ }
- request = (ply_boot_client_request_t *) ply_list_node_get_data (request_node);
- assert (request != NULL);
+ for (request_node = ply_list_get_first_node (client->requests_waiting_for_replies);
+ ; request_node = ply_list_get_next_node (client->requests_waiting_for_replies, request_node)) {
+ assert (request_node != NULL);
+ request = (ply_boot_client_request_t *) ply_list_node_get_data (request_node);
+ assert (request != NULL);
- if (!ply_read (client->socket_fd, byte, sizeof(uint8_t)))
- goto out;
+ if (! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD)
+ || ! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_CACHED_PASSWORD)
+ || ! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUESTION)
+ || ! strcmp (request->command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_KEYSTROKE)) {
+ if (! memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ANSWER, sizeof (uint8_t))
+ || ! memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NO_ANSWER, sizeof (uint8_t)))
+ break;
+ } else {
+ if (memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ANSWER, sizeof (uint8_t))
+ && memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_NO_ANSWER, sizeof (uint8_t)))
+ break;
+ }
+ }
if (memcmp (byte, PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK, sizeof(uint8_t)) == 0) {
if (request->handler != NULL)
Index: plymouth-0.9.4git20200323/src/plugins/renderers/frame-buffer/plugin.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/plugins/renderers/frame-buffer/plugin.c
+++ plymouth-0.9.4git20200323/src/plugins/renderers/frame-buffer/plugin.c
@@ -637,6 +637,16 @@ get_buffer_for_head (ply_renderer_backen
return backend->head.pixel_buffer;
}
+static unsigned int
+get_bits_per_pixel_for_head (ply_renderer_backend_t *backend,
+ ply_renderer_head_t *head)
+{
+ if (head != &backend->head)
+ return 0;
+
+ return backend->bytes_per_pixel * 8;
+}
+
static bool
has_input_source (ply_renderer_backend_t *backend,
ply_renderer_input_source_t *input_source)
@@ -753,6 +763,7 @@ ply_renderer_backend_get_interface (void
.flush_head = flush_head,
.get_heads = get_heads,
.get_buffer_for_head = get_buffer_for_head,
+ .get_bits_per_pixel_for_head = get_bits_per_pixel_for_head,
.get_input_source = get_input_source,
.open_input_source = open_input_source,
.set_handler_for_input_source = set_handler_for_input_source,
Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-pixel-display.h
===================================================================
--- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-pixel-display.h
+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-pixel-display.h
@@ -49,6 +49,8 @@ void ply_pixel_display_free (ply_pixel_d
ply_renderer_t *ply_pixel_display_get_renderer (ply_pixel_display_t *display);
ply_renderer_head_t *ply_pixel_display_get_renderer_head (ply_pixel_display_t *display);
+unsigned int ply_pixel_display_get_bits_per_pixel (ply_pixel_display_t *display);
+
unsigned long ply_pixel_display_get_width (ply_pixel_display_t *display);
unsigned long ply_pixel_display_get_height (ply_pixel_display_t *display);
int ply_pixel_display_get_device_scale (ply_pixel_display_t *display);

View File

@ -1,22 +0,0 @@
Index: plymouth-0.9.4git20200323/src/libply-splash-core/ply-device-manager.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/libply-splash-core/ply-device-manager.c
+++ plymouth-0.9.4git20200323/src/libply-splash-core/ply-device-manager.c
@@ -524,7 +524,8 @@ get_terminal (ply_device_manager_t *mana
if (strncmp (device_name, "/dev/", strlen ("/dev/")) == 0)
full_name = strdup (device_name);
else
- asprintf (&full_name, "/dev/%s", device_name);
+ asprintf (&full_name, "/dev/%s", "tty0");
+ //asprintf (&full_name, "/dev/%s", device_name);
if (strcmp (full_name, "/dev/tty0") == 0 ||
strcmp (full_name, "/dev/tty") == 0 ||
@@ -971,6 +972,7 @@ ply_device_manager_watch_devices (ply_de
#ifdef HAVE_UDEV
watch_for_udev_events (manager);
create_devices_for_subsystem (manager, SUBSYSTEM_DRM);
+ create_devices_for_subsystem (manager, SUBSYSTEM_FRAME_BUFFER);
ply_event_loop_watch_for_timeout (manager->loop,
device_timeout,
(ply_event_loop_timeout_handler_t)

21
debian/patches/series vendored
View File

@ -1,21 +0,0 @@
0005-cmdline.patch
drop-systemd-vconsole-setup-service.patch
git-drm-improve.patch
gitlab-center-messages.patch
## Ubuntu
misc-changes.patch
details-remove-separator.patch
details-update-status.patch
initramfsless-boot.patch
ubuntu-add-splash-option.patch
ubuntu-default-devicetimeout.patch
timeout-for-ping.patch
ubuntu-spinner-style.patch
ubuntu-spinner-fsck.patch
# Ubuntu themes
ubuntu-logo.patch
ubuntu-text.patch
resolve_no_splash.patch

View File

@ -1,38 +0,0 @@
Description: Don't wait forever for a ping reply.
In the event that plymouthd is not responding the plymouth client will wait
forever when sending a ping to the daemon. Instead of waiting forever timeout
after a couple of seconds.
Origin: vendor
Author: Brian Murray <brian.murray@ubuntu.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1705345
Forwarded: no
Last-Update: 2018-03-29
Index: plymouth-0.9.4git20200109/src/client/plymouth.c
===================================================================
--- plymouth-0.9.4git20200109.orig/src/client/plymouth.c
+++ plymouth-0.9.4git20200109/src/client/plymouth.c
@@ -75,6 +75,13 @@ typedef struct
char *keys;
} key_answer_state_t;
+ply_event_loop_timeout_handler_t timeout_handler(void *user_data)
+{
+ ply_event_loop_t *loop = user_data;
+ ply_trace ("ping: timed out waiting for plymouthd");
+ ply_event_loop_exit(loop, 1);
+}
+
static char **
split_string (const char *command,
const char delimiter)
@@ -1145,6 +1152,8 @@ main (int argc,
on_success,
(ply_boot_client_response_handler_t)
on_failure, &state);
+ ply_event_loop_watch_for_timeout (state.loop, 2.0,
+ timeout_handler, state.loop);
} else if (should_check_for_active_vt) {
ply_boot_client_ask_daemon_has_active_vt (state.client,
(ply_boot_client_response_handler_t)

View File

@ -1,102 +0,0 @@
Description: Ensure that we only show plymouth when splash option is provided
Consequently (with debian and ubuntu's patch), plymouth is only triggered if:
- plymouth.enable=0 isn't set
- nosplash isn't set
- we set splash (like on desktop flavors) on the kernel cmdline
Author: Didier Roche <didrocks@ubuntu.com>
Forwarded: not-needed
---
systemd-units/plymouth-halt.service.in | 1 +
systemd-units/plymouth-kexec.service.in | 1 +
systemd-units/plymouth-poweroff.service.in | 1 +
systemd-units/plymouth-reboot.service.in | 1 +
systemd-units/plymouth-start.service.in | 1 +
systemd-units/systemd-ask-password-plymouth.path.in | 1 +
systemd-units/systemd-ask-password-plymouth.service.in | 1 +
7 files changed, 7 insertions(+)
Index: plymouth-0.9.4git20200323/systemd-units/plymouth-halt.service.in
===================================================================
--- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-halt.service.in
+++ plymouth-0.9.4git20200323/systemd-units/plymouth-halt.service.in
@@ -5,6 +5,7 @@ Before=systemd-halt.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
ConditionKernelCommandLine=!nosplash
+ConditionKernelCommandLine=splash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200323/systemd-units/plymouth-kexec.service.in
===================================================================
--- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-kexec.service.in
+++ plymouth-0.9.4git20200323/systemd-units/plymouth-kexec.service.in
@@ -5,6 +5,7 @@ Before=systemd-kexec.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
ConditionKernelCommandLine=!nosplash
+ConditionKernelCommandLine=splash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200323/systemd-units/plymouth-poweroff.service.in
===================================================================
--- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-poweroff.service.in
+++ plymouth-0.9.4git20200323/systemd-units/plymouth-poweroff.service.in
@@ -5,6 +5,7 @@ Before=systemd-poweroff.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
ConditionKernelCommandLine=!nosplash
+ConditionKernelCommandLine=splash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200323/systemd-units/plymouth-reboot.service.in
===================================================================
--- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-reboot.service.in
+++ plymouth-0.9.4git20200323/systemd-units/plymouth-reboot.service.in
@@ -5,6 +5,7 @@ Before=systemd-reboot.service
DefaultDependencies=no
ConditionKernelCommandLine=!plymouth.enable=0
ConditionKernelCommandLine=!nosplash
+ConditionKernelCommandLine=splash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200323/systemd-units/plymouth-start.service.in
===================================================================
--- plymouth-0.9.4git20200323.orig/systemd-units/plymouth-start.service.in
+++ plymouth-0.9.4git20200323/systemd-units/plymouth-start.service.in
@@ -6,6 +6,7 @@ After=systemd-udev-trigger.service syste
Before=systemd-ask-password-plymouth.service
ConditionKernelCommandLine=!plymouth.enable=0
ConditionKernelCommandLine=!nosplash
+ConditionKernelCommandLine=splash
ConditionVirtualization=!container
[Service]
Index: plymouth-0.9.4git20200323/systemd-units/systemd-ask-password-plymouth.path.in
===================================================================
--- plymouth-0.9.4git20200323.orig/systemd-units/systemd-ask-password-plymouth.path.in
+++ plymouth-0.9.4git20200323/systemd-units/systemd-ask-password-plymouth.path.in
@@ -7,6 +7,7 @@ After=plymouth-start.service
Before=basic.target shutdown.target
ConditionKernelCommandLine=!plymouth.enable=0
ConditionKernelCommandLine=!nosplash
+ConditionKernelCommandLine=splash
ConditionPathExists=/run/plymouth/pid
ConditionVirtualization=!container
Index: plymouth-0.9.4git20200323/systemd-units/systemd-ask-password-plymouth.service.in
===================================================================
--- plymouth-0.9.4git20200323.orig/systemd-units/systemd-ask-password-plymouth.service.in
+++ plymouth-0.9.4git20200323/systemd-units/systemd-ask-password-plymouth.service.in
@@ -7,6 +7,7 @@ After=plymouth-start.service
Before=shutdown.target
ConditionKernelCommandLine=!plymouth.enable=0
ConditionKernelCommandLine=!nosplash
+ConditionKernelCommandLine=splash
ConditionVirtualization=!container
ConditionPathExists=@plymouthruntimedir@/pid

View File

@ -1,28 +0,0 @@
Description: Set default device timeout to 8.0, otherwise graphics fails.
The patch is needed because Ubuntu doesn't install the upstream configuration
file defaults.plymouth (which contains DeviceTimeout=8), but uses
alternatives instead.
Original-Author: Dimitri John Ledkov <xnox@ubuntu.com>
Author: Daniel van Vugt <daniel.van.vugt@canonical.com>
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1838725
Forwarded: not-needed
Last-Update: 2020-04-01
---
src/main.c | 4 ++++
1 file changed, 4 insertions(+)
Index: plymouth_0.9.4git20200323-0ubuntu6/src/main.c
===================================================================
--- plymouth_0.9.4git20200323-0ubuntu6.orig/src/main.c
+++ plymouth_0.9.4git20200323-0ubuntu6/src/main.c
@@ -2265,6 +2265,10 @@ main (int argc,
find_system_default_splash (&state);
find_distribution_default_splash (&state);
+ /* Device timeout may not be NAN or zero */
+ if (isnan (state.device_timeout) || state.device_timeout <= 0.0)
+ state.device_timeout = 8.0;
+
if (ply_kernel_command_line_has_argument ("plymouth.ignore-serial-consoles"))
device_manager_flags |= PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES;

File diff suppressed because it is too large Load Diff

View File

@ -1,289 +0,0 @@
From 60bb5d20a12c6bc92e0bf5aa0aea8f4ca3ddebd5 Mon Sep 17 00:00:00 2001
From: Daniel van Vugt <daniel.van.vugt@canonical.com>
Date: Fri, 27 Mar 2020 18:47:39 +0800
Subject: [PATCH] two-step: Add support for fsck status messages
Related to https://gitlab.freedesktop.org/plymouth/plymouth/-/issues/62 but
not a full solution. Only supports two-step right now.
Bug-Ubuntu: https://bugs.launchpad.net/bugs/1867130
---
src/plugins/splash/two-step/plugin.c | 160 ++++++++++++++++++++++++---
1 file changed, 146 insertions(+), 14 deletions(-)
Index: plymouth-0.9.4git20200323/src/plugins/splash/two-step/plugin.c
===================================================================
--- plymouth-0.9.4git20200323.orig/src/plugins/splash/two-step/plugin.c
+++ plymouth-0.9.4git20200323/src/plugins/splash/two-step/plugin.c
@@ -178,6 +178,12 @@ struct _ply_boot_splash_plugin
ply_trigger_t *idle_trigger;
ply_trigger_t *stop_trigger;
+ char *main_message;
+ char *fsck_message;
+ char *footer;
+ char *fsck_device;
+ int fsck_percent;
+
uint32_t root_is_mounted : 1;
uint32_t is_visible : 1;
uint32_t is_animating : 1;
@@ -185,6 +191,8 @@ struct _ply_boot_splash_plugin
uint32_t use_firmware_background : 1;
uint32_t dialog_clears_firmware_background : 1;
uint32_t message_below_animation : 1;
+ uint32_t transient_progress_bar : 1;
+ uint32_t in_fsck : 1;
};
ply_boot_splash_plugin_interface_t *ply_boot_splash_plugin_get_interface (void);
@@ -196,6 +204,9 @@ static void display_message (ply_boot_sp
static void become_idle (ply_boot_splash_plugin_t *plugin,
ply_trigger_t *idle_trigger);
static void view_show_message (view_t *view, const char *message);
+static void update_message (ply_boot_splash_plugin_t *plugin);
+static void update_progress_animation (ply_boot_splash_plugin_t *plugin,
+ double percent_done);
static view_t *
view_new (ply_boot_splash_plugin_t *plugin,
@@ -794,6 +805,20 @@ on_view_throbber_stopped (view_t *view)
view->end_trigger = NULL;
}
+static bool
+use_progress_bar (const ply_boot_splash_plugin_t *plugin)
+{
+ return plugin->transient_progress_bar ||
+ plugin->mode_settings[plugin->mode].use_progress_bar;
+}
+
+static bool
+use_animation (const ply_boot_splash_plugin_t *plugin)
+{
+ return !plugin->transient_progress_bar &&
+ plugin->mode_settings[plugin->mode].use_animation;
+}
+
static void
view_start_progress_animation (view_t *view)
{
@@ -815,7 +840,7 @@ view_start_progress_animation (view_t *v
ply_pixel_display_draw_area (view->display, 0, 0,
screen_width, screen_height);
- if (plugin->mode_settings[plugin->mode].use_progress_bar) {
+ if (use_progress_bar (plugin)) {
if (plugin->progress_bar_width != -1)
width = plugin->progress_bar_width;
else
@@ -829,8 +854,7 @@ view_start_progress_animation (view_t *v
view->animation_bottom = y + height;
}
- if (plugin->mode_settings[plugin->mode].use_animation &&
- view->throbber != NULL) {
+ if (use_animation (plugin) && view->throbber != NULL) {
width = ply_throbber_get_width (view->throbber);
height = ply_throbber_get_height (view->throbber);
x = plugin->animation_horizontal_alignment * screen_width - width / 2.0;
@@ -849,8 +873,7 @@ view_start_progress_animation (view_t *v
plugin->mode == PLY_BOOT_SPLASH_MODE_REBOOT)
return;
- if (plugin->mode_settings[plugin->mode].use_animation &&
- view->progress_animation != NULL) {
+ if (use_animation (plugin) && view->progress_animation != NULL) {
width = ply_progress_animation_get_width (view->progress_animation);
height = ply_progress_animation_get_height (view->progress_animation);
x = plugin->animation_horizontal_alignment * screen_width - width / 2.0;
@@ -1254,6 +1277,10 @@ destroy_plugin (ply_boot_splash_plugin_t
free (plugin->font);
free (plugin->title_font);
free (plugin->animation_dir);
+ free (plugin->main_message);
+ free (plugin->fsck_message);
+ free (plugin->footer);
+ free (plugin->fsck_device);
free_views (plugin);
free (plugin);
}
@@ -1265,7 +1292,7 @@ start_end_animation (ply_boot_splash_plu
ply_list_node_t *node;
view_t *view;
- if (!plugin->mode_settings[plugin->mode].use_animation) {
+ if (!use_animation (plugin)) {
ply_trigger_pull (trigger, NULL);
return;
}
@@ -1483,23 +1510,20 @@ on_draw (view_t *view,
&view->lock_area,
lock_data);
} else {
- if (plugin->mode_settings[plugin->mode].use_progress_bar)
+ if (use_progress_bar (plugin))
ply_progress_bar_draw_area (view->progress_bar, pixel_buffer,
x, y, width, height);
- if (plugin->mode_settings[plugin->mode].use_animation &&
- view->throbber != NULL)
+ if (use_animation (plugin) && view->throbber != NULL)
ply_throbber_draw_area (view->throbber, pixel_buffer,
x, y, width, height);
- if (plugin->mode_settings[plugin->mode].use_animation &&
- view->progress_animation != NULL)
+ if (use_animation (plugin) && view->progress_animation != NULL)
ply_progress_animation_draw_area (view->progress_animation,
pixel_buffer,
x, y, width, height);
- if (plugin->mode_settings[plugin->mode].use_animation &&
- view->end_animation != NULL)
+ if (use_animation (plugin) && view->end_animation != NULL)
ply_animation_draw_area (view->end_animation,
pixel_buffer,
x, y, width, height);
@@ -1688,10 +1712,75 @@ show_splash_screen (ply_boot_splash_plug
}
static void
+update_fsck (ply_boot_splash_plugin_t *plugin,
+ const char *device_name,
+ float percent,
+ const char *message)
+{
+ if (!plugin->in_fsck) {
+ stop_animation (plugin);
+ plugin->transient_progress_bar = true;
+ start_progress_animation (plugin);
+ plugin->in_fsck = true;
+ }
+
+ free (plugin->fsck_device);
+ plugin->fsck_device = device_name ? strdup (device_name) : NULL;
+
+ free (plugin->fsck_message);
+ plugin->fsck_message = message ? strdup (message) : message;
+
+ plugin->fsck_percent = percent;
+
+ update_message (plugin);
+ update_progress_animation (plugin, percent / 100.);
+}
+
+static void
+end_fsck (ply_boot_splash_plugin_t *plugin)
+{
+ if (!plugin->in_fsck)
+ return;
+
+ stop_animation (plugin);
+ plugin->in_fsck = false;
+ plugin->transient_progress_bar = false;
+ update_message (plugin);
+
+ if (use_animation (plugin))
+ start_progress_animation (plugin);
+}
+
+static void
+set_footer (ply_boot_splash_plugin_t *plugin,
+ const char *message)
+{
+ free (plugin->footer);
+ plugin->footer = strdup (message);
+}
+
+static void
update_status (ply_boot_splash_plugin_t *plugin,
const char *status)
{
+ char fsck_device[1024] = "";
+ char fsck_message[1024] = "";
+ float fsck_percent = 0.f;
+
assert (plugin != NULL);
+
+ if (sscanf (status, "fsck:%1023[^:]:%f",
+ fsck_device, &fsck_percent) == 2) {
+ ply_trace ("fsck of `%s' at %.1f%%", fsck_device, fsck_percent);
+ update_fsck (plugin, fsck_device, fsck_percent, NULL);
+ } else if (sscanf (status, "fsckd:%*d:%f:%1023[^\x01]",
+ &fsck_percent, fsck_message) == 2) {
+ ply_trace ("fsckd at %.1f%% [%s]", fsck_percent, fsck_message);
+ update_fsck (plugin, NULL, fsck_percent, fsck_message);
+ }
+
+ if (fsck_percent >= 100)
+ end_fsck (plugin);
}
static void
@@ -1747,6 +1836,9 @@ on_boot_progress (ply_boot_splash_plugin
if (plugin->is_idle)
return;
+ if (plugin->transient_progress_bar)
+ return;
+
/*
* If we do not have an end animation, we keep showing progress until
* become_idle gets called.
@@ -1916,6 +2008,37 @@ show_message (ply_boot_splash_plugin_t *
}
static void
+update_message (ply_boot_splash_plugin_t *plugin)
+{
+ char message[4096];
+ size_t len = 0;
+
+ if (plugin->in_fsck) {
+ const char *device = plugin->fsck_device;
+
+ if (!device || !device[0])
+ device = _("disks");
+
+ len += snprintf (message + len, sizeof(message) - 1 - len,
+ _("Checking %s: %d%% complete\n\n"),
+ device, plugin->fsck_percent);
+ }
+
+ if (plugin->in_fsck && plugin->fsck_message && len < sizeof(message))
+ len += snprintf (message + len, sizeof(message) - 1 - len,
+ "%s\n\n", plugin->fsck_message);
+ else if (plugin->main_message && len < sizeof(message))
+ len += snprintf (message + len, sizeof(message) - 1 - len,
+ "%s\n\n", plugin->main_message);
+
+ if (plugin->footer && len < sizeof(message))
+ len += snprintf (message + len, sizeof(message) - 1 - len,
+ "%s", plugin->footer);
+
+ show_message (plugin, message);
+}
+
+static void
system_update (ply_boot_splash_plugin_t *plugin,
int progress)
{
@@ -1974,7 +2097,16 @@ static void
display_message (ply_boot_splash_plugin_t *plugin,
const char *message)
{
- show_message (plugin, message);
+ if (!strncmp (message, "fsckd-cancel-msg:", 17))
+ set_footer (plugin, message + 17);
+ else if (!strncmp (message, "keys:", 5))
+ set_footer (plugin, message + 5);
+ else {
+ free (plugin->main_message);
+ plugin->main_message = strdup (message);
+ }
+
+ update_message (plugin);
}
ply_boot_splash_plugin_interface_t *

View File

@ -1,31 +0,0 @@
# Description: Ubuntu style for the spinner/bgrt theme
# use the Ubuntu font, display the password entry under the bios logo
# Upstream: not-needed
Index: plymouth-0.9.4git20200323/themes/bgrt/bgrt.plymouth.in
===================================================================
--- plymouth-0.9.4git20200323.orig/themes/bgrt/bgrt.plymouth.in
+++ plymouth-0.9.4git20200323/themes/bgrt/bgrt.plymouth.in
@@ -4,11 +4,11 @@ Description=Jimmac's spinner theme using
ModuleName=two-step
[two-step]
-Font=Cantarell 12
-TitleFont=Cantarell Light 30
+Font=Ubuntu 12
+TitleFont=Ubuntu Light 30
ImageDir=@PLYMOUTH_THEME_PATH@/spinner
DialogHorizontalAlignment=.5
-DialogVerticalAlignment=.382
+DialogVerticalAlignment=.7
TitleHorizontalAlignment=.5
TitleVerticalAlignment=.382
HorizontalAlignment=.5
@@ -21,7 +21,7 @@ BackgroundStartColor=0x000000
BackgroundEndColor=0x000000
ProgressBarBackgroundColor=0x606060
ProgressBarForegroundColor=0xffffff
-DialogClearsFirmwareBackground=true
+DialogClearsFirmwareBackground=false
MessageBelowAnimation=true
[boot-up]

View File

@ -1,904 +0,0 @@
Description: Add ubuntu-text splash plugin and theme
Author: Scott James Remnant <scott@ubuntu.com>
Forwarded: not-needed
Last-Update: 2011-01-21
Index: plymouth-0.9.4git20200323/configure.ac
===================================================================
--- plymouth-0.9.4git20200323.orig/configure.ac
+++ plymouth-0.9.4git20200323/configure.ac
@@ -309,6 +309,7 @@ AC_CONFIG_FILES([Makefile po/Makefile.in
src/plugins/splash/Makefile
src/plugins/splash/fade-throbber/Makefile
src/plugins/splash/tribar/Makefile
+ src/plugins/splash/ubuntu-text/Makefile
src/plugins/splash/text/Makefile
src/plugins/splash/details/Makefile
src/plugins/splash/space-flares/Makefile
@@ -332,6 +333,7 @@ AC_CONFIG_FILES([Makefile po/Makefile.in
themes/script/Makefile
themes/ubuntu-logo/Makefile
themes/bgrt/Makefile
+ themes/ubuntu-text/Makefile
images/Makefile
scripts/plymouth-generate-initrd
scripts/plymouth-populate-initrd
Index: plymouth-0.9.4git20200323/themes/Makefile.am
===================================================================
--- plymouth-0.9.4git20200323.orig/themes/Makefile.am
+++ plymouth-0.9.4git20200323/themes/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = spinfinity fade-in text details solar glow script spinner tribar ubuntu-logo bgrt
+SUBDIRS = spinfinity fade-in text details solar glow script spinner tribar ubuntu-logo bgrt ubuntu-text
MAINTAINERCLEANFILES = Makefile.in
Index: plymouth-0.9.4git20200323/themes/ubuntu-text/ubuntu-text.plymouth.in
===================================================================
--- /dev/null
+++ plymouth-0.9.4git20200323/themes/ubuntu-text/ubuntu-text.plymouth.in
@@ -0,0 +1,11 @@
+[Plymouth Theme]
+Name=Ubuntu Text
+Description=Text mode theme based on ubuntu-logo theme
+ModuleName=ubuntu-text
+
+[ubuntu-text]
+title=Ubuntu 18.04 LTS
+black=0x2c001e
+white=0xffffff
+brown=0xff4012
+blue=0x988592
Index: plymouth-0.9.4git20200323/themes/ubuntu-text/Makefile.am
===================================================================
--- /dev/null
+++ plymouth-0.9.4git20200323/themes/ubuntu-text/Makefile.am
@@ -0,0 +1,4 @@
+themedir = $(datadir)/plymouth/themes/ubuntu-text
+dist_theme_DATA = ubuntu-text.plymouth.in
+
+MAINTAINERCLEANFILES = Makefile.in
Index: plymouth-0.9.4git20200323/src/plugins/splash/Makefile.am
===================================================================
--- plymouth-0.9.4git20200323.orig/src/plugins/splash/Makefile.am
+++ plymouth-0.9.4git20200323/src/plugins/splash/Makefile.am
@@ -1,2 +1,2 @@
-SUBDIRS = fade-throbber text details space-flares two-step script tribar
+SUBDIRS = fade-throbber text details space-flares two-step script tribar ubuntu-text
MAINTAINERCLEANFILES = Makefile.in
Index: plymouth-0.9.4git20200323/src/plugins/splash/ubuntu-text/Makefile.am
===================================================================
--- /dev/null
+++ plymouth-0.9.4git20200323/src/plugins/splash/ubuntu-text/Makefile.am
@@ -0,0 +1,23 @@
+INCLUDES = -I$(top_srcdir) \
+ -I$(srcdir)/../../../libply \
+ -I$(srcdir)/../../../libply-splash-core \
+ -I$(srcdir)/../../.. \
+ -I$(srcdir)/../.. \
+ -I$(srcdir)/.. \
+ -I$(srcdir)
+
+plugindir = $(libdir)/plymouth
+plugin_LTLIBRARIES = ubuntu-text.la
+
+ubuntu_text_la_CFLAGS = $(PLYMOUTH_CFLAGS) \
+ -DPLYMOUTH_BACKGROUND_COLOR=$(background_color) \
+ -DPLYMOUTH_BACKGROUND_END_COLOR=$(background_end_color) \
+ -DPLYMOUTH_BACKGROUND_START_COLOR=$(background_start_color)
+
+ubuntu_text_la_LDFLAGS = -module -avoid-version -export-dynamic
+ubuntu_text_la_LIBADD = $(PLYMOUTH_LIBS) \
+ ../../../libply/libply.la \
+ ../../../libply-splash-core/libply-splash-core.la
+ubuntu_text_la_SOURCES = $(srcdir)/plugin.c
+
+MAINTAINERCLEANFILES = Makefile.in
Index: plymouth-0.9.4git20200323/src/plugins/splash/ubuntu-text/plugin.c
===================================================================
--- /dev/null
+++ plymouth-0.9.4git20200323/src/plugins/splash/ubuntu-text/plugin.c
@@ -0,0 +1,805 @@
+/* ubuntu-text.c - boot splash plugin
+ *
+ * Copyright (C) 2010 Canonical Ltd.
+ * Copyright (C) 2008 Red Hat, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * Written by: Scott James Remnant <scott@ubuntu.com>
+ * Adam Jackson <ajax@redhat.com>
+ * Ray Strode <rstrode@redhat.com>
+ */
+#include "config.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <math.h>
+#include <signal.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <termios.h>
+#include <unistd.h>
+#include <values.h>
+#include <wchar.h>
+
+#include "ply-trigger.h"
+#include "ply-boot-splash-plugin.h"
+#include "ply-buffer.h"
+#include "ply-event-loop.h"
+#include "ply-key-file.h"
+#include "ply-list.h"
+#include "ply-logger.h"
+#include "ply-text-display.h"
+#include "ply-text-progress-bar.h"
+#include "ply-utils.h"
+
+#include <linux/kd.h>
+
+#define CLEAR_LINE_SEQUENCE "\033[2K\r\n"
+#define BACKSPACE "\b\033[0K"
+
+typedef enum {
+ PLY_BOOT_SPLASH_DISPLAY_NORMAL,
+ PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY,
+ PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY
+} ply_boot_splash_display_type_t;
+
+struct _ply_boot_splash_plugin
+{
+ ply_event_loop_t *loop;
+ ply_boot_splash_mode_t mode;
+
+ ply_list_t *views;
+
+ ply_boot_splash_display_type_t state;
+
+ char *message;
+
+ uint32_t is_animating : 1;
+ uint32_t black;
+ uint32_t white;
+ uint32_t brown;
+ uint32_t blue;
+ char *title;
+};
+
+typedef struct
+{
+ ply_boot_splash_plugin_t *plugin;
+ ply_text_display_t *display;
+
+} view_t;
+
+static void hide_splash_screen (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop);
+
+static view_t *
+view_new (ply_boot_splash_plugin_t *plugin,
+ ply_text_display_t *display)
+{
+ view_t *view;
+
+ view = calloc (1, sizeof (view_t));
+ view->plugin = plugin;
+ view->display = display;
+
+ return view;
+}
+
+static void
+view_free (view_t *view)
+{
+ free (view);
+}
+
+static void
+view_show_message (view_t *view)
+{
+ ply_boot_splash_plugin_t *plugin;
+ int display_width, display_height, y;
+ ply_terminal_color_t color;
+ char *message;
+
+ plugin = view->plugin;
+
+ display_width = ply_text_display_get_number_of_columns (view->display);
+ display_height = ply_text_display_get_number_of_rows (view->display);
+
+ if (!strncmp (plugin->message, "keys:", 5))
+ {
+ message = plugin->message + 5;
+ color = PLY_TERMINAL_COLOR_WHITE;
+ y = display_height - 4;
+ }
+ else
+ {
+ message = plugin->message;
+ color = PLY_TERMINAL_COLOR_BLUE;
+ y = display_height / 2 + 7;
+ }
+
+ ply_text_display_set_cursor_position (view->display, 0, y);
+ ply_text_display_clear_line (view->display);
+ ply_text_display_set_cursor_position (view->display,
+ (display_width -
+ strlen (message)) / 2,
+ y);
+
+ ply_text_display_set_foreground_color (view->display, color);
+ ply_text_display_write (view->display, "%s", message);
+}
+
+static void
+view_show_prompt (view_t *view,
+ const char *prompt,
+ const char *entered_text)
+{
+ int display_width, display_height;
+
+ display_width = ply_text_display_get_number_of_columns (view->display);
+ display_height = ply_text_display_get_number_of_rows (view->display);
+
+ ply_text_display_set_cursor_position (view->display, 0,
+ display_height / 2 + 8);
+ ply_text_display_clear_line (view->display);
+ ply_text_display_set_cursor_position (view->display,
+ display_width / 2 - (strlen (prompt)),
+ display_height / 2 + 8);
+
+ ply_text_display_write (view->display, "%s:%s", prompt, entered_text);
+
+ ply_text_display_show_cursor (view->display);
+}
+
+static void
+view_start_animation (view_t *view)
+{
+ ply_boot_splash_plugin_t *plugin;
+ ply_terminal_t *terminal;
+
+ assert (view != NULL);
+
+ plugin = view->plugin;
+
+ terminal = ply_text_display_get_terminal (view->display);
+
+ ply_terminal_set_color_hex_value (terminal,
+ PLY_TERMINAL_COLOR_BLACK,
+ plugin->black);
+ ply_terminal_set_color_hex_value (terminal,
+ PLY_TERMINAL_COLOR_WHITE,
+ plugin->white);
+ ply_terminal_set_color_hex_value (terminal,
+ PLY_TERMINAL_COLOR_BROWN,
+ plugin->brown);
+ ply_terminal_set_color_hex_value (terminal,
+ PLY_TERMINAL_COLOR_BLUE,
+ plugin->blue);
+
+ ply_text_display_set_background_color (view->display,
+ PLY_TERMINAL_COLOR_BLACK);
+ ply_text_display_clear_screen (view->display);
+ ply_text_display_hide_cursor (view->display);
+}
+
+static void
+view_redraw (view_t *view)
+{
+ unsigned long screen_width, screen_height;
+
+ screen_width = ply_text_display_get_number_of_columns (view->display);
+ screen_height = ply_text_display_get_number_of_rows (view->display);
+
+ ply_text_display_draw_area (view->display, 0, 0,
+ screen_width, screen_height);
+}
+
+static void
+redraw_views (ply_boot_splash_plugin_t *plugin)
+{
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ 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);
+
+ view_redraw (view);
+
+ node = next_node;
+ }
+}
+
+static void
+view_hide (view_t *view)
+{
+ if (view->display != NULL)
+ {
+ ply_terminal_t *terminal;
+
+ terminal = ply_text_display_get_terminal (view->display);
+
+ ply_text_display_set_background_color (view->display, PLY_TERMINAL_COLOR_DEFAULT);
+ ply_text_display_clear_screen (view->display);
+ ply_text_display_show_cursor (view->display);
+
+ ply_terminal_reset_colors (terminal);
+ }
+}
+
+static void
+hide_views (ply_boot_splash_plugin_t *plugin)
+{
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ 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);
+
+ view_hide (view);
+
+ node = next_node;
+ }
+}
+
+static void
+pause_views (ply_boot_splash_plugin_t *plugin)
+{
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ 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_text_display_pause_updates (view->display);
+
+ node = next_node;
+ }
+}
+
+static void
+unpause_views (ply_boot_splash_plugin_t *plugin)
+{
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ 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_text_display_unpause_updates (view->display);
+
+ node = next_node;
+ }
+}
+
+static ply_boot_splash_plugin_t *
+create_plugin (ply_key_file_t *key_file)
+{
+ char *option;
+
+ ply_boot_splash_plugin_t *plugin;
+
+ ply_trace ("creating plugin");
+
+ plugin = calloc (1, sizeof (ply_boot_splash_plugin_t));
+ plugin->message = NULL;
+
+ plugin->views = ply_list_new ();
+
+ /* Not a pretty API for setting defaults for your config file... */
+ plugin->black = 0x2c001e;
+ plugin->white = 0xffffff;
+ plugin->brown = 0xff4012;
+ plugin->blue = 0x988592;
+
+ option = ply_key_file_get_value (key_file, "ubuntu-text", "black");
+ if (option)
+ sscanf(option, "0x%x", &plugin->black);
+ option = ply_key_file_get_value (key_file, "ubuntu-text", "white");
+ if (option)
+ sscanf(option, "0x%x", &plugin->white);
+ option = ply_key_file_get_value (key_file, "ubuntu-text", "brown");
+ if (option)
+ sscanf(option, "0x%x", &plugin->brown);
+ option = ply_key_file_get_value (key_file, "ubuntu-text", "blue");
+ if (option)
+ sscanf(option, "0x%x", &plugin->blue);
+
+ plugin->title = ply_key_file_get_value (key_file, "ubuntu-text", "title");
+
+ return plugin;
+}
+
+static void
+detach_from_event_loop (ply_boot_splash_plugin_t *plugin)
+{
+ plugin->loop = NULL;
+
+ ply_trace ("detaching from event loop");
+}
+
+static void
+free_views (ply_boot_splash_plugin_t *plugin)
+{
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (plugin->views);
+
+ while (node != NULL)
+ {
+ 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);
+
+ view_free (view);
+ ply_list_remove_node (plugin->views, node);
+
+ node = next_node;
+ }
+
+ ply_list_free (plugin->views);
+ plugin->views = NULL;
+}
+
+static void
+destroy_plugin (ply_boot_splash_plugin_t *plugin)
+{
+ ply_trace ("destroying plugin");
+
+ if (plugin == NULL)
+ return;
+
+ /* It doesn't ever make sense to keep this plugin on screen
+ * after exit
+ */
+ hide_splash_screen (plugin, plugin->loop);
+
+ free_views (plugin);
+ if (plugin->message != NULL)
+ free (plugin->message);
+
+ free (plugin);
+}
+
+static void
+show_message (ply_boot_splash_plugin_t *plugin)
+{
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ 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);
+
+ view_show_message (view);
+
+ node = next_node;
+ }
+}
+
+static void
+animate_frame (ply_boot_splash_plugin_t *plugin,
+ int frame)
+{
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ ply_list_node_t *next_node;
+ view_t *view;
+ int display_width, display_height;
+
+ view = ply_list_node_get_data (node);
+ next_node = ply_list_get_next_node (plugin->views, node);
+
+ display_width = ply_text_display_get_number_of_columns (view->display);
+ display_height = ply_text_display_get_number_of_rows (view->display);
+
+ ply_text_display_set_cursor_position (view->display,
+ (display_width - 12) / 2,
+ display_height / 2);
+
+ ply_text_display_set_background_color (view->display, PLY_TERMINAL_COLOR_BLACK);
+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE);
+ ply_text_display_write (view->display, "%s", plugin->title);
+
+ ply_text_display_set_cursor_position (view->display,
+ (display_width - 10) / 2,
+ (display_height / 2) + 2);
+
+ if ((frame < 1) || (frame > 4))
+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE);
+ else
+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN);
+ ply_text_display_write (view->display, "%s", ". ");
+
+ if ((frame < 2) || (frame > 5))
+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE);
+ else
+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN);
+ ply_text_display_write (view->display, "%s", ". ");
+
+ if ((frame < 3) || (frame > 6))
+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE);
+ else
+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN);
+ ply_text_display_write (view->display, "%s", ". ");
+
+ if (frame < 4)
+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_WHITE);
+ else
+ ply_text_display_set_foreground_color (view->display, PLY_TERMINAL_COLOR_BROWN);
+ ply_text_display_write (view->display, "%s", ".");
+
+ node = next_node;
+ }
+}
+
+static void
+on_timeout (ply_boot_splash_plugin_t *plugin)
+{
+ static int frame = 0;
+
+ frame += 1;
+ frame %= 8;
+
+ animate_frame (plugin, frame);
+
+ ply_event_loop_watch_for_timeout (plugin->loop, 1.0,
+ (ply_event_loop_timeout_handler_t)
+ on_timeout, plugin);
+}
+
+static void
+start_animation (ply_boot_splash_plugin_t *plugin)
+{
+ ply_list_node_t *node;
+
+ assert (plugin != NULL);
+ assert (plugin->loop != NULL);
+
+ redraw_views (plugin);
+
+ if (plugin->message != NULL)
+ show_message (plugin);
+
+ if (plugin->is_animating)
+ return;
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ 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);
+
+ view_start_animation (view);
+
+ node = next_node;
+ }
+
+ plugin->is_animating = true;
+
+ animate_frame (plugin, 0);
+ ply_event_loop_watch_for_timeout (plugin->loop, 1.0,
+ (ply_event_loop_timeout_handler_t)
+ on_timeout, plugin);
+}
+
+static void
+stop_animation (ply_boot_splash_plugin_t *plugin)
+{
+ assert (plugin != NULL);
+ assert (plugin->loop != NULL);
+
+ if (!plugin->is_animating)
+ return;
+
+ plugin->is_animating = false;
+
+ ply_event_loop_stop_watching_for_timeout (plugin->loop,
+ (ply_event_loop_timeout_handler_t)
+ on_timeout, plugin);
+
+ redraw_views (plugin);
+}
+
+static void
+on_draw (view_t *view,
+ ply_terminal_t *terminal,
+ int x,
+ int y,
+ int width,
+ int height)
+{
+}
+
+static void
+add_text_display (ply_boot_splash_plugin_t *plugin,
+ ply_text_display_t *display)
+{
+ view_t *view;
+ ply_terminal_t *terminal;
+
+ view = view_new (plugin, display);
+
+ terminal = ply_text_display_get_terminal (view->display);
+ if (ply_terminal_open (terminal))
+ {
+ ply_terminal_set_mode (terminal, PLY_TERMINAL_MODE_TEXT);
+ ply_terminal_activate_vt (terminal);
+ }
+
+ ply_text_display_set_draw_handler (view->display,
+ (ply_text_display_draw_handler_t)
+ on_draw, view);
+
+ ply_list_append_data (plugin->views, view);
+}
+
+static void
+remove_text_display (ply_boot_splash_plugin_t *plugin,
+ ply_text_display_t *display)
+{
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ view_t *view;
+ ply_list_node_t *next_node;
+
+ view = ply_list_node_get_data (node);
+ next_node = ply_list_get_next_node (plugin->views, node);
+
+ if (view->display == display)
+ {
+ ply_text_display_set_draw_handler (view->display,
+ NULL, NULL);
+ view_free (view);
+ ply_list_remove_node (plugin->views, node);
+ return;
+ }
+
+ node = next_node;
+ }
+}
+
+static bool
+show_splash_screen (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop,
+ ply_buffer_t *boot_buffer,
+ ply_boot_splash_mode_t mode)
+{
+ assert (plugin != NULL);
+
+ plugin->loop = loop;
+ plugin->mode = mode;
+ ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
+ detach_from_event_loop,
+ plugin);
+
+ ply_show_new_kernel_messages (false);
+ start_animation (plugin);
+
+ return true;
+}
+
+static void
+update_status (ply_boot_splash_plugin_t *plugin,
+ const char *status)
+{
+ assert (plugin != NULL);
+
+ ply_trace ("status update");
+}
+
+static void
+hide_splash_screen (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop)
+{
+ assert (plugin != NULL);
+
+ ply_trace ("hiding splash screen");
+
+ if (plugin->loop != NULL)
+ {
+ stop_animation (plugin);
+
+ ply_event_loop_stop_watching_for_exit (plugin->loop,
+ (ply_event_loop_exit_handler_t)
+ detach_from_event_loop,
+ plugin);
+ detach_from_event_loop (plugin);
+ }
+
+ hide_views (plugin);
+ ply_show_new_kernel_messages (true);
+}
+
+static void
+display_normal (ply_boot_splash_plugin_t *plugin)
+{
+ pause_views (plugin);
+ if (plugin->state != PLY_BOOT_SPLASH_DISPLAY_NORMAL)
+ {
+ plugin->state = PLY_BOOT_SPLASH_DISPLAY_NORMAL;
+ start_animation (plugin);
+ redraw_views (plugin);
+ }
+ unpause_views (plugin);
+}
+
+static void
+display_message (ply_boot_splash_plugin_t *plugin,
+ const char *message)
+{
+ if (plugin->message != NULL)
+ free (plugin->message);
+
+ plugin->message = strdup (message);
+ start_animation (plugin);
+}
+
+static void
+show_password_prompt (ply_boot_splash_plugin_t *plugin,
+ const char *prompt,
+ int bullets)
+{
+ ply_list_node_t *node;
+ int i;
+ char *entered_text;
+
+ entered_text = calloc (bullets + 1, sizeof (char));
+
+ for (i = 0; i < bullets; i++)
+ entered_text[i] = '*';
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ 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);
+
+ view_show_prompt (view, prompt, entered_text);
+
+ node = next_node;
+ }
+ free (entered_text);
+}
+
+static void
+show_prompt (ply_boot_splash_plugin_t *plugin,
+ const char *prompt,
+ const char *text)
+{
+ ply_list_node_t *node;
+
+ node = ply_list_get_first_node (plugin->views);
+ while (node != NULL)
+ {
+ 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);
+
+ view_show_prompt (view, prompt, text);
+
+ node = next_node;
+ }
+}
+
+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);
+
+ plugin->state = PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY;
+
+ if (!prompt)
+ prompt = "Password";
+
+ show_password_prompt (plugin, prompt, bullets);
+
+ unpause_views (plugin);
+}
+
+static void
+display_question (ply_boot_splash_plugin_t *plugin,
+ const char *prompt,
+ const char *entry_text)
+{
+ pause_views (plugin);
+ if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
+ stop_animation (plugin);
+
+ plugin->state = PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY;
+
+ if (!prompt)
+ prompt = "Password";
+
+ show_prompt (plugin, prompt, entry_text);
+
+ unpause_views (plugin);
+}
+
+
+ply_boot_splash_plugin_interface_t *
+ply_boot_splash_plugin_get_interface (void)
+{
+ static ply_boot_splash_plugin_interface_t plugin_interface =
+ {
+ .create_plugin = create_plugin,
+ .destroy_plugin = destroy_plugin,
+ .add_text_display = add_text_display,
+ .remove_text_display = remove_text_display,
+ .show_splash_screen = show_splash_screen,
+ .update_status = update_status,
+ .hide_splash_screen = hide_splash_screen,
+ .display_normal = display_normal,
+ .display_message = display_message,
+ .display_password = display_password,
+ .display_question = display_question,
+ };
+
+ return &plugin_interface;
+}
+
+/* vim: set ts=4 sw=4 expandtab autoindent cindent cino={.5s,(0: */

View File

@ -1 +1 @@
3.0 (quilt)
3.0 (native)