From c327734ca629d2edfe6983c1ddedf4f101eb5e1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Sun, 7 Apr 2024 20:13:20 +0200 Subject: [PATCH] clapper-app: Do not trigger default scroll handler on GtkRange In addition to GtkScrolledWindow, when also hovering over GtkRange subclassing widgets like GtkScale, do not trigger accidentally default app window scroll handler. We want the hovered upon widget and only that widget to handle scroll events in such case. --- src/bin/clapper-app/clapper-app-window.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/bin/clapper-app/clapper-app-window.c b/src/bin/clapper-app/clapper-app-window.c index 6441f94e..e19bb34f 100644 --- a/src/bin/clapper-app/clapper-app-window.c +++ b/src/bin/clapper-app/clapper-app-window.c @@ -471,11 +471,14 @@ scroll_cb (GtkEventControllerScroll *scroll, pickup = _pick_pointer_widget (self); - /* We do not want to accidentally allow this controller - * to handle scrolls when hovering over scrolled window */ - if (pickup && (GTK_IS_SCROLLED_WINDOW (pickup) - || gtk_widget_get_ancestor (pickup, GTK_TYPE_SCROLLED_WINDOW))) - return FALSE; + /* We do not want to accidentally allow this controller to handle + * scrolls when hovering over widgets that also handle scroll */ + while (pickup && !CLAPPER_GTK_IS_VIDEO (pickup)) { + if (GTK_IS_SCROLLED_WINDOW (pickup) || GTK_IS_RANGE (pickup)) + return FALSE; + + pickup = gtk_widget_get_parent (pickup); + } device = gtk_event_controller_get_current_event_device (GTK_EVENT_CONTROLLER (scroll));