[gtk+] entry: get_icon_area returns in entry coordinates



commit 5cafa2b1ce1ee38c8f3bb1befeed98ae55dcc923
Author: Timm Bäder <mail baedert org>
Date:   Thu Aug 3 11:14:53 2017 +0200

    entry: get_icon_area returns in entry coordinates
    
    This fixes the popover positions in the gtk4-demo/popovers, and it also
    just makes sense. Also document what the returned coordinates are
    relatiev to.

 gtk/gtkentry.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 1d8223a..b33f4fd 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -8044,7 +8044,8 @@ gtk_entry_get_current_icon_drag_source (GtkEntry *entry)
  * entry in a draw callback.
  *
  * If the entry is not realized or has no icon at the given position,
- * @icon_area is filled with zeros.
+ * @icon_area is filled with zeros. Otherwise, @icon_area will be filled
+ * with the icon's allocation, relative to @entry's allocation.
  *
  * See also gtk_entry_get_text_area()
  *
@@ -8067,11 +8068,7 @@ gtk_entry_get_icon_area (GtkEntry             *entry,
 
   if (icon_info)
     {
-      GtkAllocation widget_allocation;
-      gtk_widget_get_allocation (GTK_WIDGET (entry), &widget_allocation);
-      gtk_widget_get_border_allocation (icon_info->widget, icon_area);
-      icon_area->x -= widget_allocation.x;
-      icon_area->y -= widget_allocation.y;
+      gtk_widget_get_outer_allocation (icon_info->widget, icon_area);
     }
   else
     {


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