Browse Source

Focus webview directly in offscreen mode (#12507)

Heilig Benedek 7 years ago
parent
commit
52b1065b3b
1 changed files with 10 additions and 2 deletions
  1. 10 2
      atom/browser/api/atom_api_browser_window.cc

+ 10 - 2
atom/browser/api/atom_api_browser_window.cc

@@ -512,11 +512,19 @@ void BrowserWindow::Close() {
 }
 
 void BrowserWindow::Focus() {
-  window_->Focus(true);
+  if (api_web_contents_->IsOffScreen()) {
+    FocusOnWebView();
+  } else {
+    window_->Focus(true);
+  }
 }
 
 void BrowserWindow::Blur() {
-  window_->Focus(false);
+  if (api_web_contents_->IsOffScreen()) {
+    BlurWebView();
+  } else {
+    window_->Focus(false);
+  }
 }
 
 bool BrowserWindow::IsFocused() {