mirror of
https://github.com/tiddly-gittly/TidGi-Desktop.git
synced 2025-12-06 02:30:47 -08:00
Fix cannot convert undefined or null to object bug on Linux (#183)
This commit is contained in:
parent
249dbf06db
commit
357e791d28
2 changed files with 26 additions and 18 deletions
|
|
@ -103,6 +103,32 @@ if (!gotTheLock) {
|
|||
});
|
||||
|
||||
ipcMain.emit('request-update-pause-notifications-info');
|
||||
})
|
||||
.then(() => {
|
||||
// Fix webview is not resized automatically
|
||||
// when window is maximized on Linux
|
||||
// https://github.com/atomery/webcatalog/issues/561
|
||||
|
||||
// run it here not in mainWindow.createAsync()
|
||||
// because if the `mainWindow` is maximized or minimized
|
||||
// before the workspaces's BrowserView fully loaded
|
||||
// error will occur
|
||||
// see https://github.com/atomery/webcatalog/issues/637
|
||||
if (process.platform === 'linux') {
|
||||
const win = mainWindow.get();
|
||||
const handleMaximize = () => {
|
||||
// getContentSize is not updated immediately
|
||||
// try once after 0.2s (for fast computer), another one after 1s (to be sure)
|
||||
setTimeout(() => {
|
||||
ipcMain.emit('request-realign-active-workspace');
|
||||
}, 200);
|
||||
setTimeout(() => {
|
||||
ipcMain.emit('request-realign-active-workspace');
|
||||
}, 1000);
|
||||
};
|
||||
win.on('maximize', handleMaximize);
|
||||
win.on('unmaximize', handleMaximize);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -208,24 +208,6 @@ const createAsync = () => {
|
|||
}
|
||||
});
|
||||
|
||||
// Fix webview is not resized automatically
|
||||
// when window is maximized on Linux
|
||||
// https://github.com/atomery/webcatalog/issues/561
|
||||
if (process.platform === 'linux') {
|
||||
const handleMaximize = () => {
|
||||
// getContentSize is not updated immediately
|
||||
// try once after 0.2s (for fast computer), another one after 1s (to be sure)
|
||||
setTimeout(() => {
|
||||
ipcMain.emit('request-realign-active-workspace');
|
||||
}, 200);
|
||||
setTimeout(() => {
|
||||
ipcMain.emit('request-realign-active-workspace');
|
||||
}, 1000);
|
||||
};
|
||||
win.on('maximize', handleMaximize);
|
||||
win.on('unmaximize', handleMaximize);
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
win.once('ready-to-show', () => {
|
||||
resolve();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue