From edf3d228ece825070556660dcae64a8b738febb9 Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 20 May 2014 05:22:44 +0000 Subject: [PATCH] #567: add missing "is_modifier" function that got lost during merge. Re-add it from "ServerBase.is_modifier" since we already use this flag for key repeat. Note: this may be a bit more lax since we also match the modifier key by keysym, but this should also be fine. git-svn-id: https://xpra.org/svn/Xpra/trunk@6522 3bb7dfac-3a0b-4e04-842a-767bc560f471 --- src/xpra/server/server_base.py | 11 ++++++++--- src/xpra/x11/server_keyboard_config.py | 9 +++++++++ 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/xpra/server/server_base.py b/src/xpra/server/server_base.py index 8a8086b955..c2229b4be1 100644 --- a/src/xpra/server/server_base.py +++ b/src/xpra/server/server_base.py @@ -1361,7 +1361,12 @@ def get_keycode(self, ss, client_keycode, keyname, modifiers): return ss.get_keycode(client_keycode, keyname, modifiers) def is_modifier(self, keyname, keycode): - return keyname in DEFAULT_MODIFIER_MEANINGS.keys() + if keyname in DEFAULT_MODIFIER_MEANINGS.keys(): + return True + #keyboard config should always exist if we are here? + if self.keyboard_config: + return self.keyboard_config.is_modifier(keycode) + return False def fake_key(self, keycode, press): pass @@ -1389,10 +1394,11 @@ def unpress(): if keycode in self.keys_pressed: del self.keys_pressed[keycode] self.fake_key(keycode, False) + is_mod = self.is_modifier(name, keycode) if pressed: if keycode not in self.keys_pressed: press() - if not self.keyboard_sync and not self.keyboard_config.is_modifier(keycode): + if not self.keyboard_sync and not is_mod: #keyboard is not synced: client manages repeat so unpress #it immediately unless this is a modifier key #(as modifiers are synced via many packets: key, focus and mouse events) @@ -1404,7 +1410,6 @@ def unpress(): unpress() else: keylog("handle keycode %s: key %s was already unpressed, ignoring", keycode, name) - is_mod = self.is_modifier(name, keycode) if not is_mod and self.keyboard_sync and self.key_repeat_delay>0 and self.key_repeat_interval>0: self._key_repeat(wid, pressed, name, keyval, keycode, modifiers, self.key_repeat_delay) diff --git a/src/xpra/x11/server_keyboard_config.py b/src/xpra/x11/server_keyboard_config.py index 5c32ae4bce..a96b9fc942 100644 --- a/src/xpra/x11/server_keyboard_config.py +++ b/src/xpra/x11/server_keyboard_config.py @@ -186,6 +186,15 @@ def compute_modifier_map(self): log("modifier_map(%s)=%s", self.xkbmap_mod_meanings, self.modifier_map) + def is_modifier(self, keycode): + for mod, keys in self.keycodes_for_modifier_keynames.items(): + if keycode in keys: + log("is_modifier(%s) found modifier: %s", keycode, mod) + return True + log("is_modifier(%s) not found", keycode) + return False + + def set_keymap(self): if not self.enabled: return