[core/input] Ugly hack for responsiveness

Somehow, the fix in the previous commit didn't work, it seems that
sometimes epoll() doesn't trigger, even if there is more data in
sys.stdin. I'm sure I'm doing something horribly wrong here.

Anyhow, as a quick fix, check for the open bracket to be sure to not
buffer the first event too long.
This commit is contained in:
Tobi-wan Kenobi 2016-12-17 08:04:21 +01:00
parent f6be25bc73
commit 220bb9bf60

View file

@ -18,14 +18,16 @@ def read_input(inp):
"""Read i3bar input and execute callbacks""" """Read i3bar input and execute callbacks"""
epoll = select.epoll() epoll = select.epoll()
epoll.register(sys.stdin.fileno(), select.EPOLLIN) epoll.register(sys.stdin.fileno(), select.EPOLLIN)
f = open("/tmp/bee.log", "a")
while inp.running: while inp.running:
for thread in threading.enumerate(): for thread in threading.enumerate():
if thread.name == "MainThread" and not thread.is_alive(): if thread.name == "MainThread" and not thread.is_alive():
return return
events = epoll.poll(1) events = epoll.poll(1)
for fileno, event in events: for fileno, event in events:
line = "["
while "[" in line:
line = sys.stdin.readline().strip(",").strip() line = sys.stdin.readline().strip(",").strip()
inp.has_event = True inp.has_event = True
try: try: