diff options
author | Calum Lind <calumlind+deluge@gmail.com> | 2019-05-23 12:59:34 +0100 |
---|---|---|
committer | Calum Lind <calumlind+deluge@gmail.com> | 2019-05-23 13:00:02 +0100 |
commit | 3cfa39a2ad8ee775a7738188ab7f094c7b01f56a (patch) | |
tree | 043777b3040f813c28a2c7d637209924390c68f8 /deluge/ui/gtk3/gtkui.py | |
parent | a3b6d8d8e5dbd70b3f33cbe235b37fc09867a9a0 (diff) | |
download | deluge-3cfa39a2ad8ee775a7738188ab7f094c7b01f56a.tar.gz deluge-3cfa39a2ad8ee775a7738188ab7f094c7b01f56a.tar.bz2 deluge-3cfa39a2ad8ee775a7738188ab7f094c7b01f56a.zip |
[macOS] Fix GTK windowing issues
On macOS the Quartz windowing is used instead of X11 so make ensure
that the X11 window calls are optional.
Also if gtkosx_application is not available then don't create osxapp.
It would be useful to find out how to pass window timestamps on Quartz.
Diffstat (limited to 'deluge/ui/gtk3/gtkui.py')
-rw-r--r-- | deluge/ui/gtk3/gtkui.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/deluge/ui/gtk3/gtkui.py b/deluge/ui/gtk3/gtkui.py index 8feed0e5c..73a329fb7 100644 --- a/deluge/ui/gtk3/gtkui.py +++ b/deluge/ui/gtk3/gtkui.py @@ -154,17 +154,21 @@ class GtkUI(object): log.debug('OS signal "die" caught with args: %s', args) reactor.stop() + self.osxapp = None if windows_check(): from win32api import SetConsoleCtrlHandler SetConsoleCtrlHandler(on_die, True) log.debug('Win32 "die" handler registered') elif osx_check() and windowing('quartz'): - import gtkosx_application - - self.osxapp = gtkosx_application.gtkosx_application_get() - self.osxapp.connect('NSApplicationWillTerminate', on_die) - log.debug('OSX quartz "die" handler registered') + try: + import gtkosx_application + except ImportError: + pass + else: + self.osxapp = gtkosx_application.gtkosx_application_get() + self.osxapp.connect('NSApplicationWillTerminate', on_die) + log.debug('OSX quartz "die" handler registered') # Set process name again to fix gtk issue setproctitle(getproctitle()) @@ -207,7 +211,7 @@ class GtkUI(object): self.statusbar = StatusBar() self.addtorrentdialog = AddTorrentDialog() - if osx_check() and windowing('quartz'): + if self.osxapp: def nsapp_open_file(osxapp, filename): # Ignore command name which is raised at app launch (python opening main script). |