mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-14 03:30:02 +00:00
core: allow inserting synthetic touch events into event loop
This commit is contained in:
parent
a1a543f781
commit
8c3d93619e
@ -50,6 +50,9 @@ if __debug__:
|
||||
log_delay_rb_len = const(10)
|
||||
log_delay_rb = array.array("i", [0] * log_delay_rb_len)
|
||||
|
||||
# synthetic event queue
|
||||
synthetic_events = [] # type: List[Tuple[int, Any]]
|
||||
|
||||
|
||||
def schedule(
|
||||
task: Task, value: Any = None, deadline: int = None, finalizer: Finalizer = None
|
||||
@ -125,6 +128,15 @@ def run() -> None:
|
||||
log_delay_rb[log_delay_pos] = delay
|
||||
log_delay_pos = (log_delay_pos + 1) % log_delay_rb_len
|
||||
|
||||
# process synthetic events
|
||||
if synthetic_events:
|
||||
iface, event = synthetic_events[0]
|
||||
msg_tasks = _paused.pop(iface, ())
|
||||
if msg_tasks:
|
||||
synthetic_events.pop(0)
|
||||
for task in msg_tasks:
|
||||
_step(task, event)
|
||||
|
||||
if io.poll(_paused, msg_entry, delay):
|
||||
# message received, run tasks paused on the interface
|
||||
msg_tasks = _paused.pop(msg_entry[0], ())
|
||||
|
Loading…
Reference in New Issue
Block a user