Set the mnemonic modifier key to Alt-Ctrl for the Quartz Gdk backend.

This avoids interference with the use of the Alt/Option key for
extending the keyboard.

Fixes #6943.
This commit is contained in:
John Ralls 2018-02-05 10:54:05 -08:00
parent 3d7479969f
commit 0a38a6352f
4 changed files with 31 additions and 2 deletions

View File

@ -35,6 +35,7 @@ _LOG = logging.getLogger(".dialog")
#-------------------------------------------------------------------------
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
#-------------------------------------------------------------------------
@ -46,6 +47,7 @@ from gramps.gen.const import GRAMPS_LOCALE as glocale
_ = glocale.translation.gettext
from gramps.gen.const import ICON, URL_BUGHOME
from gramps.gen.config import config
from gramps.gen.constfunc import is_quartz
from .glade import Glade
from .display import display_url
@ -506,6 +508,12 @@ def main(args):
win = Gtk.Window()
win.set_title('Dialog test window')
win.set_position(Gtk.WindowPosition.CENTER)
#Set the mnemonic modifier on Macs to alt-ctrl so that it
#doesn't interfere with the extended keyboard, see
#https://gramps-project.org/bugs/view.php?id=6943
if is_quartz():
win.set_mnemonic_modifier(
Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK)
def cb(window, event):
Gtk.main_quit()
win.connect('delete-event', cb)

View File

@ -38,6 +38,7 @@ from io import StringIO
#
#-------------------------------------------------------------------------
from gi.repository import Gtk
from gi.repository import Gdk
#-------------------------------------------------------------------------
#
@ -47,6 +48,7 @@ from gi.repository import Gtk
from gramps.gen.const import GLADE_FILE, ICON
from gramps.gen.errors import WindowActiveError
from gramps.gen.config import config
from gramps.gen.constfunc import is_quartz
from .glade import Glade
#-------------------------------------------------------------------------
@ -488,6 +490,13 @@ class ManagedWindow:
#closing the Gtk.Window must also close ManagedWindow
self.window = window
self.window.connect('delete-event', self.close)
#Set the mnemonic modifier on Macs to alt-ctrl so that it
#doesn't interfere with the extended keyboard, see
#https://gramps-project.org/bugs/view.php?id=6943
if is_quartz():
self.window.set_mnemonic_modifier(
Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK)
if self.modal:
self.window.set_modal(True)
# The following makes sure that we only have one modal window open;

View File

@ -55,6 +55,7 @@ LOG = logging.getLogger(".")
#
#-------------------------------------------------------------------------
from gi.repository import Gtk
from gi.repository import Gdk
#-------------------------------------------------------------------------
#
@ -394,7 +395,12 @@ class ViewManager(CLIManager):
self.window.set_icon_from_file(ICON)
self.window.set_default_size(width, height)
self.window.move(horiz_position, vert_position)
#Set the mnemonic modifier on Macs to alt-ctrl so that it
#doesn't interfere with the extended keyboard, see
#https://gramps-project.org/bugs/view.php?id=6943
if is_quartz():
self.window.set_mnemonic_modifier(
Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK)
vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
self.window.add(vbox)
hpane = Gtk.Paned()

View File

@ -52,7 +52,7 @@ from gi.repository import Pango
#-------------------------------------------------------------------------
from gramps.gen.errors import MaskError, ValidationError, WindowActiveError
from .undoableentry import UndoableEntry
from gramps.gen.constfunc import is_quartz
#============================================================================
#
# MaskedEntry and ValidatableMaskedEntry copied and merged from the Kiwi
@ -1248,6 +1248,12 @@ def main(args):
win = Gtk.Window()
win.set_title('ValidatableMaskedEntry test window')
win.set_position(Gtk.WindowPosition.CENTER)
#Set the mnemonic modifier on Macs to alt-ctrl so that it
#doesn't interfere with the extended keyboard, see
#https://gramps-project.org/bugs/view.php?id=6943
if is_quartz():
win.set_mnemonic_modifier(
Gdk.ModifierType.CONTROL_MASK | Gdk.ModifierType.MOD1_MASK)
def cb(window, event):
Gtk.main_quit()
win.connect('delete-event', cb)