diff options
Diffstat (limited to 'uisimulator/x11/button-x11.c')
-rw-r--r-- | uisimulator/x11/button-x11.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/uisimulator/x11/button-x11.c b/uisimulator/x11/button-x11.c index 08b09cf8cb..673f71ea7b 100644 --- a/uisimulator/x11/button-x11.c +++ b/uisimulator/x11/button-x11.c @@ -55,13 +55,13 @@ static void button_tick(void) static int repeat_speed = REPEAT_INTERVAL_START; static int repeat_count = 0; static bool repeat = false; + static bool post = false; int diff; int btn; /* only poll every X ticks */ if ( ++tick >= POLL_FREQUENCY ) { - bool post = false; button_read(); btn = button_state; @@ -115,9 +115,18 @@ static void button_tick(void) if ( post ) { if (repeat) - queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); + { + if (queue_empty(&button_queue)) + { + queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); + post = false; + } + } else + { queue_post(&button_queue, btn, NULL); + post = false; + } #ifdef HAVE_REMOTE_LCD if(btn & BUTTON_REMOTE) remote_backlight_on(); |