Skip to content

Windows: window.isFullScreen leaves Flutter surface unsized / blank until focus change (0.6.2) #60

Done
libnativeapi/nativeapi-core
#105

Description

@MatteoMagnani7

Summary

On Windows only, toggling Window.isFullScreen updates the native window bounds, but the Flutter content / surface often does not resize or repaint until the window loses and regains focus (e.g. Alt+Tab). Exit fullscreen has a related failure: the window restores its previous size, but the client area (the windows content) stays as big as in fullscreen (so it's overflowing the windows) and the system title bar reappears in a classic / Windows-7-like style, even though the app uses a hidden title bar + custom chrome. Alt+Tab again “fixes” the layout and chrome.

macOS / Linux are fine in our usage. Package version: nativeapi / nativeapi_flutter 0.6.2 (latest on pub.dev).

Environment

  • OS: Windows 10 / 11 (reproduced on Windows)
  • Packages: nativeapi: 0.6.2, nativeapi_flutter: 0.6.2
  • Flutter desktop Windows
  • Window setup: titleBarStyle = TitleBarStyle.hidden + custom in-app title bar (not maximize — true fullscreen via isFullScreen)

Steps to reproduce

Minimal API usage (same as our wrapper):

final window = WindowManager.instance.getCurrent();
// init: custom chrome
window?.titleBarStyle = TitleBarStyle.hidden;

// enter true fullscreen (not maximize)
window?.isFullScreen = true;

// later exit
window?.isFullScreen = false;

Activity

  1. added a commit that references this issue on Dec 1, 2026
  2. lijy91 commented on Dec 1, 2026

    @lijy91
    Member

    Fixed in libnativeapi/nativeapi-core#105 and #66.

    Root Cause

    1. Stale child FLUTTERVIEW client size & missing repaint on fullscreen transitions:
      • On Windows, Window::SetFullScreen strips/restores WS_CAPTION | WS_THICKFRAME via SetWindowLongPtrW and updates window geometry via SetWindowPos(..., SWP_FRAMECHANGED) / SetWindowPlacement.
      • When the outer WindowRect already matched the monitor size or only the non-client frame insets changed during SWP_FRAMECHANGED, Win32 did not reliably deliver a follow-up WM_SIZE with the final post-frame-change GetClientRect to Flutter's Win32Window host, leaving the child FLUTTERVIEW surface unsized/unrepainted until a focus change (Alt+Tab).
    2. Classic Aero Basic title bar / border flash on exiting fullscreen (TitleBarStyle::Hidden):
      • While a window covers monitor.rcMonitor, dwm.exe detaches non-client rendering (WM_DWMNCRENDERINGCHANGED with wParam = 0). Upon SetFullScreen(false), DwmGetWindowAttribute(DWMWA_NCRENDERING_ENABLED) flips back to TRUE in user mode before dwm.exe asynchronously re-attaches (WM_DWMNCRENDERINGCHANGED with wParam = 1), causing DefWindowProcW(WM_NCPAINT) to briefly paint a classic Aero Basic caption/border into the window's redirection surface.

    Fix

    • Synchronize the host client area (WM_SIZE with final GetClientRect + immediate RedrawWindow) at the end of SetFullScreen(true) and SetFullScreen(false), and restore WINDOWPLACEMENT before SWP_FRAMECHANGED when leaving fullscreen.
    • Track actual DWM non-client attachment via WM_DWMNCRENDERINGCHANGED, suppress classic UAH caption/frame messages (WM_NCUAHDRAWCAPTION / WM_NCUAHDRAWFRAME) on TitleBarStyle::Hidden windows, preserve the top client band across DefSubclassProc(WM_NCPAINT) while DWM non-client rendering is detached, and clear non-client border residue (WindowRect - ClientRect) once DWM re-attaches while preserving Windows 11 rounded corners and shadow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions