Bug 9965: Undo in undoableentry does the wrong undo in MacOS.

This fixes the immediate problem peculiar to MacOS, but the underlying
problem that the code doesn't use keybindings and has a control-specific
undo stack which makes undo ambiguous for the window remains.
This commit is contained in:
John Ralls 2017-02-28 20:55:16 -08:00
parent 3901e7dd4c
commit 1571f8409a
2 changed files with 5 additions and 3 deletions

View File

@ -274,6 +274,7 @@ class ViewManager(CLIManager):
CLIManager.__init__(self, dbstate, setloader=False, user=user)
if _GTKOSXAPPLICATION:
self.macapp = QuartzApp.Application()
self.macapp.set_use_quartz_accelerators(False)
self.view_category_order = view_category_order

View File

@ -118,13 +118,14 @@ class UndoableEntry(Gtk.Entry, Gtk.Editable):
Handle formatting undo/redo key press.
"""
if ((Gdk.keyval_name(event.keyval) == 'Z') and
(event.get_state() & Gdk.ModifierType.CONTROL_MASK) and
keymap = Gdk.Keymap.get_default();
primary = keymap.get_modifier_mask(Gdk.ModifierIntent.PRIMARY_ACCELERATO if ((Gdk.keyval_name(event.keyval) == 'Z') and
(event.get_state() & primary) and
(event.get_state() & Gdk.ModifierType.SHIFT_MASK)):
self.redo()
return True
elif ((Gdk.keyval_name(event.keyval) == 'z') and
(event.get_state() & Gdk.ModifierType.CONTROL_MASK)):
(event.get_state() & primary)):
self.undo()
return True