effects: Re-introduce support for client filtering in WindowHeap

This commit is contained in:
Vlad Zahorodnii 2021-11-22 16:41:59 +02:00 committed by Nate Graham
parent 00c95afcc1
commit 1589e2c918

View file

@ -27,6 +27,7 @@ FocusScope {
property int animationDuration: PlasmaCore.Units.longDuration
property bool animationEnabled: false
property real padding: 0
property var showOnly: []
required property bool organized
readonly property bool effectiveOrganized: expoLayout.ready && organized
@ -51,13 +52,16 @@ FocusScope {
required property int index
readonly property bool selected: heap.selectedIndex == index
readonly property bool hidden: {
return heap.showOnly.length && heap.showOnly.indexOf(client.internalId) == -1;
}
state: {
if (effect.gestureInProgress) {
return "partial";
}
if (heap.effectiveOrganized) {
return "active";
return hidden ? "active-hidden" : "active";
}
return client.minimized ? "initial-minimized" : "initial";
}
@ -241,12 +245,19 @@ FocusScope {
PropertyChanges {
target: closeButton
opacity: 1
},
State {
name: "active-hidden"
extend: "active"
PropertyChanges {
target: thumb
opacity: 0
}
}
]
transitions: Transition {
to: "initial, active"
to: "initial, active, active-hidden"
enabled: heap.animationEnabled
NumberAnimation {
duration: heap.animationDuration
@ -357,9 +368,19 @@ FocusScope {
}
}
function findFirstItem() {
for (let candidateIndex = 0; candidateIndex < windowsRepeater.count; ++candidateIndex) {
const candidateItem = windowsRepeater.itemAt(candidateIndex);
if (!candidateItem.hidden) {
return candidateIndex;
}
}
return -1;
}
function findNextItem(selectedIndex, direction) {
if (selectedIndex == -1) {
return 0;
return findFirstItem();
}
const selectedItem = windowsRepeater.itemAt(selectedIndex);
@ -369,6 +390,9 @@ FocusScope {
case WindowHeap.Direction.Left:
for (let candidateIndex = 0; candidateIndex < windowsRepeater.count; ++candidateIndex) {
const candidateItem = windowsRepeater.itemAt(candidateIndex);
if (candidateItem.hidden) {
continue;
}
if (candidateItem.y + candidateItem.height <= selectedItem.y) {
continue;
@ -391,6 +415,9 @@ FocusScope {
case WindowHeap.Direction.Right:
for (let candidateIndex = 0; candidateIndex < windowsRepeater.count; ++candidateIndex) {
const candidateItem = windowsRepeater.itemAt(candidateIndex);
if (candidateItem.hidden) {
continue;
}
if (candidateItem.y + candidateItem.height <= selectedItem.y) {
continue;
@ -413,6 +440,9 @@ FocusScope {
case WindowHeap.Direction.Up:
for (let candidateIndex = 0; candidateIndex < windowsRepeater.count; ++candidateIndex) {
const candidateItem = windowsRepeater.itemAt(candidateIndex);
if (candidateItem.hidden) {
continue;
}
if (candidateItem.x + candidateItem.width <= selectedItem.x) {
continue;
@ -435,6 +465,9 @@ FocusScope {
case WindowHeap.Direction.Down:
for (let candidateIndex = 0; candidateIndex < windowsRepeater.count; ++candidateIndex) {
const candidateItem = windowsRepeater.itemAt(candidateIndex);
if (candidateItem.hidden) {
continue;
}
if (candidateItem.x + candidateItem.width <= selectedItem.x) {
continue;
@ -522,7 +555,9 @@ FocusScope {
// If the window heap has only one visible window, activate it.
for (let i = 0; i < windowsRepeater.count; ++i) {
const candidateItem = windowsRepeater.itemAt(i);
if (selectedItem) {
if (candidateItem.hidden) {
continue;
} else if (selectedItem) {
selectedItem = null;
break;
}