fix: restore non-panel focus behavior (#42180)

This commit is contained in:
Samuel Attard 2024-05-14 15:52:08 -07:00 коммит произвёл GitHub
Родитель d7099b0ad4
Коммит 435003566d
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
1 изменённых файлов: 1 добавлений и 14 удалений

Просмотреть файл

@ -426,20 +426,7 @@ void NativeWindowMac::Focus(bool focus) {
// If we're a panel window, we do not want to activate the app, // If we're a panel window, we do not want to activate the app,
// which enables Electron-apps to build Spotlight-like experiences. // which enables Electron-apps to build Spotlight-like experiences.
if (!IsPanel()) { if (!IsPanel()) {
// On macOS < Sonoma, "activateIgnoringOtherApps:NO" would not [[NSApplication sharedApplication] activateIgnoringOtherApps:NO];
// activate apps if focusing a window that is inActive. That
// changed with macOS Sonoma, which also deprecated
// "activateIgnoringOtherApps".
//
// There's a slim chance we should have never called
// activateIgnoringOtherApps, but we tried that many years ago
// and saw weird focus bugs on other macOS versions. So, to make
// this safe, we're gating by versions.
if (@available(macOS 14.0, *)) {
[[NSApplication sharedApplication] activate];
} else {
[[NSApplication sharedApplication] activateIgnoringOtherApps:NO];
}
} }
[window_ makeKeyAndOrderFront:nil]; [window_ makeKeyAndOrderFront:nil];
} else { } else {