summaryrefslogtreecommitdiff
path: root/gtk/gtkscrolledwindow.c
diff options
context:
space:
mode:
authorCarlos Garnacho <carlosg@gnome.org>2020-07-09 16:10:55 +0200
committerCarlos Garnacho <carlosg@gnome.org>2020-07-09 16:10:55 +0200
commit896ebdc9d75507dfbd56089aea1d7c959a7f7d44 (patch)
tree7bcc355f66847db7733bbfd29cf95fbaeb118cb5 /gtk/gtkscrolledwindow.c
parent06dd8c2cfd74b7204d960bc69a36234973c8b3d5 (diff)
downloadgtk+-896ebdc9d75507dfbd56089aea1d7c959a7f7d44.tar.gz
gtkscrolledwindow: Look up correctly target in captured motion events
Check correctly that the captured motion events are emitted towards the content or one of the scrollbars, in order to have it set the expected "over" state depending on whether the drag begins from the scrolledwindow content or one of the scrollbars. Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2879
Diffstat (limited to 'gtk/gtkscrolledwindow.c')
-rw-r--r--gtk/gtkscrolledwindow.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index 25312db293..bb74c4f17b 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1169,10 +1169,13 @@ check_update_scrollbar_proximity (GtkScrolledWindow *sw,
gboolean indicator_close, on_scrollbar, on_other_scrollbar;
indicator_close = coords_close_to_indicator (sw, indicator, x, y);
- on_scrollbar = (target == indicator->scrollbar);
+ on_scrollbar = (target == indicator->scrollbar ||
+ gtk_widget_is_ancestor (target, indicator->scrollbar));
on_other_scrollbar = (!on_scrollbar &&
(target == priv->hindicator.scrollbar ||
- target == priv->vindicator.scrollbar));
+ target == priv->vindicator.scrollbar ||
+ gtk_widget_is_ancestor (target, priv->hindicator.scrollbar) ||
+ gtk_widget_is_ancestor (target, priv->vindicator.scrollbar)));
if (indicator->over_timeout_id)
{
@@ -1262,7 +1265,8 @@ captured_motion (GtkEventController *controller,
if (priv->vscrollbar_visible)
indicator_start_fade (&priv->vindicator, 1.0);
- if (!target &&
+ if ((target == priv->child ||
+ gtk_widget_is_ancestor (target, priv->child)) &&
(state & (GDK_BUTTON1_MASK | GDK_BUTTON2_MASK | GDK_BUTTON3_MASK)) != 0)
{
indicator_set_over (&priv->hindicator, FALSE);