Skip to content

Refactor GtkScrolledWindow

lehmanju requested to merge lehmanju/gtk:scrolledwindow into master

Closes #2723

  • Fixes scrollbar behavior on touchscreens. Previously, scrollbars would jump around and not react to drags.
  • Removed unused gestures (long press/pan)
  • Change behavior of capture_button_press: TRUE all drag sequences get claimed, FALSE child widget has a chance to claim gesture and deny scrolling. TRUE is the default.

EDIT: Touchscreen gestures have been registered on GtkScrolledWindow previously. However, the mechanism to detect, whether the gesture was meant for scrollbars or touch content dragging didn't work. Gestures were always claimed for content dragging. Now gestures are registered on the child widget, making target detection far easier because it is done by the gesture implementation. Scrollbars and the child widget are direct children of GtkScrolledWindow, on event propagation scrollbars get notified first, if they are the target. This works, because they come first in the sorted list of child widgets. If they do not claim the gesture, dragging on the child widget is activated. Although gestures are registered on the child, their callbacks are in GtkScrolledWindow. A child could register additional gestures, even some of the same type, without breaking anything. GtkScrolledWindow always claims dragging/swipe gestures, no matter whether content is actually bigger than the allocated size or not. As the default propagation phase is CAPTURE, gestures on child widgets won't get notified. However, with the changed capture_button_press setting it is possible to give child widgets a chance to react on gestures by setting the propagation phase to BUBBLE.

Additionally, the long press and pan gestures have been removed. As far as I understand, they share the same sequence as GtkGestureDrag but either haven't had any handlers attached or where denying/claiming sequences without doing anything. Connecting a pan gesture on a child widget should therefore not activate it as the sequence gets claimed beforehand, by GtkGestureDrag in GtkScrolledWindow.

Edited by lehmanju

Merge request reports