Skip to content

fix(window): enforce one CaptionBarHitTest per window - #63

Merged
Moriafly merged 2 commits into
mainfrom
fix/caption-bar-hit-test-scope
Oct 20, 2026
Merged

Moriafly merged 2 commits into
mainfrom
fix/caption-bar-hit-test-scope

Conversation

@Moriafly

@Moriafly Moriafly commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Multiple CaptionBarHitTest instances in one window share hit-test state and can interfere with one another. Give each SaltWindow and SaltDialogWindow an independent registration slot: allow zero or one active region, reject duplicates, and release the slot and hover state on disposal so replacements and child windows work independently.

Clarify that this API only configures SaltUI window hit testing and does not provide standalone window movement. Keep one configuration outside overlapping AnimatedContent, Crossfade, or AnimatedVisibility branches. Only SaltUI windows create independent registration scopes; Compose Popup, Dialog, DialogWindow, and plain Window child content inherit their host's registration. Update the diagnostics to describe the SaltUI window scope explicitly.

The configuration tests change state with runOnIdle in real windows and await the host's exception callback, so they do not depend on pointer permissions or leak deferred failures into later tests. Native dragging remains covered by Robot input, with activation/focus checks and explicit semantics-node waits after keyboard-driven changes.

Validation on Windows:

  • CaptionBarHitTestTest: all 4 tests passed in three consecutive full-class runs, then passed again in the combined regression run. Covers duplicate registration in a window and child dialog, independent parent/child dragging, replacement, removal while hovered, re-registration, and points inside, at, and outside the caption boundary.
  • SaltWindowTest: 8 passed.
  • WindowsCaptionBarTouchTest: 1 passed, including native touch dragging.
  • MainContentTest: 1 passed.
  • git diff --check passed.

Linux and macOS interactions were not run locally.

Give each SaltWindow and SaltDialogWindow an independent registration slot so
multiple caption hit-test regions cannot compete for the same window state.
Reject a second active registration and release both the slot and hover state
when the region leaves composition, allowing child windows and replacements
to manage their own caption configuration.

Document that CaptionBarHitTest only configures SaltUI window hit testing and
does not provide standalone window movement. Explain the Popup scope boundary
and why registration belongs in a DisposableEffect tied to window resources.

Add real-window mouse and keyboard tests for duplicate registration, independent
parent/child windows and dialogs, replacement, removal while hovered, and
registration reuse. Check caption behavior inside, at, and outside the boundary.

Validation on Windows:
- CaptionBarHitTestTest: 4 passed.
- SaltWindowTest: 8 passed.
- WindowsCaptionBarTouchTest: 1 passed.
- MainContentTest: 1 passed.
- git diff --cached --check passed.

Linux and macOS interactions were not run locally.
Check duplicate registrations by changing composition state in a real SaltUI
window and awaiting its exception callback. Avoid native pointer injection for
configuration-only assertions and restore the global exception configuration
after each test so deferred errors cannot contaminate subsequent tests.

Keep Robot coverage for native dragging. Wait for activation and actual input
focus when switching windows, and wait for distinct semantics nodes after
keyboard-driven replacement, removal, and re-registration instead of assuming
an idle pass or a fixed activation delay delivered the input.

Document overlapping animated branches and non-SaltUI child-window scopes in
CaptionBarHitTest KDoc and diagnostics. Preserve the zero-or-one registration
contract and the opt-in required by Window.findSkiaLayer().

Validation on Windows:
- CaptionBarHitTestTest: all 4 tests passed in three consecutive class runs.
- The combined regression run passed all 14 tests across CaptionBarHitTestTest,
  SaltWindowTest, WindowsCaptionBarTouchTest, and MainContentTest.
- git diff --check passed.

Linux and macOS interactions were not run locally.
@Moriafly
Moriafly merged commit 93297b7 into main Oct 20, 2026
3 checks passed
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.

1 participant