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;
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);
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)
{
ply_save_errno ();
ply_terminal_session_free (session);
+ ply_buffer_free (state->boot_buffer);
+ state->boot_buffer = NULL;
ply_restore_errno ();
return NULL;
}
return EX_OSERR;
}
+ state.boot_buffer = ply_buffer_new ();
+
state.session = spawn_session (&state, argv + 1);
if (state.session == NULL)
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);
#include "ply-event-loop.h"
#include "ply-window.h"
+#include "ply-buffer.h"
typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t;
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,
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;
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;
splash->is_shown = false;
splash->window = window;
+ splash->boot_buffer = boot_buffer;
return 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 ();
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;
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))
splash);
exit_code = ply_event_loop_run (loop);
ply_boot_splash_free (splash);
+ ply_buffer_free (buffer);
return exit_code;
}
#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,
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);
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);
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);