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:
@@ -2556,11 +2556,19 @@ Singleton {
|
|||||||
return edges;
|
return edges;
|
||||||
}
|
}
|
||||||
|
|
||||||
function frameEdgeInsetForSide(screen, side) {
|
readonly property real frameBarContentGap: frameBarInsetPadding < 0 ? frameThickness : frameBarInsetPadding
|
||||||
if (!frameEnabled || !screen)
|
readonly property real frameBarContentGapExtra: Math.max(0, frameBarContentGap - frameThickness)
|
||||||
|
|
||||||
|
function frameEdgeReservation(screen, edge) {
|
||||||
|
if (!screen)
|
||||||
return 0;
|
return 0;
|
||||||
const edges = getActiveBarEdgesForScreen(screen);
|
return getActiveBarEdgesForScreen(screen).includes(edge) ? frameBarSize : frameThickness;
|
||||||
return edges.includes(side) ? frameBarSize : frameThickness;
|
}
|
||||||
|
|
||||||
|
function frameEdgeInsetForSide(screen, side) {
|
||||||
|
if (!frameEnabled)
|
||||||
|
return 0;
|
||||||
|
return frameEdgeReservation(screen, side);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMatugenScheme(scheme) {
|
function setMatugenScheme(scheme) {
|
||||||
|
|||||||
@@ -38,11 +38,10 @@ Item {
|
|||||||
readonly property real _barInsetPaddingRaw: SettingsData.barInsetPaddingSyncAll ? SettingsData.barInsetPaddingShared : (barConfig?.barInsetPadding ?? -1)
|
readonly property real _barInsetPaddingRaw: SettingsData.barInsetPaddingSyncAll ? SettingsData.barInsetPaddingShared : (barConfig?.barInsetPadding ?? -1)
|
||||||
readonly property real _barInsetPaddingAuto: _barIsVertical ? Theme.spacingXS : _edgeBaseMargin
|
readonly property real _barInsetPaddingAuto: _barIsVertical ? Theme.spacingXS : _edgeBaseMargin
|
||||||
readonly property real _barInsetPadding: _barInsetPaddingRaw < 0 ? _barInsetPaddingAuto : _barInsetPaddingRaw
|
readonly property real _barInsetPadding: _barInsetPaddingRaw < 0 ? _barInsetPaddingAuto : _barInsetPaddingRaw
|
||||||
// Connected-frame Bar Inset Padding: absolute free-end gap the hosted bar spans full-width into
|
// Hosted bars span their edge fully; frameBarContentGap is the free-end gap measured from the
|
||||||
// (auto < 0 = frameThickness so widgets align with the interior cutout, 0 = edge-to-edge). The extra
|
// screen edge (auto = frameThickness, aligning widgets with the interior cutout).
|
||||||
// beyond frameThickness is what an adjacent bar end adds on top of its corner alignment.
|
readonly property real _frameInsetResolved: SettingsData.frameBarContentGap
|
||||||
readonly property real _frameInsetResolved: SettingsData.frameBarInsetPadding < 0 ? SettingsData.frameThickness : SettingsData.frameBarInsetPadding
|
readonly property real _frameInsetExtra: SettingsData.frameBarContentGapExtra
|
||||||
readonly property real _frameInsetExtra: Math.max(0, _frameInsetResolved - SettingsData.frameThickness)
|
|
||||||
|
|
||||||
// Horizontal bars span the full width and own the corners; the perpendicular vertical bar
|
// 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
|
// tucks in below/above. Where they meet, inset the corner widget so it centres in the
|
||||||
|
|||||||
@@ -21,11 +21,10 @@ QtObject {
|
|||||||
|
|
||||||
readonly property bool frameExclusionActive: CompositorService.frameWindowVisibleForScreen(screen)
|
readonly property bool frameExclusionActive: CompositorService.frameWindowVisibleForScreen(screen)
|
||||||
readonly property bool usesConnectedFrameChrome: CompositorService.usesConnectedFrameChromeForScreen(screen)
|
readonly property bool usesConnectedFrameChrome: CompositorService.usesConnectedFrameChromeForScreen(screen)
|
||||||
readonly property bool connectedBarActiveOnEdge: usesConnectedFrameChrome && !!screen && SettingsData.getActiveBarEdgesForScreen(screen).includes(edge)
|
|
||||||
|
|
||||||
readonly property real connectedJoinInset: {
|
readonly property real connectedJoinInset: {
|
||||||
if (usesConnectedFrameChrome)
|
if (usesConnectedFrameChrome)
|
||||||
return connectedBarActiveOnEdge ? SettingsData.frameBarSize : SettingsData.frameThickness;
|
return SettingsData.frameEdgeReservation(screen, edge);
|
||||||
if (frameExclusionActive)
|
if (frameExclusionActive)
|
||||||
return SettingsData.frameEdgeInsetForSide(screen, edge);
|
return SettingsData.frameEdgeInsetForSide(screen, edge);
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ Scope {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function exclusionSizeForEdge(edge) {
|
function exclusionSizeForEdge(edge) {
|
||||||
return root.barEdges.includes(edge) ? SettingsData.frameBarSize : SettingsData.frameThickness;
|
return SettingsData.frameEdgeReservation(root.screen, edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|||||||
@@ -262,10 +262,22 @@ PanelWindow {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property int cutoutTopInset: win._regionInt(barEdges.includes("top") ? SettingsData.frameBarSize : SettingsData.frameThickness)
|
readonly property int cutoutTopInset: {
|
||||||
readonly property int cutoutBottomInset: win._regionInt(barEdges.includes("bottom") ? SettingsData.frameBarSize : SettingsData.frameThickness)
|
SettingsData.barConfigs;
|
||||||
readonly property int cutoutLeftInset: win._regionInt(barEdges.includes("left") ? SettingsData.frameBarSize : SettingsData.frameThickness)
|
return win._regionInt(SettingsData.frameEdgeReservation(win.targetScreen, "top"));
|
||||||
readonly property int cutoutRightInset: win._regionInt(barEdges.includes("right") ? SettingsData.frameBarSize : SettingsData.frameThickness)
|
}
|
||||||
|
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 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 cutoutHeight: Math.max(0, win._windowRegionHeight - win.cutoutTopInset - win.cutoutBottomInset)
|
||||||
readonly property int cutoutRadius: {
|
readonly property int cutoutRadius: {
|
||||||
|
|||||||
@@ -360,8 +360,7 @@ QtObject {
|
|||||||
function _frameEdgeInset(side) {
|
function _frameEdgeInset(side) {
|
||||||
if (!manager.modelData)
|
if (!manager.modelData)
|
||||||
return 0;
|
return 0;
|
||||||
const edges = SettingsData.getActiveBarEdgesForScreen(manager.modelData);
|
const raw = SettingsData.frameEdgeReservation(manager.modelData, side);
|
||||||
const raw = edges.includes(side) ? SettingsData.frameBarSize : SettingsData.frameThickness;
|
|
||||||
const dpr = CompositorService.getScreenScale(manager.modelData);
|
const dpr = CompositorService.getScreenScale(manager.modelData);
|
||||||
return Math.max(0, Math.round(Theme.px(raw, dpr)));
|
return Math.max(0, Math.round(Theme.px(raw, dpr)));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ Item {
|
|||||||
LayoutMirroring.childrenInherit: true
|
LayoutMirroring.childrenInherit: true
|
||||||
|
|
||||||
// Bar Inset Padding: resolve the "auto" sentinel (stored < 0) to the frame thickness for the slider display.
|
// 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 {
|
DankFlickable {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|||||||
@@ -584,11 +584,9 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function _frameEdgeInset(side) {
|
function _frameEdgeInset(side) {
|
||||||
if (!root.frameOwnsConnectedChrome || !root.screen)
|
if (!root.frameOwnsConnectedChrome)
|
||||||
return 0;
|
return 0;
|
||||||
const edges = SettingsData.getActiveBarEdgesForScreen(root.screen);
|
return Math.max(0, SettingsData.frameEdgeReservation(root.screen, side));
|
||||||
const raw = edges.includes(side) ? SettingsData.frameBarSize : SettingsData.frameThickness;
|
|
||||||
return Math.max(0, raw);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function _edgeGapFor(side, popupGap) {
|
function _edgeGapFor(side, popupGap) {
|
||||||
|
|||||||
Reference in New Issue
Block a user