From: Ray Strode Date: Tue, 20 May 2008 02:54:46 +0000 (-0400) Subject: Create a buffer to hold boot messages and pass that buffer to plugin show functions X-Git-Tag: 0.1.0~104 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=038d5d6dd32d43e3c173aae13c60ba3b5cd28fcd;p=thirdparty%2Fplymouth.git Create a buffer to hold boot messages and pass that buffer to plugin show functions --- diff --git a/src/main.c b/src/main.c index 45912111..296e719c 100644 --- a/src/main.c +++ b/src/main.c @@ -49,6 +49,7 @@ typedef struct ply_window_t *window; ply_boot_splash_t *boot_splash; ply_terminal_session_t *session; + ply_buffer_t *boot_buffer; int original_root_dir_fd; } state_t; @@ -192,7 +193,7 @@ start_boot_splash (state_t *state, ply_trace ("Loading boot splash plugin '%s'", module_path); - splash = ply_boot_splash_new (module_path, state->window); + splash = ply_boot_splash_new (module_path, state->window, state->boot_buffer); ply_trace ("attaching plugin to event loop"); ply_boot_splash_attach_to_event_loop (splash, state->loop); @@ -227,6 +228,9 @@ spawn_session (state_t *state, ply_trace ("attaching terminal session to event loop"); ply_terminal_session_attach_to_event_loop (session, state->loop); + ply_trace ("buffering terminal session for replay if user presses escape"); + ply_terminal_session_set_output_buffer (session, state->boot_buffer); + ply_trace ("running '%s'", argv[0]); if (!ply_terminal_session_run (session, flags, (ply_terminal_session_begin_handler_t) @@ -236,6 +240,8 @@ spawn_session (state_t *state, { ply_save_errno (); ply_terminal_session_free (session); + ply_buffer_free (state->boot_buffer); + state->boot_buffer = NULL; ply_restore_errno (); return NULL; } @@ -455,6 +461,8 @@ main (int argc, return EX_OSERR; } + state.boot_buffer = ply_buffer_new (); + state.session = spawn_session (&state, argv + 1); if (state.session == NULL) @@ -504,6 +512,8 @@ main (int argc, ply_trace ("freeing terminal session"); ply_terminal_session_free (state.session); + ply_buffer_free (state.boot_buffer); + ply_trace ("freeing event loop"); ply_event_loop_free (state.loop); diff --git a/src/ply-boot-splash-plugin.h b/src/ply-boot-splash-plugin.h index 78fb3c56..29aef6e7 100644 --- a/src/ply-boot-splash-plugin.h +++ b/src/ply-boot-splash-plugin.h @@ -28,6 +28,7 @@ #include "ply-event-loop.h" #include "ply-window.h" +#include "ply-buffer.h" typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t; @@ -37,7 +38,8 @@ typedef struct void (* destroy_plugin) (ply_boot_splash_plugin_t *plugin); bool (* show_splash_screen) (ply_boot_splash_plugin_t *plugin, - ply_window_t *window); + ply_window_t *window, + ply_buffer_t *boot_buffer); void (* update_status) (ply_boot_splash_plugin_t *plugin, const char *status); void (* hide_splash_screen) (ply_boot_splash_plugin_t *plugin, diff --git a/src/ply-boot-splash.c b/src/ply-boot-splash.c index 59091d79..922f5f16 100644 --- a/src/ply-boot-splash.c +++ b/src/ply-boot-splash.c @@ -45,6 +45,7 @@ struct _ply_boot_splash const ply_boot_splash_plugin_interface_t *plugin_interface; ply_boot_splash_plugin_t *plugin; ply_window_t *window; + ply_buffer_t *boot_buffer; char *module_name; char *status; @@ -57,7 +58,8 @@ typedef const ply_boot_splash_plugin_interface_t * ply_boot_splash_t * ply_boot_splash_new (const char *module_name, - ply_window_t *window) + ply_window_t *window, + ply_buffer_t *boot_buffer) { ply_boot_splash_t *splash; @@ -70,6 +72,7 @@ ply_boot_splash_new (const char *module_name, splash->is_shown = false; splash->window = window; + splash->boot_buffer = boot_buffer; return splash; } @@ -187,7 +190,8 @@ ply_boot_splash_show (ply_boot_splash_t *splash) ply_trace ("showing splash screen\n"); if (!splash->plugin_interface->show_splash_screen (splash->plugin, - splash->window)) + splash->window, + splash->boot_buffer)) { ply_save_errno (); @@ -304,6 +308,7 @@ main (int argc, ply_event_loop_t *loop; ply_boot_splash_t *splash; ply_window_t *window; + ply_buffer_t *buffer; int exit_code; const char *module_name; @@ -327,7 +332,8 @@ main (int argc, ply_window_attach_to_event_loop (window, loop); ply_window_set_escape_handler (window, (ply_window_escape_handler_t)on_quit, loop); - splash = ply_boot_splash_new (module_name, window); + buffer = ply_buffer_new (); + splash = ply_boot_splash_new (module_name, window, buffer); ply_boot_splash_attach_to_event_loop (splash, loop); if (!ply_boot_splash_show (splash)) @@ -343,6 +349,7 @@ main (int argc, splash); exit_code = ply_event_loop_run (loop); ply_boot_splash_free (splash); + ply_buffer_free (buffer); return exit_code; } diff --git a/src/ply-boot-splash.h b/src/ply-boot-splash.h index 6689beb6..b3143782 100644 --- a/src/ply-boot-splash.h +++ b/src/ply-boot-splash.h @@ -28,12 +28,14 @@ #include "ply-event-loop.h" #include "ply-window.h" +#include "ply-buffer.h" typedef struct _ply_boot_splash ply_boot_splash_t; #ifndef PLY_HIDE_FUNCTION_DECLARATIONS ply_boot_splash_t *ply_boot_splash_new (const char *module_name, - ply_window_t *window); + ply_window_t *window, + ply_buffer_t *boot_buffer); void ply_boot_splash_free (ply_boot_splash_t *splash); bool ply_boot_splash_show (ply_boot_splash_t *splash); void ply_boot_splash_update_status (ply_boot_splash_t *splash, diff --git a/src/splash-plugins/details/details.c b/src/splash-plugins/details/details.c index 84561412..de4749d9 100644 --- a/src/splash-plugins/details/details.c +++ b/src/splash-plugins/details/details.c @@ -80,7 +80,8 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin) bool show_splash_screen (ply_boot_splash_plugin_t *plugin, - ply_window_t *window) + ply_window_t *window, + ply_buffer_t *boot_buffer) { assert (plugin != NULL); diff --git a/src/splash-plugins/fedora-fade-in/fedora-fade-in.c b/src/splash-plugins/fedora-fade-in/fedora-fade-in.c index c09a68bf..35021708 100644 --- a/src/splash-plugins/fedora-fade-in/fedora-fade-in.c +++ b/src/splash-plugins/fedora-fade-in/fedora-fade-in.c @@ -321,7 +321,8 @@ on_interrupt (ply_boot_splash_plugin_t *plugin) bool show_splash_screen (ply_boot_splash_plugin_t *plugin, - ply_window_t *window) + ply_window_t *window, + ply_buffer_t *boot_buffer) { assert (plugin != NULL); assert (plugin->logo_image != NULL); diff --git a/src/splash-plugins/text/text.c b/src/splash-plugins/text/text.c index ad00bfa5..078f755b 100644 --- a/src/splash-plugins/text/text.c +++ b/src/splash-plugins/text/text.c @@ -96,7 +96,8 @@ open_console (ply_boot_splash_plugin_t *plugin) bool show_splash_screen (ply_boot_splash_plugin_t *plugin, - ply_window_t *window) + ply_window_t *window, + ply_buffer_t *boot_buffer) { assert (plugin != NULL);