From e999741e9b00fbad5128dff51e409dc76c2a292c Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Mon, 9 Feb 2026 07:35:35 +1100 Subject: [PATCH] fix(v3/macos): guard InvisibleTitleBarHeight and fix top-corner resize shaking (#4962) * fix(v3/macos): guard InvisibleTitleBarHeight and fix top-corner resize shaking (#4960) - Only apply InvisibleTitleBarHeight when the native drag area is actually hidden (frameless window or transparent title bar presets like HiddenInset). Previously it was applied unconditionally, which could swallow clicks near the top of standard windows. - Skip drag initiation when the click is near the left/right window edges within the invisible title bar zone. This prevents conflict between dragging and native top-corner resizing, which caused window content to shake/jitter. Fixes #4960 Co-Authored-By: Claude Opus 4.6 * docs: update InvisibleTitleBarHeight docs and changelog (#4960) Document that InvisibleTitleBarHeight only applies to frameless or transparent title bar windows, and add changelog entries for the guard and edge-detection fixes. Co-Authored-By: Claude Opus 4.6 --------- Co-authored-by: Claude Opus 4.6 --- docs/src/content/docs/features/windows/frameless.mdx | 2 +- docs/src/content/docs/features/windows/options.mdx | 3 ++- v3/UNRELEASED_CHANGELOG.md | 3 +++ v3/pkg/application/webview_window_darwin.go | 5 ++++- v3/pkg/application/webview_window_darwin.m | 9 +++++++++ 5 files changed, 19 insertions(+), 3 deletions(-) diff --git a/docs/src/content/docs/features/windows/frameless.mdx b/docs/src/content/docs/features/windows/frameless.mdx index c13cb9d4d..361cced18 100644 --- a/docs/src/content/docs/features/windows/frameless.mdx +++ b/docs/src/content/docs/features/windows/frameless.mdx @@ -394,7 +394,7 @@ body { ``` **Invisible title bar:** - Allows dragging whilst hiding the title bar: + Allows dragging whilst hiding the title bar. This only takes effect when the window is frameless or uses `AppearsTransparent`: ```go Mac: application.MacOptions{ InvisibleTitleBarHeight: 40, diff --git a/docs/src/content/docs/features/windows/options.mdx b/docs/src/content/docs/features/windows/options.mdx index 730e62045..9b38d5e2b 100644 --- a/docs/src/content/docs/features/windows/options.mdx +++ b/docs/src/content/docs/features/windows/options.mdx @@ -792,7 +792,8 @@ Mac: application.MacWindow{ **InvisibleTitleBarHeight** (`int`) - Height of invisible title bar area (for dragging) -- Useful when title bar is hidden +- Only takes effect when the native title bar drag area is hidden — i.e. when the window is frameless (`Frameless: true`) or uses a transparent title bar (`AppearsTransparent: true`) +- Has no effect on standard windows with a visible title bar **WindowLevel** (`MacWindowLevel`) - `MacWindowLevelNormal` - Standard window level (default) diff --git a/v3/UNRELEASED_CHANGELOG.md b/v3/UNRELEASED_CHANGELOG.md index 1710e1795..796685b40 100644 --- a/v3/UNRELEASED_CHANGELOG.md +++ b/v3/UNRELEASED_CHANGELOG.md @@ -25,6 +25,9 @@ After processing, the content will be moved to the main changelog and this file ## Fixed +- Fix `InvisibleTitleBarHeight` being applied to all macOS windows instead of only frameless or transparent title bar windows (#4960) +- Fix window shaking/jitter when resizing from top corners with `InvisibleTitleBarHeight` enabled, by skipping drag initiation near window edges (#4960) +- Fix generation of mapped types with enum keys in JS/TS bindings (#4437) by @fbbdev ## Deprecated diff --git a/v3/pkg/application/webview_window_darwin.go b/v3/pkg/application/webview_window_darwin.go index 4a53d7337..ff49ad49b 100644 --- a/v3/pkg/application/webview_window_darwin.go +++ b/v3/pkg/application/webview_window_darwin.go @@ -1334,7 +1334,10 @@ func (w *macosWebviewWindow) run() { C.windowSetAppearanceTypeByName(w.nsWindow, C.CString(string(macOptions.Appearance))) } - if macOptions.InvisibleTitleBarHeight != 0 { + // Only apply invisible title bar when the native drag area is hidden + // (frameless window or transparent/hidden title bar presets like HiddenInset) + if macOptions.InvisibleTitleBarHeight != 0 && + (w.parent.options.Frameless || titleBarOptions.AppearsTransparent) { C.windowSetInvisibleTitleBar(w.nsWindow, C.uint(macOptions.InvisibleTitleBarHeight)) } diff --git a/v3/pkg/application/webview_window_darwin.m b/v3/pkg/application/webview_window_darwin.m index 4e2f1cabc..48130a562 100644 --- a/v3/pkg/application/webview_window_darwin.m +++ b/v3/pkg/application/webview_window_darwin.m @@ -345,6 +345,15 @@ typedef NS_ENUM(NSInteger, MacLiquidGlassStyle) { NSPoint location = [event locationInWindow]; NSRect frame = [window frame]; if( location.y > frame.size.height - self.invisibleTitleBarHeight ) { + // Skip drag if the click is near a window edge (resize zone). + // This prevents conflict between dragging and native top-corner resizing, + // which causes window content to shake/jitter (#4960). + CGFloat resizeThreshold = 5.0; + BOOL nearLeftEdge = location.x < resizeThreshold; + BOOL nearRightEdge = location.x > frame.size.width - resizeThreshold; + if( nearLeftEdge || nearRightEdge ) { + return; + } [window performWindowDragWithEvent:event]; return; }