fix: Correct modal focus behavior on macOS (#18995)

Fixes #18502

This PR changes the focus and blur events that we emit in Electron to listen to changes in key window rather than main window. It swaps out windowDidBecomeMain and windowDidResignMain for windowDidBecomeKey and windowDidResignKey, respectively.
This commit is contained in:
Erick Zhao 2019-07-01 10:07:27 -07:00 committed by Shelley Vohr
parent 3173b66d00
commit c7da54e82a
2 changed files with 30 additions and 2 deletions

View file

@ -88,11 +88,11 @@ using TitleBarStyle = electron::NativeWindowMac::TitleBarStyle;
return frame;
}
- (void)windowDidBecomeMain:(NSNotification*)notification {
- (void)windowDidBecomeKey:(NSNotification*)notification {
shell_->NotifyWindowFocus();
}
- (void)windowDidResignMain:(NSNotification*)notification {
- (void)windowDidResignKey:(NSNotification*)notification {
shell_->NotifyWindowBlur();
}