FS#10148 by Dustin Skoracki, removes a redundant check for != BUTTON_NONE in the scrollwheel drivers.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20744 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-04-19 17:05:36 +00:00
parent 19fde6c0c0
commit aef5731d71
2 changed files with 41 additions and 48 deletions

View file

@ -100,33 +100,29 @@ static void scrollwheel(short dbop_din)
old_btn = btn; old_btn = btn;
repeat = counter = 0; repeat = counter = 0;
} }
if (btn != BUTTON_NONE) /* wheel_delta will cause lists to jump over items,
* we want this for fast scrolling, but we must keep it accurate
* for slow scrolling */
int wheel_delta = 0;
/* generate repeats if quick enough, scroll slightly too*/
if (TIME_BEFORE(current_tick, last_wheel_post + WHEEL_REPEAT_INTERVAL))
{ {
/* wheel_delta will cause lists to jump over items, btn |= BUTTON_REPEAT;
* we want this for fast scrolling, but we must keep it accurate wheel_delta = repeat>>2;
* for slow scrolling */ }
int wheel_delta = 0;
/* generate repeats if quick enough, scroll slightly too*/
if (TIME_BEFORE(current_tick, last_wheel_post + WHEEL_REPEAT_INTERVAL))
{
btn |= BUTTON_REPEAT;
wheel_delta = repeat>>2;
}
repeat += 2; repeat += 2;
/* the wheel is more reliable if we don't send ever change,
/* the wheel is more reliable if we don't send ever change, * every 2th is basically one "physical click" is
* every 2th is basically one "physical click" is * 1 item in the rockbox menus */
* 1 item in the rockbox menus */ if (++counter >= 2 && queue_empty(&button_queue))
if (++counter >= 2 && queue_empty(&button_queue)) {
{ buttonlight_on();
buttonlight_on(); backlight_on();
backlight_on(); queue_post(&button_queue, btn, ((wheel_delta+1)<<24));
queue_post(&button_queue, btn, ((wheel_delta+1)<<24)); /* message posted - reset count & last post to the queue */
/* message posted - reset count & last post to the queue */ counter = 0;
counter = 0; last_wheel_post = current_tick;
last_wheel_post = current_tick;
}
} }
} }
if (repeat > 0) if (repeat > 0)

View file

@ -99,32 +99,29 @@ static void scrollwheel(short dbop_din)
old_btn = btn; old_btn = btn;
repeat = counter = 0; repeat = counter = 0;
} }
if (btn != BUTTON_NONE) /* wheel_delta will cause lists to jump over items,
* we want this for fast scrolling, but we must keep it accurate
* for slow scrolling */
int wheel_delta = 0;
/* generate repeats if quick enough, scroll slightly faster too*/
if (repeat > 1)
{ {
/* wheel_delta will cause lists to jump over items, btn |= BUTTON_REPEAT;
* we want this for fast scrolling, but we must keep it accurate wheel_delta = repeat>>2;
* for slow scrolling */ }
int wheel_delta = 0;
/* generate repeats if quick enough, scroll slightly faster too*/
if (repeat > 1)
{
btn |= BUTTON_REPEAT;
wheel_delta = repeat>>2;
}
repeat += 2; repeat += 2;
/* the wheel is more reliable if we don't send ever change, /* the wheel is more reliable if we don't send ever change,
* every 4th is basically one "physical click" is 1 item in * every 4th is basically one "physical click" is 1 item in
* the rockbox menus */ * the rockbox menus */
if (++counter >= 4 && queue_empty(&button_queue)) if (++counter >= 4 && queue_empty(&button_queue))
{ {
buttonlight_on(); buttonlight_on();
backlight_on(); backlight_on();
queue_post(&button_queue, btn, ((wheel_delta+1)<<24)); queue_post(&button_queue, btn, ((wheel_delta+1)<<24));
/* message posted - reset count */ /* message posted - reset count */
counter = 0; counter = 0;
}
} }
} }
if (repeat > 0) if (repeat > 0)