diff options
author | n3rdopolis <bluescreenavenger@gmail.com> | 2023-12-16 13:27:24 +0000 |
---|---|---|
committer | n3rdopolis <bluescreenavenger@gmail.com> | 2023-12-16 13:27:24 +0000 |
commit | e8251d4f033b50ec194137dd2af9727e6eb3e38e (patch) | |
tree | e03b2df4ac4b536c33927c49b1d603129bf43305 /src/libply-splash-core/ply-pixel-display.c | |
parent | f5e0b9e06c9ad2defb0d553524393b00d413db69 (diff) | |
parent | 7f7c15fc262841e3005e70ebf40c185da6f99cf5 (diff) |
Merge branch 'fixconsoleviewerrefresh' into 'main'
splash plugins: Better handling the redraw of the console viewer when visible,...
See merge request plymouth/plymouth!257
Diffstat (limited to 'src/libply-splash-core/ply-pixel-display.c')
-rw-r--r-- | src/libply-splash-core/ply-pixel-display.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/libply-splash-core/ply-pixel-display.c b/src/libply-splash-core/ply-pixel-display.c index 62398038..6de4b1a0 100644 --- a/src/libply-splash-core/ply-pixel-display.c +++ b/src/libply-splash-core/ply-pixel-display.c @@ -41,6 +41,10 @@ #include "ply-renderer.h" #include "ply-utils.h" +#ifndef FRAMES_PER_SECOND +#define FRAMES_PER_SECOND 60 +#endif + struct _ply_pixel_display { ply_event_loop_t *loop; @@ -58,6 +62,23 @@ struct _ply_pixel_display int pause_count; }; +static void +on_timeout (ply_pixel_display_t *display) +{ + double sleep_time; + + + sleep_time = 1.0 / FRAMES_PER_SECOND; + + ply_pixel_display_unpause_updates (display); + ply_pixel_display_pause_updates (display); + + ply_event_loop_watch_for_timeout (display->loop, + sleep_time, + (ply_event_loop_timeout_handler_t) + on_timeout, display); +} + ply_pixel_display_t * ply_pixel_display_new (ply_renderer_t *renderer, ply_renderer_head_t *head) @@ -182,9 +203,19 @@ ply_pixel_display_set_draw_handler (ply_pixel_display_t *display, ply_pixel_display_draw_handler_t draw_handler, void *user_data) { + double sleep_time; + assert (display != NULL); display->draw_handler = draw_handler; display->draw_handler_user_data = user_data; + + sleep_time = 1.0 / FRAMES_PER_SECOND; + + ply_event_loop_watch_for_timeout (display->loop, + sleep_time, + (ply_event_loop_timeout_handler_t) + on_timeout, display); + ply_pixel_display_pause_updates (display); } |