mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-06 13:15:25 -05:00
touchscreen: Port yes/no screen to gesture API
Use the gesture API in the yes/no screen to suppress bogus touches and generally improve reliability. Change-Id: I44adf95255f07d81188fd249dc00a91519ca7b99
This commit is contained in:
parent
67233114f7
commit
94468f693f
1 changed files with 11 additions and 12 deletions
|
|
@ -249,6 +249,7 @@ enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res
|
|||
/* switch to point mode because that's more intuitive */
|
||||
enum touchscreen_mode old_mode = touchscreen_get_mode();
|
||||
touchscreen_set_mode(TOUCHSCREEN_POINT);
|
||||
action_gesture_reset();
|
||||
#endif
|
||||
|
||||
/* make sure to eat any extranous keypresses */
|
||||
|
|
@ -277,22 +278,20 @@ enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res
|
|||
{
|
||||
#ifdef HAVE_TOUCHSCREEN
|
||||
case ACTION_TOUCHSCREEN:
|
||||
{
|
||||
struct gesture_event gevent;
|
||||
if (action_gesture_get_event_in_vp(&gevent, &yn[0].vp) &&
|
||||
gevent.id == GESTURE_TAP)
|
||||
{
|
||||
int btn;
|
||||
short int x, y;
|
||||
btn = action_get_touchscreen_press_in_vp(&x, &y, &(yn[0].vp));
|
||||
if (btn == BUTTON_REL)
|
||||
if (gevent.y > yn[0].vp.height/2)
|
||||
{
|
||||
if (y > yn[0].vp.height/2)
|
||||
{
|
||||
if (x <= yn[0].vp.width/2)
|
||||
result = YESNO_YES;
|
||||
else
|
||||
result = YESNO_NO;
|
||||
}
|
||||
if (gevent.x <= yn[0].vp.width/2)
|
||||
result = YESNO_YES;
|
||||
else
|
||||
result = YESNO_NO;
|
||||
}
|
||||
}
|
||||
break;
|
||||
} break;
|
||||
#endif
|
||||
case ACTION_YESNO_ACCEPT:
|
||||
result = YESNO_YES;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue