Revision: 201022 RCL_3
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Wed, 09 Jun 2010 10:41:25 +0300
branchRCL_3
changeset 34 3a60ebea00d0
parent 24 f93c875b566e
child 41 cd0ae4656946
Revision: 201022 Kit: 2010123
group/bld.inf
rom/alfred.iby
uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h
uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def
uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def
uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp
uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h
uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h
uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h
uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h
uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h
uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h
uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h
uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp
uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp
uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp
uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp
uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp
uiacceltk/hitchcock/ServerCore/Src/alfvisualhandlers.cpp
uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp
uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF
uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF
uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilter.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilterLayer.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxGroupLayer.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxLayer.h
uiacceltk/hitchcock/coretoolkit/inc/HuiFxVisualLayer.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BevelFilter.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BlurFilter.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10ColorMatrixFilterBase.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10FilterBase.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10OutlineFilter.h
uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10TransformFilter.h
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BevelFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BlurFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10ColorMatrixFilterBase.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10FilterBase.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10OutlineFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10TransformFilter.cpp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10RenderSurface.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxFilterLayer.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxGroupLayer.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxVisualLayer.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswsbitgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp
uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h
uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h
uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp
uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/inc/gfxtransenginetfx.h
uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp
--- a/group/bld.inf	Tue May 25 13:39:57 2010 +0300
+++ b/group/bld.inf	Wed Jun 09 10:41:25 2010 +0300
@@ -15,9 +15,9 @@
 *
 */
 
-// local
-//#define ALF_USE_OPENWF_COMPOSITION
-
+#ifdef SYMBIAN_GRAPHICS_BUILD_OPENWF_WSERV
+#define ALF_USE_OPENWF_COMPOSITION
+#endif
 
 #include "../uiaccelerator_plat/group/bld.inf"
 
--- a/rom/alfred.iby	Tue May 25 13:39:57 2010 +0300
+++ b/rom/alfred.iby	Wed Jun 09 10:41:25 2010 +0300
@@ -162,7 +162,7 @@
 data=DATAZ_/RESOURCE_FILES_DIR/effects/touchinput_close.fxml RESOURCE_FILES_DIR/effects/touchinput_close.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/touchinput_open.fxml RESOURCE_FILES_DIR/effects/touchinput_open.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left.fxml RESOURCE_FILES_DIR/effects/viewswitch_left.fxml
-data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left_appear.fxml RESOURCE_FILES_DIR/effects/viewswitch_left_appear2.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left_appear.fxml RESOURCE_FILES_DIR/effects/viewswitch_left_appear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left_disappear.fxml RESOURCE_FILES_DIR/effects/viewswitch_left_disappear.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_right.fxml RESOURCE_FILES_DIR/effects/viewswitch_right.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_right_appear.fxml RESOURCE_FILES_DIR/effects/viewswitch_right_appear.fxml
--- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h	Wed Jun 09 10:41:25 2010 +0300
@@ -33,6 +33,7 @@
 class CAlfAppSrvSessionBase;
 class CAlfSrvResourceManager;
 class CAlfSrvSettingsHandler;
+class RAlfBridgerClient;
 
 enum TAlfSrvSetting
     {
@@ -207,6 +208,7 @@
     void DoBlankScreen(const RMessage2& aMessage);
     
     TInt GetLastActiveClient();
+    RAlfBridgerClient* BridgerClient();
 
 private:
 
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h	Wed Jun 09 10:41:25 2010 +0300
@@ -449,8 +449,8 @@
     static TBool RecursiveIsExternalContentDrawingEnabled(CHuiVisual* aVisual);
     static TBool RecursiveHasCommandBuffers(CHuiVisual* aVisual);
     
-    void CollectPaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const;
-    void CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const;
+    TBool CollectPaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const;
+    TBool CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const;
     
     TBool CanSkipDrawing() const;
     TBool KeepNoCache() const;
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Wed Jun 09 10:41:25 2010 +0300
@@ -824,6 +824,7 @@
     void ScanningAlfContent(TBool aScanning );
     void SetAlfContentChanged(TBool aChanged);
     TBool AlfContentChanged();
+    TRect CurrentDirtyRect();
     
 private:
 
@@ -1034,6 +1035,8 @@
     
     /** Current dirty region for this refresh instance */
     RDirtyRegions iTempDirtyRegions;
+    TRect iCurrentDirtyRect;
+
     
 	/** For handling alf content update */
     TBool iScanningAlfContent;
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def	Wed Jun 09 10:41:25 2010 +0300
@@ -50,4 +50,5 @@
 	?SubscribeCallbackL@CAlfEffectObserver@@QAEXPAVMAlfEffectObserver@1@HH@Z @ 49 NONAME ; void CAlfEffectObserver::SubscribeCallbackL(class CAlfEffectObserver::MAlfEffectObserver *, int, int)
 	?GetListOfWindowGroupsWSurfaces@RAlfBridgerClient@@QAEHPAV?$RArray@H@@@Z @ 50 NONAME ; int RAlfBridgerClient::GetListOfWindowGroupsWSurfaces(class RArray<int> *)
 	?SetDistractionWindow@CAlfEffectObserver@@QAEXABVRWindowTreeNode@@H@Z @ 51 NONAME ; void CAlfEffectObserver::SetDistractionWindow(class RWindowTreeNode const &, int)
+	?GetOptionalGraphicsMemUsers@RAlfBridgerClient@@QAEXPAV?$RArray@H@@@Z @ 52 NONAME ; void RAlfBridgerClient::GetOptionalGraphicsMemUsers(class RArray<int> *)
 
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def	Wed Jun 09 10:41:25 2010 +0300
@@ -73,4 +73,5 @@
 	_ZN18CAlfEffectObserver18SubscribeCallbackLEPNS_18MAlfEffectObserverEii @ 72 NONAME
 	_ZN17RAlfBridgerClient30GetListOfWindowGroupsWSurfacesEP6RArrayIiE @ 73 NONAME
 	_ZN18CAlfEffectObserver20SetDistractionWindowERK15RWindowTreeNodei @ 74 NONAME
+	_ZN17RAlfBridgerClient27GetOptionalGraphicsMemUsersEP6RArrayIiE @ 75 NONAME
 
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -156,12 +156,14 @@
     SendReceive(aOp, aIPCArgs, aStatus );
     }
 
-TInt RAlfBridgerClient::GetListOfWindowGroups(RArray<TInt>* aWindowGroups, TBool aListAll)
+TInt RAlfBridgerClient::GetListOfWindowGroups(RArray<TInt>* aWindowGroups, TInt aType)
     {
     TInt err = KErrNone;
     TInt array[10];
     TPtr8 ptr((TUint8*)array,0,40);
-    err = SendReceive(EAlfGetListOfWGsHavingInactiveSurfaces, TIpcArgs(&ptr, aListAll));
+
+    err = SendReceive(EAlfGetListOfWGsHavingInactiveSurfaces, TIpcArgs(&ptr, aType));
+
     if (!err)
         {
         for(TInt i = 0; i < 10; i++)
@@ -181,14 +183,18 @@
 
 EXPORT_C TInt RAlfBridgerClient::GetListOfInactiveWindowGroupsWSurfaces(RArray<TInt>* aWindowGroups)
     {
-    return GetListOfWindowGroups(aWindowGroups, EFalse);
+    return GetListOfWindowGroups(aWindowGroups, EAlfInactiveWgs);
     }
 
 EXPORT_C TInt RAlfBridgerClient::GetListOfWindowGroupsWSurfaces(RArray<TInt>* aWindowGroups)
     {
-    return GetListOfWindowGroups(aWindowGroups, ETrue);
+    return GetListOfWindowGroups(aWindowGroups, EAlfAllWgsWithSurface);
     }
 
+EXPORT_C void RAlfBridgerClient::GetOptionalGraphicsMemUsers(RArray<TInt>* aOptionalCandidates)
+    {
+    GetListOfWindowGroups(aOptionalCandidates, EAlfVolunteersForCommonGood);
+    }    
 
 
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h	Wed Jun 09 10:41:25 2010 +0300
@@ -66,16 +66,23 @@
      */    
     IMPORT_C TInt GetListOfWindowGroupsWSurfaces(RArray<TInt>* aWindowGroups);
 
-
      /**
      * Asks the number of active effects
      * @return error code or number of active effects (>= 0).
      */    
      IMPORT_C TInt EffectsCount();
+
+     /**
+     * Asks list of window groups that potentially use graohics memory even no direct EGL nor surface access on main display
+     * @param aArray array to be populated
+     * @return error code.
+     */   
+    IMPORT_C void RAlfBridgerClient::GetOptionalGraphicsMemUsers(RArray<TInt>* aOptionalCandidates);
+
      
 private:
     
-    TInt GetListOfWindowGroups(RArray<TInt>* aWindowGroups, TBool aListAll);
+    TInt GetListOfWindowGroups(RArray<TInt>* aWindowGroups, TInt aType);
     TInt iSpare1;
     TInt iSpare2;
     };
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h	Wed Jun 09 10:41:25 2010 +0300
@@ -19,40 +19,9 @@
     #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_ADD_TIME(handle, member, effects)
-    #define AMT_GET_TIME(x, handle, index, effects)
-    #define AMT_GET_TIME_POINT_COUNT(handle, x)
-    #define AMT_RESET_TIME(handle)
-    
-    #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()
+    #define AMT_MAP_PTR_TO_KEY_CAST(keyPtr)
+    #define AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC()
+    #define AMT_MAP_GCE_SET_LAYER_POSITIONS()
 
 #else
     // Module test hook has been set.
@@ -67,6 +36,23 @@
     #endif // AMT_CONTROL
 
 
+    // *** General test variable 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
+    
+    #define AMT_MAP_FORCE_SW_HANDLE 0
+    #define AMT_MAP_SW_ENABLED_HANDLE 1
+    #define AMT_MAP_LOW_MEMORY_MODE_HANDLE 2
+    
+    #define AMT_MAP_CANVAS_WS_GC_TYPE 0
+    #define AMT_MAP_TEXTURE_CACHE_MEMORY_LEVEL 1
+    #define AMT_MAP_CACHED_IMAGES_COUNT 2
+    #define AMT_MAP_CACHED_TEXTS_COUNT 3
+    #define AMT_MAP_CACHED_RENDER_BUFFERS_COUNT 4
+
+
     //  *** Use these macros to access global memory chunk
     
     
@@ -76,77 +62,97 @@
     
     // 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
+    // *** 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)
-    
-    #define AMT_ADD_TIME(handle, member, effects)   AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ TInt nextFreeIndex = AMT_DATA()->iTimeMap[timemapIndex].iCounter; AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[nextFreeIndex] = member; AMT_DATA()->iTimeMap[timemapIndex].iCounter++; timemapIndex = 100; break;} timemapIndex++; } if (timemapIndex == 10) { if (AMT_DATA()->iNextFreeMap == 10) { AMT_DATA()->iNextFreeMap = 0;} TInt nextFreeMap = AMT_DATA()->iNextFreeMap; AMT_DATA()->iTimeMap[nextFreeMap].iCounter = 1; AMT_DATA()->iTimeMap[nextFreeMap].iHandle = handle; AMT_DATA()->iTimeMap[nextFreeMap].iTimeStamp[0] = member; AMT_DATA()->iTimeMap[nextFreeMap].iEffects = effects; AMT_DATA()->iNextFreeMap++; /*RDebug::Printf("Handle: %d, %d %d %d", handle, timemapIndex, AMT_DATA()->iNextFreeMap, member)*/;})
-    #define AMT_GET_TIME(x, handle, index, effects) AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[index];(effects) = AMT_DATA()->iTimeMap[timemapIndex].iEffects;break;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;(effects) = EFalse;})
-    #define AMT_GET_TIME_POINT_COUNT(handle, x)     AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iCounter;timemapIndex = 100;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;})
-    #define AMT_RESET_TIME(handle)                  AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ AMT_DATA()->iTimeMap[timemapIndex].iHandle = 0; AMT_DATA()->iTimeMap[timemapIndex].iCounter = 0;AMT_DATA()->iTimeMap[timemapIndex].iEffects = 0;break;}timemapIndex++;})
-    
-    // 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())
+    #define AMT_MAP_PTR_TO_KEY_CAST(keyPtr)         reinterpret_cast< TInt >( keyPtr )
+
+
+    // *** Macros to define function content
+
+    #define AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC() \
+            if ( iCanvasWsGc ) \
+                { \
+                AMT_MAP_SET_VALUE( \
+                        iIntMap, \
+                        AMT_MAP_CANVAS_WS_GC_TYPE, \
+                        iCanvasWsGc->Type(), \
+                        EAlfModuleTestTypeCoreToolkitGoom ); \
+                } \
+            else \
+                { \
+                AMT_MAP_SET_VALUE( \
+                        iIntMap, \
+                        AMT_MAP_CANVAS_WS_GC_TYPE, \
+                        KErrNotFound, \
+                        EAlfModuleTestTypeCoreToolkitGoom ); \
+                }
+
+    // Sets the position of the layer into the map. 
+    // Zero means the bottom and the top layer has the greates position value.
+    #define AMT_MAP_GCE_SET_LAYER_POSITIONS() \
+            TInt gceLayerPosition( -1 ); \
+            const MWsLayer* gceLayer( iBottomLayer ); \
+            while( gceLayer ) \
+                { \
+                ++gceLayerPosition; \
+                AMT_MAP_SET_VALUE( \
+                    iIntMap, AMT_MAP_PTR_TO_KEY_CAST( gceLayer ), \
+                    gceLayerPosition, EAlfModuleTestTypeGceLayerPosition ); \
+                gceLayer = gceLayer->Above(); \
+                }
 
 #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
-
-#define AMT_MAP_FORCE_SW_HANDLE 0
-#define AMT_MAP_SW_ENABLED_HANDLE 1
-#define AMT_MAP_LOW_MEMORY_MODE_HANDLE 2
-
-#define AMT_MAP_CANVAS_WS_GC_TYPE 0
-#define AMT_MAP_TEXTURE_CACHE_MEMORY_LEVEL 1
-#define AMT_MAP_CACHED_IMAGES_COUNT 2
-#define AMT_MAP_CACHED_TEXTS_COUNT 3
-#define AMT_MAP_CACHED_RENDER_BUFFERS_COUNT 4
-
-
 // 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.  
 
 
+// Single operation macros, that will do lock/unlock.
+#define AMT_PRINT_STATE()                       AMT_FUNC_EXC(AMT_DATA()->PrintState())
+#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)
+
+#define AMT_ADD_TIME(handle, member, effects)   AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ TInt nextFreeIndex = AMT_DATA()->iTimeMap[timemapIndex].iCounter; AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[nextFreeIndex] = member; AMT_DATA()->iTimeMap[timemapIndex].iCounter++; timemapIndex = 100; break;} timemapIndex++; } if (timemapIndex == 10) { if (AMT_DATA()->iNextFreeMap == 10) { AMT_DATA()->iNextFreeMap = 0;} TInt nextFreeMap = AMT_DATA()->iNextFreeMap; AMT_DATA()->iTimeMap[nextFreeMap].iCounter = 1; AMT_DATA()->iTimeMap[nextFreeMap].iHandle = handle; AMT_DATA()->iTimeMap[nextFreeMap].iTimeStamp[0] = member; AMT_DATA()->iTimeMap[nextFreeMap].iEffects = effects; AMT_DATA()->iNextFreeMap++; /*RDebug::Printf("Handle: %d, %d %d %d", handle, timemapIndex, AMT_DATA()->iNextFreeMap, member)*/;})
+#define AMT_GET_TIME(x, handle, index, effects) AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iTimeStamp[index];(effects) = AMT_DATA()->iTimeMap[timemapIndex].iEffects;break;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;(effects) = EFalse;})
+#define AMT_GET_TIME_POINT_COUNT(handle, x)     AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ (x) = AMT_DATA()->iTimeMap[timemapIndex].iCounter;timemapIndex = 100;}timemapIndex++;}if(timemapIndex == 10){(x) = KErrNotFound;})
+#define AMT_RESET_TIME(handle)                  AMT_FUNC_EXC(TInt timemapIndex = 0; while(timemapIndex < 10){ if (AMT_DATA()->iTimeMap[timemapIndex].iHandle == handle){ AMT_DATA()->iTimeMap[timemapIndex].iHandle = 0; AMT_DATA()->iTimeMap[timemapIndex].iCounter = 0;AMT_DATA()->iTimeMap[timemapIndex].iEffects = 0;break;}timemapIndex++;})
+
+// Map operation macros, that will do lock/unlock
+#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())
+
+
 // Render stage defines
 
 #define AMT_MAP_RENDER_STAGE_NODE_CREATED() \
@@ -175,7 +181,8 @@
 #define AMT_MAP_RENDER_STAGE_ADD_LAYER() \
         AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeCreateLayer ); \
         AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeReleaseLayer ); \
-        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeLayerOrdinalPosition )
+        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeLayerOrdinalPosition ); \
+        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeLayerNodeOrdinalPosition )
 
 #define AMT_MAP_RENDER_STAGE_ADD_LAYER_LINK() \
         AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeCreateLayer ); \
@@ -184,6 +191,13 @@
         AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeReleaseLayer ); \
         AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeLayerOrdinalPosition ); \
         AMT_MAP_APPEND_LINK( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeLayerOrdinalPosition ); \
+        AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeLayerNodeOrdinalPosition ); \
+        AMT_MAP_APPEND_LINK( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeLayerNodeOrdinalPosition ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceCreateLayer ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceReleaseLayer ); \
+        AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerPosition ); \
+        AMT_MAP_APPEND_LINK( iIntMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerOpacity ); \
+        AMT_MAP_APPEND_LINK( iRectMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeGceLayerExtent ); \
         \
         AMT_MAP_SET_VALUE( iSurfaceMap, windowId, aLayer.Surface(), EAlfModuleTestTypeCreateLayer )
 
@@ -260,27 +274,33 @@
 #define AMT_MAP_BRIDGE_SET_ORDINAL_POSITION() \
         AMT_MAP_SET_VALUE_IF( windowAttributes, iIntMap, windowNodeId, windowAttributes->iOrdinalPosition, EAlfModuleTestTypeLayerOrdinalPosition )
 
-#ifndef USE_MODULE_TEST_HOOKS_FOR_ALF
-#define AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC()
-#else
-#define AMT_MAP_CANVAS_WS_PAINTER_SELECT_GC() \
-        if ( iCanvasWsGc ) \
-            { \
-            AMT_MAP_SET_VALUE( \
-                    iIntMap, \
-                    AMT_MAP_CANVAS_WS_GC_TYPE, \
-                    iCanvasWsGc->Type(), \
-                    EAlfModuleTestTypeCoreToolkitGoom ); \
-            } \
-        else \
-            { \
-            AMT_MAP_SET_VALUE( \
-                    iIntMap, \
-                    AMT_MAP_CANVAS_WS_GC_TYPE, \
-                    KErrNotFound, \
-                    EAlfModuleTestTypeCoreToolkitGoom ); \
-            }
-#endif // USE_MODULE_TEST_HOOKS_FOR_ALF
+#define AMT_MAP_NODE_SET_ORDINAL_POSITION() \
+        AMT_MAP_SET_VALUE( iIntMap, iId, ordinal, EAlfModuleTestTypeLayerNodeOrdinalPosition )
+
+
+// GCE defines
+
+#define AMT_MAP_GCE_ADD_LAYER() \
+        AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeGceCreateLayer ); \
+        AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeGceReleaseLayer ); \
+        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeGceLayerPosition ); \
+        AMT_MAP_APPEND_IF( aLayer, iIntMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), 0, EAlfModuleTestTypeGceLayerOpacity ); \
+        AMT_MAP_APPEND_IF( aLayer, iRectMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TRect(), EAlfModuleTestTypeGceLayerExtent )
+
+#define AMT_MAP_GCE_SET_SURFACE() \
+        AMT_MAP_SET_VALUE( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( static_cast< MWsLayer* >( this ) ), aSurface, EAlfModuleTestTypeGceCreateLayer )
+
+#define AMT_MAP_GCE_REMOVE_LAYER() \
+        AMT_MAP_SET_VALUE_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), aLayer->Surface(), EAlfModuleTestTypeGceReleaseLayer )
+
+#define AMT_MAP_GCE_SET_LAYER_OPACITY() \
+        AMT_MAP_SET_VALUE( iIntMap, AMT_MAP_PTR_TO_KEY_CAST( static_cast< MWsLayer* >( this ) ), Opacity(), EAlfModuleTestTypeGceLayerOpacity )
+
+#define AMT_MAP_GCE_SET_LAYER_EXTENT() \
+        AMT_MAP_SET_VALUE( iRectMap, AMT_MAP_PTR_TO_KEY_CAST( static_cast< MWsLayer* >( this ) ), aExtent, EAlfModuleTestTypeGceLayerExtent )
+
+
+// Goom defines
 
 #define AMT_MAP_CANVAS_TEXTURE_CACHE_SET_MEMORY_LEVEL() \
         AMT_MAP_SET_VALUE( iIntMap, AMT_MAP_TEXTURE_CACHE_MEMORY_LEVEL, iMemoryLevel, EAlfModuleTestTypeCoreToolkitGoom ); \
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h	Wed Jun 09 10:41:25 2010 +0300
@@ -71,8 +71,14 @@
     
     // Layer tests
     EAlfModuleTestTypeCreateLayer,
-    EAlfModuleTestTypeReleaseLayer,    
-    EAlfModuleTestTypeLayerOrdinalPosition,    
+    EAlfModuleTestTypeReleaseLayer,
+    EAlfModuleTestTypeLayerOrdinalPosition,
+    EAlfModuleTestTypeLayerNodeOrdinalPosition,
+    EAlfModuleTestTypeGceCreateLayer,
+    EAlfModuleTestTypeGceReleaseLayer,
+    EAlfModuleTestTypeGceLayerPosition,
+    EAlfModuleTestTypeGceLayerExtent,
+    EAlfModuleTestTypeGceLayerOpacity,
     
     // Do not use this value when creating item.
     // This is just meant for Find operations when all tests are accepted.
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h	Wed Jun 09 10:41:25 2010 +0300
@@ -283,7 +283,15 @@
      * 
      */
     void GfxTriggerEndFullScreen(CFullScreenEffectState* aFullScreenEffectData);
-    
+
+    /**
+	 * UpdateSecondaryEffectL
+	 *
+	 * Resolve filename for two part effect that is used with slowly starting applications
+	 * 
+	 */
+    TBool UpdateSecondaryEffectL(const CFullScreenEffectState& aState);
+
    /*
 	*	GfxTriggerEffectWhenFullScreenDrawn
 	*
@@ -614,6 +622,15 @@
 
     void ShowWindowGroupControlGroupL(CHuiRoster& aRoster, CHuiControlGroup& aGroup, TInt aWhere, TInt aScreenNumber );
     
+	/**
+	 * HasActiveAlfContent
+	 *
+	 * Determine if the window group in question has active Alf visuals
+	 *
+	 *	@return 	ETrue, if active clients
+	 */
+    TBool HasActiveAlfContent( TInt aClientWgId );
+    
 private:
          
     /**
@@ -923,6 +940,8 @@
      */
     CFullScreenEffectState* iFullScreenEffectData;
     
