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
This commit is contained in:
Niklas Stephanblom 2022-06-23 17:13:57 +00:00 committed by Nate Graham
parent 18763d1483
commit 6838b1132f
2 changed files with 9 additions and 2 deletions

View file

@ -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"

View file

@ -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);
}