From b3dc5f15ad7cb053f206980a7da09fe8647d8836 Mon Sep 17 00:00:00 2001 From: Devin Lin Date: Thu, 30 Mar 2023 22:26:35 -0700 Subject: [PATCH] kwin/mobiletaskswitcher: Fix touchscreen not being able to dismiss task switcher It seems TapHandler is not able to receive touchscreen events anymore, use MouseArea. --- kwin/mobiletaskswitcher/qml/Task.qml | 2 +- kwin/mobiletaskswitcher/qml/TaskList.qml | 27 +++++++++++------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/kwin/mobiletaskswitcher/qml/Task.qml b/kwin/mobiletaskswitcher/qml/Task.qml index 36fdfc85..9511a948 100644 --- a/kwin/mobiletaskswitcher/qml/Task.qml +++ b/kwin/mobiletaskswitcher/qml/Task.qml @@ -38,7 +38,7 @@ Item { function activateApp() { taskSwitcherState.wasInActiveTask = false; taskSwitcher.activateWindow(model.index, delegate.window); - window.setMaximize(true, true); + delegate.window.setMaximize(true, true); } function minimizeApp() { diff --git a/kwin/mobiletaskswitcher/qml/TaskList.qml b/kwin/mobiletaskswitcher/qml/TaskList.qml index e60a8b7c..d7c1d736 100644 --- a/kwin/mobiletaskswitcher/qml/TaskList.qml +++ b/kwin/mobiletaskswitcher/qml/TaskList.qml @@ -9,7 +9,7 @@ import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.kwin 3.0 as KWinComponents -Item { +MouseArea { id: root readonly property int count: repeater.count @@ -68,22 +68,19 @@ Item { yScale: taskSwitcherState.currentScale } - // taphandler activates even if delegate touched - TapHandler { - enabled: !taskSwitcherState.currentlyBeingOpened - - onTapped: { - // if tapped on the background, then hide - if (root.childAt(eventPoint.position.x, eventPoint.position.y) === null) { - taskSwitcher.hide(); - } + onClicked: { + console.log('tapped') + // if tapped on the background, then hide + if (!taskSwitcherState.currentlyBeingOpened) { + taskSwitcher.hide(); } + } - onPressedChanged: { - if (pressed) { - // ensure animations aren't running when finger is pressed - taskSwitcherState.cancelAnimations(); - } + onPressedChanged: { + console.log('pressed') + if (!taskSwitcherState.currentlyBeingOpened && pressed) { + // ensure animations aren't running when finger is pressed + taskSwitcherState.cancelAnimations(); } }