[d-feet] Assume Wnck is absent on non-X11
- From: Thomas Bechtold <toabctl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [d-feet] Assume Wnck is absent on non-X11
- Date: Fri, 16 Jun 2017 20:10:20 +0000 (UTC)
commit ad26a1b7d1b66d6a5bda269b1e0291110cc0fc14
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Jun 6 16:13:45 2017 +0200
Assume Wnck is absent on non-X11
Wnck is an X11-only API. While Wnck.Screen.get_default() might have
elegantly returned None in the absence of X11 earlier, we cannot rely
on that behaviour. In fact, the same version of libwnck has started to
crash inside Wnck.Screen.get_default().
Let's not touch Wnck when X11 is absent.
https://bugzilla.gnome.org/show_bug.cgi?id=763615
src/dfeet/wnck_utils.py | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/src/dfeet/wnck_utils.py b/src/dfeet/wnck_utils.py
index 2ba68a6..9d103ef 100644
--- a/src/dfeet/wnck_utils.py
+++ b/src/dfeet/wnck_utils.py
@@ -4,9 +4,15 @@
# behvior
import gi
-from gi.repository import Gtk
+from gi.repository import Gtk, Gdk, GLib
+
+def running_in_x11():
+ display = Gdk.Display.get_default()
+ return display.__gtype__.name == 'GdkX11Display'
try:
+ if not running_in_x11():
+ raise GLib.Error('Wnck is only meant to be used with X11')
gi.require_version('Wnck', '3.0')
from gi.repository import Wnck
has_libwnck = True
@@ -26,7 +32,6 @@ class IconTable(object):
if has_libwnck:
screen = Wnck.Screen.get_default()
- # screen is None under Wayland
if screen is not None:
Wnck.Screen.force_update(screen)
screen.connect('application_opened', self.on_app_open)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]