+    CFullScreenEffectState* iSecondaryFullScreenEffectData;
+    
     /**
      * Control effect state.
      * Own.
@@ -932,10 +951,7 @@
     // these save the current full screen transition data
     // so that the correct transition can be ended from the callback
     // when the effect ends
-    TInt iLastFullScreenEffectWindowGroup;
-    TInt iLastFullScreenScreen;
-    TInt iLastAction;
-    TInt iLastEffectHandle;
+    
     CAlfEffectEndTimer* iEffectEndTimer;
     TBool iLayoutInitializedForExitEffect;
     
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Wed Jun 09 10:41:25 2010 +0300
@@ -19,6 +19,16 @@
 #include <akntranseffect.h>
 #include "alfbridge.h"
 
+enum TEffectState
+    {
+    EBeginFullScreenReceived, // first request of effect received
+    EWaitingWindowGroup,
+    EWaitEndFullScreen,
+    EEndFullScreenReceivedWaitingWindowGroup,
+    EEndFullscreenReceived,
+    ESecondPhaseSetupActive,
+    EFinalEffectActive
+    };
 // Timer to send finish full screen effect
 // ---------------------------------------------------------
 // CAlfFinishTimer
@@ -228,6 +238,8 @@
     public:
         ~CFullScreenEffectState();
         
+        void ConstructL(const CFullScreenEffectState& aEffectState);
+        
         void ConstructL(TInt aAction, RMemReadStream& aStream);
         
         // Information from BeginFullScreen
@@ -239,15 +251,32 @@
         TInt iToSecureId;
         TInt iFromSecureId;
         TRect iRect;
-        TBool iTimeoutTriggered;
+        TBool iLongAppStartTimeout;
+        TBool iTimeout;
         
-        // ETrue if waiting for window group to appear
-        TBool iWaitingWindowGroup;
+         
+        void SetState(TEffectState aState);
+       
+        TEffectState State();
+       
+      
+private:
+        TEffectState iState;
+        
+public:
         // ETrue if end fullscreen has been performed
         TBool iEndFullScreen;
         // ETrue if setup effect container has been done
         TBool iSetupDone;
-
+        // effect has fade out and fade in. The fade in part is active, when this is ETrue.
+        enum TEffectPhase
+            {
+            EOnlyOnePart = 0,
+            EFirstPartActive,
+            ESecondPartActive
+            };
+        
+        TEffectPhase iTwoPhaseEffect;
         // used for resolving the iCleanupStackItem that holds the frozen app layout underneath the starting application
         TInt iAppStartScreenshotItemHandle;
         
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h	Wed Jun 09 10:41:25 2010 +0300
@@ -46,7 +46,9 @@
     EAlfGetNumberOfActiveEffects,
     EAlfRequestSignal,
     EAlfCompleteSignal,
-    EAlfSetDistractionWindow
+    EAlfSetDistractionWindow,
+    EAlfVolunteerForGoomTarget,
+    EAlfExcludeFromGoomTargets
 
     };
 
@@ -93,8 +95,14 @@
 enum TAlfSignalFlags
     {
     EAlfSignalEffectStarted = 0x1,
-    EAlfSignalEffectComplete = 0x2,    
-    
+    EAlfSignalEffectComplete = 0x2,     
     };
     
+enum TAlfWindowGroupListType
+    {    
+    EAlfInactiveWgs = 0,
+    EAlfAllWgsWithSurface,
+    EAlfVolunteersForCommonGood
+    };
+     
 #endif
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h	Wed Jun 09 10:41:25 2010 +0300
@@ -71,11 +71,13 @@
 
     void RemoveTargetFromInactiveSurfaces(TInt aTarget);
     void AddTargetFromInactiveSurfaces(TInt aTarget);
-    void GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TBool aActiveAlso = ETrue);
+    void GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TInt aActiveAlso = ETrue);
     void QueueRequestBGAnimSessionsL(const TPtrC8& aPtr, TInt aOp);
 
     void AddSignal(CAlfStreamerServerSession* aSession, const RMessage2& aMessage);
     void CompleteSignal(TInt aSignal, TInt aType);
+    void FormAQueueL(TInt aOp, TInt aSecureId, TInt aWindowGroupId);
+
     
 private:
     void ConstructL();
@@ -145,13 +147,14 @@
     struct TAlfCompParams
         {
         TInt iTarget; 
-        TInt iTarget2;  // padding actually
+        TInt iSecureId; // used with optional GRAM list
         TInt iWindowHandle;
         TInt iWindowGroup;
         }; 
 
     RArray<TAlfCompParams> iAlfTargets;
     RArray<TAlfCompParams> iInactiveSurfaces;
+    RArray<TAlfCompParams> iOptionalGRAM;
     };
 
 NONSHARABLE_CLASS(CAlfStreamerServerSession): public CSession2
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsessionBase.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -36,6 +36,8 @@
 #include "alf/alfextensionfactory.h"
 #include "alf/alfversion.h"
 #include "alfsrvsettingshandler.h"
+#include "alfstreamerconsts.h"
+#include "alfdecoderserverclient.h"
 
 const TUint KAlfMaxCpuUsageDuringPointerEvent = 35; // Percentage
 
@@ -106,6 +108,7 @@
     RMessagePtr2 iSystemEvent;
     TInt iParentId;
     TBool iActive;
+    TUint iSecureId;
     }; 
 
 // ======== MEMBER FUNCTIONS ========
@@ -129,11 +132,17 @@
 // ---------------------------------------------------------------------------
 //
 EXPORT_C CAlfAppSrvSessionBase::~CAlfAppSrvSessionBase()
-    { 
+    {
+        
     iHost->HandleClientExit(reinterpret_cast<TInt>(this));
     
     if ( iData )
         {
+        if (AlfAppUi()->BridgerClient())
+            {
+            AlfAppUi()->BridgerClient()->SendBlind(EAlfExcludeFromGoomTargets, TIpcArgs(iData->iSecureId,iData->iClientWindowGroupId));
+            }
+            
         iData->iHandles.Close();
         delete iData->iObjectIx;
     
@@ -208,6 +217,7 @@
 //
 EXPORT_C void CAlfAppSrvSessionBase::ServiceL(const RMessage2& aMessage)
     {
+    iData->iSecureId = aMessage.SecureId(); // one time would be enough    
     if(iHost->MetricsInterface())
         {
         iHost->MetricsInterface()->EnterClientMessageL(reinterpret_cast<TInt>(this), aMessage);
@@ -396,6 +406,10 @@
     {
     __ASSERT_DEBUG(iData, USER_INVARIANT());
     iData->iClientWindowGroupId = aId;
+    if (AlfAppUi()->BridgerClient())
+        {
+        AlfAppUi()->BridgerClient()->SendBlind(EAlfVolunteerForGoomTarget, TIpcArgs(iData->iSecureId, iData->iClientWindowGroupId));
+        }
     }
 
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -944,17 +944,21 @@
 
 void CAlfAppUi::UpdateActiveSession(CAlfAppSrvSessionBase* aSession)
     {
-    EndPointerEventHandling();
-    iData->iActiveSession = aSession;
+    if( iData->iActiveSession  != aSession )
+        {
+        EndPointerEventHandling();
+        iData->iActiveSession = aSession;
+        
+        iData->iResourceManager->SetActiveSession( iData->iActiveSession );
     
-    iData->iResourceManager->SetActiveSession( iData->iActiveSession );
-
-    if(!aSession)
-        {
-        if (iData->iMainDisplay) // TBD: multiple display support once again...
+        if(!aSession)
             {
-            TRAP_IGNORE(iData->iMainDisplay->SetClearBackgroundL(CHuiDisplay::EClearNone));
+            if (iData->iMainDisplay) // TBD: multiple display support once again...
+                {
+                TRAP_IGNORE(iData->iMainDisplay->SetClearBackgroundL(CHuiDisplay::EClearNone));
+                }
             }
+        iData->iBridgeObj->HandleVisualVisibility( 0 );
         }
     }
     
@@ -1403,4 +1407,13 @@
     // let the session complete message  
     }
 
+RAlfBridgerClient* CAlfAppUi::BridgerClient()
+    {
+    if (iData)
+        {
+        return iData->iBridgeObj->BridgerClient();  
+        }    
+    return 0;
+    }
+
 // end of file
--- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -171,6 +171,7 @@
     iDeadControlGroups.Close();
     iEffectWindowGroups.Close();
     delete iFullScreenEffectData;
+    delete iSecondaryFullScreenEffectData;
 
     if (iActivated)
         {
@@ -674,6 +675,13 @@
                 if (anyVisualHasEffect)
                     {
                     TInt activeEffectHandle = iEffectCleanupStack[activeEffectIndex].iHandle;
+                    if (iSecondaryFullScreenEffectData && iSecondaryFullScreenEffectData->iHandle == activeEffectHandle)
+                        {
+                        __ALFFXLOGSTRING1("CAlfBridge::DeleteControlGroupL - WARNING! Control group with 2 phase effect is being destroyed. Canceling second phase for handle %d", activeEffectHandle);
+                        delete iSecondaryFullScreenEffectData;
+                        iSecondaryFullScreenEffectData = NULL;
+                        }
+                    
                     __ALFFXLOGSTRING1("Layout 0x%x has external content", layout);
                     // EHuiVisualFlagShouldDestroy destroy flag should have come for the windows in this layout already
                     layout->SetFlags(EHuiVisualFlagShouldDestroy);
@@ -798,10 +806,14 @@
         entry.iSecureId = aSecureId;
         // we have received start effect for this group, but the group did not exist in alf universe at the time. hide the group.
         if (iFullScreenEffectData
-                && iFullScreenEffectData->iWaitingWindowGroup
+                && (iFullScreenEffectData->State() == EWaitingWindowGroup || iFullScreenEffectData->State() == EEndFullScreenReceivedWaitingWindowGroup)
                 && iFullScreenEffectData->iToSecureId == aSecureId)
             {
             iFullScreenEffectData->iToWg = aClientWindowGroupId;
+            if (iSecondaryFullScreenEffectData)
+                {
+                iSecondaryFullScreenEffectData->iToWg = aClientWindowGroupId;
+                }
             CHuiControlGroup* fromGroup = NULL;
             CHuiLayout* fromLayout = NULL; 
             fromGroup = FindControlGroupByFullScreenFromEffect();
@@ -815,10 +827,16 @@
             // First HandleGfxEvent, then clear iWaitingWindowGroup.
             __ALFFXLOGSTRING1("CAlfBridge::CreateControlGroupL - try triggering effect 0x%x", layout);
             TBool failed = HandleGfxEventL( *iFullScreenEffectData, layout, fromLayout );
-            if ( iFullScreenEffectData )
-                {
-                iFullScreenEffectData->iWaitingWindowGroup = EFalse;
+            if ( iFullScreenEffectData->State() == EWaitingWindowGroup)
+                {
+                iFullScreenEffectData->SetState(EWaitEndFullScreen);
                 }
+            else
+                {  
+				// was CFullScreenEffectState::EEndFullScreenReceivedWaitingWindowGroup           
+                iFullScreenEffectData->SetState(EEndFullscreenReceived);
+                }
+            
             if ( failed )
                 {
                 // Effect failed, reset state
@@ -1286,7 +1304,12 @@
         {
         return EFalse;
         }
-    if ( aVisual.Layout() && IsNonFadeEffect( aVisual.Layout()->Effect() ) )
+    
+    // Note: The long startup effect uses opaque effect to hide the background. 
+    if ( aVisual.Layout() 
+            && (IsNonFadeEffect( aVisual.Layout()->Effect() ) 
+			&& !IsOpaqueEffect(aVisual.Layout()->Effect() ))
+            )
         {
         return EFalse;
         }
@@ -1602,6 +1625,27 @@
             {
             HandleLayerVisibility( layout, controlgroup, control, hasActiveVisualsInVisualTree );
             }
+        
+        TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive);        
+        
+        // we need to set /clear inactive flags before we evaluate the fade effect,
+        // otherwise the fade effect will be removed without a reason in
+        // some use cases
+        if (isLayoutActive && !hasActiveVisualsInVisualTree && !IsOpaqueEffect(layout->Effect()))
+            {
+            // 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.
+			// If root visual is having an opaque effect, it must remain active
+            layout->SetFlag(EHuiVisualFlagInactive);
+            }
+        else if(!isLayoutActive && (hasActiveVisualsInVisualTree || IsOpaqueEffect(layout->Effect())))
+            {
+            layout->ClearFlag(EHuiVisualFlagInactive);
+            layout->SetPos(fullscreen.iTl);
+            layout->SetSize(fullscreen.Size());
+            }
+ 
             
 		// 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
@@ -1626,22 +1670,7 @@
                 layout->ClearCanvasFlags(EHuiCanvasFlagExternalFadeExistsInsideVisualTree);            
                 }
             }
-        
-        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.
-            layout->SetFlag(EHuiVisualFlagInactive);
-            }
-        else if(!isLayoutActive && hasActiveVisualsInVisualTree)
-            {
-            layout->ClearFlag(EHuiVisualFlagInactive);
-            layout->SetPos(fullscreen.iTl);
-            layout->SetSize(fullscreen.Size());
-            }
-        
+               
 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER
         __ALFLOGSTRING1(">>>> HandleVisualVisibility: Control group index: %d", j );
         __ALFLOGSTRING1(">>>> HandleVisualVisibility: Active visuals : %d", activevisualcount );
@@ -3337,9 +3366,11 @@
 		__ALFLOGSTRING3("CAlfBridge::HandlePostCanvasBufferL, EAlfDSPostCanvasBuffer: Visual not found! Screen: %d, Id: %d, GroupId: %d ", screenNumber, windowNodeId, windowGroupNodeId );                                 
 		}    
 #ifdef	USE_APPLICATION_ENDFULLSCREEN_TIMEOUT	
-	    if (iFullScreenEffectData 
+	    if (iFullScreenEffectData
+	            && !iSecondaryFullScreenEffectData
 	            && iFullScreenEffectData->iEffectType != CFullScreenEffectState::ENotDefinedEffect 
-	            && !iFullScreenEffectData->iEndFullScreen)
+	            && iFullScreenEffectData->State() == EWaitEndFullScreen
+	            && iFullScreenEffectData->iTwoPhaseEffect != CFullScreenEffectState::ESecondPartActive)
 	        {
 	        CHuiControlGroup *to_group = NULL;
             if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect)
@@ -3370,7 +3401,7 @@
 // 
 void CAlfBridge::GfxTriggerEndFullScreen(CFullScreenEffectState* aFullScreenEffectData)
     {
-    if (aFullScreenEffectData->iEndFullScreen)
+    if (iFullScreenEffectData->State() == EFinalEffectActive)
         {
         return;
         }
@@ -3399,9 +3430,9 @@
         // from layout may be undefined
         __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEndFullScreenTimeout : Enough app drawing. Trigger EndFullScreen for layout 0x%x", to_layout);    
         HandleGfxEventL( *aFullScreenEffectData, to_layout, from_layout );
-        }
-
-    aFullScreenEffectData->iEndFullScreen = ETrue;
+        aFullScreenEffectData->SetState(EFinalEffectActive);
+        }
+
     iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue);
     }
 
@@ -4535,8 +4566,9 @@
 
 TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout)
     {
-    __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - To SecureUid: 0x%x, From SecureUid: 0x%x", aEvent.iToSecureId, aEvent.iFromSecureId);
+    __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEventL - To SecureUid: 0x%x, From SecureUid: 0x%x, effect %S", aEvent.iToSecureId, aEvent.iFromSecureId, aEvent.iEffectName);
     __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction);
+    
     TInt err = KErrNone;
     TBool failed = EFalse;
     
@@ -4591,6 +4623,11 @@
                         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;
+                        if (iSecondaryFullScreenEffectData)
+                            {
+                            iSecondaryFullScreenEffectData->iEffectType = CFullScreenEffectState::EStartEffect; 
+                            }
+                                
                         aEvent.iCanDestroyOrHideImmediately = ETrue; // enable hiding of windows during application start/activate effects
                         break;
                         }
@@ -4605,18 +4642,26 @@
 
                         // The layout should be visible at this time. if not, then this is assumed
                         // as effect to an background application and ignored.
-                        if (aToLayout->Effect())
-                            {
+						
+                        if (aToLayout->Effect() 
+							&& !(aToLayout->Effect()->EffectFlags() & KHuiFadeEffectFlag ))                         
+							{
+							// If the exit effect took a screesnhot (above), then the layout is freezed to show the screenshot. 
+							// Layout may not be unfrozen before EndFullScreen, or flicker will occur.
                             // effect on a layout must be an application start effect. 
                             // External content visual is not used for that.
                             __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Found effect on layout 0x%x. Removing effect 0x%x", aToLayout, aToLayout->Effect());
                             aToLayout->SetEffect(NULL);
+                            aToLayout->SetFreezeState(EFalse); // Only if a screenshot was taken earlier then freeze state would be ETrue
                             }
+							
                         __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)
+                            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 
@@ -4634,7 +4679,11 @@
                             {
                             iLayoutInitializedForExitEffect = EFalse;
                             aEvent.iSetupDone = EFalse;
-							failed = ETrue;
+                            failed = ETrue;
+                            }
+                        if (iSecondaryFullScreenEffectData)
+                            {
+                            iSecondaryFullScreenEffectData->iSetupDone = aEvent.iSetupDone;
                             }
                          return failed;
                          }
@@ -4655,6 +4704,17 @@
                         
                     if (aToLayout)
                         {
+                        // if this was timeout appstart effect, we need to take screenshot at this point. 
+                        // It was not taken in the beginfullscreen
+                        
+                        if (aEvent.iLongAppStartTimeout)
+                            {
+                            __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL  - taking screenshot for the timeout appstart effect. Handle: %d",  aEvent.iHandle );
+                            aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
+                            TBool neededStoredBuffers(EFalse); // dummy 
+                            StoreLayoutIfRequiredByEffectL(aToLayout, aEvent, neededStoredBuffers);
+                            }
+                        
                         aToLayout->iOpacity.Set(1.0f);
                         __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - loading effect, handle %d", aEvent.iHandle );
                         if (aEvent.iAction == AknTransEffect::EApplicationExit)
@@ -4668,7 +4728,11 @@
                             // add visuals to visual cleanupstack
                             aToLayout->SetStoredRenderBufferModificationsEnabled(EFalse);
                             TInt index;
-                            if (aToLayout->StoredRenderBuffer() && HasActiveEffect(aToLayout, index) && index != KErrNotFound)
+                            if (aToLayout->StoredRenderBuffer() 
+                                    && HasActiveEffect(aToLayout, index) 
+                                    && index != KErrNotFound
+                                    && aEvent.iTwoPhaseEffect != CFullScreenEffectState::ESecondPartActive // effects second phase
+                                    )
                                 {
 	                            // a screenshot has been saved into the layout, and the layout was added to cleanupstack
     	                        // for cleaning. SetupEffectLayoutContainerL will add the same layout 
@@ -4676,7 +4740,16 @@
                                 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Removing the layout 0x%x with screenshot from iEffectCleanupStack", aToLayout);
                                 iEffectCleanupStack.Remove(index);
                                 }
-                            layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, ETrue, EFalse, aEvent.iCanDestroyOrHideImmediately);
+                            if (aEvent.iTwoPhaseEffect == CFullScreenEffectState::ESecondPartActive || aEvent.iSetupDone)
+                                {
+                                // two phase effect, setup has been made with the first part of the effect. 
+                                // Only changing the effect is required.
+                                layoutEffectable = ETrue; 
+                                }
+                            else
+                                {
+                                layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, ETrue, EFalse, aEvent.iCanDestroyOrHideImmediately);
+                                }
                             aEvent.iSetupDone = layoutEffectable; 
                             aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue);
                             }
@@ -4690,12 +4763,16 @@
                                 engine->AddEffectToGroup(activeEffectGroup);
                                 }
                             __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Active effect group: %d", activeEffectGroup);
-                            effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; 
-                            if (FxmlHasOpaqueHint(iHuiEnv->EffectsEngine(), *aEvent.iEffectName))
+                            effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn;
+                            if (FxmlHasOpaqueHint(iHuiEnv->EffectsEngine(), *aEvent.iEffectName) ||
+                                    aEvent.iTwoPhaseEffect == CFullScreenEffectState::ESecondPartActive)
                                 {
-                                // Performance improvement, but this would be better to be a special hint param in the fxml
                                 effectFlags |= KHuiFxOpaqueHint;
                                 }
+                            if (iSecondaryFullScreenEffectData)
+                                {
+                                iSecondaryFullScreenEffectData->iSetupDone = ETrue;
+                                }
                             
                             if (aEvent.iRect != TRect())
                                 {
@@ -4707,6 +4784,8 @@
                                 }
                             effect = NULL;
                             // only use the effect if the effect file was correctly parsed
+                            aToLayout->SetFreezeState(EFalse);
+                                                            
                             if (err != KErrNone)
                                 {
                                 // visuals added to "active effect visual" stack, but they wont be used, because effect loading has failed. cleanup.
@@ -4731,7 +4810,8 @@
                 }
             }
         }
-    iLastAction = aEvent.iAction; // TODO: useless?
+    
+    iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue);
     return failed;
     }
 
@@ -4794,6 +4874,8 @@
         }
     
     CleanupStack::PopAndDestroy( fxData );
+    delete iSecondaryFullScreenEffectData;
+    iSecondaryFullScreenEffectData = NULL;
     __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END");
     }
 
@@ -4899,6 +4981,8 @@
                 }
 
                delete iFullScreenEffectData;
+               delete iSecondaryFullScreenEffectData;
+               iSecondaryFullScreenEffectData = NULL;
             iFullScreenEffectData = fxData;
             iFullScreenEffectData->iAppStartScreenshotItemHandle = fxData->iHandle;
             
@@ -4914,6 +4998,14 @@
             
             // Client expects completion to be signalled with this handle.
             iFullScreenEffectData->iCompletionHandle = stream.ReadInt32L();
+            if (iSecondaryFullScreenEffectData)
+                {
+                // Two phase effect path has been chosen. First part is now ongoing, and second part will be 
+                // triggered after that. Client has now notified, that its screen is ready. We may trigger the 
+                // second effect as soon as the first part finishes.
+                __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - Trigger second part. when 1st part done.");
+                iSecondaryFullScreenEffectData->iCompletionHandle = iFullScreenEffectData->iCompletionHandle;
+                }
             
             stream.Release();           
             return ; 
@@ -4924,42 +5016,94 @@
         // End fullscreen signal received. We proceed only if there is really
         // effect ongoing and "end fullscreen" hasn't already been processed.
         
-        if ( !iFullScreenEffectData || iFullScreenEffectData->iEndFullScreen )
-            {
-            __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END: fx ready");
+        if ( !iFullScreenEffectData 
+                || iFullScreenEffectData->State() == EFinalEffectActive
+                || iFullScreenEffectData->State() == EEndFullscreenReceived)
+            {
+            if (iFullScreenEffectData)
+            __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEffectsL - END: fx ready, state %d ", iFullScreenEffectData->State());
+            stream.Release();
             return;
             }
-			// Load the whole structure. If timeout was triggered then request effect name
-			// is updated.
-            CFullScreenEffectState* fxData = new (ELeave) CFullScreenEffectState;
-            CleanupStack::PushL( fxData );
-            fxData->ConstructL( action, stream );
-            iFullScreenEffectData->iTimeoutTriggered = fxData->iTimeoutTriggered;    
-            if (fxData->iTimeoutTriggered)
-                {
-                delete iFullScreenEffectData->iEffectName;
-                iFullScreenEffectData->iEffectName = NULL;
-                iFullScreenEffectData->iEffectName = fxData->iEffectName->AllocL();
+        CFullScreenEffectState* fxData = new (ELeave) CFullScreenEffectState;
+        CleanupStack::PushL( fxData );
+        fxData->ConstructL( KErrUnknown, stream );
+        
+        TBool timeout = fxData->iTimeout;
+        // could the application be ready?
+        TBool applicationExists = FindControlGroupByFullScreenToEffect() != NULL ? ETrue : EFalse;
+
+        // It may be, that application exited already and it was moved already to effect group
+        if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect && !applicationExists )
+            {
+            applicationExists = FindLayoutByEffectHandle(fxData->iHandle) != NULL ? ETrue : EFalse;
+            }
                 
+        TBool longAppStartTimeout = fxData->iLongAppStartTimeout; 
+        
+        if (iFullScreenEffectData &&
+                !iSecondaryFullScreenEffectData && // second part has not been requested yet
+                longAppStartTimeout && // this is indeed timeout for app start effect
+                iFullScreenEffectData->iTwoPhaseEffect == CFullScreenEffectState::EOnlyOnePart && // second part has not been activated. note, that iSecondaryFullScreenEffectData would be NULL in this case 
+                (iFullScreenEffectData->State() == EWaitEndFullScreen 
+                 || iFullScreenEffectData->State() == EWaitingWindowGroup))
+            {
+            // Load the whole structure. If timeout was triggered then request effect name to be
+            // updated.
+            UpdateSecondaryEffectL(*fxData);
+            iFullScreenEffectData->iLongAppStartTimeout = fxData->iLongAppStartTimeout;
+            iFullScreenEffectData->iTwoPhaseEffect = CFullScreenEffectState::EFirstPartActive;
+            iFullScreenEffectData->iOperation = MAlfGfxEffectPlugin::EEndFullscreen;
+            }
+
+        __ALFFXLOGSTRING4("HandleGfxEffectsL - iTwoPhaseEffect %d, Setup done: %d, Timeout: %d, long app start timeout: %d", iFullScreenEffectData->iTwoPhaseEffect,iFullScreenEffectData->iSetupDone, timeout,longAppStartTimeout);
+        if (!fxData->iLongAppStartTimeout) // endfullscreen originating from the application
+            {
+            if (iFullScreenEffectData->State() == EWaitingWindowGroup)
+                {
+                iFullScreenEffectData->SetState(EEndFullScreenReceivedWaitingWindowGroup);
                 }
-            CleanupStack::PopAndDestroy( fxData );
-            fxData = NULL;
+            else
+                {
+                iFullScreenEffectData->SetState(EEndFullscreenReceived);
+                }
+            
+            if (iSecondaryFullScreenEffectData)
+                {
+                iSecondaryFullScreenEffectData->SetState(EEndFullscreenReceived);
+                }
+            
+            }
+        CleanupStack::PopAndDestroy( fxData );
+        fxData = NULL;
         
-        __ALFFXLOGSTRING("HandleGfxEffectsL - process end");
-        iFullScreenEffectData->iEndFullScreen = ETrue;
-
-#ifdef USE_APPLICATION_ENDFULLSCREEN_TIMEOUT		
-        if (iFullScreenEffectData->iDrawingCompleteTimer)
-            {
-            iFullScreenEffectData->iDrawingCompleteTimer->Cancel();
-            }
-#endif			
-        stream.Release();
+        __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEffectsL - Regular timeout: %d, Slow start timeout: %d, Effect setup: %d, State: %d",
+                timeout,
+                longAppStartTimeout,
+                iFullScreenEffectData->iSetupDone,
+                iFullScreenEffectData->State());
+
+        stream.Release();// We should respect normal timeouts.
+        if (iFullScreenEffectData->iTwoPhaseEffect > CFullScreenEffectState::EOnlyOnePart
+                && iFullScreenEffectData->iSetupDone && timeout && longAppStartTimeout) // timeout = endfullscreen was requested or it was normal endfullscreen timeout, longAppStartTime = 
+            {
+            // If this is two phased effect, it can be started only by application request of endfullscreen (!timeout)
+            // or screen drawn (triggered from 
+            __ALFFXLOGSTRING("HandleGfxEffectsL - Two phase effect. Waiting second part to start. Skip this event.");
+            return;
+            }
+        
+        // If client triggered EndFullScreen has been received, and still we haven't seen sign of the application, we know
+        // things have gone wrong and will not go right. Clean up the mess.
+        if (iFullScreenEffectData->State() == EEndFullscreenReceived && !applicationExists && !timeout)
+            {
+            HandleGfxStopEvent(ETrue);
+            return;
+            }
         }
 
     CFullScreenEffectState* fxData = iFullScreenEffectData;
     fxData->iOperation = operation;
-    fxData->iWaitingWindowGroup = EFalse;
 
     __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);
@@ -4994,11 +5138,16 @@
         if (toLayout)
             {
             failed = HandleGfxEventL(*fxData, toLayout, fromLayout);
+            // We found layout, and this was beginfullscreen event. Wait for endfullscreen to be triggered
+            if (fxData->iOperation == MAlfGfxEffectPlugin::EBeginFullscreen)
+                {
+                iFullScreenEffectData->SetState(EWaitEndFullScreen);
+                }
             }
         else
             {
             __ALFFXLOGSTRING("HandleGfxEffectsL - waiting window group");            
-            fxData->iWaitingWindowGroup = ETrue;
+            fxData->SetState(EWaitingWindowGroup);
             }
         }
 
@@ -5030,13 +5179,33 @@
     __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END");
     }
 
+TBool CAlfBridge::UpdateSecondaryEffectL(const CFullScreenEffectState& aState)
+    {
+    
+    __ALFFXLOGSTRING1("CAlfBridge::UpdateSecondaryEffectL - appstart timeout triggered: %d", aState.iLongAppStartTimeout);
+    if (aState.iLongAppStartTimeout) // only application start effects can trigger this timeout 
+        {
+        // clone the primary startup effect for later usage
+        delete iSecondaryFullScreenEffectData;
+        iSecondaryFullScreenEffectData = new (ELeave) CFullScreenEffectState;
+        iSecondaryFullScreenEffectData->ConstructL(*iFullScreenEffectData);
+        iSecondaryFullScreenEffectData->iLongAppStartTimeout = EFalse;
+        
+        delete iFullScreenEffectData->iEffectName;
+        iFullScreenEffectData->iEffectName = NULL;
+        iFullScreenEffectData->iEffectName = aState.iEffectName->AllocL();
+        }
+    __ALFFXLOGSTRING("CAlfBridge::UpdateSecondaryEffectL <<" );
+    return EFalse;
+    }    
+
 TBool CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn(CHuiControlGroup* aToGroup)
     {
     if (!aToGroup || (aToGroup && aToGroup->Count() == 0))
         {
         return EFalse;
         }
-      iTempRegion.Clear();
+    iTempRegion.Clear();
     
     CAlfScreen* screen = iAlfScreens[0];
     TRect fullscreen = TRect(TPoint(0,0), screen->Size());
@@ -5053,6 +5222,16 @@
     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);
+    // alf content check is relavant only for alf apps
+    if (!fullscreenCovered && aToGroup->iAlfApp) 
+        {
+        TInt clientGroupId = FindClientWindowGroupId(0, *aToGroup);
+        if (clientGroupId != KErrNotFound)
+            {
+            fullscreenCovered = HasActiveAlfContent(clientGroupId);
+            }
+        }
+    
     __ALFFXLOGSTRING1("CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn - Covered: %d", fullscreenCovered);
     if (fullscreenCovered)
         {
@@ -5460,7 +5639,7 @@
 
         // 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 );
+        __ALFFXLOGSTRING2("HandleGfxControlEffectsL - loading control effect, handle %d, Action: %d", aEvent.iHandle, aEvent.iAction );
         if (aCanvasVisual->Effect())
             {
             __ALFFXLOGSTRING1("HandleGfxControlEffectsL - 0x%x has active effect. Requesting removal.", aCanvasVisual);
@@ -5469,17 +5648,12 @@
             }
         TBool layoutEffectable(EFalse);
         if (aEvent.iAction == KGfxControlDisappearAction)
-            { // TODO: revise
-            // The control stays visible because the inactive flag is not set
-            // if the window is reserved.
-            /*if (aCanvasVisual->iOpacity.Target() == 0.0f)
-                {
-                // this visual was hidden, before the effect arrived. sounds like trouble.
-                // Lets make it visible again, and ask it to be hidden in the end of the effect
-                // this enables at least the notes disappear effects
-                aCanvasVisual->iOpacity.Set(KAlfVisualDefaultOpacity);
-                // visual->SetFlag(EHuiVisualFlagShouldBeHidden);
-                }*/
+            {
+            if (aCanvasVisual->Flags() & EHuiVisualFlagInactive)
+                {
+                __ALFFXLOGSTRING1("HandleGfxControlEffectsL - 0x%x is inactive. Skipping effect.", aCanvasVisual);
+                return;
+                }
             layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, ETrue, EFalse);
             }
         else
