[gtk/wip/baedert/transforms7: 46/46] widget: Compute child point directly when picking



commit b94c8590b8e94ba328902974a600b8cd0a80a432
Author: Timm Bäder <mail baedert org>
Date:   Tue Feb 19 08:51:51 2019 +0100

    widget: Compute child point directly when picking

 gtk/gtkwidget.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 41f94004fd..d0ed2eda89 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -819,12 +819,18 @@ gtk_widget_real_pick (GtkWidget *widget,
        child;
        child = _gtk_widget_get_prev_sibling (child))
     {
+      GtkWidgetPrivate *priv = gtk_widget_get_instance_private (child);
+      graphene_matrix_t inv;
       GtkWidget *picked;
-      double dx, dy;
+      graphene_vec4_t p;
 
-      gtk_widget_translate_coordinatesf (widget, child, x, y, &dx, &dy);
+      graphene_matrix_inverse (&priv->transform, &inv);
+      graphene_vec4_init (&p, x, y, 0, 1);
+      graphene_matrix_transform_vec4 (&inv, &p, &p);
 
-      picked = gtk_widget_pick (child, dx, dy);
+      picked = gtk_widget_pick (child,
+                                graphene_vec4_get_x (&p),
+                                graphene_vec4_get_y (&p));
       if (picked)
         return picked;
     }


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