From 0f673ea88492f330c5a22f37ca3a09b9fd8d083e Mon Sep 17 00:00:00 2001 From: Sam Hunter Date: Fri, 10 Jun 2016 23:49:14 -0700 Subject: [PATCH 1/3] Remove workaround for old Windows bug The code removed is no longer needed as it was fixed in this issue of atom-shell https://github.com/electron/electron/issues/380 --- src/main-process/atom-window.coffee | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/main-process/atom-window.coffee b/src/main-process/atom-window.coffee index 36a7a25c6..b69c417a8 100644 --- a/src/main-process/atom-window.coffee +++ b/src/main-process/atom-window.coffee @@ -157,17 +157,6 @@ class AtomWindow @setupContextMenu() - if @isSpec - # Workaround for https://github.com/atom/atom-shell/issues/380 - # Don't focus the window when it is being blurred during close or - # else the app will crash on Windows. - if process.platform is 'win32' - @browserWindow.on 'close', => @isWindowClosing = true - - # Spec window's web view should always have focus - @browserWindow.on 'blur', => - @browserWindow.focusOnWebView() unless @isWindowClosing - openPath: (pathToOpen, initialLine, initialColumn) -> @openLocations([{pathToOpen, initialLine, initialColumn}]) From 2daa8d60f4d11f2d88df12415dc42f27eb90e616 Mon Sep 17 00:00:00 2001 From: Sam Hunter Date: Sun, 12 Jun 2016 23:16:26 -0700 Subject: [PATCH 2/3] Fix WebView focus This code is needed to automatically focus the webview when it is blurred --- src/main-process/atom-window.coffee | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main-process/atom-window.coffee b/src/main-process/atom-window.coffee index b69c417a8..f9db631bb 100644 --- a/src/main-process/atom-window.coffee +++ b/src/main-process/atom-window.coffee @@ -157,6 +157,9 @@ class AtomWindow @setupContextMenu() + @browserWindow.on 'blur', => + @browserWindow.focusOnWebView() + openPath: (pathToOpen, initialLine, initialColumn) -> @openLocations([{pathToOpen, initialLine, initialColumn}]) From 2d68c4927470e4bcfdcbca667d0c75c7719c44db Mon Sep 17 00:00:00 2001 From: Sam Hunter Date: Sun, 12 Jun 2016 23:20:43 -0700 Subject: [PATCH 3/3] Only spec window's web view should force focus --- src/main-process/atom-window.coffee | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main-process/atom-window.coffee b/src/main-process/atom-window.coffee index f9db631bb..774cbbf0f 100644 --- a/src/main-process/atom-window.coffee +++ b/src/main-process/atom-window.coffee @@ -157,8 +157,10 @@ class AtomWindow @setupContextMenu() - @browserWindow.on 'blur', => - @browserWindow.focusOnWebView() + if @isSpec + # Spec window's web view should always have focus + @browserWindow.on 'blur', => + @browserWindow.focusOnWebView() openPath: (pathToOpen, initialLine, initialColumn) -> @openLocations([{pathToOpen, initialLine, initialColumn}])