mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-03-03 16:56:07 +00:00
use friendlier event enums
This commit is contained in:
parent
af482d3da1
commit
e382737fda
@ -6,9 +6,9 @@ from trezor.utils import unimport_func
|
|||||||
def multiplex_touch_events(gens):
|
def multiplex_touch_events(gens):
|
||||||
while True:
|
while True:
|
||||||
e, (x, y) = yield loop.Wait([
|
e, (x, y) = yield loop.Wait([
|
||||||
loop.EVT_TSTART,
|
loop.TOUCH_START,
|
||||||
loop.EVT_TMOVE,
|
loop.TOUCH_MOVE,
|
||||||
loop.EVT_TEND,
|
loop.TOUCH_END,
|
||||||
])
|
])
|
||||||
for gen in gens:
|
for gen in gens:
|
||||||
gen.send((e, (x, y)))
|
gen.send((e, (x, y)))
|
||||||
@ -23,7 +23,7 @@ def in_area(pos, area):
|
|||||||
def click_in(area, enter, leave):
|
def click_in(area, enter, leave):
|
||||||
while True:
|
while True:
|
||||||
e, pos = yield
|
e, pos = yield
|
||||||
if e is not loop.EVT_TSTART or not in_area(pos, area):
|
if e is not loop.TOUCH_START or not in_area(pos, area):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
inside = True
|
inside = True
|
||||||
@ -31,7 +31,7 @@ def click_in(area, enter, leave):
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
e, pos = yield
|
e, pos = yield
|
||||||
if e is loop.EVT_TMOVE:
|
if e is loop.TOUCH_MOVE:
|
||||||
if in_area(pos, area):
|
if in_area(pos, area):
|
||||||
if not inside:
|
if not inside:
|
||||||
enter()
|
enter()
|
||||||
@ -40,7 +40,7 @@ def click_in(area, enter, leave):
|
|||||||
if inside:
|
if inside:
|
||||||
leave()
|
leave()
|
||||||
inside = False
|
inside = False
|
||||||
elif e is loop.EVT_TEND:
|
elif e is loop.TOUCH_END:
|
||||||
if in_area(pos, area):
|
if in_area(pos, area):
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
|
@ -5,16 +5,16 @@ from .utils import type_gen
|
|||||||
from . import msg
|
from . import msg
|
||||||
from . import log
|
from . import log
|
||||||
|
|
||||||
EVT_TSTART = const(-1)
|
TOUCH_START = const(-1)
|
||||||
EVT_TMOVE = const(-2)
|
TOUCH_MOVE = const(-2)
|
||||||
EVT_TEND = const(-3)
|
TOUCH_END = const(-3)
|
||||||
EVT_MSG = const(-4)
|
MESSAGE = const(-4)
|
||||||
|
|
||||||
event_handlers = {
|
event_handlers = {
|
||||||
EVT_TSTART: None,
|
TOUCH_START: None,
|
||||||
EVT_TMOVE: None,
|
TOUCH_MOVE: None,
|
||||||
EVT_TEND: None,
|
TOUCH_END: None,
|
||||||
EVT_MSG: None,
|
MESSAGE: None,
|
||||||
}
|
}
|
||||||
time_queue = []
|
time_queue = []
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user