range: Fix click detection in slider trace

The x/y/ coordinates are relative to the range allocation, so take that
into account.
This commit is contained in:
Timm Bäder 2017-05-20 15:04:03 +02:00 committed by Matthias Clasen
parent 2ac8ebe9f7
commit 790c153b2c

View File

@ -1989,6 +1989,7 @@ gtk_range_multipress_gesture_pressed (GtkGestureMultiPress *gesture,
"gtk-primary-button-warps-slider", &primary_warps, "gtk-primary-button-warps-slider", &primary_warps,
NULL); NULL);
if (priv->mouse_location == priv->slider_widget && if (priv->mouse_location == priv->slider_widget &&
gdk_event_triggers_context_menu (event)) gdk_event_triggers_context_menu (event))
{ {
@ -2727,7 +2728,7 @@ gtk_range_update_mouse_location (GtkRange *range)
priv->mouse_location = priv->grab_location; priv->mouse_location = priv->grab_location;
else if (rectangle_contains_point (&slider_alloc, range_alloc.x + x, range_alloc.y + y)) else if (rectangle_contains_point (&slider_alloc, range_alloc.x + x, range_alloc.y + y))
priv->mouse_location = priv->slider_widget; priv->mouse_location = priv->slider_widget;
else if (rectangle_contains_point (&slider_trace, x, y)) else if (rectangle_contains_point (&slider_trace, range_alloc.x + x, range_alloc.y + y))
priv->mouse_location = priv->trough_widget; priv->mouse_location = priv->trough_widget;
else if (rectangle_contains_point (&range_alloc, range_alloc.x + x, range_alloc.y + y)) else if (rectangle_contains_point (&range_alloc, range_alloc.x + x, range_alloc.y + y))
priv->mouse_location = widget; priv->mouse_location = widget;