]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Pass the mode plymouthd is running to splashes
authorRay Strode <rstrode@redhat.com>
Thu, 7 May 2009 18:38:50 +0000 (14:38 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 7 May 2009 18:38:50 +0000 (14:38 -0400)
We don't want to show progress bars and things for
shutdown, so pass the mode to the plugins so they can
just do a static image.

src/libplybootsplash/ply-boot-splash-plugin.h
src/main.c
src/plugins/splash/details/plugin.c
src/plugins/splash/fade-in/plugin.c
src/plugins/splash/glow/plugin.c
src/plugins/splash/pulser/plugin.c
src/plugins/splash/solar/plugin.c
src/plugins/splash/spinfinity/plugin.c
src/plugins/splash/text/plugin.c
src/ply-boot-splash.c
src/ply-boot-splash.h

index 5eca3b3af7ef68884c9e9946aa7e38f4e8a9729b..5cd408c8f2bd5bbb592a4fed57398b67e5a9dc32 100644 (file)
 #include "ply-trigger.h"
 #include "ply-window.h"
 
+typedef enum
+{
+  PLY_BOOT_SPLASH_MODE_BOOT_UP,
+  PLY_BOOT_SPLASH_MODE_SHUTDOWN,
+} ply_boot_splash_mode_t;
+
 typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t;
 
 typedef struct
@@ -45,7 +51,8 @@ typedef struct
                           ply_window_t             *window);
   bool (* show_splash_screen) (ply_boot_splash_plugin_t *plugin,
                                ply_event_loop_t         *loop,
-                               ply_buffer_t             *boot_buffer);
+                               ply_buffer_t             *boot_buffer,
+                               ply_boot_splash_mode_t    mode);
   void (* update_status) (ply_boot_splash_plugin_t *plugin,
                           const char               *status);
   void (* on_boot_output) (ply_boot_splash_plugin_t *plugin,
index a4d6b2657ad559d662c6b80417878ae4b3067a34..c903c75e834374c5556044c78f2a328a67cd09d0 100644 (file)
@@ -887,6 +887,7 @@ start_boot_splash (state_t    *state,
                    const char *module_path)
 {
   ply_boot_splash_t *splash;
+  ply_boot_splash_mode_t splash_mode;
 
   ply_trace ("Loading boot splash plugin '%s'",
              module_path);
@@ -910,7 +911,12 @@ start_boot_splash (state_t    *state,
   ply_trace ("adding windows to boot splash");
   add_windows_to_boot_splash (state, splash);
   ply_trace ("showing plugin");
-  if (!ply_boot_splash_show (splash))
+  if (state->mode == PLY_MODE_SHUTDOWN)
+    splash_mode = PLY_BOOT_SPLASH_MODE_SHUTDOWN;
+  else
+    splash_mode = PLY_BOOT_SPLASH_MODE_BOOT_UP;
+
+  if (!ply_boot_splash_show (splash, splash_mode))
     {
       ply_save_errno ();
       ply_boot_splash_free (splash);
index f6380bccc40cc9578cd88bc55d49f8c5e5808f3d..168e643070cce53ae4bb5bea1c0a10e0a0648251 100644 (file)
@@ -76,6 +76,7 @@ ply_boot_splash_plugin_interface_t *ply_boot_splash_plugin_get_interface (void);
 struct _ply_boot_splash_plugin
 {
   ply_event_loop_t *loop;
+  ply_boot_splash_mode_t mode;
   ply_list_t *windows;
   ply_boot_splash_display_type_t state;
 
@@ -231,7 +232,8 @@ uninitialize_window (ply_window_t             *window,
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_buffer_t             *boot_buffer)
+                    ply_buffer_t             *boot_buffer,
+                    ply_boot_splash_mode_t    mode)
 {
   size_t size;
 
@@ -241,6 +243,7 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
                    (ply_boot_splash_plugin_window_handler_t)
                    initialize_window, NULL, NULL);
   plugin->loop = loop;
+  plugin->mode = mode;
 
   ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
                                  detach_from_event_loop,
index f06f49881674297bcd86e35609a09d0b518f5882..40c61ff7ceb814697915ae121de1841008422074 100644 (file)
@@ -74,6 +74,7 @@ typedef struct
 struct _ply_boot_splash_plugin
 {
   ply_event_loop_t *loop;
+  ply_boot_splash_mode_t mode;
   ply_frame_buffer_t *frame_buffer;
   ply_image_t *logo_image;
   ply_image_t *star_image;
@@ -255,6 +256,9 @@ animate_at_time (ply_boot_splash_plugin_t *plugin,
   opacity = .5 * sin ((time / 5) * (2 * M_PI)) + .8;
   opacity = CLAMP (opacity, 0, 1.0);
 
+  if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
+    opacity = 1.0;
+
   if (fabs (opacity - last_opacity) <= DBL_MIN)
     {
       ply_frame_buffer_unpause_updates (plugin->frame_buffer);
@@ -318,14 +322,19 @@ start_animation (ply_boot_splash_plugin_t *plugin)
   if (plugin->is_animating)
      return;
 
+  draw_background (plugin, NULL);
+
+  plugin->start_time = ply_get_timestamp ();
+  animate_at_time (plugin, plugin->start_time);
+
+  if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
+    return;
+
   ply_event_loop_watch_for_timeout (plugin->loop, 
                                     1.0 / FRAMES_PER_SECOND,
                                     (ply_event_loop_timeout_handler_t)
                                     on_timeout, plugin);
 
-  plugin->start_time = ply_get_timestamp ();
-  draw_background (plugin, NULL);
-
   plugin->is_animating = true;
 }
 
@@ -495,7 +504,8 @@ remove_window (ply_boot_splash_plugin_t *plugin,
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_buffer_t             *boot_buffer)
+                    ply_buffer_t             *boot_buffer,
+                    ply_boot_splash_mode_t    mode)
 {
   assert (plugin != NULL);
   assert (plugin->logo_image != NULL);
@@ -503,6 +513,7 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
   add_handlers (plugin);
 
   plugin->loop = loop;
+  plugin->mode = mode;
 
   ply_trace ("loading logo image");
   if (!ply_image_load (plugin->logo_image))
index 25f7ba6bde6e7e7942c1368c6805ae15f0e911b9..6d2490e81ab565ac58236515be38e7d67e2d2085 100644 (file)
@@ -75,6 +75,7 @@ typedef enum {
 struct _ply_boot_splash_plugin
 {
   ply_event_loop_t *loop;
+  ply_boot_splash_mode_t mode;
   ply_frame_buffer_t *frame_buffer;
   ply_frame_buffer_area_t box_area, lock_area;
   ply_image_t *lock_image;
@@ -192,6 +193,12 @@ start_animation (ply_boot_splash_plugin_t *plugin)
 
   draw_background (plugin, NULL);
 
+  if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
+    {
+      begin_animation (plugin, NULL);
+      return;
+    }
+
   ply_frame_buffer_get_size (plugin->frame_buffer, &area);
 
   width = ply_progress_animation_get_width (plugin->progress_animation);
@@ -372,13 +379,15 @@ remove_window (ply_boot_splash_plugin_t *plugin,
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_buffer_t             *boot_buffer)
+                    ply_buffer_t             *boot_buffer,
+                    ply_boot_splash_mode_t    mode)
 {
   assert (plugin != NULL);
 
   add_handlers (plugin);
 
   plugin->loop = loop;
+  plugin->mode = mode;
 
   ply_trace ("loading lock image");
   if (!ply_image_load (plugin->lock_image))
index adfb71284d70e759575b67f32c9971775ac070bc..d767d78cdb5d0081404a5c5c645fb0b6730e5212 100644 (file)
@@ -60,6 +60,7 @@
 struct _ply_boot_splash_plugin
 {
   ply_event_loop_t *loop;
+  ply_boot_splash_mode_t mode;
 
   ply_window_t *window;
 
@@ -140,6 +141,9 @@ start_animation (ply_boot_splash_plugin_t *plugin)
   ply_window_clear_screen (plugin->window);
   ply_window_hide_text_cursor (plugin->window);
 
+  if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
+    return;
+
   window_width = ply_window_get_number_of_text_columns (plugin->window);
   window_height = ply_window_get_number_of_text_rows (plugin->window);
   width = ply_text_pulser_get_number_of_columns (plugin->pulser);
@@ -255,7 +259,8 @@ remove_window (ply_boot_splash_plugin_t *plugin,
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_buffer_t             *boot_buffer)
+                    ply_buffer_t             *boot_buffer,
+                    ply_boot_splash_mode_t    mode)
 {
   assert (plugin != NULL);
 
@@ -263,6 +268,7 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
   ply_show_new_kernel_messages (false);
 
   plugin->loop = loop;
+  plugin->mode = mode;
   ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
                                  detach_from_event_loop,
                                  plugin);
index 8ca3beb033c4b262cd26dd8192e7d035a86daa6c..8ce2472ffee02498eecc516987dfa0d382da6c0b 100644 (file)
@@ -161,6 +161,7 @@ typedef struct
 struct _ply_boot_splash_plugin
 {
   ply_event_loop_t *loop;
+  ply_boot_splash_mode_t mode;
   ply_frame_buffer_t *frame_buffer;
   ply_frame_buffer_area_t box_area, lock_area, logo_area;
   ply_image_t *logo_image;
@@ -918,6 +919,10 @@ start_animation (ply_boot_splash_plugin_t *plugin)
   plugin->now = ply_get_timestamp ();
   setup_solar (plugin);
   ply_window_draw_area (plugin->window, area.x, area.y, area.width, area.height);
+
+  if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
+    return;
+
   on_timeout (plugin);
 
   plugin->is_animating = true;
@@ -1370,7 +1375,8 @@ setup_solar (ply_boot_splash_plugin_t *plugin)
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_buffer_t             *boot_buffer)
+                    ply_buffer_t             *boot_buffer,
+                    ply_boot_splash_mode_t    mode)
 {
   assert (plugin != NULL);
   assert (plugin->logo_image != NULL);
@@ -1378,6 +1384,7 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
   add_handlers (plugin);
 
   plugin->loop = loop;
+  plugin->mode = mode;
 
   ply_trace ("loading logo image");
   if (!ply_image_load (plugin->logo_image))
index c900436084002c49ade1e41f2e6f511fe0c16cbd..622fa7154807c2522366a74d2d689a5e54a6ee7c 100644 (file)
@@ -75,6 +75,7 @@ typedef enum {
 struct _ply_boot_splash_plugin
 {
   ply_event_loop_t *loop;
+  ply_boot_splash_mode_t mode;
   ply_frame_buffer_t *frame_buffer;
   ply_frame_buffer_area_t box_area, lock_area, logo_area, bar_area;
   ply_image_t *logo_image;
@@ -201,6 +202,9 @@ start_animation (ply_boot_splash_plugin_t *plugin)
   draw_background (plugin, NULL);
   draw_logo (plugin);
 
+  if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
+    return;
+
   ply_frame_buffer_get_size (plugin->frame_buffer, &area);
 
   width = ply_throbber_get_width (plugin->throbber);
@@ -388,7 +392,8 @@ remove_window (ply_boot_splash_plugin_t *plugin,
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_buffer_t             *boot_buffer)
+                    ply_buffer_t             *boot_buffer,
+                    ply_boot_splash_mode_t    mode)
 {
   assert (plugin != NULL);
   assert (plugin->logo_image != NULL);
@@ -396,6 +401,7 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
   add_handlers (plugin);
 
   plugin->loop = loop;
+  plugin->mode = mode;
 
   ply_trace ("loading logo image");
   if (!ply_image_load (plugin->logo_image))
index f58474e094b978328d560e9d3f8bd3f6812dcc98..b9b7ad289bc38dd0300922ab86e1cf74f73362ee 100644 (file)
@@ -62,6 +62,7 @@
 struct _ply_boot_splash_plugin
 {
   ply_event_loop_t *loop;
+  ply_boot_splash_mode_t mode;
 
   ply_window_t *window;
 
@@ -178,6 +179,12 @@ start_animation (ply_boot_splash_plugin_t *plugin)
   ply_window_clear_screen (plugin->window);
   ply_window_hide_text_cursor (plugin->window);
 
+  if (plugin->mode == PLY_BOOT_SPLASH_MODE_SHUTDOWN)
+    {
+      ply_text_progress_bar_hide (plugin->progress_bar);
+      return;
+    }
+
   ply_text_progress_bar_show (plugin->progress_bar,
                               plugin->window);
 
@@ -288,7 +295,8 @@ remove_window (ply_boot_splash_plugin_t *plugin,
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_buffer_t             *boot_buffer)
+                    ply_buffer_t             *boot_buffer,
+                    ply_boot_splash_mode_t    mode)
 {
   assert (plugin != NULL);
 
@@ -298,6 +306,7 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
   ply_window_set_text_cursor_position (plugin->window, 0, 0);
 
   plugin->loop = loop;
+  plugin->mode = mode;
   ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
                                  detach_from_event_loop,
                                  plugin);
index a8697d8b792314d907a910ec5cb64d7ce4dabc21..9ef100a72d69e661823192a3a0b511ee3bacd8ec 100644 (file)
@@ -214,7 +214,8 @@ ply_boot_splash_attach_progress (ply_boot_splash_t *splash,
 
 
 bool
-ply_boot_splash_show (ply_boot_splash_t *splash)
+ply_boot_splash_show (ply_boot_splash_t *splash,
+                      ply_boot_splash_mode_t mode)
 {
   assert (splash != NULL);
   assert (splash->module_name != NULL);
@@ -230,7 +231,8 @@ ply_boot_splash_show (ply_boot_splash_t *splash)
   ply_trace ("showing splash screen\n");
   if (!splash->plugin_interface->show_splash_screen (splash->plugin,
                                                      splash->loop,
-                                                     splash->boot_buffer))
+                                                     splash->boot_buffer,
+                                                     mode))
     {
 
       ply_save_errno ();
index 432635780d57b078b2ff935ae1ed2cd785140bfb..04085ed14ec5b059e54a9188128bbb792f47e306 100644 (file)
@@ -46,7 +46,8 @@ void ply_boot_splash_add_window (ply_boot_splash_t *splash,
 void ply_boot_splash_remove_window (ply_boot_splash_t *splash,
                                     ply_window_t      *window);
 void ply_boot_splash_free (ply_boot_splash_t *splash);
-bool ply_boot_splash_show (ply_boot_splash_t *splash);
+bool ply_boot_splash_show (ply_boot_splash_t *splash,
+                           ply_boot_splash_mode_t mode);
 void ply_boot_splash_update_status (ply_boot_splash_t *splash,
                                     const char        *status);
 void ply_boot_splash_update_output (ply_boot_splash_t *splash,