Repository navigation
Conversation
…Rect setBounds read the window's current bounds through nativeapi before every call, even when the caller passed a full Rect and none of the current values were used. Only read them when position or size is partial. Adds debugBindWindow (same hook as the sibling legacy PRs) so the bridge can be tested against a Dart fake window.
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.
Problem
WindowManager.setBoundsin the 0.5.x-compatible legacy API always read the window's current bounds through nativeapi (a synchronous FFI call) before applying new ones. It did this even when the caller passed a fullRect, so none of the values it read were used. Apps that restore or move the window with a fullRectpay for that extra native round trip on every call.Change
boundsis null andpositionand/orsizegive a partial update.Rectstill takes precedence overposition/size,animatestill triesanimateBoundsfirst and falls back to a plain set, and an empty request is still a no-op.@visibleForTesting debugBindWindowhook so the bridge can be tested against a Dart fake window. The hunk is identical to the one in fix(legacy): report show/hide and fix restore tracking #602, fix(legacy): keep the event bridge compiling when nativeapi adds events #604 and fix(legacy): show taskbar progress and badge on this app's window #605, so those PRs merge with this one without conflicts.Tests
New
test/legacy_set_bounds_test.dart, with its own fakenativeapi.Windowthat counts bounds reads. It checks that:Rectis applied with no bounds read;Rectwins overposition/size;animate: truefalls back to a plain set;dart format,flutter analyze(package and example) andflutter testall pass locally.