On macOS, add EventLoopBuilderExtMacOS::with_activate_ignoring_other_apps (#2551)

* On macOS,  add `EventLoopBuilderExtMacOS::with_activate_ignoring_other_apps`

* Update src/platform/macos.rs

Co-authored-by: Mads Marquart <mads@marquart.dk>

* remove todo

Co-authored-by: Mads Marquart <mads@marquart.dk>
This commit is contained in:
Amr Bashir 2022-11-23 14:42:46 +02:00 committed by GitHub
parent ce6c6e8c95
commit 418cc44e93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 34 additions and 5 deletions

View file

@ -272,7 +272,11 @@ impl AppState {
}
}
pub fn launched(activation_policy: NSApplicationActivationPolicy, create_default_menu: bool) {
pub fn launched(
activation_policy: NSApplicationActivationPolicy,
create_default_menu: bool,
activate_ignoring_other_apps: bool,
) {
let app = NSApp();
// We need to delay setting the activation policy and activating the app
// until `applicationDidFinishLaunching` has been called. Otherwise the
@ -280,8 +284,7 @@ impl AppState {
app.setActivationPolicy(activation_policy);
window_activation_hack(&app);
// TODO: Consider allowing the user to specify they don't want their application activated
app.activateIgnoringOtherApps(true);
app.activateIgnoringOtherApps(activate_ignoring_other_apps);
HANDLER.set_ready();
HANDLER.waker().start();