From 6838b1132fad8b32c26409fd46b2e49803684dd6 Mon Sep 17 00:00:00 2001 From: Niklas Stephanblom Date: Thu, 23 Jun 2022 17:13:57 +0000 Subject: [PATCH] Windowview: Fix broken keyboard navigation while filtering After the 5.25 update, one could not see which window was highlighted until one manually unfocused the SearchField and then pressed any key to refresh the WindowHeap. Also, the searchbar would (most of the time) "absorb" the arrow keys so one had to also unfocus it to really be able to select windows with they keyboard. With this change, there is always one window highlighted while filtering using the search box. Also, one can select another window with the arrow keys without manually unfocusing the searchbox. This heavily improves the keyboard functionality in this effect that got lost with the 5.25 update of presentwindows to windowview and resolves complaints about the keyboard navigation being buggy. BUG: 455633 BUG: 455764 BUG: 455099 BUG: 455586 BUG: 455753 FIXED-IN: 5.25.2 --- src/effects/windowview/qml/main.qml | 8 ++++++-- src/effects/windowview/windowvieweffect.cpp | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/effects/windowview/qml/main.qml b/src/effects/windowview/qml/main.qml index d7dd9aece4..f859f6765d 100644 --- a/src/effects/windowview/qml/main.qml +++ b/src/effects/windowview/qml/main.qml @@ -75,10 +75,14 @@ Item { Layout.alignment: Qt.AlignCenter Layout.topMargin: PlasmaCore.Units.gridUnit Layout.preferredWidth: Math.min(parent.width, 20 * PlasmaCore.Units.gridUnit) - focus: true + focus: false // Binding loops will be avoided from the fact that setting the text to the same won't emit textChanged // We can't use activeFocus because is not reliable on qml effects - onTextChanged: effect.searchText = text + onTextChanged: { + effect.searchText = text; + heap.resetSelected(); + heap.selectNextItem(WindowHeap.Direction.Down); + } Binding { target: searchField property: "text" diff --git a/src/effects/windowview/windowvieweffect.cpp b/src/effects/windowview/windowvieweffect.cpp index 7c81416885..7c651869fa 100644 --- a/src/effects/windowview/windowvieweffect.cpp +++ b/src/effects/windowview/windowvieweffect.cpp @@ -307,6 +307,7 @@ void WindowViewEffect::activate(const QStringList &windowIds) } if (!internalIds.isEmpty()) { m_windowIds = internalIds; + m_searchText = ""; setRunning(true); } } @@ -324,6 +325,7 @@ void WindowViewEffect::activate() setPartialActivationFactor(0); // This one should be the last. + m_searchText = ""; setRunning(true); } @@ -339,6 +341,7 @@ void WindowViewEffect::partialActivate(qreal factor) setGestureInProgress(true); // This one should be the last. + m_searchText = ""; setRunning(true); }