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 #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)