[core] input: add logging for input events
to debug input event issues (which seem to become more frequent), add some input event logging. see #336
This commit is contained in:
parent
37faef033e
commit
1850ceefdc
1 changed files with 10 additions and 2 deletions
|
@ -5,9 +5,12 @@ import json
|
|||
import uuid
|
||||
import time
|
||||
import select
|
||||
import logging
|
||||
import threading
|
||||
import bumblebee.util
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
LEFT_MOUSE = 1
|
||||
MIDDLE_MOUSE = 2
|
||||
RIGHT_MOUSE = 3
|
||||
|
@ -24,6 +27,7 @@ def read_input(inp):
|
|||
"""Read i3bar input and execute callbacks"""
|
||||
epoll = select.epoll()
|
||||
epoll.register(sys.stdin.fileno(), select.EPOLLIN)
|
||||
log.debug("starting click event processing")
|
||||
while inp.running:
|
||||
if is_terminated():
|
||||
return
|
||||
|
@ -36,14 +40,18 @@ def read_input(inp):
|
|||
line = "["
|
||||
while line.startswith("["):
|
||||
line = sys.stdin.readline().strip(",").strip()
|
||||
log.debug("new event: {}".format(line))
|
||||
inp.has_event = True
|
||||
try:
|
||||
event = json.loads(line)
|
||||
if "instance" in event:
|
||||
inp.callback(event)
|
||||
inp.redraw()
|
||||
except ValueError:
|
||||
pass
|
||||
else:
|
||||
log.debug("field 'instance' missing in input, not processing the event")
|
||||
except ValueError as e:
|
||||
log.debug("failed to parse event: {}".format(e))
|
||||
log.debug("exiting click event processing")
|
||||
epoll.unregister(sys.stdin.fileno())
|
||||
epoll.close()
|
||||
inp.has_event = True
|
||||
|
|
Loading…
Reference in a new issue