diff options
-rw-r--r-- | apps/gui/list.c | 2 | ||||
-rw-r--r-- | firmware/drivers/button.c | 16 | ||||
-rw-r--r-- | uisimulator/sdl/button.c | 16 | ||||
-rw-r--r-- | uisimulator/win32/button.c | 16 | ||||
-rw-r--r-- | uisimulator/x11/button-x11.c | 13 |
5 files changed, 52 insertions, 11 deletions
diff --git a/apps/gui/list.c b/apps/gui/list.c index b53009a976..472c01c92d 100644 --- a/apps/gui/list.c +++ b/apps/gui/list.c | |||
@@ -604,6 +604,7 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | |||
604 | #endif | 604 | #endif |
605 | gui_synclist_select_previous(lists); | 605 | gui_synclist_select_previous(lists); |
606 | gui_synclist_draw(lists); | 606 | gui_synclist_draw(lists); |
607 | yield(); | ||
607 | return LIST_PREV; | 608 | return LIST_PREV; |
608 | 609 | ||
609 | case LIST_NEXT: | 610 | case LIST_NEXT: |
@@ -619,6 +620,7 @@ unsigned gui_synclist_do_button(struct gui_synclist * lists, unsigned button) | |||
619 | #endif | 620 | #endif |
620 | gui_synclist_select_next(lists); | 621 | gui_synclist_select_next(lists); |
621 | gui_synclist_draw(lists); | 622 | gui_synclist_draw(lists); |
623 | yield(); | ||
622 | return LIST_NEXT; | 624 | return LIST_NEXT; |
623 | 625 | ||
624 | #ifdef LIST_PGRIGHT | 626 | #ifdef LIST_PGRIGHT |
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c index 1cb9472e0f..c4c22641ca 100644 --- a/firmware/drivers/button.c +++ b/firmware/drivers/button.c | |||
@@ -365,6 +365,7 @@ static void button_tick(void) | |||
365 | static int repeat_speed = REPEAT_INTERVAL_START; | 365 | static int repeat_speed = REPEAT_INTERVAL_START; |
366 | static int repeat_count = 0; | 366 | static int repeat_count = 0; |
367 | static bool repeat = false; | 367 | static bool repeat = false; |
368 | static bool post = false; | ||
368 | int diff; | 369 | int diff; |
369 | int btn; | 370 | int btn; |
370 | 371 | ||
@@ -381,7 +382,6 @@ static void button_tick(void) | |||
381 | /* only poll every X ticks */ | 382 | /* only poll every X ticks */ |
382 | if ( ++tick >= POLL_FREQUENCY ) | 383 | if ( ++tick >= POLL_FREQUENCY ) |
383 | { | 384 | { |
384 | bool post = false; | ||
385 | btn = button_read(); | 385 | btn = button_read(); |
386 | 386 | ||
387 | /* Find out if a key has been released */ | 387 | /* Find out if a key has been released */ |
@@ -406,7 +406,8 @@ static void button_tick(void) | |||
406 | { | 406 | { |
407 | if ( repeat ) | 407 | if ( repeat ) |
408 | { | 408 | { |
409 | count--; | 409 | if (!post) |
410 | count--; | ||
410 | if (count == 0) { | 411 | if (count == 0) { |
411 | post = true; | 412 | post = true; |
412 | /* yes we have repeat */ | 413 | /* yes we have repeat */ |
@@ -458,9 +459,18 @@ static void button_tick(void) | |||
458 | if ( post ) | 459 | if ( post ) |
459 | { | 460 | { |
460 | if (repeat) | 461 | if (repeat) |
461 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | 462 | { |
463 | if (queue_empty(&button_queue)) | ||
464 | { | ||
465 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | ||
466 | post = false; | ||
467 | } | ||
468 | } | ||
462 | else | 469 | else |
470 | { | ||
463 | queue_post(&button_queue, btn, NULL); | 471 | queue_post(&button_queue, btn, NULL); |
472 | post = false; | ||
473 | } | ||
464 | #ifdef HAVE_REMOTE_LCD | 474 | #ifdef HAVE_REMOTE_LCD |
465 | if(btn & BUTTON_REMOTE) | 475 | if(btn & BUTTON_REMOTE) |
466 | remote_backlight_on(); | 476 | remote_backlight_on(); |
diff --git a/uisimulator/sdl/button.c b/uisimulator/sdl/button.c index 671cf12d5c..72224315a2 100644 --- a/uisimulator/sdl/button.c +++ b/uisimulator/sdl/button.c | |||
@@ -39,7 +39,6 @@ static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ | |||
39 | 39 | ||
40 | void button_event(int key, bool pressed) | 40 | void button_event(int key, bool pressed) |
41 | { | 41 | { |
42 | bool post = false; | ||
43 | int new_btn = 0; | 42 | int new_btn = 0; |
44 | int diff = 0; | 43 | int diff = 0; |
45 | static int count = 0; | 44 | static int count = 0; |
@@ -47,6 +46,7 @@ void button_event(int key, bool pressed) | |||
47 | static int repeat_speed = REPEAT_INTERVAL_START; | 46 | static int repeat_speed = REPEAT_INTERVAL_START; |
48 | static int repeat_count = 0; | 47 | static int repeat_count = 0; |
49 | static bool repeat = false; | 48 | static bool repeat = false; |
49 | static bool post = false; | ||
50 | 50 | ||
51 | switch (key) | 51 | switch (key) |
52 | { | 52 | { |
@@ -175,7 +175,8 @@ void button_event(int key, bool pressed) | |||
175 | { | 175 | { |
176 | if ( repeat ) | 176 | if ( repeat ) |
177 | { | 177 | { |
178 | count--; | 178 | if (!post) |
179 | count--; | ||
179 | if (count == 0) | 180 | if (count == 0) |
180 | { | 181 | { |
181 | post = true; | 182 | post = true; |
@@ -203,9 +204,18 @@ void button_event(int key, bool pressed) | |||
203 | if ( post ) | 204 | if ( post ) |
204 | { | 205 | { |
205 | if(repeat) | 206 | if(repeat) |
206 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | 207 | { |
208 | if (queue_empty(&button_queue)) | ||
209 | { | ||
210 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | ||
211 | post = false; | ||
212 | } | ||
213 | } | ||
207 | else | 214 | else |
215 | { | ||
208 | queue_post(&button_queue, btn, NULL); | 216 | queue_post(&button_queue, btn, NULL); |
217 | post = false; | ||
218 | } | ||
209 | 219 | ||
210 | #ifdef HAVE_REMOTE_LCD | 220 | #ifdef HAVE_REMOTE_LCD |
211 | if(btn & BUTTON_REMOTE) | 221 | if(btn & BUTTON_REMOTE) |
diff --git a/uisimulator/win32/button.c b/uisimulator/win32/button.c index 7996af583d..8f21fe4396 100644 --- a/uisimulator/win32/button.c +++ b/uisimulator/win32/button.c | |||
@@ -40,7 +40,6 @@ static int btn = 0; /* Hopefully keeps track of currently pressed keys... */ | |||
40 | 40 | ||
41 | void button_event(int key, bool pressed) | 41 | void button_event(int key, bool pressed) |
42 | { | 42 | { |
43 | bool post = false; | ||
44 | int new_btn = 0; | 43 | int new_btn = 0; |
45 | int diff = 0; | 44 | int diff = 0; |
46 | static int count = 0; | 45 | static int count = 0; |
@@ -48,6 +47,7 @@ void button_event(int key, bool pressed) | |||
48 | static int repeat_speed = REPEAT_INTERVAL_START; | 47 | static int repeat_speed = REPEAT_INTERVAL_START; |
49 | static int repeat_count = 0; | 48 | static int repeat_count = 0; |
50 | static bool repeat = false; | 49 | static bool repeat = false; |
50 | static bool post = false; | ||
51 | 51 | ||
52 | switch (key) | 52 | switch (key) |
53 | { | 53 | { |
@@ -176,7 +176,8 @@ void button_event(int key, bool pressed) | |||
176 | { | 176 | { |
177 | if ( repeat ) | 177 | if ( repeat ) |
178 | { | 178 | { |
179 | count--; | 179 | if (!post) |
180 | count--; | ||
180 | if (count == 0) | 181 | if (count == 0) |
181 | { | 182 | { |
182 | post = true; | 183 | post = true; |
@@ -204,9 +205,18 @@ void button_event(int key, bool pressed) | |||
204 | if ( post ) | 205 | if ( post ) |
205 | { | 206 | { |
206 | if(repeat) | 207 | if(repeat) |
207 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | 208 | { |
209 | if (queue_empty(&button_queue)) | ||
210 | { | ||
211 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | ||
212 | post = false; | ||
213 | } | ||
214 | } | ||
208 | else | 215 | else |
216 | { | ||
209 | queue_post(&button_queue, btn, NULL); | 217 | queue_post(&button_queue, btn, NULL); |
218 | post = false; | ||
219 | } | ||
210 | 220 | ||
211 | #ifdef HAVE_REMOTE_LCD | 221 | #ifdef HAVE_REMOTE_LCD |
212 | if(btn & BUTTON_REMOTE) | 222 | if(btn & BUTTON_REMOTE) |
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) | |||
55 | static int repeat_speed = REPEAT_INTERVAL_START; | 55 | static int repeat_speed = REPEAT_INTERVAL_START; |
56 | static int repeat_count = 0; | 56 | static int repeat_count = 0; |
57 | static bool repeat = false; | 57 | static bool repeat = false; |
58 | static bool post = false; | ||
58 | int diff; | 59 | int diff; |
59 | int btn; | 60 | int btn; |
60 | 61 | ||
61 | /* only poll every X ticks */ | 62 | /* only poll every X ticks */ |
62 | if ( ++tick >= POLL_FREQUENCY ) | 63 | if ( ++tick >= POLL_FREQUENCY ) |
63 | { | 64 | { |
64 | bool post = false; | ||
65 | button_read(); | 65 | button_read(); |
66 | btn = button_state; | 66 | btn = button_state; |
67 | 67 | ||
@@ -115,9 +115,18 @@ static void button_tick(void) | |||
115 | if ( post ) | 115 | if ( post ) |
116 | { | 116 | { |
117 | if (repeat) | 117 | if (repeat) |
118 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | 118 | { |
119 | if (queue_empty(&button_queue)) | ||
120 | { | ||
121 | queue_post(&button_queue, BUTTON_REPEAT | btn, NULL); | ||
122 | post = false; | ||
123 | } | ||
124 | } | ||
119 | else | 125 | else |
126 | { | ||
120 | queue_post(&button_queue, btn, NULL); | 127 | queue_post(&button_queue, btn, NULL); |
128 | post = false; | ||
129 | } | ||
121 | #ifdef HAVE_REMOTE_LCD | 130 | #ifdef HAVE_REMOTE_LCD |
122 | if(btn & BUTTON_REMOTE) | 131 | if(btn & BUTTON_REMOTE) |
123 | remote_backlight_on(); | 132 | remote_backlight_on(); |