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

@ -11,6 +11,7 @@ declare_class!(
pub(super) struct ApplicationDelegate {
activation_policy: NSApplicationActivationPolicy,
default_menu: bool,
activate_ignoring_other_apps: bool,
}
unsafe impl ClassType for ApplicationDelegate {
@ -36,7 +37,11 @@ declare_class!(
#[sel(applicationDidFinishLaunching:)]
fn did_finish_launching(&self, _sender: *const Object) {
trace_scope!("applicationDidFinishLaunching:");
AppState::launched(*self.activation_policy, *self.default_menu);
AppState::launched(
*self.activation_policy,
*self.default_menu,
*self.activate_ignoring_other_apps,
);
}
#[sel(applicationWillTerminate:)]
@ -52,12 +57,14 @@ impl ApplicationDelegate {
pub(super) fn new(
activation_policy: NSApplicationActivationPolicy,
default_menu: bool,
activate_ignoring_other_apps: bool,
) -> Id<Self, Shared> {
unsafe {
msg_send_id![
msg_send_id![Self::class(), alloc],
initWithActivationPolicy: activation_policy,
defaultMenu: default_menu,
activateIgnoringOtherApps: activate_ignoring_other_apps,
]
}
}