From 4382b57e9eefaec0ef7d4d15215c8c726f4c7303 Mon Sep 17 00:00:00 2001 From: cyber-dream Date: Thu, 4 May 2023 13:46:48 +0300 Subject: [PATCH] new attempt to create focus algorithm --- resources/wde.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/wde.js b/resources/wde.js index e1819a5..d837d5f 100644 --- a/resources/wde.js +++ b/resources/wde.js @@ -4,8 +4,8 @@ document.addEventListener('DOMContentLoaded', function() { // console.log(window.screen.width) wde = new WebDesktopEnvironment if (!WebDesktopEnvironment.isMobile){ - WebDesktopEnvironment.Open("finder", ["/home/user"]) - // WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog/test-1.blog"]) + // WebDesktopEnvironment.Open("finder", ["/home/user"]) + WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog/test-1.blog"]) // WebDesktopEnvironment.Open("personal-properties", ["kek"]) } else { WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog/test-1.blog"]) @@ -150,7 +150,7 @@ class WebDesktopEnvironment{ newWindow.style.height = height.toString() + "px" document.body.querySelector('#windows-layer').appendChild(newWindow) - WindowsCompositor.bringWindowToFront(newWindow) + // WindowsCompositor.bringWindowToFront(newWindow) return newWindow } } @@ -274,11 +274,13 @@ class WindowsCompositor{ * @param {HTMLElement} window */ static bringWindowToFront(window){ //FIXME + let previousWindow = WindowsCompositor.windowsLayer.lastChild + if (window != previousWindow){ + WindowsCompositor.windowsLayer.insertBefore(previousWindow, window) + } if (!window.classList.contains("Focused")){ - let previousWindow = WindowsCompositor.windowsLayer.lastChild previousWindow.classList.remove("Focused") window.classList.add("Focused") - WindowsCompositor.windowsLayer.insertBefore(WindowsCompositor.windowsLayer.lastChild, window) } }