views: Focus webContents in BrowserWindow
This commit is contained in:
parent
8bbe28e998
commit
bf862d1d07
2 changed files with 3 additions and 4 deletions
|
@ -379,6 +379,9 @@ void BrowserWindow::OnWindowFocus() {
|
||||||
auto* rwhv = web_contents()->GetRenderWidgetHostView();
|
auto* rwhv = web_contents()->GetRenderWidgetHostView();
|
||||||
if (rwhv)
|
if (rwhv)
|
||||||
rwhv->SetActive(true);
|
rwhv->SetActive(true);
|
||||||
|
#else
|
||||||
|
if (!api_web_contents_->IsDevToolsOpened())
|
||||||
|
web_contents()->Focus();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Emit("focus");
|
Emit("focus");
|
||||||
|
|
|
@ -1183,10 +1183,6 @@ void NativeWindowViews::OnWidgetActivationChanged(
|
||||||
&NativeWindow::NotifyWindowBlur,
|
&NativeWindow::NotifyWindowBlur,
|
||||||
GetWeakPtr()));
|
GetWeakPtr()));
|
||||||
|
|
||||||
if (active && inspectable_web_contents() &&
|
|
||||||
!inspectable_web_contents()->IsDevToolsViewShowing())
|
|
||||||
web_contents()->Focus();
|
|
||||||
|
|
||||||
// Hide menu bar when window is blured.
|
// Hide menu bar when window is blured.
|
||||||
if (!active && menu_bar_autohide_ && menu_bar_visible_)
|
if (!active && menu_bar_autohide_ && menu_bar_visible_)
|
||||||
SetMenuBarVisibility(false);
|
SetMenuBarVisibility(false);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue