effects/presentwindows: Do not highlight windows based on mouse if user is currently typing

If the user is currently typing, do not highlight windows based on the mouse position. If the user types a window title before the effect opening animation is finished, he ends up in a situation where only one window is on the screen but it is deselected (because the mouse is not on the window) or another window is selected because of the mouse. With this change, the mouse input does not overwrite the window highlighting based on the search entered **if the user is currently typing.**
master
Niklas Stephanblome 3 years ago committed by Vlad Zahorodnii
parent 5b86afa6f0
commit f81e84412e

@ -620,28 +620,35 @@ void PresentWindowsEffect::inputEventUpdate(const QPoint &pos, QEvent::Type type
EffectWindow *highlightCandidate = nullptr; EffectWindow *highlightCandidate = nullptr;
for (int i = 0; i < windows.size(); ++i) { for (int i = 0; i < windows.size(); ++i) {
DataHash::const_iterator winData = m_windowData.constFind(windows.at(i)); DataHash::const_iterator winData = m_windowData.constFind(windows.at(i));
if (winData == m_windowData.constEnd()) if (winData == m_windowData.constEnd()) {
continue; continue;
}
if (m_motionManager.transformedGeometry(windows.at(i)).contains(pos) && if (m_motionManager.transformedGeometry(windows.at(i)).contains(pos) &&
winData->visible && !winData->deleted) { winData->visible && !winData->deleted) {
hovering = true; hovering = true;
if (windows.at(i) && m_highlightedWindow != windows.at(i)) if (windows.at(i) && m_highlightedWindow != windows.at(i)) {
highlightCandidate = windows.at(i); highlightCandidate = windows.at(i);
}
break; break;
} }
} }
if (!hovering) if (!hovering) {
setHighlightedWindow(nullptr); if (m_windowFilter.isEmpty()) {
if (m_highlightedWindow && m_motionManager.transformedGeometry(m_highlightedWindow).contains(pos)) setHighlightedWindow(nullptr);
}
}
if (m_highlightedWindow && m_motionManager.transformedGeometry(m_highlightedWindow).contains(pos)) {
updateCloseWindow(); updateCloseWindow();
else if (m_closeView) } else if (m_closeView) {
m_closeView->hide(); m_closeView->hide();
}
if (type == QEvent::MouseButtonRelease) { if (type == QEvent::MouseButtonRelease) {
if (highlightCandidate) if (highlightCandidate) {
setHighlightedWindow(highlightCandidate); setHighlightedWindow(highlightCandidate);
}
if (button == Qt::LeftButton) { if (button == Qt::LeftButton) {
if (hovering) { if (hovering) {
// mouse is hovering above a window - use MouseActionsWindow // mouse is hovering above a window - use MouseActionsWindow
@ -669,8 +676,9 @@ void PresentWindowsEffect::inputEventUpdate(const QPoint &pos, QEvent::Type type
mouseActionDesktop(m_rightButtonDesktop); mouseActionDesktop(m_rightButtonDesktop);
} }
} }
} else if (highlightCandidate && !m_motionManager.areWindowsMoving()) } else if (highlightCandidate && !m_motionManager.areWindowsMoving() && m_windowFilter.isEmpty()) {
setHighlightedWindow(highlightCandidate); setHighlightedWindow(highlightCandidate);
}
} }
bool PresentWindowsEffect::touchDown(qint32 id, const QPointF &pos, quint32 time) bool PresentWindowsEffect::touchDown(qint32 id, const QPointF &pos, quint32 time)
@ -856,6 +864,7 @@ void PresentWindowsEffect::grabbedKeyboardEvent(QKeyEvent *e)
return; // HACK: Workaround for Qt bug on unbound keys (#178547) return; // HACK: Workaround for Qt bug on unbound keys (#178547)
default: default:
if (!e->text().isEmpty()) { if (!e->text().isEmpty()) {
setHighlightedWindow(nullptr);
m_windowFilter.append(e->text()); m_windowFilter.append(e->text());
updateFilterFrame(); updateFilterFrame();
rearrangeWindows(); rearrangeWindows();

Loading…
Cancel
Save