From 29a6dd079c83eaac4b6f9eb8ebc133db95bd9f24 Mon Sep 17 00:00:00 2001 From: Erick Zhao Date: Sat, 13 Jul 2019 18:54:20 -0700 Subject: [PATCH] chore: revert key -> main change in window delegate listener (#19238) --- .../ui/cocoa/atom_ns_window_delegate.mm | 4 +-- spec/api-browser-window-spec.js | 27 ------------------- 2 files changed, 2 insertions(+), 29 deletions(-) diff --git a/atom/browser/ui/cocoa/atom_ns_window_delegate.mm b/atom/browser/ui/cocoa/atom_ns_window_delegate.mm index 2e7fe738b024f..7e311991a9b7f 100644 --- a/atom/browser/ui/cocoa/atom_ns_window_delegate.mm +++ b/atom/browser/ui/cocoa/atom_ns_window_delegate.mm @@ -84,11 +84,11 @@ - (NSRect)windowWillUseStandardFrame:(NSWindow*)window return frame; } -- (void)windowDidBecomeKey:(NSNotification*)notification { +- (void)windowDidBecomeMain:(NSNotification*)notification { shell_->NotifyWindowFocus(); } -- (void)windowDidResignKey:(NSNotification*)notification { +- (void)windowDidResignMain:(NSNotification*)notification { shell_->NotifyWindowBlur(); } diff --git a/spec/api-browser-window-spec.js b/spec/api-browser-window-spec.js index e5d93747af493..3224209ec8fd6 100644 --- a/spec/api-browser-window-spec.js +++ b/spec/api-browser-window-spec.js @@ -2480,33 +2480,6 @@ describe('BrowserWindow module', () => { }) }) - describe('focus event', () => { - it('should not emit if focusing on a main window with a modal open', (done) => { - const child = new BrowserWindow({ - parent: w, - modal: true, - show: false - }) - - child.once('ready-to-show', () => { - child.show() - }) - - child.on('show', () => { - w.once('focus', () => { - expect(child.isDestroyed()).to.equal(true) - done() - }) - w.focus() // this should not trigger the above listener - child.close() - }) - - // act - child.loadURL(server.url) - w.show() - }) - }) - describe('sheet-begin event', () => { let sheet = null