Skip to content

Platform: add bring-all-to-front()#11719

Open
tilladam wants to merge 5 commits into
slint-ui:masterfrom
tilladam:bring-all-to-front
Open

Platform: add bring-all-to-front()#11719
tilladam wants to merge 5 commits into
slint-ui:masterfrom
tilladam:bring-all-to-front

Conversation

@tilladam
Copy link
Copy Markdown
Contributor

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 implementation
of the Window › Bring All to Front menu item. On all other platforms it
is a no-op. Example usage:

MenuItem {
    title: "Bring All to Front";
    activated => { Platform.bring-all-to-front(); }
}

Design choices (addressing #11692 review feedback)

  • No public Window::bring_all_to_front() in Rust, C++, or JS. The
    function lives only on the Platform global in .slint, which is the
    right home for an app-wide, window-agnostic action.
  • No WindowAdapter trait method. Implemented as a free function in
    i-slint-core using objc2-app-kit directly (NSApplication feature
    was already enabled for the system tray). The C FFI entry point
    (slint_bring_all_to_front) is private_api, used only by generated
    C++ 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-specific
arrangeInFront:. I've kept the macOS-only behavior for now because the
semantics 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.

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)
@tilladam tilladam force-pushed the bring-all-to-front branch from e1a8af4 to d97d72c Compare May 13, 2026 20:09
autofix-ci Bot and others added 3 commits May 13, 2026 20:11
Node.js exposes Slint function names with dashes replaced by underscores,
not in camelCase. Use do_bring_all_to_front() instead of doBringAllToFront().
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