From 1850ceefdc2e879e5b84b28d0305a8ddbb915147 Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Mon, 3 Dec 2018 20:17:18 +0100 Subject: [PATCH] [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 --- bumblebee/input.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bumblebee/input.py b/bumblebee/input.py index 40fba85..5fb3032 100644 --- a/bumblebee/input.py +++ b/bumblebee/input.py @@ -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