mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-06 13:15:25 -05:00
touchscreen: Fix event reporting in button driver
The way the button driver reported touch events was problematic and made it impossible to detect if a touch started or if it was a continuation of an existing touch. Now, the first detected touch event gets BUTTON_TOUCHSCREEN and all subsequent touch events while the screen is pressed will get the BUTTON_REPEAT bit set. When the screen is released the final event will have the BUTTON_REL bit set. Change-Id: Ia456a22b2180031555a82231c2af32576bc5f2cb
This commit is contained in:
parent
9f613fd981
commit
c47c075bd3
1 changed files with 18 additions and 10 deletions
|
|
@ -75,8 +75,8 @@ static bool enable_sw_poweroff = true;
|
|||
* real list acceleration kicks in (this smooths acceleration).
|
||||
*
|
||||
* Note that touchscreen pointing events are not subject to this
|
||||
* acceleration and always use REPEAT_INTERVAL_TOUCH. (Do repeat
|
||||
* events even do anything sane for touchscreens??)
|
||||
* acceleration and always use REPEAT_INTERVAL_TOUCH. That value
|
||||
* essentially determines the touchscreen polling rate.
|
||||
*/
|
||||
|
||||
/* the speed repeat starts at, in centiseconds */
|
||||
|
|
@ -324,21 +324,29 @@ static void button_tick(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (count++ > REPEAT_START)
|
||||
++count;
|
||||
if (count > REPEAT_START
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
/* For touch events we want to repost quickly since
|
||||
* the coordinates can change */
|
||||
|| ((btn & BUTTON_TOUCHSCREEN) &&
|
||||
count > REPEAT_INTERVAL_TOUCH)
|
||||
#endif
|
||||
)
|
||||
{
|
||||
post = true;
|
||||
repeat = true;
|
||||
repeat_count = 0;
|
||||
/* initial repeat */
|
||||
count = REPEAT_INTERVAL_START;
|
||||
}
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
else if (lastdata != data && btn == lastbtn)
|
||||
{ /* only coordinates changed, post anyway */
|
||||
if (touchscreen_get_mode() == TOUCHSCREEN_POINT)
|
||||
post = true;
|
||||
}
|
||||
if (btn & BUTTON_TOUCHSCREEN)
|
||||
count = REPEAT_INTERVAL_TOUCH;
|
||||
else
|
||||
#endif
|
||||
{
|
||||
count = REPEAT_INTERVAL_START;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( post )
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue