Skip to content

Commit

Permalink
Make windows that are too big actually usable
Browse files Browse the repository at this point in the history
  • Loading branch information
datkat21 committed Jan 12, 2024
1 parent d685e5d commit 85816d3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pkgs/lib/WindowSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@ export default {
if (!this.options.height) {
this.options.height = 200;
}
if (this.options.width > window.innerWidth) {
this.options.width = window.innerWidth - (snapBoxMargin * 2);
this.options.left = snapBoxMargin + 'px';
}
if (this.options.height > window.innerHeight) {
this.options.height = window.innerHeight - (snapBoxMargin * 2) - 48;
this.options.top = snapBoxMargin + 'px';
}
if (!this.options.minWidth) {
this.options.minWidth = 185;
}
Expand Down Expand Up @@ -387,6 +395,14 @@ function focusWindow(x) {
x.classList.add("focus");

// console.log("[WS]", x.id, windowsList);

core.broadcastEventToProcs({
type: "wsEvent",
data: {
type: "focusedWindow",
data: getWindowObjectById(x.id),
},
});
}

function BeginWinDrag(e) {
Expand Down
1 change: 1 addition & 0 deletions pkgs/ui/Desktop.js
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,7 @@ export default {
}
break;
case "wsEvent":
console.log('wsevent', type, data);
if (data.type === "focusedWindow") {
if (data.data === undefined) return;
const p = data.data.options.pid;
Expand Down

0 comments on commit 85816d3

Please sign in to comment.