mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-06 21:25:03 -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 */
|
/* switch to point mode because that's more intuitive */
|
||||||
enum touchscreen_mode old_mode = touchscreen_get_mode();
|
enum touchscreen_mode old_mode = touchscreen_get_mode();
|
||||||
touchscreen_set_mode(TOUCHSCREEN_POINT);
|
touchscreen_set_mode(TOUCHSCREEN_POINT);
|
||||||
|
action_gesture_reset();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* make sure to eat any extranous keypresses */
|
/* make sure to eat any extranous keypresses */
|
||||||
|
|
@ -278,21 +279,19 @@ enum yesno_res gui_syncyesno_run_w_tmo(int ticks, enum yesno_res tmo_default_res
|
||||||
#ifdef HAVE_TOUCHSCREEN
|
#ifdef HAVE_TOUCHSCREEN
|
||||||
case ACTION_TOUCHSCREEN:
|
case ACTION_TOUCHSCREEN:
|
||||||
{
|
{
|
||||||
int btn;
|
struct gesture_event gevent;
|
||||||
short int x, y;
|
if (action_gesture_get_event_in_vp(&gevent, &yn[0].vp) &&
|
||||||
btn = action_get_touchscreen_press_in_vp(&x, &y, &(yn[0].vp));
|
gevent.id == GESTURE_TAP)
|
||||||
if (btn == BUTTON_REL)
|
|
||||||
{
|
{
|
||||||
if (y > yn[0].vp.height/2)
|
if (gevent.y > yn[0].vp.height/2)
|
||||||
{
|
{
|
||||||
if (x <= yn[0].vp.width/2)
|
if (gevent.x <= yn[0].vp.width/2)
|
||||||
result = YESNO_YES;
|
result = YESNO_YES;
|
||||||
else
|
else
|
||||||
result = YESNO_NO;
|
result = YESNO_NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} break;
|
||||||
break;
|
|
||||||
#endif
|
#endif
|
||||||
case ACTION_YESNO_ACCEPT:
|
case ACTION_YESNO_ACCEPT:
|
||||||
result = YESNO_YES;
|
result = YESNO_YES;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue