Merge pull request #19 from mattrose/mac-pr

Only import GdkX11 when available
This commit is contained in:
Markus Frosch 2020-04-23 20:03:13 +02:00 committed by GitHub
commit 11a6a57f51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 3 deletions

View File

@ -40,6 +40,7 @@ class Keybindings:
'alt': Gdk.ModifierType.MOD1_MASK, 'alt': Gdk.ModifierType.MOD1_MASK,
'super': Gdk.ModifierType.SUPER_MASK, 'super': Gdk.ModifierType.SUPER_MASK,
'hyper': Gdk.ModifierType.HYPER_MASK, 'hyper': Gdk.ModifierType.HYPER_MASK,
'mod2': Gdk.ModifierType.MOD2_MASK
} }
empty = {} empty = {}

View File

@ -6,7 +6,7 @@ import copy
import os import os
import gi import gi
gi.require_version('Vte', '2.91') gi.require_version('Vte', '2.91')
from gi.repository import Gtk, Gdk, Vte, GdkX11 from gi.repository import Gtk, Gdk, Vte
from gi.repository.GLib import GError from gi.repository.GLib import GError
from . import borg from . import borg
@ -18,6 +18,12 @@ from .factory import Factory
from .cwd import get_pid_cwd from .cwd import get_pid_cwd
from .version import APP_NAME, APP_VERSION from .version import APP_NAME, APP_VERSION
try:
from gi.repository import GdkX11
except ImportError:
dbg("could not import X11 gir module")
def eventkey2gdkevent(eventkey): # FIXME FOR GTK3: is there a simpler way of casting from specific EventKey to generic (union) GdkEvent? def eventkey2gdkevent(eventkey): # FIXME FOR GTK3: is there a simpler way of casting from specific EventKey to generic (union) GdkEvent?
gdkevent = Gdk.Event.new(eventkey.type) gdkevent = Gdk.Event.new(eventkey.type)
gdkevent.key.window = eventkey.window gdkevent.key.window = eventkey.window

View File

@ -7,16 +7,22 @@ import time
import uuid import uuid
import gi import gi
from gi.repository import GObject from gi.repository import GObject
from gi.repository import Gtk, Gdk, GdkX11 from gi.repository import Gtk, Gdk
from .util import dbg, err, make_uuid, display_manager from .util import dbg, err, make_uuid, display_manager
try:
from gi.repository import GdkX11
except ImportError:
dbg("could not import X11 gir module")
from . import util from . import util
from .translation import _ from .translation import _
from .version import APP_NAME from .version import APP_NAME
from .container import Container from .container import Container
from .factory import Factory from .factory import Factory
from .terminator import Terminator from .terminator import Terminator
if display_manager() == 'X11': if display_manager() == 'X11':
try: try:
gi.require_version('Keybinder', '3.0') gi.require_version('Keybinder', '3.0')