From 1571f8409ab61bdea330d2ce5838689f79622ba8 Mon Sep 17 00:00:00 2001 From: John Ralls Date: Tue, 28 Feb 2017 20:55:16 -0800 Subject: [PATCH] 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. --- gramps/gui/viewmanager.py | 1 + gramps/gui/widgets/undoableentry.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gramps/gui/viewmanager.py b/gramps/gui/viewmanager.py index 18d7aa182..cb0e94429 100644 --- a/gramps/gui/viewmanager.py +++ b/gramps/gui/viewmanager.py @@ -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 diff --git a/gramps/gui/widgets/undoableentry.py b/gramps/gui/widgets/undoableentry.py index 9ed0df194..daf2cd67e 100644 --- a/gramps/gui/widgets/undoableentry.py +++ b/gramps/gui/widgets/undoableentry.py @@ -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