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
This commit is contained in:
Thom Johansen 2006-02-10 14:39:19 +00:00
parent 1c366425f9
commit 1f8529708b

View file

@ -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;