]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
[daemon] Add new reactivate command
authorScott James Remnant <scott@ubuntu.com>
Thu, 18 Mar 2010 20:53:39 +0000 (20:53 +0000)
committerRay Strode <rstrode@redhat.com>
Mon, 22 Mar 2010 03:22:45 +0000 (23:22 -0400)
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.

src/main.c
src/ply-boot-protocol.h
src/ply-boot-server.c
src/ply-boot-server.h

index 8eab721508dee9c411eb18bd4c3bba7cb7561c03..993a1bcfc15ed44f68511b358984108c33ef51c6 100644 (file)
@@ -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);
 
index 6be72186fc3c1dd3f4fdbf11cd60411ca99b09a3..f1789fa5d25f6e523502d85099f102d40e54c0ac 100644 (file)
@@ -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"
index 6cab88741edd5ad0a1e6b7fb5b3ba67d3dc56cf9..bd2483605f4a11d6d5a1fc403179fc2db85b481b 100644 (file)
@@ -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);
 
index f2f815ae0ef1ef5582400346e605860aa7bdafbe..7ea8fc64d8c2a90d2c5c95f86d37ea0c0672a087 100644 (file)
@@ -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);