mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-07 19:30:12 +00:00
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...
This commit is contained in:
parent
994287b71f
commit
4bb9a6360f
@ -2678,33 +2678,23 @@ gtk_range_update_mouse_location (GtkRange *range)
|
|||||||
gint x, y;
|
gint x, y;
|
||||||
GtkWidget *old_location;
|
GtkWidget *old_location;
|
||||||
GtkWidget *widget = GTK_WIDGET (range);
|
GtkWidget *widget = GTK_WIDGET (range);
|
||||||
GdkRectangle trough_alloc, slider_alloc, slider_trace;
|
|
||||||
GtkAllocation range_alloc;
|
|
||||||
|
|
||||||
old_location = priv->mouse_location;
|
old_location = priv->mouse_location;
|
||||||
|
|
||||||
x = priv->mouse_x;
|
x = priv->mouse_x;
|
||||||
y = priv->mouse_y;
|
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)
|
if (priv->grab_location != NULL)
|
||||||
priv->mouse_location = priv->grab_location;
|
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
|
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)
|
if (old_location != priv->mouse_location)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user