taskswitcher: add delay for tasks reordering

This commit is contained in:
Yari Polla 2022-04-29 01:39:29 +02:00 committed by Devin Lin
parent 8f1289139f
commit 02bc67af81
2 changed files with 19 additions and 0 deletions

View file

@ -46,6 +46,7 @@ Item {
} }
function activateApp() { function activateApp() {
taskSwitcherState.wasInActiveTask = false;
taskSwitcher.activateWindow(model.index); taskSwitcher.activateWindow(model.index);
} }
//END functions //END functions

View file

@ -73,6 +73,14 @@ Item {
oldTasksCount = tasksCount; oldTasksCount = tasksCount;
} }
Timer {
id: reorderTimer
interval: 5000
onTriggered: tasksModel.taskReorderingEnabled = true
}
//BEGIN functions //BEGIN functions
function show(animation) { function show(animation) {
@ -83,6 +91,9 @@ Item {
taskSwitcherState.wasInActiveTask = tasksModel.activeTask.row >= 0; taskSwitcherState.wasInActiveTask = tasksModel.activeTask.row >= 0;
taskSwitcherState.currentlyBeingOpened = true; taskSwitcherState.currentlyBeingOpened = true;
reorderTimer.stop();
tasksModel.taskReorderingEnabled = false;
// skip to first active task // skip to first active task
if (taskSwitcherState.wasInActiveTask) { if (taskSwitcherState.wasInActiveTask) {
taskSwitcherState.goToTaskIndex(tasksModel.activeTask.row); taskSwitcherState.goToTaskIndex(tasksModel.activeTask.row);
@ -140,6 +151,12 @@ Item {
} }
instantHide(); instantHide();
if (taskSwitcherState.wasInActiveTask) {
reorderTimer.restart();
} else {
tasksModel.taskReorderingEnabled = true;
}
} }
function minimizeAll() { function minimizeAll() {
@ -156,6 +173,7 @@ Item {
easing.type: Easing.InOutQuad easing.type: Easing.InOutQuad
onFinished: { onFinished: {
root.visible = false; root.visible = false;
tasksModel.taskReorderingEnabled = true;
} }
} }