zoom
This commit is contained in:
27
main.ts
27
main.ts
@@ -765,4 +765,29 @@ try {
|
||||
);
|
||||
}
|
||||
|
||||
win.show();
|
||||
win.show();
|
||||
|
||||
// Workaround: with the experimental desktop backend the first BrowserWindow
|
||||
// "adopts" the implicit startup window, which is created before user code
|
||||
// runs. Sometimes the native window keeps its built-in default size even
|
||||
// though getSize() already reports the requested values, so the early
|
||||
// setSize-on-mismatch above is skipped. Enforce the persisted size
|
||||
// unconditionally after show(), and verify once more shortly after.
|
||||
try {
|
||||
win.setSize(clamped.windowWidth, clamped.windowHeight);
|
||||
setTimeout(() => {
|
||||
try {
|
||||
const [w, h] = win.getSize();
|
||||
if (w !== clamped.windowWidth || h !== clamped.windowHeight) {
|
||||
console.log(
|
||||
`${PREFIX} Window size drifted to ${w}x${h}, enforcing ${clamped.windowWidth}x${clamped.windowHeight}`,
|
||||
);
|
||||
win.setSize(clamped.windowWidth, clamped.windowHeight);
|
||||
}
|
||||
} catch { /* ok */ }
|
||||
}, 250);
|
||||
} catch (err) {
|
||||
console.warn(
|
||||
`${PREFIX} Post-show size enforcement failed: ${errorMessage(err)}`,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user