From 1f8529708bd65c87f601d5b425f44755da4c237c Mon Sep 17 00:00:00 2001 From: Thom Johansen Date: Fri, 10 Feb 2006 14:39:19 +0000 Subject: 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 --- firmware/drivers/button.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'firmware') 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; -- cgit v1.2.3