Repository navigation
[FIX] scroll freeze with X11 - #11
Merged
Merged
Conversation
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.
On Linux, margin-gui is built against GTK 4 and WebKitGTK 6 by default, which is what Wails v3 picks when no build tag is given. On an X11 desktop that build freezes under load: when the machine is busy, scrolling with a TrackPoint stutters, and every so often the window stops responding to clicks, keys and scrolling for ten seconds or more before it recovers. Other applications on the same machine stay responsive at the same time.
Stack samples taken from the window's UI thread during those freezes show it doing nothing but dispatching input events, one after another. A TrackPoint sends a steady stream of small scroll events, the GTK 4 build hands them to WebKit one at a time, and on a busy machine the window falls behind and has to work through the backlog before it can do anything else. We tried turning off WebKit's smooth scrolling, switching the GTK renderer, disabling accessibility and removing the sticky elements from the diff, and none of them made a difference. The same code built with
-tags gtk3(GTK 3 and WebKitGTK 4.1) ran under the same load without a single freeze, and scrolled noticeably more smoothly.This change makes GTK 3 the toolkit we build and recommend on Linux. The release workflow now builds the Linux binary with
-tags gtk3, and the install instructions in the README and docs/gui.md lead with the GTK 3 packages, keeping GTK 4 as an alternative with a note about X11. Because the toolkit is chosen at build time and a plaingo installwould silently fall back to GTK 4, a Linux build now has to name one: without-tags gtk3or-tags gtk4it stops withundefined: margin_gui_on_linux_needs_tags_gtk3_or_gtk4. macOS builds are unaffected and need no tag.The guard means
go vet ./...andgo test ./...on Linux need a tag as well. CI passesGOFLAGS=-tags=gtk4, so it keeps checking exactly what it checked before, and the screenshot script passes the matching tag too. Editors running gopls will need-tags=gtk3in their build flags, which the docs now mention.The fix was confirmed on one machine only, an X11 desktop with a TrackPoint. Touchpads and high-resolution wheels on X11 probably behave the same way, and we have not tried Wayland. One open question: should CI also build and test with
-tags gtk3? Right now that build is only exercised when a release is made.