diff --git a/app/browser/windows.js b/app/browser/windows.js index 99284906926..f777fa226d3 100644 --- a/app/browser/windows.js +++ b/app/browser/windows.js @@ -198,7 +198,6 @@ const api = { updateWindowDebounce(windowId) }) win.on('focus', () => { - appActions.windowFocused(windowId) updateWindowDebounce(windowId) }) win.on('show', () => { diff --git a/app/renderer/components/main/main.js b/app/renderer/components/main/main.js index 14294044d7d..3276e4b0649 100644 --- a/app/renderer/components/main/main.js +++ b/app/renderer/components/main/main.js @@ -434,14 +434,12 @@ class Main extends React.Component { window.addEventListener('focus', () => { windowActions.setFocusedFrame(this.props.location, this.props.tabId) - windowActions.onFocus(getCurrentWindowId()) // For whatever reason other elements are preserved but webviews are not. if (document.activeElement && document.activeElement.tagName === 'BODY') { webviewActions.setWebviewFocused() } }, { passive: true }) - windowActions.onFocus(getCurrentWindowId()) // disable dnd by default window.addEventListener('dragover', function (event) { @@ -470,7 +468,6 @@ class Main extends React.Component { const self = this window.onblur = () => { self.resetAltMenuProcessing() - windowActions.onBlur(getCurrentWindowId()) } } diff --git a/app/renderer/components/window.js b/app/renderer/components/window.js index 0bb1aa1f1e4..bea08c4ca99 100644 --- a/app/renderer/components/window.js +++ b/app/renderer/components/window.js @@ -14,6 +14,7 @@ const appActions = require('../../../js/actions/appActions') // Utils const cx = require('../../../js/lib/classSet') const {getPlatformStyles} = require('../../common/lib/platformUtil') +const {isFocused} = require('../currentWindow') window.appActions = appActions @@ -38,10 +39,8 @@ class Window extends React.Component { } mergeProps (state, ownProps) { - const currentWindow = state.get('currentWindow') - const props = {} - props.isFocused = currentWindow.getIn(['ui', 'isFocused']) + props.isFocused = isFocused() return props } diff --git a/app/sessionStore.js b/app/sessionStore.js index 003609053f5..3648e6c5d80 100644 --- a/app/sessionStore.js +++ b/app/sessionStore.js @@ -135,7 +135,6 @@ module.exports.cleanPerWindowData = (immutablePerWindowData, isShutdown) => { 'braveryPanelDetail', // Don't restore drag data and clearBrowsingDataPanel's visibility // This is no longer stored, we can remove this line eventually - ['ui', 'isFocused'], ['ui', 'mouseInTitlebar'], ['ui', 'mouseInFrame'], ['ui', 'dragging'], diff --git a/js/actions/appActions.js b/js/actions/appActions.js index a8e0efe4777..85223478229 100644 --- a/js/actions/appActions.js +++ b/js/actions/appActions.js @@ -637,18 +637,6 @@ const appActions = { }) }, - /** - * Dispatches a message when windowId gains focus - * - * @param {Number} windowId - the unique id of the window - */ - windowFocused: function (windowId) { - dispatch({ - actionType: appConstants.APP_WINDOW_FOCUSED, - windowId: windowId - }) - }, - /** * Saves current menubar template for use w/ Windows titlebar * @param {Object} menubarTemplate - JSON used to build the menu diff --git a/js/actions/windowActions.js b/js/actions/windowActions.js index 4dc258fc3a2..e88dd42f824 100644 --- a/js/actions/windowActions.js +++ b/js/actions/windowActions.js @@ -1075,20 +1075,6 @@ const windowActions = { }) }, - onMaximize: function (windowId) { - dispatch({ - actionType: windowConstants.WINDOW_ON_MAXIMIZE, - windowId - }) - }, - - onMinimize: function (windowId) { - dispatch({ - actionType: windowConstants.WINDOW_ON_MINIMIZE, - windowId - }) - }, - // TODO(bridiver) - refactor these as declarative shouldSetTitle: function (windowId, title) { dispatch({ @@ -1133,34 +1119,6 @@ const windowActions = { }) }, - onFocus: function (windowId) { - dispatch({ - actionType: windowConstants.WINDOW_ON_FOCUS, - windowId - }) - }, - - onBlur: function (windowId) { - dispatch({ - actionType: windowConstants.WINDOW_ON_BLUR, - windowId - }) - }, - - onEnterFullScreen: function (windowId) { - dispatch({ - actionType: windowConstants.WINDOW_ON_ENTER_FULL_SCREEN, - windowId - }) - }, - - onExitFullScreen: function (windowId) { - dispatch({ - actionType: windowConstants.WINDOW_ON_EXIT_FULL_SCREEN, - windowId - }) - }, - onLongBackHistory: function (history, left, top, partition, tabId, windowId) { dispatch({ actionType: windowConstants.WINDOW_ON_GO_BACK_LONG, diff --git a/js/constants/appConstants.js b/js/constants/appConstants.js index 71e69d772a0..313fe92effc 100644 --- a/js/constants/appConstants.js +++ b/js/constants/appConstants.js @@ -48,7 +48,6 @@ const appConstants = { APP_SET_LOGIN_REQUIRED_DETAIL: _, APP_SET_LOGIN_RESPONSE_DETAIL: _, APP_WINDOW_BLURRED: _, - APP_WINDOW_FOCUSED: _, APP_IDLE_STATE_CHANGED: _, APP_NETWORK_CONNECTED: _, APP_NETWORK_DISCONNECTED: _, diff --git a/js/constants/windowConstants.js b/js/constants/windowConstants.js index 850a5a95565..54968f1be03 100644 --- a/js/constants/windowConstants.js +++ b/js/constants/windowConstants.js @@ -85,12 +85,6 @@ const windowConstants = { WINDOW_TAB_MOUSE_LEAVE: _, WINDOW_FRAME_MOUSE_ENTER: _, WINDOW_FRAME_MOUSE_LEAVE: _, - WINDOW_ON_MAXIMIZE: _, - WINDOW_ON_MINIMIZE: _, - WINDOW_ON_FOCUS: _, - WINDOW_ON_BLUR: _, - WINDOW_ON_ENTER_FULL_SCREEN: _, - WINDOW_ON_EXIT_FULL_SCREEN: _, WINDOW_SHOULD_SET_TITLE: _, WINDOW_SHOULD_MINIMIZE: _, WINDOW_SHOULD_MAXIMIZE: _, diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index 56ad7b7c691..1371a6b9a25 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -802,24 +802,6 @@ const doAction = (action) => { case windowConstants.WINDOW_FRAME_MOUSE_LEAVE: windowState = windowState.setIn(['ui', 'mouseInFrame'], false) break - case windowConstants.WINDOW_ON_MAXIMIZE: - windowState = windowState.setIn(['ui', 'isMaximized'], true) - break - case windowConstants.WINDOW_ON_MINIMIZE: - windowState = windowState.setIn(['ui', 'isMaximized'], false) - break - case windowConstants.WINDOW_ON_FOCUS: - windowState = windowState.setIn(['ui', 'isFocused'], true) - break - case windowConstants.WINDOW_ON_BLUR: - windowState = windowState.setIn(['ui', 'isFocused'], false) - break - case windowConstants.WINDOW_ON_ENTER_FULL_SCREEN: - windowState = windowState.setIn(['ui', 'isFullScreen'], true) - break - case windowConstants.WINDOW_ON_EXIT_FULL_SCREEN: - windowState = windowState.setIn(['ui', 'isFullScreen'], false) - break case windowConstants.WINDOW_ON_CERT_ERROR: { const frame = frameStateUtil.getFrameByTabId(windowState, action.tabId) || Immutable.Map()