[pygobject] pygtkcompat: Make gdk.Window.get_geometry return tuple of 5



commit 85f8aae849dd0fb21de8722a3af9234ca20ea1e0
Author: Simon Feltman <sfeltman src gnome org>
Date:   Sun Mar 17 04:19:57 2013 -0700

    pygtkcompat: Make gdk.Window.get_geometry return tuple of 5
    
    Make get_geometry return a tuple of (x, y, width, height, depth)
    as it did in pygtk 2.
    Update pygtkcompat.enable_gtk() to default to version 3.0 because
    version 2.0 core dumps trying to use introspection with gtk 2.

 pygtkcompat/pygtkcompat.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/pygtkcompat/pygtkcompat.py b/pygtkcompat/pygtkcompat.py
index 00a9f6a..4267a60 100644
--- a/pygtkcompat/pygtkcompat.py
+++ b/pygtkcompat/pygtkcompat.py
@@ -100,7 +100,7 @@ def enable():
 _unset = object()
 
 
-def enable_gtk(version='2.0'):
+def enable_gtk(version='3.0'):
     # set the default encoding like PyGTK
     reload(sys)
     if sys.version_info < (3, 0):
@@ -190,6 +190,12 @@ def enable_gtk(version='2.0'):
     Gdk.screen_width = Gdk.Screen.width
     Gdk.screen_height = Gdk.Screen.height
 
+    orig_gdk_window_get_geometry = Gdk.Window.get_geometry
+
+    def gdk_window_get_geometry(window):
+        return orig_gdk_window_get_geometry(window) + (window.get_visual().get_best_depth(),)
+    Gdk.Window.get_geometry = gdk_window_get_geometry
+
     # gtk
     gi.require_version('Gtk', version)
     from gi.repository import Gtk


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