85425912a9
slightly more traditional progress bar, to maintain the illusion of progress better than the eternally oscillating cylon. Note: still incomplete.
213 lines
8.2 KiB
Diff
213 lines
8.2 KiB
Diff
diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c
|
|
--- plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c.jx 2008-06-30 17:51:25.000000000 -0400
|
|
+++ plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.c 2008-08-12 12:44:42.000000000 -0400
|
|
@@ -50,7 +50,7 @@
|
|
#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
|
|
@@ -75,13 +75,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;
|
|
}
|
|
@@ -95,42 +93,71 @@ ply_text_pulser_free (ply_text_pulser_t
|
|
free (pulser);
|
|
}
|
|
|
|
-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);
|
|
+/* 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
|
|
+#define OS_STRING " Fedora 10"
|
|
+
|
|
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_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);
|
|
+ ply_window_set_background_color (pulser->window, PLY_WINDOW_COLOR_BLACK);
|
|
+
|
|
+ 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 +188,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,8 +196,10 @@ 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 ();
|
|
|
|
diff -up plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h.jx plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h
|
|
--- plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h.jx 2008-06-21 23:48:59.000000000 -0400
|
|
+++ plymouth-0.5.0/src/libplybootsplash/ply-text-pulser.h 2008-08-12 12:36:51.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.5.0/src/splash-plugins/text/plugin.c.jx plymouth-0.5.0/src/splash-plugins/text/plugin.c
|
|
--- plymouth-0.5.0/src/splash-plugins/text/plugin.c.jx 2008-07-29 15:15:51.000000000 -0400
|
|
+++ plymouth-0.5.0/src/splash-plugins/text/plugin.c 2008-08-12 12:36:51.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
|