From 589880f1e3333db0bb2aa9ad395181f5af659578 Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Sun, 27 Mar 2016 00:27:28 -0700 Subject: [PATCH] OS X: Prevent white flash on window open MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We got the window to run less JS but now it’s shown by the main process too soon! This fixes that with a setTimeout. Perhaps when this issue is fixed (https://github.com/atom/electron/issues/861) we can remove the timeout. --- main/ipc.js | 5 ++++- main/windows.js | 4 ---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/main/ipc.js b/main/ipc.js index 075c9ed1e8..bb4ed1b27a 100644 --- a/main/ipc.js +++ b/main/ipc.js @@ -18,9 +18,12 @@ var powerSaveBlockID = 0 function init () { ipcMain.on('ipcReady', function (e) { - console.timeEnd('init') app.ipcReady = true app.emit('ipcReady') + setTimeout(function () { + windows.main.show() + console.timeEnd('init') + }, 50) }) ipcMain.on('showOpenTorrentFile', menu.showOpenTorrentFile) diff --git a/main/windows.js b/main/windows.js index 216b39e3da..7d926c1409 100644 --- a/main/windows.js +++ b/main/windows.js @@ -71,10 +71,6 @@ function createMainWindow () { menu.onToggleFullScreen() }) - win.webContents.on('did-finish-load', function () { - win.show() - }) - win.on('blur', menu.onWindowHide) win.on('focus', menu.onWindowShow)