From 4bf1c1ffe795a1d28a543a20cc3771a30a090b89 Mon Sep 17 00:00:00 2001 From: Sébastien Dailly Date: Tue, 6 May 2025 19:33:30 +0200 Subject: Added a dedicated thread for handling events sent to the endpoint --- xlib.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'xlib.py') diff --git a/xlib.py b/xlib.py index 051b21f..20476aa 100644 --- a/xlib.py +++ b/xlib.py @@ -8,12 +8,13 @@ from threading import Thread from interfaces.message import IMessage, Debug from zope import component +from consumer import Mapping + @interface.implementer(desktopEvent.IDesktop) class Listener(Thread): - def __init__(self, mapping, queue): + def __init__(self, mapping): Thread.__init__(self) - self.queue = queue self.mapping = mapping self.active_window = None self.last_code = None @@ -80,7 +81,7 @@ class Listener(Thread): if code != self.last_code: component.handle(Debug("Switching to '%s' for '%s'" % (pattern, window_name))) - self.queue.put ( (code, None) ) + component.handle(Mapping((code, None))) self.last_code = code # We found a matching configuration. Even if the match is the # same as the current one, we break the loop in order to @@ -91,7 +92,7 @@ class Listener(Thread): if default is None: return - self.queue.put ( (default, None) ) + component.handle(Mapping((default, None))) self.last_code = "default" -- cgit v1.2.3