fix: emit 'shutdown' outside -[NSApplication terminate:] (#24111)

This commit is contained in:
Shelley Vohr 2020-06-15 18:58:28 -07:00 committed by GitHub
parent 0b830ba9e5
commit 9c7d73c6d6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 2 deletions

View file

@ -48,12 +48,22 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
useDefaultAccelerator:NO]);
}
- (void)willPowerOff:(NSNotification*)notify {
[[AtomApplication sharedApplication] willPowerOff:notify];
}
- (void)applicationWillFinishLaunching:(NSNotification*)notify {
// Don't add the "Enter Full Screen" menu item automatically.
[[NSUserDefaults standardUserDefaults]
setBool:NO
forKey:@"NSFullScreenMenuItemEverywhere"];
[[[NSWorkspace sharedWorkspace] notificationCenter]
addObserver:self
selector:@selector(willPowerOff:)
name:NSWorkspaceWillPowerOffNotification
object:nil];
electron::Browser::Get()->WillFinishLaunching();
}