allow to only poll UI event every X frames
This commit is contained in:
parent
eee03e3b8e
commit
389964ae7e
1 changed files with 13 additions and 4 deletions
17
src/main.c
17
src/main.c
|
@ -18,15 +18,24 @@
|
||||||
#define CONDITION_STACK_SIZE 16
|
#define CONDITION_STACK_SIZE 16
|
||||||
#define HANDLER_STACK_SIZE 8
|
#define HANDLER_STACK_SIZE 8
|
||||||
|
|
||||||
|
#define QUERY_EVENTS_EVERY_X_FRAME 4
|
||||||
|
|
||||||
void signal_handler( int sig )
|
void signal_handler( int sig )
|
||||||
{
|
{
|
||||||
|
static int nb_refreshes_since_last_checking_events = 0;
|
||||||
|
|
||||||
switch ( sig ) {
|
switch ( sig ) {
|
||||||
/* case SIGINT: /\* Ctrl-C *\/ */
|
/* case SIGINT: /\* Ctrl-C *\/ */
|
||||||
/* enter_debugger |= USER_INTERRUPT; */
|
/* enter_debugger |= USER_INTERRUPT; */
|
||||||
/* break; */
|
/* break; */
|
||||||
case SIGALRM:
|
case SIGALRM:
|
||||||
ui_get_event();
|
if ( nb_refreshes_since_last_checking_events > QUERY_EVENTS_EVERY_X_FRAME ) {
|
||||||
|
nb_refreshes_since_last_checking_events = 0;
|
||||||
|
ui_get_event();
|
||||||
|
}
|
||||||
ui_update_display();
|
ui_update_display();
|
||||||
|
nb_refreshes_since_last_checking_events++;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SIGPIPE:
|
case SIGPIPE:
|
||||||
ui_stop();
|
ui_stop();
|
||||||
|
|
Loading…
Reference in a new issue