1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-06-10 05:03:28 -04:00

refactor(framemode): connected surfaces

This commit is contained in:
purian23
2026-06-09 13:40:53 -04:00
parent 8856d45887
commit f8b32cc298
14 changed files with 1523 additions and 454 deletions
+28 -5
View File
@@ -186,13 +186,36 @@ Variants {
return;
}
const presented = dock.visible && (dock.reveal || slideXAnimation.running || slideYAnimation.running) && dock.hasApps;
const phase = !presented ? "hidden" : ((!dock.reveal && (slideXAnimation.running || slideYAnimation.running)) ? "closing" : ((slideXAnimation.running || slideYAnimation.running) ? "opening" : "open"));
const bodyX = dock._dockWindowOriginX() + dockBackground.x + dockContainer.x + dockMouseArea.x + dockCore.x;
const bodyY = dock._dockWindowOriginY() + dockBackground.y + dockContainer.y + dockMouseArea.y + dockCore.y;
const bodyW = dock.hasApps ? dockBackground.width : 0;
const bodyH = dock.hasApps ? dockBackground.height : 0;
ConnectedModeState.setDockState(dock._dockScreenName, {
"reveal": dock.visible && (dock.reveal || slideXAnimation.running || slideYAnimation.running) && dock.hasApps,
"kind": "dock",
"screenName": dock._dockScreenName,
"phase": phase,
"visible": presented,
"presented": presented,
"reveal": presented,
"barSide": dock.connectedBarSide,
"bodyX": dock._dockWindowOriginX() + dockBackground.x + dockContainer.x + dockMouseArea.x + dockCore.x,
"bodyY": dock._dockWindowOriginY() + dockBackground.y + dockContainer.y + dockMouseArea.y + dockCore.y,
"bodyW": dock.hasApps ? dockBackground.width : 0,
"bodyH": dock.hasApps ? dockBackground.height : 0,
"bodyRect": {
"x": bodyX,
"y": bodyY,
"width": bodyW,
"height": bodyH
},
"animationOffset": {
"x": dockSlide.x,
"y": dockSlide.y
},
"scale": 1,
"opacity": Theme.connectedSurfaceColor.a,
"bodyX": bodyX,
"bodyY": bodyY,
"bodyW": bodyW,
"bodyH": bodyH,
"slideX": dockSlide.x,
"slideY": dockSlide.y
});
+36 -29
View File
@@ -1,9 +1,13 @@
pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Effects
import QtQuick.Shapes
import qs.Common
// Frame perimeter ring: the full window rectangle with a rounded-rectangle
// cutout. Drawn as a single even-odd Shape so the ring is one primitive: no
// full-output mask textures, and a translucent fill never double-blends at the
// corners.
Item {
id: root
@@ -16,39 +20,42 @@ Item {
required property real cutoutRadius
property color borderColor: Qt.rgba(SettingsData.effectiveFrameColor.r, SettingsData.effectiveFrameColor.g, SettingsData.effectiveFrameColor.b, SettingsData.frameOpacity)
Rectangle {
id: borderRect
// Path elements can't reference `parent`; expose cutout edges as root props.
readonly property real _left: cutoutLeftInset
readonly property real _top: cutoutTopInset
readonly property real _right: width - cutoutRightInset
readonly property real _bottom: height - cutoutBottomInset
readonly property real _radius: Math.max(0, Math.min(cutoutRadius, (_right - _left) / 2, (_bottom - _top) / 2))
Shape {
anchors.fill: parent
// Bake frameOpacity into the color alpha rather than using the `opacity` property
color: root.borderColor
asynchronous: false
preferredRendererType: Shape.CurveRenderer
antialiasing: true
layer.enabled: true
layer.effect: MultiEffect {
maskSource: cutoutMask
maskEnabled: true
maskInverted: true
maskThresholdMin: 0.5
maskSpreadAtMin: 1
}
}
ShapePath {
fillColor: root.borderColor
strokeWidth: -1
fillRule: ShapePath.OddEvenFill
Item {
id: cutoutMask
// Outer rectangle (window edge, square corners)
startX: 0
startY: 0
PathLine { x: root.width; y: 0 }
PathLine { x: root.width; y: root.height }
PathLine { x: 0; y: root.height }
PathLine { x: 0; y: 0 }
anchors.fill: parent
layer.enabled: true
visible: false
Rectangle {
anchors {
fill: parent
topMargin: root.cutoutTopInset
bottomMargin: root.cutoutBottomInset
leftMargin: root.cutoutLeftInset
rightMargin: root.cutoutRightInset
}
radius: root.cutoutRadius
// Inner rounded-rectangle cutout (second subpath → even-odd hole)
PathMove { x: root._left + root._radius; y: root._top }
PathLine { x: root._right - root._radius; y: root._top }
PathArc { x: root._right; y: root._top + root._radius; radiusX: root._radius; radiusY: root._radius }
PathLine { x: root._right; y: root._bottom - root._radius }
PathArc { x: root._right - root._radius; y: root._bottom; radiusX: root._radius; radiusY: root._radius }
PathLine { x: root._left + root._radius; y: root._bottom }
PathArc { x: root._left; y: root._bottom - root._radius; radiusX: root._radius; radiusY: root._radius }
PathLine { x: root._left; y: root._top + root._radius }
PathArc { x: root._left + root._radius; y: root._top; radiusX: root._radius; radiusY: root._radius }
}
}
}
File diff suppressed because it is too large Load Diff
@@ -513,13 +513,30 @@ QtObject {
ConnectedModeState.clearNotificationState(screenName);
return;
}
const bodyRect = {
x: minX,
y: minY,
width: maxXEnd - minX,
height: maxYEnd - minY
};
ConnectedModeState.setNotificationState(screenName, {
kind: "notification",
screenName: screenName,
phase: "open",
visible: true,
presented: true,
barSide: notifBarSide,
bodyRect: bodyRect,
animationOffset: {
x: 0,
y: 0
},
scale: 1,
opacity: Theme.connectedSurfaceColor.a,
bodyX: minX,
bodyY: minY,
bodyW: maxXEnd - minX,
bodyH: maxYEnd - minY,
bodyW: bodyRect.width,
bodyH: bodyRect.height,
omitStartConnector: _notificationOmitStartConnector(),
omitEndConnector: _notificationOmitEndConnector()
});