diff options
author | Sébastien Dailly <sebastien@dailly.me> | 2025-05-06 19:33:30 +0200 |
---|---|---|
committer | Sébastien Dailly <sebastien@dailly.me> | 2025-05-06 19:33:30 +0200 |
commit | 4bf1c1ffe795a1d28a543a20cc3771a30a090b89 (patch) | |
tree | 09e1bb81744be02fd3a8422f9002ec3139f54100 /xlib.py | |
parent | 0d037fd1170ecc30cea677f563dfb50dff7360c6 (diff) |
Added a dedicated thread for handling events sent to the endpoint
Diffstat (limited to 'xlib.py')
-rw-r--r-- | xlib.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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"
|