void (* destroy_plugin) (ply_boot_splash_plugin_t *plugin);
bool (* show_splash_screen) (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop,
ply_window_t *window,
ply_buffer_t *boot_buffer);
void (* update_status) (ply_boot_splash_plugin_t *plugin,
const char *output,
size_t size);
void (* hide_splash_screen) (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop,
ply_window_t *window);
- void (* attach_to_event_loop) (ply_boot_splash_plugin_t *plugin,
- ply_event_loop_t *loop);
char * (* ask_for_password) (ply_boot_splash_plugin_t *plugin);
void (* on_keyboard_input) (ply_boot_splash_plugin_t *plugin,
assert (splash->plugin_interface != NULL);
assert (splash->plugin != NULL);
- assert (splash->plugin_interface->attach_to_event_loop != NULL);
assert (splash->plugin_interface->show_splash_screen != NULL);
-
- splash->plugin_interface->attach_to_event_loop (splash->plugin,
- splash->loop);
-
assert (splash->window != NULL);
ply_window_set_keyboard_input_handler (splash->window,
ply_trace ("showing splash screen\n");
if (!splash->plugin_interface->show_splash_screen (splash->plugin,
+ splash->loop,
splash->window,
splash->boot_buffer))
{
assert (splash->plugin_interface->hide_splash_screen != NULL);
splash->plugin_interface->hide_splash_screen (splash->plugin,
+ splash->loop,
splash->window);
ply_window_set_keyboard_input_handler (splash->window, NULL, NULL);
free (plugin);
}
+static void
+detach_from_event_loop (ply_boot_splash_plugin_t *plugin)
+{
+ plugin->loop = NULL;
+
+ ply_trace ("detaching from event loop");
+}
+
bool
show_splash_screen (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop,
ply_window_t *window,
ply_buffer_t *boot_buffer)
{
assert (plugin != NULL);
+ plugin->loop = loop;
+
+ ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
+ detach_from_event_loop,
+ plugin);
+
size = ply_buffer_get_size (boot_buffer);
if (size > 0)
write (STDOUT_FILENO, output, size);
}
-static void
-detach_from_event_loop (ply_boot_splash_plugin_t *plugin)
-{
- plugin->loop = NULL;
-
- ply_trace ("detaching from event loop");
-}
-
void
hide_splash_screen (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop,
ply_window_t *window)
{
assert (plugin != NULL);
detach_from_event_loop (plugin);
}
-void
-attach_to_event_loop (ply_boot_splash_plugin_t *plugin,
- ply_event_loop_t *loop)
-{
- ply_trace ("attaching to event loop");
-
- plugin->loop = loop;
-
- ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
- detach_from_event_loop,
- plugin);
-}
-
char *
ask_for_password (ply_boot_splash_plugin_t *plugin)
{
.update_status = update_status,
.on_boot_output = on_boot_output,
.hide_splash_screen = hide_splash_screen,
- .attach_to_event_loop = attach_to_event_loop,
.ask_for_password = ask_for_password,
.on_keyboard_input = on_keyboard_input
};
stop_animation (plugin);
}
+static void
+detach_from_event_loop (ply_boot_splash_plugin_t *plugin)
+{
+ plugin->loop = NULL;
+
+ ply_window_set_mode (plugin->window, PLY_WINDOW_MODE_TEXT);
+}
+
bool
show_splash_screen (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop,
ply_window_t *window,
ply_buffer_t *boot_buffer)
{
assert (plugin->logo_image != NULL);
assert (plugin->frame_buffer != NULL);
+ plugin->loop = loop;
+ ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
+ detach_from_event_loop,
+ plugin);
+
ply_trace ("loading logo image");
if (!ply_image_load (plugin->logo_image))
return false;
add_star (plugin);
}
-static void
-detach_from_event_loop (ply_boot_splash_plugin_t *plugin)
-{
- plugin->loop = NULL;
-
- ply_window_set_mode (plugin->window, PLY_WINDOW_MODE_TEXT);
-}
-
void
hide_splash_screen (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop,
ply_window_t *window)
{
assert (plugin != NULL);
ply_frame_buffer_close (plugin->frame_buffer);
}
-void
-attach_to_event_loop (ply_boot_splash_plugin_t *plugin,
- ply_event_loop_t *loop)
-{
- plugin->loop = loop;
-
- ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
- detach_from_event_loop,
- plugin);
-}
-
void
on_keyboard_input (ply_boot_splash_plugin_t *plugin,
const char *keyboard_input)
.show_splash_screen = show_splash_screen,
.update_status = update_status,
.hide_splash_screen = hide_splash_screen,
- .attach_to_event_loop = attach_to_event_loop,
.on_keyboard_input = on_keyboard_input
};
return true;
}
+static void
+detach_from_event_loop (ply_boot_splash_plugin_t *plugin)
+{
+ plugin->loop = NULL;
+
+ ply_trace ("detaching from event loop");
+}
+
bool
show_splash_screen (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop,
ply_window_t *window,
ply_buffer_t *boot_buffer)
{
assert (plugin != NULL);
+ plugin->loop = loop;
+ ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
+ detach_from_event_loop,
+ plugin);
+
ply_trace ("opening console");
if (!open_console (plugin))
return false;
write (plugin->console_fd, ".", 1);
}
-static void
-detach_from_event_loop (ply_boot_splash_plugin_t *plugin)
-{
- plugin->loop = NULL;
-
- ply_trace ("detaching from event loop");
-}
-
void
hide_splash_screen (ply_boot_splash_plugin_t *plugin,
+ ply_event_loop_t *loop,
ply_window_t *window)
{
assert (plugin != NULL);
}
}
-void
-attach_to_event_loop (ply_boot_splash_plugin_t *plugin,
- ply_event_loop_t *loop)
-{
- plugin->loop = loop;
-
- ply_trace ("attaching to event loop");
- ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
- detach_from_event_loop,
- plugin);
-}
-
char *
ask_for_password (ply_boot_splash_plugin_t *plugin)
{
.show_splash_screen = show_splash_screen,
.update_status = update_status,
.hide_splash_screen = hide_splash_screen,
- .attach_to_event_loop = attach_to_event_loop,
.ask_for_password = ask_for_password,
.on_keyboard_input = on_keyboard_input
};