[gimp] libgimpwidgets: use new GdkWindow API only when available



commit 3ef31e4cc82e57b29aa3d682d0ab6df08a8bb19e
Author: Michael Natterer <mitch gimp org>
Date:   Sun Jan 23 00:30:58 2011 +0100

    libgimpwidgets: use new GdkWindow API only when available

 libgimpwidgets/gimpruler.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/libgimpwidgets/gimpruler.c b/libgimpwidgets/gimpruler.c
index d168371..8d3e22e 100644
--- a/libgimpwidgets/gimpruler.c
+++ b/libgimpwidgets/gimpruler.c
@@ -404,6 +404,7 @@ gtk_widget_get_translation_to_window (GtkWidget *widget,
 
   widget_window = gtk_widget_get_window (widget);
 
+#if GTK_CHECK_VERSION (2, 22, 0)
   for (w = window;
        w && w != widget_window;
        w = gdk_window_get_effective_parent (w))
@@ -415,6 +416,15 @@ gtk_widget_get_translation_to_window (GtkWidget *widget,
       *x += px;
       *y += py;
     }
+#else
+  for (w = window; w && w != widget_window; w = gdk_window_get_parent (w))
+    {
+      int wx, wy;
+      gdk_window_get_position (w, &wx, &wy);
+      *x += wx;
+      *y += wy;
+    }
+#endif
 
   if (w == NULL)
     {



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