- Minor event loop changes

- drop upstream patches
- Charlie Brej fix for progress bar resetting when escape gets pressed
This commit is contained in:
Ray Strode 2008-10-21 20:17:28 +00:00
parent 516f74a4f3
commit 25f45595e0
4 changed files with 7 additions and 285 deletions

View File

@ -1,257 +0,0 @@
diff -up plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c.textbar plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c
--- plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c.textbar 2008-08-19 15:14:04.000000000 -0400
+++ plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.c 2008-09-05 15:21:28.000000000 -0400
@@ -50,11 +50,14 @@
#include <linux/kd.h>
#ifndef FRAMES_PER_SECOND
-#define FRAMES_PER_SECOND 10
+#define FRAMES_PER_SECOND 5
#endif
#define NUMBER_OF_INDICATOR_COLUMNS 6
+#define OS_STRING " "
+char *os_string = OS_STRING;
+
struct _ply_text_pulser
{
ply_event_loop_t *loop;
@@ -75,13 +78,11 @@ ply_text_pulser_new (void)
pulser = calloc (1, sizeof (ply_text_pulser_t));
- pulser->number_of_rows = 0;
- pulser->number_of_columns = 0;
pulser->row = 0;
pulser->column = 0;
pulser->spinner_position = 0;
- pulser->number_of_columns = 40;
- pulser->number_of_rows = 1;
+ pulser->number_of_columns = 0;
+ pulser->number_of_rows = 0;
return pulser;
}
@@ -96,41 +97,95 @@ ply_text_pulser_free (ply_text_pulser_t
}
static void
-draw_trough (ply_text_pulser_t *pulser,
- int column,
- int row)
-{
- char *bytes;
-
- ply_window_set_text_cursor_position (pulser->window,
- column,
- row);
- ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_BROWN);
- bytes = malloc (pulser->number_of_columns);
- memset (bytes, ' ', pulser->number_of_columns);
- write (STDOUT_FILENO, bytes, pulser->number_of_columns);
- free (bytes);
+get_os_string (void)
+{
+ int fd;
+ char *buf, *pos, *pos2;
+ struct stat sbuf;
+
+ fd = open("/etc/system-release", O_RDONLY);
+ if (fd == -1) return;
+ if (fstat(fd, &sbuf) == -1) return;
+ buf = calloc(sbuf.st_size + 1, sizeof(char));
+ read(fd, buf, sbuf.st_size);
+ close(fd);
+
+ pos = strstr(buf, " release ");
+ if (!pos) goto out;
+ pos2 = strstr(pos, " (");
+ if (!pos2) goto out;
+ *pos = '\0';
+ pos+= 9;
+ *pos2 = '\0';
+ asprintf(&os_string," %s %s", buf, pos);
+out:
+ free(buf);
+}
+
+/* Hi Will! */
+static double
+woodsify(double time, double estimate)
+{
+ return 1.0 - pow(2.0, -pow(time, 1.45) / estimate);
}
+#define STARTUP_TIME 20.0
+
static void
animate_at_time (ply_text_pulser_t *pulser,
double time)
{
- ply_window_set_mode (pulser->window, PLY_WINDOW_MODE_TEXT);
+ int i, width = pulser->number_of_columns - 2 - strlen(os_string);
+ double brown_fraction, blue_fraction, white_fraction;
+
+ ply_window_set_mode (pulser->window, PLY_WINDOW_MODE_TEXT);
+ ply_window_set_text_cursor_position(pulser->window,
+ pulser->column,
+ pulser->row);
+
+ brown_fraction = woodsify(time, STARTUP_TIME);
+ blue_fraction = woodsify(time, STARTUP_TIME / brown_fraction);
+ white_fraction = woodsify(time, STARTUP_TIME / blue_fraction);
+
+ for (i = 0; i < width; i += 1) {
+ double f = (double)i / (double)width;
+ if (f < white_fraction)
+ ply_window_set_background_color (pulser->window,
+ PLY_WINDOW_COLOR_WHITE);
+ else if (f < blue_fraction)
+ ply_window_set_background_color (pulser->window,
+ PLY_WINDOW_COLOR_BLUE);
+ else if (f < brown_fraction)
+ ply_window_set_background_color (pulser->window,
+ PLY_WINDOW_COLOR_BROWN);
+ else break;
- draw_trough (pulser, pulser->column, pulser->row);
+ write (STDOUT_FILENO, " ", strlen (" "));
+ }
+
+ ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_BLACK);
- ply_window_set_text_cursor_position (pulser->window,
- pulser->column + pulser->spinner_position,
- pulser->row);
- pulser->spinner_position = (pulser->number_of_columns - strlen (" ") + 1) * (.5 * sin (time) + .5);
- ply_window_set_text_cursor_position (pulser->window,
- pulser->column + pulser->spinner_position,
- pulser->row);
-
- ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_GREEN);
- write (STDOUT_FILENO, " ", strlen (" "));
- ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_DEFAULT);
+ if (brown_fraction > 0.5) {
+ if (white_fraction > 0.875)
+ ply_window_set_foreground_color (pulser->window,
+ PLY_WINDOW_COLOR_WHITE);
+ else if (blue_fraction > 0.66)
+ ply_window_set_foreground_color (pulser->window,
+ PLY_WINDOW_COLOR_BLUE);
+ else
+ ply_window_set_foreground_color (pulser->window,
+ PLY_WINDOW_COLOR_BROWN);
+
+ ply_window_set_text_cursor_position(pulser->window,
+ pulser->column + width,
+ pulser->row);
+
+
+ write (STDOUT_FILENO, os_string, strlen(os_string));
+
+ ply_window_set_foreground_color (pulser->window,
+ PLY_WINDOW_COLOR_DEFAULT);
+ }
}
static void
@@ -161,9 +216,7 @@ on_timeout (ply_text_pulser_t *pulser)
bool
ply_text_pulser_start (ply_text_pulser_t *pulser,
ply_event_loop_t *loop,
- ply_window_t *window,
- int column,
- int row)
+ ply_window_t *window)
{
assert (pulser != NULL);
assert (pulser->loop == NULL);
@@ -171,10 +224,14 @@ ply_text_pulser_start (ply_text_pulser_t
pulser->loop = loop;
pulser->window = window;
- pulser->row = row;
- pulser->column = column;
+ pulser->number_of_rows = ply_window_get_number_of_text_rows(window);
+ pulser->row = pulser->number_of_rows - 1;
+ pulser->number_of_columns = ply_window_get_number_of_text_columns(window);
+ pulser->column = 2;
pulser->start_time = ply_get_timestamp ();
+
+ get_os_string ();
ply_event_loop_watch_for_timeout (pulser->loop,
1.0 / FRAMES_PER_SECOND,
diff -up plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h.textbar plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h
--- plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h.textbar 2008-08-19 15:14:04.000000000 -0400
+++ plymouth-0.6.0/src/libplybootsplash/ply-text-pulser.h 2008-09-05 15:19:22.000000000 -0400
@@ -38,9 +38,7 @@ void ply_text_pulser_free (ply_text_puls
bool ply_text_pulser_load (ply_text_pulser_t *pulser);
bool ply_text_pulser_start (ply_text_pulser_t *pulser,
ply_event_loop_t *loop,
- ply_window_t *window,
- int column,
- int row);
+ ply_window_t *window);
void ply_text_pulser_stop (ply_text_pulser_t *pulser);
int ply_text_pulser_get_number_of_rows (ply_text_pulser_t *pulser);
diff -up plymouth-0.6.0/src/plugins/splash/text/plugin.c.textbar plymouth-0.6.0/src/plugins/splash/text/plugin.c
--- plymouth-0.6.0/src/plugins/splash/text/plugin.c.textbar 2008-08-27 10:57:18.000000000 -0400
+++ plymouth-0.6.0/src/plugins/splash/text/plugin.c 2008-09-05 15:19:22.000000000 -0400
@@ -105,28 +105,33 @@ start_animation (ply_boot_splash_plugin_
assert (plugin->loop != NULL);
ply_window_set_color_hex_value (plugin->window,
+ PLY_WINDOW_COLOR_BLACK,
+ 0x000000);
+ ply_window_set_color_hex_value (plugin->window,
+ PLY_WINDOW_COLOR_WHITE,
+ 0xffffff);
+ ply_window_set_color_hex_value (plugin->window,
+ PLY_WINDOW_COLOR_BLUE,
+ 0x0073B3);
+ ply_window_set_color_hex_value (plugin->window,
PLY_WINDOW_COLOR_BROWN,
- PLYMOUTH_BACKGROUND_END_COLOR);
+ 0x00457E);
+#if 0
ply_window_set_color_hex_value (plugin->window,
PLY_WINDOW_COLOR_BLUE,
PLYMOUTH_BACKGROUND_START_COLOR);
ply_window_set_color_hex_value (plugin->window,
PLY_WINDOW_COLOR_GREEN,
PLYMOUTH_BACKGROUND_COLOR);
+#endif
- ply_window_set_background_color (plugin->window, PLY_WINDOW_COLOR_BLUE);
+ ply_window_set_background_color (plugin->window, PLY_WINDOW_COLOR_BLACK);
ply_window_clear_screen (plugin->window);
ply_window_hide_text_cursor (plugin->window);
- window_width = ply_window_get_number_of_text_columns (plugin->window);
- window_height = ply_window_get_number_of_text_rows (plugin->window);
- width = ply_text_pulser_get_number_of_columns (plugin->pulser);
- height = ply_text_pulser_get_number_of_rows (plugin->pulser);
ply_text_pulser_start (plugin->pulser,
plugin->loop,
- plugin->window,
- window_width / 2.0 - width / 2.0,
- window_height / 2.0 - height / 2.0);
+ plugin->window);
}
static void
diff -up plymouth-0.6.0/scripts/plymouth-populate-initrd.in.foo plymouth-0.6.0/scripts/plymouth-populate-initrd.in
--- plymouth-0.6.0/scripts/plymouth-populate-initrd.in.foo 2008-09-05 15:23:17.000000000 -0400
+++ plymouth-0.6.0/scripts/plymouth-populate-initrd.in 2008-09-05 15:23:51.000000000 -0400
@@ -60,6 +60,7 @@ inst ${BINDIR}/plymouth $INITRDDIR
inst ${LIBDIR}/plymouth/text.so $INITRDDIR
inst ${LIBDIR}/plymouth/details.so $INITRDDIR
inst ${PLYMOUTH_LOGO_FILE} $INITRDDIR
+inst /etc/system-release $INITRDDIR
mkdir -p ${INITRDDIR}${DATADIR}/plymouth
PLUGIN_NAME=$(plymouth-set-default-plugin)

View File

@ -1,23 +0,0 @@
commit ea15d24f3ee82aab3981c2516e09831a7176460c
Author: Ray Strode <rstrode@redhat.com>
Date: Mon Oct 20 16:51:35 2008 -0400
At exit do on_hide_splash not ply_boot_splash_hide
Calling just ply_boot_splash_hide meant that the
terminal wasn't getting reset properly causing
tty1 to misbehave.
diff --git a/src/main.c b/src/main.c
index d37c1b0..f35178a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -373,7 +373,7 @@ on_quit (state_t *state,
if (state->boot_splash != NULL)
{
if (!retain_splash)
- ply_boot_splash_hide (state->boot_splash);
+ on_hide_splash (state);
ply_boot_splash_free (state->boot_splash);
state->boot_splash = NULL;
}

View File

@ -5,7 +5,7 @@
Summary: Plymouth Graphical Boot Animation and Logger Summary: Plymouth Graphical Boot Animation and Logger
Name: plymouth Name: plymouth
Version: 0.6.0 Version: 0.6.0
Release: 0.2008.10.17.4%{?dist} Release: 0.2008.10.21.1%{?dist}
License: GPLv2+ License: GPLv2+
Group: System Environment/Base Group: System Environment/Base
Source0: http://freedesktop.org/software/plymouth/releases/%{name}-%{version}.tar.bz2 Source0: http://freedesktop.org/software/plymouth/releases/%{name}-%{version}.tar.bz2
@ -20,8 +20,6 @@ Requires: system-plymouth-plugin >= %{version}-%{release}
Requires(post): plymouth-scripts Requires(post): plymouth-scripts
Requires: initscripts >= 8.83-1 Requires: initscripts >= 8.83-1
Patch0: plymouth-0.6.0-fix-tty1-on-runlevel3.patch
%description %description
Plymouth provides an attractive graphical boot animation in Plymouth provides an attractive graphical boot animation in
place of the text messages that normally get shown. Text place of the text messages that normally get shown. Text
@ -141,7 +139,6 @@ Plymouth. It features a blue flamed sun with animated solar flares.
%prep %prep
%setup -q %setup -q
%patch0 -p1 -b .fix-tty1-on-runlevel3
%build %build
%configure --enable-tracing --disable-tests --without-boot-entry \ %configure --enable-tracing --disable-tests --without-boot-entry \
@ -292,6 +289,11 @@ fi
%{_libdir}/plymouth/solar.so %{_libdir}/plymouth/solar.so
%changelog %changelog
* Tue Oct 21 2008 Ray Strode <rstrode@redhat.com> 0.5.0-0.2008.10.21.1
- Minor event loop changes
- drop upstream patches
- Charlie Brej fix for progress bar resetting when escape gets pressed
* Tue Oct 21 2008 Ray Strode <rstrode@redhat.com> 0.5.0-0.2008.10.17.4 * Tue Oct 21 2008 Ray Strode <rstrode@redhat.com> 0.5.0-0.2008.10.17.4
- Don't make plymouth-libs require plymouth (more fun with 467356) - Don't make plymouth-libs require plymouth (more fun with 467356)

View File

@ -1 +1 @@
ea9347d47f8830669388627cfe082d27 plymouth-0.6.0.tar.bz2 f5392c4940ed018ccadda16ecb1d86a9 plymouth-0.6.0.tar.bz2