aboutsummaryrefslogtreecommitdiff
path: root/xlib.py
diff options
context:
space:
mode:
authorSébastien Dailly <sebastien@dailly.me>2025-05-06 19:33:30 +0200
committerSébastien Dailly <sebastien@dailly.me>2025-05-06 19:33:30 +0200
commit4bf1c1ffe795a1d28a543a20cc3771a30a090b89 (patch)
tree09e1bb81744be02fd3a8422f9002ec3139f54100 /xlib.py
parent0d037fd1170ecc30cea677f563dfb50dff7360c6 (diff)
Added a dedicated thread for handling events sent to the endpoint
Diffstat (limited to 'xlib.py')
-rw-r--r--xlib.py9
1 files changed, 5 insertions, 4 deletions
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"