Index: effects/presentwindows/presentwindows.h =================================================================== --- effects/presentwindows/presentwindows.h +++ effects/presentwindows/presentwindows.h @@ -264,6 +264,7 @@ bool isSelectableWindow(EffectWindow *w); bool isVisibleWindow(EffectWindow *w); void setHighlightedWindow(EffectWindow *w); + EffectWindow* nextWindow(EffectWindow *w) const; EffectWindow* relativeWindow(EffectWindow *w, int xdiff, int ydiff, bool wrap) const; EffectWindow* findFirstWindow() const; void updateCloseWindow(); Index: effects/presentwindows/presentwindows.cpp =================================================================== --- effects/presentwindows/presentwindows.cpp +++ effects/presentwindows/presentwindows.cpp @@ -811,7 +811,8 @@ setActive(false); return; case Qt::Key_Tab: - return; // Nothing at the moment + setHighlightedWindow(nextWindow(m_highlightedWindow)); + return; case Qt::Key_Delete: if (!m_windowFilter.isEmpty()) { m_windowFilter.clear(); @@ -1784,6 +1785,34 @@ m_highlightedWindow->closeWindow(); } +EffectWindow* PresentWindowsEffect::nextWindow(EffectWindow *w) const +{ + if (!w) + return m_motionManager.managedWindows().first(); + // TODO: Is it possible to select hidden windows? + EffectWindow* next = nullptr; + + EffectWindowList windowList = m_motionManager.managedWindows(); + int originalIndex = windowList.indexOf(w); + int index = originalIndex + 1; + int size = windowList.size(); + + if (index >= size) + index = 0; + + next = windowList.at(index); + DataHash::const_iterator winData = m_windowData.find(windowList.at(index)); + while (!winData->visible && index != originalIndex) { + index++; + if (index >= size) + index = 0; + winData = m_windowData.find(windowList.at(index)); + } + next = windowList.at(index); + + return next; +} + EffectWindow* PresentWindowsEffect::relativeWindow(EffectWindow *w, int xdiff, int ydiff, bool wrap) const { if (!w)