Blame SOURCES/activate-new-renderers.patch

862bc8
From 14bdb7cadcfb2d3aac54b89b91217ef58abd8377 Mon Sep 17 00:00:00 2001
862bc8
From: Ray Strode <rstrode@redhat.com>
862bc8
Date: Thu, 24 Sep 2015 09:21:18 -0400
862bc8
Subject: [PATCH 1/6] device-manager: activate new renderers after adding to
862bc8
 renderers list
862bc8
862bc8
When a new renderer gets created, we should activate it, if the device
862bc8
manager is already active.
862bc8
862bc8
At the moment we call create_pixel_displays_for_renderer which would
862bc8
implicitly activate it (from a callback), except we call it one line
862bc8
too early, so the renderer isn't in the list of known renderers yet.
862bc8
862bc8
This commit swaps the two lines and also adds an explicit renderer
862bc8
activation for clarity.  For symmetry it makes the same change to
862bc8
keyboards that it makes to renderers.
862bc8
---
862bc8
 src/libply-splash-core/ply-device-manager.c | 20 ++++++++++++++++++--
862bc8
 1 file changed, 18 insertions(+), 2 deletions(-)
862bc8
862bc8
diff --git a/src/libply-splash-core/ply-device-manager.c b/src/libply-splash-core/ply-device-manager.c
862bc8
index f09448a..14d7616 100644
862bc8
--- a/src/libply-splash-core/ply-device-manager.c
862bc8
+++ b/src/libply-splash-core/ply-device-manager.c
862bc8
@@ -45,60 +45,62 @@ static void create_devices_for_terminal_and_renderer_type (ply_device_manager_t
862bc8
                                                            const char           *device_path,
862bc8
                                                            ply_terminal_t       *terminal,
862bc8
                                                            ply_renderer_type_t   renderer_type);
862bc8
 struct _ply_device_manager
862bc8
 {
862bc8
   ply_device_manager_flags_t  flags;
862bc8
   ply_event_loop_t           *loop;
862bc8
   ply_hashtable_t            *terminals;
862bc8
   ply_hashtable_t            *renderers;
862bc8
   ply_terminal_t             *local_console_terminal;
862bc8
   ply_list_t                 *keyboards;
862bc8
   ply_list_t                 *text_displays;
862bc8
   ply_list_t                 *pixel_displays;
862bc8
   struct udev                *udev_context;
862bc8
   struct udev_queue          *udev_queue;
862bc8
   int                         udev_queue_fd;
862bc8
   ply_fd_watch_t             *udev_queue_fd_watch;
862bc8
   struct udev_monitor        *udev_monitor;
862bc8
 
862bc8
   ply_keyboard_added_handler_t         keyboard_added_handler;
862bc8
   ply_keyboard_removed_handler_t       keyboard_removed_handler;
862bc8
   ply_pixel_display_added_handler_t    pixel_display_added_handler;
862bc8
   ply_pixel_display_removed_handler_t  pixel_display_removed_handler;
862bc8
   ply_text_display_added_handler_t     text_display_added_handler;
862bc8
   ply_text_display_removed_handler_t   text_display_removed_handler;
862bc8
   void                                *event_handler_data;
862bc8
 
862bc8
   uint32_t                    local_console_managed : 1;
862bc8
   uint32_t                    local_console_is_text : 1;
862bc8
   uint32_t                    serial_consoles_detected : 1;
862bc8
+  uint32_t                    renderers_activated : 1;
862bc8
+  uint32_t                    keyboards_activated : 1;
862bc8
 };
862bc8
 
862bc8
 static void
862bc8
 detach_from_event_loop (ply_device_manager_t *manager)
