Fix keybinding in LMDE
This commit is contained in:
parent
0824cdf39d
commit
240c5cbc26
@ -60,19 +60,6 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread):
|
|||||||
self.raw_keyval = None
|
self.raw_keyval = None
|
||||||
self.keytext = ""
|
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):
|
def map_modifiers(self):
|
||||||
gdk_modifiers =(Gdk.ModifierType.CONTROL_MASK, Gdk.ModifierType.SHIFT_MASK, Gdk.ModifierType.MOD1_MASK,
|
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,
|
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):
|
if "Mod" not in Gtk.accelerator_name(0, modifier) or "Mod4" in Gtk.accelerator_name(0, modifier):
|
||||||
self.known_modifiers_mask |= 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):
|
def grab(self, key):
|
||||||
accelerator = key
|
accelerator = key
|
||||||
accelerator = accelerator.replace("<Super>", "<Mod4>")
|
accelerator = accelerator.replace("<Super>", "<Mod4>")
|
||||||
@ -95,7 +79,11 @@ class GlobalKeyBinding(GObject.GObject, threading.Thread):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
self.keytext = key
|
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)
|
self.modifiers = int(modifiers)
|
||||||
|
|
||||||
catch = error.CatchError(error.BadAccess)
|
catch = error.CatchError(error.BadAccess)
|
||||||
|
Loading…
Reference in New Issue
Block a user