mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-05 21:18:30 -04:00
frame: merge bars with frame window and get things on Top layer by
default
This commit is contained in:
@@ -12,6 +12,50 @@ Singleton {
|
||||
property var widgetRegistry: ({})
|
||||
property var dankBarRepeater: null
|
||||
|
||||
// Bars rendered inside the frame surface (connected mode) have no DankBarWindow in the
|
||||
// repeater, so they self-register here (screenName -> DankBarBody) for trigger routing.
|
||||
property var frameHostedBars: ({})
|
||||
|
||||
// Shared dock context-menu windows (created in DMSShell) so a frame-hosted dock can reach them.
|
||||
property var dockContextMenu: null
|
||||
property var dockTrashContextMenu: null
|
||||
|
||||
function registerFrameBar(screenName, body) {
|
||||
if (!screenName || !body)
|
||||
return;
|
||||
const next = Object.assign({}, frameHostedBars);
|
||||
next[screenName] = body;
|
||||
frameHostedBars = next;
|
||||
}
|
||||
|
||||
function unregisterFrameBar(screenName, body) {
|
||||
if (!screenName || frameHostedBars[screenName] !== body)
|
||||
return;
|
||||
const next = Object.assign({}, frameHostedBars);
|
||||
delete next[screenName];
|
||||
frameHostedBars = next;
|
||||
}
|
||||
|
||||
// DankBar items self-register here (barConfig id -> DankBar) so frame-hosted bars can
|
||||
// resolve their models/rootWindow reactively, independent of repeater load ordering.
|
||||
property var dankBarItems: ({})
|
||||
|
||||
function registerDankBarItem(barId, item) {
|
||||
if (!barId || !item)
|
||||
return;
|
||||
const next = Object.assign({}, dankBarItems);
|
||||
next[barId] = item;
|
||||
dankBarItems = next;
|
||||
}
|
||||
|
||||
function unregisterDankBarItem(barId, item) {
|
||||
if (!barId || dankBarItems[barId] !== item)
|
||||
return;
|
||||
const next = Object.assign({}, dankBarItems);
|
||||
delete next[barId];
|
||||
dankBarItems = next;
|
||||
}
|
||||
|
||||
signal widgetRegistered(string widgetId, string screenName)
|
||||
signal widgetUnregistered(string widgetId, string screenName)
|
||||
|
||||
@@ -141,6 +185,9 @@ Singleton {
|
||||
}
|
||||
|
||||
function getBarWindowForScreen(screenName) {
|
||||
if (frameHostedBars[screenName])
|
||||
return frameHostedBars[screenName];
|
||||
|
||||
if (!dankBarRepeater)
|
||||
return null;
|
||||
|
||||
@@ -170,17 +217,18 @@ Singleton {
|
||||
}
|
||||
|
||||
function getFirstBarWindow() {
|
||||
if (!dankBarRepeater || dankBarRepeater.count === 0)
|
||||
return null;
|
||||
if (dankBarRepeater) {
|
||||
for (var i = 0; i < dankBarRepeater.count; i++) {
|
||||
const barItem = dankBarRepeater.itemAt(i)?.item;
|
||||
if (barItem?.barVariants?.instances?.length > 0)
|
||||
return barItem.barVariants.instances[0];
|
||||
}
|
||||
}
|
||||
|
||||
const loader = dankBarRepeater.itemAt(0);
|
||||
if (!loader?.item)
|
||||
return null;
|
||||
|
||||
const barItem = loader.item;
|
||||
if (!barItem.barVariants?.instances || barItem.barVariants.instances.length === 0)
|
||||
return null;
|
||||
|
||||
return barItem.barVariants.instances[0];
|
||||
for (const screenName in frameHostedBars) {
|
||||
if (frameHostedBars[screenName])
|
||||
return frameHostedBars[screenName];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user