uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h
changeset 14 83d2d132aa58
parent 13 8f67d927ea57
child 19 f5bac0badc7e
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Fri Mar 19 09:43:21 2010 +0200
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Fri Apr 16 15:56:24 2010 +0300
@@ -31,7 +31,7 @@
         virtual ~CAlfRosterFreezeEndTimer();
 
     public: // New functions
-        void Start( TTimeIntervalMicroSeconds32 aPeriod );
+        void Start( TTimeIntervalMicroSeconds32 aPeriod, TCallBack aCallBack  );
         
     protected:  // Functions from base classes
         void DoCancel();
@@ -43,7 +43,9 @@
       
     private:    // Data
         CAlfBridge& iBridge;
-                
+ 	public:
+	   	TInt iSafeCounter;
+        TCallBack iCallBack;        
     };
 
 
@@ -60,7 +62,8 @@
         virtual ~CAlfEffectEndTimer();
 
     public: // New functions
-        void Start( TTimeIntervalMicroSeconds32 aPeriod, TInt aHandle );
+        void Start( TTimeIntervalMicroSeconds32 aPeriod );
+        void AddFinishedHandleL(TInt aHandle);
         
     protected:  // Functions from base classes
         void DoCancel();
@@ -72,8 +75,7 @@
       
     private:    // Data
         CAlfBridge& iBridge;
-        TInt iHandle;
-                
+        RArray<TInt> iHandles;
     };
 
 // ---------------------------------------------------------
@@ -82,6 +84,25 @@
 //
 NONSHARABLE_CLASS( CAlfLayoutSwitchEffectCoordinator ) : public CBase, public MAlfGfxEffectObserver
     {
+    public:
+        enum TEvent
+            {
+            EEventLayoutSwitch,
+            EEventBlankOn,
+            EEventBlankOff,
+            EEventLowMemory
+            };
+    
+        enum TState
+            {
+            EStateIdle,
+            EStateFreezeFx,
+            EStateBlankFx,
+            EStateThemeFx
+            };
+
+        typedef TState (*TStateFunction)(TEvent aEvent);
+
     public:  // Constructors and destructor
         CAlfLayoutSwitchEffectCoordinator( CAlfBridge& aBridge );
         virtual ~CAlfLayoutSwitchEffectCoordinator();
@@ -90,13 +111,47 @@
         void AlfGfxEffectEndCallBack( TInt aHandle );
     
     public:
+        void Blank(TBool aEnabled);
+        void LowMemoryEvent();
         void BeginLayoutSwitch();
-        void Cancel();
         
+        void Event(TEvent aEvent);
+        void Transition(TState aNewState, TState aPreviousState);
+
+    private:
+        TState NextIdleState(TEvent aEvent);
+        TState NextFreezeState(TEvent aEvent);
+        TState NextBlankState(TEvent aEvent);
+        TState NextThemeState(TEvent aEvent);
+
+        void FreezeFinished();
+
+    public:            
+        TBool IsThemeEffectEnabled() const;
+        TBool LayoutSwitchEffectsExist() const;
+
+		void EnableSafeCounter(TBool aEnable)
+			{
+			if (iRosterFreezeEndTimer)
+				{
+				if (aEnable)
+					{
+					iRosterFreezeEndTimer->iSafeCounter = 0;
+					}
+				else
+					{
+					iRosterFreezeEndTimer->iSafeCounter = KErrNotFound;
+					}
+				}
+			}        
+    
     private:
         AknTransEffect::TContext NextLayoutSwitchContext();
         void SetLayoutSwitchEffect(AknTransEffect::TContext aContext);
-        TBool LayoutSwitchEffectsExist();
+        
+        void FreezeRoster(TBool aFrozen);
+        
+        static TInt DoFreezeFinished(TAny* aAny);
         
     private: // Data
         
@@ -104,7 +159,11 @@
         AknTransEffect::TContext iLayoutSwitchEffectContext;
         TThreadPriority iOriginalPriority;
         CAlfRosterFreezeEndTimer* iRosterFreezeEndTimer;
-    };
+        TBool iBlankEnabled;
+        
+        TState iCurrentState;
+        TBool iLayoutSwitchNotCompleted;
+	};
 
 // ---------------------------------------------------------
 // Effects states are used for effects request that arrive before the effected 
@@ -160,16 +219,18 @@
         
         void ConstructL(TInt aAction, RMemReadStream& aStream);
         
-        TBool ResetTimerL(CAlfBridge* aBridge);
+        TBool InitDelayedEffectL(CAlfBridge* aBridge, TSize aDisplaySize);
         
         void NotifyDrawingTimeout();
 
         // Information from BeginFullScreen
         TInt iType;
-        TInt iWg1;
-        TInt iWg2;
+        TInt iToWg;
+        TInt iFromWg;
         TInt iToAppId;
         TInt iFromAppId;
+        TInt iToSecureId;
+        TInt iFromSecureId;
         TRect iRect;
         
         // ETrue if waiting for window group to appear
@@ -182,7 +243,7 @@
         // used for resolving the iCleanupStackItem that holds the frozen app layout underneath the starting application
         TInt iAppStartScreenshotItemHandle;
         
-        RRegion iPaintedRegion;
+        
         enum TEffectType
         {
             ENotDefinedEffect = 0,
@@ -191,8 +252,17 @@
         };
         
         TEffectType iEffectType;
+        
+        // Display dimension, iPaintedRegion is clipped to this when determining, if there is enough drawing to the group
         TSize iDisplaySize;
+        
+        // gathers the painted region for the effected application. When enough region has been painted, the effect is forced.
+        RRegion iPaintedRegion;
+        
         CAlfBridge* iBridge; // for callback. not own.
         
+        // If the visual is shown by some other visual by a screenshot, this is set ETrue.
+        TBool iCanDestroyOrHideImmediately;
+        
         CPeriodic* iDrawingCompleteTimer;
         };