Last active
November 14, 2018 11:06
-
-
Save ahkohd/4d08d92aae0704a5e46463b8f46be799 to your computer and use it in GitHub Desktop.
Work around for Electron.JS Frameless window White Bar Bug After Maximize Cycle main thread custom maximize and restore event handler. main.js/electron.js https://medium.com/@victoraremu/fix-electron-js-frameless-window-white-bar-bug-after-maximize-cycle-fc1c59f4758c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {ipcMain} = require('electron'); | |
// to store the restore window screen width and height and position… | |
let restoreWindowSave; | |
//... | |
function createWindow () { | |
// Create the browser window logics. | |
let win = new BrowserWindow({ width: 800, height: 600 }); | |
// set initial window width, height and positon | |
restoreWindowSave = mainWindow.getBounds(); | |
// custom maximize and unmaximize event handler logics… | |
ipcMain.on('custom-maximize', (event, x, y, restoreDetails) => { | |
restoreWindowSave = restoreDetails; | |
mainWindow.setSize(x,y) | |
mainWindow.setPosition(0, 0); | |
}); | |
ipcMain.on('custom-restore', (event) => { | |
mainWindow.setSize(restoreWindowSave.width, restoreWindowSave.height); | |
mainWindow.setPosition(restoreWindowSave.x, restoreWindowSave.y); | |
}); | |
// ... | |
} | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment