From 673aa3946269e06c93f8758f6a395076025bfa7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Sat, 2 Feb 2008 19:00:06 +0000 Subject: [PATCH] Animation cycles only one time over the stack to go to the next selected window, even if and are pressed more often. Fixes odd behaviour if and are holded. svn path=/trunk/KDE/kdebase/workspace/; revision=770090 --- effects/flipswitch.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/effects/flipswitch.cpp b/effects/flipswitch.cpp index 8323b64e2f..5da60a1416 100644 --- a/effects/flipswitch.cpp +++ b/effects/flipswitch.cpp @@ -449,12 +449,13 @@ void FlipSwitchEffect::tabBoxUpdated() // determine the switch direction int index = effects->currentTabBoxWindowList().indexOf(effects->currentTabBoxWindow()); bool direction = false; + int windowCount = effects->currentTabBoxWindowList().count(); if( index > selectedWindow ) { - if( index == effects->currentTabBoxWindowList().count()-1 && selectedWindow == 0 ) forward = false; + if( index == windowCount-1 && selectedWindow == 0 ) forward = false; else direction = true; } - else if( index == 0 && ( selectedWindow == effects->currentTabBoxWindowList().count()-1 ) ) + else if( index == 0 && ( selectedWindow == windowCount-1 ) ) { direction = true; } @@ -474,6 +475,8 @@ void FlipSwitchEffect::tabBoxUpdated() { if( direction ) rearrangeWindows--; else rearrangeWindows++; + if( rearrangeWindows >= windowCount ) rearrangeWindows = rearrangeWindows % windowCount; + else if( (-1*rearrangeWindows) >= windowCount ) rearrangeWindows = -1*((-1*rearrangeWindows) % windowCount); } } effects->addRepaintFull();