]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
main: make plymouth show-splash idempotent
authorRay Strode <rstrode@redhat.com>
Fri, 2 Nov 2012 21:26:41 +0000 (17:26 -0400)
committerRay Strode <rstrode@redhat.com>
Fri, 2 Nov 2012 21:26:41 +0000 (17:26 -0400)
plymouth show-splash causes hairy things, that should only happen once,
like activating renderers to happen.

This commit makes subsequent show-splash calls be no-ops.

src/main.c

index 60ca28f5fc98c6203787780ac68f30887d197db1..ff061630c8555cb39a3c09e16e0006d9bced9c02 100644 (file)
@@ -113,6 +113,7 @@ typedef struct
   uint32_t should_be_attached : 1;
   uint32_t should_retain_splash : 1;
   uint32_t is_inactive : 1;
+  uint32_t is_shown : 1;
   uint32_t should_force_details : 1;
 
   char *kernel_console_tty;
@@ -871,6 +872,12 @@ on_show_splash (state_t *state)
 {
   bool has_display;
 
+  if (state->is_shown)
+    {
+      ply_trace ("show splash called while already shown");
+      return;
+    }
+
   if (state->is_inactive)
     {
       ply_trace ("show splash called while inactive");
@@ -884,6 +891,8 @@ on_show_splash (state_t *state)
       return;
     }
 
+  state->is_shown = true;
+
   check_for_consoles (state, state->default_tty, true);
 
   has_display = ply_list_get_length (state->pixel_displays) > 0 ||
@@ -1012,6 +1021,8 @@ dump_details_and_quit_splash (state_t *state)
   if (state->boot_splash != NULL)
     ply_boot_splash_hide (state->boot_splash);
 
+  state->is_shown = false;
+
   quit_splash (state);
 }
 
@@ -1116,6 +1127,8 @@ on_boot_splash_idle (state_t *state)
             ply_renderer_deactivate (state->renderer);
           if (state->boot_splash != NULL)
             ply_boot_splash_hide (state->boot_splash);
+
+          state->is_shown = false;
         }
 
       ply_trace ("quitting splash");