Skip to content

fix(legacy): avoid clobbering pending size in setPosition/setBounds - #610

Open
lijy91 wants to merge 1 commit into
mainfrom
fix/set-position-preserve-size-issue-37
Open

lijy91 wants to merge 1 commit into
mainfrom
fix/set-position-preserve-size-issue-37

Conversation

@lijy91

@lijy91 lijy91 commented Nov 20, 2026

Copy link
Copy Markdown
Member

Fixes libnativeapi/nativeapi#37

Summary

  • In WindowManager.setBounds, when only position is specified (including via setPosition, setAlignment, and center), update window.position directly instead of reading window.bounds and writing back a potentially stale size on async window managers (e.g. X11).
  • When only size is specified, call window.setSize directly without reading/writing window.bounds.
  • In waitUntilReadyToShow, when both options.size and options.center are set, compute the centered position from options.size rather than reading a possibly stale getSize().
  • Added unit tests in test/legacy_api_test.dart covering setPosition, setPosition(animate: true), and partial setBounds calls.

Verification

  • dart format --output=none --set-exit-if-changed lib/src/legacy/window_manager.dart test/legacy_api_test.dart
  • dart analyze (0 issues)
  • flutter test (all 10 tests pass)

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.

Linux: setPosition and setAlignment cancel a setSize call that comes before them

1 participant