Skip to content

Commit f7a4384

Browse files
committed
Bugfix releasing a key that was pressed over another window (i.e. Shift)
Bug: Open a Nodebox window, go to another X window, press "Shift" key, focus again on the Nodebox window with the mouse and release "Shift" key. Nodebox exits with a ValueError exception because the key is not in the _keys list of pressed keys. Environment: Xubuntu Linux 14.04 (XFCE desktop) Solution: ignore ValueError exceptions when removing keys from the _keys list
1 parent e2de268 commit f7a4384

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

nodebox/graphics/context.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3807,7 +3807,10 @@ def _on_key_release(self, keycode, modifiers):
38073807
layer.on_key_release(self.key)
38083808
self.on_key_release(self.key)
38093809
self._keys.char = ""
3810-
self._keys.remove(keycode)
3810+
try:
3811+
self._keys.remove(keycode)
3812+
except ValueError:
3813+
pass
38113814
self._keys.pressed = False
38123815

38133816
def _on_text(self, text):

0 commit comments

Comments
 (0)