touchscreen: Fix seeking to end of track in WPS

Seeking to the very end of the track with the touchscreen caused
rapid skipping through the playlist because each touch event
generates a separate seek operation, kind of like rapidly pressing
a physical button. Fix this bug by executing the seek operation
only for the release event.

Change-Id: Ic1080065a68e7cc2ba98e2f27293c954f2ec8fb2
This commit is contained in:
Aidan MacDonald 2022-07-28 21:07:16 +01:00
parent 010d22ed29
commit 02ad19c959
3 changed files with 21 additions and 3 deletions

View file

@ -103,12 +103,12 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset)
case ACTION_TOUCH_SCROLLBAR:
case ACTION_TOUCH_VOLUME:
case ACTION_TOUCH_SETTING:
/* we need something press-like */
/* accept taps and drags, ignore the rest */
if (!(gevent.id == GESTURE_TAP ||
gevent.id == GESTURE_LONG_PRESS ||
gevent.id == GESTURE_HOLD ||
gevent.id == GESTURE_DRAGSTART ||
gevent.id == GESTURE_DRAG))
gevent.id == GESTURE_DRAG ||
gevent.id == GESTURE_RELEASE))
break;
if (edge_offset)
@ -194,6 +194,15 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset)
switch (action)
{
case ACTION_TOUCH_SCROLLBAR:
if (gevent.id == GESTURE_HOLD ||
gevent.id == GESTURE_DRAGSTART ||
gevent.id == GESTURE_DRAG)
action = ACTION_TOUCH_SCROLLBAR_SET;
else if (gevent.id == GESTURE_RELEASE)
action = ACTION_TOUCH_SCROLLBAR_END;
break;
case ACTION_TOUCH_SOFTLOCK:
data->touchscreen_locked = !data->touchscreen_locked;
action = ACTION_NONE;

View file

@ -193,6 +193,13 @@ static int skintouch_to_wps(void)
case ACTION_STD_HOTKEY:
return ACTION_WPS_HOTKEY;
#endif
case ACTION_TOUCH_SCROLLBAR_SET:
audio_pre_ff_rewind();
gstate->id3->elapsed = gstate->id3->length*offset/1000;
return ACTION_TOUCHSCREEN;
case ACTION_TOUCH_SCROLLBAR_END:
audio_ff_rewind(gstate->id3->elapsed);
return ACTION_TOUCHSCREEN;
case ACTION_TOUCH_SCROLLBAR:
gstate->id3->elapsed = gstate->id3->length*offset/1000;
audio_pre_ff_rewind();