[gimp] app: place the gimpview-popup at the button event's root coordinates



commit f45e171f093bfa2753e843de954e2a2d93e01086
Author: Michael Natterer <mitch gimp org>
Date:   Tue Mar 1 14:53:54 2011 +0100

    app: place the gimpview-popup at the button event's root coordinates
    
    instead of fiddling with the widget's and its window's positions.

 app/widgets/gimpview-popup.c |   20 ++++----------------
 1 files changed, 4 insertions(+), 16 deletions(-)
---
diff --git a/app/widgets/gimpview-popup.c b/app/widgets/gimpview-popup.c
index 61e3e05..9fea027 100644
--- a/app/widgets/gimpview-popup.c
+++ b/app/widgets/gimpview-popup.c
@@ -108,18 +108,8 @@ gimp_view_popup_show (GtkWidget      *widget,
   popup->popup_height = popup_height;
   popup->dot_for_dot  = dot_for_dot;
   popup->button       = bevent->button;
-  popup->button_x     = bevent->x;
-  popup->button_y     = bevent->y;
-
-  if (! gtk_widget_get_has_window (widget))
-    {
-      GtkAllocation allocation;
-
-      gtk_widget_get_allocation (widget, &allocation);
-
-      popup->button_x += allocation.x;
-      popup->button_y += allocation.y;
-    }
+  popup->button_x     = bevent->x_root;
+  popup->button_y     = bevent->y_root;
 
   g_signal_connect (widget, "button-release-event",
                     G_CALLBACK (gimp_view_popup_button_release),
@@ -232,10 +222,8 @@ gimp_view_popup_timeout (GimpViewPopup *popup)
   gtk_container_add (GTK_CONTAINER (frame), view);
   gtk_widget_show (view);
 
-  gdk_window_get_origin (gtk_widget_get_window (popup->widget), &x, &y);
-
-  x += popup->button_x - (popup->popup_width  >> 1);
-  y += popup->button_y - (popup->popup_height >> 1);
+  x = popup->button_x - (popup->popup_width  / 2);
+  y = popup->button_y - (popup->popup_height / 2);
 
   monitor = gdk_screen_get_monitor_at_point (screen, x, y);
   gdk_screen_get_monitor_geometry (screen, monitor, &rect);



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