fix(v3,linux): implement native frameless window resize#5159
fix(v3,linux): implement native frameless window resize#5159leaanthony merged 2 commits intowailsapp:v3-alphafrom
Conversation
The Linux implementation of linuxWebviewWindow.startResize was a no-op stub, so `wails:resize:<edge>` messages from the runtime's drag.ts were dispatched but never acted upon. Frameless windows on Linux could only be dragged, not resized from edges/corners. Wire both CGo backends up to the underlying GTK APIs: - GTK3 (linux_cgo.go): map the eight edge strings to GdkWindowEdge and call gtk_window_begin_resize_drag with the mouse state captured by the existing button-press-event handler. - GTK4 (linux_cgo_gtk4.go): same mapping to GdkSurfaceEdge, dispatched through the beginWindowResize C helper that was already defined in linux_cgo_gtk4.c / .h but never called. - webview_window_linux.go: remove the `// FIXME: what do we need to do here?` stub, which used to shadow the new per-backend implementations. Matches the startDrag pattern already in place on both backends, so the "drag state" populated by mousedown is reused without any new plumbing. Fixes wailsapp#4976.
WalkthroughAdded window resize functionality for Linux by implementing the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@v3/pkg/application/linux_cgo.go`:
- Around line 1770-1801: The build breaks because linux_purego.go lacks the
startResize(border string) error method required by the webviewWindowImpl
interface; add a method named startResize on the linuxWebviewWindow type in
linux_purego.go that matches the signature (func (w *linuxWebviewWindow)
startResize(border string) error) and either implement equivalent purego
behavior or return a no-op nil/error indicating unsupported resize-drag;
alternatively, add a no-op stub with that same signature to
webview_window_linux.go so purego builds satisfy the interface (ensure the
symbol name startResize and receiver type linuxWebviewWindow match existing
code).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: d6a7590e-6275-4c49-88d1-80335e90794a
📒 Files selected for processing (3)
v3/pkg/application/linux_cgo.gov3/pkg/application/linux_cgo_gtk4.gov3/pkg/application/webview_window_linux.go
💤 Files with no reviewable changes (1)
- v3/pkg/application/webview_window_linux.go
leaanthony
left a comment
There was a problem hiding this comment.
Thanks for taking this on!
Summary
linuxWebviewWindow.startResizewas a no-op stub, sowails:resize:<edge>messages sent by the runtime'sdrag.tswere dispatched but never acted upon. Frameless windows on Linux could only be dragged, not resized from edges/corners.This PR wires both CGo backends up to the underlying GTK resize APIs.
Changes
linux_cgo.go): map the eight edge strings toGdkWindowEdgeand callgtk_window_begin_resize_drag, using the mouse state captured by the existingbutton-press-eventhandler.linux_cgo_gtk4.go): same mapping toGdkSurfaceEdge, dispatched through thebeginWindowResizeC helper that was already defined inlinux_cgo_gtk4.c/.hbut never called.webview_window_linux.go: remove the// FIXME: what do we need to do here?stub so the per-backend implementations are the only definitions.The pattern mirrors the existing
startDragimplementations on both backends — thew.dragstate populated by mousedown is reused with no new plumbing.Why this matters
SetSize/SetPositionover the IPC channel per mousemove — visibly janky compared to native resize.--wails-resize/wails:resize:runtime plumbing already exist; this PR only wires them together.Fixes
Test plan
-tags gtk4: drag from each of 8 edges/corners → same behavior.unknown resize border: %q) rather than silently doing nothing.startDragbehavior is unchanged.🤖 Generated with Claude Code
Summary by CodeRabbit