@@ -5510,10 +5684,10 @@
             }
         //            RDebug::Print(_L("HandleGfxControlEffectsL - loading effect returned %d"), err );
         // only use the effect if the effect file was correctly parsed
+        aCanvasVisual->SetFreezeState(EFalse);
+                  
         if (err == KErrNone)
             {
-            iLastEffectHandle = aEvent.iHandle;
-
 #ifdef HUI_DEBUG_TRACK_DRAWING  
             visual->SetTracking(ETrue);
 #endif                
@@ -5828,6 +6002,38 @@
     // around will be cleared when HandleGfxStopEffectsL is called
 
     // iFinishedCleanupStackEffects.Append(aHandle);
+    
+	// check if the first part of application start effect finished
+    if (iFullScreenEffectData 
+            && iFullScreenEffectData->iHandle == aHandle
+            && iFullScreenEffectData->iLongAppStartTimeout && iSecondaryFullScreenEffectData)
+        {
+        delete iFullScreenEffectData;
+        iFullScreenEffectData = iSecondaryFullScreenEffectData;
+        iSecondaryFullScreenEffectData = NULL;
+        iFullScreenEffectData->iTwoPhaseEffect = CFullScreenEffectState::ESecondPartActive;
+        if (iFullScreenEffectData->State() == EEndFullscreenReceived)
+            {
+            // Client notified of the EndFullScreen during the effect. Trigger the end part immediately.
+            __ALFFXLOGSTRING("CAlfBridge::AlfGfxEffectEndCallBack - End was received. Trigger second part.");
+            iFullScreenEffectData->SetState(ESecondPhaseSetupActive); // effect setup will be skipped in HandleGfxEvent
+            GfxTriggerEndFullScreen(iFullScreenEffectData);
+            iFullScreenEffectData->SetState(EFinalEffectActive);
+			// skip cleanup. It will be run, when this effect finishes
+            return;
+            }
+        else
+            {
+            iFullScreenEffectData->SetState(EWaitEndFullScreen);
+            }
+        
+        iFullScreenEffectData->iEffectType = CFullScreenEffectState::EStartEffect;
+        
+        CHuiControlGroup* toGroup = FindControlGroupByFullScreenToEffect();
+        GfxTriggerEffectWhenFullScreenDrawn(toGroup);
+        return;
+        }
+    
     if (!iEffectEndTimer->IsActive())
         {
         TRAP_IGNORE(iEffectEndTimer->AddFinishedHandleL(aHandle));
@@ -5874,6 +6080,9 @@
         {
         delete iFullScreenEffectData;
         iFullScreenEffectData = NULL;
+        
+        delete iSecondaryFullScreenEffectData;
+        iSecondaryFullScreenEffectData = NULL;
         }
     }
     
@@ -6922,4 +7131,30 @@
         }
     }
 
+TBool CAlfBridge::HasActiveAlfContent( TInt aClientWgId )
+    {
+    TBool hasAlfContent = EFalse;
+    if(iAppUi)
+        {
+        CAlfAppSrvSessionBase* activeAlfSession = iAppUi->ActiveSession();
+        CAlfScreen* screen = iAlfScreens[0];
+        for(TInt i = 0 ; i < screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount() ; i++)
+            {
+            CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(i);
+            CHuiControl& control = controlgroup.Control(0);
+            if (control.Role() == EHuiSessionContainer)
+                {
+                CAlfAppSrvSessionBase* alfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup);
+                if(alfSrvSession && 
+                   (alfSrvSession->ClientWindowGroup() == aClientWgId))
+                    {
+                    hasAlfContent = ETrue;
+                    break;
+                    }
+                }
+            }
+        }
+    return hasAlfContent;
+    }
+
 // end of file
--- a/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -812,6 +812,31 @@
         }
     }
 
+void CFullScreenEffectState::ConstructL(const CFullScreenEffectState& aEffectState)
+    {
+    iAction = aEffectState.iAction;
+    iHandle = aEffectState.iHandle;
+    iType = aEffectState.iType;
+    iLongAppStartTimeout = aEffectState.iLongAppStartTimeout;
+    iTimeout = aEffectState.iTimeout;
+    iToWg = aEffectState.iToWg;
+    iFromWg = aEffectState.iFromWg;
+    iToAppId = aEffectState.iToAppId;
+    iFromAppId = aEffectState.iFromAppId;
+
+    iToSecureId = aEffectState.iToSecureId;
+    iFromSecureId = aEffectState.iFromSecureId;
+    
+    iRect.iTl.iX = aEffectState.iRect.iTl.iX;
+    iRect.iTl.iY = aEffectState.iRect.iTl.iY;
+    iRect.iBr.iX = aEffectState.iRect.iBr.iX;
+    iRect.iBr.iY = aEffectState.iRect.iBr.iY;
+    iState = aEffectState.iState;
+    iEffectName = aEffectState.iEffectName->AllocL();
+    iEffectType = aEffectState.iEffectType;
+    iCompletionHandle = aEffectState.iCompletionHandle;
+    iTwoPhaseEffect = CFullScreenEffectState::EOnlyOnePart;
+    }
 
 void CFullScreenEffectState::ConstructL(
         TInt aAction,
@@ -820,7 +845,8 @@
     iAction = aAction;
     iHandle = aStream.ReadInt32L();
     iType = aStream.ReadInt32L();
-    iTimeoutTriggered = aStream.ReadInt32L();
+    iLongAppStartTimeout = aStream.ReadInt32L();
+    iTimeout = aStream.ReadInt32L();
     iToWg = aStream.ReadInt32L();
     iFromWg = aStream.ReadInt32L();
     iToAppId = aStream.ReadInt32L();
@@ -828,7 +854,8 @@
 
     iToSecureId = aStream.ReadInt32L();
     iFromSecureId = aStream.ReadInt32L();
-    /*TInt flags =*/
+    
+    // TInt flags
     aStream.ReadInt32L();
     iRect.iTl.iX = aStream.ReadInt32L();
     iRect.iTl.iY = aStream.ReadInt32L();
@@ -838,8 +865,27 @@
     ResolveFileNameL(aStream);
 
     iCompletionHandle = iHandle;
+    iTwoPhaseEffect = CFullScreenEffectState::EOnlyOnePart;
     }
 
+void CFullScreenEffectState::SetState(TEffectState aState)
+    {
+    if (aState >= iState)
+        {
+        iState = aState;
+        }
+    else
+        {
+        __ALFFXLOGSTRING2("CFullScreenEffectState::SetState - WARNING! Trying to set to previous state. %d -> %d", iState, aState);
+        }
+    };
+        
+TEffectState CFullScreenEffectState::State()
+    {
+    return iState;
+    }
+      
+
 void CControlEffectState::ConstructL(TInt aAction,
         RMemReadStream& aStream)
     {
--- a/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -1317,6 +1317,7 @@
                     (TAny*)offset );
             }
         }
+    AMT_MAP_NODE_SET_ORDINAL_POSITION();
     }
 
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -234,6 +234,7 @@
     iCompositionTokens.Close();
     iWindowServerSessions.Close();
     iAlfTargets.Close();
+    iOptionalGRAM.Close();
     }
 
 void CAlfStreamerServer::AppendCompositionSessionL(CAlfStreamerServerSession* aSession, TBool aHost)
@@ -409,6 +410,30 @@
     __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL: Not Found <<")
     }
 
+void CAlfStreamerServer::FormAQueueL(TInt aOp, TInt aSecureId, TInt aWindowGroup)
+    {
+    __ALFLOGSTRING3("CAlfStreamerServer::FormAQueueL( %d, %d, %d )",aOp, aSecureId, aWindowGroup)
+    if (aOp == EAlfVolunteerForGoomTarget)
+        {
+        TAlfCompParams param = {aSecureId, aSecureId, aWindowGroup, aWindowGroup};
+        if (iOptionalGRAM.Find(param) != KErrNotFound)
+            {
+            __ALFLOGSTRING("CAlfStreamerServer::FormAQueueL: Already added");
+            return;
+            }    
+        User::LeaveIfError(iOptionalGRAM.Append(param));
+        }
+    else
+        {
+        for(TInt i = iOptionalGRAM.Count()-1; i >= 0; i-- )
+            {
+            if ( iOptionalGRAM[i].iWindowGroup == aWindowGroup )
+                {
+                iOptionalGRAM.Remove(i);
+                }       
+            }    
+        }    
+    }
 void CAlfStreamerServer::QueueRequestSessionsL(TInt aAlfToken, const TPtrC8& aPtr, TInt aOp)
     {
     __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL >>")
@@ -676,12 +701,29 @@
         }
     }
     
-void CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TBool aActiveAlso)
+void CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TInt aActiveAlso)
     {
-    RArray<TAlfCompParams>& arrayRef = aActiveAlso?iAlfTargets:iInactiveSurfaces;
+    TBool optionalOnly(aActiveAlso==EAlfVolunteersForCommonGood);  // to lessen ambiquity..
         
+    RArray<TAlfCompParams>* arrayPtr = 0;
+    switch (aActiveAlso)
+        {
+        case EAlfInactiveWgs:
+            arrayPtr = &iInactiveSurfaces;
+            break;
+        case EAlfAllWgsWithSurface:
+            arrayPtr = &iAlfTargets;
+            break;
+        case EAlfVolunteersForCommonGood:
+        default:
+            arrayPtr = &iOptionalGRAM;      
+            break;
+        }
+    
+    RArray<TAlfCompParams>& arrayRef =  *arrayPtr; // :)
+            
     TInt count = arrayRef.Count();    
-   __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL >> count %d", count)
+    __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL >> count %d", count);
     if ( count == 0)
         {
         aMessage.Complete(KErrNotFound);
@@ -689,20 +731,29 @@
         }
                 
     TInt maxLength = aMessage.GetDesMaxLength(0);
-    TInt* array = new (ELeave) TInt [maxLength/4];
+    TInt* arrayStart = new (ELeave) TInt [maxLength/4];
+    TInt* array = arrayStart;
+	
+    TInt payloadSize = optionalOnly?8:4; // what a waste
+    count = Min(maxLength/payloadSize-1, count);
     
-    count = Min(maxLength/4-1, count);
     for ( TInt i = 0; i<count; i++ ) 
         {
-        __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL adding %d", arrayRef[i].iWindowGroup);
-        array[i] = arrayRef[i].iWindowGroup;
+        __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL adding %d", arrayPtr[i].iWindowGroup);
+        *array = arrayRef[i].iWindowGroup;
+        array++;
+        if (optionalOnly)
+            {           
+            *array = arrayRef[i].iSecureId;
+            array++;
+            }
         }
         
-    array[count] = 0;
+    *array = 0;
         
-    TPtr8 ptr((TUint8*)array,maxLength,maxLength);
+    TPtr8 ptr((TUint8*)arrayStart,maxLength,maxLength);
     aMessage.WriteL(0, ptr);
-    delete[] array;
+    delete[] arrayStart;
     aMessage.Complete(KErrNone);
    __ALFLOGSTRING("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL <<")
     }
@@ -994,6 +1045,14 @@
             server->Bridge()->AddData( EAlfDSSetDistractionWindow, windowGroupId, windowHandle, (TAny*)state );
             break;
             }
+        case EAlfVolunteerForGoomTarget:  
+        case EAlfExcludeFromGoomTargets:
+            { // all these volunteers, just get into a line..
+            server->FormAQueueL(op, aMessage.Int0(), aMessage.Int1());    
+            break;    
+            }            
+            
+            
         default:
             {
             aMessage.Complete(KErrNotSupported);
--- a/uiacceltk/hitchcock/ServerCore/Src/alfvisualhandlers.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfvisualhandlers.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -777,7 +777,10 @@
                 AMT_ADD_TIME(params->iHandle, time.Int64(), ETrue);
 #endif  
                 CHuiFxEffect* effect = NULL;
-                engine->LoadEffectL( params->iFileName, effect, iVisual->Effectable(), NULL , NULL, params->iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn );
+                // Note: alf effects do not support taking screenshot 
+				// Note: alf effects do not support freezing.
+				engine->LoadEffectL( params->iFileName, effect, iVisual->Effectable(), NULL , NULL, params->iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn );
+	            iVisual->SetFreezeState(EFalse); 
                 // The effect will be automatically set to the visual if parsing succeeds
                 }
             break;
@@ -798,7 +801,10 @@
                 // this will add the group, if it does not exist already
                 // Begin and End group events are supposed to come through GfxTransEffect API.
                 engine->BeginGroupEffect(groupHandle);
+                // Note: alf effects do not support taking screenshot 
+				// Note: alf effects do not support freezing.
                 engine->LoadGroupEffectL( params->iFileName, effect, iVisual->Effectable(),groupHandle, NULL, NULL, params->iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn );
