core: make Window.close() return whether the close was accepted - #12685
Conversation
|
Why don't we fix the implementation to do the right thing instead of changing the docs. |
8e65557 to
ae2e97e
Compare
`WindowItem::close()` previously returned `true` for any top-level window regardless of the outcome, so callers could not tell whether the `close-requested` callback actually let the window close. It now returns the result of the close request: `true` when the callback accepted (the window is hidden), `false` when it kept the window shown, and `false` when called on a child `Window` element that can't be closed independently. Update the builtin docs and the window_actions test to cover both the accepted and rejected paths. changelog: Window: `close()` now returns `true` only when the application accepted the close request, instead of `true` for any top-level window. Tests: env RUSTC_WRAPPER= SLINT_TEST_FILTER=window_actions cargo test --manifest-path tests/Cargo.toml -p test-driver-rust
f42416b to
1ebd82a
Compare
|
Thanks for the review! Fixed the implementation per @ogoffart's point instead of just the docs: Also moved the changelog entry into the commit message as a |
|
It's already merged ;) |
Previously
Window.close()returnedtruefor any top-level window regardlessof the outcome, so callers could not tell whether the
close-requestedcallback actually let the window close.
WindowItem::close()now returns the result of the close request:truewhen the callback accepted the close (the window is hidden),falsewhen the callback kept the window shown,falsewhen called on a childWindowelement that can't be closed independently.The builtin docs are updated to match (using the wording from review), and the
window_actionstest now covers both the accepted and rejected paths.Tests:
env RUSTC_WRAPPER= SLINT_TEST_FILTER=window_actions cargo test --manifest-path tests/Cargo.toml -p test-driver-rust