Merge pull request #39988 from bruvzg/macos_app_active_notifications

[macOS] Add application become/resign active notifications.
This commit is contained in:
Rémi Verschelde 2020-06-30 22:14:52 +02:00 committed by GitHub
commit e820a73f58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 0 deletions

View File

@ -197,6 +197,18 @@ static NSCursor *_cursorFromSelector(SEL selector, SEL fallback = nil) {
}
}
- (void)applicationDidResignActive:(NSNotification *)notification {
if (OS_OSX::get_singleton()->get_main_loop()) {
OS_OSX::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_FOCUS_OUT);
}
}
- (void)applicationDidBecomeActive:(NSNotification *)notification {
if (OS_OSX::get_singleton()->get_main_loop()) {
OS_OSX::get_singleton()->get_main_loop()->notification(MainLoop::NOTIFICATION_APPLICATION_FOCUS_IN);
}
}
- (void)globalMenuCallback:(id)sender {
if (![sender representedObject])
return;