+	            iVisual->SetFreezeState(EFalse);
                 // The effect will be automatically set to the visual if parsing succeeds
                 }
             break;
@@ -806,6 +812,7 @@
         case EAlfVisualRemoveEffect:
             {
             iVisual->SetEffect(NULL);
+            iVisual->SetFreezeState(EFalse); // Note: alf effects do not support freezing.
             break;
             }
 
--- a/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -74,8 +74,6 @@
     RPointerArray<CAlfWindow> iWindows;
     RArray<TPluginInfo> iPlugins;
     CAlfHierarchyModel* iTree;
-    
-    RPointerArray<CAlfWindow> iChangedWindows;    
     };
 
 // ---------------------------------------------------------------------------
@@ -440,10 +438,6 @@
 //
 void CAlfWindowManager::ContentReady(CAlfWindow& aWindow, CAlfWindowBuffer* aOutBuffer)
     {
-    //ASSERT(iData->iChangedWindows.Find(&aWindow) == KErrNotFound); // no plugin should produce more frames
-                                                            // than actually bound to scene
-    iData->iChangedWindows.Append(&aWindow);
-
     if(!aWindow.IsInsertedToScene())
     	{
     	TRAPD( err, BindWindowToHitchL(&aWindow, this) );
@@ -648,7 +642,6 @@
 //   
 void CAlfWindowManager::PrepareNewFrame(TUint aEstimatedInterval)
     {
-    iData->iChangedWindows.Reset();
     for (TInt i = iData->iPlugins.Count()-1; i >= 0 ; i--)
         {
         TRAP_IGNORE(iData->iPlugins[i].iPlugin->PrepareFrameL(aEstimatedInterval));
--- a/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF	Wed Jun 09 10:41:25 2010 +0300
@@ -1391,12 +1391,12 @@
 	?RegisterParameterL@CHuiFxVisualLayer@@IAEXABVTDesC16@@PAM@Z @ 1390 NONAME ; void CHuiFxVisualLayer::RegisterParameterL(class TDesC16 const &, float *)
 	?NewL@CHuiFxEffect@@SAPAV1@AAVCHuiFxEngine@@@Z @ 1391 NONAME ; class CHuiFxEffect * CHuiFxEffect::NewL(class CHuiFxEngine &)
 	?ConstructL@CHuiFxVisualLayer@@IAEXPAVMHuiEffectable@@@Z @ 1392 NONAME ; void CHuiFxVisualLayer::ConstructL(class MHuiEffectable *)
-	?Draw@CHuiFxEffect@@QAEHAAVCHuiGc@@ABVTRect@@@Z @ 1393 NONAME ; int CHuiFxEffect::Draw(class CHuiGc &, class TRect const &)
+	?Draw@CHuiFxEffect@@QAEHAAVCHuiGc@@ABVTRect@@H@Z @ 1393 NONAME ; int CHuiFxEffect::Draw(class CHuiGc &, class TRect const &)
 	?TargetRect@CHuiFxLayer@@QBEABVTRect@@XZ @ 1394 NONAME ; class TRect const & CHuiFxLayer::TargetRect(void) const
 	?AdvanceTime@CHuiFxVisualLayer@@UAEXM@Z @ 1395 NONAME ; void CHuiFxVisualLayer::AdvanceTime(float)
 	?Filter@CHuiFxFilterLayer@@QBEAAVCHuiFxFilter@@XZ @ 1396 NONAME ; class CHuiFxFilter & CHuiFxFilterLayer::Filter(void) const
 	?IsFreeForm@CHuiFxFilter@@QBEHXZ @ 1397 NONAME ; int CHuiFxFilter::IsFreeForm(void) const
-	?Draw@CHuiFxFilterLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2@Z @ 1398 NONAME ; void CHuiFxFilterLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
+	?Draw@CHuiFxFilterLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2H@Z @ 1398 NONAME ; void CHuiFxFilterLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
 	?SetSourceRect@CHuiFxLayer@@QAEXABVTRect@@@Z @ 1399 NONAME ; void CHuiFxLayer::SetSourceRect(class TRect const &)
 	??1CHuiFxRenderbuffer@@UAE@XZ @ 1400 NONAME ; CHuiFxRenderbuffer::~CHuiFxRenderbuffer(void)
 	?SetBlendingMode@CHuiFxLayer@@QAEXW4THuiFxBlendingMode@@@Z @ 1401 NONAME ; void CHuiFxLayer::SetBlendingMode(enum THuiFxBlendingMode)
@@ -1416,7 +1416,7 @@
 	?Changed@CHuiFxFilterLayer@@UBEHXZ @ 1415 NONAME ; int CHuiFxFilterLayer::Changed(void) const
 	?AddLayerL@CHuiFxEffect@@QAEXPBVCHuiFxLayer@@@Z @ 1416 NONAME ; void CHuiFxEffect::AddLayerL(class CHuiFxLayer const *)
 	?EffectsEngine@CHuiEnv@@QBEPAVCHuiFxEngine@@XZ @ 1417 NONAME ; class CHuiFxEngine * CHuiEnv::EffectsEngine(void) const
-	?Draw@CHuiFxGroupLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2@Z @ 1418 NONAME ; void CHuiFxGroupLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
+	?Draw@CHuiFxGroupLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2H@Z @ 1418 NONAME ; void CHuiFxGroupLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
 	??0CHuiFxRenderbuffer@@IAE@XZ @ 1419 NONAME ; CHuiFxRenderbuffer::CHuiFxRenderbuffer(void)
 	?AddEffectL@CHuiFxEngine@@IAEXPAVCHuiFxEffect@@@Z @ 1420 NONAME ; void CHuiFxEngine::AddEffectL(class CHuiFxEffect *)
 	?Engine@CHuiFxEffect@@QBEAAVCHuiFxEngine@@XZ @ 1421 NONAME ; class CHuiFxEngine & CHuiFxEffect::Engine(void) const
@@ -1460,7 +1460,7 @@
 	?SetEffect@CHuiVisual@@QAEXPAVCHuiFxEffect@@@Z @ 1459 NONAME ; void CHuiVisual::SetEffect(class CHuiFxEffect *)
 	?SetMargin@CHuiFxFilter@@QAEXABVTSize@@@Z @ 1460 NONAME ; void CHuiFxFilter::SetMargin(class TSize const &)
 	?PrepareDrawL@CHuiFxFilterLayer@@UAEHAAVCHuiFxEngine@@@Z @ 1461 NONAME ; int CHuiFxFilterLayer::PrepareDrawL(class CHuiFxEngine &)
-	?Draw@CHuiFxVisualLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2@Z @ 1462 NONAME ; void CHuiFxVisualLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
+	?Draw@CHuiFxVisualLayer@@UAEXAAVCHuiFxEngine@@AAVCHuiGc@@AAVCHuiFxRenderbuffer@@2H@Z @ 1462 NONAME ; void CHuiFxVisualLayer::Draw(class CHuiFxEngine &, class CHuiGc &, class CHuiFxRenderbuffer &, class CHuiFxRenderbuffer &)
 	?SkinInstance@CHuiStatic@@SAPAVMAknsSkinInstance@@XZ @ 1463 NONAME ; class MAknsSkinInstance * CHuiStatic::SkinInstance(void)
 	?SetTrackCommandSet@CHuiCanvasVisual@@QAEXAAV?$TBuf@$0BAA@@@H@Z @ 1464 NONAME ; void CHuiCanvasVisual::SetTrackCommandSet(class TBuf<256> &, int)
 	?PopTransformationMatrix@CHuiCanvasGc@@UAEXXZ @ 1465 NONAME ; void CHuiCanvasGc::PopTransformationMatrix(void)
--- a/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF	Wed Jun 09 10:41:25 2010 +0300
@@ -1733,7 +1733,7 @@
 	_ZN12CHuiFxEffect10ConstructLEv @ 1732 NONAME
 	_ZN12CHuiFxEffect11AdvanceTimeEf @ 1733 NONAME
 	_ZN12CHuiFxEffect20SetEffectEndObserverEP21MAlfGfxEffectObserveri @ 1734 NONAME
-	_ZN12CHuiFxEffect4DrawER6CHuiGcRK5TRect @ 1735 NONAME
+	_ZN12CHuiFxEffect4DrawER6CHuiGcRK5TRecti @ 1735 NONAME
 	_ZN12CHuiFxEffect4NewLER12CHuiFxEngine @ 1736 NONAME
 	_ZN12CHuiFxEffect7ChangedEv @ 1737 NONAME
 	_ZN12CHuiFxEffect9AddLayerLEPK11CHuiFxLayer @ 1738 NONAME
@@ -1773,7 +1773,7 @@
 	_ZN16CHuiFxGroupLayer10VisualAreaER5TRect @ 1772 NONAME
 	_ZN16CHuiFxGroupLayer11AdvanceTimeEf @ 1773 NONAME
 	_ZN16CHuiFxGroupLayer12PrepareDrawLER12CHuiFxEngine @ 1774 NONAME
-	_ZN16CHuiFxGroupLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_ @ 1775 NONAME
+	_ZN16CHuiFxGroupLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_i @ 1775 NONAME
 	_ZN16CHuiFxGroupLayer4NewLEi @ 1776 NONAME
 	_ZN16CHuiFxGroupLayer9AddLayerLEPK11CHuiFxLayer @ 1777 NONAME
 	_ZN16CHuiFxGroupLayerC1Ev @ 1778 NONAME
@@ -1784,14 +1784,14 @@
 	_ZN17CHuiFxFilterLayer10ConstructLEP12CHuiFxFilter @ 1783 NONAME
 	_ZN17CHuiFxFilterLayer11AdvanceTimeEf @ 1784 NONAME
 	_ZN17CHuiFxFilterLayer12PrepareDrawLER12CHuiFxEngine @ 1785 NONAME
-	_ZN17CHuiFxFilterLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_ @ 1786 NONAME
+	_ZN17CHuiFxFilterLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_i @ 1786 NONAME
 	_ZN17CHuiFxVisualLayer10ConstructLEP14MHuiEffectable @ 1787 NONAME
 	_ZN17CHuiFxVisualLayer10VisualAreaER5TRect @ 1788 NONAME
 	_ZN17CHuiFxVisualLayer11AdvanceTimeEf @ 1789 NONAME
 	_ZN17CHuiFxVisualLayer12PrepareDrawLER12CHuiFxEngine @ 1790 NONAME
 	_ZN17CHuiFxVisualLayer18RegisterParameterLERK7TDesC16P4TRgb @ 1791 NONAME
 	_ZN17CHuiFxVisualLayer18RegisterParameterLERK7TDesC16Pf @ 1792 NONAME
-	_ZN17CHuiFxVisualLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_ @ 1793 NONAME
+	_ZN17CHuiFxVisualLayer4DrawER12CHuiFxEngineR6CHuiGcR18CHuiFxRenderbufferS5_i @ 1793 NONAME
 	_ZN17CHuiFxVisualLayer4NewLEP14MHuiEffectable @ 1794 NONAME
 	_ZN17CHuiFxVisualLayer9ParameterERK7TDesC16 @ 1795 NONAME
 	_ZN17CHuiFxVisualLayerD0Ev @ 1796 NONAME
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffect.h	Wed Jun 09 10:41:25 2010 +0300
@@ -102,7 +102,7 @@
     IMPORT_C static CHuiFxEffect* NewL(CHuiFxEngine& aEngine);
     IMPORT_C void AddLayerL(const CHuiFxLayer* aLayer); // takes ownership
     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
-    IMPORT_C TBool Draw(CHuiGc& aGc, const TRect& aDisplayRect);
+    IMPORT_C TBool Draw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aHasSurface);
     IMPORT_C CHuiFxEngine& Engine() const;
     IMPORT_C TBool VisualArea(TRect& aRect) const;
     IMPORT_C TBool Changed();
@@ -168,7 +168,7 @@
      *                   
      *  @return ETrue if drawing was done, otherwise EFalse   
      */
-    TBool CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TInt aAlpha = 255);
+    TBool CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TBool aHasSurface, TInt aAlpha = 255);
     TBool CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque);
 
     void FxmlVisualInputs(RArray<THuiFxVisualSrcType> &aArray);
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilter.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilter.h	Wed Jun 09 10:41:25 2010 +0300
@@ -34,7 +34,7 @@
     IMPORT_C virtual ~CHuiFxFilter();
     IMPORT_C virtual TBool PrepareDrawL(CHuiFxEngine& aEngine);
     IMPORT_C virtual TBool Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-                               const TRect& aTargetRect, const TRect& aSourceRect) = 0;
+                               const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface) = 0;
     // CalculateMargin will be called before PrepareDrawL(), so 
     // parameters are not ready, so margin calculation need to use 
     // either previous frame parameter values, or should be independent 
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilterLayer.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxFilterLayer.h	Wed Jun 09 10:41:25 2010 +0300
@@ -31,7 +31,7 @@
     IMPORT_C ~CHuiFxFilterLayer();
     IMPORT_C static CHuiFxFilterLayer* NewL(CHuiFxFilter* aFilter); // takes ownership
     IMPORT_C TBool PrepareDrawL(CHuiFxEngine& aEngine);
-    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource);
+    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface);
     IMPORT_C CHuiFxFilter& Filter() const;
     IMPORT_C TBool Changed() const;
     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxGroupLayer.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxGroupLayer.h	Wed Jun 09 10:41:25 2010 +0300
@@ -28,7 +28,7 @@
     IMPORT_C ~CHuiFxGroupLayer();
     IMPORT_C static CHuiFxGroupLayer* NewL(TBool aIsRoot = EFalse);
     IMPORT_C TBool PrepareDrawL(CHuiFxEngine& aEngine);
-    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource);
+    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface);
     IMPORT_C void AddLayerL(const CHuiFxLayer* aLayer); // takes ownership
     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
     IMPORT_C TBool Changed() const;
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxLayer.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxLayer.h	Wed Jun 09 10:41:25 2010 +0300
@@ -32,7 +32,7 @@
     IMPORT_C virtual ~CHuiFxLayer();
 
     IMPORT_C virtual TBool PrepareDrawL(CHuiFxEngine& aEngine);
-    virtual void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource) = 0;
+    virtual void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface) = 0;
     IMPORT_C virtual TBool VisualArea(TRect& aRect);
     IMPORT_C virtual TBool Margin( TMargins &m );
     IMPORT_C virtual void AdvanceTime(TReal32 aElapsedTime);
--- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxVisualLayer.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxVisualLayer.h	Wed Jun 09 10:41:25 2010 +0300
@@ -32,7 +32,7 @@
     IMPORT_C static CHuiFxVisualLayer* NewL(MHuiEffectable* aVisual); // param mandatory
     IMPORT_C ~CHuiFxVisualLayer();
     IMPORT_C TBool PrepareDrawL(CHuiFxEngine& aEngine);
-    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource);
+    IMPORT_C void Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface);
     IMPORT_C TBool VisualArea( TRect& aRect );
     IMPORT_C void AdvanceTime(TReal32 aElapsedTime);
     IMPORT_C TBool Changed() const;
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BevelFilter.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BevelFilter.h	Wed Jun 09 10:41:25 2010 +0300
@@ -29,7 +29,7 @@
     CHuiFxVg10BevelFilter *CloneL() const;
 protected:
     void ConstructL();
-    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight);
+    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface);
 private:
     TReal32             iOutlineX;
     TReal32             iOutlineY;
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BlurFilter.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10BlurFilter.h	Wed Jun 09 10:41:25 2010 +0300
@@ -28,9 +28,9 @@
     static CHuiFxVg10BlurFilter* NewL();
     TBool Draw(CHuiFxEngine& aEngine, CHuiGc& aGc,
             CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-            const TRect& aTargetRect, const TRect& aSourceRect);
+            const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface);
 
-    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight);
+    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface);
     void CalculateMargin(TMargins &aMargin) const;  
     CHuiFxVg10BlurFilter *CloneL() const;
 protected:
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10ColorMatrixFilterBase.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10ColorMatrixFilterBase.h	Wed Jun 09 10:41:25 2010 +0300
@@ -29,7 +29,7 @@
     static CHuiFxVg10ColorMatrixFilterBase* NewL();
 protected:
     void ConstructL();
-    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight);
+    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface);
     virtual void UpdateColorMatrix();
     void CopyFromL(const CHuiFxVg10ColorMatrixFilterBase *aOldFilter);
     CHuiFxVg10ColorMatrixFilterBase *CloneL() const;
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10FilterBase.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10FilterBase.h	Wed Jun 09 10:41:25 2010 +0300
@@ -35,10 +35,10 @@
 public: // from CHuiFxFilter
     virtual TBool Draw(CHuiFxEngine& aEngine, CHuiGc& aGc,
             CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-            const TRect& aTargetRect, const TRect& aSourceRect);
+            const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface);
 
 private:
-    virtual void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight) = 0;
+    virtual void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface) = 0;
 protected:
     TBool wasEnoughMemory();
     
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10OutlineFilter.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10OutlineFilter.h	Wed Jun 09 10:41:25 2010 +0300
@@ -28,7 +28,7 @@
     static CHuiFxVg10OutlineFilter* NewL();
 protected:
     void ConstructL();
-    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight);
+    void DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool aHasSurface);
     void CalculateMargin(TMargins &aMargin) const;  
     CHuiFxVg10OutlineFilter *CloneL() const;
 private:
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10TransformFilter.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiFxVg10TransformFilter.h	Wed Jun 09 10:41:25 2010 +0300
@@ -26,9 +26,9 @@
 public: // from CHuiFxFilter
     virtual TBool Draw(CHuiFxEngine& aEngine, CHuiGc& aGc,
                        CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-                       const TRect& aTargetRect, const TRect& aSourceRect);
+                       const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface);
     static CHuiFxVg10TransformFilter* NewL();
-    void DrawEffect(CHuiFxEngine& /*aEngine*/, VGImage /*aTargetImage*/, VGImage /*aSourceImage*/, TInt /*aWidth*/, TInt /*aHeight*/) {}
+    void DrawEffect(CHuiFxEngine& /*aEngine*/, VGImage /*aTargetImage*/, VGImage /*aSourceImage*/, TInt /*aWidth*/, TInt /*aHeight*/, TBool /*aHasSurface*/) {}
     void CalculateMargin(TMargins &aMargin) const;  
     CHuiFxVg10TransformFilter *CloneL() const;
 protected:
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BevelFilter.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BevelFilter.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -59,7 +59,7 @@
     return filter;
     }
 
-void CHuiFxVg10BevelFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight)
+void CHuiFxVg10BevelFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool /*aHasSurface*/)
     {
     VGfloat outline_x = clamp(iOutlineX, EPSILON, 128.0f);
     VGfloat outline_y = clamp(iOutlineY, EPSILON, 128.0f);
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BlurFilter.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BlurFilter.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -84,7 +84,7 @@
 }
 
 TBool CHuiFxVg10BlurFilter::Draw(CHuiFxEngine& aEngine, CHuiGc& /* aGc */, CHuiFxRenderbuffer& aTarget,
-                                 CHuiFxRenderbuffer& aSource, const TRect& aTargetRect, const TRect& aSourceRect)
+                                 CHuiFxRenderbuffer& aSource, const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface)
     {
     aTarget.BindAsTexture(ERenderbufferUsageWriteOnly);
     aSource.BindAsTexture(ERenderbufferUsageReadOnly);
@@ -96,7 +96,7 @@
 
     if(opacity > EPSILON)
         {
-        DrawEffect(aEngine, destImage, srcImage, aSourceRect.Width(), aSourceRect.Height());
+        DrawEffect(aEngine, destImage, srcImage, aSourceRect.Width(), aSourceRect.Height(), aHasSurface);
         }
     else
         {
@@ -116,7 +116,7 @@
     return wasEnoughMemory();
     }
 
-void CHuiFxVg10BlurFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight)
+void CHuiFxVg10BlurFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool /*aHasSurface*/)
     {
     const VGfloat blur_x = clamp(iBlurX, EPSILON, 128.0f);
     const VGfloat blur_y = clamp(iBlurY, EPSILON, 128.0f);
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -87,8 +87,5 @@
     iColorMatrix[16] = oOff;
     iColorMatrix[17] = oOff;
     iColorMatrix[18] = oOff;
-    iColorMatrix[19] = 0.5f; // add 0.5 to alpha so that surfaces fade aswell
-	                         // it should be considered if this should only
-							 // be done for visuals with a background
-							 // surface
+    iColorMatrix[19] = 0.0f; 
     }
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10ColorMatrixFilterBase.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10ColorMatrixFilterBase.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -44,7 +44,7 @@
     CHuiFxVg10FilterBase::CopyFromL(aOldFilter);
     memcpy(iColorMatrix, aOldFilter->iColorMatrix, sizeof(iColorMatrix));
     }
-void CHuiFxVg10ColorMatrixFilterBase::DrawEffect(CHuiFxEngine& /*aEngine*/, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight )
+void CHuiFxVg10ColorMatrixFilterBase::DrawEffect(CHuiFxEngine& /*aEngine*/, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight,TBool aHasSurface )
     {
     // take opacity into account
     const VGfloat opacity = clamp(iOpacity, 0.0f, 1.0f);
@@ -55,6 +55,8 @@
             {
             UpdateColorMatrix();
             }
+
+        iColorMatrix[19] = aHasSurface ? 0.5f : 0.0f;
         vgColorMatrix(aTargetImage, aSourceImage, iColorMatrix);
         }
     else
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10FilterBase.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10FilterBase.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -25,7 +25,7 @@
 
 
 TBool CHuiFxVg10FilterBase::Draw(CHuiFxEngine& aEngine, CHuiGc& /* aGc */, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-                                            const TRect& aTargetRect, const TRect& aSourceRect)
+                                            const TRect& aTargetRect, const TRect& aSourceRect, TBool aHasSurface)
     {
     aTarget.BindAsTexture(ERenderbufferUsageWriteOnly);
     aSource.BindAsTexture(ERenderbufferUsageReadOnly);
@@ -37,7 +37,7 @@
 
     if(opacity > EPSILON)
         {
-        DrawEffect(aEngine, destImage, srcImage, aSourceRect.Width(), aSourceRect.Height());
+        DrawEffect(aEngine, destImage, srcImage, aSourceRect.Width(), aSourceRect.Height(), aHasSurface);
         }
     else
         {
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10OutlineFilter.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10OutlineFilter.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -70,7 +70,7 @@
 }
 
 
-void CHuiFxVg10OutlineFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight)
+void CHuiFxVg10OutlineFilter::DrawEffect(CHuiFxEngine& aEngine, VGImage aTargetImage, VGImage aSourceImage, TInt aWidth, TInt aHeight, TBool /*aHasSurface*/)
     {
     VGfloat outline_x = clamp(iOutlineX, EPSILON, 128.0f);
     VGfloat outline_y = clamp(iOutlineY, EPSILON, 128.0f);
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10TransformFilter.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10TransformFilter.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -154,7 +154,7 @@
 
 TBool CHuiFxVg10TransformFilter::Draw(CHuiFxEngine& /*aEngine*/, CHuiGc& /*aGc*/,
         CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource,
-        const TRect& /*aTargetRect*/, const TRect& aSourceRect)
+        const TRect& /*aTargetRect*/, const TRect& aSourceRect, TBool /*aHasSurface*/)
     {
     aSource.BindAsTexture(ERenderbufferUsageReadOnly);
     aTarget.BindAsRenderTarget();
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10RenderSurface.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10RenderSurface.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -28,6 +28,9 @@
 #include <gdi.h>
 #include "uiacceltk/HuiProbe.h"
 #include "uiacceltk/HuiEnv.h"
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+#include <graphics/wstfxconst.h>
+#endif
 
 #include <M3G/m3g_core.h>
 
@@ -196,6 +199,10 @@
     if(iDisplay->NativeWindow())
         {
         HUI_DEBUG(_L("CHuiVg10RenderSurface::CreateSurface() - Attempting to create a real window surface."));
+#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
+        RDebug::Printf("STFX: ALF_HACK CHuiVg10RenderSurface::CreateSurface()");
+        iDisplay->NativeWindow()->SetPurpose(ETfxPurposeDesktopWindow);
+#endif
         EGLSurface surf = eglCreateWindowSurface(iEglDisplay, aConfig,
                                       iDisplay->NativeWindow(), attriblistPtr);
 
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -244,13 +244,13 @@
     HandleBuffer(scannedRect, EScanBuffer, NULL); 
     
     // Note: this could be improved to take care of dirty rects 
-    if (Effect() && Display())
+    if (Effect() && Display() && CHuiEnv::Static()->MemoryLevel() != EHuiMemoryLevelLowest )
         {        
         // If there is effect enabled, we cannot say anything about dirty area so
         // we set whole screen dirty.
         scannedRect = TRect(TPoint(0,0), Display()->VisibleArea().Size());
         }
-    else if (IsBackgroundDrawingEnabled() || IsExternalContentDrawingEnabled())
+    else if (IsExternalContentDrawingEnabled())
         {
         // If the visual has external content or draws background, 
         // set always the whole window area as a content.
@@ -349,6 +349,8 @@
     
     if (Effect())
         {
+        TBool hasStoredContent = (IsDelayedEffectSource() || Freezed()) && (StoredRenderBuffer() ||  iCanvasVisualData->iStoredRenderBuffer);
+    
         TBool semiTranparentEffectActive = Effect()->IsSemitransparent();
         if ((iOpacity.Now() <= EPSILON && !semiTranparentEffectActive))
             {
@@ -361,7 +363,8 @@
             !HasCommandBuffers(ETrue /*include children*/) && 
             !IsBackgroundDrawingEnabled() &&
             !IsExternalContentDrawingEnabled()&&
-            !IsExternalContentDrawingEnabled(ETrue /*include children*/))
+            !IsExternalContentDrawingEnabled(ETrue /*include children*/) &&
+            !hasStoredContent )
             {
             return ETrue;
             }
@@ -456,26 +459,27 @@
         transparent |= iOpacity.Now() < 1.0f; // Opacity less than 1.0f -> always transparent
                 
         TBool refreshCache = EFalse;        
+        TBool layer =  EFalse;
         if (EffectIsAppliedToChildren())
             {
             refreshCache |= ChildTreeChanged(EHuiCanvasFlagExcludeFromParentEffect);
 
             iCanvasVisualData->iPaintedRegion.Clear();
-            CollectRecursivePaintedRegion(iCanvasVisualData->iPaintedRegion, EHuiCanvasFlagExcludeFromParentEffect);
+            layer = CollectRecursivePaintedRegion(iCanvasVisualData->iPaintedRegion, EHuiCanvasFlagExcludeFromParentEffect);
             }
         else
             {
             refreshCache |= Changed();            
 
             iCanvasVisualData->iPaintedRegion.Clear();
-            CollectPaintedRegion(iCanvasVisualData->iPaintedRegion, 0);
+            layer = CollectPaintedRegion(iCanvasVisualData->iPaintedRegion, 0);
             }
 
         if(Display()->RosterImpl().AlfEventWindow() == this)
             {
             refreshCache |= Display()->RosterImpl().NativeAppsContentChanged();
             }
-        didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion);
+        didDrawEffect = Effect()->CachedDraw(aGc, area, refreshCache, !transparent, iCanvasVisualData->iPaintedRegion,layer );
         
         }
     
@@ -547,8 +551,8 @@
 #endif		
     TBool alfEventWindow = (Display()->RosterImpl().AlfEventWindow() == this);
     TReal32 effectiveOpacity = EffectiveOpacity();
-        
-    if ((effectiveOpacity <= 0 || !HasCommandBuffers(ETrue)) && !alfEventWindow)
+    TBool hasStoredContent = (IsContentDrawingEnabled() && (IsDelayedEffectSource() || Freezed())) && (StoredRenderBuffer() || iCanvasVisualData->iStoredRenderBuffer);        
+    if ((effectiveOpacity <= 0 || !HasCommandBuffers(ETrue)) && !alfEventWindow && !hasStoredContent)
         {
         // In case background drawing is enabled, and even if we don't have command buffers we still
         // want to issue clear. If the background drawing is enabled here, it means that the
@@ -564,7 +568,7 @@
             }
         }
 
-    if (IsContentDrawingEnabled() && (IsDelayedEffectSource() || Freezed()))
+    if (hasStoredContent)
         {
         // Select right draw mode
         THuiCanvasDrawMode drawMode = (Flags() & EHuiVisualFlagOpaqueHint) ? EHuiCanvasDrawModeNormal : EHuiCanvasDrawModeBlend;
@@ -889,7 +893,12 @@
         PrepareCache();
         }
     
-    SetChanged();
+    // don't call setchanged directly here, as it changes all
+    // the command buffers dirty. We don't want to do that
+    // as the drawing area might be significantly smaller in
+    // some cases
+    CHuiLayout::SetChanged();
+    Env().ContinueRefresh(ETrue);
     Env().CanvasTextureCache().EnableTouchCountCheck(EFalse);    
     }
 
@@ -1525,7 +1534,7 @@
 		}
     }
 
-void CHuiCanvasVisual::CollectPaintedRegion(TRegion& aPaintRegion, TInt aExcludeCanvasFlags) const
+TBool CHuiCanvasVisual::CollectPaintedRegion(TRegion& aPaintRegion, TInt aExcludeCanvasFlags) const
     {
     // Only our own painted areas.
     TInt paintedAreaCount = PaintedAreaCount();  
@@ -1534,12 +1543,13 @@
         aPaintRegion.AddRect( CanvasPaintedArea(i).iPaintedRect.Round() );
         }
     aPaintRegion.Tidy();
+    return !iCanvasVisualData->iLayerExtent.IsEmpty();
     }
 
-void CHuiCanvasVisual::CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const
+TBool CHuiCanvasVisual::CollectRecursivePaintedRegion(TRegion& aRecursivePaintRegion, TInt aExcludeCanvasFlags) const
     {
     // First our own painted areas...
-    CollectPaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags);
+    TBool layer = CollectPaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags);
             
     // ...then children (and their children).
     const TInt count = Count();
@@ -1559,13 +1569,14 @@
                     if (visual->Flags() & EHuiVisualFlagWserv)
                         {
                         CHuiCanvasVisual* canvasVisual = (CHuiCanvasVisual*)visual;
-                        canvasVisual->CollectRecursivePaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags);
+                        layer |= canvasVisual->CollectRecursivePaintedRegion(aRecursivePaintRegion, aExcludeCanvasFlags);
                         }
                     }
                 }        
             }
         }    
     aRecursivePaintRegion.Tidy();
+    return layer;
     }
 
 EXPORT_C TRect CHuiCanvasVisual::CommandBufferCoverage(TInt aOrientation)
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -50,6 +50,10 @@
 #include "HuiFxEngine.h"
 #include "huiextension.h"
 
+#include <e32math.h>
+
+//#define DEBUG_SW_MODE_DIRTY_AREAS
+
 const TUid KHuiInternalFbsBitmapBufferGcUid = {0x2000e5a3}; 
 
 //#define HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL
@@ -884,7 +888,7 @@
         // Set up the clipping rectangle.
         TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx];
         ClipDirtyRect(dirtyRect, VisibleAreaClippingRect());
-        
+        iCurrentDirtyRect = dirtyRect;
         iGc->PushClip();
         iGc->Clip(dirtyRect);        
         
@@ -914,7 +918,7 @@
             iForegroundBitmapGc->SetPenColor(clearColor);
             iForegroundBitmapGc->SetBrushColor(clearColor);
             iForegroundBitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
-  	        iForegroundBitmapGc->Clear();
+  	        iForegroundBitmapGc->Clear(dirtyRect);
   	        iForegroundBitmapGc->Reset();
             }
         		
@@ -975,34 +979,7 @@
 		
 	// Clear current dirty regions	
 	iCurrentDirtyRegions->Reset();
-	
-	// Trick to swap gles buffers if we are drawing idle screens before refresh loop is going to
-	// sleep. 
-	if(	IsRendererHWAccelerated() && !iGotDirtyReports && !iScreenBufferObserver) 
-    		{
-	    	//RenderSurface().SwapBuffers(); [ohi]
-	    	}
-	    	
-	// Tell the screen buffer observer that the buffer is complete 
-	if(iScreenBufferObserver)
-		{
-		SetScreenBufferLock(ETrue); // the observer should do unlock!
-		
-		TRect rect(VisibleArea()); // This is not the real display rect in ALF display case(!)
-		TRect dirtyRect(mergedDirtyRect);
-		
-		// Update screen buffer GC bitmap
-		if (DisplayType() != CHuiDisplay::EDisplayOffScreenBuffer)
-			{
-			TRAP_IGNORE(CHuiStatic::Renderer().UpdateOffScreenBitmapL(*this));			
-			}
-						
-		if (iScreenBufferObserver->ScreenBufferComplete(iScreenBufferUid, rect, dirtyRect))
-			{
-			SetScreenBufferLock(EFalse);
-			}
-		}
-
+		    	
     iWholeDisplayAreaIsDirty = EFalse;    
 	
     HUI_PROBE_PROGRAMFLOW_EXIT(MHuiProbe::EProgramFlowPointRefresh)
@@ -1671,6 +1648,15 @@
     {
     if (iForegroundTexture && iForegroundBitmap && !aRect.IsEmpty())
         {
+#if defined(DEBUG_SW_MODE_DIRTY_AREAS)
+        TRgb penColor = TRgb(Math::Random());
+        penColor.SetAlpha(128);
+        iForegroundBitmapGc->SetPenStyle(CGraphicsContext::ESolidPen);
+        iForegroundBitmapGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
+        iForegroundBitmapGc->SetPenColor(penColor);
+        iForegroundBitmapGc->SetBrushColor(penColor);
+        iForegroundBitmapGc->DrawRect(aRect);
+#endif
         TRAP_IGNORE(DoUpdateForegroundTextureL(aRect));
         }
     }
@@ -1822,3 +1808,7 @@
         }
     }
 
