mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-05-04 03:22:12 -04:00
frame(Connected): Fix connected regression & Ran Performance pass
This commit is contained in:
@@ -74,35 +74,76 @@ Item {
|
||||
readonly property real barY: impl.item ? impl.item.barY : 0
|
||||
readonly property real barWidth: impl.item ? impl.item.barWidth : 0
|
||||
readonly property real barHeight: impl.item ? impl.item.barHeight : 0
|
||||
readonly property bool useConnectedBackend: SettingsData.connectedFrameModeActive && !!screen && SettingsData.isScreenInPreferences(screen, SettingsData.frameScreenPreferences)
|
||||
readonly property var _desiredBackend: useConnectedBackend ? connectedComp : standaloneComp
|
||||
readonly property bool useConnectedBackend: _usesConnectedBackendForScreen(screen)
|
||||
property var _resolvedBackend: null
|
||||
property bool _pendingOpen: false
|
||||
|
||||
Timer {
|
||||
id: _pendingOpenTimer
|
||||
interval: 0
|
||||
onTriggered: {
|
||||
if (!root._pendingOpen || !impl.item)
|
||||
return;
|
||||
root._pendingOpen = false;
|
||||
impl.item.open();
|
||||
}
|
||||
}
|
||||
|
||||
onUseConnectedBackendChanged: _maybeResolveBackend()
|
||||
Component.onCompleted: _resolvedBackend = _desiredBackend
|
||||
Component.onCompleted: _resolvedBackend = _backendForScreen(screen)
|
||||
|
||||
Connections {
|
||||
target: SettingsData
|
||||
function onConnectedFrameModeActiveChanged() {
|
||||
root._maybeResolveBackend();
|
||||
}
|
||||
function onFrameScreenPreferencesChanged() {
|
||||
root._maybeResolveBackend();
|
||||
}
|
||||
}
|
||||
|
||||
function _usesConnectedBackendForScreen(targetScreen) {
|
||||
return SettingsData.connectedFrameModeActive && !!targetScreen && SettingsData.isScreenInPreferences(targetScreen, SettingsData.frameScreenPreferences);
|
||||
}
|
||||
|
||||
function _backendForScreen(targetScreen) {
|
||||
return _usesConnectedBackendForScreen(targetScreen) ? connectedComp : standaloneComp;
|
||||
}
|
||||
|
||||
// Defer Loader source-component swap until impl is fully closed; avoids
|
||||
// tearing down a popout mid-animation when frame mode is toggled.
|
||||
function _maybeResolveBackend() {
|
||||
if (_resolvedBackend === _desiredBackend)
|
||||
_resolveBackendForScreen(screen);
|
||||
}
|
||||
|
||||
function _resolveBackendForScreen(targetScreen) {
|
||||
const backend = _backendForScreen(targetScreen);
|
||||
if (_resolvedBackend === backend)
|
||||
return;
|
||||
if (impl.item && (impl.item.shouldBeVisible || impl.item.isClosing))
|
||||
return;
|
||||
_resolvedBackend = _desiredBackend;
|
||||
_resolvedBackend = backend;
|
||||
}
|
||||
|
||||
function open() {
|
||||
if (impl.item)
|
||||
_maybeResolveBackend();
|
||||
if (impl.item) {
|
||||
_pendingOpen = false;
|
||||
impl.item.open();
|
||||
return;
|
||||
}
|
||||
_pendingOpen = true;
|
||||
}
|
||||
|
||||
function close() {
|
||||
_pendingOpen = false;
|
||||
_pendingOpenTimer.stop();
|
||||
if (impl.item)
|
||||
impl.item.close();
|
||||
}
|
||||
|
||||
function toggle() {
|
||||
shouldBeVisible ? close() : open();
|
||||
(shouldBeVisible || _pendingOpen) ? close() : open();
|
||||
}
|
||||
|
||||
function setBarContext(position, bottomGap) {
|
||||
@@ -126,6 +167,7 @@ Item {
|
||||
|
||||
adjacentBarInfo = SettingsData.getAdjacentBarInfo(targetScreen, pos, barConfig);
|
||||
setBarContext(pos, bottomGap);
|
||||
_resolveBackendForScreen(targetScreen);
|
||||
}
|
||||
|
||||
function updateSurfacePosition() {
|
||||
@@ -185,6 +227,10 @@ Item {
|
||||
it.effectiveBarBottomGap = Qt.binding(() => root.effectiveBarBottomGap);
|
||||
|
||||
it.shouldBeVisible = root.shouldBeVisible;
|
||||
if (root._primeContent && typeof it.primeContent === "function")
|
||||
it.primeContent();
|
||||
if (_pendingOpen)
|
||||
_pendingOpenTimer.restart();
|
||||
}
|
||||
|
||||
function primeContent() {
|
||||
|
||||
@@ -84,6 +84,24 @@ Item {
|
||||
signal popoutClosed
|
||||
signal backgroundClicked
|
||||
|
||||
Timer {
|
||||
id: _fullSyncTimer
|
||||
interval: 0
|
||||
onTriggered: root._flushFullSync()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: _animSyncTimer
|
||||
interval: 0
|
||||
onTriggered: root._flushAnimSync()
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: _bodySyncTimer
|
||||
interval: 0
|
||||
onTriggered: root._flushBodySync()
|
||||
}
|
||||
|
||||
property var _lastOpenedScreen: null
|
||||
property bool isClosing: false
|
||||
|
||||
@@ -266,11 +284,11 @@ Item {
|
||||
if (_fullSyncQueued)
|
||||
return;
|
||||
_fullSyncQueued = true;
|
||||
Qt.callLater(() => {
|
||||
root._fullSyncQueued = false;
|
||||
if (typeof root._syncPopoutChromeState === "function")
|
||||
root._syncPopoutChromeState();
|
||||
});
|
||||
_fullSyncTimer.restart();
|
||||
}
|
||||
function _flushFullSync() {
|
||||
_fullSyncQueued = false;
|
||||
_syncPopoutChromeState();
|
||||
}
|
||||
|
||||
property bool _animSyncQueued: false
|
||||
@@ -278,10 +296,7 @@ Item {
|
||||
if (_animSyncQueued)
|
||||
return;
|
||||
_animSyncQueued = true;
|
||||
Qt.callLater(() => {
|
||||
if (root && typeof root._flushAnimSync === "function")
|
||||
root._flushAnimSync();
|
||||
});
|
||||
_animSyncTimer.restart();
|
||||
}
|
||||
function _flushAnimSync() {
|
||||
_animSyncQueued = false;
|
||||
@@ -294,10 +309,7 @@ Item {
|
||||
if (_bodySyncQueued)
|
||||
return;
|
||||
_bodySyncQueued = true;
|
||||
Qt.callLater(() => {
|
||||
if (root && typeof root._flushBodySync === "function")
|
||||
root._flushBodySync();
|
||||
});
|
||||
_bodySyncTimer.restart();
|
||||
}
|
||||
function _flushBodySync() {
|
||||
_bodySyncQueued = false;
|
||||
@@ -707,8 +719,8 @@ Item {
|
||||
|
||||
blurX: trackBlurFromBarEdge ? contentContainer.x + (contentContainer.barRight ? _dxClamp : 0) : contentContainer.x + contentContainer.width * (1 - s) * 0.5 + Theme.snap(contentContainer.animX, root.dpr) - contentContainer.horizontalConnectorExtent * s
|
||||
blurY: trackBlurFromBarEdge ? contentContainer.y + (contentContainer.barBottom ? _dyClamp : 0) : contentContainer.y + contentContainer.height * (1 - s) * 0.5 + Theme.snap(contentContainer.animY, root.dpr) - contentContainer.verticalConnectorExtent * s
|
||||
blurWidth: (shouldBeVisible && contentWrapper.publishedOpacity > 0) ? (trackBlurFromBarEdge ? Math.max(0, contentContainer.width - Math.abs(_dxClamp)) : (contentContainer.width + contentContainer.horizontalConnectorExtent * 2) * s) : 0
|
||||
blurHeight: (shouldBeVisible && contentWrapper.publishedOpacity > 0) ? (trackBlurFromBarEdge ? Math.max(0, contentContainer.height - Math.abs(_dyClamp)) : (contentContainer.height + contentContainer.verticalConnectorExtent * 2) * s) : 0
|
||||
blurWidth: shouldBeVisible ? (trackBlurFromBarEdge ? Math.max(0, contentContainer.width - Math.abs(_dxClamp)) : (contentContainer.width + contentContainer.horizontalConnectorExtent * 2) * s) : 0
|
||||
blurHeight: shouldBeVisible ? (trackBlurFromBarEdge ? Math.max(0, contentContainer.height - Math.abs(_dyClamp)) : (contentContainer.height + contentContainer.verticalConnectorExtent * 2) * s) : 0
|
||||
blurRadius: Theme.isConnectedEffect ? Theme.connectedCornerRadius : Theme.connectedSurfaceRadius
|
||||
}
|
||||
|
||||
@@ -1077,7 +1089,11 @@ Item {
|
||||
duration: Math.round(Theme.variantDuration(animationDuration, shouldBeVisible) * Theme.variantOpacityDurationScale)
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
|
||||
onRunningChanged: contentWrapper._animating = running
|
||||
onRunningChanged: {
|
||||
contentWrapper._animating = running;
|
||||
if (!running && !root.shouldBeVisible)
|
||||
contentWrapper._renderActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1087,8 +1103,6 @@ Item {
|
||||
duration: Math.round(Theme.variantDuration(animationDuration, shouldBeVisible) * Theme.variantOpacityDurationScale)
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
|
||||
onRunningChanged: if (!running && contentWrapper.publishedOpacity === 0)
|
||||
contentWrapper._renderActive = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1100,6 +1114,14 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: contentWindow
|
||||
function onVisibleChanged() {
|
||||
if (!contentWindow.visible)
|
||||
contentWrapper._renderActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
clip: false
|
||||
|
||||
@@ -553,7 +553,7 @@ Item {
|
||||
targetWindow: contentWindow
|
||||
readonly property real s: Math.min(1, contentContainer.scaleValue)
|
||||
readonly property bool trackBlurFromBarEdge: root.fluidStandaloneActive
|
||||
readonly property bool blurAlive: trackBlurFromBarEdge ? (contentContainer.revealWidth > 0 && contentContainer.revealHeight > 0) : (root.shouldBeVisible && contentWrapper.publishedOpacity > 0)
|
||||
readonly property bool blurAlive: trackBlurFromBarEdge ? (contentContainer.revealWidth > 0 && contentContainer.revealHeight > 0) : root.shouldBeVisible
|
||||
|
||||
blurX: trackBlurFromBarEdge ? contentContainer.x + contentContainer.revealX : contentContainer.x + contentContainer.width * (1 - s) * 0.5 + Theme.snap(contentContainer.animX, root.dpr)
|
||||
blurY: trackBlurFromBarEdge ? contentContainer.y + contentContainer.revealY : contentContainer.y + contentContainer.height * (1 - s) * 0.5 + Theme.snap(contentContainer.animY, root.dpr)
|
||||
@@ -825,7 +825,11 @@ Item {
|
||||
duration: Math.round(Theme.variantDuration(root.animationDuration, root.shouldBeVisible) * Theme.variantOpacityDurationScale)
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
|
||||
onRunningChanged: contentWrapper._animating = running
|
||||
onRunningChanged: {
|
||||
contentWrapper._animating = running;
|
||||
if (!running && !root.shouldBeVisible)
|
||||
contentWrapper._renderActive = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -835,8 +839,6 @@ Item {
|
||||
duration: Math.round(Theme.variantDuration(root.animationDuration, root.shouldBeVisible) * Theme.variantOpacityDurationScale)
|
||||
easing.type: Easing.BezierSpline
|
||||
easing.bezierCurve: root.shouldBeVisible ? root.animationEnterCurve : root.animationExitCurve
|
||||
onRunningChanged: if (!running && contentWrapper.publishedOpacity === 0)
|
||||
contentWrapper._renderActive = false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -848,6 +850,14 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: contentWindow
|
||||
function onVisibleChanged() {
|
||||
if (!contentWindow.visible)
|
||||
contentWrapper._renderActive = false;
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
id: contentLoader
|
||||
anchors.fill: parent
|
||||
|
||||
Reference in New Issue
Block a user