Skip to content

Fix macOS fullscreen hide, always-on-top fullscreen level, and SetFullScreenable - #99

Merged
lijy91 merged 2 commits into
mainfrom
fix/macos-window-issues-80
Nov 21, 2026
Merged

lijy91 merged 2 commits into
mainfrom
fix/macos-window-issues-80

Conversation

@lijy91

@lijy91 lijy91 commented Nov 20, 2026

Copy link
Copy Markdown
Member

Refs #80

Summary

Addresses the reproducible macOS window lifecycle bugs from #80:

  • Hide() in fullscreen (leanflutter/window_manager#379): When IsFullScreen() is true, Window::Hide() now exits native fullscreen via toggleFullScreen: first and defers setIsVisible:NO / orderOut: until NSWindowDidExitFullScreenNotification, avoiding leaving the user stuck on a black fullscreen Space. Calling Show() or ShowInactive() before exit completes cancels the pending hide.
  • AlwaysOnTop + fullscreen (leanflutter/window_manager#351): Track the requested always-on-top policy on the NSWindow and suspend NSFloatingWindowLevel back to NSNormalWindowLevel across native fullscreen (both programmatic SetFullScreen(true) and user-initiated NSWindowWillEnterFullScreenNotification) so macOS hides the menu bar and Dock properly, restoring NSFloatingWindowLevel on NSWindowDidExitFullScreenNotification.
  • SetFullScreenable() / IsFullScreenable(): Implement SetFullScreenable() via collectionBehavior (NSWindowCollectionBehaviorFullScreenPrimary / NSWindowCollectionBehaviorFullScreenNone) and fix IsFullScreenable() (which previously checked NSWindowStyleMaskFullScreen, i.e. IsFullScreen()).
  • Tests: Add tests/window_lifecycle_macos_test.mm covering deferred fullscreen hide + cancellation, always-on-top level suspension/restoration across fullscreen, SetFullScreenable(), SetResizable() round-trip (#462), and top-edge button hit-testing under TitleBarStyle::Hidden on macOS 27.2 (#565).

Audit of remaining #80 items on macOS 27.2

  • #565 (hidden title bar top clicks): NativeApiUpdateWindowMovable disables system drag on hidden title bar; verified top-edge NSButton hit-tests directly to NSButton on macOS 27.2.
  • #171 (bar blocking top in fullscreen): nativeapi does not inject an NSToolbar; uses NSWindowStyleMaskFullSizeContentView + transparent title bar.
  • #462 (setResizable): verified round-trip with both normal and hidden title bars.
  • #543 (hide from hotkey callback): shortcut_manager_macos.mm delivers Carbon hotkeys on the main thread.
  • #541 (setSize hang in tests): Window::SetSize is synchronous (setFrame:display:YES) and never blocks on an animation completion callback.
  • #481 (transparent background black): Window::SetBackgroundColor updates FlutterViewController.backgroundColor via NativeApiContentWithBackground.
  • #360 (freeze after hot restart in fullscreen): Window::SetFullScreen(true) is a no-op when IsFullScreen() is already true and never blocks.

Verification

  • Built core and ran full ctest suite on macOS 27.2: 40/40 tests passed.

Drop the cached kWindowAlwaysOnTopKey associated object so direct native NSWindow.level changes after SetAlwaysOnTop(false) are still reflected by IsAlwaysOnTop() and reported by WindowPropertyChangedEvent. Only treat restore_always_on_top as overriding the window level while suspended for native fullscreen, and guard repeated Hide() calls in fullscreen from toggling twice.
@lijy91
lijy91 merged commit 60fa795 into main Nov 21, 2026
9 of 10 checks passed
@lijy91
lijy91 deleted the fix/macos-window-issues-80 branch November 21, 2026 02:10
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