Avoid infinite loop with CDE-style Alt+Tab (#112737).

svn path=/trunk/KDE/kdebase/workspace/; revision=488475
This commit is contained in:
Luboš Luňák 2005-12-14 17:02:29 +00:00
parent d41b6d71fc
commit b627b8b43e

View file

@ -931,28 +931,29 @@ void Workspace::CDEWalkThroughWindows( bool forward )
options_traverse_all = group.readNumEntry("TraverseAll", false ); options_traverse_all = group.readNumEntry("TraverseAll", false );
} }
if ( !forward ) Client* firstClient = 0;
do
{ {
do nc = forward ? nextStaticClient(nc) : previousStaticClient(nc);
if (!firstClient)
{ {
nc = previousStaticClient(nc); // When we see our first client for the second time,
} while (nc && nc != c && // it's time to stop.
(( !options_traverse_all && !nc->isOnDesktop(currentDesktop())) || firstClient = nc;
nc->isMinimized() || !nc->wantsTabFocus() ) ); }
} else if (nc == firstClient)
else
{
do
{ {
nc = nextStaticClient(nc); // No candidates found.
} while (nc && nc != c && nc = 0;
(( !options_traverse_all && !nc->isOnDesktop(currentDesktop())) || break;
nc->isMinimized() || !nc->wantsTabFocus() ) ); }
} } while (nc && nc != c &&
if (c && c != nc) (( !options_traverse_all && !nc->isOnDesktop(currentDesktop())) ||
lowerClient( c ); nc->isMinimized() || !nc->wantsTabFocus() ) );
if (nc) if (nc)
{ {
if (c && c != nc)
lowerClient( c );
if ( options->focusPolicyIsReasonable() ) if ( options->focusPolicyIsReasonable() )
{ {
activateClient( nc ); activateClient( nc );