Fix initial window focus bug

Summary:
When launching flipper release build, the initial window focus was wrong, so it appeared unfocussed.
Clicking away and then back to the window would fix it.

This should set the initial focus to be correct from the start.

Task has more details.

Reviewed By: mweststrate

Differential Revision: D18808306

fbshipit-source-id: 2c5828d0b3298594dc30f956bb14141e6cff5918
This commit is contained in:
John Knox
2019-12-04 06:50:38 -08:00
committed by Facebook Github Bot
parent 26632890d6
commit ab5892c60e

View File

@@ -56,6 +56,16 @@ export default (store: Store, logger: Logger) => {
});
});
// windowIsFocussed is initialized in the store before the app is fully ready.
// So wait until everything is up and running and then check and set the isFocussed state.
window.addEventListener('flipper-store-ready', () => {
const isFocussed = currentWindow.isFocused();
store.dispatch({
type: 'windowIsFocused',
payload: isFocussed,
});
});
ipcRenderer.on(
'flipper-protocol-handler',
(_event: string, query: string) => {