mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Input: Process input events in batches (#7483)
Requires https://github.com/koreader/koreader-base/pull/1344 & https://github.com/koreader/koreader-base/pull/1346 (fix #7485) Assorted input fixes: * Actually handle errors in the "there's a callback timer" input polling loop. * Don't break timerfd when the clock probe was inconclusive. Not directly related, but noticed because of duplicate onInputEvent handlers: * HookContainer: Fix deregistration to actually deregister properly. "Regression" extant since its inception in #2933 (!). * Made sure the three plugins (basically the trio of AutoThingies ;p) that were using HookContainer actually unschedule their task on teardown.
This commit is contained in:
@@ -49,16 +49,18 @@ end
|
||||
function HookContainer:registerWidget(name, widget)
|
||||
self:_assertIsValidName(name)
|
||||
assert(type(widget) == "table")
|
||||
self:register(name, function(args)
|
||||
-- *That* is the function we actually register and need to unregister later, so keep a ref to it...
|
||||
local hook_func = function(args)
|
||||
local f = widget["on" .. name]
|
||||
self:_assertIsValidFunction(f)
|
||||
f(widget, args)
|
||||
end)
|
||||
end
|
||||
self:register(name, hook_func)
|
||||
local original_close_widget = widget.onCloseWidget
|
||||
self:_assertIsValidFunctionOrNil(original_close_widget)
|
||||
widget.onCloseWidget = function()
|
||||
if original_close_widget then original_close_widget(widget) end
|
||||
self:unregister(name, widget["on" .. name])
|
||||
self:unregister(name, hook_func)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user