1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-08-01 19:18:28 -04:00

frame: consolidate and simplify inset logic

This commit is contained in:
bbedward
2026-07-27 13:10:36 -04:00
parent 8594a414ec
commit 73da4879f6
8 changed files with 38 additions and 23 deletions
@@ -38,11 +38,10 @@ Item {
readonly property real _barInsetPaddingRaw: SettingsData.barInsetPaddingSyncAll ? SettingsData.barInsetPaddingShared : (barConfig?.barInsetPadding ?? -1)
readonly property real _barInsetPaddingAuto: _barIsVertical ? Theme.spacingXS : _edgeBaseMargin
readonly property real _barInsetPadding: _barInsetPaddingRaw < 0 ? _barInsetPaddingAuto : _barInsetPaddingRaw
// Connected-frame Bar Inset Padding: absolute free-end gap the hosted bar spans full-width into
// (auto < 0 = frameThickness so widgets align with the interior cutout, 0 = edge-to-edge). The extra
// beyond frameThickness is what an adjacent bar end adds on top of its corner alignment.
readonly property real _frameInsetResolved: SettingsData.frameBarInsetPadding < 0 ? SettingsData.frameThickness : SettingsData.frameBarInsetPadding
readonly property real _frameInsetExtra: Math.max(0, _frameInsetResolved - SettingsData.frameThickness)
// Hosted bars span their edge fully; frameBarContentGap is the free-end gap measured from the
// screen edge (auto = frameThickness, aligning widgets with the interior cutout).
readonly property real _frameInsetResolved: SettingsData.frameBarContentGap
readonly property real _frameInsetExtra: SettingsData.frameBarContentGapExtra
// Horizontal bars span the full width and own the corners; the perpendicular vertical bar
// tucks in below/above. Where they meet, inset the corner widget so it centres in the
+1 -2
View File
@@ -21,11 +21,10 @@ QtObject {
readonly property bool frameExclusionActive: CompositorService.frameWindowVisibleForScreen(screen)
readonly property bool usesConnectedFrameChrome: CompositorService.usesConnectedFrameChromeForScreen(screen)
readonly property bool connectedBarActiveOnEdge: usesConnectedFrameChrome && !!screen && SettingsData.getActiveBarEdgesForScreen(screen).includes(edge)
readonly property real connectedJoinInset: {
if (usesConnectedFrameChrome)
return connectedBarActiveOnEdge ? SettingsData.frameBarSize : SettingsData.frameThickness;
return SettingsData.frameEdgeReservation(screen, edge);
if (frameExclusionActive)
return SettingsData.frameEdgeInsetForSide(screen, edge);
return 0;
+1 -1
View File
@@ -34,7 +34,7 @@ Scope {
}
function exclusionSizeForEdge(edge) {
return root.barEdges.includes(edge) ? SettingsData.frameBarSize : SettingsData.frameThickness;
return SettingsData.frameEdgeReservation(root.screen, edge);
}
Loader {
+16 -4
View File
@@ -262,10 +262,22 @@ PanelWindow {
return false;
}
readonly property int cutoutTopInset: win._regionInt(barEdges.includes("top") ? SettingsData.frameBarSize : SettingsData.frameThickness)
readonly property int cutoutBottomInset: win._regionInt(barEdges.includes("bottom") ? SettingsData.frameBarSize : SettingsData.frameThickness)
readonly property int cutoutLeftInset: win._regionInt(barEdges.includes("left") ? SettingsData.frameBarSize : SettingsData.frameThickness)
readonly property int cutoutRightInset: win._regionInt(barEdges.includes("right") ? SettingsData.frameBarSize : SettingsData.frameThickness)
readonly property int cutoutTopInset: {
SettingsData.barConfigs;
return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "top"));
}
readonly property int cutoutBottomInset: {
SettingsData.barConfigs;
return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "bottom"));
}
readonly property int cutoutLeftInset: {
SettingsData.barConfigs;
return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "left"));
}
readonly property int cutoutRightInset: {
SettingsData.barConfigs;
return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "right"));
}
readonly property int cutoutWidth: Math.max(0, win._windowRegionWidth - win.cutoutLeftInset - win.cutoutRightInset)
readonly property int cutoutHeight: Math.max(0, win._windowRegionHeight - win.cutoutTopInset - win.cutoutBottomInset)
readonly property int cutoutRadius: {
@@ -360,8 +360,7 @@ QtObject {
function _frameEdgeInset(side) {
if (!manager.modelData)
return 0;
const edges = SettingsData.getActiveBarEdgesForScreen(manager.modelData);
const raw = edges.includes(side) ? SettingsData.frameBarSize : SettingsData.frameThickness;
const raw = SettingsData.frameEdgeReservation(manager.modelData, side);
const dpr = CompositorService.getScreenScale(manager.modelData);
return Math.max(0, Math.round(Theme.px(raw, dpr)));
}
+1 -1
View File
@@ -13,7 +13,7 @@ Item {
LayoutMirroring.childrenInherit: true
// Bar Inset Padding: resolve the "auto" sentinel (stored < 0) to the frame thickness for the slider display.
readonly property int frameInsetPaddingDisplay: SettingsData.frameBarInsetPadding < 0 ? Math.round(SettingsData.frameThickness) : SettingsData.frameBarInsetPadding
readonly property int frameInsetPaddingDisplay: Math.round(SettingsData.frameBarContentGap)
DankFlickable {
anchors.fill: parent