gtk4-ify scrolling continued (left/right panels, navigation, and geotagging) and add pinch-to-zoom on navigation widget#20801
Merged
TurboGit merged 3 commits intodarktable-org:masterfrom Apr 22, 2026
Conversation
- Merge discrete and non-discrete setup functions and use GTK_EVENT_CONTROLLER_SCROLL_DISCRETE flag to differentiate - Scroll proxy function now handles propagating scroll events to left/right panels as this is a common pattern - Move attenuation into a helper function - Attenuate non-discrete smooth scroll events (important for MacOS) - Assume that dt_gui_connect_scroll() is always called with a handler function, as it would be nonsensical to set up a scroll handler without a handler - Add helper function to setup scroll controller - Note that discrete scroll deltas can exceed 1 - Use new GtkEventControllerScroll code in geotagging utility module
Panel scroll events over modules (with appropriate modifier) or border now change the GtkScrolledWindow's vertical GtkAdjustment, rather than passing their event on via gtk_widget_event(). This keeps from breaking kinetic scrolling and is more GTK4-ready. GTK4 seems to want widgets to not pass events to other widgets, but instead, based on the event, modify other widgets as needed. Also: - cleanup border scrolling: always scroll border, regardless of modifier keys - acknowledge that still need to handle scroll-event in one case (when scrolling over panel) until convert to GTK4 as in GTK3, parent GtkScrolledWindow must use scroll-event to decide when to handle its own scrolling vs. allow its children to handle event - move _scroll_attenuate() later - tidy widget variable names in center panel init: for clarity, don't reuse variable names.
Handle scroll events via explicitly zooming/panning center view. This appears to be more GTK4-sympathetic than passing the events to the center view to handle. This also should produce better results. The center view scroll/pan code called through dt_view_manager_scrolled() also handled cases when the event interacts with a mask or color picker. Scroll/pan on the navigation widget now goes directly to dt_dev_zoom_move() which is the only case which we really need to handle. Also, proxying scroll events through another widget makes event controller behavior flaky as it is tied both to an event and a widget. Implement pinch-to-zoom behavior on the navigation thumbnail. This matches corresponding behavior on the center view and allows for both panning and zooming using a touchpad. Unlike pinch-to-zoom on the center view, there is no "unconstrained" mode via control key modifier, as it is hard to hold the control key and pinch and there is no visual feedback in the navigation window once the center view area exceeds the image area. Make scroll-to-zoom (via mouse wheel) and pinch-to-zoom (via touchpad) zoom in on the mouse cursor location by (laboriously) translating navigation widget mouse coordinates to center view coordinates. Note that this doesn't necessarily pan the view appropriately when zooming in outside of the area of the image shown in the center view, but works as expected in other cases.
Contributor
Author
|
Great! Very glad the cleanup of removing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
dt_gui_connect_scroll_discrete()and merge it intodt_gui_connect_scroll().dt_dev_get_zoom_bounds()and then same hand-rolled math to make this work. If there's a better helper function for this, it could make that code simpler.)_ui_init_panel_container_center()for clarity.This looks to be part of a series of commits to make GTK4-ready scrolling handling.