From: Benjamin Otte Date: Sun, 5 Nov 2017 03:22:02 +0000 (+0100) Subject: range: Use gtk_widget_pick() to pick the mouse location X-Git-Tag: archive/raspbian/4.4.1+ds1-2+rpi1^2~18^2~23^2~866 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=4bb9a6360fcf4a26b66e9a67ea580482c85ec66e;p=gtk4.git range: Use gtk_widget_pick() to pick the mouse location That's rather unsuccessful so far because it requires skipping a bunch of irrelevant widgets, but oh well... --- diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c index 0b8f6f7a96..dfacb88ef8 100644 --- a/gtk/gtkrange.c +++ b/gtk/gtkrange.c @@ -2678,33 +2678,23 @@ gtk_range_update_mouse_location (GtkRange *range) gint x, y; GtkWidget *old_location; GtkWidget *widget = GTK_WIDGET (range); - GdkRectangle trough_alloc, slider_alloc, slider_trace; - GtkAllocation range_alloc; old_location = priv->mouse_location; x = priv->mouse_x; y = priv->mouse_y; - gtk_widget_get_own_allocation (widget, &range_alloc); - gtk_widget_get_outer_allocation (priv->trough_widget, &trough_alloc); - - gtk_widget_get_outer_allocation (priv->slider_widget, &slider_alloc); - gtk_widget_translate_coordinates (priv->trough_widget, widget, - slider_alloc.x, slider_alloc.y, &slider_alloc.x, &slider_alloc.y); - - gdk_rectangle_union (&slider_alloc, &trough_alloc, &slider_trace); - if (priv->grab_location != NULL) priv->mouse_location = priv->grab_location; - else if (gdk_rectangle_contains_point (&slider_alloc, x, y)) - priv->mouse_location = priv->slider_widget; - else if (gdk_rectangle_contains_point (&slider_trace, x, y)) - priv->mouse_location = priv->trough_widget; - else if (gdk_rectangle_contains_point (&range_alloc, x, y)) - priv->mouse_location = widget; else - priv->mouse_location = NULL; + priv->mouse_location = gtk_widget_pick (widget, x, y); + + /* That's what you get for not attaching gestures to the correct widget */ + while (priv->mouse_location && + priv->mouse_location != priv->slider_widget && + priv->mouse_location != priv->trough_widget && + priv->mouse_location != widget) + priv->mouse_location = gtk_widget_get_parent (priv->mouse_location); if (old_location != priv->mouse_location) {