[gimp] Make menu positioning also works for transformed offscreen widgets



commit 4822ca0d6d9a38593995b0d2efc0b198acaf3f06
Author: Michael Natterer <mitch gimp org>
Date:   Sun Oct 18 16:03:33 2009 +0200

    Make menu positioning also works for transformed offscreen widgets
    
    (gimp_button_menu_position): reorder the code, use the new
    gdk_window_get_root_coords() and pass it coordinates that include
    the widget's offset within its parent gdk window.

 app/widgets/gimpwidgets-utils.c |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpwidgets-utils.c b/app/widgets/gimpwidgets-utils.c
index 6dcaa7d..28010f0 100644
--- a/app/widgets/gimpwidgets-utils.c
+++ b/app/widgets/gimpwidgets-utils.c
@@ -166,7 +166,16 @@ gimp_button_menu_position (GtkWidget       *button,
         }
     }
 
-  gdk_window_get_origin (gtk_widget_get_window (button), x, y);
+  *x = 0;
+  *y = 0;
+
+  if (! gtk_widget_get_has_window (button))
+    {
+      *x += button->allocation.x;
+      *y += button->allocation.y;
+    }
+
+  gdk_window_get_root_coords (gtk_widget_get_window (button), *x, *y, x, y);
 
   gtk_widget_size_request (GTK_WIDGET (menu), &menu_requisition);
 
@@ -177,9 +186,6 @@ gimp_button_menu_position (GtkWidget       *button,
 
   gtk_menu_set_screen (menu, screen);
 
-  if (! gtk_widget_get_has_window (button))
-    *x += button->allocation.x;
-
   switch (position)
     {
     case GTK_POS_LEFT:



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