From b673d40fd56722468ef94a4e13046109a1f7d7cd Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Tue, 26 Jun 2012 09:55:52 -0700 Subject: [PATCH] Remove focus from CEF when AtomController resigns as main window. Add focus when it becomes the main window. --- Atom/src/AtomController.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Atom/src/AtomController.mm b/Atom/src/AtomController.mm index e118054bc..ebc78098b 100644 --- a/Atom/src/AtomController.mm +++ b/Atom/src/AtomController.mm @@ -129,6 +129,17 @@ } #pragma mark NSWindowDelegate +- (void)windowDidResignMain:(NSNotification *)notification { + if (_clientHandler && _clientHandler->GetBrowser()) { + _clientHandler->GetBrowser()->SendFocusEvent(false); + } +} + +- (void)windowDidBecomeMain:(NSNotification *)notification { + if (_clientHandler && _clientHandler->GetBrowser()) { + _clientHandler->GetBrowser()->SendFocusEvent(true); + } +} - (BOOL)windowShouldClose:(id)window { CefRefPtr context = _clientHandler->GetBrowser()->GetMainFrame()->GetV8Context();