skin: touchscreen: fix rewind in long files

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]> Mon, 1 Jun 2026 04:26:06 -0400
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit c052d11673e0fea7bd426adfa851de2e24adc99b
Author: Roman Artiukhin <[email protected]>
Date:   Sat May 30 12:49:12 2026 +0300

    skin: touchscreen: fix rewind in long files
    
    Fix a possible overflow in the elapsed time calculation.
    
    Change-Id: I211777d8144f76889003239b9a49e4fc56184c8f

diff --git a/apps/gui/skin_engine/skin_touchsupport.c b/apps/gui/skin_engine/skin_touchsupport.c
index 7098d8aa05..7d05d4ea5c 100644
--- a/apps/gui/skin_engine/skin_touchsupport.c
+++ b/apps/gui/skin_engine/skin_touchsupport.c
@@ -204,24 +204,11 @@ int skin_get_touchaction(struct gui_wps *gwps, int* edge_offset)
         if (!gwps->id3)
             break;
 
-        if (gevent.id == GESTURE_HOLD ||
-            gevent.id == GESTURE_DRAGSTART ||
-            gevent.id == GESTURE_DRAG)
-        {
-            audio_pre_ff_rewind();
-            gwps->id3->elapsed = gwps->id3->length * (*edge_offset) / 1000;
-        }
-        else if (gevent.id == GESTURE_RELEASE)
-        {
-            audio_ff_rewind(gwps->id3->elapsed);
-        }
-        else
-        {
-            gwps->id3->elapsed = gwps->id3->length * (*edge_offset) / 1000;
-            audio_pre_ff_rewind();
-            audio_ff_rewind(gwps->id3->elapsed);
-        }
+        audio_pre_ff_rewind();
+        gwps->id3->elapsed = gwps->id3->length / 1000 * (*edge_offset);
 
+        if (gevent.id == GESTURE_TAP || gevent.id == GESTURE_RELEASE)
+            audio_ff_rewind(gwps->id3->elapsed);
     } break;
 
     case ACTION_TOUCH_VOLUME:
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs