# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1270065838 -10800 # Node ID 88b23e2e82e11e0cb57870846ee367e4071fa0e7 # Parent 10534483575fc7be1a74e9a359f04d579b74b327 Revision: 201012 Kit: 201013 diff -r 10534483575f -r 88b23e2e82e1 layers.sysdef.xml --- a/layers.sysdef.xml Mon Mar 15 12:43:37 2010 +0200 +++ b/layers.sysdef.xml Wed Mar 31 23:03:58 2010 +0300 @@ -10,6 +10,7 @@ + diff -r 10534483575f -r 88b23e2e82e1 package_definition.xml --- a/package_definition.xml Mon Mar 15 12:43:37 2010 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 10534483575f -r 88b23e2e82e1 rom/alfred.iby --- a/rom/alfred.iby Mon Mar 15 12:43:37 2010 +0200 +++ b/rom/alfred.iby Wed Mar 31 23:03:58 2010 +0300 @@ -81,7 +81,8 @@ // Effect fxmls. Keep the list in alphabetical order. When updating the list below, REMEMBER TO ALSO UPDATE core_exports.inc! data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_add_page.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_add_page.fxml -data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_appear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_appear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_anim_to_image.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_anim_to_image.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_image_to_image.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_image_to_image.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_editmode.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_editmode.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_widgetmanager.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_widgetmanager.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left.fxml @@ -133,6 +134,10 @@ data=DATAZ_/RESOURCE_FILES_DIR/effects/optionsmenu_cascade_appear.fxml RESOURCE_FILES_DIR/effects/optionsmenu_cascade_appear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/optionsmenu_cascade_disappear.fxml RESOURCE_FILES_DIR/effects/optionsmenu_cascade_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/optionsmenu_disappear.fxml RESOURCE_FILES_DIR/effects/optionsmenu_disappear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/photos_gridview_appear.fxml RESOURCE_FILES_DIR/effects/photos_gridview_appear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/photos_gridview_disappear.fxml RESOURCE_FILES_DIR/effects/photos_gridview_disappear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/photos_fullscreen_close.fxml RESOURCE_FILES_DIR/effects/photos_fullscreen_close.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/photos_fullscreen_open.fxml RESOURCE_FILES_DIR/effects/photos_fullscreen_open.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/popup_appear.fxml RESOURCE_FILES_DIR/effects/popup_appear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/popup_disappear.fxml RESOURCE_FILES_DIR/effects/popup_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/popup_disappear_screenshot.fxml RESOURCE_FILES_DIR/effects/popup_disappear_screenshot.fxml diff -r 10534483575f -r 88b23e2e82e1 uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h Wed Mar 31 23:03:58 2010 +0300 @@ -350,6 +350,8 @@ IMPORT_C TBool HasCommandBuffers(TBool aAskFromChildren = ETrue) const; + IMPORT_C TBool HasTransParentClear() const; + // to handle background surface that may be set to the Window public: @@ -449,6 +451,7 @@ void CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const; TBool CanSkipDrawing() const; + TBool KeepNoCache() const; private: diff -r 10534483575f -r 88b23e2e82e1 uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiControlGroup.h Wed Mar 31 23:03:58 2010 +0300 @@ -203,6 +203,9 @@ */ IMPORT_C void SetSessionId(TInt aSessionId); + IMPORT_C void SetSecureId(TInt aSecureId); + IMPORT_C TInt SecureId(); + private: /* Private methods */ @@ -235,6 +238,8 @@ /** Session id */ TInt iSessionId; + + TInt iSecureId; public: diff -r 10534483575f -r 88b23e2e82e1 uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h Wed Mar 31 23:03:58 2010 +0300 @@ -1006,8 +1006,8 @@ void DoSynchronize(); TBool iPauseDrawing; private: - MHuiSynchronizationObserver* iSynchObserver; - TInt iSynchId; + RPointerArray iSynchObservers; + RArray iSynchIds; }; #endif // __HUIENV_H__ diff -r 10534483575f -r 88b23e2e82e1 uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiSkin.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiSkin.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiSkin.h Wed Mar 31 23:03:58 2010 +0300 @@ -241,8 +241,12 @@ */ IMPORT_C virtual TInt GetTexture(TInt aSkinTextureResource, const CHuiTexture*& aOutTexture); - - + + /** + * Release cached textures. + */ + void ReleaseCachedTextures(); + public: /* Implementation of MHuiTextureContentObserver. */ diff -r 10534483575f -r 88b23e2e82e1 uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionclient.h --- a/uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionclient.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionclient.h Wed Mar 31 23:03:58 2010 +0300 @@ -294,11 +294,26 @@ **/ IMPORT_C static CAlfCompositionPixelSource* NewL(MAlfBufferProvider& aProvider, RWindow* aWindow = NULL); + /** - * Activate drawing for the first time or continue drawing if it is being paused or suspended + * Constructor for application to decide AO priority + */ + IMPORT_C static CAlfCompositionPixelSource* NewL(MAlfBufferProvider& aProvider, TInt aPriority = CActive::EPriorityIdle, RWindow* aWindow = NULL ); + + + /** + * Activate drawing for the first time or continue drawing if it is being paused or suspended **/ IMPORT_C void ActivateL(); + + /* + * An other option to activate/continue drawing. This activate method ensures that no saw-edged black area is seen if client + * only wants to draw one frame. MAlfBufferProvider::ProduceNewFrameL is called from inside ActivateSyncL so that + * surface buffer can be updated before making surface visible. + */ + IMPORT_C void ActivateSyncL(); + /** * Suspend drawing **/ @@ -329,7 +344,7 @@ private: // Internal / utils - void ConstructL(MAlfBufferProvider& aProvider, RWindow* aWindow); + void ConstructL(MAlfBufferProvider& aProvider, TInt aPriority, RWindow* aWindow); void ConstructSurfaceL(MAlfBufferProvider::TBufferCreationAttributes& aCreationAttributes); void FreeSurface(); TUint8* Buffer(TInt aBufferNumber); diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/group/bld.inf --- a/uiacceltk/group/bld.inf Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/group/bld.inf Wed Mar 31 23:03:58 2010 +0300 @@ -24,4 +24,6 @@ PRJ_EXPORTS ../hitchcock/sis/uiaccelerator_stub.sis /epoc32/release/armv5/urel/uiaccelerator_stub.sis ../../rom/alfred.iby CORE_MW_LAYER_IBY_EXPORT_PATH(alfred.iby) +#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS ../../rom/alftranseffectplugin.iby CORE_MW_LAYER_IBY_EXPORT_PATH(alftranseffectplugin.iby) +#endif // #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS \ No newline at end of file diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def --- a/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def Wed Mar 31 23:03:58 2010 +0300 @@ -41,4 +41,6 @@ ??1CAlfCompositionCntrlClient@@UAE@XZ @ 40 NONAME ; CAlfCompositionCntrlClient::~CAlfCompositionCntrlClient(void) ?SetSourceRect@CAlfCompositionSource@@UAEHABVTRect@@@Z @ 41 NONAME ; int CAlfCompositionSource::SetSourceRect(class TRect const &) ?GetListOfInactiveWindowGroupsWSurfaces@RAlfBridgerClient@@QAEHPAV?$RArray@H@@@Z @ 42 NONAME ; int RAlfBridgerClient::GetListOfInactiveWindowGroupsWSurfaces(class RArray *) + ?NewL@CAlfCompositionPixelSource@@SAPAV1@AAVMAlfBufferProvider@@HPAVRWindow@@@Z @ 43 NONAME ; class CAlfCompositionPixelSource * CAlfCompositionPixelSource::NewL(class MAlfBufferProvider &, int, class RWindow *) + ?ActivateSyncL@CAlfCompositionPixelSource@@QAEXXZ @ 44 NONAME ; void CAlfCompositionPixelSource::ActivateSyncL(void) diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def --- a/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def Wed Mar 31 23:03:58 2010 +0300 @@ -62,4 +62,6 @@ _ZN21CAlfCompositionSource13SetSourceRectERK5TRect @ 61 NONAME _ZThn32_N21CAlfCompositionSource13SetSourceRectERK5TRect @ 62 NONAME _ZN17RAlfBridgerClient38GetListOfInactiveWindowGroupsWSurfacesEP6RArrayIiE @ 63 NONAME + _ZN26CAlfCompositionPixelSource4NewLER18MAlfBufferProvideriP7RWindow @ 64 NONAME + _ZN26CAlfCompositionPixelSource13ActivateSyncLEv @ 65 NONAME diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp --- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -258,6 +258,11 @@ return; } + if (aEventType == KAlfCompositionLayoutSwitchComplete && iController) + { + iController->AlfBridgeCallback(KAlfCompositionLayoutSwitchComplete, NULL); + } + TInt* ptr = static_cast(aEventData); TInt target; @@ -720,27 +725,22 @@ void RunL() { - if( iStatus == KErrNone ) + if( iStatus != KErrCancel ) { SetActive(); if( !iPixelSource.DrawFrameL(iStatus, iBufferNumber) ) { - __ALFLOGSTRING( "CSurfaceUpdateCallBack::RunL - DrawFrameL returned EFalse -> Pause"); - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); + __ALFLOGSTRING( "CSurfaceUpdateCallBack::RunL - DrawFrameL returned EFalse -> Pausing"); + TRequestStatus* status = &iStatus; + User::RequestComplete(status, KErrCancel); Cancel(); - } + } } - else - { - __ALFLOGSTRING1("CSurfaceUpdateCallBack::RunL %d", iStatus.Int()); - iPixelSource.Suspend(); - } + }; + void DoCancel() + { + }; - - }; - void DoCancel() { }; - private: // Data CAlfCompositionPixelSource& iPixelSource; TInt iBufferNumber; @@ -824,6 +824,8 @@ TInt iCurrentBuffer; TRect iSurfaceRect; + + TInt iWaiterAoPriority; }; @@ -836,12 +838,26 @@ { CAlfCompositionPixelSource* me = new (ELeave) CAlfCompositionPixelSource(); CleanupStack::PushL(me); - me->ConstructL(aProvider, aWindow); + me->ConstructL(aProvider, CActive::EPriorityIdle, aWindow); CleanupStack::Pop(me); return me; } // --------------------------------------------------------------------------- +// CAlfCompositionPixelSource::NewL +// --------------------------------------------------------------------------- +// +EXPORT_C CAlfCompositionPixelSource* CAlfCompositionPixelSource::NewL(MAlfBufferProvider& aProvider, TInt aPriority, RWindow* aWindow) + { + CAlfCompositionPixelSource* me = new (ELeave) CAlfCompositionPixelSource(); + CleanupStack::PushL(me); + me->ConstructL(aProvider, aPriority, aWindow); + CleanupStack::Pop(me); + return me; + } + + +// --------------------------------------------------------------------------- // CAlfCompositionPixelSource::ActivateL // --------------------------------------------------------------------------- // @@ -873,7 +889,7 @@ { if( !iData->iSurfaceUpdateWaiter ) { - iData->iSurfaceUpdateWaiter = new (ELeave) CSurfaceUpdateCallback( *this, 0, CActive::EPriorityIdle ); + iData->iSurfaceUpdateWaiter = new (ELeave) CSurfaceUpdateCallback( *this, 0, iData->iWaiterAoPriority ); } iData->iSurfaceUpdateWaiter->SetActive(); @@ -886,7 +902,71 @@ // do nothing if content was already active } - + +// --------------------------------------------------------------------------- +// CAlfCompositionPixelSource::ActivateSyncL +// --------------------------------------------------------------------------- +// +EXPORT_C void CAlfCompositionPixelSource::ActivateSyncL() + { + if( !iData->iWindow && iData->iSurfaceId.IsNull() ) + { + User::Leave(KErrNotReady); + } + TBool pause = EFalse; + if( iData->iSourceStatus == CAlfCompositionPixelSourceData::ESuspended ) + { + MAlfBufferProvider::TBufferCreationAttributes& creationAttribs = iData->iProvider.BufferAttributes(); + + iData->iSurfaceRect = TRect(TPoint(0,0), TSize(creationAttribs.iWidth, creationAttribs.iHeight)); + + ConstructSurfaceL(creationAttribs); + + User::LeaveIfError( iData->iSurfaceUpdateSession.Connect() ); + + // update surface buffer before setting surface as background surface + if( !iData->iSurfaceUpdateWaiter ) + { + iData->iSurfaceUpdateWaiter = new (ELeave) CSurfaceUpdateCallback( *this, 0, iData->iWaiterAoPriority ); + } + + iData->iSurfaceUpdateWaiter->SetActive(); + pause = !DrawFrameL(iData->iSurfaceUpdateWaiter->iStatus ,0); + if(pause && iData->iSurfaceUpdateWaiter->IsActive()) + { + TRequestStatus* status = &iData->iSurfaceUpdateWaiter->iStatus; + User::RequestComplete(status, KErrCancel); + iData->iSurfaceUpdateWaiter->Cancel(); + } + + iData->iWindow->SetBackgroundSurface(iData->iSurfaceId); + + TInt array[] = { 0, iData->iWindow->ClientHandle(), iData->iWindow->WindowGroupId() }; + TInt handle = SendEvent(KAlfCompOpCreateSource, array, sizeof(array)); + CAlfCompositionClientBase::SetHandleL( handle ); + } + + if( iData->iSourceStatus != CAlfCompositionPixelSourceData::EActive && !pause ) + { + + if( !iData->iSurfaceUpdateWaiter ) + { + iData->iSurfaceUpdateWaiter = new (ELeave) CSurfaceUpdateCallback( *this, 0, iData->iWaiterAoPriority ); + } + + if(!iData->iSurfaceUpdateWaiter->IsActive()) + { + iData->iSurfaceUpdateWaiter->SetActive(); + TRequestStatus* status = &iData->iSurfaceUpdateWaiter->iStatus; + User::RequestComplete(status, KErrNone); + } + iData->iProvider.OnActivation(); + iData->iSourceStatus = CAlfCompositionPixelSourceData::EActive; + } + + // do nothing if content was already active and running + } + // --------------------------------------------------------------------------- // CAlfCompositionPixelSource::Suspend // --------------------------------------------------------------------------- @@ -961,9 +1041,11 @@ // CAlfCompositionPixelSource::ConstructL // --------------------------------------------------------------------------- // -void CAlfCompositionPixelSource::ConstructL(MAlfBufferProvider& aProvider, RWindow* aWindow) +void CAlfCompositionPixelSource::ConstructL(MAlfBufferProvider& aProvider, TInt aPriority, RWindow* aWindow) { iData = CAlfCompositionPixelSourceData::NewL( aProvider ); + iData->iWaiterAoPriority = aPriority; + TInt screenNumber = KErrNotFound; if( aWindow ) { diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp --- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -366,9 +366,9 @@ TRegionFix<1> clipRegion; clipRegion.AddRect( aClipRect ); - TRgb penColor = TRgb(0x555555); - TRgb brushColor = TRgb(0x555555); - TRgb dotColor = TRgb(0xBBBBBB); + TRgb penColor = TRgb(0x000000); + TRgb brushColor = TRgb(0x000000); + TRgb dotColor = TRgb(0xFFFFFF); WindowRedrawStart( aWindowTreeNode, drawRegion ); iWsGraphicsContext->Reset(); @@ -593,7 +593,9 @@ AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup, iRsWindowGroupNodeCount ); - AMT_INC_COUNTER(iRsTotalNodeCount ); + AMT_INC_COUNTER(iRsTotalNodeCount ); + + AMT_MAP_RENDER_STAGE_NODE_CREATED(); } // --------------------------------------------------------------------------- @@ -636,7 +638,14 @@ AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup, iRsWindowGroupNodeCount ); - AMT_DEC_COUNTER(iRsTotalNodeCount ); + AMT_DEC_COUNTER(iRsTotalNodeCount ); + + AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), + iIntMap, aWindowTreeNode.Window()->Handle(), + EAlfModuleTestTypeRenderStageReleaseWindow ); + AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeGroup == nodeType && aWindowTreeNode.WindowGroup() ), + iIntMap, aWindowTreeNode.WindowGroup()->Identifier(), + EAlfModuleTestTypeRenderStageReleaseWindowGroup ); } // --------------------------------------------------------------------------- @@ -655,7 +664,11 @@ iAlfSendBuffer->CommitL(); __ALFLOGSTRING("CAlfRenderStage::NodeActivated <<"); - AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeActivatedCount ); + AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeActivatedCount ); + + AMT_MAP_SET_VALUE_IF( nodeType == MWsWindowTreeNode::EWinTreeNodeClient, + iBoolMap, aWindowTreeNode.Window()->Handle(), ETrue, + EAlfModuleTestTypeRenderStageActiveWindow ); } // --------------------------------------------------------------------------- @@ -695,12 +708,13 @@ AMT_INC_COUNTER( iRsNodeExtentChangedCount ); AMT_SET_VALUE( iRsLatestNodeExtentRect, aRect ); + AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ), - iSizeMap, aWindowTreeNode.Window()->Handle(), - aRect.Size(), EAlfModuleTestTypeRenderStageChangeSize ); + iSizeMap, aWindowTreeNode.Window()->Handle(), + aRect.Size(), EAlfModuleTestTypeRenderStageChangeWindowSize ); AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ), - iPositionMap, aWindowTreeNode.Window()->Handle(), - aRect.iTl, EAlfModuleTestTypeRenderStageChangePosition ); + iPositionMap, aWindowTreeNode.Window()->Handle(), + aRect.iTl, EAlfModuleTestTypeRenderStageChangeWindowPosition ); } // --------------------------------------------------------------------------- @@ -717,7 +731,7 @@ &aWindowTreeNode ); iAlfSendBuffer->CommitL(); - } + } // --------------------------------------------------------------------------- // FlagChanged @@ -735,9 +749,12 @@ iAlfSendBuffer->CommitL(); AMT_INC_COUNTER( iRsTotalNodeFlagChangedCount ); - AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.Window() ), - iIntMap, aWindowTreeNode.Window()->Handle(), - EAlfModuleTestTypeRenderStageChangeFlag ); + + AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() && MWsWindowTreeObserver::EVisible == aFlag ), + iBoolMap, + aWindowTreeNode.Window()->Handle(), + aNewValue, + EAlfModuleTestTypeRenderStageChangeWindowVisibility ); } // --------------------------------------------------------------------------- @@ -837,7 +854,9 @@ iAlfSendBuffer->CommitL(); AMT_INC_COUNTER( iRsTotalNodeAttributeChangedCount ); - } + } + + AMT_MAP_RENDER_STAGE_TEXT_CURSOR_CHANGE(); } // --------------------------------------------------------------------------- diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF --- a/uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF Wed Mar 31 23:03:58 2010 +0300 @@ -1110,4 +1110,5 @@ ?NewL@CAlfDrawer@@SAPAV1@XZ @ 1109 NONAME ; class CAlfDrawer * CAlfDrawer::NewL(void) ?BlankScreen@RAlfDirectClient@@QAEHH@Z @ 1110 NONAME ; int RAlfDirectClient::BlankScreen(int) ?FallbackCopyScreenToBitmap@CAlfDrawer@@SAHAAVCWsScreenDevice@@PAVCFbsBitmap@@ABVTRect@@@Z @ 1111 NONAME ; int CAlfDrawer::FallbackCopyScreenToBitmap(class CWsScreenDevice &, class CFbsBitmap *, class TRect const &) + ?CopyScreenToBitmap@AlfDrawerInternal@@SAHPAVMAlfDrawerScreenInterface@@PAVCFbsBitmap@@ABVTRect@@@Z @ 1112 NONAME ; int AlfDrawerInternal::CopyScreenToBitmap(class MAlfDrawerScreenInterface *, class CFbsBitmap *, class TRect const &) diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/Client/eabi/alfclientu.DEF --- a/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF Wed Mar 31 23:03:58 2010 +0300 @@ -1345,4 +1345,5 @@ _ZN10CAlfDrawerD2Ev @ 1344 NONAME _ZN16RAlfDirectClient11BlankScreenEi @ 1345 NONAME _ZN10CAlfDrawer26FallbackCopyScreenToBitmapER15CWsScreenDeviceP10CFbsBitmapRK5TRect @ 1346 NONAME + _ZN17AlfDrawerInternal18CopyScreenToBitmapEP25MAlfDrawerScreenInterfaceP10CFbsBitmapRK5TRect @ 1347 NONAME diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/Client/src/alfdrawer.cpp --- a/uiacceltk/hitchcock/Client/src/alfdrawer.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/Client/src/alfdrawer.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -22,6 +22,7 @@ #include #include "alfcrppluginclient.h" #include "alflogger.h" +#include "alfdrawerinternal.h" #include #include @@ -42,6 +43,17 @@ // Creates CAlfCrpPluginClient instance. static CAlfCrpPluginClient* CreateAlfCrpClientL(); +NONSHARABLE_CLASS( TAlfDrawerDirectClient ) : public MAlfDrawerScreenInterface + { +public: + TAlfDrawerDirectClient( RAlfDirectClient& aClient ); + TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation); + TInt ReadPixels(CFbsBitmap* aBitmap); + +private: + RAlfDirectClient iClient; + }; + /** * Misc utility methods for CAlfDrawer. */ @@ -93,6 +105,14 @@ CWsScreenDevice& aDevice, CFbsBitmap* aBitmap, const TRect& aRect ); + + /** + * Copies screen to bitmap using 'read pixels' operation. + */ + static void DoCopyScreenToBitmap2L( + MAlfDrawerScreenInterface* aInterface, + CFbsBitmap* aBitmap, + const TRect& aRect ); }; @@ -187,12 +207,29 @@ RAlfDirectClient client; CleanupClosePushL(client); + TAlfDrawerDirectClient clientWrapper(client); + DoCopyScreenToBitmap2L(&clientWrapper, aBitmap, aRect); + + CleanupStack::PopAndDestroy(); // CleanupClosePushL + + __ALFLOGSTRING("DoCopyScreenToBitmapL - Done"); + } + +// --------------------------------------------------------------------------- +// DoCopyScreenToBitmapL +// --------------------------------------------------------------------------- +// +void AlfDrawerUtils::DoCopyScreenToBitmap2L( + MAlfDrawerScreenInterface* aInterface, + CFbsBitmap* aBitmap, + const TRect& aRect ) + { // Get size & virtual rotation from ALF side. // GetSizeAndRotation will also create session to server. TInt rotation = 0; TSize size; - User::LeaveIfError(client.GetSizeAndRotation(size, rotation)); + User::LeaveIfError(aInterface->GetSizeAndRotation(size, rotation)); // Calculate device size in pixels (same as aDevice.SizeInPixels()) TSize deviceSize = size; @@ -216,7 +253,6 @@ actualRect.IsEmpty() ) { __ALFLOGSTRING("DoCopyScreenToBitmapL - empty rect or zero bitmap size"); - CleanupStack::PopAndDestroy(); // CleanupClosePushL return; } @@ -239,7 +275,7 @@ CleanupStack::PushL( surfaceBitmap ); User::LeaveIfError( surfaceBitmap->Create( size, surfaceDisplayMode ) ); - TInt err = client.ReadPixels( surfaceBitmap->Handle() ); + TInt err = aInterface->ReadPixels( surfaceBitmap ); __ALFLOGSTRING1("DoCopyScreenToBitmapL - ReadPixels returned %d", err); User::LeaveIfError( err ); @@ -439,10 +475,6 @@ } CleanupStack::PopAndDestroy( surfaceBitmap ); - - CleanupStack::PopAndDestroy(); // CleanupClosePushL - - __ALFLOGSTRING("DoCopyScreenToBitmapL - Done"); } // --------------------------------------------------------------------------- @@ -473,6 +505,19 @@ } // --------------------------------------------------------------------------- +// CopyScreenToBitmap +// --------------------------------------------------------------------------- +// +EXPORT_C TInt AlfDrawerInternal::CopyScreenToBitmap( + MAlfDrawerScreenInterface* aInterface, + CFbsBitmap* aBitmap, + const TRect& aRect ) + { + TRAPD(err, AlfDrawerUtils::DoCopyScreenToBitmap2L(aInterface, aBitmap, aRect)); + return err; + } + +// --------------------------------------------------------------------------- // CreateAlfCrpClient // --------------------------------------------------------------------------- // @@ -495,3 +540,30 @@ return client; } +// --------------------------------------------------------------------------- +// TAlfDrawerDirectClient +// --------------------------------------------------------------------------- +// +TAlfDrawerDirectClient::TAlfDrawerDirectClient( RAlfDirectClient& aClient ) + : iClient( aClient ) + { + } + +// --------------------------------------------------------------------------- +// GetSizeAndRotation +// --------------------------------------------------------------------------- +// +TInt TAlfDrawerDirectClient::GetSizeAndRotation(TSize& aSize, TInt& aRotation) + { + return iClient.GetSizeAndRotation(aSize, aRotation); + } + +// --------------------------------------------------------------------------- +// ReadPixels +// --------------------------------------------------------------------------- +// +TInt TAlfDrawerDirectClient::ReadPixels(CFbsBitmap* aBitmap) + { + return iClient.ReadPixels(aBitmap->Handle()); + } + diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/CommonInc/alfdrawerinternal.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiacceltk/hitchcock/CommonInc/alfdrawerinternal.h Wed Mar 31 23:03:58 2010 +0300 @@ -0,0 +1,47 @@ +/* +* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Internal interface for CAlfDrawer +* +*/ + + + +#ifndef ALFDRAWERINTERNAL_H +#define ALFDRAWERINTERNAL_H + +#include + +/** + * Interface to get screen & parameters + */ +class MAlfDrawerScreenInterface + { +public: + virtual TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation) = 0; + virtual TInt ReadPixels(CFbsBitmap* aBitmap) = 0; + }; + +/** + * Internal drawer interface. + */ +NONSHARABLE_CLASS( AlfDrawerInternal ) + { +public: + IMPORT_C static TInt CopyScreenToBitmap( + MAlfDrawerScreenInterface* aInterface, + CFbsBitmap* aBitmap, + const TRect& aRect ); + }; + +#endif // ALFDRAWERINTERNAL_H diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/CommonInc/alfmoduletest.h --- a/uiacceltk/hitchcock/CommonInc/alfmoduletest.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/CommonInc/alfmoduletest.h Wed Mar 31 23:03:58 2010 +0300 @@ -1,427 +1,30 @@ -#include "e32base.h" -#include "e32debug.h" - #ifndef ALFMODULETEST_H #define ALFMODULETEST_H -// Define this to build module testing enchanced version of ALF -//#define USE_MODULE_TEST_HOOKS_FOR_ALF -#if !defined(USE_MODULE_TEST_HOOKS_FOR_ALF) || !defined(AMT_CONTROL) - -#define AMT_DATA() -#define AMT_FUNC(func) -#define AMT_FUNC_EXC(func) -#define AMT_FUNC_EXC_RET(ret, func) -#define AMT_FUNC_EXC_IF(cond, func) -#define AMT_FUNC_EXC_IF_RET(cond, ret, func) -#define AMT_INC_COUNTER(member) -#define AMT_DEC_COUNTER(member) -#define AMT_SET_VALUE(member, val) -#define AMT_GET_VALUE(x, member) -#define AMT_INC_COUNTER_IF(cond, member) -#define AMT_DEC_COUNTER_IF(cond, member) -#define AMT_SET_VALUE_IF(cond, member, val) -#define AMT_GET_VALUE_IF(cond, x, member) +#include +#include -#define AMT_MAP_APPEND(memberMap, key, type, defaultValue) -#define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type) -#define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type) -#define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type) -#define AMT_MAP_SET_VALUE(memberMap, key, value, type) -#define AMT_MAP_INC_VALUE(memberMap, key, type) -#define AMT_MAP_DEC_VALUE(memberMap, key, type) -#define AMT_MAP_RESET(memberMap) - -#define AMT_PRINT_STATE() +// Informs if module test hooks have been set on. +#include "alfmoduletestconf.h" -#ifndef AMT_CONTROL -#error "Error: you need to define AMT_CONTROL macro in your code to be able to use ALF module test system!" -// The user have to define AMT_CONTROL, e.g. like this: -// #define AMT_CONTROL() static_cast(Dll::Tls()) -// or -// #define AMT_CONTROL() iMyModuleTestDataControl -// etc. -#endif - -#else +// Provides module test hooks defines. +#include "alfmoduletestdefines.h" -// *** Use these macros to access global memory chunk - - -// Note: If you read/write a large block of data members, it is advisable not use the AMT_FUNC_EXC() based macros below. -// Use Lock() and Unlock() around the block explicitely, and use AMT_FUNC() macro. -// That is to avoid unnecessary nested lock-unlock sequences (even if nested locks are working ok). - -// Note: Be careful not to lock the the mutex for a long time as it will halt other processes if they are using the lock during that time! - -// Generic macros -#define AMT_DATA() AMT_CONTROL()->iModuleTestData -#define AMT_FUNC(func) if (AMT_DATA()->iIsEnabled) {func;} -#define AMT_FUNC_EXC(func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();} -#define AMT_FUNC_EXC_RET(ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {ret = func;} AMT_CONTROL()->Unlock();} -#define AMT_FUNC_EXC_IF(cond, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {func;} AMT_CONTROL()->Unlock();} -#define AMT_FUNC_EXC_IF_RET(cond, ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {ret = func;} AMT_CONTROL()->Unlock();} +#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF -// Single operation macros, that will do lock/unlock. -#define AMT_INC_COUNTER(member) AMT_FUNC_EXC(AMT_DATA()->member++) -#define AMT_DEC_COUNTER(member) AMT_FUNC_EXC(AMT_DATA()->member--) -#define AMT_SET_VALUE(member, val) AMT_FUNC_EXC(AMT_DATA()->member=(val)) -#define AMT_GET_VALUE(x, member) AMT_FUNC_EXC((x) = AMT_DATA()->member) -#define AMT_PRINT_STATE() AMT_FUNC_EXC(AMT_DATA()->PrintState()) +// *** Test map classes +#include "alfmoduletesttype.h" +#include "alfmoduletestitem.h" +#include "alfmoduletestmap.h" -// Conditional single operation macros, that will do lock/unlock. -#define AMT_INC_COUNTER_IF(cond, member) AMT_FUNC_EXC_IF((cond), AMT_DATA()->member++) -#define AMT_DEC_COUNTER_IF(cond, member) AMT_FUNC_EXC_IF((cond), AMT_DATA()->member--) -#define AMT_SET_VALUE_IF(cond, member, val) AMT_FUNC_EXC_IF((cond), AMT_DATA()->member=(val)) -#define AMT_GET_VALUE_IF(cond, x, member) AMT_FUNC_EXC_IF((cond), (x) = AMT_DATA()->member) - -// Map operation macros, that will do lock/unlock -#define AMT_MAP_APPEND(memberMap, key, type, defaultValue) AMT_FUNC_EXC(AMT_DATA()->memberMap.Append(key, type, defaultValue)) -#define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type) AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.SetValue(key, value, type)) -#define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type) AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.Find(key, type)), AMT_DATA()->memberMap.SetValue(key, AMT_DATA()->memberMap.Find(key, type)->Value() + 1, type)) -#define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type) AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.Find(key, type)), AMT_DATA()->memberMap.SetValue(key, AMT_DATA()->memberMap.Find(key, type)->Value() - 1, type)) -#define AMT_MAP_SET_VALUE(memberMap, key, value, type) AMT_FUNC_EXC_IF(ETrue, AMT_DATA()->memberMap.SetValue(key, value, type)) -#define AMT_MAP_INC_VALUE(memberMap, key, type) AMT_MAP_INC_VALUE_IF(ETrue, memberMap, key, type) -#define AMT_MAP_DEC_VALUE(memberMap, key, type) AMT_MAP_DEC_VALUE_IF(ETrue, memberMap, key, type) -#define AMT_MAP_RESET(memberMap) AMT_FUNC_EXC(AMT_DATA()->memberMap.Reset()) // *** Global object names _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK"); _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX"); -/** - * TAlfModuleTestType specifies recognized test types. - */ -enum TAlfModuleTestType - { - // Do not use this value when creating item. - EAlfModuleTestTypeNone, - - // Render stage component specific tests - EAlfModuleTestTypeRenderStageChangeSize, - EAlfModuleTestTypeRenderStageChangePosition, - EAlfModuleTestTypeRenderStageChangeFlag, - - // Streamer hierarchy model component specific tests - EAlfModuleTestTypeHierarchyModelChangeSize, - EAlfModuleTestTypeHierarchyModelChangePosition, - EAlfModuleTestTypeHierarchyModelChangeFlag, - - // Server bridge component specific tests - EAlfModuleTestTypeBridgeChangeSize, - EAlfModuleTestTypeBridgeChangePosition, - EAlfModuleTestTypeBridgeChangeFlag, - - // Do not use this value when creating item. - // This is just meant for Find operations when all tests are accepted. - EAlfModuleTestTypeAll - }; - - -/** - * CAlfModuleTestItem - * - * Provides key-value pair that is used in TAlfModuleTestMap. - */ -template< class T > -NONSHARABLE_CLASS( TAlfModuleTestItem ) - { - -public: - - /** - * Constructor to initialize variables. - * - * @param aKey Key that identifies the item. - * In test cases this could be for example handle. - * @param aTestType Defines for what this test item is meant for. - */ - TAlfModuleTestItem( TInt aKey, const TAlfModuleTestType& aTestType, const T& aDefaultValue ): - iKey( aKey ), - iTestType( aTestType ), - iValue( aDefaultValue ), - iValueSetCount( 0 ) - { - } - - - /** - * @param aObject Value to be compared. - * @return ETrue if given object equals the value of this item. - * Else EFalse. - */ - TBool Equals( const T& aValue, const TAlfModuleTestType& aTestType ) const - { - // Also, check that value has been set. If it has not been set, - // then think objects as unequals. - return ( iValueSetCount > 0 - && iValue == aValue - && TestTypeMatch( aTestType ) ); - } - - - /** - * @return TInt Key that should be set during creation of this object. - */ - TInt Key() const - { - return iKey; - } - - /** - * @see ValueSet to check if the value has already been set. - * - * @return const T& Value that corresonds the key. - */ - const T& Value() const - { - return iValue; - } - - - /** - * @param aValue Value to be set for the key - */ - void SetValue( const T& aValue ) - { - iValue = aValue; - ++iValueSetCount; - } - - - /** - * @return TInt Informs how many times the value has been set. - */ - TInt ValueSetCount() const - { - return iValueSetCount; - } - - /** - * @return const TAlfModuleTestType& Defines what the test is for - */ - const TAlfModuleTestType& TestType() const - { - return iTestType; - } - - - /** - * @param aTestType - * @return TBool ETrue if flag matches this item. Else EFalse. - */ - TBool TestTypeMatch( const TAlfModuleTestType& aTestType ) const - { - return ( EAlfModuleTestTypeAll == aTestType - || iTestType == aTestType ); - } - - - /** - * Resets the item info - */ - void Reset() - { - iValueSetCount = 0; - } - - -private: // data - - TInt iKey; - TAlfModuleTestType iTestType; - T iValue; - TInt iValueSetCount; - - }; - - -/** - * Class CAlfModuleTestMap - * - * Provides map functionality for the key-value-pairs. - * In test cases, this should most likely be used so, that - * first test case classes create items with certain keys, for example with handle values. - * Then, define hooks are used in the code to update values that corresond the correct handles. - * In the end, test case classes can check that items have correct values set and if the test - * is passed. - */ -template< class T > -NONSHARABLE_CLASS( TAlfModuleTestMap ) - { -public: - - // Maximum item count in the map - static const TInt KMaxArrayCount = 50; - - - /** - * Constructor to initialize variables. - */ - TAlfModuleTestMap(): - iCount( 0 ), - iSetValueCallCount( 0 ) - { - } - - - /** - * @param aKey - * @param aTestType Informs what type of test is accepted. Others are skipped. - * @return T* Ownership is not transferred. - * NULL if item is not found. - */ - TAlfModuleTestItem< T >* Find( TInt aKey, const TAlfModuleTestType& aTestType ) - { - // Try to find the item corresponding the given key. - for ( TInt i = 0; i < iCount; ++i ) - { - TAlfModuleTestItem< T >& testItem( iArray[ i ] ); - if ( testItem.Key() == aKey - && testItem.TestTypeMatch( aTestType ) ) - { - return &( testItem ); - } - } - // Item corresponding the given key was not found. - return NULL; - } - - - /** - * Function to append new item into the map. - * - * @param aKey - * @param aTestType Describes for what case the appended test item is created for. - * @return TInt System wide error code. - */ - TInt Append( TInt aKey, const TAlfModuleTestType& aTestType, const T& aDefaultValue ) - { - if ( iCount == KMaxArrayCount ) - { - // Array already full. - return KErrOverflow; - } - else if ( Find( aKey, aTestType ) ) - { - // Key has already been inserted. - return KErrAlreadyExists; - } - - // Append new key value set into the array. - iArray[ iCount ] = TAlfModuleTestItem< T >( aKey, aTestType, aDefaultValue ); - ++iCount; - return KErrNone; - } - - - /** - * Sets the value for the item. - * Item itself should already exist in the array before - * setting its value here. See, Append function. - * - * @param aKey - * @param aValue - * @return TInt System wide error code. - */ - TInt SetValue( TInt aKey, const T& aValue, const TAlfModuleTestType& aTestType ) - { - // Increase counter, because this function is called. - ++iSetValueCallCount; - TAlfModuleTestItem< T >* item( Find( aKey, aTestType ) ); - if ( !item ) - { - // Item was not found from the array. - return KErrNotFound; - } - // Item exists. So, set its values. - item->SetValue( aValue ); - return KErrNone; - } - - - /** - * Resets the map - */ - void Reset() - { - // Just reset the counter. - // We do not bother to reset map items, because when counter is reseted - // already set items and their info is left out of the scope. - iCount = 0; - iSetValueCallCount = 0; - } - - - /** - * Checks if all the values of items in the array match the given value. - * - * @param aValue Reference to the value that items are compared to. - * @param aTestType Informs the test type whose items should be compared. - */ - TInt CountEquals( const T& aValue, const TAlfModuleTestType& aTestType ) const - { - TInt count( 0 ); - for ( TInt i = 0; i < iCount; ++i ) - { - if ( iArray[ i ].Equals( aValue, aTestType ) ) - { - // Item matches - ++count; - } - } - return count; - } - - - /** - * @return TInt Number of map items - */ - TInt ItemCount() const - { - return iCount; - } - - - /** - * @return const TAlfModuleTestItem< T >& Reference to the map item - */ - const TAlfModuleTestItem< T >& Item( TInt aIndex ) const - { - return iArray[ aIndex ]; - } - - - /** - * @return TInt Number of times SetValue function has been called - * since last reset. This information can be used - * to check if hooks have been used correct times during - * a test case. Notice, that this informs the number of - * function calls, not the number of times a value has actually - * set for some item. - */ - TInt SetValueCallCount() const - { - return iSetValueCallCount; - } - - -private: // data - - TAlfModuleTestItem< T > iArray[ KMaxArrayCount ]; - // Informs number of array items - TInt iCount; - // Informs how many times SetItem has been called since last reset. - // Notice, that this informs the number of function calls, not the number - // of times a value has actually set for some item. - TInt iSetValueCallCount; - - }; - - /* * Class CAlfModuleTestData */ @@ -471,24 +74,55 @@ iLatestVisualExtentRect.Width(), iLatestVisualExtentRect.Height()); RDebug::Print(_L("iTotalVisualFlagChangedCount=%d"), iTotalVisualFlagChangedCount); RDebug::Print(_L("iTotalVisualAttributeChangedCount=%d"), iTotalVisualAttributeChangedCount); + RDebug::Print(_L("iBoolMap =>")); + PrintBoolMapState( iBoolMap ); + RDebug::Print(_L("iIntMap =>")); + PrintIntMapState( iIntMap ); RDebug::Print(_L("iSizeMap =>")); PrintSizeMapState( iSizeMap ); RDebug::Print(_L("iPositionMap =>")); - PrintPositionMapState( iPositionMap ); + PrintPositionMapState( iPositionMap ); RDebug::Print(_L("*** ALF INTERNAL STATE ***")); } + + void PrintBoolMapState( TAlfModuleTestMap< TBool > aMap ) + { + RDebug::Print(_L("*** ALF INTERNAL BOOL MAP STATE -->")); + RDebug::Print(_L("Map item count=%d"), aMap.ItemCount()); + for ( TInt i = 0; i < aMap.ItemCount(); ++i ) + { + const TAlfModuleTestItem< TBool >& item( aMap.Item( i ) ); + RDebug::Print(_L("Map item %d, iTestType=%d, iKey=%d, iValue=%d, iValueSetCount=%d, iLinkTargetKey=%d"), + i, item.TestType(), item.Key(), item.Value(), item.ValueSetCount(), item.LinkTargetKey()); + } + RDebug::Print(_L("<-- ALF INTERNAL BOOL MAP STATE ***")); + } + + + void PrintIntMapState( TAlfModuleTestMap< TInt > aMap ) + { + RDebug::Print(_L("*** ALF INTERNAL INT MAP STATE -->")); + RDebug::Print(_L("Map item count=%d"), aMap.ItemCount()); + for ( TInt i = 0; i < aMap.ItemCount(); ++i ) + { + const TAlfModuleTestItem< TInt >& item( aMap.Item( i ) ); + RDebug::Print(_L("Map item %d, iTestType=%d, iKey=%d, iValue=%d, iValueSetCount=%d, iLinkTargetKey=%d"), + i, item.TestType(), item.Key(), item.Value(), item.ValueSetCount(), item.LinkTargetKey()); + } + RDebug::Print(_L("<-- ALF INTERNAL INT MAP STATE ***")); + } + void PrintSizeMapState( TAlfModuleTestMap< TSize > aMap ) { RDebug::Print(_L("*** ALF INTERNAL SIZE MAP STATE -->")); - RDebug::Print(_L("Map item count=%d, SetValue call count=%d"), - aMap.ItemCount(), aMap.SetValueCallCount()); + RDebug::Print(_L("Map item count=%d"), aMap.ItemCount()); for ( TInt i = 0; i < aMap.ItemCount(); ++i ) { const TAlfModuleTestItem< TSize >& item( aMap.Item( i ) ); - RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d"), - i, item.Key(), item.TestType(), item.ValueSetCount()); + RDebug::Print(_L("Map item %d, iTestType=%d, iKey=%d, iValueSetCount=%d, iLinkTargetKey=%d"), + i, item.TestType(), item.Key(), item.ValueSetCount(), item.LinkTargetKey()); RDebug::Print(_L("Map item index=%d, width=%d, height=%d"), i, item.Value().iWidth, item.Value().iHeight); } @@ -499,13 +133,12 @@ void PrintPositionMapState( TAlfModuleTestMap< TPoint > aMap ) { RDebug::Print(_L("*** ALF INTERNAL POSITION MAP STATE -->")); - RDebug::Print(_L("Map item count=%d, SetValue call count=%d"), - aMap.ItemCount(), aMap.SetValueCallCount()); + RDebug::Print(_L("Map item count=%d"), aMap.ItemCount() ); for ( TInt i = 0; i < aMap.ItemCount(); ++i ) { const TAlfModuleTestItem< TPoint >& item( aMap.Item( i ) ); - RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d"), - i, item.Key(), item.TestType(), item.ValueSetCount()); + RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d, iLinkTargetKey=%d"), + i, item.Key(), item.TestType(), item.ValueSetCount(), item.LinkTargetKey()); RDebug::Print(_L("Map item index=%d, x=%d, y=%d"), i, item.Value().iX, item.Value().iY); } @@ -571,6 +204,8 @@ TInt iASE_Temp3; TInt iASE_Temp4; + // Map that contains boolean items that can be specified for certain test cases. + TAlfModuleTestMap< TBool > iBoolMap; // Map that contains integer items that can be specified for certain test cases. TAlfModuleTestMap< TInt > iIntMap; // Map that contains size items that can be specified for certain test cases. @@ -634,7 +269,8 @@ CAlfModuleTestData* iModuleTestData; // Not owned }; -#endif +#endif // USE_MODULE_TEST_HOOKS_FOR_ALF + #endif // ALFMODULETEST_H diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/CommonInc/alfmoduletestconf.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestconf.h Wed Mar 31 23:03:58 2010 +0300 @@ -0,0 +1,9 @@ +#ifndef ALF_MODULETEST_CONF_H +#define ALF_MODULETEST_CONF_H + +// Define this to build module testing enchanced version of ALF +//#define USE_MODULE_TEST_HOOKS_FOR_ALF + +#endif // ALF_MODULETEST_CONF_H + +// End of File diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h Wed Mar 31 23:03:58 2010 +0300 @@ -0,0 +1,225 @@ +/** + * @see alfmoduletest.h for class implementations that these defines use. + */ + +#ifndef ALF_MODULE_TEST_DEFINES_H +#define ALF_MODULE_TEST_DEFINES_H + + +// Informs if module test hooks have been set on. +#include "alfmoduletestconf.h" + + +#ifndef USE_MODULE_TEST_HOOKS_FOR_ALF + // Use empty defines if module test hook is not set. + + #define AMT_DATA() + #define AMT_FUNC(func) + #define AMT_FUNC_EXC(func) + #define AMT_FUNC_EXC_RET(ret, func) + #define AMT_FUNC_EXC_IF(cond, func) + #define AMT_FUNC_EXC_IF_RET(cond, ret, func) + #define AMT_INC_COUNTER(member) + #define AMT_DEC_COUNTER(member) + #define AMT_SET_VALUE(member, val) + #define AMT_GET_VALUE(x, member) + #define AMT_INC_COUNTER_IF(cond, member) + #define AMT_DEC_COUNTER_IF(cond, member) + #define AMT_SET_VALUE_IF(cond, member, val) + #define AMT_GET_VALUE_IF(cond, x, member) + + #define AMT_MAP_PTR_TO_KEY_CAST( keyPtr ) + #define AMT_MAP_CPTR_TO_KEY_CAST( keyCPtr ) + #define AMT_MAP_APPEND_IF(cond, memberMap, key, defaultValue, type) + #define AMT_MAP_APPEND(memberMap, key, defaultValue, type) + #define AMT_MAP_APPEND_LINK_IF(cond, memberMap, linkKey, targetKey, type) + #define AMT_MAP_APPEND_LINK(memberMap, linkKey, targetKey, type) + #define AMT_MAP_APPEND_AND_LINK_IF(cond, memberMap, linkKey, actualKey, defaultValue, type) + #define AMT_MAP_APPEND_AND_LINK(memberMap, linkKey, actualKey, defaultValue, type) + #define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type) + #define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type) + #define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type) + #define AMT_MAP_SET_VALUE(memberMap, key, value, type) + #define AMT_MAP_INC_VALUE(memberMap, key, type) + #define AMT_MAP_DEC_VALUE(memberMap, key, type) + #define AMT_MAP_APPEND_ACCEPT_IF(cond, memberMap, testType) + #define AMT_MAP_APPEND_ACCEPT(memberMap, testType) + #define AMT_MAP_RESET_ITEMS(memberMap, defaultValue, type) + #define AMT_MAP_RESET(memberMap) + + #define AMT_PRINT_STATE() + +#else + // Module test hook has been set. + + #ifndef AMT_CONTROL + #error "Error: you need to define AMT_CONTROL macro in your code to be able to use ALF module test system!" + // The user have to define AMT_CONTROL, e.g. like this: + // #define AMT_CONTROL() static_cast(Dll::Tls()) + // or + // #define AMT_CONTROL() iMyModuleTestDataControl + // etc. + #endif // AMT_CONTROL + + + // *** Use these macros to access global memory chunk + + + // Note: If you read/write a large block of data members, it is advisable not use the AMT_FUNC_EXC() based macros below. + // Use Lock() and Unlock() around the block explicitely, and use AMT_FUNC() macro. + // That is to avoid unnecessary nested lock-unlock sequences (even if nested locks are working ok). + + // Note: Be careful not to lock the the mutex for a long time as it will halt other processes if they are using the lock during that time! + + // Generic macros + #define AMT_DATA() AMT_CONTROL()->iModuleTestData + #define AMT_FUNC(func) if (AMT_DATA()->iIsEnabled) {func;} + #define AMT_FUNC_EXC(func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();} + #define AMT_FUNC_EXC_RET(ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {ret = func;} AMT_CONTROL()->Unlock();} + #define AMT_FUNC_EXC_IF(cond, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {func;} AMT_CONTROL()->Unlock();} + #define AMT_FUNC_EXC_IF_RET(cond, ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {ret = func;} AMT_CONTROL()->Unlock();} + + // Single operation macros, that will do lock/unlock. + #define AMT_INC_COUNTER(member) AMT_FUNC_EXC(AMT_DATA()->member++) + #define AMT_DEC_COUNTER(member) AMT_FUNC_EXC(AMT_DATA()->member--) + #define AMT_SET_VALUE(member, val) AMT_FUNC_EXC(AMT_DATA()->member=(val)) + #define AMT_GET_VALUE(x, member) AMT_FUNC_EXC((x) = AMT_DATA()->member) + + // Conditional single operation macros, that will do lock/unlock. + #define AMT_INC_COUNTER_IF(cond, member) AMT_FUNC_EXC_IF((cond), AMT_DATA()->member++) + #define AMT_DEC_COUNTER_IF(cond, member) AMT_FUNC_EXC_IF((cond), AMT_DATA()->member--) + #define AMT_SET_VALUE_IF(cond, member, val) AMT_FUNC_EXC_IF((cond), AMT_DATA()->member=(val)) + #define AMT_GET_VALUE_IF(cond, x, member) AMT_FUNC_EXC_IF((cond), (x) = AMT_DATA()->member) + + // Map operation macros, that will do lock/unlock + #define AMT_MAP_PTR_TO_KEY_CAST( keyPtr ) reinterpret_cast< TInt >( keyPtr ) + #define AMT_MAP_CPTR_TO_KEY_CAST( keyCPtr ) AMT_MAP_PTR_TO_KEY_CAST( static_cast< const CBase* >( keyCPtr ) ) + #define AMT_MAP_APPEND_IF(cond, memberMap, key, defaultValue, type) AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.Append(type, key, defaultValue)) + #define AMT_MAP_APPEND(memberMap, key, defaultValue, type) AMT_MAP_APPEND_IF(ETrue, memberMap, key, defaultValue, type) + #define AMT_MAP_APPEND_LINK_IF(cond, memberMap, linkKey, targetKey, type) AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.AppendLink(type, linkKey, targetKey)) + #define AMT_MAP_APPEND_LINK(memberMap, linkKey, targetKey, type) AMT_MAP_APPEND_LINK_IF(ETrue, memberMap, linkKey, targetKey, type) + #define AMT_MAP_APPEND_AND_LINK_IF(cond, memberMap, linkKey, actualKey, defaultValue, type) AMT_MAP_APPEND_IF(cond, memberMap, actualKey, defaultValue, type ); AMT_MAP_APPEND_LINK_IF(cond, memberMap, linkKey, actualKey, type) + #define AMT_MAP_APPEND_AND_LINK(memberMap, linkKey, actualKey, defaultValue, type) AMT_MAP_APPEND_AND_LINK_IF(ETrue, memberMap, linkKey, actualKey, defaultValue, type) + #define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type) AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.SetActualValue(type, key, value)) + #define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type) AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.FindActual(type, key)), AMT_DATA()->memberMap.SetActualValue(type, key, AMT_DATA()->memberMap.FindActual(type, key)->Value() + 1)) + #define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type) AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.FindActual(type, key)), AMT_DATA()->memberMap.SetActualValue(type, key, AMT_DATA()->memberMap.FindActual(type, key)->Value() - 1)) + #define AMT_MAP_SET_VALUE(memberMap, key, value, type) AMT_FUNC_EXC_IF(ETrue, AMT_DATA()->memberMap.SetActualValue(type, key, value)) + #define AMT_MAP_INC_VALUE(memberMap, key, type) AMT_MAP_INC_VALUE_IF(ETrue, memberMap, key, type) + #define AMT_MAP_DEC_VALUE(memberMap, key, type) AMT_MAP_DEC_VALUE_IF(ETrue, memberMap, key, type) + #define AMT_MAP_APPEND_ACCEPT_IF(cond, memberMap, testType) AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.AppendAccept(testType)) + #define AMT_MAP_APPEND_ACCEPT(memberMap, testType) AMT_MAP_APPEND_ACCEPT_IF(ETrue, memberMap, testType) + #define AMT_MAP_RESET_ITEMS(memberMap, defaultValue, type) AMT_FUNC_EXC(AMT_DATA()->memberMap.ResetItems(type, defaultValue)) + #define AMT_MAP_RESET(memberMap) AMT_FUNC_EXC(AMT_DATA()->memberMap.Reset()) + + #define AMT_PRINT_STATE() AMT_FUNC_EXC(AMT_DATA()->PrintState()) + +#endif // USE_MODULE_TEST_HOOKS_FOR_ALF + + +// General defines +// Text cursor handle is defined as constant because correct handle is not provided +// from the window server for render stage. +#define AMT_MAP_TEXT_CURSOR_HANDLE 0 + + +// Notice: +// Defines below will be empty if module test hook is not set. +// If module test hook is set on, then these defines also use functionality defined above. + + +// Render stage defines + +#define AMT_MAP_RENDER_STAGE_NODE_CREATED() \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iIntMap, aWindowTreeNode.Window()->Handle(), 0, EAlfModuleTestTypeRenderStageCreateWindow ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iIntMap, aWindowTreeNode.Window()->Handle(), 0, EAlfModuleTestTypeRenderStageReleaseWindow ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iBoolMap, aWindowTreeNode.Window()->Handle(), EFalse, EAlfModuleTestTypeRenderStageActiveWindow ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iSizeMap, aWindowTreeNode.Window()->Handle(), TSize(), EAlfModuleTestTypeRenderStageChangeWindowSize ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iPositionMap, aWindowTreeNode.Window()->Handle(), TPoint(), EAlfModuleTestTypeRenderStageChangeWindowPosition ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iBoolMap, aWindowTreeNode.Window()->Handle(), EFalse, EAlfModuleTestTypeRenderStageChangeWindowVisibility ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeGroup == nodeType && aWindowTreeNode.WindowGroup() ), iIntMap, aWindowTreeNode.WindowGroup()->Identifier(), 0, EAlfModuleTestTypeRenderStageCreateWindowGroup ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeGroup == nodeType && aWindowTreeNode.WindowGroup() ), iIntMap, aWindowTreeNode.WindowGroup()->Identifier(), 0, EAlfModuleTestTypeRenderStageReleaseWindowGroup ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeStandardTextCursor == nodeType ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeRenderStageChangeTextCursorType ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeStandardTextCursor == nodeType ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeRenderStageChangeTextCursorClipRect ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeStandardTextCursor == nodeType ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeRenderStageChangeTextCursorFlag ); \ + AMT_MAP_APPEND_IF( ( MWsWindowTreeNode::EWinTreeNodeStandardTextCursor == nodeType ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeRenderStageChangeTextCursorColor ); \ + \ + AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeClient == nodeType && aWindowTreeNode.Window() ), iIntMap, aWindowTreeNode.Window()->Handle(), EAlfModuleTestTypeRenderStageCreateWindow ); \ + AMT_MAP_INC_VALUE_IF( ( MWsWindowTreeNode::EWinTreeNodeGroup == nodeType && aWindowTreeNode.WindowGroup() ), iIntMap, aWindowTreeNode.WindowGroup()->Identifier(), EAlfModuleTestTypeRenderStageCreateWindowGroup ) + +#define AMT_MAP_RENDER_STAGE_TEXT_CURSOR_CHANGE() \ + AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorType ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorType ); \ + AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorClipRect ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorClipRect ); \ + AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorFlags ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorFlag ); \ + AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorColor ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorColor ) + + +// Streamer defines + +#define AMT_MAP_STREAMER_NODE_WINDOW_CONSTRUCT() \ + AMT_MAP_APPEND_AND_LINK( iIntMap, iId, iNodeWindowConstructionStruct.iWindowHandle, 0, EAlfModuleTestTypeHierarchyModelCreateWindow ); \ + AMT_MAP_APPEND_AND_LINK( iIntMap, iId, iNodeWindowConstructionStruct.iWindowHandle, 0, EAlfModuleTestTypeHierarchyModelReleaseWindow ); \ + AMT_MAP_APPEND_AND_LINK( iBoolMap, iId, iNodeWindowConstructionStruct.iWindowHandle, EFalse, EAlfModuleTestTypeHierarchyModelActiveWindow ); \ + AMT_MAP_APPEND_AND_LINK( iSizeMap, iId, iNodeWindowConstructionStruct.iWindowHandle, TSize(), EAlfModuleTestTypeHierarchyModelChangeWindowSize ); \ + AMT_MAP_APPEND_AND_LINK( iPositionMap, iId, iNodeWindowConstructionStruct.iWindowHandle, TPoint(), EAlfModuleTestTypeHierarchyModelChangeWindowPosition ); \ + AMT_MAP_APPEND_AND_LINK( iBoolMap, iId, iNodeWindowConstructionStruct.iWindowHandle, EFalse, EAlfModuleTestTypeHierarchyModelChangeWindowVisibility ) + +#define AMT_MAP_STREAMER_NODE_GROUP_CONSTRUCT() \ + AMT_MAP_APPEND_AND_LINK( iIntMap, iId, clientHandle, 0, EAlfModuleTestTypeHierarchyModelCreateWindowGroup ); \ + AMT_MAP_APPEND_AND_LINK( iIntMap, iId, clientHandle, 0, EAlfModuleTestTypeHierarchyModelReleaseWindowGroup ) + +#define AMT_MAP_STREAMER_TEXT_CURSOR_CONSTRUCT() \ + AMT_MAP_APPEND( iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeHierarchyModelChangeTextCursorType ); \ + AMT_MAP_APPEND( iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeHierarchyModelChangeTextCursorClipRect ); \ + AMT_MAP_APPEND( iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeHierarchyModelChangeTextCursorFlag ); \ + AMT_MAP_APPEND( iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeHierarchyModelChangeTextCursorColor ) + +#define AMT_MAP_STREAMER_TEXT_CURSOR_CHANGE() \ + AMT_MAP_INC_VALUE_IF( ( attribute == MWsWindowTreeObserver::ECursorType ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeHierarchyModelChangeTextCursorType ); \ + AMT_MAP_INC_VALUE_IF( ( attribute == MWsWindowTreeObserver::ECursorClipRect ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeHierarchyModelChangeTextCursorClipRect ); \ + AMT_MAP_INC_VALUE_IF( ( attribute == MWsWindowTreeObserver::ECursorFlags ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeHierarchyModelChangeTextCursorFlag ); \ + AMT_MAP_INC_VALUE_IF( ( attribute == MWsWindowTreeObserver::ECursorColor ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeHierarchyModelChangeTextCursorColor ) + + +// Alfserver defines + +#define AMT_MAP_BRIDGE_ADD_VISUAL() \ + AMT_MAP_APPEND_AND_LINK( iIntMap, aWindowNodeId, aClientSideId, 0, EAlfModuleTestTypeBridgeCreateWindow ); \ + AMT_MAP_APPEND_AND_LINK( iIntMap, aWindowNodeId, aClientSideId, 0, EAlfModuleTestTypeBridgeReleaseWindow ); \ + AMT_MAP_APPEND_AND_LINK( iBoolMap, aWindowNodeId, aClientSideId, EFalse, EAlfModuleTestTypeBridgeActiveWindow ); \ + AMT_MAP_APPEND_AND_LINK( iSizeMap, aWindowNodeId, aClientSideId, TSize(), EAlfModuleTestTypeBridgeChangeWindowSize ); \ + AMT_MAP_APPEND_AND_LINK( iPositionMap, aWindowNodeId, aClientSideId, TPoint(), EAlfModuleTestTypeBridgeChangeWindowPosition ); \ + AMT_MAP_APPEND_AND_LINK( iBoolMap, aWindowNodeId, aClientSideId, EFalse, EAlfModuleTestTypeBridgeChangeWindowVisibility ); \ + \ + AMT_MAP_APPEND_AND_LINK_IF( aVisual, iIntMap, AMT_MAP_CPTR_TO_KEY_CAST( aVisual ), aClientSideId, 0, EAlfModuleTestTypeCoreToolkitDrawWindow ); \ + AMT_MAP_APPEND_AND_LINK_IF( aVisual, iIntMap, AMT_MAP_CPTR_TO_KEY_CAST( aVisual ), aClientSideId, 0, EAlfModuleTestTypeCoreToolkitDrawFromRenderBuffer ); \ + \ + AMT_MAP_INC_VALUE( iIntMap, aClientSideId, EAlfModuleTestTypeBridgeCreateWindow ); \ + \ + AMT_MAP_APPEND( iBoolMap, aClientSideId, ETrue, EAlfModuleTestTypeBridgeCreateWindow ); \ + AMT_MAP_APPEND( iBoolMap, aClientSideId, EFalse, EAlfModuleTestTypeBridgeVisualVisibility ); \ + AMT_MAP_APPEND_LINK_IF( aVisual, iBoolMap, AMT_MAP_CPTR_TO_KEY_CAST( aVisual ), aClientSideId, EAlfModuleTestTypeBridgeVisualVisibility ); \ + AMT_MAP_APPEND( iBoolMap, aClientSideId, EFalse, EAlfModuleTestTypeBridgeReleaseWindow ); \ + AMT_MAP_APPEND_LINK( iBoolMap, aWindowNodeId, aClientSideId, EAlfModuleTestTypeBridgeReleaseWindow ) + +#define AMT_MAP_BRIDGE_CREATE_CONTROL_GROUP() \ + AMT_MAP_APPEND_AND_LINK( iIntMap, aWindowGroupNodeId, aClientWindowGroupId, 0, EAlfModuleTestTypeBridgeCreateWindowGroup ); \ + AMT_MAP_APPEND_AND_LINK( iIntMap, aWindowGroupNodeId, aClientWindowGroupId, 0, EAlfModuleTestTypeBridgeReleaseWindowGroup ); \ + \ + AMT_MAP_INC_VALUE( iIntMap, aClientWindowGroupId, EAlfModuleTestTypeBridgeCreateWindowGroup ) + +#define AMT_MAP_BRIDGE_ADD_TEXT_CURSOR() \ + AMT_MAP_APPEND( iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeBridgeChangeTextCursorType ); \ + AMT_MAP_APPEND( iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeBridgeChangeTextCursorClipRect ); \ + AMT_MAP_APPEND( iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeBridgeChangeTextCursorFlag ); \ + AMT_MAP_APPEND( iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, 0, EAlfModuleTestTypeBridgeChangeTextCursorColor ) + +#define AMT_MAP_BRIDGE_TEXT_CURSOR_CHANGE() \ + AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorType ); \ + AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorClipRect ); \ + AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorFlag ); \ + AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorColor ) + + +#endif // ALF_MODULE_TEST_DEFINES_H + +// End of File diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/CommonInc/alfmoduletestitem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestitem.h Wed Mar 31 23:03:58 2010 +0300 @@ -0,0 +1,188 @@ +/** + * @note This class is provided only if module test hooks are set on. + */ + +#include "alfmoduletestconf.h" +#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF + +#ifndef ALFMODULETESTITEM_H +#define ALFMODULETESTITEM_H + +#include +#include "alfmoduletesttype.h" + + +/** + * CAlfModuleTestItem + * + * Provides key-value pair that is used in TAlfModuleTestMap. + */ +template< class T > +NONSHARABLE_CLASS( TAlfModuleTestItem ) + { + +public: + + /** + * Default constructor + * + * This is provided for copy operations that may required default constructor. + * For normal cases, use another constructor instead to initialize the item + * with correct values. + */ + TAlfModuleTestItem(): + iTestType( EAlfModuleTestTypeNone ), + iKey( 0 ), + iValueSetCount( 0 ), + iLinkTargetKey( KErrNotFound ) + { + } + + + /** + * Constructor to initialize variables. + * + * @param aTestType Defines for what this test item is meant for. + * @param aKey Key that identifies the item. + * In test cases this could be for example handle. + * @param aDefaultValue Default value for the map item. + */ + TAlfModuleTestItem( const TAlfModuleTestType& aTestType, TInt aKey, const T& aDefaultValue ): + iTestType( aTestType ), + iKey( aKey ), + iValue( aDefaultValue ), + iValueSetCount( 0 ), + iLinkTargetKey( KErrNotFound ) + { + } + + + /** + * @note Be carefull when comparing items because some items may + * be link items instead of original items. + * + * @param aTestType Test type of accepted item. + * @param aValue Item value to be compared. + * @return ETrue if given object equals the value of this item. + * Else EFalse. + */ + TBool Equals( const TAlfModuleTestType& aTestType, const T& aValue ) const + { + // Also, check that value has been set. If it has not been set, + // then think objects as unequals. + return ( iValueSetCount > 0 + && iValue == aValue + && TestTypeMatch( aTestType ) ); + } + + + /** + * @return TInt Key that should be set during creation of this object. + */ + TInt Key() const + { + return iKey; + } + + + /** + * @see TAlfModuleTestItem::ValueSetCount to check if the value has already been set. + * + * @return const T& Value that corresonds the key. + */ + const T& Value() const + { + return iValue; + } + + + /** + * @param aValue Value to be set for the key + */ + void SetValue( const T& aValue ) + { + iValue = aValue; + ++iValueSetCount; + } + + + /** + * @return TInt Informs how many times the value has been set. + */ + TInt ValueSetCount() const + { + return iValueSetCount; + } + + + /** + * @return const TAlfModuleTestType& Defines what the test is for. + */ + const TAlfModuleTestType& TestType() const + { + return iTestType; + } + + + /** + * @param aTestType Type of the test this item is for. + * @return TBool ETrue if flag matches this item. Else EFalse. + */ + TBool TestTypeMatch( const TAlfModuleTestType& aTestType ) const + { + return ( EAlfModuleTestTypeAll == aTestType + || EAlfModuleTestTypeAll == iTestType + || iTestType == aTestType ); + } + + + /** + * @param aLinkTargetKey Key of the item that this item links to. + * KErrNotFound if this is not a link item. + */ + void SetLinkTargetKey( TInt aLinkTargetKey ) + { + iLinkTargetKey = aLinkTargetKey; + } + + + /** + * @return TInt Key of the item that this item links to. + * KErrNotFound if this is not a link item. + */ + TInt LinkTargetKey() const + { + return iLinkTargetKey; + } + + + /** + * Resets this item to the given default value and + * sets value set count to zero. + * + * @note Type, key and link target remain unchanged. + * + * @param aDefaultValue Default value for the item. + */ + void Reset( const T& aDefaultValue ) + { + iValue = aDefaultValue; + iValueSetCount = 0; + } + + +private: // data + + TAlfModuleTestType iTestType; + TInt iKey; + T iValue; + TInt iValueSetCount; + TInt iLinkTargetKey; + + }; + +#endif // ALFMODULETESTITEM_H + +#endif // USE_MODULE_TEST_HOOKS_FOR_ALF + +// End of File diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h Wed Mar 31 23:03:58 2010 +0300 @@ -0,0 +1,359 @@ +/** + * @note This class is provided only if module test hooks are set on. + */ + +#include "alfmoduletestconf.h" +#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF + +#ifndef ALFMODULETESTMAP_H +#define ALFMODULETESTMAP_H + +#include +#include "alfmoduletestitem.h" +#include "alfmoduletesttype.h" + + +/** + * Class CAlfModuleTestMap + * + * Provides map functionality for the key-value-pairs. + * In test cases, this should most likely be used so, that + * first test case classes create items with certain keys, for example with handle values. + * Then, define hooks are used in the code to update values that corresond the correct handles. + * In the end, test case classes can check that items have correct values set and if the test + * is passed. + * + * @note When this item is copied, also the contents of the map item array are copied + * into new map item array. In other words, copy can be thought as deep copy + * instead of just shallow copy of array pointer. + * + * @see CAlfModuleTestItem + */ +template< class T > +NONSHARABLE_CLASS( TAlfModuleTestMap ) + { +public: + + // Maximum item count in the map + static const TInt KMaxArrayCount = 100; + + // Maximum accepted test type count in the map + static const TInt KMaxAcceptArrayCount = 20; + + + /** + * Constructor to initialize variables. + */ + TAlfModuleTestMap(): + iArrayCount( 0 ) + { + } + + + /** + * @note This will return normal items and also items that are links. + * + * @param aTestType Informs what type of test is accepted. Others are skipped. + * @param aKey Key of the map item. + * @return T* Ownership is not transferred. + * NULL if item is not found. + */ + TAlfModuleTestItem< T >* Find( const TAlfModuleTestType& aTestType, TInt aKey ) + { + // Try to find the item corresponding the given key. + for ( TInt i = 0; i < iArrayCount; ++i ) + { + TAlfModuleTestItem< T >& testItem( iArray[ i ] ); + if ( testItem.Key() == aKey + && testItem.TestTypeMatch( aTestType ) ) + { + return &( testItem ); + } + } + // Item corresponding the given key was not found. + return NULL; + } + + + /** + * Finds the actual item. + * + * @note If the given key identifies a link item, + * then search is continued to the actual item + * through the link chain. + * Link item is not returned here. + * + * @param aTestType Test type of the linked item and link item. + * @param aKey Key of the item. This can also be a key to a link item. + * @return TAlfModuleTestItem< T >* Actual item. + * NULL if item was not found. + * Ownership is not transferred. + */ + TAlfModuleTestItem< T >* FindActual( const TAlfModuleTestType& aTestType, TInt aKey ) + { + TAlfModuleTestItem< T >* item( Find( aTestType, aKey ) ); + while ( item && item->LinkTargetKey() != KErrNotFound ) + { + // Item is link. + // So, find the actual item through link targets. + item = Find( aTestType, item->LinkTargetKey() ); + } + return item; + } + + + /** + * Function to append new item into the map. + * + * @param aTestType Describes for what case the appended test item is created for. + * @param aKey Key of the map item. + * @param aDefaultValue Default value for the map item. + * @return TInt System wide error code. + */ + TInt Append( const TAlfModuleTestType& aTestType, TInt aKey, const T& aDefaultValue ) + { + if ( !Accept( aTestType ) ) + { + // Given test type has not been set as accepted. + return KErrNotSupported; + } + else if ( Find( aTestType, aKey ) ) + { + // Item already exists in the map. + return KErrAlreadyExists; + } + else if ( iArrayCount == KMaxArrayCount ) + { + // Array already full. + return KErrOverflow; + } + + // Append new item into the array. + iArray[ iArrayCount ] = TAlfModuleTestItem< T >( aTestType, aKey, aDefaultValue ); + ++iArrayCount; + return KErrNone; + } + + + /** + * Creates and appends link item that links to another item. + * + * @param aTestType Test type of the linked item and link item. + * @param aLinkKey Link item key. + * @param aTargetKey Target item key. + * @return TInt System wide error code. + */ + TInt AppendLink( const TAlfModuleTestType& aTestType, TInt aLinkKey, TInt aTargetKey ) + { + if ( !Accept( aTestType ) ) + { + // Given test type has not been set as accepted. + return KErrNotSupported; + } + else if ( Find( aTestType, aLinkKey ) ) + { + // Link item already exists in the map. + return KErrAlreadyExists; + } + else if ( !FindActual( aTestType, aTargetKey ) ) + { + // Link has to point to another existing item. + // Also, link has to point to the chain that ends to actual item. + // Then, links will not create forever loops. Loops could occur + // if links in chain point to each other creating loops. + return KErrNotFound; + } + else if ( iArrayCount == KMaxArrayCount ) + { + // Array already full. + return KErrOverflow; + } + + // Create link item because original item exists and link chain is correct. + // Append new link item into the array and link it to another link or to + // actual item. + TAlfModuleTestItem< T >* target( Find( aTestType, aTargetKey ) ); + // Set value of the link same as its target's value. + iArray[ iArrayCount ] = TAlfModuleTestItem< T >( aTestType, aLinkKey, target->Value() ); + iArray[ iArrayCount ].SetLinkTargetKey( target->Key() ); + ++iArrayCount; + return KErrNone; + } + + + /** + * Sets the value for the actual item. + * Item itself should already appended into map and exist + * in the array before setting its value here. + * + * @note Some items may be links. But, only the value of the + * actual item in the end of the link chain is set here. + * + * @param aTestType Describes for what case the item is for. + * @param aKey Key of the map item. + * @param aValue Value for the map item. + * @return TInt System wide error code. + */ + TInt SetActualValue( const TAlfModuleTestType& aTestType, TInt aKey, const T& aValue ) + { + TAlfModuleTestItem< T >* item( FindActual( aTestType, aKey ) ); + if ( !item ) + { + // Actual item was not found from the array. + return KErrNotFound; + } + + // Actual item exists and it is not link item. So, set its values. + item->SetValue( aValue ); + return KErrNone; + } + + + /** + * Find an actual item if it exists and gets its value if item is found + * and value has been set. + * + * @param aTestType Describes for what case the item is for. + * @param aKey Key of the map item. + * @param aValue If map item is found, value of the item is set here. + * @return TBool ETrue if map item is found and value has been set. Else EFalse. + */ + TBool GetActualValue( const TAlfModuleTestType& aTestType, TInt aKey, T& aValue ) + { + const TAlfModuleTestItem< T >* item( FindActual( aTestType, aKey ) ); + if ( item && item->ValueSetCount() > 0 ) + { + aValue = item->Value(); + return ETrue; + } + return EFalse; + } + + + /** + * Finds an actual item if it exists and checks if it equals the given value. + * + * @return TBool ETrue if item is found and its value equals given value. Else EFalse. + */ + TBool ActualEquals( const TAlfModuleTestType& aTestType, TInt aKey, const T& aValue ) + { + T value( aValue ); + if ( GetActualValue( aTestType, aKey, value ) && value == aValue ) + { + return ETrue; + } + return EFalse; + } + + + /** + * @return TInt Number of map items + */ + TInt ItemCount() const + { + return iArrayCount; + } + + + /** + * @return const TAlfModuleTestItem< T >& Reference to the map item + */ + const TAlfModuleTestItem< T >& Item( TInt aIndex ) const + { + return iArray[ aIndex ]; + } + + + /** + * Appends an accepted test type into the accepted array. + * + * @note Only items of accepted test type can be appended + * into this map. + * + * @param aTestType Test item type that is accepted for this map. + * @return TInt System wide error code. + */ + TInt AppendAccept( const TAlfModuleTestType& aTestType ) + { + if ( Accept( aTestType ) ) + { + // Type already exists in the array. + return KErrAlreadyExists; + } + else if ( iAcceptArrayCount == KMaxAcceptArrayCount ) + { + // Array already full. + return KErrOverflow; + } + + iAcceptArray[ iAcceptArrayCount ] = aTestType; + ++iAcceptArrayCount; + return KErrNone; + } + + + /** + * @param aTestType Test item type to be checked. + * @return TBool ETrue if given test type is set as accepted for this map. + * Else EFalse. + */ + TBool Accept( const TAlfModuleTestType& aTestType ) const + { + for ( TInt i = 0; i < iAcceptArrayCount; ++i ) + { + if ( aTestType == iAcceptArray[ i ] ) + { + return ETrue; + } + } + return EFalse; + } + + + /** + * Resets all the array items that match the given test type + * to given default value. + * + * @param aTestType The test type of items that should be resetted. + * @param aValue Reference to the value that items are resetted to. + */ + void ResetItems( const TAlfModuleTestType& aTestType, const T& aDefaultValue ) + { + for ( TInt i = 0; i < iArrayCount; ++i ) + { + if ( iArray[ i ].TestTypeMatch( aTestType ) ) + { + iArray[ i ].Reset( aDefaultValue ); + } + } + } + + + /** + * Resets the map + */ + void Reset() + { + // Just reset the counter. + // We do not bother to reset map items, because when counter is reseted + // already set items and their info is left out of the scope. + iArrayCount = 0; + iAcceptArrayCount = 0; + } + + +private: // data + + TAlfModuleTestItem< T > iArray[ KMaxArrayCount ]; + TInt iArrayCount; + + TAlfModuleTestType iAcceptArray[ KMaxAcceptArrayCount ]; + TInt iAcceptArrayCount; + + }; + +#endif // ALFMODULETESTMAP_H + +#endif // USE_MODULE_TEST_HOOKS_FOR_ALF + +// End of File diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h Wed Mar 31 23:03:58 2010 +0300 @@ -0,0 +1,81 @@ +/** + * @note Contents of this file are provided only if module test hooks are set on. + */ + +#include "alfmoduletestconf.h" +#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF + +#ifndef ALFMODULETESTTYPE_H +#define ALFMODULETESTTYPE_H + +/** + * TAlfModuleTestType specifies recognized test types. + */ +enum TAlfModuleTestType + { + // Do not use this value when creating item. + EAlfModuleTestTypeNone, + + // Render stage component specific tests + EAlfModuleTestTypeRenderStageCreateLayer, + EAlfModuleTestTypeRenderStageReleaseLayer, + EAlfModuleTestTypeRenderStageCreateWindow, + EAlfModuleTestTypeRenderStageReleaseWindow, + EAlfModuleTestTypeRenderStageCreateWindowGroup, + EAlfModuleTestTypeRenderStageReleaseWindowGroup, + EAlfModuleTestTypeRenderStageActiveWindow, + EAlfModuleTestTypeRenderStageChangeWindowSize, + EAlfModuleTestTypeRenderStageChangeWindowPosition, + EAlfModuleTestTypeRenderStageChangeWindowVisibility, + EAlfModuleTestTypeRenderStageChangeTextCursorType, + EAlfModuleTestTypeRenderStageChangeTextCursorClipRect, + EAlfModuleTestTypeRenderStageChangeTextCursorFlag, + EAlfModuleTestTypeRenderStageChangeTextCursorColor, + + // Streamer hierarchy model component specific tests + EAlfModuleTestTypeHierarchyModelCreateLayer, + EAlfModuleTestTypeHierarchyModelReleaseLayer, + EAlfModuleTestTypeHierarchyModelCreateWindow, + EAlfModuleTestTypeHierarchyModelReleaseWindow, + EAlfModuleTestTypeHierarchyModelCreateWindowGroup, + EAlfModuleTestTypeHierarchyModelReleaseWindowGroup, + EAlfModuleTestTypeHierarchyModelActiveWindow, + EAlfModuleTestTypeHierarchyModelChangeWindowSize, + EAlfModuleTestTypeHierarchyModelChangeWindowPosition, + EAlfModuleTestTypeHierarchyModelChangeWindowVisibility, + EAlfModuleTestTypeHierarchyModelChangeTextCursorType, + EAlfModuleTestTypeHierarchyModelChangeTextCursorClipRect, + EAlfModuleTestTypeHierarchyModelChangeTextCursorFlag, + EAlfModuleTestTypeHierarchyModelChangeTextCursorColor, + + // Server bridge component specific tests + EAlfModuleTestTypeBridgeCreateLayer, + EAlfModuleTestTypeBridgeReleaseLayer, + EAlfModuleTestTypeBridgeCreateWindow, + EAlfModuleTestTypeBridgeReleaseWindow, + EAlfModuleTestTypeBridgeCreateWindowGroup, + EAlfModuleTestTypeBridgeReleaseWindowGroup, + EAlfModuleTestTypeBridgeActiveWindow, + EAlfModuleTestTypeBridgeChangeWindowSize, + EAlfModuleTestTypeBridgeChangeWindowPosition, + EAlfModuleTestTypeBridgeChangeWindowVisibility, + EAlfModuleTestTypeBridgeChangeTextCursorType, + EAlfModuleTestTypeBridgeChangeTextCursorClipRect, + EAlfModuleTestTypeBridgeChangeTextCursorFlag, + EAlfModuleTestTypeBridgeChangeTextCursorColor, + EAlfModuleTestTypeBridgeVisualVisibility, + + // Core toolkit component specific tests + EAlfModuleTestTypeCoreToolkitDrawWindow, + EAlfModuleTestTypeCoreToolkitDrawFromRenderBuffer, + + // Do not use this value when creating item. + // This is just meant for Find operations when all tests are accepted. + EAlfModuleTestTypeAll + }; + +#endif // ALFMODULETESTTYPE_H + +#endif // USE_MODULE_TEST_HOOKS_FOR_ALF + +// End of File diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/BWINS/alfappservercoreu.DEF --- a/uiacceltk/hitchcock/ServerCore/BWINS/alfappservercoreu.DEF Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/BWINS/alfappservercoreu.DEF Wed Mar 31 23:03:58 2010 +0300 @@ -308,4 +308,5 @@ ?FindWgForAppUid@CAlfStreamerBridge@@QAEHVTUid@@@Z @ 307 NONAME ; int CAlfStreamerBridge::FindWgForAppUid(class TUid) ?FindAppUidForWgId@CAlfStreamerBridge@@QAE?AVTUid@@H@Z @ 308 NONAME ; class TUid CAlfStreamerBridge::FindAppUidForWgId(int) ?SetLayerUsesAplhaFlag@CAlfWindow@@QAEXH@Z @ 309 NONAME ; void CAlfWindow::SetLayerUsesAplhaFlag(int) + ?ClientAboutToExit@CAlfWindowFxPlugin@@UAEXVTThreadId@@@Z @ 310 NONAME ; void CAlfWindowFxPlugin::ClientAboutToExit(class TThreadId) diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h Wed Mar 31 23:03:58 2010 +0300 @@ -199,6 +199,7 @@ void AlfGfxEffectEndCallBack( TInt aHandle ); TInt FindClientWindowGroupId( TInt aScreenNumber, CHuiControlGroup& aControlGroup ); + TInt FindWindowGroupNodeId( TInt aScreenNumber, CHuiControlGroup& aControlGroup ) const; void RemoveAllTemporaryPresenterVisuals(); @@ -210,6 +211,7 @@ void EnableSwRenderingL(TBool aEnable = ETrue); TBool PrepareSwRenderingTarget( CAlfScreen* aScreen ); + void InitializeSwRenderingTarget(CFbsBitmap* aBitmap); /** * Sets memory level. @@ -237,9 +239,9 @@ void DoUpdateMemoryLevel(); /** - * Cancels all effects due to low memory. + * Modify all effects due to low memory. */ - void LowMemoryCancelAllEffects(); + void OnLowMemoryModifyAllEffects(); /** * Gets size & rotation. @@ -265,20 +267,31 @@ void Synchronized(TInt aId); /* - * HandleGfxEndFullScreenTimeout + * GfxTriggerEndFullScreen * * GfxTransEffect API gives EndFullScreen events too late. Thus there is a two stage process for triggering * the EndFullScreen effect after BeginFullScreen event arrived. * - * For application start effects we give N milliseconds timeout for application to finish drawing after - * the first drawing has arrived. If after N milliseconds application has not drawn 75% of the screen, it - * gets another N milliseconds. Most cases, the first N milliseconds is enough. */ - void HandleGfxEndFullScreenTimeout(CFullScreenEffectState* aFullScreenEffectData); + void GfxTriggerEndFullScreen(CFullScreenEffectState* aFullScreenEffectData); + + /* + * GfxTriggerEffectWhenFullScreenDrawn + * + * Goes through the given CHuiControl (group which is supposed to show the effect). + * Triggers the effect, if drawing buffers in group cover the whole screen in the + * current orientation. + * + * @param aToGroup Group to be analyzed + */ + TBool GfxTriggerEffectWhenFullScreenDrawn(CHuiControlGroup* aToGroup = NULL); // Experimental TBool IsFullScreenDrawn( TInt aOrientation); + void LayoutSwitchStart(); + void LayoutSwitchComplete(); + private: @@ -329,7 +342,17 @@ // component effect handling void HandleGfxControlEffectsL( TAlfBridgerData data ); - + + /** + * StoreLayoutIfRequiredByEffectL + * + * @param aNeededStoredLayout Returns ETrue, if storing is required. Otherwise EFalse. + * + * @return ETrue If storing was required and could be done. + * OR storing was not required. + */ + TBool StoreLayoutIfRequiredByEffectL(CHuiLayout* aLayout, CFullScreenEffectState& aEvent, TBool& aNeededStoredLayout); + /** * Handles begin and end fullscreen events */ @@ -537,6 +560,8 @@ void HandleSetNodeTracking( TAlfBridgerData& aData ); void HandleSetFadeEffectL( TAlfBridgerData& aData ); + + void HandleMoveWindowToNewGroupL( TAlfBridgerData& aData ); void HandleSetLayoutSwitchEffectL(); @@ -771,10 +796,12 @@ TRect& aFullscreen, CAlfScreen* aScreen, TBool& aSubtreeVisible, - TBool& aHasVisualsWithLayers, TBool aChildCanBeOpaque, TInt aOrientation); + + void MarkAllLayersHiddenRecursive(CHuiLayout* aLayout); + NONSHARABLE_CLASS ( TDeadControlGroup ) { public: @@ -946,6 +973,11 @@ mutable RRegionBuf iTempRegion; TBool iBgSurfaceFound; TBool iInLowMemMode; + TBool iLayoutSwitchInProgress; + + TBool iHomeScreenWallpaperWindowFound; + TBool iBgAnimHidden; + CAlfLayoutSwitchEffectCoordinator* iLayoutSwitchEffectCoordinator; TInt iAlfSecureId; TBool iSwRenderingEnabled; @@ -954,6 +986,9 @@ TBool iLowMemoryMode; THuiMemoryLevel iCurrentMemoryLevel; + TInt iIdForEAlfDSSynchronizeOp; + TInt iIdForLayoutSwitchFrameSync; + #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER TInt activevisualcount; TInt passivevisualcount; diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h Wed Mar 31 23:03:58 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(); @@ -45,7 +45,7 @@ CAlfBridge& iBridge; public: TInt iSafeCounter; - + TCallBack iCallBack; }; @@ -84,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(); @@ -92,9 +111,25 @@ void AlfGfxEffectEndCallBack( TInt aHandle ); public: + void Blank(TBool aEnabled); + void LowMemoryEvent(); void BeginLayoutSwitch(); - void Cancel(); - TBool LayoutSwitchEffectsExist(); + + 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) @@ -109,16 +144,25 @@ } } } + private: AknTransEffect::TContext NextLayoutSwitchContext(); void SetLayoutSwitchEffect(AknTransEffect::TContext aContext); + void FreezeRoster(TBool aFrozen); + + static TInt DoFreezeFinished(TAny* aAny); + private: // Data CAlfBridge& iBridge; AknTransEffect::TContext iLayoutSwitchEffectContext; TThreadPriority iOriginalPriority; CAlfRosterFreezeEndTimer* iRosterFreezeEndTimer; + TBool iBlankEnabled; + + TState iCurrentState; + TBool iLayoutSwitchNotCompleted; }; // --------------------------------------------------------- @@ -175,10 +219,6 @@ void ConstructL(TInt aAction, RMemReadStream& aStream); - TBool InitDelayedEffectL(CAlfBridge* aBridge, TSize aDisplaySize); - - void NotifyDrawingTimeout(); - // Information from BeginFullScreen TInt iType; TInt iToWg; diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h Wed Mar 31 23:03:58 2010 +0300 @@ -73,6 +73,8 @@ KAlfCompositionTargetHiddenBGAnim, KAlfCompositionTargetVisibleBGAnim, + KAlfCompositionLayoutSwitchComplete + }; struct TAlfNativeWindowData diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h Wed Mar 31 23:03:58 2010 +0300 @@ -35,7 +35,7 @@ static TInt LaunchServer(TThreadId& aThreadId, CAlfStreamerBridge* aBridge ); static void NewLC(CAlfStreamerBridge* aBridge); ~CAlfStreamerServer(); - void HandleClientExit(const CSession2* aClient); + void HandleClientExit(const CAlfStreamerServerSession* aClient); CAlfWindowManager* WindowMgr() { return iWindowMgr; @@ -146,7 +146,7 @@ NONSHARABLE_CLASS(CAlfStreamerServerSession): public CSession2 { public: - CAlfStreamerServerSession(); + CAlfStreamerServerSession(const TThreadId& aThreadId); ~CAlfStreamerServerSession(); void ServiceL(const RMessage2& aMessage); void HandleCompositionOpL(TInt aOp, const RMessage2& aMessage, CAlfStreamerServer* aServer); @@ -162,6 +162,10 @@ TSurfaceId& ExtentSurfaceId(); TInt& AlfToken(){ return iAlfToken; } TBool IsBgAnimSession(){return iIsBgAnimSession;} + TThreadId ThreadId() const + { + return iThreadId; + } private: RArray iLoadedPlugins; @@ -179,6 +183,7 @@ TSurfaceId iExtentSurfaceId; TInt iAlfToken; TBool iIsBgAnimSession; + TThreadId iThreadId; }; #endif diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Inc/alfwindowfxplugin.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfwindowfxplugin.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfwindowfxplugin.h Wed Mar 31 23:03:58 2010 +0300 @@ -45,6 +45,9 @@ /** Cancel asynch message(s) from client */ IMPORT_C virtual void CancelMessage(TInt aMessageId); + /** Client about to exist, discard message(s) from client */ + IMPORT_C virtual void ClientAboutToExit(TThreadId aClientId); + /** * Pure Virtuals */ diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Inc/alfwindowmanager.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfwindowmanager.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfwindowmanager.h Wed Mar 31 23:03:58 2010 +0300 @@ -248,6 +248,8 @@ IMPORT_C CAlfStreamerBridge* Bridge(); + void HandleClientExit(TThreadId aThreadId); + private: // utils CAlfWindowManager(); diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -468,8 +468,10 @@ if(iWindowGc->Construct() == KErrNone) { iWindowGc->Activate(*iWindow); + iWindow->BeginRedraw(); iWindowGc->SetBrushColor(0xffffffff); iWindowGc->Clear(); + iWindow->EndRedraw(); iWindowGc->Deactivate(); } } @@ -1476,36 +1478,15 @@ User::Leave(KErrPermissionDenied); } - if (iData->iBridgeObj->LayoutSwitchEffectCoordinator()) - { - iData->iBridgeObj->LayoutSwitchEffectCoordinator()->EnableSafeCounter(EFalse); // let capserver rule - } +// if (iData->iBridgeObj->LayoutSwitchEffectCoordinator()) +// { +// iData->iBridgeObj->LayoutSwitchEffectCoordinator()->EnableSafeCounter(EFalse); // let capserver rule +// } TBool pause = aMessage.Int0(); - if ( pause && - CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff ) && - iData->iBridgeObj->LayoutSwitchEffectCoordinator() && - iData->iBridgeObj->LayoutSwitchEffectCoordinator()->LayoutSwitchEffectsExist() - ) - { // don't pause if effects are there, releasing the blanker needs to be allowed still - __ALFLOGSTRING("CAlfAppUi::DoBlankScreen << - Effects on"); - return; - } - if (pause != iData->iHuiEnv->iPauseDrawing) - { - iData->iHuiEnv->iPauseDrawing = pause; - __ALFLOGSTRING1("CAlfAppUi::DoBlankScreen pausing %d",pause); - TRAP_IGNORE(iData->iHuiEnv->Display(0).Roster().FreezeVisibleContentL(pause)); - if (!pause) - { // make sure that toolkit will traverse through scene - iData->iHuiEnv->StartRefresh(1); - } - else - { - iData->iBridgeObj->LayoutSwitchEffectCoordinator()->Cancel(); - } - } + iData->iBridgeObj->LayoutSwitchEffectCoordinator()->Blank(pause); + __ALFLOGSTRING("CAlfAppUi::DoBlankScreen <<"); // let the session complete message } diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -70,6 +70,7 @@ #include "huicanvasrenderbuffer.h" #include "alfeffectutils.h" #include "alfrenderstageutils.h" // for KAlfPSUidSynchronizer & KAlfPSKeySynchronizer +#include "alfdrawerinternal.h" #ifdef HUI_DEBUG_TRACK_DRAWING #include @@ -89,6 +90,8 @@ //const TReal32 KAlfVisualDefaultOpacity = 0.5f; const TInt KEffectCleanupDelayInMs = 10; +const TInt KPreventingCollisionOfIdsInSynchDrawRequests = 35; + _LIT8(KAlfWindowGroupContainerControlTag, "WGROUP"); #define USE_APPLICATION_ENDFULLSCREEN_TIMEOUT @@ -98,7 +101,15 @@ const TInt KFadeAction = 6000; -// ======== MEMBER FUNCTIONS ======== +NONSHARABLE_CLASS( TAlfBridgeDrawerWrapper ) : public MAlfDrawerScreenInterface + { +public: + TAlfBridgeDrawerWrapper(CAlfBridge& aBridge); + TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation); + TInt ReadPixels(CFbsBitmap* aBitmap); +private: + CAlfBridge& iBridge; + }; // ======== MEMBER FUNCTIONS ======== @@ -171,6 +182,9 @@ void CAlfBridge::ConstructL(CHuiEnv* aEnv) { iHuiEnv = aEnv; + + iIdForEAlfDSSynchronizeOp = 0; + iIdForLayoutSwitchFrameSync = iIdForEAlfDSSynchronizeOp - KPreventingCollisionOfIdsInSynchDrawRequests; #ifdef SYMBIAN_BUILD_GCE iPrintFPS = EFalse; @@ -338,6 +352,8 @@ iPreviouslySearchedVisual = aVisual; AMT_INC_COUNTER( iTotalVisualCount ); + + AMT_MAP_BRIDGE_ADD_VISUAL(); } // --------------------------------------------------------------------------- @@ -350,7 +366,10 @@ iWindowHashArray.Remove( aWindowNodeId ); iPreviouslySearchedVisualId = 0; - AMT_DEC_COUNTER( iTotalVisualCount ); + AMT_DEC_COUNTER( iTotalVisualCount ); + + AMT_MAP_INC_VALUE( iIntMap, aWindowNodeId, EAlfModuleTestTypeBridgeReleaseWindow ); + AMT_MAP_SET_VALUE( iBoolMap, aWindowNodeId, ETrue, EAlfModuleTestTypeBridgeReleaseWindow ); } // --------------------------------------------------------------------------- @@ -431,6 +450,22 @@ } // --------------------------------------------------------------------------- +// FindWindowGroupNodeId +// --------------------------------------------------------------------------- +// +TInt CAlfBridge::FindWindowGroupNodeId( TInt aScreenNumber, CHuiControlGroup& aControlGroup ) const + { + for (TInt i=0; iiControlGroups.Count();i++) + { + if( iAlfScreens[aScreenNumber]->iControlGroups[i].iControlGroup == &aControlGroup ) + { + return iAlfScreens[aScreenNumber]->iControlGroups[i].iWindowGroupNodeId; + } + } + return KErrNotFound; + } + +// --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // CHuiControlGroup* CAlfBridge::FindControlGroupByWindowGroupId( TInt aWindowGroupId, TInt& aScreenNumber, TAlfControlGroupEntry** aAlfGroup ) @@ -577,7 +612,7 @@ { iFullScreenEffectData->iFromSecureId = iAlfScreens[0]->iControlGroups[j].iSecureId; iFullScreenEffectData->iFromWg = iAlfScreens[0]->iControlGroups[j].iClientWindowGroupId; - __ALFFXLOGSTRING2("CAlfBridge::ResolveAfterEffectAppearingApplicationL - Found underneath application uid: 0x%x, window group: %d - Start track drawing for exit effect.", iFullScreenEffectData->iFromAppId, iFullScreenEffectData->iFromWg ); + __ALFFXLOGSTRING2("CAlfBridge::ResolveAfterEffectAppearingApplicationL - Found underneath application uid: 0x%x, window group: %d - Start track drawing for exit effect.", iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg ); break; } } @@ -680,7 +715,10 @@ break; } - } + } + + AMT_MAP_INC_VALUE( iIntMap, aWindowGroupNodeId, + EAlfModuleTestTypeBridgeReleaseWindowGroup ); } @@ -697,6 +735,7 @@ if (!group) { group = &iHuiEnv->NewControlGroupL(aWindowGroupNodeId); + group->SetSecureId(aSecureId); CleanupStack::PushL(group); CHuiControl* cntrl = new (ELeave) CHuiControl(*iHuiEnv); CleanupStack::PushL(cntrl); @@ -758,7 +797,8 @@ AMT_INC_COUNTER( iTotalControlGroupCount ); } - + + AMT_MAP_BRIDGE_CREATE_CONTROL_GROUP(); return *group; } @@ -1297,10 +1337,9 @@ TBool fullscreenCovered = EFalse; CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; - //iActiveVisualCount = 0; iBgSurfaceFound = EFalse; - //iPaintedArea = 0; - + iHomeScreenWallpaperWindowFound = EFalse; + // Check if effect group has an effect with opaque hint. CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup); CHuiControl& fxcontrol = fxcontrolgroup.Control(0); @@ -1488,24 +1527,50 @@ #endif } - if (iActivated) - { - if (iBgSurfaceFound) - { - if (!iInLowMemMode) + + if (iActivated && !iLayoutSwitchInProgress) + { + if (iBgSurfaceFound || iHomeScreenWallpaperWindowFound) + { + // only bg surface should trigger lowmem + if (!iInLowMemMode && iBgSurfaceFound) { SetLowMemory(ETrue); + iInLowMemMode = ETrue; + } + else if (!iBgSurfaceFound && iInLowMemMode) + { + SetLowMemory(EFalse); + iInLowMemMode = EFalse; + } + + // if the background animation is not hidden yet, hide it now + if (!iBgAnimHidden) + { // Notify Bg anim iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetHidden)); - iInLowMemMode = ETrue; + iBgAnimHidden = ETrue; } } - else if (iInLowMemMode) - { - SetLowMemory(EFalse); - // Notify Bg anim - iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetVisible)); - iInLowMemMode = EFalse; + else if (iInLowMemMode || iBgAnimHidden) + { + // if we did not found bg surface, but are in low memory mode + // exit it now... + if (!iBgSurfaceFound && iInLowMemMode) + { + SetLowMemory(EFalse); + iInLowMemMode = EFalse; + } + + // if the bg animation is hidden and we did not found a background surface + // or the homescreen window containing wallpaper, show the background animation + // again + if (iBgAnimHidden && !iBgSurfaceFound && !iHomeScreenWallpaperWindowFound) + { + // Notify Bg anim + iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetVisible)); + iBgAnimHidden = EFalse; + } } } @@ -1519,7 +1584,7 @@ // would clear the screen areas where they do not really draw. if (fadeEffectInScreen) { - TBool alwaysblend = EFalse; + TBool firstFadedWindowGroupFound = EFalse; for (TInt j=0; jiDisplay->Roster().Count() - screen->FixedControlGroupCount(); j++) // skip the topmost (effect) layer { CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j); @@ -1527,7 +1592,7 @@ CHuiVisual* layout = &control.Visual(0); if (layout->Effect() && (layout->Effect()->EffectFlags() & KHuiFadeEffectFlag)) { - if (alwaysblend) + if (firstFadedWindowGroupFound) { TInt flags = layout->Effect()->EffectFlags(); flags |= KHuiFxAlwaysBlend; // Workaround for opaque layout canvasvisual. @@ -1540,9 +1605,9 @@ TInt flags = layout->Effect()->EffectFlags(); flags |= KHuiFxEnableBackgroundInAllLayers; // This forces effect to happen to background pixels that are read from surface. flags |= KHuiFxFrozenBackground; // To get optimal UI performance, we ignore changes in ALF scene when it is faded. - alwaysblend = ETrue; layout->Effect()->SetEffectFlags(flags); } + firstFadedWindowGroupFound = ETrue; } } } @@ -1619,6 +1684,7 @@ visualDisplayRect = canvasVisual->DisplayRect(); // Make sure we clip visual rect to visible screen area + ClipVisualRect(visualDisplayRect, aLayout->DisplayRect()); ClipVisualRect(visualDisplayRect, aFullscreen); // Check if this visual is covered by other opaque visuals which rects are in "covered" region @@ -1694,18 +1760,44 @@ canvasVisual->PrepareCache(); canvasVisual->SetCapturingBufferL(aScreen->iSwRenderingTarget); + // We found an _ACTIVE_ window in homescreens controlgroup + if (aControlGroup.SecureId() == 0x102750F0) + { + // which is fully opaque, and visible ... + if ( (canvasVisual->iOpacity.Now() > 0.001) && canvasVisual->Flags() & EHuiVisualFlagOpaqueHint) + { + // ... and it's a fullscreen one, and does not have a transparent clear in it + if (canvasVisual->DisplayRect().Round() == Display(0)->VisibleArea() && + !canvasVisual->HasTransParentClear()) + { + // we can "safely" asseme that the window is the + // one used to draw the user defined wallpaper + // ----> stop background animation as it's not visible + iHomeScreenWallpaperWindowFound = ETrue; + } + } + } + // we've found non-inactive window which has background surface // attached.. if (canvasVisual->IsBackgroundDrawingEnabled() && canvasVisual->LayerExtent() != TRect() && !canvasVisual->LayerUsesAlphaFlag() ) { - // if paintedareacount is exactly one, it means that the window + // if paintedareacount is exactly one or two, it means that the window // has background surface but no drawing commands - if (canvasVisual->PaintedAreaCount() == 1) + TInt areaCount = canvasVisual->PaintedAreaCount(); + if (areaCount == 1 || areaCount == 2) { - THuiCanvasPaintedArea pa = canvasVisual->PaintedArea(0); - TRect r = pa.iPaintedRect.Round(); + TBool onlyFullScreenAreas = ETrue; + for (TInt count = 0; count < areaCount; count++) + { + TRect area = canvasVisual->PaintedArea(count).iPaintedRect.Round(); + if (area != Display(0)->VisibleArea()) + { + onlyFullScreenAreas = EFalse; + } + } // if we found a fullscreen surface with no other drawing commands // we can safely assume that it's about the only thing to be visible // and we can release memory occupied by other parts of the system @@ -1716,7 +1808,7 @@ // memory state. We want to do it like this as otherwise // we would be triggering for example background animation // on / off quite rapidly........ - if ( r == Display(0)->VisibleArea()) + if ( onlyFullScreenAreas ) { // Final test. Surface must not be ALF surface, but some other surface. CHuiControlGroup* alfControlGroup = FindControlGroupBySecureId( iAlfSecureId ); @@ -1767,6 +1859,7 @@ if ( !canvasVisual->HasCustomShape() ) { TRect displayRect(canvasVisual->DisplayRect()); + ClipVisualRect(displayRect, aLayout->DisplayRect()); ClipVisualRect(displayRect, aFullscreen); #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER @@ -1831,7 +1924,20 @@ visualTreeActive |= visualIsActive; // iVisibleVisualCount is cleared in HandleVisualVisibility() - AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); + AMT_INC_COUNTER_IF( visualIsActive && visualIsOpaque && !visualRectIsCovered, iVisibleVisualCount ); + + AMT_MAP_SET_VALUE_IF( + visualIsActive && visualIsOpaque && !visualRectIsCovered && (canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation), + iBoolMap, + AMT_MAP_CPTR_TO_KEY_CAST( canvasVisual ), + ETrue, + EAlfModuleTestTypeBridgeVisualVisibility); + AMT_MAP_SET_VALUE_IF( + !visualIsActive || !visualIsOpaque || visualRectIsCovered || !(canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation), + iBoolMap, + AMT_MAP_CPTR_TO_KEY_CAST( canvasVisual ), + EFalse, + EAlfModuleTestTypeBridgeVisualVisibility); } // for loop end : children checking loop return visualTreeActive; @@ -2006,10 +2112,10 @@ { case EAlfDSSynchronize: { - TInt id = data.iInt1; + iIdForEAlfDSSynchronizeOp = data.iInt1; if ( iHuiEnv ) { - iHuiEnv->Synchronize( id, this ); + iHuiEnv->Synchronize( iIdForEAlfDSSynchronizeOp, this ); } } break; @@ -2124,30 +2230,8 @@ } case EAlfDSMoveWindowToNewGroup: { - /* - RDebug::Print(_L("CAlfBridge::DoDispatchL, EAlfDSMoveWindowToNewGroup, THIS METHOD IS UNTESTED. EXPECT TROUBLE!")); - // TODO: TEST! - TInt windowGroupNodeId = data.iInt1; - TInt windowNodeId = data.iInt2; - TInt newGroupId = (TInt)data.iPtr; - CHuiLayout* layout = NULL; - CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId, windowGroupNodeId,screenNumber); - if (viz) - { - // #1 remove visual from old group - layout = viz->Layout(); - layout->Remove(viz); - viz->Owner().Remove(viz); - // #2 insert visual to the beginning of the new group - CHuiControlGroup* controlGroup = FindControlGroup(newGroupId,screenNumber); - if (controlGroup) - { - CHuiControl& control = controlGroup->Control(0); - CHuiLayout* layout = (CHuiLayout*)&control.Visual(0); - layout->AppendL( viz ); - } - }*/ - break; + HandleMoveWindowToNewGroupL( data ); + break; } case EAlfEffectFx: { @@ -2244,7 +2328,7 @@ CHuiGc::TOrientation huiOrientation(CHuiGc::EOrientationNormal); switch(data.iInt1) { - case 1: // 90 + case 1: // 90 huiOrientation = CHuiGc::EOrientationCCW90; break; case 2: // 180 @@ -2524,6 +2608,7 @@ { case EAlfWinTreeNodeGroup: { + HandleVisualVisibility(0); DeleteControlGroupL(windowGroupNodeId, screenNumber); break; } @@ -2617,9 +2702,9 @@ AMT_INC_COUNTER_IF( viz, iVisualPositionChangedCount ); AMT_SET_VALUE_IF( viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); - AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ), - iPositionMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, - windowAttributes->iPosition, EAlfModuleTestTypeBridgeChangePosition ); + AMT_MAP_SET_VALUE_IF( viz, iPositionMap, windowNodeId, + windowAttributes->iPosition, + EAlfModuleTestTypeBridgeChangeWindowPosition ); } // --------------------------------------------------------------------------- @@ -2651,9 +2736,10 @@ AMT_INC_COUNTER_IF(viz, iVisualSizeChangedCount ); AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); - AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ), - iSizeMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, - windowAttributes->iSize, EAlfModuleTestTypeBridgeChangeSize ); + + AMT_MAP_SET_VALUE_IF( viz, iSizeMap, windowNodeId, + windowAttributes->iSize, + EAlfModuleTestTypeBridgeChangeWindowSize ); } // --------------------------------------------------------------------------- @@ -3065,7 +3151,6 @@ && iFullScreenEffectData->iEffectType != CFullScreenEffectState::ENotDefinedEffect && !iFullScreenEffectData->iEndFullScreen) { - CHuiControlGroup *to_group = NULL; if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect) { @@ -3081,22 +3166,10 @@ // 2. only the first drawing commands will trigger EndFullScreen // (this mechanism is here because we want to remove delay from fullscreen effects - and EndFullScreens are coming from application too late) - if (viz->Owner().ControlGroup() == to_group) + if (viz && viz->Owner().ControlGroup() == to_group) { - if (!iFullScreenEffectData->iDrawingCompleteTimer) - { - iFullScreenEffectData->InitDelayedEffectL(this, iAlfScreens[0]->Size()); - } - THuiCanvasPaintedArea p = viz->PaintedArea(0); - iFullScreenEffectData->iPaintedRegion.AddRect( p.iPaintedRect.Round() ); - TRect b = iFullScreenEffectData->iPaintedRegion.BoundingRect(); - __ALFFXLOGSTRING3( - "CAlfBridge::HandlePostCanvasBufferL : Effect to visual 0x%x, Covered rect: iTl.iX: %d , iTl.iY: %d", - viz, - b.iTl.iX, - b.iTl.iY); - __ALFFXLOGSTRING2("CAlfBridge::HandlePostCanvasBufferL : iBr.iX: %d, iBr.iY: %d", b.iBr.iX, b.iBr.iY); - } + GfxTriggerEffectWhenFullScreenDrawn(to_group); + } } #endif } @@ -3105,7 +3178,7 @@ // HandleGfxEndFullScreenTimeout // --------------------------------------------------------------------------- // -void CAlfBridge::HandleGfxEndFullScreenTimeout(CFullScreenEffectState* aFullScreenEffectData) +void CAlfBridge::GfxTriggerEndFullScreen(CFullScreenEffectState* aFullScreenEffectData) { if (aFullScreenEffectData->iEndFullScreen) { @@ -3165,6 +3238,7 @@ } else { + __ALFFXLOGSTRING2("CAlfBridge::SetWindowActiveL 0x%x has active effect. New state: %d", aVisual, aActive); // Has effect // these flags are put to action in RemoveTemporaryPresenterItem if (aActive) @@ -3279,9 +3353,11 @@ AMT_INC_COUNTER( iTotalVisualFlagChangedCount ); AMT_INC_COUNTER_IF( windowAttributes->iActive, iActiveVisualCount ); AMT_INC_COUNTER_IF( !windowAttributes->iActive, iPassiveVisualCount ); - AMT_MAP_INC_VALUE_IF( ( iWindowHashArray.Find( windowNodeId ) ), - iIntMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, - EAlfModuleTestTypeBridgeChangeFlag ); + + AMT_MAP_SET_VALUE( iBoolMap, windowNodeId, windowAttributes->iActive, + EAlfModuleTestTypeBridgeChangeWindowVisibility ); + AMT_MAP_SET_VALUE( iBoolMap, windowNodeId, windowAttributes->iActive, + EAlfModuleTestTypeBridgeActiveWindow ); } @@ -3940,6 +4016,85 @@ // --------------------------------------------------------------------------- +// HandleMoveWindowToNewGroupL +// --------------------------------------------------------------------------- +// +void CAlfBridge::HandleMoveWindowToNewGroupL( TAlfBridgerData& aData ) + { + TInt windowNodeId = aData.iInt1; + TInt screenNumber = aData.iInt2; + TInt newWindowGroupNodeId = (TInt)aData.iPtr; + + CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId); + +#ifdef _ALF_LOGGING + CHuiControlGroup* oldControlGroup = viz->Owner().ControlGroup(); + TInt oldWindowGroupId = 0; + if ( oldControlGroup ) + { + oldWindowGroupId = FindWindowGroupNodeId(screenNumber, *oldControlGroup ); + } + __ALFLOGSTRING3("CAlfBridge::HandleMoveWindowToNewGroupL moving nodeId 0x%x from group 0x%x to 0x%x ",windowNodeId, oldWindowGroupId, newWindowGroupNodeId ); +#endif + + if (viz) + { + CHuiLayout* oldLayout = viz->Layout(); + TBool isRootOfTheMovingTree = EFalse; // if true, we need to update the parent layout + + if ( viz->Owner().ControlGroup() && + (&viz->Owner().ControlGroup()->Control(0).Visual(0) == oldLayout) ) + { + // Symbian OS documentation: "This function allows a window with a window group as its + // immediate parent to be moved from one window group to another one." + // + // This implementation is assuming that only a window which is an immediate child of a window group + // can be moved to new group. Moving an immediate child (=root of the moving tree) + // causes the child windows to move as well. + isRootOfTheMovingTree = ETrue; + } + + // #1 remove visual from old group + if ( isRootOfTheMovingTree && oldLayout ) + { + // remove also from the old parent layout - new layout is coming from the new group + oldLayout->Remove(viz); + } + // else: keep the parent layout - assume that is moving as well. + + // remove from the old control + viz->Owner().Remove(viz); + + // #2 insert visual to the beginning of the new group + CHuiControlGroup* newControlGroup = FindControlGroup(newWindowGroupNodeId,screenNumber); + if (newControlGroup) + { + CHuiControl& newControl = newControlGroup->Control(0); + if ( isRootOfTheMovingTree ) + { + // update the parent layout to be the default layout of the window group + CHuiLayout* newLayout = (CHuiLayout*)&newControl.Visual(0); + newControl.AppendL( viz, newLayout ); + } + else + { + // just update the owner. Assume that the parent RWindowTreeNode/CAlfNode/CHuiLayout is moving as well. + newControl.AppendL( viz ); + } + } + else + { + __ALFLOGSTRING("CAlfBridge::HandleMoveWindowToNewGroupL cannot find new group! orphaning the visual"); + iOrphanStorage->AppendL( viz ); + } + } + else + { + __ALFLOGSTRING("CAlfBridge::HandleMoveWindowToNewGroupL cannot find moving visual!"); + } + } + +// --------------------------------------------------------------------------- // HandleSetFadeEffect // --------------------------------------------------------------------------- // @@ -4047,7 +4202,9 @@ __ALFLOGSTRING1("CAlfBridge::HandleSetCursorDataL - WARNING! Cursor node 0x%x not found!", windowNodeId); } - AMT_INC_COUNTER_IF(viz, iTotalVisualAttributeChangedCount); + AMT_INC_COUNTER_IF(viz, iTotalVisualAttributeChangedCount); + + AMT_MAP_BRIDGE_TEXT_CURSOR_CHANGE(); } // --------------------------------------------------------------------------- @@ -4106,7 +4263,41 @@ { return aEngine->FxmlUsesInput1(aFileName); } - + +// --------------------------------------------------------------------------- +// StoreLayoutIfRequiredByEffectL +// +// Certains effects require screenshot to be taken when BeginFullScreen event +// is triggered. This method will take a screenshot (of the whole screen), if +// there is enough memory available. +// --------------------------------------------------------------------------- +// +TBool CAlfBridge::StoreLayoutIfRequiredByEffectL(CHuiLayout* aLayout, CFullScreenEffectState& aEvent, TBool& aNeededStoredLayout) + { + aNeededStoredLayout = NeedsStoredBuffers(iHuiEnv->EffectsEngine(), *aEvent.iEffectName); + __ALFFXLOGSTRING2("CAlfBridge::StoreLayoutIfRequiredByEffectL - aHandle: %d, Take screenhot: %d", aEvent.iHandle, aNeededStoredLayout); + if (aNeededStoredLayout) + { + TRAPD(err,StoreRenderBufferStartL(aLayout)); + __ALFFXLOGSTRING1("CAlfBridge::StoreLayoutIfRequiredByEffectL - Screenshot result: KErrNone == %d", err); + if (err == KErrNone) + { + aLayout->SetFreezeState(ETrue); + aEvent.iCanDestroyOrHideImmediately = ETrue; // if children of this layout are hidden or destroyed during effect, that can happen immediately + return ETrue; // storing of content requesteds, could store the content => success + } + else + { + return EFalse; // could not store the content => failed + } + } + else + { + __ALFFXLOGSTRING("CAlfBridge::StoreLayoutIfRequiredByEffectL - Storing not required"); + return ETrue; // no storing requred, no screenshot required => success + } + } + TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout) { __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction); @@ -4131,22 +4322,26 @@ case MAlfGfxEffectPlugin::EBeginFullscreen: { aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); - TBool needStoredBuffers = NeedsStoredBuffers(engine, *aEvent.iEffectName); - __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - EBeginFullScreen: %d, Take screenhot: %d", aEvent.iHandle, needStoredBuffers); - if (needStoredBuffers) + TBool neededStoredBuffers; + TBool success = StoreLayoutIfRequiredByEffectL(aToLayout, aEvent, neededStoredBuffers); + + // if screenshot was requested and it was possible to take one, then add this layout + // to effectcleanup stack + if (neededStoredBuffers) { - TRAP(err,StoreRenderBufferStartL(aToLayout)); - __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullScreen: Screenshot result: KErrNone == %d", err); - if (err == KErrNone) - { - aToLayout->SetFreezeState(ETrue); - aEvent.iCanDestroyOrHideImmediately = ETrue; // if children of this layout are hidden or destroyed during effect, that can happen immediately - } - else - { - return ETrue; // failed, effect will be canceled - } + TInt dummy; + if (!HasActiveEffect(aToLayout, dummy)) + { + __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Add layout 0x%x with handle %d to cleanupstack", aToLayout, aEvent.iHandle); + AddEffectItemL(aEvent.iHandle, aToLayout, NULL, NULL, EFalse, dummy, EFalse); + } } + // Screenshot was requested, but it could not be taken. Lets cancel the effect. + if (!success) + { + return ETrue; // this will cause effect cleanup + } + switch(aEvent.iAction) { @@ -4159,6 +4354,7 @@ aToLayout->iOpacity.Set(0.0f); // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); aEvent.iEffectType = CFullScreenEffectState::EStartEffect; + aEvent.iCanDestroyOrHideImmediately = ETrue; // enable hiding of windows during application start/activate effects break; } case AknTransEffect::EApplicationExit: @@ -4179,8 +4375,18 @@ __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Found effect on layout 0x%x. Removing effect 0x%x", aToLayout, aToLayout->Effect()); aToLayout->SetEffect(NULL); } - if ( aEvent.iAction == AknTransEffect::EApplicationExit && !(aToLayout->Flags() & EHuiVisualFlagInactive)) + __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Layout 0x%x is active: %d", aToLayout, !TBool(aToLayout->Flags() & EHuiVisualFlagInactive) ); + if (!(aToLayout->Flags() & EHuiVisualFlagInactive)) { + TInt index; + if (aToLayout->StoredRenderBuffer() && HasActiveEffect(aToLayout, index) && index != KErrNotFound) + { + // a screenshot has been saved into the layout, and the layout was added to cleanupstack + // for cleaning. SetupEffectLayoutContainerL will add the same layout + // to the cleanupstack, but double cleaning is not a good idea. Thus it is removed here. + __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Removing the layout 0x%x with screenshot from iEffectCleanupStack", aToLayout); + iEffectCleanupStack.Remove(index); + } // this will tag the visual, that they cannot be hidden by HandleVisualVisibility // Initialize layout for the exit effect iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue, aEvent.iCanDestroyOrHideImmediately); @@ -4191,6 +4397,7 @@ { iLayoutInitializedForExitEffect = EFalse; aEvent.iSetupDone = EFalse; + failed = ETrue; } return failed; } @@ -4217,20 +4424,36 @@ { // Exit effect was initialized earlier with EBeginFullscreen event layoutEffectable = aEvent.iSetupDone; - __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EEndFullScreen: %d", layoutEffectable); + __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EEndFullScreen: iSetupDone: %d", layoutEffectable); } else { // add visuals to visual cleanupstack aToLayout->SetStoredRenderBufferModificationsEnabled(EFalse); + TInt index; + if (aToLayout->StoredRenderBuffer() && HasActiveEffect(aToLayout, index) && index != KErrNotFound) + { + // a screenshot has been saved into the layout, and the layout was added to cleanupstack + // for cleaning. SetupEffectLayoutContainerL will add the same layout + // to the cleanupstack, but double cleaning is not a good idea. Thus it is removed here. + __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Removing the layout 0x%x with screenshot from iEffectCleanupStack", aToLayout); + iEffectCleanupStack.Remove(index); + } layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse, aEvent.iCanDestroyOrHideImmediately); aEvent.iSetupDone = layoutEffectable; aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); } if (layoutEffectable) - { - TInt effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; + { + TInt effectFlags = 0; + TInt activeEffectGroup = engine->ActiveGroupEffect(); + if (activeEffectGroup != KErrNotFound) + { + engine->AddEffectToGroup(activeEffectGroup); + } + __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Active effect group: %d", activeEffectGroup); + effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; if (NeedsStoredBuffers(iHuiEnv->EffectsEngine(), *aEvent.iEffectName)) { // Performance improvement, but this would be better to be a special hint param in the fxml @@ -4239,11 +4462,11 @@ if (aEvent.iRect != TRect()) { - TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), &aEvent.iRect, this, aEvent.iHandle, effectFlags )); + TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), activeEffectGroup, &aEvent.iRect, this, aEvent.iHandle, effectFlags )); } else { - TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, effectFlags ) ); + TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), activeEffectGroup, NULL, this, aEvent.iHandle, effectFlags ) ); } effect = NULL; // only use the effect if the effect file was correctly parsed @@ -4298,6 +4521,9 @@ if (!iFullScreenEffectData) { __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END: none"); + RemoveAllTemporaryPresenterVisuals(); + delete iControlEffectData; + iControlEffectData = NULL; return; } @@ -4305,7 +4531,7 @@ iFullScreenEffectData = NULL; CleanupStack::PushL( fxData ); - __ALFFXLOGSTRING2(" - handle: %d, toAppUid: 0x%x", fxData->iHandle, fxData->iToAppId); + __ALFFXLOGSTRING2("CAlfBridge::HandleGfxStopEvent - handle: %d, toAppUid: 0x%x", fxData->iHandle, fxData->iToAppId); // clean effects with this handle RemoveTemporaryPresenterVisual(NULL, fxData->iHandle); @@ -4316,11 +4542,11 @@ RemoveEffectFromApp(fxData->iToSecureId, fxData->iToWg ); RemoveEffectFromApp(fxData->iFromSecureId, fxData->iFromWg ); } - else - { - // abort ALL effects - RemoveAllTemporaryPresenterVisuals(); - } + // abort ALL other possible control effects + RemoveAllTemporaryPresenterVisuals(); + + delete iControlEffectData; + iControlEffectData = NULL; iHuiEnv->ContinueRefresh(); @@ -4389,6 +4615,14 @@ // operation tells if this is begin full screen or end full screen TInt operation = stream.ReadInt32L(); + // If we are in low memory state, we don't want to do any effects + if(iHuiEnv->MemoryLevel() < EHuiMemoryLevelReduced) + { + __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - Returning because memory level below NORMAL"); + stream.Release(); + return; + } + if ( operation == MAlfGfxEffectPlugin::EBeginFullscreen ) { if ( !iFullScreenEffectData || !iFullScreenEffectData->iSetupDone ) @@ -4477,43 +4711,11 @@ __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEffectsL - Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType); __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - towg: %d, fromwg: %d", fxData->iToWg, fxData->iFromWg); - // find root nodes and attach effects to them - // First we need a windowgroup node id. So far we have a list of window ids - - // wg2 is the window group that is supposed to disappear from view - // when a new application starts. We don't have any use for it now... - - // This is the group that is disappearing - // Currently we don't add an effect to it. - - // TODO: when ids available from wserv... - // if ( appUid2 ) - //{ - // group2 = FindControlGrouAppUId( appUid2, screen2, &alfGroup ); - // } - //if ( toAppId2 ) - // { - // group2 = FindControlGroupByAppId(toAppId2); - // } - //if ( wg2 && wg2 != KErrNotFound ) - // { - // group2 = FindControlGroupByWindowGroupId( wg2, screen2 ); - // } - // if ( group2 ) - // { - // CHuiControl& control = group2->Control(0); - // layout2 = (CHuiLayout*)&control.Visual(0); - // } - - // This effect is triggered either by BeginFullScreen or by EndFullScreen - // depending on if we have an application that is already running or not - - // TAlfControlGroupEntry* alfGroup = NULL; - + CHuiControlGroup* toGroup = NULL; + TBool failed = EFalse; if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) { - CHuiControlGroup* toGroup = NULL; CHuiLayout* toLayout = NULL; toGroup = FindControlGroupByFullScreenToEffect(); @@ -4552,6 +4754,18 @@ // Effect failed, reset state HandleGfxStopEvent( EFalse ); // destroys iFullScreenEffectData } + else + { + // it might be that the application is already having drawing for the whole screen. + // If so, then trigger EndFullScreen immediately. + if (fxData && + toGroup + && fxData->iOperation == MAlfGfxEffectPlugin::EBeginFullscreen + && fxData->iEffectType == CFullScreenEffectState::EStartEffect) + { + GfxTriggerEffectWhenFullScreenDrawn(toGroup); + } + } for (TInt i = 0; i < iAlfScreens.Count(); i++) { @@ -4563,6 +4777,37 @@ __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END"); } +TBool CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn(CHuiControlGroup* aToGroup) + { + if (!aToGroup || (aToGroup && aToGroup->Count() == 0)) + { + return EFalse; + } + iTempRegion.Clear(); + + CAlfScreen* screen = iAlfScreens[0]; + TRect fullscreen = TRect(TPoint(0,0), screen->Size()); + TBool fullscreenCovered(EFalse); + TInt dummy = 0; + + CHuiControl& control = aToGroup->Control(0); + CHuiLayout* toLayout = control.VisualCount() > 0 ? (CHuiLayout*)&control.Visual(0) : NULL; + if (!toLayout) + { + return EFalse; + } + TBool opaque = ETrue; // in app start case the layout is propably not opaque. Fake it. + IsFullScreenDrawnRecursive(toLayout, *aToGroup, control, fullscreenCovered, fullscreen, screen, dummy, opaque, iAlfScreens[0]->iDisplay->Orientation()); + fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); + __ALFFXLOGSTRING1("CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn - Covered: %d", fullscreenCovered); + if (fullscreenCovered) + { + GfxTriggerEndFullScreen(iFullScreenEffectData); + return ETrue; + } + return EFalse; + } + // TODO: add effect type to effect struct. remove all fullscreen effects. currently some might hang around void CAlfBridge::HandleGfxStopEffectsL(TAlfBridgerData data) { @@ -4610,6 +4855,9 @@ TInt handle = stream.ReadInt32L(); stream.Release(); + delete iControlEffectData; + iControlEffectData = NULL; + if (handle != KErrNotFound) { __ALFFXLOGSTRING1("CAlfBridge::HandleGfxStopControlEffectsL - Remove effect with handle: %d", handle); @@ -4829,6 +5077,15 @@ delete iControlEffectData; iControlEffectData = NULL; } + + // If we are in low memory state, we don't want to do any effects + if(iHuiEnv->MemoryLevel() < EHuiMemoryLevelReduced) + { + __ALFFXLOGSTRING("CAlfBridge::HandleGfxControlEffectsL - Returning because memory level below NORMAL"); + stream.Release(); + return; + } + CControlEffectState* fxData = new (ELeave) CControlEffectState; CleanupStack::PushL(fxData); fxData->ConstructL(action, stream); @@ -4874,13 +5131,13 @@ CHuiFxEngine* engine = NULL; // engine is not owned by us, it is a member of HuiEnv engine = iHuiEnv->EffectsEngine(); - if (NeedsStoredBuffers(engine, *aEvent.iEffectName)) - { - RecursiveStoreRenderBufferL(aCanvasVisual); - } - if (engine) { + if (NeedsStoredBuffers(engine, *aEvent.iEffectName)) + { + RecursiveStoreRenderBufferL(aCanvasVisual); + } + // clear out old effect if this visual has one __ALFFXLOGSTRING2("HandleGfxControlEffectsL - loading effect %S on visual 0x%x", aEvent.iEffectName, aCanvasVisual ); __ALFFXLOGSTRING1("HandleGfxControlEffectsL - loading control effect, handle %d", aEvent.iHandle ); @@ -4891,7 +5148,6 @@ RemoveTemporaryPresenterVisual(aCanvasVisual); } TBool layoutEffectable(EFalse); - aCanvasVisual->iOpacity.Set(KAlfVisualDefaultOpacity); if (aEvent.iAction == KGfxControlDisappearAction) { // TODO: revise // The control stays visible because the inactive flag is not set @@ -4912,7 +5168,16 @@ } if (layoutEffectable) { - TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn ) ); + TInt effectFlags = 0; + + // effect will start delayed anyway when it is syncronized. this flag would break syncronization between effects. + effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; + TInt activeEffectGroup = engine->ActiveGroupEffect(); + if (activeEffectGroup != KErrNotFound) + { + engine->AddEffectToGroup(activeEffectGroup); + } + TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), activeEffectGroup, NULL, this, aEvent.iHandle, effectFlags ) ); } else { @@ -5653,6 +5918,11 @@ // For tests //TUint32* data = aScreen->iSwRenderingTarget->DataAddress(); } + + if (modified && aScreen->iSwRenderingTarget) + { + InitializeSwRenderingTarget(aScreen->iSwRenderingTarget); + } } else { @@ -5667,6 +5937,18 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // +void CAlfBridge::InitializeSwRenderingTarget(CFbsBitmap* aBitmap) + { + __ALFLOGSTRING("CAlfBridge::InitializeSwRenderingTarget"); + TAlfBridgeDrawerWrapper wrapper(*this); + AlfDrawerInternal::CopyScreenToBitmap(&wrapper, aBitmap, + TRect(aBitmap->SizeInPixels())); + __ALFLOGSTRING("CAlfBridge::InitializeSwRenderingTarget ok"); + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// void CAlfBridge::SetMemoryLevel(THuiMemoryLevel aMemoryLevel) { iCurrentMemoryLevel = aMemoryLevel; @@ -5733,9 +6015,9 @@ } } - if ( memoryLevel <= EHuiMemoryLevelLowest) - { - LowMemoryCancelAllEffects(); + if ( memoryLevel < EHuiMemoryLevelReduced) + { + OnLowMemoryModifyAllEffects(); } iHuiEnv->NotifyMemoryLevel(memoryLevel); @@ -5753,12 +6035,13 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // -void CAlfBridge::LowMemoryCancelAllEffects() +void CAlfBridge::OnLowMemoryModifyAllEffects() { - __ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects"); - iLayoutSwitchEffectCoordinator->Cancel(); + __ALFLOGSTRING("CAlfBridge::OnLowMemoryModifyAllEffects"); + iLayoutSwitchEffectCoordinator->LowMemoryEvent(); HandleGfxStopEvent( EFalse ); - __ALFLOGSTRING("CAlfBridge::LowMemoryCancelAllEffects done"); + + __ALFLOGSTRING("CAlfBridge::OnLowMemoryModifyAllEffects done"); } // --------------------------------------------------------------------------- @@ -5814,8 +6097,19 @@ // void CAlfBridge::Synchronized(TInt aId) { - // Use P&S for now. - RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, aId ); + if(aId == iIdForLayoutSwitchFrameSync) + { + // send notification to alfstreamer server about + if (iActivated) + { + iBridgerClient.SendBlind(KAlfCompositionLayoutSwitchComplete, TIpcArgs()); + } + } + else + { + // Use P&S for now. + RProperty::Set( KAlfPSUidSynchronizer, KAlfPSKeySynchronizer, aId ); + } } void CAlfBridge::SetWindowGroupAsAlfApp(TInt aId) @@ -5857,15 +6151,10 @@ CAlfScreen* screen = iAlfScreens[0]; TRect fullscreen = TRect(TPoint(0,0), screen->Size()); - TBool fadeEffectInScreen = EFalse; - + __ALFFXLOGSTRING3("CAlfBridge::IsFullScreenDrawn - new orientation %d, screen size: (%d,%d)", aOrientation, fullscreen.iBr.iX, fullscreen.iBr.iY ); TBool fullscreenCovered = EFalse; CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; - - //iActiveVisualCount = 0; - iBgSurfaceFound = EFalse; - //iPaintedArea = 0; - + // Check if effect group has an effect with opaque hint. CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[0]->iFullscreenEffectControlGroup); CHuiControl& fxcontrol = fxcontrolgroup.Control(0); @@ -5881,7 +6170,6 @@ fullscreenCovered = ETrue; } - TBool alfWindowGroupFoundVisible = EFalse; AMT_SET_VALUE( iVisibleVisualCount, 0 ); @@ -5891,7 +6179,9 @@ { CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j); CHuiControl& control = controlgroup.Control(0); - + __ALFFXLOGSTRING1("CAlfBridge::IsFullScreenDrawn : Group owner 0x%x", controlgroup.SecureId()); + + if (control.Role() == EAlfFpsIndicatorContainer) { // FPS container doesn't contain canvas visuals @@ -5903,7 +6193,12 @@ // For optimization reasons, check if all visuals below in Z-order are covered if (!fullscreenCovered) { - fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); + fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); + + for(TInt ii=0;ii< iTempRegion.Count(); ii++) + { + __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawn (%d,%d)-(%d,%d)", iTempRegion[ii].iTl.iX, iTempRegion[ii].iTl.iY , iTempRegion[ii].iBr.iX, iTempRegion[ii].iBr.iY ); + } } // Dont mess with alf control group visuals, alf session handling does it for us @@ -5913,7 +6208,7 @@ TInt flags = hostContainer->Flags(); if (!fullscreenCovered) { - // clear inactive flag if client has not made this controlgroup hidden + if(!(flags&EHuiVisualFlagUnderOpaqueHint)) { alfWindowGroupFoundVisible = ETrue; @@ -5956,32 +6251,16 @@ __ALFLOGSTRING1("CAlfBridge::IsFullScreenDraw - fullscreen covered %d", fullscreenCovered) TBool subTreeCovered = EFalse; - TBool hasLayers = EFalse; TBool hasActiveVisualsInVisualTree = - IsFullScreenDrawnRecursive( layout, controlgroup, control, fullscreenCovered, fullscreen, screen,subTreeCovered, hasLayers, IsVisualOpaque(*layout), aOrientation ); - TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); - + IsFullScreenDrawnRecursive( layout, controlgroup, control, fullscreenCovered, fullscreen, screen,subTreeCovered, IsVisualOpaque(*layout), aOrientation ); // If root visuals effect is marked as opaque, then add whole screen area as covered. + /* if (!fullscreenCovered) { fullscreenCovered = IsOpaqueEffect(layout->Effect()); } - // "has layers" has been removed - // If we layout is active setup the fade effects. Also if it is inactive, but has been - // flagged as containing fade effect, then run the setup as well so that effects which - // are no more needed get removed. - - TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive); - if (isLayoutActive && !hasActiveVisualsInVisualTree) - { - // Setting also the root visual (layout) as inactive, if it had none - // active children. This is because otherwise the Inactive checks won't - // work correctly within RosterImpl ScanDirty & ClearChanged phases. - - } - else if(!isLayoutActive && hasActiveVisualsInVisualTree) - { - } + */ + if (fullscreenCovered) { return ETrue; @@ -5998,7 +6277,6 @@ TRect& aFullscreen, CAlfScreen* aScreen, TBool& aSubtreeVisible, - TBool& aHasVisualsWithLayers, TBool aChildCanBeOpaque, TInt aOrientation) { @@ -6028,14 +6306,9 @@ // As another example, parent can have scaling transformation. visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); - if (visualIsOpaque && !canvasVisual->LayerExtent().IsEmpty()) - { - aHasVisualsWithLayers = ETrue; - } - if (canvasVisual->Count()) { - visualTreeActive |= IsFullScreenDrawnRecursive( canvasVisual, aControlGroup, aControl,aFullscreenCovered, aFullscreen, aScreen,visualSubtreeVisible, aHasVisualsWithLayers, visualIsOpaque, aOrientation ); + visualTreeActive |= IsFullScreenDrawnRecursive( canvasVisual, aControlGroup, aControl,aFullscreenCovered, aFullscreen, aScreen,visualSubtreeVisible, visualIsOpaque, aOrientation ); } @@ -6052,21 +6325,22 @@ else { // add the rect only if the window contains drawing for the new orientation + visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation); - + // Make sure we clip visual rect to visible screen area ClipVisualRect(visualDisplayRect, aFullscreen); // Check if this visual is covered by other opaque visuals which rects are in "covered" region - visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); + visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); + } - // Finally check the area that this visual covers and add it to covered region - visualIsActive = !(canvasVisual->Flags() & EHuiVisualFlagInactive); - + + visualIsActive = canvasVisual->iOpacity.Now() > 0.01; // in fact this does not mean that visual should be drawn, but this atleast prevents disabled "on top" windows to be considered as visible. + // Sprites and effects as we consider them always as transparent and also // if controlgroup is transformed somehow - if (aControl.Role() == EAlfFullScreenEffectContainer || aControl.Role() == EAlfWindowFloatingSpriteContainer || aControlGroup.IsTransformed()) @@ -6078,29 +6352,10 @@ { // New visibility system takes only window shape into account. if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) - { - if ( !canvasVisual->HasCustomShape() ) - { - TRect displayRect(canvasVisual->DisplayRect()); - ClipVisualRect(displayRect, aFullscreen); - iTempRegion.AddRect(displayRect); - iTempRegion.Tidy(); - } - else - { - TRect displayRect = canvasVisual->DisplayRect(); - const TRegion& region = canvasVisual->ShapeRegion(); - TPoint delta = -canvasVisual->ShapeOrigin() + displayRect.iTl; - - for (TInt i = 0; i < region.Count(); ++i) - { - TRect coveredRect(region[i]); - coveredRect.Move(delta); - ClipVisualRect(coveredRect, aFullscreen); - iTempRegion.AddRect(coveredRect); - iTempRegion.Tidy(); - } - } + { + iTempRegion.AddRect(visualDisplayRect); + iTempRegion.Tidy(); + __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawnRecursive - Added covered area (%d,%d)-(%d,%d)", visualDisplayRect.iTl.iX, visualDisplayRect.iTl.iY , visualDisplayRect.iBr.iX, visualDisplayRect.iBr.iY ); } } visualTreeActive |= visualIsActive; @@ -6108,8 +6363,90 @@ // iVisibleVisualCount is cleared in HandleVisualVisibility() AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); } // for loop end : children checking loop - return visualTreeActive; } + +void CAlfBridge::LayoutSwitchStart() + { + // mark all the application surfaces hidden + if (!iAlfScreens.Count()) + { + return; + } + iLayoutSwitchInProgress = ETrue; + CAlfScreen* screen = iAlfScreens[0]; + // skip the topmost (effect) layer, start from floating sprite group + for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) + { + CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(j); + CHuiControl& control = controlgroup.Control(0); + + if (control.Role() == EAlfFpsIndicatorContainer || control.Role() == EAlfSessionContainer) + { + // FPS container doesn't contain canvas visuals and alfsession containers cannot have surfaces + continue; + } + + CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0); + MarkAllLayersHiddenRecursive(layout); + } + + } + +void CAlfBridge::MarkAllLayersHiddenRecursive(CHuiLayout* aLayout) + { + CHuiCanvasVisual* canvasVisual = NULL; + + for (TInt i = aLayout->Count()-1; i >= 0; i--) + { + canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i)); + if(canvasVisual) + { + if (canvasVisual->Count()) + { + MarkAllLayersHiddenRecursive(canvasVisual); + } + + if (!canvasVisual->LayerExtent().IsEmpty()) + { + canvasVisual->ClearCanvasFlags(EHuiCanvasFlagSurfaceVisible); + canvasVisual->SetCanvasFlags(EHuiCanvasFlagSurfaceInvisible); + } + } + } + } + +void CAlfBridge::LayoutSwitchComplete() + { + // send notification to alfstreamer server + /*if (iActivated) + { + iBridgerClient.SendBlind(KAlfCompositionLayoutSwitchComplete, TIpcArgs()); + } + */ + // request syncronized frame + iLayoutSwitchInProgress = EFalse; + if ( iHuiEnv ) + { + iIdForLayoutSwitchFrameSync = iIdForEAlfDSSynchronizeOp - KPreventingCollisionOfIdsInSynchDrawRequests; + iHuiEnv->Synchronize( iIdForLayoutSwitchFrameSync, this ); + } + } + +TAlfBridgeDrawerWrapper::TAlfBridgeDrawerWrapper(CAlfBridge& aBridge) + : iBridge( aBridge ) + { + } + +TInt TAlfBridgeDrawerWrapper::GetSizeAndRotation(TSize& aSize, TInt& aRotation) + { + return iBridge.GetSizeAndRotation(aSize, aRotation); + } + +TInt TAlfBridgeDrawerWrapper::ReadPixels(CFbsBitmap* aBitmap) + { + return iBridge.ReadPixels(aBitmap); + } + // end of file diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -54,11 +54,13 @@ Cancel(); } -void CAlfRosterFreezeEndTimer::Start( TTimeIntervalMicroSeconds32 aPeriod ) +void CAlfRosterFreezeEndTimer::Start( TTimeIntervalMicroSeconds32 aPeriod, TCallBack aCallBack ) { + iCallBack = aCallBack; __ALFLOGSTRING("CAlfRosterFreezeEndTimer::Start"); if (!IsActive()) { + iSafeCounter = 0; After( aPeriod ); } } @@ -72,7 +74,7 @@ if (iSafeCounter >= 0) { iSafeCounter++; - if (iSafeCounter == 10) + if (iSafeCounter == 100) // can be lower, 100 should be visible enough to see, if heuristics fail { timeout = ETrue; iSafeCounter = 0; @@ -87,11 +89,7 @@ } else { - __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL - ready in new orientation. "); - iBridge.iHuiEnv->Display(0).SetDirty(); - iBridge.iHuiEnv->iPauseDrawing = EFalse; - TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse)); - iBridge.SetVisualTreeVisibilityChanged(ETrue); + iCallBack.CallBack(); } } @@ -104,7 +102,8 @@ CAlfLayoutSwitchEffectCoordinator::CAlfLayoutSwitchEffectCoordinator( CAlfBridge& aBridge ) : iBridge( aBridge ), - iLayoutSwitchEffectContext(AknTransEffect::ENone) + iLayoutSwitchEffectContext(AknTransEffect::ENone), + iCurrentState( EStateIdle ) { RThread me = RThread(); iOriginalPriority = me.Priority(); @@ -116,183 +115,365 @@ } // --------------------------------------------------------- -// CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack -// -// This method is callback which gets called when layout -// switch effect has ended. +// CAlfLayoutSwitchEffectCoordinator::Blank // --------------------------------------------------------- // -void CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack( TInt aHandle ) +void CAlfLayoutSwitchEffectCoordinator::Blank(TBool aEnabled) { - //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack")); - if (iLayoutSwitchEffectContext == aHandle) - { - AknTransEffect::TContext nextContext = NextLayoutSwitchContext(); - - // Unfreeze visible content. This reveals real roster content (in new orientation). - if (nextContext == AknTransEffect::ELayoutSwitchExit) - { - #ifdef HUI_DEBUG_TRACK_DRAWING - RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack unfreezing roster content")); - #endif - iBridge.iHuiEnv->Display(0).SetDirty(); - TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse)); - iBridge.SetVisualTreeVisibilityChanged(ETrue); - } - - // Set next effect - SetLayoutSwitchEffect(nextContext); - - if (nextContext == AknTransEffect::ENone) - { - // Restore normal priority - RThread me = RThread(); - me.SetPriority(iOriginalPriority); - me.Close(); - - // Just in case refresh everything - iBridge.iHuiEnv->Display(0).SetDirty(); - } - } - else - { - //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack - got different handle (normal, dont worry...) - %i"), aHandle); - } + __ALFLOGSTRING1("CAlfLayoutSwitchEffectCoordinator::Blank %d", aEnabled); + iBlankEnabled = aEnabled; + Event( aEnabled ? EEventBlankOn : EEventBlankOff ); } - + // --------------------------------------------------------- -// CAlfLayoutSwitchEffectCoordinator::Cancel +// CAlfLayoutSwitchEffectCoordinator::LowMemoryEvent // --------------------------------------------------------- // -void CAlfLayoutSwitchEffectCoordinator::Cancel() +void CAlfLayoutSwitchEffectCoordinator::LowMemoryEvent() { - // Disable effect - SetLayoutSwitchEffect( AknTransEffect::ENone ); - - // Unfreeze visible content - if ( iRosterFreezeEndTimer ) - { - iRosterFreezeEndTimer->Cancel(); - } - - iBridge.iHuiEnv->Display(0).SetDirty(); - TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse)); - iBridge.SetVisualTreeVisibilityChanged(ETrue); + __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::LowMemory"); + Event( EEventLowMemory ); + } - // Restore normal priority - RThread me = RThread(); - me.SetPriority(iOriginalPriority); - me.Close(); - } - // --------------------------------------------------------- // CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch -// -// This method starts the layout switch effect procedure. // --------------------------------------------------------- // void CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch() { - if (iRosterFreezeEndTimer) - { - iRosterFreezeEndTimer->Cancel(); - } + __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch"); + Event( EEventLayoutSwitch ); + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::Event +// --------------------------------------------------------- +// +void CAlfLayoutSwitchEffectCoordinator::Event(TEvent aEvent) + { + // States: + // - EStateIdle - No layout switch effect ongoing + // - EStateFreezeFx - Roster frozen, periodic fullscreen completeness checking + // - EStateBlankFx - Roster frozen, expecting client to say when ready to unfreeze + // - EStateThemeFx - Theme effect in use - if (!iLayoutSwitchEffectContext && !( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest )) + // Events: + // - EEventBlankOn - Client requested blank on + // - EEventBlankOff - Client requested blank off + // - EEventLayoutSwitch - Layout switch noticed + // - EEventLowMemory - Low memory indication + // and implicit Finish - Effect finished + + // Transitions: + // From EStateIdle: + // - EEventBlankOn: EStateBlankFx + // - EEventLayoutSwitch: If effect available, EStateThemeFx. Otherwise EStateFreezeFx. + // + // From EStateFreezeFx: + // - EEventBlankOn: EStateBlankFx + // - implicit Finish - EStateIdle + // + // From EStateBlankFx: + // - EEventBlankOff: EStateFreezeFx (we use freeze to ensure that result is ok) + // - EEventLayoutSwitch: If effect available, EStateThemeFx. + // + // From EStateThemeFx: + // - EEventLowMemory: If blank still on, EStateBlankFx. Otherwise EStateFreezeFx. + // - implicit Finish - EStateIdle + + TState nextState = EStateIdle; + + switch ( iCurrentState ) + { + case EStateFreezeFx: + nextState = NextFreezeState(aEvent); + break; + + case EStateBlankFx: + nextState = NextBlankState(aEvent); + break; + + case EStateThemeFx: + nextState = NextThemeState(aEvent); + break; + + case EStateIdle: + default: + nextState = NextIdleState(aEvent); + break; + } + + if ( nextState != iCurrentState ) { - TBool tfxOn = CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff ); - TBool tfxExists = LayoutSwitchEffectsExist(); - if (tfxOn && tfxExists) - { - // Boost priority so that we are able to draw more frames for the effect - RThread me = RThread(); - me.SetPriority(EPriorityAbsoluteHigh); - me.Close(); - - // Freeze visual content - //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch freezing roster content")); - iBridge.iHuiEnv->Display(0).SetDirty(); - TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(ETrue)); - - // Remove all other effects - iBridge.HandleGfxStopEvent( EFalse ); - iBridge.RemoveAllTemporaryPresenterVisuals(); - - // Set first layout switch effect - SetLayoutSwitchEffect(AknTransEffect::ELayoutSwitchStart); - } - else - { - if (!iRosterFreezeEndTimer) - { - TRAP_IGNORE(iRosterFreezeEndTimer = CAlfRosterFreezeEndTimer::NewL(iBridge)); - } - - if (iRosterFreezeEndTimer) - { - TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(ETrue)); - - // Remove all other effects - iBridge.HandleGfxStopEvent( EFalse ); - iBridge.RemoveAllTemporaryPresenterVisuals(); - - // Set remove freeze timer - __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch - Freeze timer started"); - iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000); - } - //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch - tfx are set OFF -> I am not starting effect.")); - } - } - else - { - //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch - old effect exists - %i"), iLayoutSwitchEffectContext); + Transition( nextState, iCurrentState ); } } // --------------------------------------------------------- -// CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext -// -// This method automatically selects the next context in the -// layout switch procedure. -// -// Contextes change in the following order during layout switch: -// -// 1. AknTransEffect::ENone -// 2. AknTransEffect::ELayoutSwitchStart -// 3. AknTransEffect::ELayoutSwitchExit -// 4. AknTransEffect::ENone -// -// After new context is selected, appropriate effect is set -// (and/or removed) from the roster. -// +// CAlfLayoutSwitchEffectCoordinator::Transition // --------------------------------------------------------- // -AknTransEffect::TContext CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext() +void CAlfLayoutSwitchEffectCoordinator::Transition( + TState aNewState, TState aPreviousState) { - // Resolve next context based on current context - AknTransEffect::TContext newContext = AknTransEffect::ENone; - switch (iLayoutSwitchEffectContext) + __ALFLOGSTRING2("CAlfLayoutSwitchEffectCoordinator::Transition from: %d to: %d", aNewState, aPreviousState); + iCurrentState = aNewState; + + // Undo previous state - don't unfreeze roster. + switch ( aPreviousState ) + { + case EStateFreezeFx: + if ( iRosterFreezeEndTimer ) + { + iRosterFreezeEndTimer->Cancel(); + } + break; + + case EStateBlankFx: + iBridge.iHuiEnv->iPauseDrawing = EFalse; + break; + + case EStateThemeFx: + { + RThread me = RThread(); + me.SetPriority(iOriginalPriority); + me.Close(); + + if ( iRosterFreezeEndTimer ) + { + iRosterFreezeEndTimer->Cancel(); + } + + SetLayoutSwitchEffect( AknTransEffect::ENone ); + } + break; + + case EStateIdle: + default: + break; + } + + // Do next state actions + switch ( iCurrentState ) + { + case EStateFreezeFx: { - case AknTransEffect::ENone: + if (!iRosterFreezeEndTimer) + { + TRAP_IGNORE(iRosterFreezeEndTimer = CAlfRosterFreezeEndTimer::NewL(iBridge)); + } + + if (iRosterFreezeEndTimer) { - newContext = AknTransEffect::ELayoutSwitchStart; - break; + iRosterFreezeEndTimer->Cancel(); + + FreezeRoster(ETrue); + + // Remove all other effects + iBridge.HandleGfxStopEvent( EFalse ); + iBridge.RemoveAllTemporaryPresenterVisuals(); + + // Set remove freeze timer + __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::Transition - Freeze timer started"); + iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoFreezeFinished, this)); } - case AknTransEffect::ELayoutSwitchStart: + } + break; + + case EStateBlankFx: + { + // Start blanker + iBridge.iHuiEnv->iPauseDrawing = ETrue; + FreezeRoster(ETrue); + } + break; + + case EStateThemeFx: + { + // Boost priority so that we are able to draw more frames for the effect + RThread me = RThread(); + me.SetPriority(EPriorityAbsoluteHigh); + me.Close(); + + // Freeze visual content + iBridge.iHuiEnv->Display(0).SetDirty(); + FreezeRoster(ETrue); + + // Remove all other effects + iBridge.HandleGfxStopEvent( EFalse ); + iBridge.RemoveAllTemporaryPresenterVisuals(); + + // Set first layout switch effect + SetLayoutSwitchEffect(AknTransEffect::ELayoutSwitchStart); + } + break; + + case EStateIdle: + default: + { + // Undo everything to be sure + RThread me = RThread(); + me.SetPriority(iOriginalPriority); + me.Close(); + + SetLayoutSwitchEffect( AknTransEffect::ENone ); + if ( iRosterFreezeEndTimer ) { - newContext = AknTransEffect::ELayoutSwitchExit; - break; + iRosterFreezeEndTimer->Cancel(); + } + + iBridge.iHuiEnv->iPauseDrawing = EFalse; + FreezeRoster(EFalse); + iBridge.iHuiEnv->Display(0).SetDirty(); + iBridge.SetVisualTreeVisibilityChanged(ETrue); + } + break; + } + + // Inform bridge about layout switch actions + if ( aNewState != EStateIdle && aPreviousState == EStateIdle ) + { + iLayoutSwitchNotCompleted = ETrue; + iBridge.LayoutSwitchStart(); + } + if ( aNewState == EStateIdle && iLayoutSwitchNotCompleted ) + { + iLayoutSwitchNotCompleted = EFalse; + iBridge.LayoutSwitchComplete(); + } + + __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::Transition end"); + } + + + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::NextIdleState +// --------------------------------------------------------- +// +CAlfLayoutSwitchEffectCoordinator::TState + CAlfLayoutSwitchEffectCoordinator::NextIdleState( + TEvent aEvent) + { + TState state = EStateIdle; + + switch ( aEvent ) + { + case EEventLayoutSwitch: + if ( IsThemeEffectEnabled() ) + { + state = EStateThemeFx; } - case AknTransEffect::ELayoutSwitchExit: // fallthrough - default: + else { - newContext = AknTransEffect::ENone; - break; - } + state = EStateFreezeFx; + } + break; + + case EEventBlankOn: + state = EStateBlankFx; + break; + + case EEventBlankOff: + case EEventLowMemory: + default: + break; + } + + return state; + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::NextFreezeState +// --------------------------------------------------------- +// +CAlfLayoutSwitchEffectCoordinator::TState + CAlfLayoutSwitchEffectCoordinator::NextFreezeState( + TEvent aEvent) + { + TState state = EStateFreezeFx; + + switch ( aEvent ) + { + case EEventBlankOn: + state = EStateBlankFx; + break; + + case EEventLayoutSwitch: + case EEventBlankOff: + case EEventLowMemory: + default: + break; } + + return state; + } - //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchEffectL old ctx = %i, new ctx = %i"), iLayoutSwitchEffectContext, newContext); - return newContext; +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::NextBlankState +// --------------------------------------------------------- +// +CAlfLayoutSwitchEffectCoordinator::TState + CAlfLayoutSwitchEffectCoordinator::NextBlankState( + TEvent aEvent) + { + TState state = EStateBlankFx; + + switch ( aEvent ) + { + case EEventLayoutSwitch: + if ( IsThemeEffectEnabled() ) + { + state = EStateThemeFx; + } + break; + + case EEventBlankOff: + state = EStateFreezeFx; + break; + + case EEventBlankOn: + case EEventLowMemory: + default: + break; + } + + return state; + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::NextThemeState +// --------------------------------------------------------- +// +CAlfLayoutSwitchEffectCoordinator::TState + CAlfLayoutSwitchEffectCoordinator::NextThemeState( + TEvent aEvent) + { + TState state = EStateThemeFx; + + switch ( aEvent ) + { + case EEventLowMemory: + state = iBlankEnabled ? EStateBlankFx : EStateFreezeFx; + break; + + case EEventLayoutSwitch: + case EEventBlankOn: + case EEventBlankOff: + default: + break; + } + + return state; + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::FreezeFinished +// --------------------------------------------------------- +// +void CAlfLayoutSwitchEffectCoordinator::FreezeFinished() + { + Transition(EStateIdle, iCurrentState); } // --------------------------------------------------------- @@ -338,7 +519,159 @@ } } -TBool CAlfLayoutSwitchEffectCoordinator::LayoutSwitchEffectsExist() +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack +// +// This method is callback which gets called when layout +// switch effect has ended. +// --------------------------------------------------------- +// +void CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack( TInt aHandle ) + { + //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack")); + // KErrNotFound indicates callback from DoNextLayoutSwitchContext + if (iLayoutSwitchEffectContext == aHandle || aHandle == KErrNotFound) + { + AknTransEffect::TContext nextContext = NextLayoutSwitchContext(); + + // Unfreeze visible content. This reveals real roster content (in new orientation). + if (nextContext == AknTransEffect::ELayoutSwitchExit) + { + #ifdef HUI_DEBUG_TRACK_DRAWING + RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack unfreezing roster content")); + #endif + iBridge.iHuiEnv->Display(0).SetDirty(); + FreezeRoster(EFalse); + iBridge.SetVisualTreeVisibilityChanged(ETrue); + if ( iLayoutSwitchNotCompleted ) + { + iLayoutSwitchNotCompleted = EFalse; + iBridge.LayoutSwitchComplete(); + } + } + + // Set next effect + SetLayoutSwitchEffect(nextContext); + + if (nextContext == AknTransEffect::ENone) + { + // Restore normal priority + if ( iCurrentState == EStateThemeFx ) + { + Transition(EStateIdle, iCurrentState); + } + + RThread me = RThread(); + me.SetPriority(iOriginalPriority); + me.Close(); + + // Just in case refresh everything + iBridge.iHuiEnv->Display(0).SetDirty(); + } + } + else + { + //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::AlfGfxEffectEndCallBack - got different handle (normal, dont worry...) - %i"), aHandle); + } + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext +// +// This method automatically selects the next context in the +// layout switch procedure. +// +// Contextes change in the following order during layout switch: +// +// 1. AknTransEffect::ENone +// 2. AknTransEffect::ELayoutSwitchStart +// 3. AknTransEffect::ELayoutSwitchExit +// 4. AknTransEffect::ENone +// +// After new context is selected, appropriate effect is set +// (and/or removed) from the roster. +// +// --------------------------------------------------------- +// +// todo: rename +TInt DoNextLayoutSwitchContext(TAny* aLayoutSwitchCoordinator) + { + CAlfLayoutSwitchEffectCoordinator* coordinator = (CAlfLayoutSwitchEffectCoordinator*)aLayoutSwitchCoordinator; + coordinator->AlfGfxEffectEndCallBack(KErrNotFound); + return 0; + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext +// --------------------------------------------------------- +// +AknTransEffect::TContext CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchContext() + { + // Resolve next context based on current context + AknTransEffect::TContext newContext = AknTransEffect::ENone; + switch (iLayoutSwitchEffectContext) + { + case AknTransEffect::ENone: + { + newContext = AknTransEffect::ELayoutSwitchStart; + break; + } + case AknTransEffect::ELayoutSwitchStart: + { + newContext = AknTransEffect::ELayoutSwitch; + if (!iRosterFreezeEndTimer) + { + TRAP_IGNORE(iRosterFreezeEndTimer = CAlfRosterFreezeEndTimer::NewL(iBridge)); + } + if (iRosterFreezeEndTimer) + { + iRosterFreezeEndTimer->Cancel(); + iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000, TCallBack(DoNextLayoutSwitchContext, this)); + } + else + { + newContext = AknTransEffect::ELayoutSwitchExit; + } + break; + } + case AknTransEffect::ELayoutSwitch: + { + newContext = AknTransEffect::ELayoutSwitchExit; + break; + } + case AknTransEffect::ELayoutSwitchExit: // fallthrough + default: + { + newContext = AknTransEffect::ENone; + break; + } + } + + //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::NextLayoutSwitchEffectL old ctx = %i, new ctx = %i"), iLayoutSwitchEffectContext, newContext); + return newContext; + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::IsThemeEffectEnabled() +// Returns true if layout switch theme effect may be used +// --------------------------------------------------------- +// +TBool CAlfLayoutSwitchEffectCoordinator::IsThemeEffectEnabled() const + { + TBool memoryOk = !( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest ); + TBool tfxOn = CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff ); + TBool tfxExists = LayoutSwitchEffectsExist(); + + return + memoryOk && tfxOn && tfxExists; + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::LayoutSwitchEffectsExist() +// Returns true if layout switch effect exists +// --------------------------------------------------------- +// +TBool CAlfLayoutSwitchEffectCoordinator::LayoutSwitchEffectsExist() const { TBool appearExists = EFalse; TBool disAppearExists = EFalse; @@ -361,6 +694,26 @@ } // --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::FreezeRoster() +// Freeze visible content in roster. +// --------------------------------------------------------- +// +void CAlfLayoutSwitchEffectCoordinator::FreezeRoster(TBool aFrozen) + { + TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(aFrozen)); + } + +// --------------------------------------------------------- +// CAlfLayoutSwitchEffectCoordinator::DoFreezeFinished() +// --------------------------------------------------------- +// +TInt CAlfLayoutSwitchEffectCoordinator::DoFreezeFinished(TAny* aAny) + { + static_cast(aAny)->FreezeFinished(); + return KErrNone; + } + +// --------------------------------------------------------- // CAlfFinishTimer // --------------------------------------------------------- // @@ -495,46 +848,6 @@ iCompletionHandle = iHandle; } -TInt doNotifyDrawingTimeout( TAny* aPtr ) - { - ((CFullScreenEffectState*)aPtr)->NotifyDrawingTimeout(); - return 0; // must return something - } - -TBool CFullScreenEffectState::InitDelayedEffectL(CAlfBridge* aBridge, TSize aDisplaySize) - { - iBridge = aBridge; - iDisplaySize = aDisplaySize; - if (!iDrawingCompleteTimer) - { - iDrawingCompleteTimer = CPeriodic::NewL( EPriorityNormal ); - iDrawingCompleteTimer->Start( - KFirstTimeoutForApplicationEndFullScreenInMs * 1000 , - KFirstTimeoutForApplicationEndFullScreenInMs * 1000 , TCallBack( doNotifyDrawingTimeout, this )); - return ETrue; - } - return EFalse; - } - -void CFullScreenEffectState::NotifyDrawingTimeout() - { - - iPaintedRegion.ClipRect(TRect(0,0, iDisplaySize.iWidth, iDisplaySize.iHeight)); - iPaintedRegion.Tidy(); // remove overlapping regions - TInt size(0); - for(TInt i=0; i< iPaintedRegion.Count();i++ ) - { - size += iPaintedRegion[i].Width()*iPaintedRegion[i].Height(); - } - // lets continue, if the covered area is more than 75% of the screen. This is usually enough. - if ( size > KMinimumPaintedAreaBeforeForcedEffect * (iDisplaySize.iWidth * iDisplaySize.iHeight)) - { - iBridge->HandleGfxEndFullScreenTimeout(this); - delete iDrawingCompleteTimer; - iDrawingCompleteTimer = NULL; - } - } - void CControlEffectState::ConstructL(TInt aAction, RMemReadStream& aStream) { diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -797,7 +797,12 @@ AMT_INC_COUNTER_IF(node && (nodeType==MWsWindowTreeNode::EWinTreeNodeClient), iWindowNodeCount ); AMT_INC_COUNTER_IF(node && (nodeType==MWsWindowTreeNode::EWinTreeNodeGroup), iWindowGroupNodeCount ); - AMT_INC_COUNTER_IF(node, iTotalNodeCount ); + AMT_INC_COUNTER_IF(node, iTotalNodeCount ); + + AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeClient, + iIntMap, node->iId, EAlfModuleTestTypeHierarchyModelCreateWindow ); + AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeGroup, + iIntMap, node->iId, EAlfModuleTestTypeHierarchyModelCreateWindowGroup ); } // --------------------------------------------------------------------------- @@ -830,7 +835,12 @@ AMT_DEC_COUNTER_IF(node && (nodeType==MWsWindowTreeNode::EWinTreeNodeClient), iWindowNodeCount ); AMT_DEC_COUNTER_IF(node && (nodeType==MWsWindowTreeNode::EWinTreeNodeGroup), iWindowGroupNodeCount ); - AMT_DEC_COUNTER_IF(node, iTotalNodeCount ); + AMT_DEC_COUNTER_IF(node, iTotalNodeCount ); + + AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeClient, + iIntMap, nodeId, EAlfModuleTestTypeHierarchyModelReleaseWindow ); + AMT_MAP_INC_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeGroup, + iIntMap, nodeId, EAlfModuleTestTypeHierarchyModelReleaseWindowGroup ); } // --------------------------------------------------------------------------- @@ -851,7 +861,11 @@ USER_INVARIANT(); } - AMT_INC_COUNTER_IF( node && (nodeType==MWsWindowTreeNode::EWinTreeNodeClient), iWindowNodeActivatedCount ); + AMT_INC_COUNTER_IF( node && (nodeType==MWsWindowTreeNode::EWinTreeNodeClient), iWindowNodeActivatedCount ); + + AMT_MAP_SET_VALUE_IF( node && nodeType == MWsWindowTreeNode::EWinTreeNodeClient, + iBoolMap, nodeId, ETrue, + EAlfModuleTestTypeHierarchyModelActiveWindow ); } // --------------------------------------------------------------------------- @@ -884,12 +898,12 @@ AMT_INC_COUNTER_IF(node, iNodeExtentChangedCount ); AMT_SET_VALUE_IF(node, iLatestNodeExtentRect, rect ); - AMT_MAP_SET_VALUE_IF( ( node && node->iWindow ), + AMT_MAP_SET_VALUE_IF( node && node->iWindow, iSizeMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, - rect.Size(), EAlfModuleTestTypeHierarchyModelChangeSize ); - AMT_MAP_SET_VALUE_IF( ( node && node->iWindow ), + rect.Size(), EAlfModuleTestTypeHierarchyModelChangeWindowSize ); + AMT_MAP_SET_VALUE_IF( node && node->iWindow, iPositionMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, - rect.iTl, EAlfModuleTestTypeHierarchyModelChangePosition ); + rect.iTl, EAlfModuleTestTypeHierarchyModelChangeWindowPosition ); } // --------------------------------------------------------------------------- @@ -951,9 +965,11 @@ } AMT_INC_COUNTER_IF(node, iTotalNodeFlagChangedCount ); - AMT_MAP_INC_VALUE_IF( ( node && node->iWindow ), - iIntMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, - EAlfModuleTestTypeHierarchyModelChangeFlag ); + AMT_MAP_SET_VALUE_IF( node && node->iWindow && MWsWindowTreeObserver::EVisible == flag, + iBoolMap, + node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, + newValue, + EAlfModuleTestTypeHierarchyModelChangeWindowVisibility ); } // --------------------------------------------------------------------------- @@ -1152,7 +1168,7 @@ USER_INVARIANT(); // attribute change for unexpected node type. new code needed! } - AMT_INC_COUNTER_IF(node, iTotalNodeAttributeChangedCount ); + AMT_INC_COUNTER_IF(node, iTotalNodeAttributeChangedCount ); } // --------------------------------------------------------------------------- diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -214,9 +214,13 @@ if ( iParent->iType != MWsWindowTreeNode::EWinTreeNodeRoot) { CAlfNode* parentGroupNode = iModel->FindNode( aParentId ); + aNodes.Append(parentGroupNode); for (CAlfNode::TIter iter( parentGroupNode ); iter.Current() != NULL; iter.Next()) { - aNodes.Append(iter.Current()); + if (iter.Current() != parentGroupNode ) + { + aNodes.Append(iter.Current()); + } } } else @@ -1716,20 +1720,21 @@ ResolveParent( iNodeWindowConstructionStruct.iParentId, iId ); CreateWindowL( iNodeWindowConstructionStruct.iWindowGroupHandle, iNodeWindowConstructionStruct.iWindowHandle, iNodeWindowConstructionStruct.iParentId ); UpdateOrdinalPosition(); + + AMT_MAP_STREAMER_NODE_WINDOW_CONSTRUCT(); } // --------------------------------------------------------------------------- // MoveToWindowGroup -// !!!! THIS METHOD HAS NOT BEEN TESTED AT ALL!!!!!! EXPECT TROUBLE!!!! // --------------------------------------------------------------------------- // void CAlfNodeWindow::MoveToWindowGroup( TUint32 aNewGroupId ) { - __ALFLOGSTRING("CAlfNodeWindow::MoveToWindowGroup, THIS METHOD IS UNTESTED. EXPECT TROUBLE!"); + __ALFLOGSTRING3("CAlfNodeWindow::MoveToWindowGroup moving nodeID 0x%x from group 0x%x to 0x%x",iId, iParent->iId, aNewGroupId ); CAlfNodeGroup* newGroup = (CAlfNodeGroup*)iModel->FindNode( aNewGroupId ); if ( newGroup ) { - // collect my children in my old group + // collect my children in my old group (inclucing me) RPointerArray myChildNodes; GetAllChildrenInGroup( myChildNodes, iId ); @@ -1743,20 +1748,22 @@ { previous->iSibling = iSibling; // there was the a previous child. update the link to my next sibling (which might be NULL) } - TUint32 oldGroupId = iParent->iId; - iParent = newGroup; - SetFirstChild(); - + // yippii, new parent, // add me as the first child of the new group - // TODO: Move the nodes to the new group? + iParent = newGroup; + iSibling = NULL; + SetFirstChild(); + + TUint32 screenNumber = iScreenNumber; + TInt i = myChildNodes.Count(); while( --i >=0 ) // update groupid and send new location to appui - { - iModel->Server().Bridge()->AddData( EAlfDSMoveWindowToNewGroup, - myChildNodes[i]->iId, - oldGroupId, - (TAny*)aNewGroupId ); + { + iModel->Server().Bridge()->AddData( EAlfDSMoveWindowToNewGroup, + myChildNodes[i]->iId, + screenNumber, + (TAny*)aNewGroupId ); myChildNodes[i]->iGroupId = aNewGroupId; } @@ -1895,6 +1902,8 @@ iGroupId, iId, (TAny*)offset ); + + AMT_MAP_STREAMER_NODE_GROUP_CONSTRUCT(); } // --------------------------------------------------------------------------- @@ -2128,6 +2137,8 @@ (TAny*)offset ); UpdateOrdinalPosition(); + + AMT_MAP_STREAMER_TEXT_CURSOR_CONSTRUCT(); } // --------------------------------------------------------------------------- @@ -2146,6 +2157,8 @@ void CAlfNodeTextCursor::AttributeChangedL( RMemReadStream* aStream ) { + AMT_MAP_BRIDGE_ADD_TEXT_CURSOR(); + // TODO: PASS FORWARD!!! TInt attribute = aStream->ReadInt32L(); switch ( attribute ) @@ -2184,6 +2197,8 @@ iGroupId, iId, (TAny*)offset ); + + AMT_MAP_STREAMER_TEXT_CURSOR_CHANGE(); } CAlfNodeTextCursor::~CAlfNodeTextCursor( ) { diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -161,9 +161,13 @@ // NewSessionL // --------------------------------------------------------------------------- // -CSession2* CAlfStreamerServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& /*aMessage*/) const +CSession2* CAlfStreamerServer::NewSessionL(const TVersion& /*aVersion*/,const RMessage2& aMessage) const { - CSession2* newSession = new(ELeave) CAlfStreamerServerSession(); + RThread t; + aMessage.Client(t); + CleanupClosePushL(t); + CSession2* newSession = new(ELeave) CAlfStreamerServerSession(t.Id()); + CleanupStack::PopAndDestroy(); iSessions++; return newSession; @@ -188,9 +192,13 @@ // HandleClientExit // --------------------------------------------------------------------------- // -void CAlfStreamerServer::HandleClientExit(const CSession2* /*aClient*/) +void CAlfStreamerServer::HandleClientExit(const CAlfStreamerServerSession* aClient) { iSessions--; + if (WindowMgr()) + { + WindowMgr()->HandleClientExit(aClient->ThreadId()); + } if (!iSessions) { // CActiveScheduler::Stop(); // TODO: lets not die, if client dies. @@ -539,7 +547,7 @@ } if ( aOp == KAlfCompositionLowOnGraphicsMemory || aOp == KAlfCompositionGoodOnGraphicsMemory - || aOp == KAlfCompositionTargetHidden ||aOp == KAlfCompositionTargetVisible) + || aOp == KAlfCompositionTargetHidden ||aOp == KAlfCompositionTargetVisible || aOp == KAlfCompositionLayoutSwitchComplete) { aMessage.Complete(KErrNone); QueueRequestAllSessionsL(KNullDesC8(), aOp, ETrue); @@ -688,7 +696,7 @@ // constructor // --------------------------------------------------------------------------- // -CAlfStreamerServerSession::CAlfStreamerServerSession() : iScreenNumber(KErrNotFound) +CAlfStreamerServerSession::CAlfStreamerServerSession(const TThreadId& aThreadId) : iScreenNumber(KErrNotFound), iThreadId(aThreadId) { } @@ -968,6 +976,7 @@ case KAlfCompositionTargetHidden: case KAlfCompositionTargetVisible: case KAlfCompositionTargetCreated: + case KAlfCompositionLayoutSwitchComplete: { aServer->HandleCompositionEventL(this, aOp, aMessage); break; diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Src/alfwindowfxplugin.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfwindowfxplugin.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfwindowfxplugin.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -101,3 +101,10 @@ } return 0; } + + +EXPORT_C void CAlfWindowFxPlugin::ClientAboutToExit(TThreadId) + { + } + + diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -681,3 +681,15 @@ *windowCommandBuffer = empty; return windowCommandBuffer; } + + +void CAlfWindowManager::HandleClientExit(TThreadId aThreadId) + { + for (TInt i = iData->iPlugins.Count()-1; i >= 0 ; i--) + { // assuming that plugins won't actually change the order on this message + //(i.e. they may destroy them selves but not the plugine inserted before them) + iData->iPlugins[i].iPlugin->ClientAboutToExit(aThreadId); + } + } + + diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/ServerCore/eabi/alfappservercoreu.DEF --- a/uiacceltk/hitchcock/ServerCore/eabi/alfappservercoreu.DEF Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/eabi/alfappservercoreu.DEF Wed Mar 31 23:03:58 2010 +0300 @@ -547,4 +547,5 @@ _ZN18CAlfStreamerBridge15FindWgForAppUidE4TUid @ 546 NONAME _ZN18CAlfStreamerBridge17FindAppUidForWgIdEi @ 547 NONAME _ZN10CAlfWindow21SetLayerUsesAplhaFlagEi @ 548 NONAME + _ZN18CAlfWindowFxPlugin17ClientAboutToExitE9TThreadId @ 549 NONAME diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF --- a/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF Wed Mar 31 23:03:58 2010 +0300 @@ -1592,4 +1592,8 @@ ?SetShape@CHuiCanvasVisual@@QAEXABVTPoint@@ABVTRegion@@@Z @ 1591 NONAME ; void CHuiCanvasVisual::SetShape(class TPoint const &, class TRegion const &) ?CommandBufferCoverage@CHuiCanvasVisual@@QAE?AVTRect@@H@Z @ 1592 NONAME ; class TRect CHuiCanvasVisual::CommandBufferCoverage(int) ?CopyScreenToBitmapL@CHuiDisplay@@QAEXPAVCFbsBitmap@@@Z @ 1593 NONAME ; void CHuiDisplay::CopyScreenToBitmapL(class CFbsBitmap *) + ?SecureId@CHuiControlGroup@@QAEHXZ @ 1594 NONAME ; int CHuiControlGroup::SecureId(void) + ?SetSecureId@CHuiControlGroup@@QAEXH@Z @ 1595 NONAME ; void CHuiControlGroup::SetSecureId(int) + ?HasTransParentClear@CHuiCanvasVisual@@QBEHXZ @ 1596 NONAME ; int CHuiCanvasVisual::HasTransParentClear(void) const + ?AddEffectToGroup@CHuiFxEngine@@QAEHH@Z @ 1597 NONAME ; int CHuiFxEngine::AddEffectToGroup(int) diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF --- a/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF Wed Mar 31 23:03:58 2010 +0300 @@ -1993,4 +1993,8 @@ _ZNK16CHuiCanvasVisual14HasCustomShapeEv @ 1992 NONAME _ZN16CHuiCanvasVisual21CommandBufferCoverageEi @ 1993 NONAME _ZN11CHuiDisplay19CopyScreenToBitmapLEP10CFbsBitmap @ 1994 NONAME + _ZN16CHuiControlGroup11SetSecureIdEi @ 1995 NONAME + _ZN16CHuiControlGroup8SecureIdEv @ 1996 NONAME + _ZNK16CHuiCanvasVisual19HasTransParentClearEv @ 1997 NONAME + _ZN12CHuiFxEngine16AddEffectToGroupEi @ 1998 NONAME diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h --- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h Wed Mar 31 23:03:58 2010 +0300 @@ -40,7 +40,10 @@ /** Effect is not applied to children visuals. */ const TInt KHuiFxEffectExcludeChildrenFlag = 0x4; -/** Effect is grouped and syncronized with other effect(s)*/ +/** Effect is grouped and syncronized with other effect(s) + * + * Indicates that the EndGroup event has not yet been received. + */ const TInt KHuiFxWaitGroupSyncronization = 0x8; /** Effect duration is started after it has first time been drawn. */ @@ -61,6 +64,16 @@ /** Background pixels are not read for every frame (only once in a while), thus background content looks frozen if it is visible. */ const TInt KHuiFxFrozenBackground = 0x200; +/** + * EndGroup request has been received, but this effect has not yet drawn itself. + */ +const TInt KHuiFxWaitGroupToStartSyncronized = 0x400; + +/** EndGroup request has been received and this effect has drawn itself once and it is + * now waiting for the others in the group to be drawn. + */ +const TInt KHuiFxReadyAndWaitingGroupToStartSyncronized = 0x800; + class MAlfGfxEffectObserver { public: @@ -98,6 +111,9 @@ IMPORT_C void SetEngine( CHuiFxEngine *aEngine ); IMPORT_C void SetEffectFlags( TInt aFlags ); + void SetEffectFlag( TInt aFlag ); + void ClearEffectFlag( TInt aFlag ); + IMPORT_C void SetEffectGroup(TInt aGroupId); IMPORT_C TInt EffectFlags(); IMPORT_C TInt GroupId(); diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h --- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h Wed Mar 31 23:03:58 2010 +0300 @@ -88,7 +88,7 @@ { public: CHuiFxEffectCacheEffectNode(const TDesC &aFileName, CHuiFxEffect *&aEffect, MHuiEffectable *aVisual, TRect *extRect, CHuiFxEngine *aEngine) - : iFileName(aFileName.AllocL()), iEffect(aEffect), iVisual(aVisual), iExtRect(extRect), iEffectCached(0), iEngine(aEngine), iRefCount(0), iParser(0) { } + : iFileName(aFileName.AllocL()), iEffect(aEffect), iVisual(aVisual), iExtRect(extRect), iEffectCached(0), iEngine(aEngine), iRefCount(0), iParser(0), iGroup(KErrNotFound) { } IMPORT_C ~CHuiFxEffectCacheEffectNode(); void SetEffectEndObserver( MAlfGfxEffectObserver* aEffectEndObserver, TInt aHandle ); void SetEffectFlags( TInt aFlags ); diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h --- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEngine.h Wed Mar 31 23:03:58 2010 +0300 @@ -126,10 +126,10 @@ * time. */ IMPORT_C void BeginGroupEffect(TInt aGroup); - IMPORT_C TInt ActiveGroupEffect(); + IMPORT_C TBool AddEffectToGroup(TInt aGroup); /* * StartGroupEffect * @@ -147,6 +147,14 @@ IMPORT_C void SetMemoryLevel(THuiMemoryLevel aLevel); + /** + * Group effects wait until each effect has been drawn once. + * + * Group effects are set into motion by NotifyEffectReady, when all effects in + * the group have been drawn at least once. + */ + void NotifyEffectReady(TInt aGroupId); + protected: IMPORT_C void AddEffectL(CHuiFxEffect* aEffect); IMPORT_C void RemoveEffect(CHuiFxEffect* aEffect); @@ -157,6 +165,7 @@ private: TBool FxmlUsesInput1(CHuiFxEffect& aEffect); + TInt FindEffectGroup(TInt aGroup); private: // Render buffer management --- native implementations @@ -189,7 +198,22 @@ TRect iExtRect; CHuiFxEffectCache *iCache; TInt iLowGraphicsMemoryMode; - RArray iActiveEffectGroups; + + NONSHARABLE_STRUCT(TEffectGroupStruct) + { + public: + + TEffectGroupStruct(TInt aGroup) : iGroup(aGroup), iWaiting(0), iEndCalled(EFalse){}; + + TInt iGroup; + TInt iWaiting; + TBool iEndCalled; + }; + + /** + * Only one simultanious effect group is supported + */ + RArray iActiveEffectGroups; }; #endif /*HUIFXENGINE_H_*/ diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h --- a/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiRosterImpl.h Wed Mar 31 23:03:58 2010 +0300 @@ -28,6 +28,7 @@ #include "uiacceltk/HuiRealPoint.h" #include "uiacceltk/HuiRealPoint.h" #include "uiacceltk/HuiGc.h" +#include "uiacceltk/huilowmemoryobserver.h" #include "huieffectable.h" /* Forward declarations. */ @@ -53,7 +54,8 @@ * * @see CHuiRoster */ -NONSHARABLE_CLASS(CHuiRosterImpl) : public CHuiRoster, MHuiEffectable +NONSHARABLE_CLASS(CHuiRosterImpl) : public CHuiRoster, private MHuiEffectable, + private MHuiMemoryLevelObserver { public: @@ -330,6 +332,10 @@ void SetLoadingEffect(TBool aLoading); void EffectSetSource( TBool aIsInput1 ); TBool EffectGetSource() const; + + // From MHuiMemoryLevelObserver + void SetMemoryLevel(THuiMemoryLevel aLevel); + protected: /* Methods. */ @@ -451,6 +457,11 @@ */ void DrawBoundaries( CHuiGc& aGc, CHuiVisual* aVisual, TBool aDrawOutline ) const; + /** + * Returns true if render buffer can be used for freeze. + */ + TBool UseRenderBufferForFreeze() const; + private: /** Area occupied by the roster. */ @@ -498,6 +509,9 @@ CHuiCanvasGc* iCanvasGc; CHuiCanvasRenderBuffer* iCanvasRenderBuffer; CHuiGc::TOrientation iCanvasRenderBufferOrientation; + + TBool iRosterIsFrozen; + TBool iMonitorMemoryLevel; }; #endif // __HUIROSTERIMPL_H__ diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/inc/huicanvaspainter.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaspainter.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaspainter.h Wed Mar 31 23:03:58 2010 +0300 @@ -49,6 +49,7 @@ /** Flag to say wheter buffer really contains somethign that really draws something */ EHuiCanvasBufferContainsDrawing = 0x8000, + EHuiCanvasBufferContainsTransparentClear = 0x10000, /** All flags, can be used for clearing all flags */ EHuiCanvasBufferStatusAll = 0xFFFFFFFF }; diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h Wed Mar 31 23:03:58 2010 +0300 @@ -158,6 +158,7 @@ */ virtual CHuiCanvasGc& CanvasGc() const; CHuiCanvasWsGc *CanvasWsGc() const { return iCanvasWsGc; } + private: /** @@ -321,6 +322,8 @@ TRect iTestFullDisplayRect; #endif + TRgb iBrushColor; + // Stream read optimizations struct TStructBitBlitRect { diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/inc/huiextension.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huiextension.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huiextension.h Wed Mar 31 23:03:58 2010 +0300 @@ -83,4 +83,7 @@ TInt iErrorCode; }; +// Uid for Release Cached Textures extension for CHuiSkin. +const TUid KHuiSkinReleaseCachedTextures = { 0x2002E6D4 }; + #endif // __HUIEXTENSION_H__ diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/inc/huistatictlsdata.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huistatictlsdata.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huistatictlsdata.h Wed Mar 31 23:03:58 2010 +0300 @@ -22,6 +22,14 @@ #define __HUISTATICTLSDATA_H__ +// For testing purposes, insert additional test data into TLS. +// Notice, that TTlsData object is inserted into TLS. So, test +// object needs to be added into TTLSData and not inserted directly +// into TLS. +#define AMT_CONTROL() static_cast(Dll::Tls())->iAlfModuleTestDataControl +#include "alfmoduletest.h" + + LOCAL_D const TInt KMaxClocks = 10; @@ -109,7 +117,12 @@ RFs* iFs; CAppFwProxy* iAppFwProxy; - + +#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF + // For testing purposes, test data needs to be included into TLS object. + CAlfModuleTestDataControl* iAlfModuleTestDataControl; +#endif + CWsScreenDevice* WsScreenDevice(TInt aScreenNumber) { if (aScreenNumber < iScreenDevices.Count()) @@ -138,6 +151,13 @@ void DoInitL() { +#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF + // For testing purposes, test data needs to be included into TTlsData object because + // TTlsData object itself is inserted into TLS. + iAlfModuleTestDataControl = new(ELeave) CAlfModuleTestDataControl(); + User::LeaveIfError( iAlfModuleTestDataControl->OpenGlobalObjects() ); +#endif + CCoeEnv* coe = CCoeEnv::Static(); if (coe) { @@ -206,6 +226,11 @@ iFs = 0; RFbsSession::Disconnect(); + +#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF + delete iAlfModuleTestDataControl; + iAlfModuleTestDataControl = NULL; +#endif } }; diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h Wed Mar 31 23:03:58 2010 +0300 @@ -495,7 +495,7 @@ TReal32 aRightBorderWidth, TReal32 aTopBorderHeight, TReal32 aBottomBorderHeight, - const THuiImage* aImage); + const THuiImage* aImage) __SOFTFP; void CreateVgObjectsL(); diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -1872,7 +1872,7 @@ TReal32 aRightBorderWidth, TReal32 aTopBorderHeight, TReal32 aBottomBorderHeight, - const THuiImage* aImage) + const THuiImage* aImage) __SOFTFP { // If there is no image, draw a solid border if (!aImage || !aImage->HasTexture()) diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -1932,7 +1932,18 @@ { // For PC-lint } - + if (aFirst.iTextBoxMaxSize.iHeight < aSecond.iTextBoxMaxSize.iHeight) + { + return -1; // less than + } + else if (aFirst.iTextBoxMaxSize.iHeight > aSecond.iTextBoxMaxSize.iHeight) + { + return 1; // more than + } + else + { + // For PC-lint + } // Text content TInt textcompare = KErrNotFound; if ( aFirst.iFindTextPtr ) @@ -2089,7 +2100,7 @@ CHuiCanvasTextureCache::CHuiCanvasTextureCache() { SetMemoryLevel(EHuiMemoryLevelNormal); - CHuiStatic::Env().AddLowMemoryObserver(this); + CHuiStatic::Env().AddMemoryLevelObserver(this); } // --------------------------------------------------------------------------- @@ -2098,7 +2109,7 @@ // CHuiCanvasTextureCache::~CHuiCanvasTextureCache() { - CHuiStatic::Env().RemoveLowMemoryObserver(this); + CHuiStatic::Env().RemoveMemoryLevelObserver(this); iCachedTexts.ResetAndDestroy(); iCachedImages.ResetAndDestroy(); iRecycledTextures.ResetAndDestroy(); diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -80,6 +80,9 @@ RRegionBuf<5> iShapeRegion; TPoint iShapeOrigin; + + // Flag to indicate if this has received commands while inactive + TBool iCommandsReceivedWhileNoCache; }; EXPORT_C CHuiCanvasVisual* CHuiCanvasVisual::AddNewL(CHuiControl& aOwnerControl, @@ -125,6 +128,8 @@ iCanvasVisualData->iShapeOrigin = TPoint(); + iCanvasVisualData->iCommandsReceivedWhileNoCache = EFalse; + // subwindow effects //EnableBrushesL(ETrue); } @@ -274,6 +279,15 @@ void CHuiCanvasVisual::HandleBuffer(TRect& aDisplayRect, TInt aAction, CHuiGc* aGc) const { + TBool touchCountWasEnabled = EFalse; + if (iCanvasVisualData->iCommandsReceivedWhileNoCache) + { + // Commands were received while this visual didn't keep cache. + // So it's possible that some images are still in texture cache but haven't been updated. + touchCountWasEnabled = Env().CanvasTextureCache().IsTouchCountCheckEnabled(); + Env().CanvasTextureCache().EnableTouchCountCheck(); + } + if (iCanvasVisualData->iCommandSetType == ECommandBufferWs || iCanvasVisualData->iCommandSetType == ECommandBufferAlf) { TRAPD(err, iCanvasVisualData->iCanvasPainter->HandleBufferL(aDisplayRect, aAction, *this, aGc, DisplayRect().iTl.Round())); @@ -287,6 +301,14 @@ // do nothing } + if (iCanvasVisualData->iCommandsReceivedWhileNoCache) + { + Env().CanvasTextureCache().EnableTouchCountCheck( touchCountWasEnabled ); + if ( !KeepNoCache() && aAction == EDrawBuffer ) + { + iCanvasVisualData->iCommandsReceivedWhileNoCache = EFalse; + } + } } @@ -320,27 +342,37 @@ TBool CHuiCanvasVisual::CanSkipDrawing() const { - TBool semiTranparentEffectActive = (Effect() && Effect()->IsSemitransparent()); - TBool childWindowEffectActive = (Effect() && EffectIsAppliedToChildren()); - TBool invisible = (iOpacity.Now() <= EPSILON && !semiTranparentEffectActive); - TBool effectAppliedToSurfacePixels = (Effect() && (Effect()->EffectFlags() & KHuiFxEnableBackgroundInAllLayers)); - - if( invisible || - (!HasCommandBuffers(ETrue /*include children*/) && - !childWindowEffectActive && - !IsBackgroundDrawingEnabled() && - !IsExternalContentDrawingEnabled()&& - !IsExternalContentDrawingEnabled(ETrue /*include children*/) && - !effectAppliedToSurfacePixels - - )) + if (Effect()) { - return ETrue; + TBool semiTranparentEffectActive = Effect()->IsSemitransparent(); + if ((iOpacity.Now() <= EPSILON && !semiTranparentEffectActive)) + { + return ETrue; + } + TBool childWindowEffectActive = EffectIsAppliedToChildren(); + TBool effectAppliedToSurfacePixels = (Effect()->EffectFlags() & KHuiFxEnableBackgroundInAllLayers); + if( !childWindowEffectActive && + !effectAppliedToSurfacePixels && + !HasCommandBuffers(ETrue /*include children*/) && + !IsBackgroundDrawingEnabled() && + !IsExternalContentDrawingEnabled()&& + !IsExternalContentDrawingEnabled(ETrue /*include children*/)) + { + return ETrue; + } } else { - return EFalse; + if (iOpacity.Now() <= EPSILON || + (!HasCommandBuffers(ETrue /*include children*/) && + !IsBackgroundDrawingEnabled() && + !IsExternalContentDrawingEnabled() && + !IsExternalContentDrawingEnabled(ETrue /*include children*/)) ) + { + return ETrue; + } } + return EFalse; } void CHuiCanvasVisual::Draw(CHuiGc& aGc) const @@ -762,13 +794,9 @@ TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->SetCommandSetL(aCommands)); // Memory optimization. Do not prepare cache if visual is inactive. - TBool rosterFrozen = Display() && Display()->Roster().IsVisibleContentFrozen(); - TBool inactive = EFalse; - inactive |= Flags() & EHuiVisualFlagInactive; - inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; - - if (rosterFrozen || inactive) + if (KeepNoCache()) { + iCanvasVisualData->iCommandsReceivedWhileNoCache = ETrue; ClearCache(); } else @@ -836,13 +864,9 @@ TRAP_IGNORE(iCanvasVisualData->iCanvasPainter->AddCommandSetL(aMoreCommands)); // Memory optimization. Do not prepare cache if visual is inactive. - TBool rosterFrozen = Display() && Display()->Roster().IsVisibleContentFrozen(); - TBool inactive = EFalse; - inactive |= Flags() & EHuiVisualFlagInactive; - inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; - - if (rosterFrozen || inactive) + if (KeepNoCache()) { + iCanvasVisualData->iCommandsReceivedWhileNoCache = ETrue; ClearCache(); } else @@ -988,7 +1012,11 @@ background.iPaintedRect = DisplayRect(); background.iPaintType = /*(iCanvasVisualData->iBackground->BackgroundColor().Alpha() == 255) ?*/ EHuiCanvasPaintTypeOpaque;// : EHuiCanvasPaintTypeTransparent; return background; - } + } + else + { + aIndex--; + } } } @@ -1529,4 +1557,17 @@ return iCanvasVisualData->iCanvasPainter->CommandBufferCoverage(aOrientation); } +EXPORT_C TBool CHuiCanvasVisual::HasTransParentClear() const + { + return iCanvasVisualData->iCanvasPainter->HasCommandBuffers(EHuiCanvasBufferContainsTransparentClear); + } +TBool CHuiCanvasVisual::KeepNoCache() const + { + TBool rosterFrozen = Display() && Display()->Roster().IsVisibleContentFrozen(); + TBool inactive = EFalse; + inactive |= Flags() & EHuiVisualFlagInactive; + inactive |= Flags() & EHuiVisualFlagUnderOpaqueHint; + + return rosterFrozen || inactive; + } diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiControlGroup.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiControlGroup.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiControlGroup.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -230,6 +230,15 @@ iAcceptInput = aAcceptInput; } +EXPORT_C void CHuiControlGroup::SetSecureId(TInt aSecureId) + { + iSecureId = aSecureId; + } +EXPORT_C TInt CHuiControlGroup::SecureId() + { + return iSecureId; + } + TBool CHuiControlGroup::Changed() const { diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -638,6 +638,12 @@ return EFalse; } + if (!iForegroundTextureTransparency && iForegroundTexture) + { + // When we can blit foreground texture, we shouldn't need any textures in skin side. + iEnv.Skin().ReleaseCachedTextures(); + } + TBool useDirtyRects = (RenderSurface().Flags() & MHuiRenderSurface::EFlagUseDirtyRects) == MHuiRenderSurface::EFlagUseDirtyRects; @@ -851,7 +857,7 @@ iGc->PushClip(); iGc->Clip(dirtyRect); - if ( iForegroundBitmapGc ) + if ( iForegroundBitmapGc && !RosterImpl().IsVisibleContentFrozen() ) { // If we are in SW rendering mode, then SW bitmap may be blended. // However, it's possible that nothing is drawn below, so clear @@ -1628,6 +1634,12 @@ EXPORT_C void CHuiDisplay::SetForegroundTextureOptions(TBool aTransparency) { iForegroundTextureTransparency = aTransparency; + + if (!iForegroundTextureTransparency && iForegroundTexture) + { + // When we can blit foreground texture, we shouldn't need any textures in skin side. + iEnv.Skin().ReleaseCachedTextures(); + } } void CHuiDisplay::UpdateForegroundTexture(const TRect& aRect) @@ -1657,7 +1669,7 @@ void CHuiDisplay::DrawForegroundTexture() { - if (iForegroundTexture) + if (iForegroundTexture && !RosterImpl().IsVisibleContentFrozen() ) { THuiQuality originalQuality = iGc->Quality(); if ( originalQuality != EHuiQualityFast ) diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -346,6 +346,9 @@ CHuiEnv::~CHuiEnv() { + iSynchObservers.Close(); + iSynchIds.Close(); + iActionObservers.Close(); // Destroy groups in reverse order so that references will be removed @@ -1772,9 +1775,17 @@ EXPORT_C void CHuiEnv::Synchronize(TInt aId, MHuiSynchronizationObserver* aObserver) { - iSynchObserver = aObserver; - iSynchId = aId; - + TInt err = iSynchObservers.Append(aObserver); + if(err) + { + return; + } + err = iSynchIds.Append(aId); + if(err ) + { + iSynchObservers.Remove(iSynchObservers.Count()-1); + return; + } if ( aObserver ) { ContinueRefresh(); @@ -1783,7 +1794,7 @@ void CHuiEnv::DoSynchronize() { - if ( !iSynchObserver ) + if ( iSynchObservers.Count() == 0) { return; } @@ -1799,8 +1810,13 @@ } } - iSynchObserver->Synchronized( iSynchId ); - iSynchObserver = NULL; + TUint observersCount = iSynchObservers.Count()-1; + for(TInt u = observersCount; u >= 0 ; u-- ) + { + iSynchObservers[u]->Synchronized( iSynchIds[u] ); + iSynchObservers.Remove(u); + iSynchIds.Remove(u); + } } void CHuiEnv::RemoveTheControlGroup(TInt aId) diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -82,6 +82,13 @@ ReleaseCachedRenderTarget(); iEngine->RemoveEffect(this); + if (iEngine && iGroupId != KErrNotFound) + { + // if effect was deleted before it was drawn, the group must be notified. If this was the last effect in the group + // the group will be removed by the EffectReadyToStart + iEngine->NotifyEffectReady(iGroupId); + } + #ifdef HUIFX_TRACE RDebug::Print(_L("CHuiFxEffect::~CHuiFxEffect - 0x%x"), this); #endif @@ -308,7 +315,9 @@ } // Write cached buffer to the display - iEngine->Composite(aGc, *iCachedRenderTarget, targetRect.iTl, aOpaque && !(EffectFlags() & KHuiFxAlwaysBlend), aAlpha); + + iEngine->Composite(aGc, *iCachedRenderTarget, targetRect.iTl, aOpaque && !(EffectFlags() & KHuiFxAlwaysBlend), aAlpha); + if (aClipRegion.Count()) { @@ -442,6 +451,16 @@ iFlags = aFlags; } +void CHuiFxEffect::SetEffectFlag( TInt aFlag ) + { + iFlags |= aFlag; + } + +void CHuiFxEffect::ClearEffectFlag( TInt aFlag ) + { + iFlags &= ~aFlag; + } + EXPORT_C void CHuiFxEffect::SetEffectGroup(TInt aGroupId) { iGroupId = aGroupId; @@ -462,16 +481,31 @@ if (iFlags & KHuiFxDelayRunUntilFirstFrameHasBeenDrawn) { if (iFramesDrawn) - { + { + if (iFlags & KHuiFxReadyAndWaitingGroupToStartSyncronized) + { + // this has drawn atleast once, but all the effect in this group have not drawn. Must hang on little more. + return; + } + + if (iFlags & KHuiFxWaitGroupToStartSyncronized) + { + // Group has been started, waiting the others in the group to be drawn + SetEffectFlag(KHuiFxReadyAndWaitingGroupToStartSyncronized); + ClearEffectFlag(KHuiFxWaitGroupToStartSyncronized); + // NotifyEffectReady will clear KHuiFxReadyAndWaitingGroupToStartSyncronized flag + // if all items in the group are ready. + iEngine->NotifyEffectReady(iGroupId); + return; + } + if (iFramesDrawn == 1) { aElapsedTime = 0; iFramesDrawn++; } - iRoot->AdvanceTime(aElapsedTime); - } - else - { + + iRoot->AdvanceTime(aElapsedTime); } } else diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiFxEngine.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEngine.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEngine.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -66,6 +66,7 @@ #endif #endif CHuiStatic::Env().AddMemoryLevelObserver(this); + iActiveEffectGroups.Reserve(2); } EXPORT_C TBool CHuiFxEngine::FxmlUsesInput1(const TDesC &aFileName) @@ -302,6 +303,7 @@ // the effect will be removed, and will no longer be part of iActiveEffects set. // We must check if the effect is still in our list, but the indices change // if something is removed from the middle of the list + TInt skipGroup = KErrNotFound; for ( i = iActiveEffects.Count() - 1; i >= 0; i-- ) { CHuiFxEffect* effect = iActiveEffects[i]; @@ -309,10 +311,24 @@ { refreshRequired = ETrue; } - if ( i < iActiveEffects.Count() && effect == iActiveEffects[i] && !(effect->EffectFlags() & KHuiFxWaitGroupSyncronization)) + TInt flags = effect->EffectFlags(); + if ( !(flags & KHuiFxWaitGroupSyncronization) + && (skipGroup == KErrNotFound || skipGroup != effect->GroupId())) { // The effect is still in its place, it did not go away yet + TBool waitingGroupBefore = flags & KHuiFxWaitGroupToStartSyncronized; effect->AdvanceTime(aElapsedTime); + + if (waitingGroupBefore) + { + flags = effect->EffectFlags(); + if (!(flags & KHuiFxReadyAndWaitingGroupToStartSyncronized) && !(flags & KHuiFxWaitGroupToStartSyncronized)) + { + // effects in this group are all ready to start drawing. Skip this group in AdvanceTime, + // that they can start syncronized on the next round + skipGroup = effect->GroupId(); + } + } } } @@ -626,48 +642,123 @@ ASSERT(iBuffersInCache == 0); } - + +TInt CHuiFxEngine::FindEffectGroup(TInt aGroup) + { + for (TInt i=0 ; i < iActiveEffectGroups.Count();i++) + { + if (iActiveEffectGroups[i].iGroup == aGroup) + { + return i; + } + } + return KErrNotFound; + } + EXPORT_C void CHuiFxEngine::BeginGroupEffect(TInt aGroup) { - TInt index = iActiveEffectGroups.Find(aGroup); + // Multiple grouped effects at the same time are not supported. + // Same visual might participate different groups, which will mess up the effect + if (iActiveEffectGroups.Count()>0) + { + // delete previous groups + while(iActiveEffectGroups.Count()) + { + TInt groupId = iActiveEffectGroups[0].iGroup; + for ( TInt i = iActiveEffects.Count() - 1; i >= 0; i-- ) + { + if (iActiveEffects[i]->GroupId() == groupId) + { + iActiveEffects[i]->ClearEffectFlag(KHuiFxReadyAndWaitingGroupToStartSyncronized); + iActiveEffects[i]->ClearEffectFlag(KHuiFxWaitGroupToStartSyncronized); + iActiveEffects[i]->ClearEffectFlag(KHuiFxWaitGroupSyncronization); + } + + } + iActiveEffectGroups.Remove(0); + } + } + + TInt index = FindEffectGroup(aGroup); + if (index == KErrNotFound) { - iActiveEffectGroups.Append(aGroup); - } - else - { - // group already exists + const TEffectGroupStruct item(aGroup); + iActiveEffectGroups.Append(item); } } +// This will add effect to this group. Do not call this function more than once for single effect EXPORT_C TInt CHuiFxEngine::ActiveGroupEffect() { - if (iActiveEffectGroups.Count() > 0) - { - return iActiveEffectGroups[iActiveEffectGroups.Count()-1]; - } - else - { - return KErrNotFound; - } + TInt index = iActiveEffectGroups.Count(); + if (index == 0) + { + return KErrNotFound; + } + while(--index >= 0) + { + // group is alive until all its effects have been drawn once. .iEndCalled is to prevent + // another effect entering into this group + const TEffectGroupStruct& item = iActiveEffectGroups[index]; + if (!item.iEndCalled) + { + return iActiveEffectGroups[index].iGroup; + } + } + return KErrNotFound; } +EXPORT_C TBool CHuiFxEngine::AddEffectToGroup(TInt aGroup) + { + TInt index = FindEffectGroup(aGroup); + if (index != KErrNotFound) + { + // keep count of effects in this group. All must draw atleast once, before + // syncronized group effect may start + iActiveEffectGroups[index].iWaiting++; + return ETrue; + } + return EFalse; + } + EXPORT_C void CHuiFxEngine::StartGroupEffect(TInt aGroup) { - TInt index = iActiveEffectGroups.Find(aGroup); + TInt index = FindEffectGroup(aGroup); if (index != KErrNotFound) { - iActiveEffectGroups.Remove(index); - + iActiveEffectGroups[index].iEndCalled = ETrue; // this group will not take any more participants for ( TInt i = iActiveEffects.Count() - 1; i >= 0; i-- ) { CHuiFxEffect* effect = iActiveEffects[i]; TInt flags = effect->EffectFlags(); if ((flags & KHuiFxWaitGroupSyncronization) && (effect->GroupId() == aGroup)) { - flags &= ~KHuiFxWaitGroupSyncronization; - effect->SetEffectFlags(flags); + effect->ClearEffectFlag(KHuiFxWaitGroupSyncronization); + effect->SetEffectFlag(KHuiFxWaitGroupToStartSyncronized); } } } } + +void CHuiFxEngine::NotifyEffectReady(TInt aGroupId) + { + TInt index = FindEffectGroup(aGroupId); + if (index != KErrNotFound) + { + if (--iActiveEffectGroups[iActiveEffectGroups.Count()-1].iWaiting == 0) + { + // set in motion all effects in this group + iActiveEffectGroups.Remove(index); + for ( TInt i = iActiveEffects.Count() - 1; i >= 0; i-- ) + { + CHuiFxEffect* effect = iActiveEffects[i]; + TInt flags = effect->EffectFlags(); + if ((flags & KHuiFxReadyAndWaitingGroupToStartSyncronized) && (effect->GroupId() == aGroupId)) + { + effect->ClearEffectFlag(KHuiFxReadyAndWaitingGroupToStartSyncronized); + } + } + } + } + } diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -60,6 +60,11 @@ CHuiRosterImpl::~CHuiRosterImpl() { + if (iDisplay) + { + iDisplay->Env().RemoveMemoryLevelObserver(this); + } + FreezeVisibleContentL(EFalse); delete iLongTapDetector; @@ -530,7 +535,7 @@ ASSERT(display!=NULL); - if (iCanvasRenderBuffer && iCanvasGc) + if (IsVisibleContentFrozen()) { DrawSelfFrozen(aGc, display); return; @@ -1621,19 +1626,30 @@ void CHuiRosterImpl::FreezeVisibleContentL(TBool aEnable) { + iRosterIsFrozen = aEnable; + + if (aEnable && !iMonitorMemoryLevel && iDisplay) + { + iDisplay->Env().AddMemoryLevelObserver(this); + iMonitorMemoryLevel = ETrue; + } + if (aEnable) { - if (!iCanvasGc) + if (UseRenderBufferForFreeze()) { - CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer(); - iCanvasGc = renderplugin.CreateCanvasGcL(); - } - if (!iCanvasRenderBuffer) - { - iCanvasRenderBuffer = iCanvasGc->CreateRenderBufferL(TSize(0,0)); - iCanvasRenderBuffer->InitializeL(CHuiStatic::Env().Display(0).VisibleArea().Size()); - iCanvasRenderBuffer->Copy(TPoint(0,0)); - iCanvasRenderBufferOrientation = CHuiStatic::Env().Display(0).Orientation(); + if (!iCanvasGc) + { + CHuiRenderPlugin& renderplugin = CHuiStatic::Renderer(); + iCanvasGc = renderplugin.CreateCanvasGcL(); + } + if (!iCanvasRenderBuffer) + { + iCanvasRenderBuffer = iCanvasGc->CreateRenderBufferL(TSize(0,0)); + iCanvasRenderBuffer->InitializeL(CHuiStatic::Env().Display(0).VisibleArea().Size()); + iCanvasRenderBuffer->Copy(TPoint(0,0)); + iCanvasRenderBufferOrientation = CHuiStatic::Env().Display(0).Orientation(); + } } } else @@ -1648,7 +1664,7 @@ TBool CHuiRosterImpl::IsVisibleContentFrozen() const { - return ((iCanvasRenderBuffer != NULL) && (iCanvasGc != NULL)); + return iRosterIsFrozen; } void CHuiRosterImpl::EffectSetEffect(CHuiFxEffect* aEffect) @@ -1707,3 +1723,20 @@ { return iIsInput1; } + +void CHuiRosterImpl::SetMemoryLevel(THuiMemoryLevel /*aLevel*/) + { + if ( IsVisibleContentFrozen() && !UseRenderBufferForFreeze() ) + { + // Release render buffer if we are not supposed to use. + delete iCanvasGc; + iCanvasGc = NULL; + delete iCanvasRenderBuffer; + iCanvasRenderBuffer = NULL; + } + } + +TBool CHuiRosterImpl::UseRenderBufferForFreeze() const + { + return !iDisplay || !( iDisplay->Env().MemoryLevel() <= EHuiMemoryLevelLowest ); + } diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -32,7 +32,7 @@ #include #include "huiskinbackroundlayout.h" - +#include "huiextension.h" struct TBackgroundTexture { @@ -188,12 +188,19 @@ EXPORT_C void CHuiS60Skin::SkinContentChanged() { - FreeAllBackgroundTextureResources(); + } EXPORT_C void CHuiS60Skin::SkinConfigurationChanged( const TAknsSkinStatusConfigurationChangeReason aReason ) { + if (aReason == EAknsSkinStatusConfigurationDeployed) + { + FreeAllBackgroundTextureResources(); + Env().NotifySkinChangedL(); + Env().TextStyleManager().NotifyDisplaySizeChangedL(); + ReloadBgTexturesL(); + } } @@ -250,11 +257,8 @@ EXPORT_C void CHuiS60Skin::NotifyDisplaySizeChangedL() { // The background is now different. - SkinContentChanged(); // to delete old contents + SkinConfigurationChanged(EAknsSkinStatusConfigurationDeployed); - Env().NotifySkinChangedL(); - Env().TextStyleManager().NotifyDisplaySizeChangedL(); - ReloadBgTexturesL(); } @@ -292,7 +296,14 @@ EXPORT_C void CHuiS60Skin::SkinExtension(const TUid& aExtensionUid, TAny** aExtensionParameters) { - CHuiSkin::SkinExtension(aExtensionUid,aExtensionParameters); + if (aExtensionUid == KHuiSkinReleaseCachedTextures) + { + FreeAllBackgroundTextureResources(); + } + else + { + CHuiSkin::SkinExtension(aExtensionUid, aExtensionParameters); + } } EXPORT_C THuiSkinOrientation CHuiS60Skin::Orientation() const @@ -509,7 +520,7 @@ bgTexture = ((TPrivData*)(iSpare))->iBackgrounds[index]; if (bgTexture.iID == aID) { - if(!bgTexture.iBackgroundTexture && !bgTexture.iBackgroundTexture->HasContent()) + if(!bgTexture.iBackgroundTexture || !bgTexture.iBackgroundTexture->HasContent()) { delete bgTexture.iBackgroundTexture; bgTexture.iBackgroundTexture = NULL; diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiSkin.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiSkin.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiSkin.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -27,6 +27,7 @@ #include "uiacceltk/HuiUtil.h" #include "uiacceltk/HuiPanic.h" #include "uiacceltk/HuiDisplay.h" +#include "huiextension.h" CHuiSkin::CHuiSkin(CHuiEnv& aEnv) : iEnv(aEnv) @@ -192,6 +193,10 @@ return err; } +void CHuiSkin::ReleaseCachedTextures() + { + SkinExtension(KHuiSkinReleaseCachedTextures, NULL); + } void CHuiSkin::PrepareShadowTextureL(CHuiTexture& aTexture) { diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -390,6 +390,14 @@ iChangeNotifier->Start(); #ifndef __WINSCW__ globalWriteableData = *iData; + #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF + // For testing purposes, test data needs to be included into TLS + // because test cases require information stored in TLS. + if ( !Dll::Tls() ) + { + Dll::SetTls( iData ); + } + #endif #else Dll::SetTls(iData); #endif @@ -417,7 +425,7 @@ } iChangeNotifier->Cancel(); delete iChangeNotifier; -#ifdef __WINSCW__ +#if defined( __WINSCW__ ) || defined( USE_MODULE_TEST_HOOKS_FOR_ALF ) Dll::FreeTls(); #endif delete iData; diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/huicanvasgc.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvasgc.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvasgc.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -34,6 +34,15 @@ #include +#include "alfmoduletestconf.h" +#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF + // Provides TLS object data for test cases. + // This is used only if module test hooks are set on. + #include "huistatictlsdata.h" +#endif // USE_MODULE_TEST_HOOKS_FOR_ALF +// Provides module test hook defines. +#include "alfmoduletestdefines.h" + EXPORT_C CHuiCanvasGc::CHuiCanvasGc(): iPenColor(KRgbBlack), @@ -44,7 +53,7 @@ iHorizontalTextAlign(EHuiAlignHLeft), iTextStyleId(EHuiTextStyleNormal), iEffectiveOpacityEnabled(ETrue) - { + { } EXPORT_C CHuiCanvasGc::~CHuiCanvasGc() @@ -673,6 +682,10 @@ { iGc->DrawRect(rect); } + + AMT_MAP_INC_VALUE_IF( iVisual, iIntMap, + AMT_MAP_CPTR_TO_KEY_CAST( iVisual ), + EAlfModuleTestTypeCoreToolkitDrawWindow ); } } } @@ -1346,7 +1359,11 @@ DisableDelayedClippingIfNeeded(); - Cleanup(); + Cleanup(); + + AMT_MAP_INC_VALUE_IF( iVisual, iIntMap, + AMT_MAP_CPTR_TO_KEY_CAST( iVisual ), + EAlfModuleTestTypeCoreToolkitDrawFromRenderBuffer ); } EXPORT_C void CHuiCanvasGc::ClearRenderBuffer( CHuiCanvasRenderBuffer& aImage, const TRect & aRect ) diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -557,8 +557,8 @@ else if (iWsBrushStyle == MWsGraphicsContext::EPatternedBrush) { iCanvasGc->SetPolygonDrawMode( EHuiFillEvenOdd ); - iCanvasGc->SetPenColor(iWsPenColor); - iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f)); + iCanvasGc->SetPenColor(iWsBrushColor); + iCanvasGc->SetOpacity(TReal32(iWsBrushColor.Alpha() / 255.f)); UseBrushPattern(); iCanvasGc->SetDrawMode(SelectCanvasDrawMode(iWsDrawMode)); iCanvasGc->DrawRoundRect( THuiRealRect(aRect), THuiRealSize( aPoint.iX*2, aPoint.iY*2 )); @@ -731,8 +731,8 @@ else if (iWsBrushStyle == MWsGraphicsContext::EPatternedBrush) { iCanvasGc->SetPolygonDrawMode( EHuiFillEvenOdd ); - iCanvasGc->SetPenColor(iWsPenColor); - iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f)); + iCanvasGc->SetPenColor(iWsBrushColor); + iCanvasGc->SetOpacity(TReal32(iWsBrushColor.Alpha() / 255.f)); UseBrushPattern(); iCanvasGc->SetDrawMode(SelectCanvasDrawMode(iWsDrawMode)); iCanvasGc->DrawEllipse(destRect); @@ -881,8 +881,8 @@ else if (iWsBrushStyle == MWsGraphicsContext::EPatternedBrush) { iCanvasGc->SetPolygonDrawMode( EHuiFillEvenOdd ); - iCanvasGc->SetPenColor(iWsPenColor); - iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f)); + iCanvasGc->SetPenColor(iWsBrushColor); + iCanvasGc->SetOpacity(TReal32(iWsBrushColor.Alpha() / 255.f)); UseBrushPattern(); iCanvasGc->SetDrawMode(SelectCanvasDrawMode(iWsDrawMode)); iCanvasGc->DrawRects(rects); diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -925,6 +925,12 @@ case EAlfClearRect: { commandBuffer->SetStatusFlags(EHuiCanvasBufferContainsDrawing); + TRgb transpclearcolor(KRgbWhite); + transpclearcolor.SetAlpha(0); + if (iBrushColor == transpclearcolor) + { + commandBuffer->SetStatusFlags(EHuiCanvasBufferContainsTransparentClear); + } WsClearRectL(); break; } @@ -1892,6 +1898,7 @@ #ifdef __ALF_SYMBIAN_RWINDOW_CLEARING_BUG_WORKAROUND__ iTestBrushColor.SetInternal(0); #endif + iBrushColor.SetInternal(0); } void CHuiCanvasWsPainter::WsSetBrushColorL() @@ -1903,6 +1910,7 @@ #ifdef __ALF_SYMBIAN_RWINDOW_CLEARING_BUG_WORKAROUND__ iTestBrushColor = color; #endif + iBrushColor = color; } void CHuiCanvasWsPainter::WsSetBrushOriginL() diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/goommonitor/data/goomconfig.xml --- a/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml Wed Mar 31 23:03:58 2010 +0300 @@ -27,7 +27,7 @@ --> - + diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/goommonitor/inc/goomrunplugin.inl --- a/uiacceltk/hitchcock/goommonitor/inc/goomrunplugin.inl Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/goommonitor/inc/goomrunplugin.inl Wed Mar 31 23:03:58 2010 +0300 @@ -31,7 +31,12 @@ inline TBool CGOomRunPlugin::IsRunning() { - return iPluginWaiter->IsActive(); + if(iPluginWaiter) + { + return iPluginWaiter->IsActive(); + } + + return EFalse; } inline void CGOomRunPlugin::WaitCompleted() diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -324,7 +324,7 @@ if (iFreeingMemory) { - TRACES("OOMWATCHER:CGOomActionList::FreeMemory Memory is currently being freed, do not start any more actions"); + TRACES("GOOMWATCHER:CGOomActionList::FreeMemory Memory is currently being freed, do not start any more actions"); return; } @@ -339,6 +339,8 @@ TInt memoryEstimate = iMonitor.GetFreeMemory(); // The amount of free memory we expect to be free after the currently initiated operations + TRACES2("GOOMWATCHER:CGOomActionList::FreeMemory Memory currentActionIndex %d iActionrefsCount %d", iCurrentActionIndex, iActionRefs.Count()); + while (iCurrentActionIndex < iActionRefs.Count()) { if(iActionRefs[iCurrentActionIndex].Priority() > aMaxPriority) @@ -360,6 +362,8 @@ TInt32 fgApp = wgName->AppUid().iUid; TInt32 appId = iMonitor.GetWindowGroupList()->AppIdfromWgId(ref.WgId(), ETrue); + + CleanupStack::PopAndDestroy(); if(appId == fgApp) { TRACES1("Foreground App wgid %x, spared by GOOM", appId); @@ -404,11 +408,18 @@ // Also check if we estimate that we have already freed enough memory (assuming that the sync mode is "estimate" { // Return from the loop - we will be called back (in CGOomActionList::StateChanged()) when the running actions complete + iCurrentActionIndex++; TRACES("CGOomActionList::FreeMemory: Exiting run action loop"); return; } // ... otherwise continue running actions, don't wait for any existing ones to complete iCurrentActionIndex++; + + if (iCurrentActionIndex >= iActionRefs.Count()) + { + StateChanged(); + return; + } } @@ -610,7 +621,6 @@ { TRACES2("CGOomActionList::StateChanged: Finished Action %d out of %d",iCurrentActionIndex, iActionRefs.Count()); - iCurrentActionIndex++; if (iCurrentActionIndex >= iActionRefs.Count()) { diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -231,7 +231,7 @@ TRACES1("FreeMemThresholdCrossedL : crossed low threshold %d", iLowThreshold); iMemAllocationsGrowing->Stop(); iMemAllocationsGoingDown->Continue(); - if(iTrigger == EGOomTriggerNone) + if((iTrigger == EGOomTriggerNone) && !NeedToPostponeMemGood() && !iSynchTimer->IsActive() ) StartFreeSomeRamL(iGoodThreshold, EGOomTriggerThresholdCrossed); } #endif @@ -251,9 +251,11 @@ // Refresh the low and good memory thresholds as they may have changed due to the new foreground application RefreshThresholds(aForegroundAppUid); - // Not very elegant, now we poll on each window group change - // Should have better trigger e.g. from window server - StartFreeSomeRamL(iCurrentTarget, EGOomTriggerFocusChanged); + + if(iCurrentTarget) + { + StartFreeSomeRamL(iCurrentTarget, EGOomTriggerFocusChanged); + } } void CMemoryMonitor::StartFreeSomeRamL(TInt aTargetFree, TInt aMaxPriority, TGOomTrigger aTrigger) // The maximum priority of action to run @@ -379,8 +381,8 @@ // Calculate the desired good threshold, this could be the globally configured value... iGoodThreshold = CMemoryMonitor::GlobalConfig().iGoodRamThreshold; iLowThreshold = CMemoryMonitor::GlobalConfig().iLowRamThreshold; - if(iCurrentTarget < iLowThreshold) - iCurrentTarget = iLowThreshold; + //if(iCurrentTarget < iLowThreshold) + // iCurrentTarget = iLowThreshold; TRACES2("CMemoryMonitor::RefreshThresholds: Global Good Threshold = %d, Global Low Threshold = %d", iGoodThreshold, iLowThreshold); diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitorsession.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -94,6 +94,7 @@ if (err) { // completes the message if that was left to pending + TRACES1("Error in RequestFreeMemory %d", err); CloseAppsFinished(0, EFalse); } } diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/goommonitor/src/goomrunplugin.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -52,7 +52,10 @@ iFreeMemoryCalled = ETrue; // Wait for the required time before we signal completion. - iPluginWaiter->Start(); + if(iPluginWaiter) + { + iPluginWaiter->Start(); + } } // Call the memory good function on the plugin but... @@ -86,13 +89,15 @@ TInt waitDuration = CMemoryMonitor::GlobalConfig().iDefaultWaitAfterPlugin; - if (aPluginConfig.WaitAfterPluginDefined()) + if(aPluginConfig.iSyncMode == ECheckRam) { - // If the wait duration for this plugin is overridden then use the overridden value - waitDuration = aPluginConfig.WaitAfterPlugin(); + if (aPluginConfig.WaitAfterPluginDefined()) + { + // If the wait duration for this plugin is overridden then use the overridden value + waitDuration = aPluginConfig.WaitAfterPlugin(); + } + iPluginWaiter = CGOomPluginWaiter::NewL(waitDuration, *this); } - - iPluginWaiter = CGOomPluginWaiter::NewL(waitDuration, *this); } TUint CGOomRunPlugin::Id() diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp --- a/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -76,12 +76,13 @@ User::LeaveIfError(iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&iLowOnMemWgs)); RArray& inactiveSurfaces = iLowOnMemWgs; - + TRACES1("Inactive surfaces count %d", inactiveSurfaces.Count()); RArray processIds; RArray privMemUsed; + RArray sparedProcessIds; - if (inactiveSurfaces.Count() == 1) // ALF only - { + //if (inactiveSurfaces.Count() == 1) // ALF only + // { NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK"); if (!eglQueryProfilingData) @@ -93,9 +94,6 @@ EGLint data_count; EGLint* prof_data; TInt i(0); - RArray processIds; - RArray privMemUsed; - RArray systemProcessIds; EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); @@ -148,6 +146,8 @@ TRACES1("Memory Usage by app is %d", mem); if(mem > KAllowedMemUsageForApps) processIds.Append(process_id); + else + sparedProcessIds.Append(process_id); i++; break; @@ -181,7 +181,7 @@ // Optimization, no need to construct list if ALF is the only one /////////////////////////////////////////////////////////////////// - if (processIds.Count() == 1) + if( (processIds.Count() == 1) && (inactiveSurfaces.Count() == 1)) { RProcess process; TInt err = process.Open(processIds[0]); @@ -192,12 +192,13 @@ if(secureId == 0x10003B20) // magic, wserv { processIds.Close(); + privMemUsed.Close(); TRACES("Only WServ using GFX mem, no need for app actions"); return; } } } - } + // } // Refresh window group list // get all window groups, with info about parents @@ -250,11 +251,12 @@ while (index--) { //Remove if process is not in list of processes using gfx mem + TUint secureId = AppId(index,ETrue); TBool found = 0; - TInt i = 0; + TInt i = 0; + //todo - do we really need to check this list , when we have all ids in inactiveSurfaces[] for(i = 0; i < processIds.Count(); i++) { - TUint secureId = AppId(index,ETrue); RProcess process; TInt er = process.Open(processIds[i]); if(er != KErrNone) @@ -274,31 +276,59 @@ } process.Close(); } - TRACES1("Checking WG ID : %d", iWgIds[index].iId); - for(TInt ii = 0; ii < inactiveSurfaces.Count(); ii++) - { - if (iWgIds[index].iId == inactiveSurfaces[ii] ) - { - AppId(index,EFalse); // update iWgName for found only - found = ETrue; - TRACES2("Found %d isSystem: %d",inactiveSurfaces[ii], iWgName->IsSystem()) - } + + if(!found) + { + TRACES1("Checking WG ID : %d", iWgIds[index].iId); + for(TInt ii = 0; ii < inactiveSurfaces.Count(); ii++) + { + if (iWgIds[index].iId == inactiveSurfaces[ii] ) + { + found = ETrue; + TRACES3("Found %d , AppId %x, isSystem: %d",inactiveSurfaces[ii], secureId, iWgName->IsSystem()) + } + } } - if(!found || iWgName->IsSystem()) + if(!found) { iWgIds.Remove(index); continue; } + + //check if it is system app + if(iWgName->IsSystem() /*|| iWgName->Hidden()*/) + { + TRACES3("System/Hidden app found %x, ISystem %d, IsHidden %d",secureId, iWgName->IsSystem()?1:0, iWgName->Hidden()?1:0); + sparedProcessIds.Append(secureId); + } + } - - processIds.Close(); + inactiveSurfaces.Close(); + //CleanupStack::PopAndDestroy(); // CleanupClosePushL(inactiveSurfaces); + processIds.Close(); privMemUsed.Close(); + //check if any system apps are included index = iWgIds.Count(); while (index--) { + TBool skipped = EFalse; + for(TInt i = 0; i < sparedProcessIds.Count(); i++) + { + if(AppId(index,ETrue) == sparedProcessIds[i]) + { + TRACES2("WgId %d belongs to system app %x. Removing from Kill List",iWgIds[index].iId, sparedProcessIds[i]); + iWgIds.Remove(index); + skipped = ETrue; + break; + } + } + + if(skipped) + continue; + // See if there is a tick count entry for each window in the list TGOomWindowGroupProperties* wgProperties = iWgToPropertiesMapping.Find(iWgIds[index].iId); @@ -311,6 +341,7 @@ } } TRACES1("Number of applications using graphics mem: %d", iWgIds.Count()); + sparedProcessIds.Close(); } diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/group/bld.inf --- a/uiacceltk/hitchcock/group/bld.inf Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/group/bld.inf Wed Mar 31 23:03:58 2010 +0300 @@ -12,7 +12,7 @@ * Contributors: * * Description: Build information file for project alfappserver -* Version : %version: tr1sido#128.1.9 % +* Version : %version: tr1sido#128.1.10 % * */ @@ -39,7 +39,7 @@ // separate keyword definitions for appear and disappera effects for control transitions. // After effect system is complete and aknskins has taken over the correct 101f84b9.sel file // and manifest.mf file, we should no longer export these files. - +#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS ../coretoolkit/data/101f84b9.sel /epoc32/data/z/resource/skins/101f84b9/101f84b9.sel ../coretoolkit/data/101f84b9.sel /epoc32/release/winscw/udeb/z/resource/skins/101f84b9/101f84b9.sel ../coretoolkit/data/101f84b9.sel /epoc32/release/winscw/urel/z/resource/skins/101f84b9/101f84b9.sel @@ -60,6 +60,8 @@ // /resource/effects/ directory. // These files can be changed any time and reregistered by changing the skin +#endif // #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + // backround animation shaders ../backgroundanim/refplugin/data/refvertexshader.vsh /epoc32/data/z/private/200286D3/refvertexshader.vsh ../backgroundanim/refplugin/data/reffragmentshader.fsh /epoc32/data/z/private/200286D3/reffragmentshader.fsh @@ -84,9 +86,12 @@ ../AlfHintPlugin/group/AlfHintPlugin.mmp ../AlfHintPlugin/group/AlfHintPluginDrawer.mmp +#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS ../plugins/alftranseffect/alftranseffectplugin/group/alftranseffectplugin.mmp ../plugins/alftranseffect/alftfxserverplugin/group/AlfTfxSrvPlugin.mmp ../plugins/alftranseffect/alfgfxtransadapter/group/gfxtransenginetfx.mmp +#endif // #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS + ../plugins/alfoogmplugin/group/alfoogmplugin.mmp ../plugins/alfcrpplugin/group/alfcrpplugin.mmp diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/group/core_exports.inc --- a/uiacceltk/hitchcock/group/core_exports.inc Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/group/core_exports.inc Wed Mar 31 23:03:58 2010 +0300 @@ -3,7 +3,7 @@ * Name : core_exports.inc * Part of : Alfred UI Toolkit * Description : Exported header files. -* Version : %version: tr1sido#8.1.31 % +* Version : %version: tr1sido#8.1.34 % * * Copyright © 2006-2007 Nokia. All rights reserved. * This material, including documentation and any related computer @@ -19,7 +19,7 @@ PRJ_EXPORTS - +#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS // Effect definitions are considered as differentiating SW and thus not available for foundation. #ifndef ALF_USE_OPENWF_COMPOSITION @@ -33,7 +33,8 @@ // for EMULATOR UREL ../coretoolkit/data/activeidle_viewswitch_add_page.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_add_page.fxml -../coretoolkit/data/activeidle_viewswitch_bg_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_bg_appear.fxml +../coretoolkit/data/activeidle_viewswitch_bg_anim_to_image.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_bg_anim_to_image.fxml +../coretoolkit/data/activeidle_viewswitch_bg_image_to_image.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_bg_image_to_image.fxml ../coretoolkit/data/activeidle_viewswitch_close_editmode.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_close_editmode.fxml ../coretoolkit/data/activeidle_viewswitch_close_widgetmanager.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_close_widgetmanager.fxml ../coretoolkit/data/activeidle_viewswitch_left.fxml /epoc32/release/winscw/urel/z/resource/effects/activeidle_viewswitch_left.fxml @@ -85,6 +86,10 @@ ../coretoolkit/data/optionsmenu_cascade_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/optionsmenu_cascade_appear.fxml ../coretoolkit/data/optionsmenu_cascade_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/optionsmenu_cascade_disappear.fxml ../coretoolkit/data/optionsmenu_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/optionsmenu_disappear.fxml +../coretoolkit/data/photos_fullscreen_close.fxml /epoc32/release/winscw/urel/z/resource/effects/photos_fullscreen_close.fxml +../coretoolkit/data/photos_fullscreen_open.fxml /epoc32/release/winscw/urel/z/resource/effects/photos_fullscreen_open.fxml +../coretoolkit/data/photos_gridview_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/photos_gridview_disappear.fxml +../coretoolkit/data/photos_gridview_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/photos_gridview_appear.fxml ../coretoolkit/data/popup_appear.fxml /epoc32/release/winscw/urel/z/resource/effects/popup_appear.fxml ../coretoolkit/data/popup_disappear.fxml /epoc32/release/winscw/urel/z/resource/effects/popup_disappear.fxml ../coretoolkit/data/popup_disappear_screenshot.fxml /epoc32/release/winscw/urel/z/resource/effects/popup_disappear_screenshot.fxml @@ -117,7 +122,8 @@ // for EMULATOR UDEB ../coretoolkit/data/activeidle_viewswitch_add_page.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_add_page.fxml -../coretoolkit/data/activeidle_viewswitch_bg_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_bg_appear.fxml +../coretoolkit/data/activeidle_viewswitch_bg_anim_to_image.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_bg_anim_to_image.fxml +../coretoolkit/data/activeidle_viewswitch_bg_image_to_image.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_bg_image_to_image.fxml ../coretoolkit/data/activeidle_viewswitch_close_editmode.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_close_editmode.fxml ../coretoolkit/data/activeidle_viewswitch_close_widgetmanager.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_close_widgetmanager.fxml ../coretoolkit/data/activeidle_viewswitch_left.fxml /epoc32/release/winscw/udeb/z/resource/effects/activeidle_viewswitch_left.fxml @@ -169,6 +175,10 @@ ../coretoolkit/data/optionsmenu_cascade_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/optionsmenu_cascade_appear.fxml ../coretoolkit/data/optionsmenu_cascade_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/optionsmenu_cascade_disappear.fxml ../coretoolkit/data/optionsmenu_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/optionsmenu_disappear.fxml +../coretoolkit/data/photos_gridview_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/photos_gridview_appear.fxml +../coretoolkit/data/photos_gridview_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/photos_gridview_disappear.fxml +../coretoolkit/data/photos_fullscreen_close.fxml /epoc32/release/winscw/udeb/z/resource/effects/photos_fullscreen_close.fxml +../coretoolkit/data/photos_fullscreen_open.fxml /epoc32/release/winscw/udeb/z/resource/effects/photos_fullscreen_open.fxml ../coretoolkit/data/popup_appear.fxml /epoc32/release/winscw/udeb/z/resource/effects/popup_appear.fxml ../coretoolkit/data/popup_disappear.fxml /epoc32/release/winscw/udeb/z/resource/effects/popup_disappear.fxml ../coretoolkit/data/popup_disappear_screenshot.fxml /epoc32/release/winscw/udeb/z/resource/effects/popup_disappear_screenshot.fxml @@ -201,7 +211,8 @@ // For ROM ../coretoolkit/data/activeidle_viewswitch_add_page.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_add_page.fxml -../coretoolkit/data/activeidle_viewswitch_bg_appear.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_bg_appear.fxml +../coretoolkit/data/activeidle_viewswitch_bg_anim_to_image.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_bg_anim_to_image.fxml +../coretoolkit/data/activeidle_viewswitch_bg_image_to_image.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_bg_image_to_image.fxml ../coretoolkit/data/activeidle_viewswitch_close_editmode.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_close_editmode.fxml ../coretoolkit/data/activeidle_viewswitch_close_widgetmanager.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_close_widgetmanager.fxml ../coretoolkit/data/activeidle_viewswitch_left.fxml /epoc32/data/z/resource/effects/activeidle_viewswitch_left.fxml @@ -253,6 +264,10 @@ ../coretoolkit/data/optionsmenu_cascade_appear.fxml /epoc32/data/z/resource/effects/optionsmenu_cascade_appear.fxml ../coretoolkit/data/optionsmenu_cascade_disappear.fxml /epoc32/data/z/resource/effects/optionsmenu_cascade_disappear.fxml ../coretoolkit/data/optionsmenu_disappear.fxml /epoc32/data/z/resource/effects/optionsmenu_disappear.fxml +../coretoolkit/data/photos_gridview_appear.fxml /epoc32/data/z/resource/effects/photos_gridview_appear.fxml +../coretoolkit/data/photos_gridview_disappear.fxml /epoc32/data/z/resource/effects/photos_gridview_disappear.fxml +../coretoolkit/data/photos_fullscreen_close.fxml /epoc32/data/z/resource/effects/photos_fullscreen_close.fxml +../coretoolkit/data/photos_fullscreen_open.fxml /epoc32/data/z/resource/effects/photos_fullscreen_open.fxml ../coretoolkit/data/popup_appear.fxml /epoc32/data/z/resource/effects/popup_appear.fxml ../coretoolkit/data/popup_disappear.fxml /epoc32/data/z/resource/effects/popup_disappear.fxml ../coretoolkit/data/popup_disappear_screenshot.fxml /epoc32/data/z/resource/effects/popup_disappear_screenshot.fxml @@ -286,4 +301,4 @@ // Effect definitions are considered as differentiating SW and thus not available for foundation. #endif // ifndef ALF_USE_OPENWF_COMPOSITION - +#endif // #ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp --- a/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -456,12 +456,11 @@ case EPreBeginCapture: break; case EPostBeginCapture: - // If we get KGfxControlAppearAction, it is followed by StartTransition, - // but disappear action is not. Therefore we must handle it byself - // We use begin capture as trigger, as we assume that the control is still present - // at that time. After EPostBeginCapture it will probably be already gone. - // If we don't have plugin yet, there will be no transitions. - if ( action == KGfxControlDisappearAction && iHasPlugin && aKey && aKey->DrawableWindow()) + // Send control effect request to ALf. This is done immediately after call of + // GfxTransEffect::Begin(). This makes it possible (NOT QUARANTEENED) + // that effect request arrives to Alf before possible visiblity changes are made to + // the control. + if ( iHasPlugin && aKey && aKey->DrawableWindow()) { // We must generate our own transition as we won't be sending // iClient->TransitionFinished back. @@ -743,15 +742,7 @@ if( err == KErrNone ) { - if ( transdata->iAction != KGfxControlDisappearAction ) - { - // Disappear action was started by EPostBeginCapture event - TRAP( err, DoStartTransitionL( aHandle, transdata ) ); - } - else - { - __ALFFXLOGSTRING( "CGfxTransAdapterTfx::StartTransition called for disappear action" ); - } + __ALFFXLOGSTRING( "CGfxTransAdapterTfx::StartTransition called for disappear action. Do nothing." ); } // always finish the caller @@ -1264,7 +1255,7 @@ void CGfxTransAdapterTfx::GenerateTransitionL( const CCoeControl* aKey, const CTransitionData* aTransData) { - __ALFFXLOGSTRING("CGfxTransAdapterTfx::GenerateTransitionL >>"); + // We generate a transition call from begin capture for control exit transitions TPtr8 inPtr = iTransferBuffer->Des(); inPtr.Zero(); @@ -1275,6 +1266,13 @@ TInt windowGroup = aKey->DrawableWindow()->WindowGroupId(); TInt windowHandle = aKey->DrawableWindow()->ClientHandle(); + __ALFFXLOGSTRING4("CGfxTransAdapterTfx::GenerateTransitionL - Operation: MAlfGfxEffectPlugin::EBeginComponentTransition Action: %d, Uid: 0x%x, WindowGroup: %d, WindowHandle: %d >>", + aTransData->iAction, + aTransData->iUid.iUid, + windowGroup, + windowHandle + ); + inBuf.WriteInt32L( op ); inBuf.WriteUint32L( aTransData->iAction ); inBuf.WriteInt32L( aTransData->iUid.iUid ); diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfgfxeffects.h --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfgfxeffects.h Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfgfxeffects.h Wed Mar 31 23:03:58 2010 +0300 @@ -73,6 +73,9 @@ /** Cancel asynch message(s) from client */ void CancelMessage(TInt aMessageId); + + /** release message(s) from client */ + void ClientAboutToExit(TThreadId aClientId); /** * From CAlfWindowManager - not implemented diff -r 10534483575f -r 88b23e2e82e1 uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp Mon Mar 15 12:43:37 2010 +0200 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp Wed Mar 31 23:03:58 2010 +0300 @@ -250,6 +250,13 @@ #endif uid1 = TUid::Uid( inStream.ReadInt32L() ); + // hack to keep disapear viewswitch transitions popping on top of everything + // TODO: Remove when HS complies + if ((uid1.iUid == 0x102750F1 || uid1.iUid == 0x102750F2 ) && action == 4) + { + action = 5; + } + TInt windowGroup = inStream.ReadInt32L(); TInt windowHandle = inStream.ReadInt32L(); TBool nLayered = inStream.ReadInt32L(); @@ -983,4 +990,15 @@ delete buffer; } #endif + +void CAlfGfxEffects::ClientAboutToExit(TThreadId aClientId) + { + if (iPolicyHandler) + { + iPolicyHandler->RemoveClient( aClientId ); + } + } + + + // End of File