862bc8
 {
862bc8
   assert (manager != NULL);
862bc8
 
862bc8
   manager->loop = NULL;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 attach_to_event_loop (ply_device_manager_t *manager,
862bc8
                       ply_event_loop_t     *loop)
862bc8
 {
862bc8
   assert (manager != NULL);
862bc8
   assert (loop != NULL);
862bc8
   assert (manager->loop == NULL);
862bc8
 
862bc8
   manager->loop = loop;
862bc8
 
862bc8
   ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
862bc8
                                  detach_from_event_loop,
862bc8
                                  manager);
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 drm_device_in_use (ply_device_manager_t *manager,
862bc8
                    const char           *device_path)
862bc8
 {
862bc8
   ply_renderer_t *renderer;
862bc8
@@ -696,85 +698,92 @@ create_devices_for_terminal_and_renderer_type (ply_device_manager_t *manager,
862bc8
       ply_trace ("ignoring device %s since it's already managed",
862bc8
                  device_path);
862bc8
       return;
862bc8
     }
862bc8
 
862bc8
   ply_trace ("creating devices for %s (renderer type: %u) (terminal: %s)",
862bc8
              device_path? : "", renderer_type, terminal? ply_terminal_get_name (terminal): "none");
862bc8
 
862bc8
   if (renderer_type != PLY_RENDERER_TYPE_NONE)
862bc8
     {
862bc8
       renderer = ply_renderer_new (renderer_type, device_path, terminal);
862bc8
 
862bc8
       if (!ply_renderer_open (renderer))
862bc8
         {
862bc8
           ply_trace ("could not open renderer for %s", device_path);
862bc8
           ply_renderer_free (renderer);
862bc8
           renderer = NULL;
862bc8
           if (renderer_type != PLY_RENDERER_TYPE_AUTO)
862bc8
             return;
862bc8
         }
862bc8
     }
862bc8
 
862bc8
   if (renderer != NULL)
862bc8
     {
862bc8
       keyboard = ply_keyboard_new_for_renderer (renderer);
862bc8
       ply_list_append_data (manager->keyboards, keyboard);
862bc8
 
862bc8
       if (manager->keyboard_added_handler != NULL)
862bc8
         manager->keyboard_added_handler (manager->event_handler_data, keyboard);
862bc8
 
862bc8
-      create_pixel_displays_for_renderer (manager, renderer);
862bc8
       ply_hashtable_insert (manager->renderers, strdup (device_path), renderer);
862bc8
+      create_pixel_displays_for_renderer (manager, renderer);
862bc8
+
862bc8
+      if (manager->renderers_activated)
862bc8
+        {
862bc8
+          ply_trace ("activating renderer");
862bc8
+          ply_renderer_activate (renderer);
862bc8
+        }
862bc8
     }
862bc8
   else if (terminal != NULL)
862bc8
     {
862bc8
       keyboard = ply_keyboard_new_for_terminal (terminal);
862bc8
       ply_list_append_data (manager->keyboards, keyboard);
862bc8
 
862bc8
       if (manager->keyboard_added_handler != NULL)
862bc8
         manager->keyboard_added_handler (manager->event_handler_data, keyboard);
862bc8
     }
862bc8
 
862bc8
   if (terminal != NULL)
862bc8
     {
862bc8
       create_text_displays_for_terminal (manager, terminal);
862bc8
 
862bc8
       if (terminal == manager->local_console_terminal)
862bc8
         {
862bc8
           manager->local_console_is_text = renderer == NULL;
862bc8
           manager->local_console_managed = true;
862bc8
         }
862bc8
     }
862bc8
 
862bc8
-  if (keyboard != NULL)
862bc8
+  if (keyboard != NULL && manager->keyboards_activated)
862bc8
     {
862bc8
+      ply_trace ("activating keyboards");
862bc8
       ply_keyboard_watch_for_input (keyboard);
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 create_devices_for_terminal (const char           *device_path,
862bc8
                              ply_terminal_t       *terminal,
862bc8
                              ply_device_manager_t *manager)
862bc8
 {
862bc8
   create_devices_for_terminal_and_renderer_type (manager,
862bc8
                                                  device_path,
862bc8
                                                  terminal,
862bc8
                                                  PLY_RENDERER_TYPE_NONE);
862bc8
 }
862bc8
 static bool
862bc8
 create_devices_from_terminals (ply_device_manager_t *manager)
862bc8
 {
862bc8
   bool has_serial_consoles;
862bc8
 
862bc8
   ply_trace ("checking for consoles");
862bc8
 
862bc8
   if (manager->flags & PLY_DEVICE_MANAGER_FLAGS_IGNORE_SERIAL_CONSOLES)
862bc8
     {
862bc8
       has_serial_consoles = false;
862bc8
       ply_trace ("ignoring all consoles but default console because explicitly told to.");
862bc8
     }
862bc8
   else
862bc8
     {
862bc8
       has_serial_consoles = add_consoles_from_file (manager, "/sys/class/tty/console/active");
862bc8
     }
862bc8
@@ -946,91 +955,98 @@ ply_device_manager_get_text_displays (ply_device_manager_t *manager)
862bc8
 }
862bc8
 
862bc8
 ply_terminal_t *
862bc8
 ply_device_manager_get_default_terminal (ply_device_manager_t *manager)
862bc8
 {
862bc8
   return manager->local_console_terminal;
862bc8
 }
862bc8
 
862bc8
 bool
862bc8
 ply_device_manager_has_serial_consoles (ply_device_manager_t *manager)
862bc8
 {
862bc8
   return manager->serial_consoles_detected;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 activate_renderer (char                 *device_path,
862bc8
                    ply_renderer_t       *renderer,
862bc8
                    ply_device_manager_t *manager)
862bc8
 {
862bc8
   ply_renderer_activate (renderer);
862bc8
 }
862bc8
 
862bc8
 void
862bc8
 ply_device_manager_activate_renderers (ply_device_manager_t *manager)
862bc8
 {
862bc8
   ply_trace ("activating renderers");
862bc8
   ply_hashtable_foreach (manager->renderers,
862bc8
                          (ply_hashtable_foreach_func_t *)
862bc8
                          activate_renderer,
862bc8
                          manager);
862bc8
+
862bc8
+  manager->renderers_activated = true;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 deactivate_renderer (char                 *device_path,
862bc8
                      ply_renderer_t       *renderer,
862bc8
                      ply_device_manager_t *manager)
862bc8
 {
862bc8
   ply_renderer_deactivate (renderer);
862bc8
 }
862bc8
 
862bc8
 void
862bc8
 ply_device_manager_deactivate_renderers (ply_device_manager_t *manager)
862bc8
 {
862bc8
   ply_trace ("deactivating renderers");
862bc8
   ply_hashtable_foreach (manager->renderers,
862bc8
                          (ply_hashtable_foreach_func_t *)
862bc8
                          deactivate_renderer,
862bc8
                          manager);
862bc8
+  manager->renderers_activated = false;
862bc8
 }
862bc8
 
862bc8
 void
862bc8
 ply_device_manager_activate_keyboards (ply_device_manager_t *manager)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   ply_trace ("activating keyboards");
862bc8
   node = ply_list_get_first_node (manager->keyboards);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_keyboard_t *keyboard;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       keyboard = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (manager->keyboards, node);
862bc8
 
862bc8
       ply_keyboard_watch_for_input (keyboard);
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
+
862bc8
+  manager->keyboards_activated = true;
862bc8
 }
862bc8
 
862bc8
 void
862bc8
 ply_device_manager_deactivate_keyboards (ply_device_manager_t *manager)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   ply_trace ("deactivating keyboards");
862bc8
   node = ply_list_get_first_node (manager->keyboards);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_keyboard_t *keyboard;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       keyboard = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (manager->keyboards, node);
862bc8
 
862bc8
       ply_keyboard_stop_watching_for_input (keyboard);
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
+
862bc8
+  manager->keyboards_activated = false;
862bc8
 }
862bc8
-- 
862bc8
2.5.0
862bc8
862bc8
862bc8
From 61ca85cd95de1e467e4996a5563c5f77221e569f Mon Sep 17 00:00:00 2001
862bc8
From: Ray Strode <rstrode@redhat.com>
862bc8
Date: Thu, 24 Sep 2015 15:53:01 -0400
862bc8
Subject: [PATCH 2/6] plugins: unset draw handler when freeing view
862bc8
862bc8
If the view is freed, we definitely shouldn't draw
862bc8
the view's display anymore.
862bc8
---
862bc8
 src/plugins/splash/fade-throbber/plugin.c | 4 ++--
862bc8
 src/plugins/splash/space-flares/plugin.c  | 4 ++--
862bc8
 src/plugins/splash/throbgress/plugin.c    | 4 ++--
862bc8
 src/plugins/splash/two-step/plugin.c      | 3 ++-
862bc8
 4 files changed, 8 insertions(+), 7 deletions(-)
862bc8
862bc8
diff --git a/src/plugins/splash/fade-throbber/plugin.c b/src/plugins/splash/fade-throbber/plugin.c
862bc8
index 4af6cae..7b097c0 100644
862bc8
--- a/src/plugins/splash/fade-throbber/plugin.c
862bc8
+++ b/src/plugins/splash/fade-throbber/plugin.c
862bc8
@@ -240,60 +240,62 @@ free_stars (view_t *view)
862bc8
 
862bc8
 static void detach_from_event_loop (ply_boot_splash_plugin_t *plugin);
862bc8
 
862bc8
 static view_t *
862bc8
 view_new (ply_boot_splash_plugin_t *plugin,
862bc8
           ply_pixel_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   view = calloc (1, sizeof (view_t));
862bc8
   view->plugin = plugin;
862bc8
   view->display = display;
862bc8
 
862bc8
   view->entry = ply_entry_new (plugin->image_dir);
862bc8
   view->stars = ply_list_new ();
862bc8
   view->label = ply_label_new ();
862bc8
 
862bc8
   view->message_label = ply_label_new ();
862bc8
 
862bc8
   return view;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_free (view_t *view)
862bc8
 {
862bc8
 
862bc8
   ply_entry_free (view->entry);
862bc8
   ply_label_free (view->message_label);
862bc8
   free_stars (view);
862bc8
 
862bc8
+  ply_pixel_display_set_draw_handler (view->display, NULL, NULL);
862bc8
+
862bc8
   free (view);
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 view_load (view_t *view)
862bc8
 {
862bc8
   ply_trace ("loading entry");
862bc8
   if (!ply_entry_load (view->entry))
862bc8
     return false;
862bc8
 
862bc8
   return true;
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 load_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
   bool view_loaded;
862bc8
 
862bc8
   view_loaded = false;
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
 
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
@@ -753,62 +755,60 @@ add_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                    ply_pixel_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   ply_pixel_display_set_draw_handler (view->display,
862bc8
                                       (ply_pixel_display_draw_handler_t)
862bc8
                                       on_draw, view);
862bc8
 
862bc8
   ply_list_append_data (plugin->views, view);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                       ply_pixel_display_t      *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
-
862bc8
-          ply_pixel_display_set_draw_handler (view->display, NULL, NULL);
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
862bc8
                     ply_event_loop_t         *loop,
862bc8
                     ply_buffer_t             *boot_buffer,
862bc8
                     ply_boot_splash_mode_t    mode)
862bc8
 {
862bc8
   assert (plugin != NULL);
862bc8
   assert (plugin->logo_image != NULL);
862bc8
 
862bc8
   plugin->loop = loop;
862bc8
   plugin->mode = mode;
862bc8
 
862bc8
   ply_trace ("loading logo image");
862bc8
   if (!ply_image_load (plugin->logo_image))
862bc8
     return false;
862bc8
 
862bc8
   ply_trace ("loading star image");
862bc8
   if (!ply_image_load (plugin->star_image))
862bc8
     return false;
862bc8
 
862bc8
   ply_trace ("loading lock image");
862bc8
diff --git a/src/plugins/splash/space-flares/plugin.c b/src/plugins/splash/space-flares/plugin.c
862bc8
index e31dce8..45863ff 100644
862bc8
--- a/src/plugins/splash/space-flares/plugin.c
862bc8
+++ b/src/plugins/splash/space-flares/plugin.c
862bc8
@@ -210,60 +210,62 @@ static view_t *
862bc8
 view_new (ply_boot_splash_plugin_t *plugin,
862bc8
           ply_pixel_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   view = calloc (1, sizeof (view_t));
862bc8
   view->plugin = plugin;
862bc8
   view->display = display;
862bc8
 
862bc8
   view->entry = ply_entry_new (plugin->image_dir);
862bc8
   view->label = ply_label_new ();
862bc8
   view->message_label = ply_label_new ();
862bc8
 
862bc8
   view->sprites = ply_list_new ();
862bc8
 
862bc8
   return view;
862bc8
 }
862bc8
 
862bc8
 static void view_free_sprites (view_t *view);
862bc8
 
862bc8
 static void
862bc8
 view_free (view_t *view)
862bc8
 {
862bc8
 
862bc8
   ply_entry_free (view->entry);
862bc8
   ply_label_free (view->label);
862bc8
   ply_label_free (view->message_label);
862bc8
   view_free_sprites (view);
862bc8
   ply_list_free (view->sprites);
862bc8
 
862bc8
+  ply_pixel_display_set_draw_handler (view->display, NULL, NULL);
862bc8
+
862bc8
   ply_image_free (view->scaled_background_image);
862bc8
 
862bc8
   free (view);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 free_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       view_free (view);
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 
862bc8
   ply_list_free (plugin->views);
862bc8
   plugin->views = NULL;
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 view_load (view_t *view)
862bc8
@@ -1428,62 +1430,60 @@ add_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                    ply_pixel_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   ply_pixel_display_set_draw_handler (view->display,
862bc8
                                       (ply_pixel_display_draw_handler_t)
862bc8
                                       on_draw, view);
862bc8
 
862bc8
   ply_list_append_data (plugin->views, view);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                       ply_pixel_display_t      *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
-
862bc8
-          ply_pixel_display_set_draw_handler (view->display, NULL, NULL);
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_setup_scene (view_t *view)
862bc8
 {
862bc8
   ply_boot_splash_plugin_t *plugin;
862bc8
   sprite_t *sprite;
862bc8
   int i;
862bc8
   int x, y;
862bc8
   int width = 360;
862bc8
   int height = 460;
862bc8
   unsigned long screen_width, screen_height;
862bc8
 
862bc8
   plugin = view->plugin;
862bc8
 
862bc8
   screen_width = ply_pixel_display_get_width (view->display);
862bc8
   screen_height = ply_pixel_display_get_height (view->display);
862bc8
 
862bc8
     {
862bc8
       star_bg_t* star_bg;
862bc8
       if (view->scaled_background_image)
862bc8
         ply_image_free (view->scaled_background_image);
862bc8
       view->scaled_background_image = ply_image_resize (plugin->logo_image, screen_width, screen_height);
862bc8
diff --git a/src/plugins/splash/throbgress/plugin.c b/src/plugins/splash/throbgress/plugin.c
862bc8
index fba809b..d669a74 100644
862bc8
--- a/src/plugins/splash/throbgress/plugin.c
862bc8
+++ b/src/plugins/splash/throbgress/plugin.c
862bc8
@@ -115,60 +115,62 @@ static void become_idle (ply_boot_splash_plugin_t *plugin,
862bc8
 static view_t *
862bc8
 view_new (ply_boot_splash_plugin_t *plugin,
862bc8
           ply_pixel_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   view = calloc (1, sizeof (view_t));
862bc8
   view->plugin = plugin;
862bc8
   view->display = display;
862bc8
 
862bc8
   view->entry = ply_entry_new (plugin->image_dir);
862bc8
   view->throbber = ply_throbber_new (plugin->image_dir,
862bc8
                                      "throbber-");
862bc8
   view->progress_bar = ply_progress_bar_new ();
862bc8
   view->label = ply_label_new ();
862bc8
   view->message_label = ply_label_new ();
862bc8
 
862bc8
   return view;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_free (view_t *view)
862bc8
 {
862bc8
 
862bc8
   ply_entry_free (view->entry);
862bc8
   ply_throbber_free (view->throbber);
862bc8
   ply_progress_bar_free (view->progress_bar);
862bc8
   ply_label_free (view->label);
862bc8
   ply_label_free (view->message_label);
862bc8
 
862bc8
+  ply_pixel_display_set_draw_handler (view->display, NULL, NULL);
862bc8
+
862bc8
   free (view);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 free_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
 
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       view_free (view);
862bc8
       ply_list_remove_node (plugin->views, node);
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 
862bc8
   ply_list_free (plugin->views);
862bc8
   plugin->views = NULL;
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 view_load (view_t *view)
862bc8
@@ -631,62 +633,60 @@ add_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
   view_t *view;
862bc8
 
862bc8
   ply_trace ("adding pixel display to plugin");
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   ply_pixel_display_set_draw_handler (view->display,
862bc8
                                       (ply_pixel_display_draw_handler_t)
862bc8
                                       on_draw, view);
862bc8
 
862bc8
   ply_list_append_data (plugin->views, view);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                       ply_pixel_display_t      *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   ply_trace ("removing pixel display from plugin");
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
-
862bc8
-          ply_pixel_display_set_draw_handler (view->display, NULL, NULL);
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
862bc8
                     ply_event_loop_t         *loop,
862bc8
                     ply_buffer_t             *boot_buffer,
862bc8
                     ply_boot_splash_mode_t    mode)
862bc8
 {
862bc8
   assert (plugin != NULL);
862bc8
   assert (plugin->logo_image != NULL);
862bc8
 
862bc8
   plugin->loop = loop;
862bc8
   plugin->mode = mode;
862bc8
 
862bc8
   ply_trace ("loading logo image");
862bc8
   if (!ply_image_load (plugin->logo_image))
862bc8
     return false;
862bc8
 
862bc8
   ply_trace ("loading lock image");
862bc8
   if (!ply_image_load (plugin->lock_image))
862bc8
     return false;
862bc8
 
862bc8
   ply_trace ("loading box image");
862bc8
diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c
862bc8
index f48b41e..0253aac 100644
862bc8
--- a/src/plugins/splash/two-step/plugin.c
862bc8
+++ b/src/plugins/splash/two-step/plugin.c
862bc8
@@ -155,60 +155,62 @@ view_new (ply_boot_splash_plugin_t *plugin,
862bc8
 
862bc8
   view->entry = ply_entry_new (plugin->animation_dir);
862bc8
   view->end_animation = ply_animation_new (plugin->animation_dir,
862bc8
                                            "animation-");
862bc8
   view->progress_animation = ply_progress_animation_new (plugin->animation_dir,
862bc8
                                                          "progress-");
862bc8
 
862bc8
   view->throbber = ply_throbber_new (plugin->animation_dir,
862bc8
                                      "throbber-");
862bc8
   ply_progress_animation_set_transition (view->progress_animation,
862bc8
                                          plugin->transition,
862bc8
                                          plugin->transition_duration);
862bc8
 
862bc8
   view->label = ply_label_new ();
862bc8
   view->message_label = ply_label_new ();
862bc8
 
862bc8
   return view;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_free (view_t *view)
862bc8
 {
862bc8
 
862bc8
   ply_entry_free (view->entry);
862bc8
   ply_animation_free (view->end_animation);
862bc8
   ply_progress_animation_free (view->progress_animation);
862bc8
   ply_throbber_free (view->throbber);
862bc8
   ply_label_free (view->label);
862bc8
   ply_label_free (view->message_label);
862bc8
 
862bc8
+  ply_pixel_display_set_draw_handler (view->display, NULL, NULL);
862bc8
+
862bc8
   if (view->background_image != NULL)
862bc8
     ply_image_free (view->background_image);
862bc8
 
862bc8
   free (view);
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 view_load (view_t *view)
862bc8
 {
862bc8
   unsigned long screen_width, screen_height;
862bc8
   ply_boot_splash_plugin_t *plugin;
862bc8
 
862bc8
   plugin = view->plugin;
862bc8
 
862bc8
   screen_width = ply_pixel_display_get_width (view->display);
862bc8
   screen_height = ply_pixel_display_get_height (view->display);
862bc8
 
862bc8
   if (plugin->background_tile_image != NULL)
862bc8
     {
862bc8
       ply_trace ("tiling background to %lux%lu", screen_width, screen_height);
862bc8
       view->background_image = ply_image_tile (plugin->background_tile_image, screen_width, screen_height);
862bc8
     }
862bc8
 
862bc8
   if (plugin->watermark_image != NULL)
862bc8
     {
862bc8
       view->watermark_area.width = ply_image_get_width (plugin->watermark_image);
862bc8
       view->watermark_area.height = ply_image_get_height (plugin->watermark_image);
862bc8
       view->watermark_area.x = screen_width * plugin->watermark_horizontal_alignment - ply_image_get_width (plugin->watermark_image) * plugin->watermark_horizontal_alignment;
862bc8
       view->watermark_area.y = screen_height * plugin->watermark_vertical_alignment - ply_image_get_height (plugin->watermark_image) * plugin->watermark_vertical_alignment;
862bc8
     }
862bc8
@@ -993,61 +995,60 @@ add_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
   view_t *view;
862bc8
 
862bc8
   ply_trace ("adding pixel display to plugin");
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   ply_pixel_display_set_draw_handler (view->display,
862bc8
                                       (ply_pixel_display_draw_handler_t)
862bc8
                                       on_draw, view);
862bc8
   ply_list_append_data (plugin->views, view);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                       ply_pixel_display_t      *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   ply_trace ("removing pixel display from plugin");
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
 
862bc8
-          ply_pixel_display_set_draw_handler (view->display, NULL, NULL);
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
862bc8
                     ply_event_loop_t         *loop,
862bc8
                     ply_buffer_t             *boot_buffer,
862bc8
                     ply_boot_splash_mode_t    mode)
862bc8
 {
862bc8
   assert (plugin != NULL);
862bc8
 
862bc8
   plugin->loop = loop;
862bc8
   plugin->mode = mode;
862bc8
 
862bc8
   ply_trace ("loading lock image");
862bc8
   if (!ply_image_load (plugin->lock_image))
862bc8
     return false;
862bc8
 
862bc8
   ply_trace ("loading box image");
862bc8
   if (!ply_image_load (plugin->box_image))
862bc8
     return false;
862bc8
 
862bc8
   if (plugin->corner_image != NULL)
862bc8
     {
862bc8
-- 
862bc8
2.5.0
862bc8
862bc8
862bc8
From b849b3edc60cac8d1c1f7a66d103768abdb71666 Mon Sep 17 00:00:00 2001
862bc8
From: Ray Strode <rstrode@redhat.com>
862bc8
Date: Thu, 24 Sep 2015 15:55:08 -0400
862bc8
Subject: [PATCH 3/6] plugins: free views that can't load
862bc8
862bc8
Trying to use an unloaded view can lead to crashes.
862bc8
If a view can't be loaded, free it right away.
862bc8
---
862bc8
 src/plugins/splash/fade-throbber/plugin.c | 9 ++++++++-
862bc8
 src/plugins/splash/space-flares/plugin.c  | 9 ++++++++-
862bc8
 src/plugins/splash/throbgress/plugin.c    | 9 ++++++++-
862bc8
 src/plugins/splash/two-step/plugin.c      | 9 ++++++++-
862bc8
 4 files changed, 32 insertions(+), 4 deletions(-)
862bc8
862bc8
diff --git a/src/plugins/splash/fade-throbber/plugin.c b/src/plugins/splash/fade-throbber/plugin.c
862bc8
index 7b097c0..953186d 100644
862bc8
--- a/src/plugins/splash/fade-throbber/plugin.c
862bc8
+++ b/src/plugins/splash/fade-throbber/plugin.c
862bc8
@@ -273,61 +273,68 @@ view_free (view_t *view)
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 view_load (view_t *view)
862bc8
 {
862bc8
   ply_trace ("loading entry");
862bc8
   if (!ply_entry_load (view->entry))
862bc8
     return false;
862bc8
 
862bc8
   return true;
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 load_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
   bool view_loaded;
862bc8
 
862bc8
   view_loaded = false;
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
 
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view_load (view))
862bc8
-        view_loaded = true;
862bc8
+        {
862bc8
+          view_loaded = true;
862bc8
+        }
862bc8
+      else
862bc8
+        {
862bc8
+          ply_list_remove_node (plugin->views, node);
862bc8
+          view_free (view);
862bc8
+        }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 
862bc8
   return view_loaded;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_redraw (view_t *view)
862bc8
 {
862bc8
   unsigned long screen_width, screen_height;
862bc8
 
862bc8
   screen_width = ply_pixel_display_get_width (view->display);
862bc8
   screen_height = ply_pixel_display_get_height (view->display);
862bc8
 
862bc8
   ply_pixel_display_draw_area (view->display, 0, 0,
862bc8
                                screen_width, screen_height);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 redraw_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
diff --git a/src/plugins/splash/space-flares/plugin.c b/src/plugins/splash/space-flares/plugin.c
862bc8
index 45863ff..b18f39f 100644
862bc8
--- a/src/plugins/splash/space-flares/plugin.c
862bc8
+++ b/src/plugins/splash/space-flares/plugin.c
862bc8
@@ -268,61 +268,68 @@ free_views (ply_boot_splash_plugin_t *plugin)
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 view_load (view_t *view)
862bc8
 {
862bc8
   ply_trace ("loading entry");
862bc8
   if (!ply_entry_load (view->entry))
862bc8
     return false;
862bc8
 
862bc8
   return true;
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 load_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
   bool view_loaded;
862bc8
 
862bc8
   view_loaded = false;
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
 
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view_load (view))
862bc8
-        view_loaded = true;
862bc8
+        {
862bc8
+          view_loaded = true;
862bc8
+        }
862bc8
+      else
862bc8
+        {
862bc8
+          ply_list_remove_node (plugin->views, node);
862bc8
+          view_free (view);
862bc8
+        }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 
862bc8
   return view_loaded;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_redraw (view_t *view)
862bc8
 {
862bc8
   unsigned long screen_width, screen_height;
862bc8
 
862bc8
   screen_width = ply_pixel_display_get_width (view->display);
862bc8
   screen_height = ply_pixel_display_get_height (view->display);
862bc8
 
862bc8
   ply_pixel_display_draw_area (view->display, 0, 0,
862bc8
                                screen_width, screen_height);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 redraw_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
diff --git a/src/plugins/splash/throbgress/plugin.c b/src/plugins/splash/throbgress/plugin.c
862bc8
index d669a74..e3ce91b 100644
862bc8
--- a/src/plugins/splash/throbgress/plugin.c
862bc8
+++ b/src/plugins/splash/throbgress/plugin.c
862bc8
@@ -177,61 +177,68 @@ view_load (view_t *view)
862bc8
 {
862bc8
   ply_trace ("loading entry");
862bc8
   if (!ply_entry_load (view->entry))
862bc8
     return false;
862bc8
 
862bc8
   ply_trace ("loading throbber");
862bc8
   if (!ply_throbber_load (view->throbber))
862bc8
     return false;
862bc8
 
862bc8
   return true;
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 load_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
   bool view_loaded;
862bc8
 
862bc8
   view_loaded = false;
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
 
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view_load (view))
862bc8
-        view_loaded = true;
862bc8
+        {
862bc8
+          view_loaded = true;
862bc8
+        }
862bc8
+      else
862bc8
+        {
862bc8
+          ply_list_remove_node (plugin->views, node);
862bc8
+          view_free (view);
862bc8
+        }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 
862bc8
   return view_loaded;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_redraw (view_t *view)
862bc8
 {
862bc8
   unsigned long screen_width, screen_height;
862bc8
 
862bc8
   screen_width = ply_pixel_display_get_width (view->display);
862bc8
   screen_height = ply_pixel_display_get_height (view->display);
862bc8
 
862bc8
   ply_pixel_display_draw_area (view->display, 0, 0,
862bc8
                                screen_width, screen_height);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 redraw_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c
862bc8
index 0253aac..4612e3f 100644
862bc8
--- a/src/plugins/splash/two-step/plugin.c
862bc8
+++ b/src/plugins/splash/two-step/plugin.c
862bc8
@@ -257,61 +257,68 @@ view_load (view_t *view)
862bc8
           ply_throbber_free (view->throbber);
862bc8
           view->throbber = NULL;
862bc8
         }
862bc8
     }
862bc8
   else
862bc8
     {
862bc8
       ply_trace ("this theme has no throbber\n");
862bc8
     }
862bc8
 
862bc8
   return true;
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 load_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
   bool view_loaded;
862bc8
 
862bc8
   view_loaded = false;
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
 
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view_load (view))
862bc8
-        view_loaded = true;
862bc8
+        {
862bc8
+          view_loaded = true;
862bc8
+        }
862bc8
+      else
862bc8
+        {
862bc8
+          ply_list_remove_node (plugin->views, node);
862bc8
+          view_free (view);
862bc8
+        }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 
862bc8
   return view_loaded;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_redraw (view_t *view)
862bc8
 {
862bc8
   unsigned long screen_width, screen_height;
862bc8
 
862bc8
   screen_width = ply_pixel_display_get_width (view->display);
862bc8
   screen_height = ply_pixel_display_get_height (view->display);
862bc8
 
862bc8
   ply_pixel_display_draw_area (view->display, 0, 0,
862bc8
                                screen_width, screen_height);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 redraw_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
-- 
862bc8
2.5.0
862bc8
862bc8
862bc8
From a790e8d26d81b978ed2d90a5730c717af9dc673b Mon Sep 17 00:00:00 2001
862bc8
From: Ray Strode <rstrode@redhat.com>
862bc8
Date: Thu, 24 Sep 2015 15:57:59 -0400
862bc8
Subject: [PATCH 4/6] plugins: load view of hot plugged displays immediately
862bc8
862bc8
If we're already chugging along, and a new display
862bc8
gets added make sure to load the view associated with
862bc8
that display right away.
862bc8
862bc8
Using an unloaded view can lead to crashes.
862bc8
---
862bc8
 src/plugins/splash/fade-throbber/plugin.c | 18 ++++++++++++++++--
862bc8
 src/plugins/splash/space-flares/plugin.c  | 13 +++++++++++--
862bc8
 src/plugins/splash/text/plugin.c          |  3 +++
862bc8
 src/plugins/splash/throbgress/plugin.c    | 13 +++++++++++--
862bc8
 src/plugins/splash/tribar/plugin.c        |  7 ++++++-
862bc8
 src/plugins/splash/two-step/plugin.c      | 12 +++++++++++-
862bc8
 6 files changed, 58 insertions(+), 8 deletions(-)
862bc8
862bc8
diff --git a/src/plugins/splash/fade-throbber/plugin.c b/src/plugins/splash/fade-throbber/plugin.c
862bc8
index 953186d..946a732 100644
862bc8
--- a/src/plugins/splash/fade-throbber/plugin.c
862bc8
+++ b/src/plugins/splash/fade-throbber/plugin.c
862bc8
@@ -76,60 +76,61 @@ typedef struct
862bc8
 } star_t;
862bc8
 
862bc8
 typedef struct
862bc8
 {
862bc8
   ply_boot_splash_plugin_t *plugin;
862bc8
   ply_pixel_display_t *display;
862bc8
   ply_list_t *stars;
862bc8
   ply_entry_t *entry;
862bc8
   ply_label_t *label;
862bc8
   ply_label_t *message_label;
862bc8
   ply_rectangle_t lock_area;
862bc8
   double logo_opacity;
862bc8
 } view_t;
862bc8
 
862bc8
 struct _ply_boot_splash_plugin
862bc8
 {
862bc8
   ply_event_loop_t *loop;
862bc8
   ply_boot_splash_mode_t mode;
862bc8
   ply_image_t *logo_image;
862bc8
   ply_image_t *star_image;
862bc8
   ply_image_t *lock_image;
862bc8
   char *image_dir;
862bc8
   ply_list_t *views;
862bc8
 
862bc8
   ply_boot_splash_display_type_t state;
862bc8
 
862bc8
   double start_time;
862bc8
   double now;
862bc8
 
862bc8
   uint32_t is_animating : 1;
862bc8
+  uint32_t is_visible : 1;
862bc8
 };
862bc8
 
862bc8
 ply_boot_splash_plugin_interface_t *ply_boot_splash_plugin_get_interface (void);
862bc8
 
862bc8
 static void
862bc8
 view_show_prompt (view_t     *view,
862bc8
                   const char *prompt)
862bc8
 {
862bc8
   ply_boot_splash_plugin_t *plugin;
862bc8
   int x, y;
862bc8
   int entry_width, entry_height;
862bc8
 
862bc8
   assert (view != NULL);
862bc8
 
862bc8
   plugin = view->plugin;
862bc8
 
862bc8
   if (ply_entry_is_hidden (view->entry))
862bc8
     {
862bc8
       unsigned long screen_width, screen_height;
862bc8
 
862bc8
       screen_width = ply_pixel_display_get_width (view->display);
862bc8
       screen_height = ply_pixel_display_get_height (view->display);
862bc8
 
862bc8
       view->lock_area.width = ply_image_get_width (plugin->lock_image);
862bc8
       view->lock_area.height = ply_image_get_height (plugin->lock_image);
862bc8
 
862bc8
       entry_width = ply_entry_get_width (view->entry);
862bc8
       entry_height = ply_entry_get_height (view->entry);
862bc8
 
862bc8
       x = screen_width / 2.0 - (view->lock_area.width + entry_width) / 2.0 + view->lock_area.width;
862bc8
@@ -741,62 +742,71 @@ on_draw (view_t                   *view,
862bc8
          int                       width,
862bc8
          int                       height)
862bc8
 {
862bc8
   ply_boot_splash_plugin_t *plugin;
862bc8
 
862bc8
   plugin = view->plugin;
862bc8
 
862bc8
   draw_background (view, pixel_buffer, x, y, width, height);
862bc8
 
862bc8
   if (plugin->state == PLY_BOOT_SPLASH_DISPLAY_NORMAL)
862bc8
     draw_normal_view (view, pixel_buffer, x, y, width, height);
862bc8
   else
862bc8
     draw_prompt_view (view, pixel_buffer, x, y, width, height);
862bc8
 
862bc8
   ply_label_draw_area (view->message_label,
862bc8
                        pixel_buffer,
862bc8
                        x, y, width, height);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 add_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                    ply_pixel_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   ply_pixel_display_set_draw_handler (view->display,
862bc8
                                       (ply_pixel_display_draw_handler_t)
862bc8
                                       on_draw, view);
862bc8
-
862bc8
-  ply_list_append_data (plugin->views, view);
862bc8
+  if (plugin->is_visible)
862bc8
+    {
862bc8
+      if (view_load (view))
862bc8
+        ply_list_append_data (plugin->views, view);
862bc8
+      else
862bc8
+        view_free (view);
862bc8
+    }
862bc8
+  else
862bc8
+    {
862bc8
+      ply_list_append_data (plugin->views, view);
862bc8
+    }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                       ply_pixel_display_t      *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
862bc8
@@ -805,60 +815,62 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
862bc8
                     ply_boot_splash_mode_t    mode)
862bc8
 {
862bc8
   assert (plugin != NULL);
862bc8
   assert (plugin->logo_image != NULL);
862bc8
 
862bc8
   plugin->loop = loop;
862bc8
   plugin->mode = mode;
862bc8
 
862bc8
   ply_trace ("loading logo image");
862bc8
   if (!ply_image_load (plugin->logo_image))
862bc8
     return false;
862bc8
 
862bc8
   ply_trace ("loading star image");
862bc8
   if (!ply_image_load (plugin->star_image))
862bc8
     return false;
862bc8
 
862bc8
   ply_trace ("loading lock image");
862bc8
   if (!ply_image_load (plugin->lock_image))
862bc8
     return false;
862bc8
 
862bc8
   ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
862bc8
                                  detach_from_event_loop,
862bc8
                                  plugin);
862bc8
 
862bc8
   if (!load_views (plugin))
862bc8
     {
862bc8
       ply_trace ("couldn't load views");
862bc8
       return false;
862bc8
     }
862bc8
 
862bc8
+  plugin->is_visible = true;
862bc8
+
862bc8
   ply_trace ("starting boot animation");
862bc8
   start_animation (plugin);
862bc8
 
862bc8
   return true;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_add_star (view_t *view)
862bc8
 {
862bc8
   ply_boot_splash_plugin_t *plugin;
862bc8
   ply_rectangle_t logo_area;
862bc8
   star_t *star;
862bc8
   unsigned int x, y;
862bc8
   unsigned int width, height;
862bc8
   unsigned long screen_width, screen_height;
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   assert (view != NULL);
862bc8
 
862bc8
   plugin = view->plugin;
862bc8
 
862bc8
   screen_width = ply_pixel_display_get_width (view->display);
862bc8
   screen_height = ply_pixel_display_get_height (view->display);
862bc8
   width = ply_image_get_width (plugin->logo_image);
862bc8
   height = ply_image_get_height (plugin->logo_image);
862bc8
   logo_area.x = (screen_width / 2) - (width / 2);
862bc8
   logo_area.y = (screen_height / 2) - (height / 2);
862bc8
   logo_area.width = width;
862bc8
   logo_area.height = height;
862bc8
 
862bc8
@@ -944,60 +956,62 @@ update_status (ply_boot_splash_plugin_t *plugin,
862bc8
 static void
862bc8
 show_message (ply_boot_splash_plugin_t *plugin,
862bc8
               const char               *message)
862bc8
 {
862bc8
   ply_trace ("Showing message '%s'", message);
862bc8
   ply_list_node_t *node;
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
       ply_label_set_text (view->message_label, message);
862bc8
       ply_label_show (view->message_label, view->display, 10, 10);
862bc8
 
862bc8
       ply_pixel_display_draw_area (view->display, 10, 10,
862bc8
                                    ply_label_get_width (view->message_label),
862bc8
                                    ply_label_get_height(view->message_label));
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 hide_splash_screen (ply_boot_splash_plugin_t *plugin,
862bc8
                     ply_event_loop_t         *loop)
862bc8
 {
862bc8
   assert (plugin != NULL);
862bc8
 
862bc8
+  plugin->is_visible = false;
862bc8
+
862bc8
   if (plugin->loop != NULL)
862bc8
     {
862bc8
       stop_animation (plugin);
862bc8
 
862bc8
       ply_event_loop_stop_watching_for_exit (plugin->loop, (ply_event_loop_exit_handler_t)
862bc8
                                              detach_from_event_loop,
862bc8
                                              plugin);
862bc8
       detach_from_event_loop (plugin);
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 show_password_prompt (ply_boot_splash_plugin_t *plugin,
862bc8
                       const char               *text,
862bc8
                       int                       number_of_bullets)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       view_show_prompt (view, text);
862bc8
       ply_entry_set_bullet_count (view->entry, number_of_bullets);
862bc8
 
862bc8
diff --git a/src/plugins/splash/space-flares/plugin.c b/src/plugins/splash/space-flares/plugin.c
862bc8
index b18f39f..9e53617 100644
862bc8
--- a/src/plugins/splash/space-flares/plugin.c
862bc8
+++ b/src/plugins/splash/space-flares/plugin.c
862bc8
@@ -1416,62 +1416,71 @@ draw_background (view_t             *view,
862bc8
   image_area.width = ply_image_get_width(plugin->star_image);
862bc8
   image_area.height = ply_image_get_height(plugin->star_image);
862bc8
   
862bc8
   
862bc8
   ply_pixel_buffer_fill_with_argb32_data_with_clip (pixel_buffer,
862bc8
                                                      &image_area, &area,
862bc8
                                                      ply_image_get_data (plugin->star_image));
862bc8
                                                      
862bc8
   image_area.x = 20;
862bc8
   image_area.y = 20;
862bc8
   image_area.width = ply_image_get_width(plugin->logo_image);
862bc8
   image_area.height = ply_image_get_height(plugin->logo_image);
862bc8
   
862bc8
   
862bc8
   ply_pixel_buffer_fill_with_argb32_data_with_clip (pixel_buffer,
862bc8
                                                      &image_area, &area,
862bc8
                                                      ply_image_get_data (plugin->logo_image));
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 add_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                    ply_pixel_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   ply_pixel_display_set_draw_handler (view->display,
862bc8
                                       (ply_pixel_display_draw_handler_t)
862bc8
                                       on_draw, view);
862bc8
-
862bc8
-  ply_list_append_data (plugin->views, view);
862bc8
+  if (plugin->is_visible)
862bc8
+    {
862bc8
+      if (view_load (view))
862bc8
+        ply_list_append_data (plugin->views, view);
862bc8
+      else
862bc8
+        view_free (view);
862bc8
+    }
862bc8
+  else
862bc8
+    {
862bc8
+      ply_list_append_data (plugin->views, view);
862bc8
+    }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                       ply_pixel_display_t      *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_setup_scene (view_t *view)
862bc8
diff --git a/src/plugins/splash/text/plugin.c b/src/plugins/splash/text/plugin.c
862bc8
index fb97c14..69125a2 100644
862bc8
--- a/src/plugins/splash/text/plugin.c
862bc8
+++ b/src/plugins/splash/text/plugin.c
862bc8
@@ -458,60 +458,63 @@ stop_animation (ply_boot_splash_plugin_t *plugin)
862bc8
 
862bc8
 static void
862bc8
 on_draw (view_t                   *view,
862bc8
          ply_terminal_t           *terminal,
862bc8
          int                       x,
862bc8
          int                       y,
862bc8
          int                       width,
862bc8
          int                       height)
862bc8
 {
862bc8
   ply_text_display_clear_screen (view->display);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 add_text_display (ply_boot_splash_plugin_t *plugin,
862bc8
                   ply_text_display_t       *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
   ply_terminal_t *terminal;
862bc8
 
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   terminal = ply_text_display_get_terminal (view->display);
862bc8
   if (ply_terminal_open (terminal))
862bc8
     ply_terminal_activate_vt (terminal);
862bc8
 
862bc8
   ply_text_display_set_draw_handler (view->display,
862bc8
                                      (ply_text_display_draw_handler_t)
862bc8
                                      on_draw, view);
862bc8
 
862bc8
   ply_list_append_data (plugin->views, view);
862bc8
+
862bc8
+  if (plugin->is_animating)
862bc8
+    view_start_animation (view);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_text_display (ply_boot_splash_plugin_t *plugin,
862bc8
                      ply_text_display_t       *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
           ply_text_display_set_draw_handler (view->display,
862bc8
                                              NULL, NULL);
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
diff --git a/src/plugins/splash/throbgress/plugin.c b/src/plugins/splash/throbgress/plugin.c
862bc8
index e3ce91b..c4d0555 100644
862bc8
--- a/src/plugins/splash/throbgress/plugin.c
862bc8
+++ b/src/plugins/splash/throbgress/plugin.c
862bc8
@@ -618,62 +618,71 @@ on_draw (view_t                   *view,
862bc8
       lock_data = ply_image_get_data (plugin->lock_image);
862bc8
       ply_pixel_buffer_fill_with_argb32_data (pixel_buffer,
862bc8
                                               &view->lock_area,
862bc8
                                               lock_data);
862bc8
     }
862bc8
   else
862bc8
     {
862bc8
       draw_logo (view, pixel_buffer);
862bc8
       ply_throbber_draw_area (view->throbber,
862bc8
                               pixel_buffer, x, y, width, height);
862bc8
       ply_progress_bar_draw_area (view->progress_bar,
862bc8
                                   pixel_buffer, x, y, width, height);
862bc8
     }
862bc8
   ply_label_draw_area (view->message_label,
862bc8
                        pixel_buffer,
862bc8
                        x, y, width, height);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 add_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                    ply_pixel_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   ply_trace ("adding pixel display to plugin");
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   ply_pixel_display_set_draw_handler (view->display,
862bc8
                                       (ply_pixel_display_draw_handler_t)
862bc8
                                       on_draw, view);
862bc8
-
862bc8
-  ply_list_append_data (plugin->views, view);
862bc8
+  if (plugin->is_visible)
862bc8
+    {
862bc8
+      if (view_load (view))
862bc8
+        ply_list_append_data (plugin->views, view);
862bc8
+      else
862bc8
+        view_free (view);
862bc8
+    }
862bc8
+  else
862bc8
+    {
862bc8
+      ply_list_append_data (plugin->views, view);
862bc8
+    }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                       ply_pixel_display_t      *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   ply_trace ("removing pixel display from plugin");
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
diff --git a/src/plugins/splash/tribar/plugin.c b/src/plugins/splash/tribar/plugin.c
862bc8
index 4458bad..5b89cc3 100644
862bc8
--- a/src/plugins/splash/tribar/plugin.c
862bc8
+++ b/src/plugins/splash/tribar/plugin.c
862bc8
@@ -461,60 +461,63 @@ stop_animation (ply_boot_splash_plugin_t *plugin)
862bc8
 
862bc8
 static void
862bc8
 on_draw (view_t                   *view,
862bc8
          ply_terminal_t           *terminal,
862bc8
          int                       x,
862bc8
          int                       y,
862bc8
          int                       width,
862bc8
          int                       height)
862bc8
 {
862bc8
   ply_text_display_clear_screen (view->display);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 add_text_display (ply_boot_splash_plugin_t *plugin,
862bc8
                   ply_text_display_t       *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
   ply_terminal_t *terminal;
862bc8
 
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   terminal = ply_text_display_get_terminal (view->display);
862bc8
   if (ply_terminal_open (terminal))
862bc8
     ply_terminal_activate_vt (terminal);
862bc8
 
862bc8
   ply_text_display_set_draw_handler (view->display,
862bc8
                                      (ply_text_display_draw_handler_t)
862bc8
                                      on_draw, view);
862bc8
 
862bc8
   ply_list_append_data (plugin->views, view);
862bc8
+
862bc8
+  if (plugin->is_animating)
862bc8
+    view_start_animation (view);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_text_display (ply_boot_splash_plugin_t *plugin,
862bc8
                      ply_text_display_t       *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
           ply_text_display_set_draw_handler (view->display,
862bc8
                                              NULL, NULL);
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
@@ -545,61 +548,63 @@ update_status (ply_boot_splash_plugin_t *plugin,
862bc8
   assert (plugin != NULL);
862bc8
 
862bc8
   ply_trace ("status update");
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 on_boot_progress (ply_boot_splash_plugin_t *plugin,
862bc8
                   double                    duration,
862bc8
                   double                    percent_done)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
   double total_duration;
862bc8
 
862bc8
   total_duration = duration / percent_done;
862bc8
 
862bc8
   /* Fun made-up smoothing function to make the growth asymptotic:
862bc8
    * fraction(time,estimate)=1-2^(-(time^1.45)/estimate) */
862bc8
   percent_done = 1.0 - pow (2.0, -pow (duration, 1.45) / total_duration) * (1.0 - percent_done);
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
 
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       ply_text_progress_bar_set_percent_done (view->progress_bar, percent_done);
862bc8
-      ply_text_progress_bar_draw (view->progress_bar);
862bc8
+
862bc8
+      if (plugin->is_animating)
862bc8
+        ply_text_progress_bar_draw (view->progress_bar);
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 hide_splash_screen (ply_boot_splash_plugin_t *plugin,
862bc8
                     ply_event_loop_t         *loop)
862bc8
 {
862bc8
   assert (plugin != NULL);
862bc8
 
862bc8
   ply_trace ("hiding splash screen");
862bc8
 
862bc8
   if (plugin->loop != NULL)
862bc8
     {
862bc8
       stop_animation (plugin);
862bc8
 
862bc8
       ply_event_loop_stop_watching_for_exit (plugin->loop,
862bc8
                                              (ply_event_loop_exit_handler_t)
862bc8
                                              detach_from_event_loop,
862bc8
                                              plugin);
862bc8
       detach_from_event_loop (plugin);
862bc8
     }
862bc8
 
862bc8
   hide_views (plugin);
862bc8
   ply_show_new_kernel_messages (true);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 display_normal (ply_boot_splash_plugin_t *plugin)
862bc8
diff --git a/src/plugins/splash/two-step/plugin.c b/src/plugins/splash/two-step/plugin.c
862bc8
index 4612e3f..a1d1f00 100644
862bc8
--- a/src/plugins/splash/two-step/plugin.c
862bc8
+++ b/src/plugins/splash/two-step/plugin.c
862bc8
@@ -980,61 +980,71 @@ on_draw (view_t                   *view,
862bc8
 
862bc8
           if (view->throbber != NULL)
862bc8
             sprite_height = MAX (ply_throbber_get_height (view->throbber),
862bc8
                                  sprite_height);
862bc8
 
862bc8
           image_area.width = ply_image_get_width (plugin->header_image);
862bc8
           image_area.height = ply_image_get_height (plugin->header_image);
862bc8
           image_area.x = screen_area.width / 2.0 - image_area.width / 2.0;
862bc8
           image_area.y = plugin->animation_vertical_alignment * screen_area.height - sprite_height / 2.0 - image_area.height;
862bc8
 
862bc8
           ply_pixel_buffer_fill_with_argb32_data (pixel_buffer, &image_area, ply_image_get_data (plugin->header_image));
862bc8
         }
862bc8
     }
862bc8
   ply_label_draw_area (view->message_label,
862bc8
                        pixel_buffer,
862bc8
                        x, y, width, height);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 add_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                    ply_pixel_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   ply_trace ("adding pixel display to plugin");
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   ply_pixel_display_set_draw_handler (view->display,
862bc8
                                       (ply_pixel_display_draw_handler_t)
862bc8
                                       on_draw, view);
862bc8
-  ply_list_append_data (plugin->views, view);
862bc8
+  if (plugin->is_visible)
862bc8
+    {
862bc8
+      if (view_load (view))
862bc8
+        ply_list_append_data (plugin->views, view);
862bc8
+      else
862bc8
+        view_free (view);
862bc8
+    }
862bc8
+  else
862bc8
+    {
862bc8
+      ply_list_append_data (plugin->views, view);
862bc8
+    }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_pixel_display (ply_boot_splash_plugin_t *plugin,
862bc8
                       ply_pixel_display_t      *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   ply_trace ("removing pixel display from plugin");
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
 
862bc8
           view_free (view);
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
-- 
862bc8
2.5.0
862bc8
862bc8
862bc8
From 3dc6d04a80329bb97e574c2785f79a684bfdc41b Mon Sep 17 00:00:00 2001
862bc8
From: Ray Strode <rstrode@redhat.com>
862bc8
Date: Fri, 9 Oct 2015 12:46:49 -0400
862bc8
Subject: [PATCH 5/6] details: update new views with current boot buffer
862bc8
862bc8
if a view is added after the splash is shown, make sure
862bc8
to update the view with the current contents of the boot
862bc8
buffer.
862bc8
---
862bc8
 src/plugins/splash/details/plugin.c | 15 +++++++++++++--
862bc8
 1 file changed, 13 insertions(+), 2 deletions(-)
862bc8
862bc8
diff --git a/src/plugins/splash/details/plugin.c b/src/plugins/splash/details/plugin.c
862bc8
index aff2f1c..6ddd654 100644
862bc8
--- a/src/plugins/splash/details/plugin.c
862bc8
+++ b/src/plugins/splash/details/plugin.c
862bc8
@@ -49,61 +49,61 @@
862bc8
 #include "ply-text-display.h"
862bc8
 #include "ply-trigger.h"
862bc8
 #include "ply-utils.h"
862bc8
 
862bc8
 #include <linux/kd.h>
862bc8
 
862bc8
 #define CLEAR_LINE_SEQUENCE "\033[2K\r"
862bc8
 
862bc8
 typedef enum {
862bc8
    PLY_BOOT_SPLASH_DISPLAY_NORMAL,
862bc8
    PLY_BOOT_SPLASH_DISPLAY_QUESTION_ENTRY,
862bc8
    PLY_BOOT_SPLASH_DISPLAY_PASSWORD_ENTRY
862bc8
 } ply_boot_splash_display_type_t;
862bc8
 
862bc8
 typedef struct
862bc8
 {
862bc8
   ply_boot_splash_plugin_t *plugin;
862bc8
   ply_text_display_t *display;
862bc8
 } view_t;
862bc8
 
862bc8
 ply_boot_splash_plugin_interface_t *ply_boot_splash_plugin_get_interface (void);
862bc8
 static void detach_from_event_loop (ply_boot_splash_plugin_t *plugin);
862bc8
 
862bc8
 struct _ply_boot_splash_plugin
862bc8
 {
862bc8
   ply_event_loop_t *loop;
862bc8
   ply_boot_splash_mode_t mode;
862bc8
   ply_list_t *views;
862bc8
   ply_boot_splash_display_type_t state;
862bc8
   ply_list_t *messages;
862bc8
-
862bc8
+  ply_buffer_t *boot_buffer;
862bc8
 };
862bc8
 
862bc8
 static view_t *
862bc8
 view_new (ply_boot_splash_plugin_t *plugin,
862bc8
           ply_text_display_t      *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
 
862bc8
   view = calloc (1, sizeof (view_t));
862bc8
   view->plugin = plugin;
862bc8
   view->display = display;
862bc8
 
862bc8
   return view;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 view_free (view_t *view)
862bc8
 {
862bc8
   free (view);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 free_views (ply_boot_splash_plugin_t *plugin)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
 
862bc8
   while (node != NULL)
862bc8
     {
862bc8
@@ -217,108 +217,119 @@ write_on_views (ply_boot_splash_plugin_t *plugin,
862bc8
 
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       ply_list_node_t *next_node;
862bc8
       view_t *view;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       view_write (view, text, number_of_bytes);
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 add_text_display (ply_boot_splash_plugin_t *plugin,
862bc8
                   ply_text_display_t       *display)
862bc8
 {
862bc8
   view_t *view;
862bc8
   ply_terminal_t *terminal;
862bc8
 
862bc8
   view = view_new (plugin, display);
862bc8
 
862bc8
   terminal = ply_text_display_get_terminal (view->display);
862bc8
   if (ply_terminal_open (terminal))
862bc8
     ply_terminal_activate_vt (terminal);
862bc8
 
862bc8
   ply_list_append_data (plugin->views, view);
862bc8
+
862bc8
+  if (plugin->boot_buffer != NULL)
862bc8
+    {
862bc8
+      size_t size;
862bc8
+      const char *bytes;
862bc8
+
862bc8
+      size = ply_buffer_get_size (plugin->boot_buffer);
862bc8
+      bytes = ply_buffer_get_bytes (plugin->boot_buffer);
862bc8
+      view_write (view, bytes, size);
862bc8
+    }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 remove_text_display (ply_boot_splash_plugin_t *plugin,
862bc8
                      ply_text_display_t       *display)
862bc8
 {
862bc8
   ply_list_node_t *node;
862bc8
 
862bc8
   node = ply_list_get_first_node (plugin->views);
862bc8
   while (node != NULL)
862bc8
     {
862bc8
       view_t *view;
862bc8
       ply_list_node_t *next_node;
862bc8
 
862bc8
       view = ply_list_node_get_data (node);
862bc8
       next_node = ply_list_get_next_node (plugin->views, node);
862bc8
 
862bc8
       if (view->display == display)
862bc8
         {
862bc8
           ply_list_remove_node (plugin->views, node);
862bc8
           return;
862bc8
         }
862bc8
 
862bc8
       node = next_node;
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static bool
862bc8
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
862bc8
                     ply_event_loop_t         *loop,
862bc8
                     ply_buffer_t             *boot_buffer,
862bc8
                     ply_boot_splash_mode_t    mode)
862bc8
 {
862bc8
   size_t size;
862bc8
 
862bc8
   assert (plugin != NULL);
862bc8
 
862bc8
   plugin->loop = loop;
862bc8
   plugin->mode = mode;
862bc8
 
862bc8
   ply_event_loop_watch_for_exit (loop, (ply_event_loop_exit_handler_t)
862bc8
                                  detach_from_event_loop,
862bc8
                                  plugin);
862bc8
 
862bc8
   if (boot_buffer)
862bc8
     {
862bc8
-      size = ply_buffer_get_size (boot_buffer);
862bc8
+      plugin->boot_buffer = boot_buffer;
862bc8
 
862bc8
+      size = ply_buffer_get_size (boot_buffer);
862bc8
       write_on_views (plugin, ply_buffer_get_bytes (boot_buffer), size);
862bc8
     }
862bc8
 
862bc8
   return true;
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 update_status (ply_boot_splash_plugin_t *plugin,
862bc8
                const char               *status)
862bc8
 {
862bc8
   assert (plugin != NULL);
862bc8
 
862bc8
   ply_trace ("status update");
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 on_boot_output (ply_boot_splash_plugin_t *plugin,
862bc8
                 const char               *output,
862bc8
                 size_t                    size)
862bc8
 {
862bc8
   ply_trace ("writing '%s' to all views (%d bytes)",
862bc8
              output, (int) size);
862bc8
   write_on_views (plugin, output, size);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 hide_splash_screen (ply_boot_splash_plugin_t *plugin,
862bc8
                     ply_event_loop_t         *loop)
862bc8
 {
862bc8
   assert (plugin != NULL);
862bc8
-- 
862bc8
2.5.0
862bc8
862bc8
862bc8
From 07864d66b30aa37908df83495d3bffc681fb34d3 Mon Sep 17 00:00:00 2001
862bc8
From: Ray Strode <rstrode@redhat.com>
862bc8
Date: Fri, 9 Oct 2015 12:48:17 -0400
862bc8
Subject: [PATCH 6/6] main: make sure to reshow prompts when new display is
862bc8
 added
862bc8
862bc8
When a display is added, we need to tell the splash plugin
862bc8
to redisplay any pending questions, so those questions show
862bc8
up on the new display.
862bc8
---
862bc8
 src/main.c | 3 +++
862bc8
 1 file changed, 3 insertions(+)
862bc8
862bc8
diff --git a/src/main.c b/src/main.c
862bc8
index 875dd1a..7c4ea3c 100644
862bc8
--- a/src/main.c
862bc8
+++ b/src/main.c
862bc8
@@ -1022,89 +1022,92 @@ on_keyboard_removed (state_t        *state,
862bc8
                                       (ply_keyboard_escape_handler_t)
862bc8
                                       on_escape_pressed);
862bc8
   ply_trace ("no longer listening for backspace");
862bc8
   ply_keyboard_remove_backspace_handler (keyboard,
862bc8
                                          (ply_keyboard_backspace_handler_t)
862bc8
                                          on_backspace);
862bc8
   ply_trace ("no longer listening for enter");
862bc8
   ply_keyboard_remove_enter_handler (keyboard,
862bc8
                                      (ply_keyboard_enter_handler_t)
862bc8
                                      on_enter);
862bc8
 
862bc8
   if (state->boot_splash != NULL)
862bc8
     ply_boot_splash_unset_keyboard (state->boot_splash);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 on_pixel_display_added (state_t                    *state,
862bc8
                         ply_pixel_display_t *display)
862bc8
 {
862bc8
   if (state->is_shown)
862bc8
     {
862bc8
       if (state->boot_splash == NULL)
862bc8
         {
862bc8
           ply_trace ("pixel display added before splash loaded, so loading splash now");
862bc8
           show_splash (state);
862bc8
         }
862bc8
       else
862bc8
         {
862bc8
           ply_trace ("pixel display added after splash loaded, so attaching to splash");
862bc8
           ply_boot_splash_add_pixel_display (state->boot_splash, display);
862bc8
+          update_display (state);
862bc8
         }
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 on_pixel_display_removed (state_t                    *state,
862bc8
                           ply_pixel_display_t *display)
862bc8
 {
862bc8
   if (state->boot_splash == NULL)
862bc8
     return;
862bc8
 
862bc8
   ply_boot_splash_remove_pixel_display (state->boot_splash, display);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 on_text_display_added (state_t                   *state,
862bc8
                        ply_text_display_t *display)
862bc8
 {
862bc8
   if (state->is_shown)
862bc8
     {
862bc8
       if (state->boot_splash == NULL)
862bc8
         {
862bc8
           ply_trace ("text display added before splash loaded, so loading splash now");
862bc8
           show_splash (state);
862bc8
         }
862bc8
       else
862bc8
         {
862bc8
           ply_trace ("text display added after splash loaded, so attaching to splash");
862bc8
           ply_boot_splash_add_text_display (state->boot_splash, display);
862bc8
+
862bc8
+          update_display (state);
862bc8
         }
862bc8
     }
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 on_text_display_removed (state_t                   *state,
862bc8
                          ply_text_display_t *display)
862bc8
 {
862bc8
   if (state->boot_splash == NULL)
862bc8
     return;
862bc8
 
862bc8
   ply_boot_splash_remove_text_display (state->boot_splash, display);
862bc8
 }
862bc8
 
862bc8
 static void
862bc8
 load_devices (state_t                    *state,
862bc8
               ply_device_manager_flags_t  flags)
862bc8
 {
862bc8
   state->device_manager = ply_device_manager_new (state->default_tty, flags);
862bc8
   state->local_console_terminal = ply_device_manager_get_default_terminal (state->device_manager);
862bc8
 
862bc8
   ply_device_manager_watch_devices (state->device_manager,
862bc8
                                     (ply_keyboard_added_handler_t)
862bc8
                                     on_keyboard_added,
862bc8
                                     (ply_keyboard_removed_handler_t)
862bc8
                                     on_keyboard_removed,
862bc8
                                     (ply_pixel_display_added_handler_t)
862bc8
                                     on_pixel_display_added,
862bc8
                                     (ply_pixel_display_removed_handler_t)
862bc8
                                     on_pixel_display_removed,
862bc8
-- 
862bc8
2.5.0
862bc8