Skip to content

Use sensible first-float window sizing#1073

Merged
wieslawsoltes merged 3 commits intowieslawsoltes:masterfrom
danwalmsley:codex/fixes/first-float-window-size
Mar 12, 2026
Merged

Use sensible first-float window sizing#1073
wieslawsoltes merged 3 commits intowieslawsoltes:masterfrom
danwalmsley:codex/fixes/first-float-window-size

Conversation

@danwalmsley
Copy link
Copy Markdown
Contributor

Summary

  • treat tiny tracked dockable bounds as uninitialized during the first float operation
  • fall back to the owner pane size before using the default 300x400 floating window size
  • add a regression test covering first-float sizing when tracked document bounds are tiny

Testing

  • dotnet build src/Dock.Model/Dock.Model.csproj -nologo
  • dotnet test tests/Dock.Avalonia.HeadlessTests/Dock.Avalonia.HeadlessTests.csproj --filter FloatDockable_UsesOwnerSize_WhenTrackedDocumentBoundsAreTiny -nologo
  • dotnet test tests/Dock.Avalonia.HeadlessTests/Dock.Avalonia.HeadlessTests.csproj -nologo

@wieslawsoltes
Copy link
Copy Markdown
Owner

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb2b53ce22

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


private static double ResolveFloatingSize(double dockableSize, double ownerSize, double fallbackSize)
{
if (IsValidSize(dockableSize) && dockableSize > MinimumTrackedFloatingSize)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid discarding persisted float sizes under 32px

The new ResolveFloatingSize threshold treats any tracked size <= 32 as uninitialized, so FloatDockable/FloatAllDockables now overwrite legitimate small persisted dimensions every time a dockable is floated again. In practice, if a user intentionally resizes a floating tool/document window to something narrow (for example 24px) and later docks then re-floats it, this code forces owner/default sizing instead of restoring the saved size, which is a regression from the previous NaN-only fallback behavior.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in 926f6bd0.

I narrowed the heuristic so we only treat clearly bogus initial tracked sizes as uninitialized by dropping the cutoff from 32 to 16. That preserves legitimate small persisted float sizes like 24x24 while still fixing the first-float tiny-window case.

I also added a regression test covering the preserved-small-size case:

  • FloatDockable_PreservesSmallTrackedDocumentBoundsAboveTinyThreshold

And re-ran the focused sizing tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants