uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h
branchRCL_3
changeset 5 433cbbb6a04b
parent 3 d8a3531bc6b8
child 6 10534483575f
equal deleted inserted replaced
3:d8a3531bc6b8 5:433cbbb6a04b
    20 #ifndef __ALF_BRIDGE_H__
    20 #ifndef __ALF_BRIDGE_H__
    21 #define __ALF_BRIDGE_H__
    21 #define __ALF_BRIDGE_H__
    22 
    22 
    23 #include <e32hashtab.h>
    23 #include <e32hashtab.h>
    24 
    24 
    25 #define AMT_CONTROL()                static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
    25 #define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
    26 #include "alfmoduletest.h" 
    26 #include "alfmoduletest.h" 
    27 
    27 
    28 #include "alfscreen.h"
    28 #include "alfscreen.h"
    29 #include "alfstreamerbridge.h"
    29 #include "alfstreamerbridge.h"
    30 #include "alfdecoderserverclient.h"
    30 #include "alfdecoderserverclient.h"
    38 
    38 
    39 class CAlfEffectEndTimer;
    39 class CAlfEffectEndTimer;
    40 class CAlfCommandDebug;
    40 class CAlfCommandDebug;
    41 class CAlfLayoutSwitchEffectCoordinator;
    41 class CAlfLayoutSwitchEffectCoordinator;
    42 class RMemReadStream;
    42 class RMemReadStream;
    43 
    43 class CHuiCanvasVisual;
       
    44 class CFullScreenEffectState;
       
    45 class CControlEffectState;
       
    46     
    44 const TInt KAlfBridgeRegionGranularity = 10;
    47 const TInt KAlfBridgeRegionGranularity = 10;
    45 
    48 
    46 NONSHARABLE_CLASS(CAlfBridge): 
    49 NONSHARABLE_CLASS(CAlfBridge): 
    47 	public CBase, 
    50 	public CBase, 
    48     public MAlfStreamerListener, 
    51     public MAlfStreamerListener, 
    49     public MHuiDisplayRefreshObserver, 
    52     public MHuiDisplayRefreshObserver, 
    50     public MHuiBitmapProvider,
    53     public MHuiBitmapProvider,
    51     public MAlfGfxEffectObserver,
    54     public MAlfGfxEffectObserver,
    52     public MHuiRosterObserver,
       
    53     public MHuiSynchronizationObserver
    55     public MHuiSynchronizationObserver
    54     {
    56     {
    55 	// Helper class for keeping ongoing effects in order. Kept in iEffectCleanupStack
    57 	// Helper class for keeping ongoing effects in order. Kept in iEffectCleanupStack
    56     private:
    58     private:
    57 
    59 
   190      * @param aClientRequest ETrue if requested by client.
   192      * @param aClientRequest ETrue if requested by client.
   191      */
   193      */
   192     void HandleGfxStopEvent( TBool aClientRequest );
   194     void HandleGfxStopEvent( TBool aClientRequest );
   193     
   195     
   194     void EnableSwRenderingL(TBool aEnable = ETrue);
   196     void EnableSwRenderingL(TBool aEnable = ETrue);
   195     void UploadSwRenderingTargetL( CAlfScreen* aScreen );
       
   196     TBool PrepareSwRenderingTarget( CAlfScreen* aScreen );
   197     TBool PrepareSwRenderingTarget( CAlfScreen* aScreen );
   197 
   198 
   198     /**
   199     /**
   199      * Sets memory level.
   200      * Sets memory level.
   200      * @param aMemoryLevel memory level.
   201      * @param aMemoryLevel memory level.
   222     
   223     
   223     /**
   224     /**
   224      * Cancels all effects due to low memory.
   225      * Cancels all effects due to low memory.
   225      */
   226      */
   226     void LowMemoryCancelAllEffects();
   227     void LowMemoryCancelAllEffects();
   227     
   228 
   228     // From MHuiRosterObserver
   229     /**
   229     void NotifyRosterDrawStart(CHuiDisplay& aDisplay);
   230       * Sets HuiControlGroup as Alf application window group
   230     void NotifyRosterDrawEnd(CHuiDisplay& aDisplay);
   231       */
       
   232     void SetWindowGroupAsAlfApp(TInt aId);
   231     
   233     
   232     // From MHuiSynchronizationObserver
   234     // From MHuiSynchronizationObserver
   233     void Synchronized(TInt aId);
   235     void Synchronized(TInt aId);
   234     
   236     
       
   237     /*
       
   238      * HandleGfxEndFullScreenTimeout
       
   239      * 
       
   240      * GfxTransEffect API gives EndFullScreen events too late. Thus there is a two stage process for triggering 
       
   241      * the EndFullScreen effect after BeginFullScreen event arrived.
       
   242      * 
       
   243      * For application start effects we give N milliseconds timeout for application to finish drawing after
       
   244      * the first drawing has arrived. If after N milliseconds application has not drawn 75% of the screen, it
       
   245      * gets another N milliseconds. Most cases, the first N milliseconds is enough.
       
   246      */
       
   247     void HandleGfxEndFullScreenTimeout(CFullScreenEffectState* aFullScreenEffectData);
       
   248         
   235 private:    
   249 private:    
   236     
   250     
   237     class CFullScreenEffectState;
       
   238     
       
   239     class CControlEffectState;
       
   240     
   251     
   241     CAlfBridge( CAlfStreamerBridge** aHost );
   252     CAlfBridge( CAlfStreamerBridge** aHost );
   242     
   253     
   243     void ConstructL(CHuiEnv* aEnv);
   254     void ConstructL(CHuiEnv* aEnv);
   244     
   255     
   286     
   297     
   287     /**
   298     /**
   288      * Handles begin and end fullscreen events
   299      * Handles begin and end fullscreen events
   289      */
   300      */
   290     TBool HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout);
   301     TBool HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout);
       
   302     
       
   303     
       
   304     /*
       
   305      * ResolveAfterEffectAppearingApplicationL
       
   306      * 
       
   307      * In case of an exit effect the appearing application is not notifed to alf
       
   308      * by the GfxTransEffect API. In such case it is being resolved from Roster by
       
   309      * taking the application directly under the application that is being moved
       
   310      * to the background (when called by HandleReorderWindow) or being destroyed
       
   311      * (called by DeleteControlGroupL).
       
   312      * 
       
   313      * In some situation Alf may end up with wrong appearing application uid. In such
       
   314      * case the worst that can happen, is that we must wait the frameworks
       
   315      * EndFullScreen event to arrive.
       
   316      */
       
   317     void ResolveAfterEffectAppearingApplicationL(CHuiControlGroup* aGroup);
       
   318 
   291     
   319     
   292 	/**
   320 	/**
   293 	*	FreezeLayoutUntilEffectDestroyedL
   321 	*	FreezeLayoutUntilEffectDestroyedL
   294 	*
   322 	*
   295 	*	Tries to take screenshot of the layout. If that fails, the layout will not be effected at all.
   323 	*	Tries to take screenshot of the layout. If that fails, the layout will not be effected at all.
   661     TBool SetupFadeEffectL(CHuiCanvasVisual& aVisual);
   689     TBool SetupFadeEffectL(CHuiCanvasVisual& aVisual);
   662     void PrepareFadeEffects( CHuiCanvasVisual& aVisual );    
   690     void PrepareFadeEffects( CHuiCanvasVisual& aVisual );    
   663     TBool LoadFadeEffectsL( CHuiCanvasVisual& aVisual );        
   691     TBool LoadFadeEffectsL( CHuiCanvasVisual& aVisual );        
   664 
   692 
   665     // Fading related utility methods
   693     // Fading related utility methods
   666     static TBool CanFadeChildren( CHuiCanvasVisual& aParent );
   694     TBool CanFadeChildren( CHuiCanvasVisual& aParent );
   667     static TInt RecursiveChildCount( CHuiCanvasVisual& aParent, TInt aCanvasFlags );
   695     TInt RecursiveChildCount( CHuiCanvasVisual& aParent, TInt aCanvasFlags );
   668     static TBool IsFadedByParent( CHuiCanvasVisual& aVisual );
   696     TBool IsFadedByParent( CHuiCanvasVisual& aVisual );
   669     static TBool IsNearestParentEffectFade( CHuiCanvasVisual& aVisual );
   697     TBool IsNearestParentEffectFade( CHuiCanvasVisual& aVisual );
   670     static TBool HasActivePaintedAreas( CHuiCanvasVisual& aVisual, TBool aIncludeChildren );
   698     TBool HasActivePaintedAreas( CHuiCanvasVisual& aVisual, TBool aIncludeChildren );
   671     static TBool HasActiveFadedChildren( CHuiCanvasVisual& aVisual );
   699     TBool HasActiveFadedChildren( CHuiCanvasVisual& aVisual );
   672 
   700 
   673 private:
   701 private:
   674 
   702 
   675     RPointerArray<CAlfScreen> iAlfScreens;
   703     RPointerArray<CAlfScreen> iAlfScreens;
   676     void SetCursorTimerL(TUint aTime = 0, CHuiVisual* aCursor = 0);
   704     void SetCursorTimerL(TUint aTime = 0, CHuiVisual* aCursor = 0);
       
   705     TBool IsAlfOriginatedWindow(CHuiCanvasVisual& aVisual);
   677 
   706 
   678 NONSHARABLE_CLASS ( TDeadControlGroup )
   707 NONSHARABLE_CLASS ( TDeadControlGroup )
   679     {
   708     {
   680 public:
   709 public:
   681     TDeadControlGroup():
   710     TDeadControlGroup():
   742     
   771     
   743     // Same as iEffectCleanupStack, but only the ones that can be now cleaned away.
   772     // Same as iEffectCleanupStack, but only the ones that can be now cleaned away.
   744     // See method RemoveTemporaryPresenterVisuals.
   773     // See method RemoveTemporaryPresenterVisuals.
   745     RArray<TInt> iFinishedCleanupStackEffects;
   774     RArray<TInt> iFinishedCleanupStackEffects;
   746     
   775     
   747 	// Effects states are used for effects request that arrive before the effected 
   776 	
   748 	// window has been created. This is very common with fullscreen effects and 
       
   749 	// occational with control effects.
       
   750 	//
       
   751 	// NOTE: control effects support currently only one "delayed" effect. This is propably
       
   752 	// not sufficient for all sitations.
       
   753     NONSHARABLE_CLASS(CEffectState) : public CBase
       
   754         {
       
   755     public:    
       
   756         
       
   757         CEffectState();
       
   758          ~CEffectState();
       
   759          
       
   760     protected:
       
   761 	   /**
       
   762 		* ResolveFileNameL
       
   763 		*
       
   764 		* Reads filename from stream and composes it to iEffectName variable.
       
   765 		*/
       
   766          void ResolveFileNameL(RMemReadStream& aStream);
       
   767          
       
   768     public:
       
   769          
       
   770          TInt iAction;
       
   771          TInt iHandle;
       
   772             
       
   773          HBufC* iEffectName;
       
   774          // Handle using which client should be informed of completion.
       
   775          TInt iCompletionHandle;
       
   776          // State information
       
   777          TInt iOperation;
       
   778          
       
   779         };
       
   780     
       
   781     NONSHARABLE_CLASS( CControlEffectState ) : public CEffectState
       
   782         {
       
   783     public:
       
   784 
       
   785         TUint32 iClientHandle;
       
   786         TUint32 iClientGroupHandle;
       
   787     
       
   788         void ConstructL(TInt aAction, RMemReadStream& aStream);
       
   789         };
       
   790 
       
   791     NONSHARABLE_CLASS( CFullScreenEffectState ) : public CEffectState
       
   792         {
       
   793     public:
       
   794        // CFullScreenEffectState();
       
   795        // ~CFullScreenEffectState();
       
   796         
       
   797         void ConstructL(TInt aAction, RMemReadStream& aStream);
       
   798 
       
   799         // Information from BeginFullScreen
       
   800         TInt iType;
       
   801         TInt iWg1;
       
   802         TInt iWg2;
       
   803         TInt iToAppId;
       
   804         TInt iFromAppId;
       
   805         TRect iRect;
       
   806         
       
   807         // ETrue if waiting for window group to appear
       
   808         TBool iWaitingWindowGroup;
       
   809         // ETrue if end fullscreen has been performed
       
   810         TBool iEndFullScreen;
       
   811         // ETrue if setup effect container has been done
       
   812         TBool iSetupDone;
       
   813 
       
   814         // used for resolving the iCleanupStackItem that holds the frozen app layout underneath the starting application
       
   815         TInt iAppStartScreenshotItemHandle;
       
   816         };
       
   817 
       
   818     /**
   777     /**
   819      * Full screen effect state.
   778      * Full screen effect state.
   820      * Own.
   779      * Own.
   821      */
   780      */
   822     CFullScreenEffectState* iFullScreenEffectData;
   781     CFullScreenEffectState* iFullScreenEffectData;
   866         TInt32 iClientSideId;
   825         TInt32 iClientSideId;
   867         TInt32 iClientSideGroupId;
   826         TInt32 iClientSideGroupId;
   868         };
   827         };
   869     
   828     
   870     RHashMap<TUint32,THashVisualStruct> iWindowHashArray;
   829     RHashMap<TUint32,THashVisualStruct> iWindowHashArray;
       
   830     CHuiControl* iOrphanStorage; // owned. holds the visuals which are orphaned from their control group
   871     class TRegisteredEffectsStruct
   831     class TRegisteredEffectsStruct
   872         {
   832         {
   873     public:
   833     public:
   874         TRegisteredEffectsStruct()
   834         TRegisteredEffectsStruct()
   875             {
   835             {
   921     
   881     
   922     #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
   882     #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
   923     TInt iTempTotalActiveVisualCount;
   883     TInt iTempTotalActiveVisualCount;
   924     TInt iTempTotalPassiveVisualCount;
   884     TInt iTempTotalPassiveVisualCount;
   925     #endif
   885     #endif
       
   886     #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
       
   887     TInt activevisualcount;
       
   888     TInt passivevisualcount;
       
   889     #endif
   926     };    
   890     };    
   927 
   891 
   928 #endif // __ALF_BRIDGE_H__
   892 #endif // __ALF_BRIDGE_H__