[gedit-plugins] [multiedit] Use primary key for access
- From: Jesse van den Kieboom <jessevdk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-plugins] [multiedit] Use primary key for access
- Date: Fri, 5 Sep 2014 21:59:55 +0000 (UTC)
commit c37814472b6ed4d0b2b104bb48563a056ebf1e5b
Author: Jesse van den Kieboom <jessevdk gmail com>
Date: Fri Sep 5 23:58:56 2014 +0200
[multiedit] Use primary key for access
plugins/multiedit/multiedit/viewactivatable.py | 20 +++++++++++++-------
1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/plugins/multiedit/multiedit/viewactivatable.py b/plugins/multiedit/multiedit/viewactivatable.py
index e0350d1..fde5e97 100644
--- a/plugins/multiedit/multiedit/viewactivatable.py
+++ b/plugins/multiedit/multiedit/viewactivatable.py
@@ -144,15 +144,18 @@ class MultiEditViewActivatable(GObject.Object, Gedit.ViewActivatable, Signals):
self._buffer = newbuf
def initialize_event_handlers(self):
+ keymap = Gdk.Keymap.get_for_display(self.view.get_display())
+ modmask = keymap.get_modifier_mask(Gdk.ModifierIntent.PRIMARY_ACCELERATOR)
+
self._event_handlers = [
[('Escape',), 0, self.do_escape_mode, True],
[('Return',), 0, self.do_column_edit, True],
- [('Return',), Gdk.ModifierType.CONTROL_MASK, self.do_smart_column_edit, True],
- [('Return',), Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK,
self.do_smart_column_align, True],
- [('Return',), Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.SHIFT_MASK |
Gdk.ModifierType.MOD1_MASK, self.do_smart_column_align, True],
- [('Home',), Gdk.ModifierType.CONTROL_MASK, self.do_mark_start, True],
- [('End',), Gdk.ModifierType.CONTROL_MASK, self.do_mark_end, True],
- [('e', 'E'), Gdk.ModifierType.CONTROL_MASK, self.do_toggle_edit_point, True]
+ [('Return',), modmask, self.do_smart_column_edit, True],
+ [('Return',), modmask | Gdk.ModifierType.SHIFT_MASK, self.do_smart_column_align, True],
+ [('Return',), modmask | Gdk.ModifierType.SHIFT_MASK | Gdk.ModifierType.MOD1_MASK,
self.do_smart_column_align, True],
+ [('Home',), modmask, self.do_mark_start, True],
+ [('End',), modmask, self.do_mark_end, True],
+ [('e', 'E'), modmask, self.do_toggle_edit_point, True]
]
for handler in self._event_handlers:
@@ -770,10 +773,13 @@ class MultiEditViewActivatable(GObject.Object, Gedit.ViewActivatable, Signals):
return True
def on_key_press_event(self, view, event):
+ keymap = Gdk.Keymap.get_for_display(view.get_display())
defmod = Gtk.accelerator_get_default_mod_mask() & event.state
for handler in self._event_handlers:
- if (not handler[3] or self._in_mode) and event.keyval in handler[0] and (defmod == handler[1]):
+ state = keymap.add_virtual_modifiers(handler[1])
+
+ if (not handler[3] or self._in_mode) and event.keyval in handler[0] and (defmod == state):
return handler[2](event)
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]