1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-01-24 21:42:51 -05:00

popout: use mapToItem instead of mapToGlobal for popout positioning

fixes #1152
This commit is contained in:
bbedward
2025-12-25 12:50:26 -05:00
parent ec6db7962a
commit fd839059c0
11 changed files with 104 additions and 112 deletions

View File

@@ -581,7 +581,7 @@ Item {
appDrawerLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
}
if (appDrawerLoader.item && appDrawerLoader.item.setTriggerPosition) {
const globalPos = launcherButton.visualContent.mapToGlobal(0, 0);
const globalPos = launcherButton.visualContent.mapToItem(null, 0, 0);
const currentScreen = barWindow.screen;
const pos = SettingsData.getPopupTriggerPosition(globalPos, currentScreen, barWindow.effectiveBarThickness, launcherButton.visualWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
appDrawerLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, launcherButton.section, currentScreen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
@@ -676,20 +676,20 @@ Item {
if (centerSection) {
if (barWindow.isVertical) {
const centerY = centerSection.height / 2;
const centerGlobalPos = centerSection.mapToGlobal(0, centerY);
const centerGlobalPos = centerSection.mapToItem(null, 0, centerY);
triggerPos = centerGlobalPos;
triggerWidth = centerSection.height;
} else {
const centerGlobalPos = centerSection.mapToGlobal(0, 0);
const centerGlobalPos = centerSection.mapToItem(null, 0, 0);
triggerPos = centerGlobalPos;
triggerWidth = centerSection.width;
}
} else {
triggerPos = visualContent.mapToGlobal(0, 0);
triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth;
}
} else {
triggerPos = visualContent.mapToGlobal(0, 0);
triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth;
}
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
@@ -732,20 +732,20 @@ Item {
if (centerSection) {
if (barWindow.isVertical) {
const centerY = centerSection.height / 2;
const centerGlobalPos = centerSection.mapToGlobal(0, centerY);
const centerGlobalPos = centerSection.mapToItem(null, 0, centerY);
triggerPos = centerGlobalPos;
triggerWidth = centerSection.height;
} else {
const centerGlobalPos = centerSection.mapToGlobal(0, 0);
const centerGlobalPos = centerSection.mapToItem(null, 0, 0);
triggerPos = centerGlobalPos;
triggerWidth = centerSection.width;
}
} else {
triggerPos = visualContent.mapToGlobal(0, 0);
triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth;
}
} else {
triggerPos = visualContent.mapToGlobal(0, 0);
triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth;
}
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
@@ -790,21 +790,21 @@ Item {
// For vertical bars, use center Y of section; for horizontal, use left edge
if (barWindow.isVertical) {
const centerY = centerSection.height / 2;
const centerGlobalPos = centerSection.mapToGlobal(0, centerY);
const centerGlobalPos = centerSection.mapToItem(null, 0, centerY);
triggerPos = centerGlobalPos;
triggerWidth = centerSection.height;
} else {
// For horizontal bars, use left edge (DankPopout will center it)
const centerGlobalPos = centerSection.mapToGlobal(0, 0);
const centerGlobalPos = centerSection.mapToItem(null, 0, 0);
triggerPos = centerGlobalPos;
triggerWidth = centerSection.width;
}
} else {
triggerPos = visualContent.mapToGlobal(0, 0);
triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth;
}
} else {
triggerPos = visualContent.mapToGlobal(0, 0);
triggerPos = visualContent.mapToItem(null, 0, 0);
triggerWidth = visualWidth;
}
const pos = SettingsData.getPopupTriggerPosition(triggerPos, barWindow.screen, barWindow.effectiveBarThickness, triggerWidth, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
@@ -871,7 +871,7 @@ Item {
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
}
if (processListPopoutLoader.item.setTriggerPosition) {
const globalPos = cpuWidget.mapToGlobal(0, 0);
const globalPos = cpuWidget.mapToItem(null, 0, 0);
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, cpuWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
@@ -907,7 +907,7 @@ Item {
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
}
if (processListPopoutLoader.item.setTriggerPosition) {
const globalPos = ramWidget.mapToGlobal(0, 0);
const globalPos = ramWidget.mapToItem(null, 0, 0);
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, ramWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
@@ -957,7 +957,7 @@ Item {
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
}
if (processListPopoutLoader.item.setTriggerPosition) {
const globalPos = cpuTempWidget.mapToGlobal(0, 0);
const globalPos = cpuTempWidget.mapToItem(null, 0, 0);
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, cpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
@@ -993,7 +993,7 @@ Item {
processListPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
}
if (processListPopoutLoader.item.setTriggerPosition) {
const globalPos = gpuTempWidget.mapToGlobal(0, 0);
const globalPos = gpuTempWidget.mapToItem(null, 0, 0);
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, gpuTempWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
processListPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
@@ -1036,7 +1036,7 @@ Item {
notificationCenterLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
}
if (notificationCenterLoader.item.setTriggerPosition) {
const globalPos = notificationButton.mapToGlobal(0, 0);
const globalPos = notificationButton.mapToItem(null, 0, 0);
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, notificationButton.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
notificationCenterLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
@@ -1074,7 +1074,7 @@ Item {
batteryPopoutLoader.item.setBarContext(barPosition, effectiveBarConfig?.bottomGap ?? 0);
}
if (batteryPopoutLoader.item.setTriggerPosition) {
const globalPos = batteryWidget.mapToGlobal(0, 0);
const globalPos = batteryWidget.mapToItem(null, 0, 0);
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, batteryWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
batteryPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
@@ -1107,7 +1107,7 @@ Item {
const barPosition = barWindow.axis?.edge === "left" ? 2 : (barWindow.axis?.edge === "right" ? 3 : (barWindow.axis?.edge === "top" ? 0 : 1));
if (layoutPopoutLoader.item.setTriggerPosition) {
const globalPos = layoutWidget.mapToGlobal(0, 0);
const globalPos = layoutWidget.mapToItem(null, 0, 0);
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, layoutWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "center";
layoutPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
@@ -1147,7 +1147,7 @@ Item {
}
if (vpnPopoutLoader.item.setTriggerPosition) {
const globalPos = vpnWidget.mapToGlobal(0, 0);
const globalPos = vpnWidget.mapToItem(null, 0, 0);
const pos = SettingsData.getPopupTriggerPosition(globalPos, barWindow.screen, barWindow.effectiveBarThickness, vpnWidget.width, effectiveBarConfig?.spacing ?? 4, barPosition, effectiveBarConfig);
const widgetSection = topBarContent.getWidgetSection(parent) || "right";
vpnPopoutLoader.item.setTriggerPosition(pos.x, pos.y, pos.width, widgetSection, barWindow.screen, barPosition, barWindow.effectiveBarThickness, effectiveBarConfig?.spacing ?? 4, effectiveBarConfig);
@@ -1193,7 +1193,7 @@ Item {
}
controlCenterLoader.item.triggerScreen = barWindow.screen;
if (controlCenterLoader.item.setTriggerPosition) {
const globalPos = mapToGlobal(0, 0);
const globalPos = mapToItem(null, 0, 0);
// Use topBarContent.barConfig directly
const effectiveBarConfig = topBarContent.barConfig;
// Calculate barPosition from axis.edge like Battery widget does