new attempt to create focus algorithm
This commit is contained in:
parent
2f3cb85d22
commit
4382b57e9e
@ -4,8 +4,8 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
// console.log(window.screen.width)
|
// console.log(window.screen.width)
|
||||||
wde = new WebDesktopEnvironment
|
wde = new WebDesktopEnvironment
|
||||||
if (!WebDesktopEnvironment.isMobile){
|
if (!WebDesktopEnvironment.isMobile){
|
||||||
WebDesktopEnvironment.Open("finder", ["/home/user"])
|
// WebDesktopEnvironment.Open("finder", ["/home/user"])
|
||||||
// WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog/test-1.blog"])
|
WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog/test-1.blog"])
|
||||||
// WebDesktopEnvironment.Open("personal-properties", ["kek"])
|
// WebDesktopEnvironment.Open("personal-properties", ["kek"])
|
||||||
} else {
|
} else {
|
||||||
WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog/test-1.blog"])
|
WebDesktopEnvironment.Open("blog-viewer", ["/home/user/blog/test-1.blog"])
|
||||||
@ -150,7 +150,7 @@ class WebDesktopEnvironment{
|
|||||||
newWindow.style.height = height.toString() + "px"
|
newWindow.style.height = height.toString() + "px"
|
||||||
|
|
||||||
document.body.querySelector('#windows-layer').appendChild(newWindow)
|
document.body.querySelector('#windows-layer').appendChild(newWindow)
|
||||||
WindowsCompositor.bringWindowToFront(newWindow)
|
// WindowsCompositor.bringWindowToFront(newWindow)
|
||||||
return newWindow
|
return newWindow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -274,11 +274,13 @@ class WindowsCompositor{
|
|||||||
* @param {HTMLElement} window
|
* @param {HTMLElement} window
|
||||||
*/
|
*/
|
||||||
static bringWindowToFront(window){ //FIXME
|
static bringWindowToFront(window){ //FIXME
|
||||||
if (!window.classList.contains("Focused")){
|
|
||||||
let previousWindow = WindowsCompositor.windowsLayer.lastChild
|
let previousWindow = WindowsCompositor.windowsLayer.lastChild
|
||||||
|
if (window != previousWindow){
|
||||||
|
WindowsCompositor.windowsLayer.insertBefore(previousWindow, window)
|
||||||
|
}
|
||||||
|
if (!window.classList.contains("Focused")){
|
||||||
previousWindow.classList.remove("Focused")
|
previousWindow.classList.remove("Focused")
|
||||||
window.classList.add("Focused")
|
window.classList.add("Focused")
|
||||||
WindowsCompositor.windowsLayer.insertBefore(WindowsCompositor.windowsLayer.lastChild, window)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user