From 814f42cce092d1a815a38cf846c94c5fb22956a2 Mon Sep 17 00:00:00 2001 From: poire-z Date: Mon, 11 Apr 2022 13:32:28 +0200 Subject: [PATCH] UIManager:discardEvents(): use accurate "now" Instead of UIManager possibly staled _now, which could have no effect after a long ReaderRolling re-rendering. Also lower the delay after such ReaderRolling re-rendering, so we can change settings quicker when comparing renderings. --- frontend/apps/reader/modules/readerrolling.lua | 4 +++- frontend/ui/uimanager.lua | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/apps/reader/modules/readerrolling.lua b/frontend/apps/reader/modules/readerrolling.lua index d4307d946..2c5afb370 100644 --- a/frontend/apps/reader/modules/readerrolling.lua +++ b/frontend/apps/reader/modules/readerrolling.lua @@ -884,7 +884,9 @@ function ReaderRolling:onUpdatePos() self:updatePos() Device:setIgnoreInput(false) -- Allow processing of events (on Android). - UIManager:discardEvents(true) -- Discard events, which might have occured (double tap). + UIManager:discardEvents(0.2) -- Discard events, which might have occurred (double tap). + -- We can use a smaller duration than the default (quite large to avoid accidental dismissals), + -- to allow for quicker setting changes and rendering comparisons. end function ReaderRolling:updatePos() diff --git a/frontend/ui/uimanager.lua b/frontend/ui/uimanager.lua index 03d6296db..c7a544771 100644 --- a/frontend/ui/uimanager.lua +++ b/frontend/ui/uimanager.lua @@ -1081,7 +1081,7 @@ function UIManager:discardEvents(set_or_seconds) else -- we expect a number delay = TimeVal:new{ sec = set_or_seconds, usec = 0 } end - self._discard_events_till = self._now + delay + self._discard_events_till = TimeVal:now() + delay end --[[--