diff --git a/pkgs/lib/WindowSystem.js b/pkgs/lib/WindowSystem.js index af37efe..48f8139 100644 --- a/pkgs/lib/WindowSystem.js +++ b/pkgs/lib/WindowSystem.js @@ -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; } @@ -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) { diff --git a/pkgs/ui/Desktop.js b/pkgs/ui/Desktop.js index c537037..ddce473 100644 --- a/pkgs/ui/Desktop.js +++ b/pkgs/ui/Desktop.js @@ -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;