+TRect CHuiDisplay::CurrentDirtyRect()
+    {
+    return iCurrentDirtyRect;
+    }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -261,13 +261,13 @@
 TBool CHuiFxEffect::CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque)
     {
     RRegion dummy;
-    TBool ret = CachedDraw(aGc, aDisplayRect, aRefreshCachedRenderTarget, aOpaque, dummy);
+    TBool ret = CachedDraw(aGc, aDisplayRect, aRefreshCachedRenderTarget, aOpaque, dummy,EFalse);
     dummy.Close();
     return ret;
     }
 
 // TODO: effect area should be reduced if aClipRegion is smaller than aDisplayRect.
-TBool CHuiFxEffect::CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TInt aAlpha)
+TBool CHuiFxEffect::CachedDraw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aRefreshCachedRenderTarget, TBool aOpaque, const TRegion& aClipRegion, TBool aHasSurface, TInt aAlpha)
     {
 #ifdef HUIFX_TRACE    
     RDebug::Print(_L("CHuiFxEffect::CachedDraw - 0x%x"), this);
@@ -364,7 +364,7 @@
             if (cachedRenderTargetNeedsRefresh)
                 {
                 // Render to cached render target
-                iRoot->Draw(*iEngine, aGc, *iCachedRenderTarget, *iCachedRenderTarget);                
+                iRoot->Draw(*iEngine, aGc, *iCachedRenderTarget, *iCachedRenderTarget, aHasSurface);                
 #ifdef HUIFX_TRACE    
                 RDebug::Print(_L("CHuiFxEffect::CachedDraw - refreshed cached render buffer 0x%x"), this);
 #endif
@@ -420,13 +420,13 @@
             }
         
         // Normal drawing
-        iRoot->Draw(*iEngine, aGc, *target, *target);
+        iRoot->Draw(*iEngine, aGc, *target, *target, aHasSurface);
         }
                 
     return ETrue;    
     }
 
-EXPORT_C TBool CHuiFxEffect::Draw(CHuiGc& aGc, const TRect& aDisplayRect)
+EXPORT_C TBool CHuiFxEffect::Draw(CHuiGc& aGc, const TRect& aDisplayRect, TBool aHasSurface)
     {
     // Prepare all layers
 #ifdef HUIFX_TRACE    
@@ -483,7 +483,7 @@
         return EFalse;
         }
 
-    iRoot->Draw(*iEngine, aGc, *target, *target);
+    iRoot->Draw(*iEngine, aGc, *target, *target, aHasSurface);
     return ETrue;
     }
 
@@ -612,6 +612,15 @@
         }
     else
         {
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+        if (iFramesDrawn == 1)
+            {
+            // This is about the time when first frame from the effect is on screen
+            TTime endTime;
+            endTime.UniversalTime();
+            AMT_ADD_TIME(iHandle, endTime.Int64(), ETrue);
+            }
+#endif
         iRoot->AdvanceTime(aElapsedTime);
         }
     iElapsedTime += aElapsedTime;
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxFilterLayer.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxFilterLayer.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -90,7 +90,7 @@
     iFilter->AdvanceTime(aElapsedTime);
     }
 
-EXPORT_C void CHuiFxFilterLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource)
+EXPORT_C void CHuiFxFilterLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, CHuiFxRenderbuffer& aSource, TBool aHasSurface)
     {
 #ifdef HUIFX_TRACE 
 	RDebug::Print(_L("CHuiFxFilterLayer::Draw - 0x%x "), this);
@@ -107,7 +107,7 @@
     TRect targetRect(TPoint(0, 0), TargetRect().Size());
     TInt alpha = 0xff; // TODO
 
-    iFilter->Draw(aEngine, aGc, *backBuffer, aSource, targetRect, SourceRect());
+    iFilter->Draw(aEngine, aGc, *backBuffer, aSource, targetRect, SourceRect(), aHasSurface);
 
     // Composite the result
     TRect compositionSourceRect(targetRect);
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxGroupLayer.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxGroupLayer.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -172,7 +172,7 @@
     }
 
 EXPORT_C void CHuiFxGroupLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer& aTarget, 
-                                     CHuiFxRenderbuffer& aSource)
+                                     CHuiFxRenderbuffer& aSource, TBool aHasSurface)
     {
 #ifdef HUIFX_TRACE    
     RDebug::Print(_L("CHuiFxGroupLayer::Draw - 0x%x "), this);
@@ -230,7 +230,7 @@
     
     for (TInt i = 0; i < iLayers.Count(); i++)
         {
-        iLayers[i]->Draw(aEngine, aGc, *backBuffer, *sourceBuffer);
+        iLayers[i]->Draw(aEngine, aGc, *backBuffer, *sourceBuffer, aHasSurface);
         }
 
     // The root group does not support composition
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxVisualLayer.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxVisualLayer.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -233,7 +233,7 @@
     return ETrue;
     }
 
-EXPORT_C void CHuiFxVisualLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer &aTarget, CHuiFxRenderbuffer& /*aSource*/)
+EXPORT_C void CHuiFxVisualLayer::Draw(CHuiFxEngine& aEngine, CHuiGc& aGc, CHuiFxRenderbuffer &aTarget, CHuiFxRenderbuffer& /*aSource*/, TBool /*aHasSurface*/)
     {
 #ifdef HUIFX_TRACE    
     RDebug::Print(_L("CHuiFxVisualLayer::Draw - 0x%x "), this);
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -504,7 +504,7 @@
             iEffect->ForceCachedRenderTargetUsage(ETrue);
             }        
         RRegion dummy;
-        didDrawEffect = iEffect->CachedDraw(aGc, displayRect, refreshCache, opaque, dummy, iEffectOpacity*255);        
+        didDrawEffect = iEffect->CachedDraw(aGc, displayRect, refreshCache, opaque, dummy, EFalse, iEffectOpacity*255);        
         dummy.Close();
         }
     
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -156,6 +156,19 @@
         delete iVisualData->iStoredRenderBuffer;
         iVisualData->iStoredRenderBuffer = aRenderBuffer;
         }
+    else
+        {
+        if (aRenderBuffer != iVisualData->iStoredRenderBuffer)
+            {
+#ifdef _DEBUG
+            RDebug::Printf("CHuiVisual::SetStoredRenderBuffer - Warning: Not enabled (%x / %x)", 
+                aRenderBuffer, iVisualData->iStoredRenderBuffer);
+#endif
+            // Ownership was passed, but we do not need it.
+            delete aRenderBuffer;
+            aRenderBuffer = NULL;
+            }
+        }
     }
 EXPORT_C void CHuiVisual::SetStoredRenderBufferModificationsEnabled(TBool aEnabled)
     {
@@ -2154,8 +2167,6 @@
 
 EXPORT_C void CHuiVisual::SetEffect(CHuiFxEffect* aEffect)
     {
-    SetFreezeState(EFalse);
-
     __ALFFXLOGSTRING2("CHuiVisual::SetEffect - : 0x%d on visual 0x%x", aEffect, this );
     // If effect is replaced by a new effect, we don't want the effect end callback
     // as it would end the new effect
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsbitgc.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsbitgc.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -156,6 +156,7 @@
             }
         
         iCapturingBitGc->SetClippingRegion(aUpdateRegion);
+        iCapturingBitGc->SetClippingRect(CHuiEnv::Static()->Display(0).CurrentDirtyRect());
         
         TSize visualSize = iVisual->DisplayRect().Size().Round();        
         if (iCapturingBitBitmap->SizeInPixels() != visualSize)
@@ -168,6 +169,7 @@
             iCapturingBitGc->BitBlt(TPoint(0,0), iBitBitmap);
             }
         
+        iCapturingBitGc->CancelClippingRect();
         iCapturingBitGc->CancelClippingRegion();
         }
 
@@ -208,15 +210,5 @@
 
 void CHuiCanvasWsBitGc::ClearCapturingBufferArea(const TRect& aRect)
     {
-    if ( iCapturingBitGc )
-        {
-        TRgb clearColor = KRgbBlack;
-	    clearColor.SetAlpha(0x0);
-        
-	    iCapturingBitGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha);
-        iCapturingBitGc->SetPenColor(clearColor);
-        iCapturingBitGc->SetBrushColor(clearColor);
-        iCapturingBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
-  	    iCapturingBitGc->Clear(aRect);
-        }
+    
     }
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -1906,8 +1906,8 @@
     if (aUpdateDisplay && renderbuffer && iCanvasGc->Gc())
         {
         THuiRealRect updatedRect = aUpdateRegion.BoundingRect();
-				  TInt w; 
-				  TInt h ;
+        TInt w = 0; 
+		TInt h = 0;
         // Handle relative rotation
         if (iVisual->Display())
             {
@@ -2136,6 +2136,15 @@
         }
     }
 
+static TRect CalculateClipRect(CHuiCanvasRenderBuffer* aRenderbuffer)
+    {
+    const TInt KHuiDefaultSize = 2048;
+    return 
+        aRenderbuffer && aRenderbuffer->IsInitialized() ? 
+        TRect( aRenderbuffer->Size() ) :
+        TRect( TSize( KHuiDefaultSize, KHuiDefaultSize ) );
+    }
+
 void CHuiCanvasWsHwGc::BindRenderBuffer(CHuiCanvasRenderBuffer* aRenderbuffer, const TRegion& aUpdateRegion)
     {
     // Disable effective opacity when rendering to a buffer
@@ -2158,15 +2167,15 @@
     
     // Set new clipping region which does not clip anything. 
     // We want always draw aUpdateRegion fully to the aRenderbuffer. 
-    TRect displayArea = iCanvasGc->Gc()->DisplayArea(); 
-    
-    iCanvasGc->Gc()->SetClip(displayArea); // this call does not transform region anymore
+            
+    iCanvasGc->Gc()->SetClip(CalculateClipRect(aRenderbuffer)); // this call does not transform region anymore
     
     // We use translation to get screen coordinates to match render buffer coordinates
     iCanvasGc->PushTransformationMatrix();
     iCanvasGc->Translate(x, y, 0.f);
         
     // Handle relative rotation
+    TRect displayArea = iCanvasGc->Gc()->DisplayArea();
     TInt w = displayArea.Width();
     TInt h = displayArea.Height();
     
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -566,6 +566,12 @@
             
             // Clip drawing to update area. This seems to improve performance although
             // it may depend on used HW.
+
+            // Set position delta to zero, otherwise updateregion is adjusted incorrectly
+            // in SW mode. No effect on HW mode as it does not adjust the updateregion in
+            // EnableUpdateRegion call...
+            TPoint delta(0,0);
+            iCanvasWsGc->SetPositionDelta(delta);
             iCanvasWsGc->EnableUpdateRegion(iCommandBuffers[cb]->iUpdateRegion, aClearBeforeHandlingBuffers);
 
             #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL
--- a/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomactionlist.h	Wed Jun 09 10:41:25 2010 +0300
@@ -265,6 +265,8 @@
     TUint iCurrentPluginRun;
     RArray<TInt> iLowOnMemWgs;
     TBool iUseSwRendering;
+    TBool iTryOptional; // we did everything we could but still missing some bits, try again with different app targets
+    TBool iOptionalTried; // no need to overperform though
     };
 
 #include "goomactionlist.inl"
--- a/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/inc/goomwindowgrouplist.h	Wed Jun 09 10:41:25 2010 +0300
@@ -42,10 +42,10 @@
     static CGOomWindowGroupList* NewL(RWsSession& aWs);
     
     // Update the list of window groups
-    void RefreshL();
+    void RefreshL(TBool aOptionalOnly = EFalse);
     
     // Update the list of window groups, non-leaving version
-    void Refresh();
+    void Refresh(TBool aOptionalOnly = EFalse);
     
     // Return the number of application instances in this list
     inline TUint Count() const;
@@ -133,6 +133,7 @@
     CApaWindowGroupName* iWgName;
     HBufC* iWgNameBuf;              // owned by iWgName
     RArray<TInt> iLowOnMemWgs;
+    RArray<TInt> iOptionalUids;
     RAlfBridgerClient iAlfClient;
     };
 
--- a/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomactionlist.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -217,7 +217,7 @@
 //    iActionRefs.Reset();
 //    iCurrentActionIndex = 0;
     
-    aWindowGroupList.RefreshL();
+    aWindowGroupList.RefreshL(iTryOptional);
     
     for (TInt i = 0; aWindowGroupList.LowOnMemWgs(i) != KErrNotFound ; i++ )
         {
@@ -426,11 +426,23 @@
     if (!memoryFreeingActionRun)
         {
         // No usable memory freeing action has been found, so we give up
-        TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found");
         TInt freeMemory;
-        FreeMemoryAboveTarget(freeMemory);
-        iServer.CloseAppsFinished(freeMemory, EFalse);
-        iMonitor.WaitAndSynchroniseMemoryState();
+
+        if ( !FreeMemoryAboveTarget(freeMemory) && !iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config
+            { 
+            iTryOptional = ETrue;
+            iOptionalTried = ETrue;
+            iMonitor.RunCloseAppActions(iMaxPriority);
+            }
+        else
+            {
+            iTryOptional = EFalse;
+            iOptionalTried = EFalse;
+
+            TRACES("CGOomActionList::FreeMemory: No usable memory freeing action has been found");
+            iServer.CloseAppsFinished(freeMemory, EFalse);
+            iMonitor.WaitAndSynchroniseMemoryState();
+            }
         }
     }
 
@@ -636,8 +648,18 @@
                     MemoryGood();
                     }
                      */
-                    iServer.CloseAppsFinished(freeMemory, EFalse);
-                    iMonitor.WaitAndSynchroniseMemoryState();
+                    if (!iTryOptional && !iOptionalTried && freeMemory < 25*1024*1024 ) // magic, should read this from config
+                        { 
+                        iTryOptional = ETrue;
+                        iOptionalTried = EFalse;
+                        iMonitor.RunCloseAppActions(iMaxPriority);
+                        }
+                    else
+                        {
+                        iTryOptional = EFalse;       
+                        iServer.CloseAppsFinished(freeMemory, EFalse);
+                        iMonitor.WaitAndSynchroniseMemoryState();
+                        }
                     }
                 else
                     {
--- a/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -43,18 +43,18 @@
     }
 
 // Update the list of window groups
-void CGOomWindowGroupList::Refresh()
+void CGOomWindowGroupList::Refresh(TBool aOptionalOnly)
     {
     FUNC_LOG;
     
 #ifdef _DEBUG
-    TRAPD(err, RefreshL());
+    TRAPD(err, RefreshL(aOptionalOnly));
     if (err)
         {
         TRACES1("CGOomWindowGroupList::Refresh(): RefreshL leave %d", err);
         }
 #else
-    TRAP_IGNORE(RefreshL());
+    TRAP_IGNORE(RefreshL(aOptionalOnly));
     // Ignore any error
     // Errors are very unlikely, the only possibility is OOM errors (which should be very unlikely due to pre-created, re-reserved lists)
     // The outcome of any error is that the most foreground operations will be missing from the list
@@ -64,7 +64,7 @@
 
 // Update the list of window groups
 // Should be called whenever the 
-void CGOomWindowGroupList::RefreshL()
+void CGOomWindowGroupList::RefreshL(TBool aOptionalOnly)
     {
     FUNC_LOG;
   
@@ -76,9 +76,27 @@
     RArray<TInt> inactiveSurfaces;
 
     // ignore possible errors, we have information from profiling extension anyway
-    iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces);    
-    iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs);
+    if (!aOptionalOnly)
+        {
+        iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces);    
+        iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs);
+        }
+    else
+        { // first iteration: try to cope with window group ID's only
+          // Most likely that needs to be revisited because apps fail to name their window 
+          // groups properly on external screens...  
+        iAlfClient.GetOptionalGraphicsMemUsers(&inactiveSurfaces);    
+        iOptionalUids.Reset();
+        TInt count = inactiveSurfaces.Count(); 
+        for (TInt i = 0; i<count-1; i++)
+            {
+            iOptionalUids.Append(inactiveSurfaces[i+1]);
+            inactiveSurfaces.Remove(i+1);
+            count--;
+            }   
+        }
         
+    TRACES1("Optional list composed: %d", aOptionalOnly);     
     TRACES1("Inactive surfaces count %d", inactiveSurfaces.Count());     
     TRACES1("Windowgroups w/ surfaces count %d", iLowOnMemWgs.Count());     
 
@@ -86,17 +104,17 @@
     RArray<TUint> privMemUsed;
     RArray<TUint64> sparedProcessIds;
     
-   //if (inactiveSurfaces.Count() == 1) // ALF only 
-   //     {
-    NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
+   if (!aOptionalOnly)
+      {
+      NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
     
-    if (!eglQueryProfilingData && inactiveSurfaces.Count() == 0)
+      if (!eglQueryProfilingData && inactiveSurfaces.Count() == 0)
         {
         TRACES("RefreshL EGL_NOK_resource_profiling not available");
         return;
         }
     
-    if (eglQueryProfilingData)
+     if (eglQueryProfilingData)
         {
         EGLint data_count;
         EGLint* prof_data;
@@ -206,7 +224,7 @@
                 }
             }
         }
-                
+      }            
     // Refresh window group list
     // get all window groups, with info about parents
     TInt numGroups = iWs.NumWindowGroups();
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/inc/gfxtransenginetfx.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/inc/gfxtransenginetfx.h	Wed Jun 09 10:41:25 2010 +0300
@@ -243,9 +243,9 @@
 	void DoStartTransitionL(TInt aHandle, const CTransitionData* aTransData);
 
     /*
-     * Generate start transition from begin capture in case of contol exit transition
+     * Generate transition event
      */
