Only mac needs to call SetActive

This commit is contained in:
Cheng Zhao 2018-03-06 13:32:56 +09:00
parent 4c7b48e596
commit e7f175d578

View file

@ -364,18 +364,22 @@ void BrowserWindow::OnWindowEndSession() {
void BrowserWindow::OnWindowBlur() { void BrowserWindow::OnWindowBlur() {
web_contents()->StoreFocus(); web_contents()->StoreFocus();
#if defined(OS_MACOSX)
auto* rwhv = web_contents()->GetRenderWidgetHostView(); auto* rwhv = web_contents()->GetRenderWidgetHostView();
if (rwhv) if (rwhv)
rwhv->SetActive(false); rwhv->SetActive(false);
#endif
Emit("blur"); Emit("blur");
} }
void BrowserWindow::OnWindowFocus() { void BrowserWindow::OnWindowFocus() {
web_contents()->RestoreFocus(); web_contents()->RestoreFocus();
#if defined(OS_MACOSX)
auto* rwhv = web_contents()->GetRenderWidgetHostView(); auto* rwhv = web_contents()->GetRenderWidgetHostView();
if (rwhv) if (rwhv)
rwhv->SetActive(true); rwhv->SetActive(true);
#endif
Emit("focus"); Emit("focus");
} }