[gtk+] Fix gdk_window_get_geometry for native children with non-native parent



commit 528546733f1da859cb8041829abe0ae677d9a46d
Author: Alexander Larsson <alexl redhat com>
Date:   Sun Aug 16 22:24:00 2009 +0200

    Fix gdk_window_get_geometry for native children with non-native parent
    
    gdk_window_get_geometry calls the native function for all non-native
    windows. This returns coords relative to the native parent. We need
    to convert this to be relative to the client side parent.
    
    This fixes DnD coordinates in firefox (bug 588437).

 gdk/gdkwindow.c |   18 ++++++++++++++----
 1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index f42cc75..a31d570 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -7272,7 +7272,7 @@ gdk_window_get_geometry (GdkWindow *window,
 			 gint      *height,
 			 gint      *depth)
 {
-  GdkWindowObject *private;
+  GdkWindowObject *private, *parent;
 
   if (!window)
     {
@@ -7289,9 +7289,19 @@ gdk_window_get_geometry (GdkWindow *window,
   if (!GDK_WINDOW_DESTROYED (window))
     {
       if (gdk_window_has_impl (private))
-	GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_geometry (window, x, y,
-								 width, height,
-								 depth);
+	{
+	  GDK_WINDOW_IMPL_GET_IFACE (private->impl)->get_geometry (window, x, y,
+								   width, height,
+								   depth);
+	  /* This reports the position wrt to the native parent, we need to convert
+	     it to be relative to the client side parent */
+	  parent = private->parent;
+	  if (!gdk_window_has_impl (parent))
+	    {
+	      *x -= parent->abs_x;
+	      *y -= parent->abs_y;
+	    }
+	}
       else
 	{
 	  if (x)



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