From 02ad19c959817c56faa9fa5078f6c3137b9bf8b4 Mon Sep 17 00:00:00 2001 From: Aidan MacDonald Date: Thu, 28 Jul 2022 21:07:16 +0100 Subject: [PATCH] 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 --- apps/action.h | 2 ++ apps/gui/skin_engine/skin_touchsupport.c | 15 ++++++++++++--- apps/gui/wps.c | 7 +++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/apps/action.h b/apps/action.h index 36f5901b84..03a3a084c4 100644 --- a/apps/action.h +++ b/apps/action.h @@ -303,6 +303,8 @@ enum { ACTION_TOUCH_REPMODE, ACTION_TOUCH_MUTE, ACTION_TOUCH_SCROLLBAR, + ACTION_TOUCH_SCROLLBAR_SET, + ACTION_TOUCH_SCROLLBAR_END, ACTION_TOUCH_VOLUME, ACTION_TOUCH_SOFTLOCK, ACTION_TOUCH_SETTING, diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c index 7eeed6ecb4..719e5513b6 100644 --- a/apps/gui/skin_engine/skin_touchsupport.c +++ b/apps/gui/skin_engine/skin_touchsupport.c @@ -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; diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 416653cf18..c39d8afc4c 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -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();