Skip to content

Commit

Permalink
[GTK] Only import wnck on X11 display
Browse files Browse the repository at this point in the history
Wnck is only supported on X11 and raises errors in Wayland so only load
it when X11 present.

Fixes: #3265
  • Loading branch information
cas-- committed Jun 12, 2019
1 parent 7ee8750 commit 03e7952
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Gtk UI

- Fix errors running on Wayland (#3265).
- Fix Peers Tab tooltip and context menu errors (#3266).

### Web UI
Expand Down
17 changes: 9 additions & 8 deletions deluge/ui/gtk3/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import os.path
from hashlib import sha1 as sha

import gi
from gi.repository import Gtk
from gi.repository.Gdk import DragAction, WindowState
from twisted.internet import reactor
Expand All @@ -27,19 +28,19 @@
from .dialogs import PasswordDialog
from .ipcinterface import process_args

try:
import gi

gi.require_version('Wnck', '3.0')
from gi.repository import Wnck
except ValueError:
Wnck = None

try:
from gi.repository import GdkX11
except ImportError:
GdkX11 = None

Wnck = None
if GdkX11:
try:
gi.require_version('Wnck', '3.0')
from gi.repository import Wnck
except (ImportError, ValueError):
pass

log = logging.getLogger(__name__)


Expand Down

0 comments on commit 03e7952

Please sign in to comment.