1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-07-26 16:45:12 -04:00

[terminal] Periodically refresh screen

DISPLAY_TIME_REFRESH 50ms (No more than 20fps).
It is still using too much CPU for refreshing screen.
This commit is contained in:
Witold Filipczyk 2022-12-11 16:22:41 +01:00
parent 3b1c5ce751
commit 37cc5f52eb
2 changed files with 11 additions and 1 deletions

View File

@ -489,6 +489,15 @@ set_handlers(int fd, select_handler_T read_func, select_handler_T write_func,
}
}
static timer_id_T periodic_redraw_timer = TIMER_ID_UNDEF;
static void
periodic_redraw_all_terminals(void *data)
{
redraw_all_terminals();
install_timer(&periodic_redraw_timer, DISPLAY_TIME_REFRESH, periodic_redraw_all_terminals, NULL);
}
void
select_loop(void (*init)(void))
{
@ -515,12 +524,12 @@ select_loop(void (*init)(void))
}
#endif
if (event_enabled) {
periodic_redraw_all_terminals(NULL);
while (!program.terminate) {
check_signals();
if (1 /*(!F)*/) {
do_event_loop(EVLOOP_NONBLOCK);
check_signals();
redraw_all_terminals();
}
if (program.terminate) break;
do_event_loop(EVLOOP_ONCE);

View File

@ -61,6 +61,7 @@
#define DISPLAY_TIME_MIN ((milliseconds_T) 200)
#define DISPLAY_TIME 20
#define DISPLAY_TIME_REFRESH ((milliseconds_T) 50)
#define HTML_LEFT_MARGIN 3
#define HTML_MAX_TABLE_LEVEL 10