forked from len0rd/rockbox
erosq: When mucking with the clickwheel, ensure we keep the screen awake!
Change-Id: I49d39f301f4b44c2477a657e2af964b97d73cf6b
This commit is contained in:
parent
cd64aa2b10
commit
13dbcab6c0
2 changed files with 30 additions and 5 deletions
|
@ -687,7 +687,7 @@ static int button_read(void)
|
||||||
status twice in a row. */
|
status twice in a row. */
|
||||||
#ifndef HAVE_TOUCHSCREEN
|
#ifndef HAVE_TOUCHSCREEN
|
||||||
if (btn != last_read)
|
if (btn != last_read)
|
||||||
retval = lastbtn;
|
retval = lastbtn;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
retval = btn;
|
retval = btn;
|
||||||
|
|
|
@ -33,6 +33,22 @@
|
||||||
#include "button.h"
|
#include "button.h"
|
||||||
#include "panic.h"
|
#include "panic.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_SCROLLWHEEL
|
||||||
|
#include "powermgmt.h"
|
||||||
|
#if defined(HAVE_BACKLIGHT) || defined(HAVE_BUTTON_LIGHT)
|
||||||
|
#include "backlight.h"
|
||||||
|
#endif
|
||||||
|
#endif /* HAVE_SCROLLWHEEL */
|
||||||
|
|
||||||
|
/* TODO: HAVE_SCROLLWHEEL is a hack. Instead of posting the exact number
|
||||||
|
of clicks, instead do it similar to the ipod clickwheel and post
|
||||||
|
the wheel angular velocity (degrees per second)
|
||||||
|
|
||||||
|
* Track the relative position (ie based on click events)
|
||||||
|
* Use WHEELCLICKS_PER_ROTATION to convert clicks to angular distance
|
||||||
|
* Compute to angular velocity (degrees per second)
|
||||||
|
|
||||||
|
*/
|
||||||
#define NR_POLL_DESC 4
|
#define NR_POLL_DESC 4
|
||||||
|
|
||||||
static int num_devices = 0;
|
static int num_devices = 0;
|
||||||
|
@ -150,8 +166,17 @@ int button_read_device(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SCROLLWHEEL
|
#ifdef HAVE_SCROLLWHEEL
|
||||||
// TODO: Is there a better way to handle this?
|
/* Reset backlight and poweroff timers */
|
||||||
// TODO: enable BUTTON_REPEAT if the events happen quickly enough
|
if (wheel_ticks) {
|
||||||
|
#ifdef HAVE_BACKLIGHT
|
||||||
|
backlight_on();
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_BUTTON_LIGHT
|
||||||
|
buttonlight_on();
|
||||||
|
#endif
|
||||||
|
reset_poweroff_timer();
|
||||||
|
}
|
||||||
|
|
||||||
if (wheel_ticks > 0)
|
if (wheel_ticks > 0)
|
||||||
{
|
{
|
||||||
while (wheel_ticks-- > 0)
|
while (wheel_ticks-- > 0)
|
||||||
|
@ -159,14 +184,14 @@ int button_read_device(void)
|
||||||
queue_post(&button_queue, BUTTON_SCROLL_FWD, 0);
|
queue_post(&button_queue, BUTTON_SCROLL_FWD, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (wheel_ticks < 0)
|
||||||
{
|
{
|
||||||
while (wheel_ticks++ < 0)
|
while (wheel_ticks++ < 0)
|
||||||
{
|
{
|
||||||
queue_post(&button_queue, BUTTON_SCROLL_BACK, 0);
|
queue_post(&button_queue, BUTTON_SCROLL_BACK, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* HAVE_SCROLLWHEEL */
|
||||||
|
|
||||||
return button_bitmap;
|
return button_bitmap;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue