From 41eea9dd3b0cf9b88c1596e03049b50512d84a6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20L=C3=BCbking?= Date: Tue, 13 Mar 2012 08:46:09 +0100 Subject: [PATCH] Don't highlight windows w/o mouse CCBUG: 292630 REVIEW: 104264 --- effects/presentwindows/presentwindows.cpp | 30 ++++++++++------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/effects/presentwindows/presentwindows.cpp b/effects/presentwindows/presentwindows.cpp index fcf5420aab..3a0eec6828 100755 --- a/effects/presentwindows/presentwindows.cpp +++ b/effects/presentwindows/presentwindows.cpp @@ -565,6 +565,8 @@ void PresentWindowsEffect::windowInputMouseEvent(Window w, QEvent *e) break; } } + if (!hovering) + setHighlightedWindow(NULL); if (m_highlightedWindow && m_motionManager.transformedGeometry(m_highlightedWindow).contains(me->pos())) updateCloseWindow(); else if (m_closeView) @@ -751,36 +753,28 @@ void PresentWindowsEffect::grabbedKeyboardEvent(QKeyEvent *e) switch(e->key()) { // Wrap only if not auto-repeating case Qt::Key_Left: - if (m_highlightedWindow) - setHighlightedWindow(relativeWindow(m_highlightedWindow, -1, 0, !e->isAutoRepeat())); + setHighlightedWindow(relativeWindow(m_highlightedWindow, -1, 0, !e->isAutoRepeat())); break; case Qt::Key_Right: - if (m_highlightedWindow) - setHighlightedWindow(relativeWindow(m_highlightedWindow, 1, 0, !e->isAutoRepeat())); + setHighlightedWindow(relativeWindow(m_highlightedWindow, 1, 0, !e->isAutoRepeat())); break; case Qt::Key_Up: - if (m_highlightedWindow) - setHighlightedWindow(relativeWindow(m_highlightedWindow, 0, -1, !e->isAutoRepeat())); + setHighlightedWindow(relativeWindow(m_highlightedWindow, 0, -1, !e->isAutoRepeat())); break; case Qt::Key_Down: - if (m_highlightedWindow) - setHighlightedWindow(relativeWindow(m_highlightedWindow, 0, 1, !e->isAutoRepeat())); + setHighlightedWindow(relativeWindow(m_highlightedWindow, 0, 1, !e->isAutoRepeat())); break; case Qt::Key_Home: - if (m_highlightedWindow) - setHighlightedWindow(relativeWindow(m_highlightedWindow, -1000, 0, false)); + setHighlightedWindow(relativeWindow(m_highlightedWindow, -1000, 0, false)); break; case Qt::Key_End: - if (m_highlightedWindow) - setHighlightedWindow(relativeWindow(m_highlightedWindow, 1000, 0, false)); + setHighlightedWindow(relativeWindow(m_highlightedWindow, 1000, 0, false)); break; case Qt::Key_PageUp: - if (m_highlightedWindow) - setHighlightedWindow(relativeWindow(m_highlightedWindow, 0, -1000, false)); + setHighlightedWindow(relativeWindow(m_highlightedWindow, 0, -1000, false)); break; case Qt::Key_PageDown: - if (m_highlightedWindow) - setHighlightedWindow(relativeWindow(m_highlightedWindow, 0, 1000, false)); + setHighlightedWindow(relativeWindow(m_highlightedWindow, 0, 1000, false)); break; case Qt::Key_Backspace: if (!m_windowFilter.isEmpty()) { @@ -936,7 +930,7 @@ void PresentWindowsEffect::rearrangeWindows() } } if (windowlist.isEmpty()) { - setHighlightedWindow(NULL); // TODO: Having a NULL highlighted window isn't really safe + setHighlightedWindow(NULL); return; } @@ -1762,6 +1756,8 @@ void PresentWindowsEffect::closeWindow() EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, int ydiff, bool wrap) const { + if (!w) + return m_motionManager.managedWindows().first(); // TODO: Is it possible to select hidden windows? EffectWindow* next; QRect area = effects->clientArea(FullArea, 0, effects->currentDesktop());