Skip to content

Commit

Permalink
fix(output-window): removes immediate setSize call (#849)
Browse files Browse the repository at this point in the history
* fix(output-window): removes immediate setSize call

window timings are tricky, occasionally the setSize call sets width and height to 0

* feat(window): prevent accidental close or reload of output window

* fix: undo in-dev changes
  • Loading branch information
2xAA authored Jun 11, 2023
1 parent e294498 commit 151feb0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
14 changes: 10 additions & 4 deletions src/application/window-handler.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export default function windowHandler() {
const windows = {};
const that = this;

function createHideMouseTimerhandler(canvas) {
let mouseTimer;
Expand All @@ -18,10 +19,16 @@ export default function windowHandler() {
};
}

function configureWindow({ win, canvas, title, backgroundColor }) {
function configureWindow({ win, canvas, backgroundColor }) {
win.document.body.appendChild(canvas);
win.document.title = title;
win.document.body.style.backgroundColor = backgroundColor;
win.addEventListener("beforeunload", ev => {
// Setting any value other than undefined here will prevent the window
// from closing or reloading
ev.returnValue = true;
});

setSize.call(that, win);
}

function pollToConfigureWindow(args) {
Expand Down Expand Up @@ -62,6 +69,7 @@ export default function windowHandler() {
"modal",
`width=${width}, height=${height}, location=no, menubar=no, left=0`
);
win.document.title = title;

if (win === null || typeof win === "undefined") {
console.log(
Expand Down Expand Up @@ -120,8 +128,6 @@ export default function windowHandler() {
setSize.call(this, win);
});
});

setSize.call(this, win);
}
});

Expand Down
5 changes: 4 additions & 1 deletion src/background/window-prefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ const windowPrefs = {
event.preventDefault();
event.newGuest = new BrowserWindow({
...options,
autoHideMenuBar: true
autoHideMenuBar: true,
closable: false,
enableLargerThanScreen: true,
title: ""
});

event.newGuest.removeMenu();
Expand Down

0 comments on commit 151feb0

Please sign in to comment.