fix(v3,linux): enable frameless resize edge detection on Linux (#4680)#5366
fix(v3,linux): enable frameless resize edge detection on Linux (#4680)#5366leaanthony wants to merge 2 commits intomasterfrom
Conversation
The resize border detection in drag.ts was gated behind !IsWindows(),
which silently disabled JavaScript edge detection on Linux (and macOS).
On Linux, frameless windows have no WM-managed resize handles, so the
JavaScript path — detect edge → invoke("wails:resize:<edge>") → GTK's
gtk_window_begin_resize_drag() — is the only mechanism available.
When a DOM scrollbar sits at the window's right or bottom edge, the
mouse never leaves the WebView viewport, so clientX/clientY coordinates
are still correct. The capture-phase mousemove listener fires first,
detects the resize zone, and sets resizeEdge. Without this fix, though,
the !IsWindows() guard drops the event and resizeEdge stays empty,
making resize unresponsive regardless of the scrollbar.
Change the guard to !IsWindows() && !IsLinux() so Linux follows the same
JavaScript edge-detection path as Windows, while macOS keeps its current
(native-WM) behaviour unchanged.
Also rebuild runtime.js and runtime.debug.js from the updated source.
Fixes #4680.
CC @leaanthony
Co-authored-by: multica-agent <github@multica.ai>
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
✅ Files skipped from review due to trivial changes (1)
Hidden review stack artifactWalkthroughThis PR widens the drag runtime platform guard to allow frameless-window resize on Linux (in addition to Windows), makes Linux backend ChangesLinux Resize Support
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.1)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Enables the v3 desktop runtime’s JavaScript resize-edge detection on Linux so frameless windows can initiate native GTK resize drags when the pointer is near the window edge (e.g., even when hovering a DOM scrollbar at the edge).
Changes:
- Update
drag.tsto allow resize-edge detection on Linux (previously Windows-only). - Rebuild the bundled runtime assets (
runtime.js/runtime.debug.js) to include the updated logic.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
v3/internal/runtime/desktop/@wailsio/runtime/src/drag.ts |
Allows edge detection to run on Linux by extending the OS guard to permit Linux. |
v3/internal/assetserver/bundledassets/runtime.debug.js |
Rebuilt debug bundle to include the Linux-enabled edge detection logic. |
v3/internal/assetserver/bundledassets/runtime.js |
Rebuilt production/minified bundle to include the Linux-enabled edge detection logic. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!resizable || (!IsWindows() && !IsLinux())) { | ||
| if (resizeEdge) { setResize(); } | ||
| return; |
The Linux setResizable implementation only called gtk_window_set_resizable but never notified the JS side via window._wails.setResizable(). This left the drag.ts `resizable` flag permanently false on Linux, causing the !resizable guard in onMouseMove to always short-circuit before edge detection could run — making the frameless resize fix in this PR a no-op. Apply the same execJS call that the Windows backend already uses. The call is dispatched asynchronously after wails:runtime:ready fires the SetResizable init, so window._wails.setResizable is guaranteed to exist when the JS runs. Both GTK3 (linux_cgo.go) and GTK4 (linux_cgo_gtk4.go) paths fixed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
Summary
Fixes #4680 — frameless window resize blocked by scrollbar at window edges on Linux.
Root cause:
drag.ts'sonMouseMove()had a!IsWindows()guard that completely disabled JavaScript resize-edge detection on non-Windows platforms. On Linux, frameless windows have no WM-managed resize handles; the only resize path is:resizeEdgecanResize = trueinvoke("wails:resize:<edge>")→ Go callsgtk_window_begin_resize_drag()With the guard in place,
resizeEdgewas never set on Linux, soinvoke("wails:resize:...")was never called and the entire resize mechanism was dead. A DOM scrollbar at the window edge made this obvious: users reaching for the resize handle found the scrollbar area completely unresponsive to resize.Fix: Change the guard from
!IsWindows()to!IsWindows() && !IsLinux():macOS is unchanged — it was and remains excluded from JavaScript edge detection, relying on WM/native behaviour.
Why it was Windows-only originally: The GTK
startResize()backend was a no-op stub until PR #5159 wired upgtk_window_begin_resize_drag()/gdk_toplevel_begin_resize(). There was no point detecting edges if the backend couldn't act on them. Now that both GTK3 and GTK4 backends are connected, enabling the JS detection side completes the fix.Scrollbar interaction: The event listeners use
{ capture: true }, so the resize handler'smousemovefires in the capture phase before any scrollbar element can consume it.clientX/clientYcoordinates remain viewport-relative regardless of which DOM element is under the cursor, so the edge detection arithmetic is correct even when the mouse is over a DOM scrollbar.Changed files
v3/internal/runtime/desktop/@wailsio/runtime/src/drag.tsIsLinuxto import; change!IsWindows()→!IsWindows() && !IsLinux()v3/internal/assetserver/bundledassets/runtime.debug.jsv3/internal/assetserver/bundledassets/runtime.jsTest plan
Distro tested: Ubuntu 24.04 LTS, GTK 3.24, webkit2gtk-4.0
Wails version: master
🤖 Generated with Claude Code
CC @leaanthony
Summary by CodeRabbit
New Features
Refactor