From 240c5cbc266490574640e876b5d51fdd0fc6ff9d Mon Sep 17 00:00:00 2001 From: Clement Lefebvre Date: Fri, 28 Apr 2017 13:24:38 +0100 Subject: [PATCH] Fix keybinding in LMDE --- usr/lib/linuxmint/mintMenu/keybinding.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/usr/lib/linuxmint/mintMenu/keybinding.py b/usr/lib/linuxmint/mintMenu/keybinding.py index ca50863..3f23db9 100644 --- a/usr/lib/linuxmint/mintMenu/keybinding.py +++ b/usr/lib/linuxmint/mintMenu/keybinding.py @@ -60,19 +60,6 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread): self.raw_keyval = None self.keytext = "" - def is_hotkey(self, key, modifier): - keymatch = False - modmatch = False - modifier = modifier & ~Gdk.ModifierType.SUPER_MASK - modint = int(modifier) - if self.get_keycode(key) == self.keycode: - keymatch = True - for ignored_mask in self.ignored_masks: - if self.modifiers | ignored_mask == modint | ignored_mask: - modmatch = True - break - return keymatch and modmatch - def map_modifiers(self): gdk_modifiers =(Gdk.ModifierType.CONTROL_MASK, Gdk.ModifierType.SHIFT_MASK, Gdk.ModifierType.MOD1_MASK, Gdk.ModifierType.MOD2_MASK, Gdk.ModifierType.MOD3_MASK, Gdk.ModifierType.MOD4_MASK, Gdk.ModifierType.MOD5_MASK, @@ -82,9 +69,6 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread): if "Mod" not in Gtk.accelerator_name(0, modifier) or "Mod4" in Gtk.accelerator_name(0, modifier): self.known_modifiers_mask |= modifier - def get_keycode(self, keyval): - return self.keymap.get_entries_for_keyval(keyval).keys[0].keycode - def grab(self, key): accelerator = key accelerator = accelerator.replace("", "") @@ -95,7 +79,11 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread): return False self.keytext = key - self.keycode = self.get_keycode(keyval) + try: + self.keycode = self.keymap.get_entries_for_keyval(keyval).keys[0].keycode + except: + # In Betsy, the get_entries_for_keyval() returns an unamed tuple... + self.keycode = self.keymap.get_entries_for_keyval(keyval)[1][0].keycode self.modifiers = int(modifiers) catch = error.CatchError(error.BadAccess)