windows: emit minimize/restore events to keep custom platform view synced#2790
Open
KaithyRookie wants to merge 1 commit intopichillilorenzo:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_SIZEwithSIZE_MINIMIZED/SIZE_RESTORED/SIZE_MAXIMIZED) were not explicitly emitted throughPlatformUtil, soCustomPlatformViewcould miss position/size resync on those transitions.What this PR changes
PlatformUtilListener(Dart):onWindowMinimizeonWindowRestoreWM_SIZE + SIZE_MINIMIZED->onWindowMinimize(andonWindowMove)WM_SIZE + SIZE_RESTORED/SIZE_MAXIMIZED->onWindowRestore(andonWindowMove)CustomPlatformViewby forcing:_reportSurfaceSize()_reportWidgetPosition()Files changed
flutter_inappwebview_windows/windows/platform_util.cppflutter_inappwebview_windows/windows/platform_util.hflutter_inappwebview_windows/lib/src/platform_util.dartflutter_inappwebview_windows/lib/src/in_app_webview/custom_platform_view.dartManual test steps
InAppWebView.https://google.com).Regression checks
onWindowMove,onWindowStartMove,onWindowEndMove).Screenshots or Videos
Before fix:
https://github.com/user-attachments/assets/e4fdcc32-d8c5-46d0-899a-1a133533748f
After fix:
https://github.com/user-attachments/assets/eb141537-cdbe-4eb1-901b-6f9b794881d6