From: Ray Strode Date: Mon, 22 Sep 2008 03:12:12 +0000 (-0400) Subject: Add new interface to make splash plugin go to idle X-Git-Tag: 0.6.0~137 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2bb73dcfe336b06e8d5eb89fa9345db5f869fd0e;p=thirdparty%2Fplymouth.git Add new interface to make splash plugin go to idle There are times when we want to make the splash screen stop any pending animations and got to an idle state. For instance, right before resuming, or right before loading up GDM. It may take a few frames for the splash screen to get there though. This interface tells the splash screen it needs to idle and provides a trigger for it to fire when it's actually made it to an idle state. --- diff --git a/src/libplybootsplash/ply-boot-splash-plugin.h b/src/libplybootsplash/ply-boot-splash-plugin.h index 8e3d2fac..c5f35547 100644 --- a/src/libplybootsplash/ply-boot-splash-plugin.h +++ b/src/libplybootsplash/ply-boot-splash-plugin.h @@ -27,9 +27,10 @@ #include #include "ply-answer.h" +#include "ply-buffer.h" #include "ply-event-loop.h" +#include "ply-trigger.h" #include "ply-window.h" -#include "ply-buffer.h" typedef struct _ply_boot_splash_plugin ply_boot_splash_plugin_t; @@ -60,6 +61,8 @@ typedef struct void (* ask_for_password) (ply_boot_splash_plugin_t *plugin, const char *prompt, ply_answer_t *answer); + void (* become_idle) (ply_boot_splash_plugin_t *plugin, + ply_trigger_t *idle_trigger); } ply_boot_splash_plugin_interface_t; #endif /* PLY_BOOT_SPLASH_PLUGIN_H */ diff --git a/src/ply-boot-splash.c b/src/ply-boot-splash.c index a9baa3ee..7f606448 100644 --- a/src/ply-boot-splash.c +++ b/src/ply-boot-splash.c @@ -36,6 +36,7 @@ #include "ply-event-loop.h" #include "ply-list.h" #include "ply-logger.h" +#include "ply-trigger.h" #include "ply-utils.h" struct _ply_boot_splash @@ -46,6 +47,7 @@ struct _ply_boot_splash ply_boot_splash_plugin_t *plugin; ply_window_t *window; ply_buffer_t *boot_buffer; + ply_trigger_t *idle_trigger; char *module_name; char *status; @@ -290,6 +292,24 @@ ply_boot_splash_attach_to_event_loop (ply_boot_splash_t *splash, splash); } +void +ply_boot_splash_become_idle (ply_boot_splash_t *splash, + ply_boot_splash_on_idle_handler_t idle_handler, + void *user_data) +{ + assert (splash->idle_trigger == NULL); + + if (splash->plugin_interface->become_idle == NULL) + { + idle_handler (user_data); + return; + } + + splash->idle_trigger = ply_trigger_new ((ply_trigger_handler_t) idle_handler, user_data, &splash->idle_trigger); + + splash->plugin_interface->become_idle (splash->plugin, splash->idle_trigger); +} + #ifdef PLY_BOOT_SPLASH_ENABLE_TEST #include diff --git a/src/ply-boot-splash.h b/src/ply-boot-splash.h index aeddc249..5efa6785 100644 --- a/src/ply-boot-splash.h +++ b/src/ply-boot-splash.h @@ -34,6 +34,8 @@ typedef struct _ply_boot_splash ply_boot_splash_t; +typedef void (* ply_boot_splash_on_idle_handler_t) (void *user_data); + #ifndef PLY_HIDE_FUNCTION_DECLARATIONS ply_boot_splash_t *ply_boot_splash_new (const char *module_name, ply_window_t *window, @@ -53,6 +55,10 @@ void ply_boot_splash_ask_for_password (ply_boot_splash_t *splash, void ply_boot_splash_hide (ply_boot_splash_t *splash); void ply_boot_splash_attach_to_event_loop (ply_boot_splash_t *splash, ply_event_loop_t *loop); +void ply_boot_splash_become_idle (ply_boot_splash_t *splash, + ply_boot_splash_on_idle_handler_t idle_handler, + void *user_data); + #endif