UIManager: Simplify setPMInputTimeout (from #9173)

This was originally designed for finer-grainbed control (specifically,
to correct by the amount of time spent in standby), but the final fix
only ever sets this to 0.

Simplify and rename (consumeInputEarlyAfterPM) to avoid useless computations.
pull/9202/head
NiLuJe 2 years ago
parent 299c34a49c
commit 2e681353d7

@ -1659,11 +1659,11 @@ function UIManager:handleInput()
-- this function emits (plugin), or within waitEvent() right after (hardware).
-- Anywhere else breaks preventStandby/allowStandby invariants used by background jobs while UI is left running.
self:_standbyTransition()
if self.PM_INPUT_TIMEOUT then
if self._pm_consume_input_early then
-- If the PM state transition requires an early return from input polling, honor that.
-- c.f., UIManager:setPMInputTimeout (and AutoSuspend:AllowStandbyHandler).
deadline = now + time.s(self.PM_INPUT_TIMEOUT)
self.PM_INPUT_TIMEOUT = nil
deadline = now
self._pm_consume_input_early = false
end
-- wait for next batch of events
@ -1847,10 +1847,10 @@ function UIManager:_standbyTransition()
self._prev_prevent_standby_count = self._prevent_standby_count
end
-- Used by a PM transition event handler to request an early return from input polling (value in s).
-- Used by a PM transition event handler to request an early return from input polling.
-- NOTE: We can't re-use setInputTimeout to avoid interactions with ZMQ...
function UIManager:setPMInputTimeout(timeout)
self.PM_INPUT_TIMEOUT = timeout
function UIManager:consumeInputEarlyAfterPM(toggle)
self._pm_consume_input_early = toggle
end
--- Broadcasts a `FlushSettings` Event to *all* widgets.

@ -605,7 +605,7 @@ function AutoSuspend:AllowStandbyHandler()
-- even when there isn't actually any user input happening (e.g., woken up by the rtc alarm).
-- This shouldn't prevent us from actually consuming any pending input events first,
-- because if we were woken up by user input, those events should already be in the evdev queue...
UIManager:setPMInputTimeout(0)
UIManager:consumeInputEarlyAfterPM(true)
end
end

Loading…
Cancel
Save