[gtk+] widget: Avoid casting event coordinates to int in contains()



commit 85fa3961761c7d3a39570b83f5212751e1651519
Author: Timm Bäder <mail baedert org>
Date:   Thu Jan 4 18:25:55 2018 +0100

    widget: Avoid casting event coordinates to int in contains()

 gtk/gtkwidget.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 02e651a..af4b3c7 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -911,11 +911,14 @@ gtk_widget_real_contains (GtkWidget *widget,
                           gdouble    y)
 {
   GtkAllocation own_alloc;
+  graphene_rect_t widget_bounds;
 
   gtk_widget_get_own_allocation (widget, &own_alloc);
-  
+  graphene_rect_init (&widget_bounds, own_alloc.x, own_alloc.y, own_alloc.width, own_alloc.height);
+
   /* XXX: This misses rounded rects */
-  return gdk_rectangle_contains_point (&own_alloc, x, y);
+  return graphene_rect_contains_point (&widget_bounds,
+                                       &(graphene_point_t){x, y});
 }
 
 static GtkWidget *


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