Fix cb_view_adjustment_changed* callbacks issues - #1030
Merged
Merged
Conversation
- Fix cb_view_adjustment_changed callback modifying adjustment value - Fix cb_view_*adjustment_value_changed stored_position hack
This was referenced Sep 21, 2026
sebastinas
requested changes
Sep 21, 2026
Member
|
It'd appreciate somebody with Wayland to test this PR. |
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.
Removes three FIXMEs in cb_view_adjustment_changed*:
Closes:
The random scroll jumpings are occuring because GDK_SCROLL events are handled by GtkScrolledWindow internal scroll event listener, which sets adjustment values to it's private priv->unclamped_vadj_value + scroll_delta. As far as I can understand the girara session's GtkEventControllerScroll should handle all of them and no event should leak into GtkScrolledWindow's event controller, but it's still happening and I don't really know why.
To accommodate it, it's possible to allow both GtkScrolledWindow internal logic and installed mouse shortcuts to modify the adjustments. priv->unclamped_vadj_value and zathura->position_* should be set in adjustment value-changed signal callback, and refresh-view signal writes to the adjustment, so in theory everything is fine. The caveat is, GtkScrolledWindow's logic is bit weird and priv->unclamped_vadj_value is only set when the widget is not kinetic scrolling. And when the GDK_SCROLL event leaks, it starts kinetic scrolling hence never really sets priv->unclamped_vadj_value and just jumps to last place priv->unclamped_vadj_value is set to.
So the fix is simply cancelling kinetic scrolling whenever manually scrolling with position_set, sc_zoom so adjustment value-changed callback can correctly modify priv->unclamped_vadj_value.
This also restores the unintended feature of holding alt and scrolling allowing kinetic scrolling because ALT_MASK + GDK_SCROLL event handler is not installed, falling back to GtkScrolledWindow.
I thoroughly tested by pressing random keybindings on my machine, and so far didn't find any bug.
P.S. Thank you so much for creating such a great document viewer. Really been using zathura as the only document viewer forever.
Void Linux, Kernel 7.2.5, Sway (GDK_BACKEND=wayland)
GTK Version: 4.22.4
Girara Version: 2026.07.18
Edit: The only place where upper bound of adjustments is changed seem to be zooming, hence just restore the position ratio after setting the bounds on zoom.