mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 15:58:20 +02:00
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.
This commit is contained in:
parent
6f329db9eb
commit
2bb73dcfe3
3 changed files with 31 additions and 2 deletions
|
|
@ -27,9 +27,10 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "ply-answer.h"
|
||||
#include "ply-event-loop.h"
|
||||
#include "ply-window.h"
|
||||
#include "ply-buffer.h"
|
||||
#include "ply-event-loop.h"
|
||||
#include "ply-trigger.h"
|
||||
#include "ply-window.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 */
|
||||
|
|
|
|||
|
|
@ -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 <stdio.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
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue