mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-08-07 14:08:29 -04:00
workspaces: use stable references for placeholders in ScriptModel to fix
animation jitter related #2754
This commit is contained in:
@@ -107,6 +107,13 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: CompositorService
|
||||||
|
function onCompositorChanged() {
|
||||||
|
root._placeholderPool = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
property var currentWorkspace: {
|
property var currentWorkspace: {
|
||||||
if (useExtWorkspace)
|
if (useExtWorkspace)
|
||||||
return getExtWorkspaceActiveWorkspace();
|
return getExtWorkspaceActiveWorkspace();
|
||||||
@@ -426,41 +433,48 @@ Item {
|
|||||||
return Object.values(byApp);
|
return Object.values(byApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
function padWorkspaces(list) {
|
function _makePlaceholder() {
|
||||||
const padded = list.slice();
|
if (useExtWorkspace)
|
||||||
let placeholder;
|
return {
|
||||||
if (useExtWorkspace) {
|
|
||||||
placeholder = {
|
|
||||||
"id": "",
|
"id": "",
|
||||||
"name": "",
|
"name": "",
|
||||||
"active": false,
|
"active": false,
|
||||||
"_placeholder": true
|
"_placeholder": true
|
||||||
};
|
};
|
||||||
} else if (CompositorService.isNiri) {
|
if (CompositorService.isNiri)
|
||||||
placeholder = {
|
return {
|
||||||
"id": -1,
|
"id": -1,
|
||||||
"idx": -1,
|
"idx": -1,
|
||||||
"name": ""
|
"name": ""
|
||||||
};
|
};
|
||||||
} else if (CompositorService.isHyprland) {
|
if (CompositorService.isHyprland)
|
||||||
placeholder = {
|
return {
|
||||||
"id": -1,
|
"id": -1,
|
||||||
"name": ""
|
"name": ""
|
||||||
};
|
};
|
||||||
} else if (root.isMango) {
|
if (root.isMango)
|
||||||
placeholder = {
|
return {
|
||||||
"tag": -1
|
"tag": -1
|
||||||
};
|
};
|
||||||
} else if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle) {
|
if (CompositorService.isSway || CompositorService.isScroll || CompositorService.isMiracle)
|
||||||
placeholder = {
|
return {
|
||||||
"num": -1,
|
"num": -1,
|
||||||
"_placeholder": true
|
"_placeholder": true
|
||||||
};
|
};
|
||||||
} else {
|
return -1;
|
||||||
placeholder = -1;
|
}
|
||||||
}
|
|
||||||
|
// Stable placeholder instances so ScriptModel (identity-diffed) reuses padding delegates instead of recreating them on workspace churn
|
||||||
|
property var _placeholderPool: []
|
||||||
|
|
||||||
|
function padWorkspaces(list) {
|
||||||
|
const padded = list.slice();
|
||||||
|
let slot = 0;
|
||||||
while (padded.length < 3) {
|
while (padded.length < 3) {
|
||||||
padded.push(placeholder);
|
if (root._placeholderPool.length <= slot)
|
||||||
|
root._placeholderPool.push(root._makePlaceholder());
|
||||||
|
padded.push(root._placeholderPool[slot]);
|
||||||
|
slot++;
|
||||||
}
|
}
|
||||||
return padded;
|
return padded;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user