ply_renderer_t *renderer;
ply_terminal_t *terminal;
+ ply_trigger_t *deactivate_trigger;
ply_trigger_t *quit_trigger;
char kernel_command_line[PLY_MAX_COMMAND_LINE_SIZE];
uint32_t is_attached : 1;
uint32_t should_be_attached : 1;
uint32_t should_retain_splash : 1;
+ uint32_t is_inactive : 1;
char *kernel_console_tty;
char *override_splash_path;
static void
on_boot_splash_idle (state_t *state)
{
+
ply_trace ("boot splash idle");
+
+ if (state->deactivate_trigger != NULL)
+ {
+ ply_trace ("deactivating renderer");
+ ply_renderer_deactivate (state->renderer);
+
+ ply_trace ("quitting splash");
+ quit_splash (state);
+
+ ply_trigger_pull (state->deactivate_trigger, NULL);
+ state->deactivate_trigger = NULL;
+ state->is_inactive = true;
+
+ return;
+ }
+
if (!state->should_retain_splash)
{
ply_trace ("hiding splash");
quit_program (state);
}
+
+static void
+on_deactivate (state_t *state,
+ ply_trigger_t *deactivate_trigger)
+{
+ ply_trace ("deactivating");
+ if (state->boot_splash != NULL)
+ {
+ state->deactivate_trigger = deactivate_trigger;
+ ply_boot_splash_become_idle (state->boot_splash,
+ (ply_boot_splash_on_idle_handler_t)
+ on_boot_splash_idle,
+ state);
+ }
+ else
+ {
+ ply_trigger_pull (state->deactivate_trigger, NULL);
+ state->deactivate_trigger = NULL;
+ }
+}
+
static void
on_quit (state_t *state,
bool retain_splash,
on_boot_splash_idle,
state);
}
+ else if (state->is_inactive && !retain_splash)
+ /* We've been deactivated and X failed to start
+ */
+ dump_details_and_quit_splash (state);
else
quit_program (state);
}
(ply_boot_server_newroot_handler_t) on_newroot,
(ply_boot_server_system_initialized_handler_t) on_system_initialized,
(ply_boot_server_error_handler_t) on_error,
+ (ply_boot_server_deactivate_handler_t) on_deactivate,
(ply_boot_server_quit_handler_t) on_quit,
state);
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_PING "P"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_UPDATE "U"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_SYSTEM_INITIALIZED "S"
+#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_DEACTIVATE "D"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT "Q"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD "*"
#define PLY_BOOT_PROTOCOL_REQUEST_TYPE_CACHED_PASSWORD "c"
ply_boot_server_ignore_keystroke_handler_t ignore_keystroke_handler;
ply_boot_server_progress_pause_handler_t progress_pause_handler;
ply_boot_server_progress_unpause_handler_t progress_unpause_handler;
+ ply_boot_server_deactivate_handler_t deactivate_handler;
ply_boot_server_quit_handler_t quit_handler;
void *user_data;
ply_boot_server_newroot_handler_t newroot_handler,
ply_boot_server_system_initialized_handler_t initialized_handler,
ply_boot_server_error_handler_t error_handler,
+ ply_boot_server_deactivate_handler_t deactivate_handler,
ply_boot_server_quit_handler_t quit_handler,
void *user_data)
{
server->system_initialized_handler = initialized_handler;
server->show_splash_handler = show_splash_handler;
server->hide_splash_handler = hide_splash_handler;
+ server->deactivate_handler = deactivate_handler;
server->quit_handler = quit_handler;
server->user_data = user_data;
}
+static void
+ply_boot_connection_on_deactivated (ply_boot_connection_t *connection)
+{
+ if (!ply_write (connection->fd,
+ PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK,
+ strlen (PLY_BOOT_PROTOCOL_RESPONSE_TYPE_ACK)))
+ {
+ ply_error ("could not write bytes: %m");
+ }
+}
+
static void
ply_boot_connection_on_quit_complete (ply_boot_connection_t *connection)
{
if (server->hide_splash_handler != NULL)
server->hide_splash_handler (server->user_data, server);
}
+ else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_DEACTIVATE) == 0)
+ {
+ ply_trigger_t *deactivate_trigger;
+
+ deactivate_trigger = ply_trigger_new (NULL);
+
+ ply_trigger_add_handler (deactivate_trigger,
+ (ply_trigger_handler_t)
+ ply_boot_connection_on_deactivated,
+ connection);
+
+ if (server->deactivate_handler != NULL)
+ server->deactivate_handler (server->user_data, deactivate_trigger, server);
+
+ free (argument);
+ free (command);
+ return;
+ }
else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT) == 0)
{
bool retain_splash;
printf ("got hide splash request\n");
}
+static void
+on_deactivate (ply_event_loop_t *loop)
+{
+ printf ("got deactivate request\n");
+}
+
static void
on_quit (ply_event_loop_t *loop)
{
(ply_boot_server_newroot_handler_t) on_newroot,
(ply_boot_server_system_initialized_handler_t) on_system_initialized,
(ply_boot_server_error_handler_t) on_error,
+ (ply_boot_server_deactivate_handler_t) on_deactivate,
(ply_boot_server_quit_handler_t) on_quit,
loop);
typedef void (* ply_boot_server_error_handler_t) (void *user_data,
ply_boot_server_t *server);
+typedef void (* ply_boot_server_deactivate_handler_t) (void *user_data,
+ ply_trigger_t *deactivate_trigger,
+ ply_boot_server_t *server);
typedef void (* ply_boot_server_quit_handler_t) (void *user_data,
bool retain_splash,
ply_trigger_t *quit_trigger,
ply_boot_server_newroot_handler_t newroot_handler,
ply_boot_server_system_initialized_handler_t initialized_handler,
ply_boot_server_error_handler_t error_handler,
+ ply_boot_server_deactivate_handler_t deactivate_handler,
ply_boot_server_quit_handler_t quit_handler,
void *user_data);