summaryrefslogtreecommitdiff
path: root/normal.py
diff options
context:
space:
mode:
authorFeynman Liang <feynmanliang@users.noreply.github.com>2020-01-21 16:43:23 -0800
committerGitHub <noreply@github.com>2020-01-21 16:43:23 -0800
commita8b8eaf06d83451c1023dab3d4e1288e76c26b81 (patch)
tree156425b3fc3e94fd86a4f2ddcbdf74cec65ce456 /normal.py
parent591ffe2d0be2ef0e60bd9362dd147274e173b9b0 (diff)
Support F-key shortcuts
Keypresses of F-keys do not get a string returned from `XK.keysym_to_string` and hence (1) do not get added to `pressed` and (2) do not trigger a `replay` even when they are not handled. This breaks the F-key shortcuts which are a big part of Inkscape. This PR introduces a change which `replay`s all the `event`s received whenever our application doesn't handle it (previously it only replayed when it receives an `event` representing a `KeyPress` of **a key which `keysym_to_string` can interpret as a char)
Diffstat (limited to 'normal.py')
-rw-r--r--normal.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/normal.py b/normal.py
index f8c9e90..7fadcc9 100644
--- a/normal.py
+++ b/normal.py
@@ -47,15 +47,18 @@ def normal_mode(self, event, char):
if event.type != X.KeyRelease:
return
+ handled = False
if len(pressed) > 1:
paste_style(self, pressed)
-
- if len(pressed) == 1:
+ handled = True
+ elif len(pressed) == 1:
# Get the only element in pressed
ev = next(iter(pressed))
handled = handle_single_key(self, ev)
- if not handled:
- replay(self)
+
+ # replay events to Inkscape if we couldn't handle them
+ if not handled:
+ replay(self)
events.clear()
pressed.clear()