Skip to content

windows: emit minimize/restore events to keep custom platform view synced#2790

Open
KaithyRookie wants to merge 1 commit intopichillilorenzo:masterfrom
KaithyRookie:fix/windows-minimize-overlay-wm-size-events
Open

windows: emit minimize/restore events to keep custom platform view synced#2790
KaithyRookie wants to merge 1 commit intopichillilorenzo:masterfrom
KaithyRookie:fix/windows-minimize-overlay-wm-size-events

Conversation

@KaithyRookie
Copy link

Connection with issue(s)

Resolve issue #2789

Connected to #2789

Testing and Review Notes

Background

Issue #2789 describes a Windows-specific case where, after minimizing/moving a Flutter app using InAppWebView, desktop interaction can be blocked by an overlay-like stale platform view state.

Root Cause

In flutter_inappwebview_windows, platform view geometry sync was primarily driven by move-related events (WM_MOVING, WM_EXITSIZEMOVE) and app lifecycle callbacks.
Minimize/restore transitions (WM_SIZE with SIZE_MINIMIZED / SIZE_RESTORED / SIZE_MAXIMIZED) were not explicitly emitted through PlatformUtil, so CustomPlatformView could miss position/size resync on those transitions.

What this PR changes

  • Add minimize/restore event support in PlatformUtilListener (Dart):
    • onWindowMinimize
    • onWindowRestore
  • Emit those events from native Windows layer:
    • WM_SIZE + SIZE_MINIMIZED -> onWindowMinimize (and onWindowMove)
    • WM_SIZE + SIZE_RESTORED/SIZE_MAXIMIZED -> onWindowRestore (and onWindowMove)
  • Handle the new events in CustomPlatformView by forcing:
    • _reportSurfaceSize()
    • _reportWidgetPosition()

Files changed

  • flutter_inappwebview_windows/windows/platform_util.cpp
  • flutter_inappwebview_windows/windows/platform_util.h
  • flutter_inappwebview_windows/lib/src/platform_util.dart
  • flutter_inappwebview_windows/lib/src/in_app_webview/custom_platform_view.dart

Manual test steps

  1. Run the Windows example/app that hosts InAppWebView.
  2. Load any regular page (e.g., https://google.com).
  3. Minimize the app window.
  4. Verify desktop icons remain clickable and no overlay-like blocked region remains.
  5. Restore/maximize the app window.
  6. Verify WebView remains visible and interactive.
  7. Move the window around and verify WebView tracks position correctly.

Regression checks

  • Existing move event behavior still works (onWindowMove, onWindowStartMove, onWindowEndMove).
  • No API breaking changes (only additive listener methods).
  • Windows build succeeds with the new native branch.

Screenshots or Videos

@probot-autolabeler probot-autolabeler bot added android iOS linux Linux platform macOS macOS platform platform_interface Platform Interface plugin flutter_inappwebview plugin web windows Windows platform labels Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

android iOS linux Linux platform macOS macOS platform platform_interface Platform Interface plugin flutter_inappwebview plugin web windows Windows platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant