Don't break keybinding service when we get an unexpected event

(onscreen keyboard)
This commit is contained in:
Michael Webster 2013-05-20 21:37:21 -04:00
parent 9f8f76b0eb
commit bc514d1c8c

View File

@ -132,6 +132,7 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread):
wait_for_release = False wait_for_release = False
while self.running: while self.running:
event = self.display.next_event() event = self.display.next_event()
try:
self.current_event_time = event.time self.current_event_time = event.time
if event.detail == self.keycode and event.type == X.KeyPress and not wait_for_release: if event.detail == self.keycode and event.type == X.KeyPress and not wait_for_release:
modifiers = event.state & self.known_modifiers_mask modifiers = event.state & self.known_modifiers_mask
@ -147,6 +148,8 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread):
self.display.allow_events(X.AsyncKeyboard, event.time) self.display.allow_events(X.AsyncKeyboard, event.time)
else: else:
self.display.allow_events(X.ReplayKeyboard, event.time) self.display.allow_events(X.ReplayKeyboard, event.time)
except AttributeError:
continue
def stop(self): def stop(self):
self.running = False self.running = False