[gtk+/wip/carlosg/event-delivery: 94/105] scrolledwindow: Calculate indicator coords relative to scrolledwindow
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/carlosg/event-delivery: 94/105] scrolledwindow: Calculate indicator coords relative to scrolledwindow
- Date: Sun, 14 May 2017 23:45:21 +0000 (UTC)
commit 4b3657599b83fd16ed9da63279b24188e3c97f13
Author: Timm Bäder <mail baedert org>
Date: Tue May 9 19:26:27 2017 +0200
scrolledwindow: Calculate indicator coords relative to scrolledwindow
The event coordinates we get are relative to the scrolledwindow
coordinates.
gtk/gtkscrolledwindow.c | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index c3d437d..2eef2bf 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1083,14 +1083,21 @@ event_close_to_indicator (GtkScrolledWindow *sw,
{
GtkScrolledWindowPrivate *priv;
GtkAllocation indicator_alloc;
+ GtkAllocation sw_alloc;
gdouble x, y;
gint distance;
priv = sw->priv;
+ gtk_widget_get_allocation (GTK_WIDGET (sw), &sw_alloc);
gtk_widget_get_allocation (indicator->scrollbar, &indicator_alloc);
gdk_event_get_coords (event, &x, &y);
+ /* Make indicator alloc relative to scrolledwindow alloc, which is also
+ * what the event coords are relative to */
+ indicator_alloc.x -= sw_alloc.x;
+ indicator_alloc.y -= sw_alloc.y;
+
if (indicator->over)
distance = INDICATOR_FAR_DISTANCE;
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]