Platform: add bring-all-to-front()#11719
Open
tilladam wants to merge 5 commits into
Open
Conversation
Adds `Platform.bring-all-to-front()` to the Slint language, lowered to a new `BuiltinFunction::BringAllToFront` via the platform-lowering pass. On macOS the function calls `[NSApp arrangeInFront:]` via a free function in `i-slint-core`, using the `objc2-app-kit` dependency that was already present for the system tray. On all other platforms it is a no-op. Public-language API only — no `slint::Window::bring_all_to_front()`, no `WindowAdapter` trait method, and no language-binding wrappers. The C FFI entry point (`slint_bring_all_to_front`) is private_api, used only by generated C++ code. Addresses the review feedback from PR slint-ui#11692: - ogoffart: remove from WindowAdapter trait, implement as free function in i-slint-core using objc2-app-kit directly - ogoffart: no public Rust/C++/JS Window::bring_all_to_front() API - Both reviewers: split into its own PR (orthogonal to minimize/maximize/close)
e1a8af4 to
d97d72c
Compare
Node.js exposes Slint function names with dashes replaced by underscores, not in camelCase. Use do_bring_all_to_front() instead of doBringAllToFront().
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.
Summary
Adds
Platform.bring-all-to-front()to the Slint language, split out from#11692 per reviewer request (orthogonal to the minimize/maximize/close work
and easier to discuss in isolation).
On macOS this calls
[NSApp arrangeInFront:]— the standard implementationof the Window › Bring All to Front menu item. On all other platforms it
is a no-op. Example usage:
Design choices (addressing #11692 review feedback)
Window::bring_all_to_front()in Rust, C++, or JS. Thefunction lives only on the
Platformglobal in.slint, which is theright home for an app-wide, window-agnostic action.
WindowAdaptertrait method. Implemented as a free function ini-slint-coreusingobjc2-app-kitdirectly (NSApplicationfeaturewas already enabled for the system tray). The C FFI entry point
(
slint_bring_all_to_front) isprivate_api, used only by generatedC++ code.
Open question
@tronical raised the idea of making this cross-platform by iterating all
window adapters and calling
show()on each, rather than the macOS-specificarrangeInFront:. I've kept the macOS-only behavior for now because thesemantics are different on other platforms ("raise all our windows" is more
aggressive than the macOS concept of bringing a group of windows to the
front of the z-stack). Happy to revisit in a follow-up if there's appetite
for a cross-platform version.