summaryrefslogtreecommitdiff
path: root/firmware/drivers/button.c
diff options
context:
space:
mode:
authorThom Johansen <thomj@rockbox.org>2006-02-10 14:39:19 +0000
committerThom Johansen <thomj@rockbox.org>2006-02-10 14:39:19 +0000
commit1f8529708bd65c87f601d5b425f44755da4c237c (patch)
tree50d7629ab7719cfd240c1d22a915916364702665 /firmware/drivers/button.c
parent1c366425f99d4c9f06705ed71753b1b1d6067b71 (diff)
Make the clickwheel driver stop buffering events if Rockbox is too busy
to handle them. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8650 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/button.c')
-rw-r--r--firmware/drivers/button.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/firmware/drivers/button.c b/firmware/drivers/button.c
index 5ba45bb460..db1033dc82 100644
--- a/firmware/drivers/button.c
+++ b/firmware/drivers/button.c
@@ -174,8 +174,19 @@ static int ipod_4g_button_read(void)
old_wheel_value = new_wheel_value;
}
- if (wheel_keycode != BUTTON_NONE)
- queue_post(&button_queue, wheel_keycode, NULL);
+ if (wheel_keycode != BUTTON_NONE) {
+ /* When you use the clickwheel, the queue should
+ usually have no other events in it, so we check if
+ it's empty to see whether pending clickwheel events
+ have been handled. This way, Rockbox will stop
+ responding to the clickwheel if it doesn't have time
+ to handle the events immediately.
+ Can also implement queue_peek() to do this in a
+ cleaner way.
+ */
+ if (queue_empty(&button_queue))
+ queue_post(&button_queue, wheel_keycode, NULL);
+ }
}
else {
old_wheel_value = new_wheel_value;