fix throwing error screen before loading update

This commit is contained in:
RoyceDa
2026-01-30 17:20:14 +02:00
parent d099346056
commit ad696616e1
4 changed files with 121 additions and 80 deletions

View File

@@ -108,22 +108,29 @@ export function foundationIpcRegistration(mainWindow: BrowserWindow) {
});
ipcMain.on('window-resize', (_, { width, height }) => {
const { x: currentX, y: currentY, width: currentWidth, height: currentHeight } = mainWindow.getBounds();
const { x: currentX, y: currentY } = mainWindow.getBounds();
const newX = currentX + (currentWidth - width) / 2;
const newY = currentY + (currentHeight - height) / 2;
const display = screen.getDisplayMatching(mainWindow.getBounds());
const displayBounds = display.workArea;
const { width: screenWidth, height: screenHeight } = screen.getPrimaryDisplay().workAreaSize;
let newX = currentX;
let newY = currentY;
const clampedX = Math.max(0, Math.min(newX, screenWidth - width));
//const clampedY = Math.max(0, Math.min(newY, screenHeight - height));
if (currentX + width > displayBounds.x + displayBounds.width) {
newX = displayBounds.x + displayBounds.width - width;
}
if (currentY + height > displayBounds.y + displayBounds.height) {
newY = displayBounds.y + displayBounds.height - height;
}
mainWindow.setBounds({
x: Math.round(clampedX),
//y: Math.round(clampedY),
width,
height,
x: newX,
y: newY,
width: width,
height: height
});
mainWindow.webContents.send('window-state-changed');
});
ipcMain.on('window-resizeble', (_, isResizeble) => {