1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-29 07:52:50 -05:00

hypr: prevent events with bad data

This commit is contained in:
bbedward
2025-11-09 11:11:08 -05:00
parent 1524d27f4c
commit 392a1c03c5

View File

@@ -108,7 +108,6 @@ Singleton {
Connections { Connections {
target: Hyprland.toplevels target: Hyprland.toplevels
function onValuesChanged() { function onValuesChanged() {
root._hasRefreshedOnce = false
root.scheduleSort() root.scheduleSort()
} }
} }
@@ -166,7 +165,7 @@ Singleton {
function sortHyprlandToplevelsSafe() { function sortHyprlandToplevelsSafe() {
if (!Hyprland.toplevels || !Hyprland.toplevels.values) return [] if (!Hyprland.toplevels || !Hyprland.toplevels.values) return []
if (_refreshScheduled) return sortedToplevelsCache if (_refreshScheduled && sortedToplevelsCache.length > 0) return sortedToplevelsCache
const items = Array.from(Hyprland.toplevels.values) const items = Array.from(Hyprland.toplevels.values)
@@ -198,6 +197,8 @@ Singleton {
if (!t) continue if (!t) continue
const addr = t.address || "" const addr = t.address || ""
if (!addr) continue
const li = t.lastIpcObject || null const li = t.lastIpcObject || null
const monName = _get(li, ["monitor"], null) ?? _get(t, ["monitor", "name"], "") const monName = _get(li, ["monitor"], null) ?? _get(t, ["monitor", "name"], "")
@@ -241,8 +242,7 @@ Singleton {
}) })
} }
if (missingAnyPosition && hasNewWindow) { if (missingAnyPosition && hasNewWindow && !_hasRefreshedOnce) {
_hasRefreshedOnce = false
scheduleRefresh() scheduleRefresh()
} }