Skip to content

[FIX] scroll freeze with X11 - #11

Merged
redrick merged 1 commit into
mainfrom
fix/scroll-freeze
Nov 26, 2026
Merged

redrick merged 1 commit into
mainfrom
fix/scroll-freeze

Conversation

@redrick

@redrick redrick commented Nov 25, 2026

Copy link
Copy Markdown
Owner

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 plain go install would silently fall back to GTK 4, a Linux build now has to name one: without -tags gtk3 or -tags gtk4 it stops with undefined: margin_gui_on_linux_needs_tags_gtk3_or_gtk4. macOS builds are unaffected and need no tag.

The guard means go vet ./... and go test ./... on Linux need a tag as well. CI passes GOFLAGS=-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=gtk3 in 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.

@redrick
redrick merged commit 024ecf7 into main Nov 26, 2026
1 check passed
@redrick
redrick deleted the fix/scroll-freeze branch November 26, 2026 07:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant