From: Scott James Remnant Date: Thu, 18 Mar 2010 20:53:39 +0000 (+0000) Subject: [daemon] Add new reactivate command X-Git-Tag: 0.8.0~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1976a90cd493623a5a6fc3f8f4b203a4e12ff22f;p=thirdparty%2Fplymouth.git [daemon] Add new reactivate command More for debugging and completeness than anything else, add a "reactivate" command to the daemon that undoes the effects of deactivate and continues the splash screen on its way. Another possible use for this could be (for example) providing a seamless shutdown experience. A future commit will implement the client bits needed. --- diff --git a/src/main.c b/src/main.c index 8eab7215..993a1bcf 100644 --- a/src/main.c +++ b/src/main.c @@ -820,6 +820,40 @@ on_deactivate (state_t *state, } } +static void +on_reactivate (state_t *state) +{ + if (!state->is_inactive) + return; + + if (state->terminal != NULL) + { + ply_terminal_watch_for_vt_changes (state->terminal); + ply_terminal_set_unbuffered_input (state->terminal); + ply_terminal_ignore_mode_changes (state->terminal, false); + } + + if ((state->session != NULL) && state->should_be_attached) + { + ply_trace ("reactivating terminal session"); + attach_to_running_session (state); + } + + if (state->keyboard != NULL) + { + ply_trace ("activating keyboard"); + ply_keyboard_watch_for_input (state->keyboard); + } + + if (state->renderer != NULL) + { + ply_trace ("activating renderer"); + ply_renderer_activate (state->renderer); + } + + state->is_inactive = false; +} + static void on_quit (state_t *state, bool retain_splash, @@ -879,6 +913,7 @@ start_boot_server (state_t *state) (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_reactivate_handler_t) on_reactivate, (ply_boot_server_quit_handler_t) on_quit, state); diff --git a/src/ply-boot-protocol.h b/src/ply-boot-protocol.h index 6be72186..f1789fa5 100644 --- a/src/ply-boot-protocol.h +++ b/src/ply-boot-protocol.h @@ -27,6 +27,7 @@ #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_REACTIVATE "r" #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT "Q" #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_PASSWORD "*" #define PLY_BOOT_PROTOCOL_REQUEST_TYPE_CACHED_PASSWORD "c" diff --git a/src/ply-boot-server.c b/src/ply-boot-server.c index 6cab8874..bd248360 100644 --- a/src/ply-boot-server.c +++ b/src/ply-boot-server.c @@ -66,6 +66,7 @@ struct _ply_boot_server 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_reactivate_handler_t reactivate_handler; ply_boot_server_quit_handler_t quit_handler; void *user_data; @@ -85,8 +86,9 @@ ply_boot_server_new (ply_boot_server_update_handler_t update_handler, ply_boot_server_hide_splash_handler_t hide_splash_handler, 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_error_handler_t error_handler, + ply_boot_server_deactivate_handler_t deactivate_handler, + ply_boot_server_reactivate_handler_t reactivate_handler, ply_boot_server_quit_handler_t quit_handler, void *user_data) { @@ -111,6 +113,7 @@ ply_boot_server_new (ply_boot_server_update_handler_t update_handler, server->show_splash_handler = show_splash_handler; server->hide_splash_handler = hide_splash_handler; server->deactivate_handler = deactivate_handler; + server->reactivate_handler = reactivate_handler; server->quit_handler = quit_handler; server->user_data = user_data; @@ -388,6 +391,12 @@ ply_boot_connection_on_request (ply_boot_connection_t *connection) free (command); return; } + else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_REACTIVATE) == 0) + { + ply_trace ("got reactivate request"); + if (server->reactivate_handler != NULL) + server->reactivate_handler (server->user_data, server); + } else if (strcmp (command, PLY_BOOT_PROTOCOL_REQUEST_TYPE_QUIT) == 0) { bool retain_splash; @@ -721,6 +730,12 @@ on_deactivate (ply_event_loop_t *loop) printf ("got deactivate request\n"); } +static void +on_reactivate (ply_event_loop_t *loop) +{ + printf ("got reactivate request\n"); +} + static void on_quit (ply_event_loop_t *loop) { @@ -814,6 +829,7 @@ main (int argc, (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_reactivate_handler_t) on_reactivate, (ply_boot_server_quit_handler_t) on_quit, loop); diff --git a/src/ply-boot-server.h b/src/ply-boot-server.h index f2f815ae..7ea8fc64 100644 --- a/src/ply-boot-server.h +++ b/src/ply-boot-server.h @@ -83,6 +83,8 @@ typedef void (* ply_boot_server_error_handler_t) (void *user_data, 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_reactivate_handler_t) (void *user_data, + ply_boot_server_t *server); typedef void (* ply_boot_server_quit_handler_t) (void *user_data, bool retain_splash, ply_trigger_t *quit_trigger, @@ -103,6 +105,7 @@ ply_boot_server_t *ply_boot_server_new (ply_boot_server_update_handler_t update_ 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_reactivate_handler_t reactivate_handler, ply_boot_server_quit_handler_t quit_handler, void *user_data);