Minor Input & TimeVal cleanups

* Input: Don't create a new TimeVal object for input frame timestamps, just promote our existing table by assigning it the `TimeVal` metatable.
* TimeVal: Export (const) `zero` & `huge` TimeVal objects, because they're common enough in our codebase. (NOTE: not actually const, that's a Lua 5.4 feature ;p).
* GestureDetector: Explain the behavior of the `last_tevs` & `first_tevs` tables, and why one needs a new object and not the other.
* Speaking of, simplify the copy method for `first_tevs`, because it doesn't need to create a new TimeVal object, we can just reference the original, it's unique and re-assigned for each frame.
This commit is contained in:
NiLuJe
2021-04-15 01:00:28 +02:00
parent fce63d3c0f
commit 3274183466
17 changed files with 65 additions and 50 deletions

View File

@@ -1101,8 +1101,8 @@ function ReaderRolling:handleEngineCallback(ev, ...)
-- ignore other events
end
local ENGINE_PROGRESS_INITIAL_DELAY = TimeVal:new{ sec = 2 }
local ENGINE_PROGRESS_UPDATE_DELAY = TimeVal:new{ usec = 500000 }
local ENGINE_PROGRESS_INITIAL_DELAY = TimeVal:new{ sec = 2, usec = 0 }
local ENGINE_PROGRESS_UPDATE_DELAY = TimeVal:new{ sec = 0, usec = 500000 }
function ReaderRolling:showEngineProgress(percent)
if G_reader_settings and G_reader_settings:isFalse("cre_show_progress") then