[pygobject] Try to import GdkX11 in Gdk overrides



commit 6a26d3f2b25b3fbbd87def14f1df17b96ed23a0d
Author: Christoph Reiter <creiter src gnome org>
Date:   Sun Oct 4 11:18:04 2015 +0200

    Try to import GdkX11 in Gdk overrides
    
    pygobject will not provide GdkX11 instances until the namespace
    is loaded so try to load it in the overrides.
    
    This makes Gdk.Display.get_default() return a GdkX11.X11Display
    instead of a dummy Gdk.Display subclass instance.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673396

 gi/overrides/Gdk.py |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/gi/overrides/Gdk.py b/gi/overrides/Gdk.py
index 840affe..baa8449 100644
--- a/gi/overrides/Gdk.py
+++ b/gi/overrides/Gdk.py
@@ -24,13 +24,22 @@ import warnings
 
 from ..overrides import override, strip_boolean_result
 from ..module import get_introspection_module
-from gi import PyGIDeprecationWarning
+from gi import PyGIDeprecationWarning, require_version
 
 Gdk = get_introspection_module('Gdk')
 
 __all__ = []
 
 
+# https://bugzilla.gnome.org/show_bug.cgi?id=673396
+try:
+    require_version("GdkX11", Gdk._version)
+    from gi.repository import GdkX11
+    GdkX11  # pyflakes
+except (ValueError, ImportError):
+    pass
+
+
 class Color(Gdk.Color):
     MAX_VALUE = 65535
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]