mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-07 05:58:28 -04:00
fix(Hover): refactor & update hover tracking w/context menus
Fixes #2737
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
pragma ComponentBehavior: Bound
|
||||
|
||||
import QtQuick
|
||||
|
||||
QtObject {
|
||||
id: root
|
||||
|
||||
property var _entries: []
|
||||
readonly property bool active: _entries.length > 0
|
||||
readonly property var focusWindows: _entries.map(entry => entry.focusWindow).filter(window => window)
|
||||
|
||||
signal closeRequested
|
||||
|
||||
function setActive(owner, active, focusWindow) {
|
||||
if (!owner)
|
||||
return;
|
||||
const next = _entries.filter(entry => entry.owner !== owner);
|
||||
if (active) {
|
||||
next.push({
|
||||
"owner": owner,
|
||||
"focusWindow": focusWindow ?? null
|
||||
});
|
||||
}
|
||||
_entries = next;
|
||||
}
|
||||
|
||||
function unregister(owner) {
|
||||
setActive(owner, false, null);
|
||||
}
|
||||
|
||||
function closeAll() {
|
||||
if (_entries.length === 0)
|
||||
return;
|
||||
closeRequested();
|
||||
_entries = [];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user