]> git.ipfire.org Git - thirdparty/plymouth.git/commitdiff
Add {add,remove}_window funcs to splash plugins
authorRay Strode <rstrode@redhat.com>
Sat, 13 Sep 2008 15:56:14 +0000 (11:56 -0400)
committerRay Strode <rstrode@redhat.com>
Tue, 23 Sep 2008 18:21:48 +0000 (14:21 -0400)
We'll be able to have more than one window for
serial consoles, etc.

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

index 25b3fe68bbc68b4bd576bfcaced6299cbe90d959..8e3d2facd88762c332011acb04d348ccdc9bee9d 100644 (file)
@@ -40,9 +40,13 @@ typedef struct
   ply_boot_splash_plugin_t * (* create_plugin) (void);
   void (* destroy_plugin) (ply_boot_splash_plugin_t *plugin);
 
+  void (* add_window) (ply_boot_splash_plugin_t *plugin,
+                       ply_window_t             *window);
+
+  void (* remove_window) (ply_boot_splash_plugin_t *plugin,
+                          ply_window_t             *window);
   bool (* show_splash_screen) (ply_boot_splash_plugin_t *plugin,
                                ply_event_loop_t         *loop,
-                               ply_window_t             *window,
                                ply_buffer_t             *boot_buffer);
   void (* update_status) (ply_boot_splash_plugin_t *plugin,
                           const char               *status);
@@ -51,8 +55,7 @@ typedef struct
                            size_t                    size);
   void (* on_root_mounted) (ply_boot_splash_plugin_t *plugin);
   void (* hide_splash_screen) (ply_boot_splash_plugin_t *plugin,
-                               ply_event_loop_t         *loop,
-                               ply_window_t             *window);
+                               ply_event_loop_t         *loop);
 
   void (* ask_for_password) (ply_boot_splash_plugin_t *plugin,
                              const char               *prompt,
index 34fa5d860f6950fda97afb3cd620f48ef4c980e8..4e3292ba6a7a6590920f845c6f2bbd10dd2525b3 100644 (file)
@@ -132,37 +132,48 @@ on_enter (ply_boot_splash_plugin_t *plugin,
     }
 }
 
