mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 11:19:17 +02:00
[script] Add an "on quit" callback to scripted themes
The callback is called before the final sprite refresh and quit. This allows the theme to tidy up the screen before handing over to the X fade and the destop manager.
This commit is contained in:
parent
d63a2aec8d
commit
36a1b35570
5 changed files with 34 additions and 0 deletions
|
|
@ -325,6 +325,9 @@ view_stop_animation (view_t *view)
|
|||
ply_boot_splash_plugin_t *plugin;
|
||||
|
||||
plugin = view->plugin;
|
||||
script_lib_plymouth_on_quit (view->script_state,
|
||||
view->script_plymouth_lib);
|
||||
script_lib_sprite_refresh (view->script_sprite_lib);
|
||||
|
||||
if (plugin->loop != NULL)
|
||||
ply_event_loop_stop_watching_for_timeout (plugin->loop,
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state_t *s
|
|||
data->script_display_password_func = script_obj_new_null ();
|
||||
data->script_display_question_func = script_obj_new_null ();
|
||||
data->script_message_func = script_obj_new_null ();
|
||||
data->script_quit_func = script_obj_new_null ();
|
||||
data->mode = mode;
|
||||
|
||||
script_obj_t *plymouth_hash = script_obj_hash_get_element (state->global, "Plymouth");
|
||||
|
|
@ -145,6 +146,12 @@ script_lib_plymouth_data_t *script_lib_plymouth_setup (script_state_t *s
|
|||
&data->script_message_func,
|
||||
"function",
|
||||
NULL);
|
||||
script_add_native_function (plymouth_hash,
|
||||
"SetQuitFunction",
|
||||
plymouth_set_function,
|
||||
&data->script_quit_func,
|
||||
"function",
|
||||
NULL);
|
||||
script_add_native_function (plymouth_hash,
|
||||
"GetMode",
|
||||
plymouth_get_mode,
|
||||
|
|
@ -171,6 +178,7 @@ void script_lib_plymouth_destroy (script_lib_plymouth_data_t *data)
|
|||
script_obj_unref (data->script_display_password_func);
|
||||
script_obj_unref (data->script_display_question_func);
|
||||
script_obj_unref (data->script_message_func);
|
||||
script_obj_unref (data->script_quit_func);
|
||||
free (data);
|
||||
}
|
||||
|
||||
|
|
@ -299,3 +307,13 @@ void script_lib_plymouth_on_message (script_state_t *state,
|
|||
script_obj_unref (new_message_obj);
|
||||
script_obj_unref (ret.object);
|
||||
}
|
||||
|
||||
void script_lib_plymouth_on_quit (script_state_t *state,
|
||||
script_lib_plymouth_data_t *data)
|
||||
{
|
||||
script_return_t ret = script_execute_object (state,
|
||||
data->script_quit_func,
|
||||
NULL,
|
||||
NULL);
|
||||
script_obj_unref (ret.object);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ typedef struct
|
|||
script_obj_t *script_display_password_func;
|
||||
script_obj_t *script_display_question_func;
|
||||
script_obj_t *script_message_func;
|
||||
script_obj_t *script_quit_func;
|
||||
ply_boot_splash_mode_t mode;
|
||||
} script_lib_plymouth_data_t;
|
||||
|
||||
|
|
@ -71,5 +72,7 @@ void script_lib_plymouth_on_display_question (script_state_t *state,
|
|||
void script_lib_plymouth_on_message (script_state_t *state,
|
||||
script_lib_plymouth_data_t *data,
|
||||
const char *new_message);
|
||||
void script_lib_plymouth_on_quit (script_state_t *state,
|
||||
script_lib_plymouth_data_t *data);
|
||||
|
||||
#endif /* SCRIPT_LIB_PLYMOUTH_H */
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@ PlymouthSetDisplayNormalFunction = Plymouth.SetDisplayNormalFunction;
|
|||
PlymouthSetDisplayPasswordFunction = Plymouth.SetDisplayPasswordFunction;
|
||||
PlymouthSetDisplayQuestionFunction = Plymouth.SetDisplayQuestionFunction;
|
||||
PlymouthSetMessageFunction = Plymouth.SetMessageFunction;
|
||||
PlymouthSetQuitFunction = Plymouth.SetQuitFunction;
|
||||
PlymouthGetMode = Plymouth.GetMode;
|
||||
|
|
|
|||
|
|
@ -140,3 +140,12 @@ fun progress_callback (duration, progress)
|
|||
}
|
||||
|
||||
PlymouthSetBootProgressFunction(progress_callback);
|
||||
|
||||
#----------------------------------------- Quit --------------------------------
|
||||
|
||||
fun quit_callback ()
|
||||
{
|
||||
logo.sprite.SetOpacity (1);
|
||||
}
|
||||
|
||||
PlymouthSetQuitFunction(quit_callback);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue