[core/engine] Ensure that full updates still take place regularly

Ensure that a full update still happens, even if continuous scrolling
triggers new events (and therefore, partial updates) all the time.

see #353
This commit is contained in:
Tobias Witek 2019-01-19 14:18:48 +01:00
parent 2b91ce5861
commit 23be352ec3

View file

@ -265,13 +265,16 @@ class Engine(object):
"""Start the event loop"""
self._output.start()
event = None
last_full = time.time()
interval = float(self._config.get("interval", 1))
while self.running():
if event:
if event and time.time() - last_full < interval:
self.patch_output(event)
else:
last_full = time.time()
self.write_output()
if self.running():
event = self.input.wait(float(self._config.get("interval", 1)))
event = self.input.wait(interval)
self._output.stop()
self.input.stop()