idlehomescreen/xmluirendering/uiengine/src/xneffectmanager.cpp
changeset 1 5315654608de
parent 0 f72a12da539e
child 15 ff572dfe6d86
--- a/idlehomescreen/xmluirendering/uiengine/src/xneffectmanager.cpp	Thu Dec 17 08:40:49 2009 +0200
+++ b/idlehomescreen/xmluirendering/uiengine/src/xneffectmanager.cpp	Thu Jan 07 12:39:41 2010 +0200
@@ -156,7 +156,6 @@
     {
     for ( TInt i = 0; i < iEffects.Count(); )
         {
-        TInt count = iEffects.Count(); // for debugging
         TXnEffect* effect = iEffects[i];
         if ( effect && effect->iState == KEffectStarted )
             {
@@ -183,9 +182,9 @@
 //
 void CXnEffectManager::UiLayouted()
     {
-    TInt count = iEffects.Count();
-    for ( TInt i = 0; i < count; i++ )
+    for ( TInt i = 0; i < iEffects.Count(); )
         {
+        TBool effectStarted = ETrue;
         TXnEffect* effect = iEffects[i];
         if ( effect && effect->iNode &&
              effect->iState == KWaitForLayout &&
@@ -193,13 +192,23 @@
             {
             if ( effect->iType == KEffectTypeFullscreen )
                 {
-                DoBeginFullscreenEffect( *effect );
+                effectStarted = DoBeginFullscreenEffect( *effect );
                 }
             else if ( effect->iType == KEffectTypeControl )
                 {
-                DoBeginControlEffect( *effect );
+                effectStarted = DoBeginControlEffect( *effect );
                 }
             }
+        
+        if ( effectStarted )
+            {
+            i++;
+            }
+        else
+            {
+            // effect cannot be started, remove it
+            RemoveEffect( effect );
+            }
         }
     }
 
@@ -207,7 +216,7 @@
 // CXnEffectManager::DoBeginFullscreenEffect
 // -----------------------------------------------------------------------------
 //
-void CXnEffectManager::DoBeginFullscreenEffect( TXnEffect& aEffect )
+TBool CXnEffectManager::DoBeginFullscreenEffect( TXnEffect& aEffect )
     {
     CCoeEnv* coe( CCoeEnv::Static() );
            
@@ -215,8 +224,7 @@
          coe->RootWin().Identifier() )
         {
         // Window group is not focused
-        RemoveEffect( &aEffect );
-        return;
+        return EFalse;
         }
 
     const TInt flags( AknTransEffect::TParameter::EActivateExplicitCancel );
@@ -228,22 +236,23 @@
         targetAppUid, flags ) );
     
     aEffect.iState = KEffectStarted;
+    return ETrue;
     }
 
 // -----------------------------------------------------------------------------
 // CXnEffectManager::DoBeginControlEffect
 // -----------------------------------------------------------------------------
 //
-void CXnEffectManager::DoBeginControlEffect( TXnEffect& aEffect )
+TBool CXnEffectManager::DoBeginControlEffect( TXnEffect& aEffect )
     {
+    TBool ret = EFalse;
     CCoeEnv* coe( CCoeEnv::Static() );
            
     if ( coe->WsSession().GetFocusWindowGroup() != 
          coe->RootWin().Identifier() )
         {
         // Window group is not focused
-        RemoveEffect( &aEffect );
-        return;
+        return ret;
         }
 
     // Set effect begin point
@@ -251,11 +260,10 @@
         {
         GfxTransEffect::Begin( aEffect.iNode->Control() , aEffect.iId );
         aEffect.iState = KEffectStarted;
+        ret = ETrue;
         }
-    else
-        {
-        RemoveEffect( &aEffect );
-        }
+    
+    return ret;
     }
 
 // -----------------------------------------------------------------------------