[gtk+/wip/baedert/drawing: 106/143] range: Fix mouse location tracking



commit 8dbdef32a1e2d912b52cf221084f624c4b97dfac
Author: Timm Bäder <mail baedert org>
Date:   Mon May 8 13:37:31 2017 +0200

    range: Fix mouse location tracking

 gtk/gtkrange.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkrange.c b/gtk/gtkrange.c
index 19b7dea..bdc00b0 100644
--- a/gtk/gtkrange.c
+++ b/gtk/gtkrange.c
@@ -2794,28 +2794,26 @@ gtk_range_update_mouse_location (GtkRange *range)
   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_allocation (widget, &range_alloc);
   gtk_widget_get_border_allocation (priv->trough_widget, &trough_alloc);
   gtk_widget_get_border_allocation (priv->slider_widget, &slider_alloc);
   gdk_rectangle_union (&slider_alloc, &trough_alloc, &slider_trace);
 
   if (priv->grab_location != NULL)
     priv->mouse_location = priv->grab_location;
-#if 0
-  else if (gtk_css_gadget_border_box_contains_point (priv->slider_gadget, x, y))
+  else if (rectangle_contains_point (&slider_alloc, range_alloc.x + x, range_alloc.y + y))
     priv->mouse_location = priv->slider_widget;
-#endif
   else if (rectangle_contains_point (&slider_trace, x, y))
     priv->mouse_location = priv->trough_widget;
-#if 0
-  else if (gtk_css_gadget_margin_box_contains_point (priv->gadget, x, y))
-    priv->mouse_location = priv->gadget;
-#endif
+  else if (rectangle_contains_point (&range_alloc, range_alloc.x + x, range_alloc.y + y))
+    priv->mouse_location = widget;
   else
     priv->mouse_location = NULL;
 


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