From 7852b7ad2b03710ddffcb0ea8b6fa493ec9c8feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20B=C3=BCchi?= Date: Sun, 7 Jul 2024 23:57:48 +0200 Subject: [PATCH] make quick switch gesture properly open switcher on end of list doing a quick task switch gesture towards the end of the list should force open the task switcher (there is nothing to switch to) this was half-done on the left side of the switcher (this behavior is not visible with immediate task reordering, but could be hit if we have different ordering criteria or delayed reordering) and due to superfluous Math.max completely not working on the right side always opening the right-most task instead of opening the switcher --- kwin/mobiletaskswitcher/qml/TaskSwitcher.qml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kwin/mobiletaskswitcher/qml/TaskSwitcher.qml b/kwin/mobiletaskswitcher/qml/TaskSwitcher.qml index 59d8b03c..90ad11b7 100644 --- a/kwin/mobiletaskswitcher/qml/TaskSwitcher.qml +++ b/kwin/mobiletaskswitcher/qml/TaskSwitcher.qml @@ -156,13 +156,14 @@ FocusScope { let shouldSwitch = false; if (state.xVelocity > 0 && state.wasInActiveTask) { // flick to the right, go to app to the left - newIndex = state.currentTaskIndex + 1, tasksCount - 1; + newIndex = state.currentTaskIndex + 1; if (newIndex < tasksCount) { // switch only if flick doesn't go over end of list shouldSwitch = true; } } else if (state.xVelocity < 0 && state.wasInActiveTask) { - newIndex = Math.max(state.currentTaskIndex - 1, 0); + // flick to the left, go to app to the right + newIndex = state.currentTaskIndex - 1; if (newIndex >= 0) { // switch only if flick doesn't go over end of list shouldSwitch = true;