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 = previousStaticClient(nc); nc = forward ? nextStaticClient(nc) : previousStaticClient(nc);
if (!firstClient)
{
// When we see our first client for the second time,
// it's time to stop.
firstClient = nc;
}
else if (nc == firstClient)
{
// No candidates found.
nc = 0;
break;
}
} while (nc && nc != c && } while (nc && nc != c &&
(( !options_traverse_all && !nc->isOnDesktop(currentDesktop())) || (( !options_traverse_all && !nc->isOnDesktop(currentDesktop())) ||
nc->isMinimized() || !nc->wantsTabFocus() ) ); nc->isMinimized() || !nc->wantsTabFocus() ) );
}
else
{
do
{
nc = nextStaticClient(nc);
} while (nc && nc != c &&
(( !options_traverse_all && !nc->isOnDesktop(currentDesktop())) ||
nc->isMinimized() || !nc->wantsTabFocus() ) );
}
if (c && c != nc)
lowerClient( c );
if (nc) if (nc)
{ {
if (c && c != nc)
lowerClient( c );
if ( options->focusPolicyIsReasonable() ) if ( options->focusPolicyIsReasonable() )
{ {
activateClient( nc ); activateClient( nc );