+void
+add_window (ply_boot_splash_plugin_t *plugin,
+            ply_window_t             *window)
+{
+  plugin->window = window;
+}
+
+void
+remove_window (ply_boot_splash_plugin_t *plugin,
+               ply_window_t             *window)
+{
+  plugin->window = NULL;
+}
+
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_window_t             *window,
                     ply_buffer_t             *boot_buffer)
 {
   size_t size;
 
   assert (plugin != NULL);
 
-  if (window != NULL)
+  if (plugin->window != NULL)
     {
       ply_boot_splash_plugin_interface_t *interface;
 
-      ply_window_set_mode (window, PLY_WINDOW_MODE_TEXT);
+      ply_window_set_mode (plugin->window, PLY_WINDOW_MODE_TEXT);
 
-      ply_window_set_keyboard_input_handler (window,
+      ply_window_set_keyboard_input_handler (plugin->window,
                                              (ply_window_keyboard_input_handler_t)
                                              on_keyboard_input, plugin);
-      ply_window_set_backspace_handler (window,
+      ply_window_set_backspace_handler (plugin->window,
                                         (ply_window_backspace_handler_t)
                                         on_backspace, plugin);
-      ply_window_set_enter_handler (window,
+      ply_window_set_enter_handler (plugin->window,
                                     (ply_window_enter_handler_t)
                                     on_enter, plugin);
 
       interface = ply_boot_splash_plugin_get_interface ();
 
       interface->ask_for_password = ask_for_password;
-
-      plugin->window = window;
     }
 
   plugin->loop = loop;
@@ -201,8 +212,7 @@ on_boot_output (ply_boot_splash_plugin_t *plugin,
 
 void
 hide_splash_screen (ply_boot_splash_plugin_t *plugin,
-                    ply_event_loop_t         *loop,
-                    ply_window_t             *window)
+                    ply_event_loop_t         *loop)
 {
   assert (plugin != NULL);
 
@@ -215,16 +225,15 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
       plugin->keyboard_input_is_hidden = false;
     }
 
-  ply_window_set_keyboard_input_handler (window, NULL, NULL);
-  ply_window_set_backspace_handler (window, NULL, NULL);
-  ply_window_set_enter_handler (window, NULL, NULL);
+  ply_window_set_keyboard_input_handler (plugin->window, NULL, NULL);
+  ply_window_set_backspace_handler (plugin->window, NULL, NULL);
+  ply_window_set_enter_handler (plugin->window, NULL, NULL);
 
   ply_event_loop_stop_watching_for_exit (plugin->loop,
                                          (ply_event_loop_exit_handler_t)
                                          detach_from_event_loop,
                                          plugin);
   detach_from_event_loop (plugin);
-  plugin->window = NULL;
 }
 
 void
@@ -254,6 +263,8 @@ ply_boot_splash_plugin_get_interface (void)
     {
       .create_plugin = create_plugin,
       .destroy_plugin = destroy_plugin,
+      .add_window = add_window,
+      .remove_window = remove_window,
       .show_splash_screen = show_splash_screen,
       .update_status = update_status,
       .on_boot_output = on_boot_output,
index 604c1814e69e1b454eef3730e68f6a46ae79dbd9..dd1cb362e1177a88820b8ed44cb53d7bdbc2a3bd 100644 (file)
@@ -426,30 +426,43 @@ on_erase (ply_boot_splash_plugin_t *plugin,
                                        0x807c71, 0x3a362f);
 }
 
+void
+add_window (ply_boot_splash_plugin_t *plugin,
+            ply_window_t             *window)
+{
+  plugin->window = window;
+}
+
+void
+remove_window (ply_boot_splash_plugin_t *plugin,
+               ply_window_t             *window)
+{
+  plugin->window = NULL;
+}
+
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_window_t             *window,
                     ply_buffer_t             *boot_buffer)
 {
   assert (plugin != NULL);
   assert (plugin->logo_image != NULL);
 
-  ply_window_set_keyboard_input_handler (window,
+  ply_window_set_keyboard_input_handler (plugin->window,
                                          (ply_window_keyboard_input_handler_t)
                                          on_keyboard_input, plugin);
-  ply_window_set_backspace_handler (window,
+  ply_window_set_backspace_handler (plugin->window,
                                     (ply_window_backspace_handler_t)
                                     on_backspace, plugin);
-  ply_window_set_enter_handler (window,
+  ply_window_set_enter_handler (plugin->window,
                                 (ply_window_enter_handler_t)
                                 on_enter, plugin);
 
-  ply_window_set_draw_handler (window,
+  ply_window_set_draw_handler (plugin->window,
                                (ply_window_draw_handler_t)
                                on_draw, plugin);
 
-  ply_window_set_erase_handler (window,
+  ply_window_set_erase_handler (plugin->window,
                                (ply_window_erase_handler_t)
                                on_erase, plugin);
 
@@ -471,8 +484,6 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
   if (!ply_entry_load (plugin->entry))
     return false;
 
-  plugin->window = window;
-
   ply_trace ("setting graphics mode");
   if (!ply_window_set_mode (plugin->window, PLY_WINDOW_MODE_GRAPHICS))
     return false;
@@ -573,8 +584,7 @@ update_status (ply_boot_splash_plugin_t *plugin,
 
 void
 hide_splash_screen (ply_boot_splash_plugin_t *plugin,
-                    ply_event_loop_t         *loop,
-                    ply_window_t             *window)
+                    ply_event_loop_t         *loop)
 {
   assert (plugin != NULL);
 
@@ -584,9 +594,9 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
       plugin->pending_password_answer = NULL;
     }
 
-  ply_window_set_keyboard_input_handler (window, NULL, NULL);
-  ply_window_set_backspace_handler (window, NULL, NULL);
-  ply_window_set_enter_handler (window, NULL, NULL);
+  ply_window_set_keyboard_input_handler (plugin->window, NULL, NULL);
+  ply_window_set_backspace_handler (plugin->window, NULL, NULL);
+  ply_window_set_enter_handler (plugin->window, NULL, NULL);
 
   if (plugin->loop != NULL)
     {
@@ -601,7 +611,6 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
   plugin->frame_buffer = NULL;
 
   ply_window_set_mode (plugin->window, PLY_WINDOW_MODE_TEXT);
-  plugin->window = NULL;
 }
 
 static void
@@ -649,6 +658,8 @@ ply_boot_splash_plugin_get_interface (void)
     {
       .create_plugin = create_plugin,
       .destroy_plugin = destroy_plugin,
+      .add_window = add_window,
+      .remove_window = remove_window,
       .show_splash_screen = show_splash_screen,
       .update_status = update_status,
       .hide_splash_screen = hide_splash_screen,
index cd9a85b033a14438e8cc73fb37d15c8a7a01d6c7..2759ad259f96c52fc636813827bbb2e888c86e99 100644 (file)
@@ -112,6 +112,8 @@ destroy_plugin (ply_boot_splash_plugin_t *plugin)
   ply_entry_free (plugin->entry);
   ply_throbber_free (plugin->throbber);
   ply_label_free (plugin->label);
+
+
   free (plugin);
 }
 
@@ -301,30 +303,43 @@ on_erase (ply_boot_splash_plugin_t *plugin,
                                        PLYMOUTH_BACKGROUND_END_COLOR);
 }
 
+void
+add_window (ply_boot_splash_plugin_t *plugin,
+            ply_window_t             *window)
+{
+  plugin->window = window;
+}
+
+void
+remove_window (ply_boot_splash_plugin_t *plugin,
+               ply_window_t             *window)
+{
+  plugin->window = NULL;
+}
+
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_window_t             *window,
                     ply_buffer_t             *boot_buffer)
 {
   assert (plugin != NULL);
   assert (plugin->logo_image != NULL);
 
-  ply_window_set_keyboard_input_handler (window,
+  ply_window_set_keyboard_input_handler (plugin->window,
                                          (ply_window_keyboard_input_handler_t)
                                          on_keyboard_input, plugin);
-  ply_window_set_backspace_handler (window,
+  ply_window_set_backspace_handler (plugin->window,
                                     (ply_window_backspace_handler_t)
                                     on_backspace, plugin);
-  ply_window_set_enter_handler (window,
+  ply_window_set_enter_handler (plugin->window,
                                 (ply_window_enter_handler_t)
                                 on_enter, plugin);
 
-  ply_window_set_draw_handler (window,
+  ply_window_set_draw_handler (plugin->window,
                                (ply_window_draw_handler_t)
                                on_draw, plugin);
 
-  ply_window_set_erase_handler (window,
+  ply_window_set_erase_handler (plugin->window,
                                (ply_window_erase_handler_t)
                                on_erase, plugin);
 
@@ -350,8 +365,6 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
   if (!ply_throbber_load (plugin->throbber))
     return false;
 
-  plugin->window = window;
-
   ply_trace ("setting graphics mode");
   if (!ply_window_set_mode (plugin->window, PLY_WINDOW_MODE_GRAPHICS))
     return false;
@@ -382,8 +395,7 @@ update_status (ply_boot_splash_plugin_t *plugin,
 
 void
 hide_splash_screen (ply_boot_splash_plugin_t *plugin,
-                    ply_event_loop_t         *loop,
-                    ply_window_t             *window)
+                    ply_event_loop_t         *loop)
 {
   assert (plugin != NULL);
 
@@ -393,11 +405,11 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
       plugin->pending_password_answer = NULL;
     }
 
-  ply_window_set_keyboard_input_handler (window, NULL, NULL);
-  ply_window_set_backspace_handler (window, NULL, NULL);
-  ply_window_set_enter_handler (window, NULL, NULL);
-  ply_window_set_draw_handler (window, NULL, NULL);
-  ply_window_set_erase_handler (window, NULL, NULL);
+  ply_window_set_keyboard_input_handler (plugin->window, NULL, NULL);
+  ply_window_set_backspace_handler (plugin->window, NULL, NULL);
+  ply_window_set_enter_handler (plugin->window, NULL, NULL);
+  ply_window_set_draw_handler (plugin->window, NULL, NULL);
+  ply_window_set_erase_handler (plugin->window, NULL, NULL);
 
   if (plugin->loop != NULL)
     {
@@ -410,8 +422,6 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
     }
 
   plugin->frame_buffer = NULL;
-
-  plugin->window = NULL;
 }
 
 static void
@@ -506,6 +516,8 @@ ply_boot_splash_plugin_get_interface (void)
     {
       .create_plugin = create_plugin,
       .destroy_plugin = destroy_plugin,
+      .add_window = add_window,
+      .remove_window = remove_window,
       .show_splash_screen = show_splash_screen,
       .update_status = update_status,
       .hide_splash_screen = hide_splash_screen,
index 465d7634e79041d5136ab381d5de0a57cdc8f46f..63ff2f607b20d229c0020d4b789f6cbaa5a31a34 100644 (file)
@@ -199,27 +199,40 @@ on_erase (ply_boot_splash_plugin_t *plugin,
   ply_window_clear_screen (plugin->window);
 }
 
+void
+add_window (ply_boot_splash_plugin_t *plugin,
+            ply_window_t             *window)
+{
+  plugin->window = window;
+}
+
+void
+remove_window (ply_boot_splash_plugin_t *plugin,
+               ply_window_t             *window)
+{
+  plugin->window = NULL;
+}
+
 bool
 show_splash_screen (ply_boot_splash_plugin_t *plugin,
                     ply_event_loop_t         *loop,
-                    ply_window_t             *window,
                     ply_buffer_t             *boot_buffer)
 {
   assert (plugin != NULL);
 
-  ply_window_set_keyboard_input_handler (window,
+  ply_window_set_keyboard_input_handler (plugin->window,
                                          (ply_window_keyboard_input_handler_t)
                                          on_keyboard_input, plugin);
-  ply_window_set_backspace_handler (window,
+  ply_window_set_backspace_handler (plugin->window,
                                     (ply_window_backspace_handler_t)
                                     on_backspace, plugin);
-  ply_window_set_enter_handler (window,
+  ply_window_set_enter_handler (plugin->window,
                                 (ply_window_enter_handler_t)
                                 on_enter, plugin);
-  ply_window_set_draw_handler (window,
+  ply_window_set_draw_handler (plugin->window,
                                (ply_window_draw_handler_t)
                                 on_draw, plugin);
-  ply_window_set_erase_handler (window,
+  ply_window_set_erase_handler (plugin->window,
                                 (ply_window_erase_handler_t)
                                 on_erase, plugin);
 
@@ -228,8 +241,6 @@ show_splash_screen (ply_boot_splash_plugin_t *plugin,
                                  detach_from_event_loop,
                                  plugin);
 
-  plugin->window = window;
-
   start_animation (plugin);
 
   return true;
@@ -246,8 +257,7 @@ update_status (ply_boot_splash_plugin_t *plugin,
 
 void
 hide_splash_screen (ply_boot_splash_plugin_t *plugin,
-                    ply_event_loop_t         *loop,
-                    ply_window_t             *window)
+                    ply_event_loop_t         *loop)
 {
   assert (plugin != NULL);
 
@@ -259,11 +269,11 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
       plugin->pending_password_answer = NULL;
     }
 
-  ply_window_set_keyboard_input_handler (window, NULL, NULL);
-  ply_window_set_backspace_handler (window, NULL, NULL);
-  ply_window_set_enter_handler (window, NULL, NULL);
-  ply_window_set_draw_handler (window, NULL, NULL);
-  ply_window_set_erase_handler (window, NULL, NULL);
+  ply_window_set_keyboard_input_handler (plugin->window, NULL, NULL);
+  ply_window_set_backspace_handler (plugin->window, NULL, NULL);
+  ply_window_set_enter_handler (plugin->window, NULL, NULL);
+  ply_window_set_draw_handler (plugin->window, NULL, NULL);
+  ply_window_set_erase_handler (plugin->window, NULL, NULL);
 
   if (plugin->loop != NULL)
     {
@@ -280,8 +290,6 @@ hide_splash_screen (ply_boot_splash_plugin_t *plugin,
   ply_window_clear_screen (plugin->window);
   ply_window_show_text_cursor (plugin->window);
   ply_window_reset_colors (plugin->window);
-
-  plugin->window = NULL;
 }
 
 void
@@ -322,6 +330,8 @@ ply_boot_splash_plugin_get_interface (void)
     {
       .create_plugin = create_plugin,
       .destroy_plugin = destroy_plugin,
+      .add_window = add_window,
+      .remove_window = remove_window,
       .show_splash_screen = show_splash_screen,
       .update_status = update_status,
       .hide_splash_screen = hide_splash_screen,
index ca2d3cfdb78431f911ee9e5a742528089625dc6d..a9baa3eed6294553b0f3481e912a894b723d4270 100644 (file)
@@ -170,10 +170,11 @@ ply_boot_splash_show (ply_boot_splash_t *splash)
   assert (splash->plugin != NULL);
   assert (splash->plugin_interface->show_splash_screen != NULL);
 
+  splash->plugin_interface->add_window (splash->plugin, splash->window);
+
   ply_trace ("showing splash screen\n");
   if (!splash->plugin_interface->show_splash_screen (splash->plugin,
                                                      splash->loop,
-                                                     splash->window,
                                                      splash->boot_buffer))
     {
 
@@ -260,8 +261,9 @@ ply_boot_splash_hide (ply_boot_splash_t *splash)
   assert (splash->plugin_interface->hide_splash_screen != NULL);
 
   splash->plugin_interface->hide_splash_screen (splash->plugin,
-                                                splash->loop,
-                                                splash->window);
+                                                splash->loop);
+
+  splash->plugin_interface->remove_window (splash->plugin, splash->window);
 
   splash->is_shown = false;