[presto] reduce touch debounce while searching

This commit is contained in:
Claudio Ortolina
2026-05-16 21:39:26 +01:00
parent 56c0e0c8b1
commit 890edc6f9a
2 changed files with 22 additions and 1 deletions
+9 -1
View File
@@ -173,6 +173,7 @@ MONTH_NAMES = [
# Touch debounce (milliseconds)
DEBOUNCE_MS = 300
KEYBOARD_DEBOUNCE_MS = 80
DRAG_REDRAW_MS = 40
DRAG_REDRAW_PX = px(8)
TOUCH_RELEASE_TIMEOUT_MS = 3_000
@@ -2287,6 +2288,13 @@ def read_touch():
return None
def _touch_debounce_ms(app):
"""Return the active debounce threshold for the current screen."""
if app.screen == STATE_SEARCH_INPUT:
return KEYBOARD_DEBOUNCE_MS
return DEBOUNCE_MS
def _normalise_touch(point):
"""Convert common touch return shapes to (x, y)."""
if not point:
@@ -2692,7 +2700,7 @@ def main():
continue
x, y = touch_point
if time.ticks_diff(now, app.touch.last_touch) < DEBOUNCE_MS:
if time.ticks_diff(now, app.touch.last_touch) < _touch_debounce_ms(app):
time.sleep(0.02)
continue
app.touch.last_touch = now