-	void GenerateTransitionL( const CCoeControl* aKey, const CTransitionData* aTransData);
+	void GenerateComponentTransitionEventL(const CTransitionData* aTransData, TInt aOp, TInt aHandle = KErrNotFound);
 	
 	/*
 	 * Connect to server and load plugin
@@ -324,6 +324,14 @@
 
     TInt iCurrHandle;
 
+    struct TControlEffect
+        {
+        TInt iHandle;
+        TInt iWindowGroup;
+        TInt iWindowHandle;
+        };
+    RArray<TControlEffect> iControlEffects;
+    
 //	TBool iIsWO;
 
 	TThreadId iClientId;
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alfgfxtransadapter/src/gfxtransenginetfx.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -295,6 +295,8 @@
 CGfxTransAdapterTfx::~CGfxTransAdapterTfx()
 	{
 	
+    
+    iControlEffects.Close();
 	__ALFFXLOGSTRING("CGfxTransAdapterTfx for HWA transitionn effects, destructor ");
 //	iIgnoredWOChildControls.Close();
 	//iControlInfo.ResetAndDestroy();
@@ -456,17 +458,22 @@
 	    }
 	 
 	TInt err = KErrNone;    
-	TInt action = 0;
 	const CTransitionData* transdata;
 	err = iClient->GetTransitionData( aHandle, transdata );
-	if ( err == KErrNone )
-	    {
-    	action = transdata->iAction;
-	    }
 
 	switch(aState)
 		{
 		case EFallback:
+	    case EAbort:
+	        for(TInt i = 0 ; i < iControlEffects.Count(); i++ )
+	            {
+	            // clear ongoing effect for this handle
+	            if( iControlEffects[i].iHandle == aHandle)
+	                {
+	                iControlEffects.Remove(i);
+	                i--;
+	                }
+	            }
 		    break;
 		case EPreBeginCapture:
 		    break;
@@ -475,35 +482,45 @@
 			// 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())
+		    if (aKey && aKey->DrawableWindow() && err == KErrNone)
 		        {
-		        // We must generate our own transition as we won't be sending 
-		        // iClient->TransitionFinished back.
-		        // (Client did not ask for transition to be started, and won't be
-		        // interested in the end.)
-          		TRAP( err, GenerateTransitionL( aKey, transdata ) );
+                TControlEffect newEffect;
+                newEffect.iHandle = aHandle;
+                newEffect.iWindowGroup = aKey->DrawableWindow()->WindowGroupId();
+                newEffect.iWindowHandle =aKey->DrawableWindow()->ClientHandle(); 
+                iControlEffects.Append(newEffect);
 		        }
 		    break;
 		case EPreEndCapture:	
 		    break;
 		case EPostEndCapture:
-		    break;
-		case EAbort:
-		// Abort component transition, handle given.
+            if (aKey && err == KErrNone)
+                {
+                TRAP( err, GenerateComponentTransitionEventL( transdata, MAlfGfxEffectPlugin::EBeginComponentTransition, aHandle ) );
+                }
 		    break;
 		case EGlobalAbort:
-		// abort component transition, no handle.
+		    // abort component transition, no handle.
+		    for(TInt i = 0 ; i < iControlEffects.Count(); i++ )
+                {
+                // clear all on going effects
+                iControlEffects.Remove(i);
+                i--;
+                }
+          // TODO: send abort to server
+		   // TRAP( err, GenerateComponentTransitionEventL( transdata, MAlfGfxEffectPlugin::EAbortComponentTransition) );
+		    
 	        break;
 		case EBeginGroup:
 			{
-			__ALFFXLOGSTRING1("-- BeginGroup: New transition group for groupid: %d)",aHandle);
-			SendGroupCommand(aHandle, EFalse);
+            __ALFFXLOGSTRING1("-- BeginGroup: New transition group for groupid: %d)",aHandle);
+            SendGroupCommand(aHandle, EFalse);
 		    break;
 			}
 		case EEndGroup:
 			{
-			__ALFFXLOGSTRING1("-- EndGroup: closing transition group: %d)",aHandle);
-			SendGroupCommand(aHandle, ETrue);
+            __ALFFXLOGSTRING1("-- EndGroup: closing transition group: %d)",aHandle);
+            SendGroupCommand(aHandle, ETrue);
 		    break;
 			}
 		default:
@@ -1269,20 +1286,41 @@
 	__ALFFXLOGSTRING("CGfxTransAdapterTfx::DoStartTransitionL <<");
 	}
 
-void CGfxTransAdapterTfx::GenerateTransitionL( const CCoeControl* aKey, const CTransitionData* aTransData)
+void CGfxTransAdapterTfx::GenerateComponentTransitionEventL(const CTransitionData* aTransData, TInt aOp, TInt aHandle)
     {
 
     // We generate a transition call from begin capture for control exit transitions
-	TPtr8 inPtr = iTransferBuffer->Des();
-	inPtr.Zero();
-	TPtr8 outPtr = iReturnBuffer->Des();
-	outPtr.Zero();
-	RDesWriteStream inBuf( inPtr );
-    TInt op = MAlfGfxEffectPlugin::EBeginComponentTransition;
-    TInt windowGroup = aKey->DrawableWindow()->WindowGroupId();
-    TInt windowHandle = aKey->DrawableWindow()->ClientHandle(); 
+    TPtr8 inPtr = iTransferBuffer->Des();
+    inPtr.Zero();
+    TPtr8 outPtr = iReturnBuffer->Des();
+    outPtr.Zero();
+    RDesWriteStream inBuf( inPtr );
+    TInt op = aOp;
     
-    __ALFFXLOGSTRING4("CGfxTransAdapterTfx::GenerateTransitionL - Operation: MAlfGfxEffectPlugin::EBeginComponentTransition Action: %d,  Uid: 0x%x, WindowGroup: %d, WindowHandle: %d  >>",
+    TInt windowGroup = KErrNotFound;
+    TInt windowHandle = KErrNotFound;
+    if( aHandle != KErrNotFound )
+        {
+        for(TInt i = 0 ; i < iControlEffects.Count(); i++ )
+            {
+            // we take the last one. to make hopefully clean up any earlier effect that was not finished for some reason.
+            if( iControlEffects[i].iHandle == aHandle)
+                {
+                windowGroup = iControlEffects[i].iWindowGroup;
+                windowHandle = iControlEffects[i].iWindowHandle;
+                iControlEffects.Remove(i);
+                i--;
+                }
+            }
+        }
+    if(aHandle != KErrNotFound && (windowGroup == KErrNotFound  || windowHandle == KErrNotFound))
+        {
+        return;
+        }
+    
+    __ALFFXLOGSTRING1("CGfxTransAdapterTfx::GenerateComponentTransitionEventL - Operation: %d", op );
+
+    __ALFFXLOGSTRING4("CGfxTransAdapterTfx::GenerateComponentTransitionEventL - Action: %d,  Uid: 0x%x, WindowGroup: %d, WindowHandle: %d  >>",
         aTransData->iAction,
         aTransData->iUid.iUid,
         windowGroup,
@@ -1303,17 +1341,17 @@
     inBuf.Release();
     inBuf.Close();
 
-    __ALFFXLOGSTRING( "CGfxTransAdapterTfx::GenerateTransitionL" );
+    __ALFFXLOGSTRING( "CGfxTransAdapterTfx::GenerateTransitionL - iTfxServer.SendSynchronousData " );
     iTfxServer.SendSynchronousData( iPluginImplementation, inPtr, outPtr );
     // clear out used data    
-	inPtr.Zero();
-	outPtr.Zero();
-	
-	// Don't signal client because client did not request the transition to start
+    inPtr.Zero();
+    outPtr.Zero();
+    
+    // Don't signal client because client did not request the transition to start
     __ALFFXLOGSTRING("CGfxTransAdapterTfx::GenerateTransitionL <<");
-    }
-	
-	
+    }	
+
+
 // ---------------------------------------------------------------------------
 // finds a control
 // ---------------------------------------------------------------------------
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Wed Jun 09 10:41:25 2010 +0300
@@ -42,7 +42,6 @@
 	virtual TUint& Action() = 0;
 	virtual TInt& Flags() = 0;
 	virtual void IncreaseControlHandle() = 0;
-	virtual void IncreaseFullScreenHandle() = 0;
 	virtual TInt CurrentControlHandle() = 0;
 	virtual TInt CurrentFullScreenHandle() = 0;
 	virtual void StartEndChecker() = 0;
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Wed Jun 09 10:41:25 2010 +0300
@@ -95,7 +95,6 @@
 	void IncreaseControlHandle();
 	TInt CurrentControlHandle();
 	
-	void IncreaseFullScreenHandle();
 	TInt CurrentFullScreenHandle();
 	
 	void StartEndChecker();
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -43,8 +43,15 @@
 // This sets the maximum time for an effect. Even if the fxml file has specified a longer duration, 
 // this will stop the effect.
 const TInt KAlfShortEffectTimeout     = 4000000;
+
+// Note, The timeouts are DIFFERENT for EMULATOR AND ARMV5
+#ifdef __WINS__
+const TInt KAlfAppStartEffectTimeout  = 800000;
+const TInt KAlfLongEffectTimeout      = 10000000;
+#else
 const TInt KAlfAppStartEffectTimeout  = 300000;
 const TInt KAlfLongEffectTimeout      = 5000000;
+#endif
 const TInt KAlfActiveControlFxGranularity = 4;
 const TInt KAlfLongApplicationStartContext = 20;
 
@@ -671,7 +678,7 @@
     // I don't think we need this
     TInt index = 0;
 
-    IncreaseFullScreenHandle();
+    iCurrentFullScreenHandle = iToSid.iId;
 
     iFullScreenTransitionEndObserver->Cancel();
     iFinishFullScreen->Cancel();
@@ -685,9 +692,10 @@
         RMemWriteStream stream( bridgeBuffer, bufferSize );
         // The writes should not leave if we have calculated our buffer length correctly.
         stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen );
-        stream.WriteInt32L(  iToSid.iId ); //iCurrentFullScreenHandle );
+        stream.WriteInt32L(  iToSid.iId );
         stream.WriteInt32L( iType );
-        stream.WriteInt32L( 0 ); // timeout triggered
+        stream.WriteInt32L( 0 ); // timeout? 0 always in BeginFullScreen
+        stream.WriteInt32L( 0 );
       	if ( iType == AknTransEffect::EParameterType && isExit )
       	    {
             stream.WriteInt32L( iToWg );
@@ -810,7 +818,7 @@
     // It appears that folder open and close never send endfullscreen, so for them the effect
     // must be started as soon as we get beginfullscreen
     
-    isAppStartEffect = EFalse; // disable different timeout effect for appstart effects
+    // isAppStartEffect = EFalse; // disable different timeout effect for appstart effects
 	
     if (isAppStartEffect)
         {
@@ -837,13 +845,14 @@
         __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen END no need");
         return KErrNone;
         }
-    iFullScreenEndSent = ETrue;
         
     __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen");
     iFullScreenTransitionEndObserver->Cancel();
     iFullScreenTimeout->Cancel();
     iFinishFullScreen->Cancel();
+    TBool timeout = iFullScreenTimeout->iTimeoutTriggered;
     TBool triggerStartEffectTimeout= iFullScreenTimeout->iTimeoutTriggered && iFullScreenTimeout->iIsStartEffect;
+    iFullScreenEndSent = !triggerStartEffectTimeout;
     iFullScreenTimeout->iTimeoutTriggered = EFalse;
     iFullScreenTimeout->iIsStartEffect = EFalse;
     
@@ -879,7 +888,7 @@
     // also the effect file name or something else to identify the effect 
     // that is going to be used
     
-    TInt bufferSize = 12 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect, timeoutTriggered
+    TInt bufferSize = 13 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect, timeoutTriggered
     bufferSize += sizeof(TPtrC);
     bufferSize += resourceDir.Length() * 2;
     bufferSize += sizeof(TPtrC);
@@ -904,6 +913,7 @@
             stream.WriteInt32L( iCurrentFullScreenHandle );
             stream.WriteInt32L( iType );
             stream.WriteInt32L( triggerStartEffectTimeout );
+            stream.WriteInt32L( timeout );
             stream.WriteInt32L( iToWg );
             stream.WriteInt32L( iFromWg );
 
@@ -934,6 +944,10 @@
 
     iFullScreenFinished = EFalse;
     iFullScreenTimeout->iIsStartEffect = EFalse;
+    if (triggerStartEffectTimeout)
+        {
+        return KErrNone;
+        }
     if ( iAction == AknTransEffect::EApplicationExit /*||
         iAction == 1001*/  ) 
         {
@@ -961,7 +975,8 @@
         }
 
     iFullScreenTransitionEndObserver->Cancel();
-    
+    iFinishFullScreen->Cancel();
+    iFullScreenTimeout->Cancel();
     iFullScreenFxSent = EFalse;
     iFullScreenEndSent = ETrue;
     
@@ -1286,13 +1301,6 @@
     highestHandle++;
     iCurrentControlHandle = highestHandle; 
 	}
-	
-void CAlfServerDrawer::IncreaseFullScreenHandle()
-    {
-    TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle;
-    highestHandle++;
-    iCurrentFullScreenHandle = highestHandle;
-    }
 
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
@@ -1339,7 +1347,7 @@
         iFullScreenTimeout->Cancel();
         // If we don't get an EndFullScreen in a timely manner, 
         // we generate an EndFullScreen signal by ourselves
-        EndFullscreen();
+        EndFullscreen(ETrue);
         }
     }
 
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -238,6 +238,9 @@
 				return CPhase1State::NewL(iEngine,iHandler);
 				}
 			return NULL;
+	     case EEndFullscreen:
+	            iEngine.SendEndFullscreen();
+	        return NULL;
 		case EBeginComponent:
 		    error = iEngine.SendBeginControlTransition();
 		    if ( error == KErrNone )
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp	Tue May 25 13:39:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp	Wed Jun 09 10:41:25 2010 +0300
@@ -66,7 +66,8 @@
 		// startup blocked because startup exit leaves the screen black.
 		// must be debugged
         0x100058F4, // startup blocked for the time being
-        0x101f857A // camera
+        0x101f857A, // camera
+        0x2002d07f	// ovistore_2002D07F.exe, this does not draw anything, but launcher 
         // Application shell is Ok, folder open and close have KAknApplicationShellViewId
         // as both to and from ids. There is only one visual, so some sort of blur effect works...
 		//, KAknApplicationShellViewId
@@ -84,8 +85,8 @@
     {
 	0x0, // DO NOT REMOVE 0x0! this is here for compile reasons, it will not be included in the AllowedCustomUid check
     0x101f857A, // camera
-    0x2002A540  // conversation.exe , other launchable from messaging don't have effect either
-
+    0x2002A540,  // conversation.exe , other launchable from messaging don't have effect either
+    0x2002d07f // ovistore_2002D07F.exe, this does not draw anything, but launcher 
   //0xUID //Add UIds of applications that shouldn't have effects here
 	};
 
@@ -485,7 +486,7 @@
             }
         
         iAppInfo[index].iAction = aAction;
-        RDebug::Printf("CAppInfoCache::SetAction - Returned action %d", iAppInfo[index].iAction);
+        __ALFFXLOGSTRING1("CAppInfoCache::SetAction - Returned action %d", iAppInfo[index].iAction);
         return iAppInfo[index].iAction;
     }
 
@@ -743,11 +744,17 @@
 		//Adding uid to block list			
 		if(flags & AknTransEffect::TParameter::ENoEffects)
 			{
+            __ALFFXLOGSTRING1("CWsServerDrawerController::BeginFullscreen - Add to block list 0x%x", toUid);
 			iStates->AddBlockUid(toUid);
+			if (iLastToUid == aUid1)
+			    {
+                AbortTransition(EAbortFullscreen);
+			    }
 			}
 		//Removing uid from blocklist
 		if(flags & AknTransEffect::TParameter::EEnableEffects)	
 			{
+            __ALFFXLOGSTRING1("CWsServerDrawerController::BeginFullscreen - Remove from block list 0x%x", toUid);
 			iStates->RemoveBlockUid(toUid);
 			}
 		}
@@ -804,15 +811,14 @@
 	//we should know if its a dsa app before end can be called
 	if(iDSAActive)
 	    {
-        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort.");
+        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - DSA active. Abort.");
 	    return; //Do nothing if dsa active.
 	    }
 
 	//Special argument calls does not initiate any FS effect and is caught here.
-	// TODO: remove && !iEngine->WaitingForRootWgId() when appuids available from wserv
 	if(fstype == CStateHandler::ENone) 
 		{
-        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort.");
+        __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Special argument. Abort.");
 		return;
 		}
 
@@ -915,6 +921,7 @@
     // Convert 
 
     // Signal statemachine
+    SaveLastActionAndUid();
     iStates->Signal(CStateBase::EBeginFullscreen);
 	// Start end checker always.
 	if(flags & AknTransEffect::TParameter::EEndCheck)