201019
authorhgs
Fri, 14 May 2010 02:41:21 +0300
changeset 27 70e659bb284f
parent 26 8eb818df3c66
child 28 423dd85009cf
201019
rom/alfred.iby
uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h
uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h
uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp
uiacceltk/hitchcock/CommonInc/alfmoduletest.h
uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h
uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h
uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h
uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h
uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp
uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp
uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp
uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp
uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp
uiacceltk/hitchcock/ServerCore/Src/alfvisualhandlers.cpp
uiacceltk/hitchcock/ServerInterface/src/alfdocument.cpp
uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h
uiacceltk/hitchcock/coretoolkit/rendervg10/group/huirendervg10.mmp
uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp
uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp
uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp
uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp
uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp
uiacceltk/hitchcock/group/core_exports.inc
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp
uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp
--- a/rom/alfred.iby	Thu May 13 23:40:57 2010 +0300
+++ b/rom/alfred.iby	Fri May 14 02:41:21 2010 +0300
@@ -101,6 +101,7 @@
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_activate.fxml RESOURCE_FILES_DIR/effects/app_activate.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_exit.fxml RESOURCE_FILES_DIR/effects/app_exit.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start.fxml RESOURCE_FILES_DIR/effects/app_start.fxml
+data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start_long.fxml RESOURCE_FILES_DIR/effects/app_start_long.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start_rect.fxml RESOURCE_FILES_DIR/effects/app_start_rect.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start_switch.fxml RESOURCE_FILES_DIR/effects/app_start_switch.fxml
 data=DATAZ_/RESOURCE_FILES_DIR/effects/app_start_switch_rect.fxml RESOURCE_FILES_DIR/effects/app_start_switch_rect.fxml
--- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h	Fri May 14 02:41:21 2010 +0300
@@ -54,7 +54,7 @@
  *
  *  @since S60 v3.2
  */
-NONSHARABLE_CLASS(CAlfAppUi) : public CAknAppUi, public MAlfSrvSettingsObserver
+NONSHARABLE_CLASS(CAlfAppUi) : public CBase, public MAlfSrvSettingsObserver
     {
 
 public: // new methods 
@@ -121,7 +121,7 @@
      * 2nd phase constructor. Called by the framework after 
      * the 1st phase construction.
      */
-    IMPORT_C void ConstructL();
+    IMPORT_C virtual void ConstructL();
     
     /**
      * From CAknAppUi.
@@ -129,7 +129,7 @@
      *
      * @param aEvent Occurred event.
      */
-    IMPORT_C void HandleSystemEventL(const TWsEvent& aEvent);
+    IMPORT_C virtual void HandleSystemEventL(const TWsEvent& aEvent);
 
     /**
      * From CAknAppUi.
@@ -137,7 +137,7 @@
      *
      * @param aEvent Occurred event.
      */    
-    IMPORT_C void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
+    IMPORT_C virtual void HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination);
     
     /**
      * From CAknAppUi.
@@ -145,7 +145,7 @@
      *
      * @return ETrue. Meaning the framework will synchronize the application to the starter
      */
-    IMPORT_C TBool FrameworkCallsRendezvous() const;
+    IMPORT_C virtual TBool FrameworkCallsRendezvous() const;
     
     /**
      * From CAknAppUi.
@@ -153,7 +153,7 @@
      *
      * @param aType Changed resource. 
      */
-    IMPORT_C void HandleResourceChangeL( TInt aType );
+    IMPORT_C virtual void HandleResourceChangeL( TInt aType );
    
    /**
      * From CAknAppUi.
@@ -161,7 +161,7 @@
      *
      * @param aCommand The command
      */
-    IMPORT_C void HandleCommandL(TInt aCommand);
+    IMPORT_C virtual void HandleCommandL(TInt aCommand);
     
     void MAlfSrvUintSettingChangedL( TAlfSrvSetting aSetting, TUint aNewValue );
     
--- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h	Fri May 14 02:41:21 2010 +0300
@@ -818,6 +818,9 @@
      */
     IMPORT_C void CopyScreenToBitmapL(CFbsBitmap* aBitmap);
     
+    
+    void DoBackgroundClear();
+    
 private:
 
     /**
@@ -1021,6 +1024,12 @@
     CFbsBitGc* iForegroundBitmapGc;
     /** ETrue if foreground texture should be blend, EFalse otherwise */
     TBool iForegroundTextureTransparency;
+    
+    /** dirty region index that is being drawn currently */ 
+    TInt iCurrentDirtyIndx;
+    
+    /** Current dirty region for this refresh instance */
+    RDirtyRegions iTempDirtyRegions;
     };
 
 #endif  // __HUIDISPLAY_H__
--- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp	Fri May 14 02:41:21 2010 +0300
@@ -22,9 +22,18 @@
 #include "alfuids.h"
 
 _LIT(KAlfServerThreadName, "alfredserver");
+
+
+// Implements just Error() to avoid panic
+NONSHARABLE_CLASS(CSimpleScheduler) : public CActiveScheduler
+    {
+    void Error( TInt ) const{} // From CActiveScheduler
+    };
+
+
 static void RunServerL()
     {
-    CActiveScheduler* s=new(ELeave) CActiveScheduler;
+    CActiveScheduler* s=new(ELeave) CSimpleScheduler;
     CleanupStack::PushL(s);
     CActiveScheduler::Install(s);
 
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletest.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletest.h	Fri May 14 02:41:21 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 #ifndef ALFMODULETEST_H
 #define ALFMODULETEST_H
 
@@ -41,7 +25,7 @@
 _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK");
 _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX");
 
-
+const TInt KMaxSimultMeasurementCount = 10;
 /*
  *  Class CAlfModuleTestData
  */
@@ -240,6 +224,18 @@
     TInt iASE_Temp3;
     TInt iASE_Temp4;
 
+    class TSpeedTest
+    {
+    public:
+        TInt64 iHandle;
+        TInt iCounter;
+        TBool iEffects;
+        TInt64 iTimeStamp[5];
+    };
+    
+    TSpeedTest iTimeMap[10];
+    TInt iNextFreeMap;
+        
     // Map that contains boolean items for certain test cases.
     TAlfModuleTestMap< TBool > iBoolMap;        
     // Map that contains integer items for certain test cases.
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestdefines.h	Fri May 14 02:41:21 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /**
  * @see alfmoduletest.h for class implementations that these defines use.
  */
@@ -43,6 +27,11 @@
     #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 )
@@ -107,6 +96,11 @@
     #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 ) )
@@ -169,14 +163,22 @@
         AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && aAttribute == ECursorColor ), iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeRenderStageChangeTextCursorColor )
 
 #define AMT_MAP_RENDER_STAGE_ADD_LAYER() \
-        AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeRenderStageCreateLayer ); \
-        AMT_MAP_APPEND_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), TSurfaceId::CreateNullId(), EAlfModuleTestTypeRenderStageReleaseLayer )
+        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 )
 
 #define AMT_MAP_RENDER_STAGE_ADD_LAYER_LINK() \
-        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeRenderStageCreateLayer ); \
-        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeRenderStageReleaseLayer ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeCreateLayer ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( &aWindowTreeNode ), windowId, EAlfModuleTestTypeCreateLayer ); \
+        AMT_MAP_APPEND_LINK( iSurfaceMap, windowId, AMT_MAP_PTR_TO_KEY_CAST( &aLayer ), EAlfModuleTestTypeReleaseLayer ); \
+        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_SET_VALUE( iSurfaceMap, windowId, aLayer.Surface(), EAlfModuleTestTypeRenderStageCreateLayer )
+        AMT_MAP_SET_VALUE( iSurfaceMap, windowId, aLayer.Surface(), EAlfModuleTestTypeCreateLayer )
+
+#define AMT_MAP_RENDER_STAGE_REMOVE_LAYER() \
+        AMT_MAP_SET_VALUE_IF( aLayer, iSurfaceMap, AMT_MAP_PTR_TO_KEY_CAST( aLayer ), aLayer->Surface(), EAlfModuleTestTypeReleaseLayer )
 
 
 // Streamer defines
@@ -245,7 +247,10 @@
         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorFlag ); \
         AMT_MAP_INC_VALUE_IF( viz, iIntMap, AMT_MAP_TEXT_CURSOR_HANDLE, EAlfModuleTestTypeBridgeChangeTextCursorColor )
 
-        
+#define AMT_MAP_BRIDGE_SET_ORDINAL_POSITION() \
+        AMT_MAP_SET_VALUE_IF( windowAttributes, iIntMap, windowNodeId, windowAttributes->iOrdinalPosition, EAlfModuleTestTypeLayerOrdinalPosition )
+
+
 #endif // ALF_MODULE_TEST_DEFINES_H
 
 // End of File
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletestmap.h	Fri May 14 02:41:21 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /**
  * @note This class is provided only if module test hooks are set on.
  */
@@ -61,7 +45,8 @@
      * Constructor to initialize variables.
      */
     TAlfModuleTestMap():
-        iArrayCount( 0 )
+        iArrayCount( 0 ),
+        iAcceptArrayCount( 0 )
         {
         }
 
--- a/uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/CommonInc/alfmoduletesttype.h	Fri May 14 02:41:21 2010 +0300
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description: 
-*
-*/
 /**
  * @note Contents of this file are provided only if module test hooks are set on.
  */
@@ -33,8 +17,6 @@
     EAlfModuleTestTypeNone,
     
     // Render stage component specific tests
-    EAlfModuleTestTypeRenderStageCreateLayer,
-    EAlfModuleTestTypeRenderStageReleaseLayer,
     EAlfModuleTestTypeRenderStageCreateWindow,
     EAlfModuleTestTypeRenderStageReleaseWindow,    
     EAlfModuleTestTypeRenderStageCreateWindowGroup,
@@ -85,6 +67,11 @@
     EAlfModuleTestTypeCoreToolkitDrawWindow,
     EAlfModuleTestTypeCoreToolkitDrawFromRenderBuffer,
     
+    // Layer tests
+    EAlfModuleTestTypeCreateLayer,
+    EAlfModuleTestTypeReleaseLayer,    
+    EAlfModuleTestTypeLayerOrdinalPosition,    
+    
     // Do not use this value when creating item.
     // This is just meant for Find operations when all tests are accepted.
     EAlfModuleTestTypeAll
--- a/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h	Fri May 14 02:41:21 2010 +0300
@@ -239,6 +239,7 @@
         TInt iToSecureId;
         TInt iFromSecureId;
         TRect iRect;
+        TBool iTimeoutTriggered;
         
         // ETrue if waiting for window group to appear
         TBool iWaitingWindowGroup;
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp	Fri May 14 02:41:21 2010 +0300
@@ -297,8 +297,10 @@
         return;       
         }
     
+    TBool lastActiveDying = EFalse;
     if ( dying->ClientWindowGroup() == iLastActiveClientWg )
         {
+        lastActiveDying = ETrue;
         iLastActiveClientWg = KErrNotFound;
         parentWg = dying->ParentWindowGroupId();
         }
@@ -349,8 +351,10 @@
             }
         delete wgs;
         }
-    
-    TRAP_IGNORE(FocusedWindowGroupChangedL(newFocusSession, parentWg))
+    if( lastActiveDying || newFocusSession )
+        {
+        TRAP_IGNORE(FocusedWindowGroupChangedL(newFocusSession, parentWg));
+        }
     }
 
 
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp	Fri May 14 02:41:21 2010 +0300
@@ -1592,9 +1592,9 @@
 
         // If we are reusing deleted texture, remove it from "deleted" array
         TInt index = iTextures.Find(&texture);
-        if (index != KErrNotFound)
+        if (index == KErrNotFound)
            {
-           iTextures.Remove(index);                
+           iTextures.Append(env->TextureManager().Texture(id));                
            }                    
 
 
@@ -1727,9 +1727,9 @@
 
         // If we are reusing deleted texture, remove it from "deleted" array
         TInt index = iTextures.Find(&textureRef);
-        if (index != KErrNotFound)
+        if (index == KErrNotFound)
            {
-           iTextures.Remove(index);                
+           iTextures.Append(env->TextureManager().Texture(id));                
            }                    
         
         // Add texture to skin content
--- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp	Fri May 14 02:41:21 2010 +0300
@@ -67,6 +67,12 @@
 #define ALF_USE_EMULATOR_LAYOUT_SWITCH_BUTTON
 #endif
 
+// Implements just Error() to avoid panic
+NONSHARABLE_CLASS(CSimpleScheduler) : public CActiveScheduler
+    {
+    void Error( TInt ) const{} // From CActiveScheduler
+    };
+
 NONSHARABLE_CLASS(TAlfEffectObserver): public MHuiEffectObserver
     {
     public:    
@@ -603,7 +609,7 @@
     if (err == KErrNone)
         {
         // Set up scheduler and cleanup stack for this thread
-        CActiveScheduler* scheduler = new CActiveScheduler;
+        CActiveScheduler* scheduler = new CSimpleScheduler();
         if (!scheduler)
             {
             return KErrNoMemory;
@@ -690,10 +696,6 @@
 //
 EXPORT_C CAlfAppUi::CAlfAppUi()
     {
-    if (CCoeEnv::Static())    
-        {
-        SetFullScreenApp(EFalse); // to avoid getting queued/suspended in case of S60 system events
-        }
     }
 
 // ---------------------------------------------------------------------------
@@ -808,25 +810,12 @@
     User::LeaveIfError(AMT_CONTROL()->OpenGlobalObjects());
     #endif
       
-    TInt flags = EStandardApp|ENoScreenFurniture|ENonStandardResourceFile|EAknEnableSkin;
-    CCoeEnv* coe = CCoeEnv::Static();
     iData =  new (ELeave) CAlfAppUiData();
 
     iData->iSettingsHandler = CAlfSrvSettingsHandler::NewL( *this );
     CreateHuiEnvL();
     
-    if (coe)
-        {
-        // initialize app basic services
-        CAknAppUi::BaseConstructL(flags);
-
-        // create direct pointer to server so no need to access coestatics whenever server needed
-        iData->iServer = static_cast<CAlfAppServer*>(static_cast<CEikonEnv*>(coe)->AppServer());
-        }
-    else
-        { 
-        iData->iServer = CAlfAppServer::NewAppServerL();
-        }
+    iData->iServer = CAlfAppServer::NewAppServerL();
 
     iData->iServer->SetAppUi(this);     
     
@@ -838,34 +827,25 @@
     mainWg.SetOrdinalPosition(-1,ECoeWinPriorityNeverAtFront);
 
 
-    if (!coe) // multiple screen support missing, for main display only atm
-        {
-        TUid appUid = TUid::Uid(KAlfAppServerInterfaceUid3);
-        // complete server construction
-        TName serverName;
-        _LIT(KServerNameFormat, "%08x_%08x_AppServer");
-        serverName.Format( 
+    TUid appUid = TUid::Uid(KAlfAppServerInterfaceUid3);
+    // complete server construction
+    TName serverName;
+    _LIT(KServerNameFormat, "%08x_%08x_AppServer");
+    serverName.Format( 
                 KServerNameFormat, 
                 appUid, 
                 appUid.iUid );
         
-        iData->iServer->ConstructL(serverName);
+    iData->iServer->ConstructL(serverName);
         
-        // parametrize our window group
-        CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(CHuiStatic::WsSession());
-        wgName->SetHidden(ETrue); // hides us from FSW and protects us from OOM FW etc.
-        wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down    
-        wgName->SetCaptionL(_L("ALF"));
-        wgName->SetAppUid(appUid);
-        wgName->SetWindowGroupName(mainWg);
-        CleanupStack::PopAndDestroy();
-        }
-    // misc settings for surroundings     
-    if (coe)
-        { // we ndon't need these in NGA
-        mainWg.EnableFocusChangeEvents();
-        }
-        
+    // parametrize our window group
+    CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(CHuiStatic::WsSession());
+    wgName->SetHidden(ETrue); // hides us from FSW and protects us from OOM FW etc.
+    wgName->SetSystem(ETrue); // Allow only application with PowerManagement cap to shut us down    
+    wgName->SetCaptionL(_L("ALF"));
+    wgName->SetAppUid(appUid);
+    wgName->SetWindowGroupName(mainWg);
+    CleanupStack::PopAndDestroy();        
     CHuiStatic::WsSession().ComputeMode(RWsSession::EPriorityControlDisabled);
 
     RThread thread; 
@@ -873,27 +853,16 @@
 
     // delegates..
     iData->iResourceManager = CAlfSrvResourceManager::NewL( *iData->iHuiEnv );
-
-    if (coe)
-        {
-        iData->iSharedWindow = new (ELeave) CAlfSharedDisplayCoeControl();
-        iData->iSharedWindow->ConstructL();
-        iData->iSharedWindow->DrawableWindow()->EnableVisibilityChangeEvents();
-        }
-    else
-        { 
-        //mainWg.EnableScreenChangeEvents();
         
-        CHuiStatic::WsSession().EnableWindowSizeCacheL();
-        iData->iPlainWindow = new (ELeave) RWindow(CHuiStatic::WsSession());
-        iData->iPlainWindow->Construct(*CHuiStatic::RootWin(),0x000FAB10); // FYI: multiple display support neglegted atm
-        iData->iPlainWindow->SetExtentErr(TPoint(0,0),CHuiStatic::ScreenDevice()->SizeInPixels()); // FYI: multiple display support neglegted atm            
-        iData->iPlainWindow->Size(); // to populate size cache
-        iData->iPlainWindow->Activate();
-        iData->iPlainWindow->SetVisible(ETrue);
-        iData->iPlainWindow->SetTransparencyAlphaChannel();
-        iData->iPlainWindow->SetBackgroundColor(~0);          
-        }
+    CHuiStatic::WsSession().EnableWindowSizeCacheL();
+    iData->iPlainWindow = new (ELeave) RWindow(CHuiStatic::WsSession());
+    iData->iPlainWindow->Construct(*CHuiStatic::RootWin(),0x000FAB10); // FYI: multiple display support neglegted atm
+    iData->iPlainWindow->SetExtentErr(TPoint(0,0),CHuiStatic::ScreenDevice()->SizeInPixels()); // FYI: multiple display support neglegted atm            
+    iData->iPlainWindow->Size(); // to populate size cache
+    iData->iPlainWindow->Activate();
+    iData->iPlainWindow->SetVisible(ETrue);
+    iData->iPlainWindow->SetTransparencyAlphaChannel();
+    iData->iPlainWindow->SetBackgroundColor(~0);          
 
     iData->iBridge = CAlfStreamerBridge::NewL(0);
     iData->iBridge->iAlfWindowData.iAlfWindowGrpId = mainWg.Identifier();
@@ -908,19 +877,12 @@
 	iData->iAlfEffectObserver = new (ELeave) TAlfEffectObserver(&iData->iBridge->iActiveEffectCount, *iData->iBridgeObj);
 	iData->iHuiEnv->EffectsEngine()->SetObserver(iData->iAlfEffectObserver);
 			
-    if( !iData->iPlainWindow)
-        {
-        // Create default CAlfScreen already now to be able to show controlgroups early enough... 
-  	    iData->iBridgeObj->AddNewScreenL(iData->iSharedWindow);
-        }
-    else 
-        {
-  	    iData->iBridgeObj->AddNewScreenFromWindowL(iData->iPlainWindow);
-        iData->iEventAo = new (ELeave) CAlfEventBridge(*this, *iData->iBridgeObj->Display(0));
+    iData->iBridgeObj->AddNewScreenFromWindowL(iData->iPlainWindow);
+    iData->iEventAo = new (ELeave) CAlfEventBridge(*this, *iData->iBridgeObj->Display(0));
         
-        RThread eventThread;
+    RThread eventThread;
 
-        User::LeaveIfError(eventThread.Create(
+    User::LeaveIfError(eventThread.Create(
             KAlfEventThreadName,
             AlfEventThreadStartFunction,
             16384, // magic
@@ -928,9 +890,8 @@
             (TAny*)iData->iEventAo, 
             EOwnerThread));
 
-        eventThread.Resume();
-        eventThread.Close();
-        }
+    eventThread.Resume();
+    eventThread.Close();
 
     AppendDisplayOnSharedWindowL(*(iData->iBridgeObj->Display(0)));
     
@@ -941,9 +902,11 @@
     iData->iServer->TextureManager().HandleEnvCreateL( *iData->iHuiEnv );
     
     // Construct transition effect instance if it does not yet exist
+    // OBSOLETE
 	iData->iServer->CreateTransitionEffectsL();
 	
 	// Load Tfx server client API plugin, if exists
+    // OBSOLETE
 	iData->iServer->CreateTfxServerPlugin();
     
 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
@@ -956,21 +919,11 @@
 // ---------------------------------------------------------------------------
 // From class CAknAppUi.
 // Handles system event.
+// OBSOLETE
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CAlfAppUi::HandleSystemEventL(const TWsEvent& aEvent)
+EXPORT_C void CAlfAppUi::HandleSystemEventL(const TWsEvent&)
     {
-    switch (*(TApaSystemEvent*)(aEvent.EventData()))
-		{
-	case EApaSystemEventBroughtToForeground:
-        { // we need to suppress this event as it causes undesired effects on applications underneath
-        break;
-        }
-    default:
-        CAknAppUi::HandleSystemEventL(aEvent);
-        }
-
-    return;
     }
 
 void CAlfAppUi::StartPointerEventHandling()
@@ -996,17 +949,6 @@
     
     iData->iResourceManager->SetActiveSession( iData->iActiveSession );
 
-    if (CCoeEnv::Static())
-        {   
-        if( aSession )
-            {
-            CHuiStatic::RootWin()->EnableGroupListChangeEvents();
-            }
-        else
-            {
-            CHuiStatic::RootWin()->DisableGroupListChangeEvents();
-            }
-        }
     if(!aSession)
         {
         if (iData->iMainDisplay) // TBD: multiple display support once again...
@@ -1023,41 +965,14 @@
 //
 EXPORT_C void CAlfAppUi::HandleWsEventL(const TWsEvent& aEvent, CCoeControl* aDestination)
     {
-    TBool handlingPtrEvent(EFalse);
-    
     if (aEvent.Type() >= EEventPointer && aEvent.Type() <= 	EEventDragDrop )
         {
         StartPointerEventHandling();
-        handlingPtrEvent = ETrue; // just to play it safe
-        }
-
-    // A Fix for AlfServer not shutting down on power off (ANIA-7EWFV6)
-    if ( aEvent.Type() == EEventPowerMgmt ) 
-        {
-        TApaSystemEvent systemEvent( *(TApaSystemEvent*)(aEvent.EventData()) );
-        if ( systemEvent == EApaSystemEventShutdown || systemEvent == EApaSystemEventSecureShutdown )
-            {
-            // Don't let this event go further to base class' HandleWsEventL,
-            // since it'll start the appShutter, which will be ignored first,
-            // and when it would be really needed (after AllClientsClosed), it's already destroyed. 
-            return;
-            }
         }
     
-    if (!iData->iEventAo) // CCoeEnv exists
+    if( aEvent.Type() == EEventScreenDeviceChanged  )
         {
-        CAknAppUi::HandleWsEventL(aEvent, aDestination);
-        if (handlingPtrEvent)
-            {
-            EndPointerEventHandling();
-            }
-        }
-    else
-        {
-        if( aEvent.Type() == EEventScreenDeviceChanged  )
-            {
-            HandleResourceChangeL( KEikDynamicLayoutVariantSwitch );
-            }
+        HandleResourceChangeL( KEikDynamicLayoutVariantSwitch );
         }
     
     switch ( aEvent.Type() )
@@ -1180,8 +1095,7 @@
 //
 EXPORT_C TBool CAlfAppUi::FrameworkCallsRendezvous() const
     {
-    // just basecall for now    
-    return CAknAppUi::FrameworkCallsRendezvous();      
+    return EFalse;
     }
 
 // ---------------------------------------------------------------------------
@@ -1248,12 +1162,8 @@
 // Called when a command is received.
 // ---------------------------------------------------------------------------
 //
-EXPORT_C void CAlfAppUi::HandleCommandL(TInt aCommand)
+EXPORT_C void CAlfAppUi::HandleCommandL(TInt)
     {
-    if (aCommand == EEikCmdExit && iData->iAllClientsClosed)
-        {
-        Exit();
-        }
     }
 
 // ---------------------------------------------------------------------------
@@ -1269,27 +1179,8 @@
 // Updates non-fading setting to window.
 // ---------------------------------------------------------------------------
 //
-void CAlfAppUi::SetContainerNonFading( TBool aNonFading )
+void CAlfAppUi::SetContainerNonFading(TBool)
     {
-    const TBool nonFading = iData->iSharedWindowNonFading;
-    if ( ( nonFading && !aNonFading ) ||
-         ( !nonFading && aNonFading ) )
-        {
-        // Update window server setting.
-        iData->iSharedWindowNonFading = aNonFading;
-        iData->iSharedWindow->DrawableWindow()->SetNonFading( aNonFading );
-        
-        // If non-fading is turned off, update fading to correct value.
-        // It's assumed that alfred applications are not shown in a pop up.
-        // If it were possible, we would need to know if alfred pop up is
-        // topmost.
-        if ( !aNonFading )
-            {
-            iData->iSharedWindow->DrawableWindow()->SetFaded( 
-                IsFaded(),
-                RWindowTreeNode::EFadeIncludeChildren );
-            }
-        }
     }
 
 // ---------------------------------------------------------------------------
@@ -1355,7 +1246,7 @@
 
 TTypeUid::Ptr CAlfAppUi::MopSupplyObject(TTypeUid aId)
     {
-    return CAknAppUi::MopSupplyObject(aId);
+    return TTypeUid::Null();
     }
 
 // ---------------------------------------------------------------------------
@@ -1384,8 +1275,7 @@
 void CAlfAppUi::ShowControlGroupL(CHuiRoster& aRoster, CHuiControlGroup& aGroup, TInt aWhere, TInt aScreenNumber )
     {
     iData->iBridgeObj->ShowControlGroupL(aRoster, aGroup, aWhere, aScreenNumber);    
-    iData->iBridgeObj->HandleVisualVisibility( aScreenNumber );    
-
+    iData->iBridgeObj->HandleVisualVisibility( aScreenNumber );
     }
 
 // ---------------------------------------------------------------------------
@@ -1431,18 +1321,6 @@
 //
 void CAlfAppUi::NotifyLowMemory(TInt aAmountOfFreeMemRequested)
     {
-/*
-	// Toggle between normal & low memory levels
-    if (!aAmountOfFreeMemRequested)
-        {
-        iData->iBridgeObj->SetMemoryLevel(EHuiMemoryLevelNormal);
-        }
-    else
-        {
-        iData->iBridgeObj->SetMemoryLevel(EHuiMemoryLevelLow);        
-        }
-*/
-
 	// Enable "ultra-low" memory mode
     if (!aAmountOfFreeMemRequested)
         {
@@ -1511,11 +1389,6 @@
         {
         User::Leave(KErrPermissionDenied);    
         }
-    
-//	if (iData->iBridgeObj->LayoutSwitchEffectCoordinator())
-//		{
-//		iData->iBridgeObj->LayoutSwitchEffectCoordinator()->EnableSafeCounter(EFalse); // let capserver rule  
-//		}
   
     TBool pause = aMessage.Int0();
     
--- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp	Fri May 14 02:41:21 2010 +0300
@@ -361,7 +361,7 @@
         TInt aClientSideGroupId,
         CHuiCanvasVisual* aVisual )
     {
-    __ALFFXLOGSTRING1("CAlfBridge::AddVisual 0x%x", aWindowNodeId);
+    __ALFFXLOGSTRING4("CAlfBridge::AddVisual id: %d (%d,%d), visual: 0x%x", aWindowNodeId, aClientSideId, aClientSideGroupId, aVisual);
     THashVisualStruct visualStruct( aVisual, aClientSideId, aClientSideGroupId);
     iWindowHashArray.Insert( aWindowNodeId, visualStruct );
     iPreviouslySearchedVisualId = aWindowNodeId;
@@ -406,7 +406,7 @@
         iPreviouslySearchedVisual = visualStruct->iVisual;
         return iPreviouslySearchedVisual; 
         }
-    __ALFFXLOGSTRING1("CAlfBridge::FindVisual - Visual 0x%x not found", aWindowNodeId);
+    __ALFLOGSTRING1("CAlfBridge::FindVisual - Visual 0x%x not found", aWindowNodeId);
     return NULL;
     }
 
@@ -664,13 +664,16 @@
                 TBool anyVisualHasEffect(EFalse);
                 TInt familyIndex(0);
                 TInt familySize = familyTree.Count();
+                TInt activeEffectIndex = KErrNotFound; 
                 while(familyIndex < familySize && !anyVisualHasEffect)
                     {
-                    anyVisualHasEffect = HasActiveEffect(familyTree[familyIndex++]);
+                    anyVisualHasEffect = HasActiveEffect(familyTree[familyIndex++], activeEffectIndex); 
+                    
                     }
                 
                 if (anyVisualHasEffect)
                     {
+                    TInt activeEffectHandle = iEffectCleanupStack[activeEffectIndex].iHandle;
                     __ALFFXLOGSTRING1("Layout 0x%x has external content", layout);
                     // EHuiVisualFlagShouldDestroy destroy flag should have come for the windows in this layout already
                     layout->SetFlags(EHuiVisualFlagShouldDestroy);
@@ -692,10 +695,16 @@
                     effectControlGroup.AppendL(layout, effectControlGroupLayout); // this will remove it from the previous layout
                     layout->SetOwner(effectControlGroup);
                     
-                    for(TInt familyIndex = 0; familyIndex < familyTree.Count();familyIndex++)
-                        {
-                        familyTree[familyIndex]->SetOwner(effectControlGroup);
-                        }
+                    for(TInt familyIndex = familyTree.Count() - 1; familyIndex >= 0; --familyIndex)
+                       {
+                       familyTree[familyIndex]->SetOwner(effectControlGroup);                      
+                       
+                       if (!HasActiveEffect(familyTree[familyIndex]))
+                           {
+                           TInt dummy;
+                           AddEffectItemL(activeEffectHandle, familyTree[familyIndex], NULL, NULL, EFalse, dummy, EFalse);
+                           }
+                       }
                     }
                 else
                     {
@@ -710,6 +719,8 @@
                          if ( removedVisual != layout ) // let control group delete the layout
 					         {
 					         control.Remove(removedVisual); // remove ownership from the original control (group)
+					         __ALFFXLOGSTRING1("CAlfBridge::DeleteControlGroupL - adding to orphonage 0x%x", layout);
+					         RemoveTemporaryPresenterVisual(removedVisual);
 					         if ( removedVisual->Layout() == layout ) 
 					             {
 					             iOrphanStorage->AppendL( removedVisual );
@@ -1687,11 +1698,7 @@
             }
         }
 
-    
-    if ( iSwRenderingEnabled )
-        {
-        screen->iDisplay->SetForegroundTextureOptions( alfWindowGroupFoundVisible );
-        }
+	screen->iDisplay->SetForegroundTextureOptions( alfWindowGroupFoundVisible | alfClientWindowGroupVisible );
 
     // Finally, if there are fadeeffects applied to windowgroups, make sure first one does not
     // blend itself, but other windowgroups do blend. Otherwise windowgrouops above others
@@ -2715,6 +2722,9 @@
         CHuiLayout* lVisual = familyTree[familyIndex];
         lVisual->Owner().Remove(lVisual);
         iOrphanStorage->AppendL( lVisual );
+        RemoveTemporaryPresenterVisual(lVisual);
+        
+        __ALFLOGSTRING1("CAlfBridge::DestroyWindow - orphons: %d", iOrphanStorage->VisualCount());
         }
     familyTree.Close();
          
@@ -3204,7 +3214,9 @@
 			}
 		}
   
-	iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed   
+	iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed
+
+	AMT_MAP_BRIDGE_SET_ORDINAL_POSITION();
 	}
 
 // ---------------------------------------------------------------------------
@@ -3259,6 +3271,27 @@
 			{
 			viz->ClearCommandSet();
 			}
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+		if (!(viz->Flags() & EHuiVisualFlagInactive))
+		    {
+            TInt secureId = viz->Owner().ControlGroup()->SecureId();
+            TInt64 temp(KErrNotFound);
+            TBool effects(EFalse);
+            AMT_GET_TIME(temp, secureId, 0, effects);
+            if (temp != KErrNotFound && effects == EFalse)
+                {
+                TTime time;
+                time.UniversalTime();
+                TTime startTime(temp);
+                    
+                TInt64 reactionTime = time.MicroSecondsFrom(startTime).Int64();
+                    
+                RDebug::Printf("CAlfBridge::HandlePostCanvasBufferL - Reaction time \t0x%x\t%f", secureId, (TReal)reactionTime / 1000000.0f );
+                AMT_RESET_TIME(secureId);
+                }
+		    }
+#endif
+		
 		// If tracking has been enabled for this CHuiCanvasVisual object, the buffers will be marked for tracking aswell in CHuiCanvasVisual
 		switch( bufferAttributes->iPartStatus )
 			{
@@ -4173,6 +4206,7 @@
                     effectFlags |= KHuiFxEffectExcludeChildrenFlag;
                     //RDebug::Print(_L("CAlfBridge::SetupFadeEffectL - no children faded by parent"));
                     }
+                __ALFFXLOGSTRING1("CAlfBridge::SetupFadeEffectL - insert fade 0x%x", &aVisual);
                 TRAP( err, engine->LoadEffectL(*iFadeEffectFile, effect, aVisual.Effectable(), NULL, NULL, 0, effectFlags ) );
                 didFadeEffectLoad = ETrue;
         		}
@@ -4184,6 +4218,7 @@
         if (alreadyFaded)
             {
             aVisual.SetEffect( NULL );
+            __ALFFXLOGSTRING1("CAlfBridge::SetupFadeEffectL - remove fade: 0x%x", &aVisual);
             alreadyFaded = EFalse;
             }
         }
@@ -4269,7 +4304,9 @@
         else 
             {
             __ALFLOGSTRING("CAlfBridge::HandleMoveWindowToNewGroupL cannot find new group! orphaning the visual");
-            iOrphanStorage->AppendL( viz );
+            
+            RemoveTemporaryPresenterVisual(viz);
+             iOrphanStorage->AppendL( viz );
             }
         }
     else
@@ -4874,8 +4911,6 @@
         }
     else // MAlfGfxEffectPlugin::EEndFullscreen
         {
-        stream.Release();
-
         // End fullscreen signal received. We proceed only if there is really
         // effect ongoing and "end fullscreen" hasn't already been processed.
         
@@ -4884,7 +4919,22 @@
             __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END: fx ready");
             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();
+                
+                }
+            CleanupStack::PopAndDestroy( fxData );
+            fxData = NULL;
+        
         __ALFFXLOGSTRING("HandleGfxEffectsL - process end");
         iFullScreenEffectData->iEndFullScreen = ETrue;
 
@@ -4894,6 +4944,7 @@
             iFullScreenEffectData->iDrawingCompleteTimer->Cancel();
             }
 #endif			
+        stream.Release();
         }
 
     CFullScreenEffectState* fxData = iFullScreenEffectData;
@@ -5082,7 +5133,7 @@
         }
     else
         {
-        __ALFFXLOGSTRING2("CAlfBridge::HandleGfxControlEffectsL - Control not found. iClientHandle %d, iClientGroupHandle %d", 
+        __ALFFXLOGSTRING2("CAlfBridge::HandleSetDistractionWindowL - Control not found. iClientHandle %d, iClientGroupHandle %d. Cache request.", 
                 fxData->iClientHandle, 
                 fxData->iClientGroupHandle);
         return;
@@ -5385,7 +5436,7 @@
     CHuiFxEngine* engine = NULL;
     // engine is not owned by us, it is a member of HuiEnv
     engine = iHuiEnv->EffectsEngine();
-    if (engine)
+    if (engine && aCanvasVisual)
         {
         if (NeedsStoredBuffers(engine, *aEvent.iEffectName))
             {
--- a/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp	Fri May 14 02:41:21 2010 +0300
@@ -818,10 +818,9 @@
         RMemReadStream& aStream)
     {
     iAction = aAction;
-
     iHandle = aStream.ReadInt32L();
-
     iType = aStream.ReadInt32L();
+    iTimeoutTriggered = aStream.ReadInt32L();
     iToWg = aStream.ReadInt32L();
     iFromWg = aStream.ReadInt32L();
     iToAppId = aStream.ReadInt32L();
@@ -831,8 +830,6 @@
         {
         iToSecureId = aStream.ReadInt32L();
         iFromSecureId = aStream.ReadInt32L();
-        /*screen1 =*/aStream.ReadInt32L();
-        /*screen2 =*/aStream.ReadInt32L();
         }
     /*TInt flags =*/
     aStream.ReadInt32L();
--- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp	Fri May 14 02:41:21 2010 +0300
@@ -32,6 +32,12 @@
 #include <alf/AlfTransEffectPlugin.hrh>
 
 
+// Implements just Error() to avoid panic
+NONSHARABLE_CLASS(CSimpleScheduler) : public CActiveScheduler
+    {
+    void Error( TInt ) const{} // From CActiveScheduler
+    };
+
 // ==================================
 // Launcher implementation.
 // ==================================   
@@ -66,7 +72,7 @@
         thread.Close();
 
         // Set up scheduler and cleanup stack for this thread
-        CActiveScheduler* scheduler = new CActiveScheduler;
+        CActiveScheduler* scheduler = new CSimpleScheduler;
         if (!scheduler)
             {
             return KErrNoMemory;
--- a/uiacceltk/hitchcock/ServerCore/Src/alfvisualhandlers.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerCore/Src/alfvisualhandlers.cpp	Fri May 14 02:41:21 2010 +0300
@@ -46,6 +46,9 @@
 #include "alfsrvsubsessionbase.h"
 #include "alfsrvtransformationsubsession.h"
 
+#define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
+#include "alfmoduletest.h" 
+
 #ifdef RD_ALF_IN_PLATFORM
 #include <aknlayout2hierarchy.h>
 #endif
@@ -768,6 +771,11 @@
             CHuiFxEngine* engine = iVisual->Env().EffectsEngine();
             if (engine)
                 {
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+                TTime time;
+                time.UniversalTime();
+                AMT_ADD_TIME(params->iHandle, time.Int64(), ETrue);
+#endif  
                 CHuiFxEffect* effect = NULL;
                 engine->LoadEffectL( params->iFileName, effect, iVisual->Effectable(), NULL , NULL, params->iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn );
                 // The effect will be automatically set to the visual if parsing succeeds
@@ -781,6 +789,11 @@
             CHuiFxEngine* engine = iVisual->Env().EffectsEngine();
             if (engine)
                 {
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+                TTime time;
+                time.UniversalTime();
+                AMT_ADD_TIME(params->iHandle, time.Int64(), ETrue);
+#endif  
                 CHuiFxEffect* effect = NULL;
                 // this will add the group, if it does not exist already
                 // Begin and End group events are supposed to come through GfxTransEffect API.
--- a/uiacceltk/hitchcock/ServerInterface/src/alfdocument.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/ServerInterface/src/alfdocument.cpp	Fri May 14 02:41:21 2010 +0300
@@ -42,7 +42,8 @@
 //
 CEikAppUi* CAlfDocument::CreateAppUiL()
     {
-    return new (ELeave) CAlfAppUi;
+    User::Leave(KErrNotSupported);    
+    return 0;
     }
 
 
--- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h	Fri May 14 02:41:21 2010 +0300
@@ -186,6 +186,7 @@
     void DoHandleBufferL(TInt aIndex, TRect& aDisplayRect, TInt aAction, const CHuiCanvasVisual& aUser, CHuiGc* aGc, TPoint& aPos); 
     void DoHandleBufferStringL(TInt aIndex, TRect& aDisplayRect, TInt aAction, const CHuiCanvasVisual& aUser, CHuiGc* aGc, TPoint& aPos, TPtr8 aCommandBuffer, CHuiCanvasCommandBuffer *aBuffer);
 
+    void DoPeekBufferAndUpdateShapeRegionL();
     void DoPeekBufferL(TInt aIndex);     
     void DoDigestPaddingL();
 
@@ -284,6 +285,9 @@
     
     virtual void ClearCapturingBufferArea(const TRect& aRect);
     
+    void ApplyShapeRegion();
+    void TranslateShapeRegion(const TPoint& aNewOrigin);
+    
 private:
     
     /** Region which this painter updates with current command buffers */
@@ -314,6 +318,8 @@
     TBool iAutomaticRenderBufferUsage;
     
     /** Flags to tell whether the window shape region has been changed  */
+    TBool iShapeRegionAvailable;
+    TPoint iShapeRegionOrigin;
     TBool iShapeRegionClearingPending;
     TBool iShapeRegionClippingPending;
     
@@ -390,6 +396,6 @@
     
     // Boolean flag indicating if render buffer ought to be used.
     TBool iEnableRenderBuffer;
-  };
+    };
     
 #endif  // __HUICANVASWSPAINTER_H__
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/group/huirendervg10.mmp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/group/huirendervg10.mmp	Fri May 14 02:41:21 2010 +0300
@@ -48,6 +48,7 @@
 
 USERINCLUDE     ../../inc
 USERINCLUDE     ../inc
+USERINCLUDE     ../../../CommonInc
 
 //Added as part of break team support changes.
 #include "../../../../../group/stdinc.mmh"
--- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiFxVg10BrightnessContrastFilter.cpp	Fri May 14 02:41:21 2010 +0300
@@ -87,5 +87,8 @@
     iColorMatrix[16] = oOff;
     iColorMatrix[17] = oOff;
     iColorMatrix[18] = oOff;
-    iColorMatrix[19] = 0.0f;
+    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
     }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp	Fri May 14 02:41:21 2010 +0300
@@ -218,6 +218,8 @@
     iVisibleAreaObservers.Reset();
     iRosterObservers.Reset();
 
+    iTempDirtyRegions.Close();
+    
     iDirtyRegions.Close();
     iDirtyRegions2.Close();
     if ( iCurrentDirtyRegions )
@@ -649,6 +651,9 @@
  	
     iWholeDisplayAreaIsDirty = EFalse;    
     
+    // Restore state to defaults. Alf client may have done some NVG drawing outside refresh loop and main drawing context may be wrong
+    iGc->RestoreState();
+    
     if(iUpdateRenderState)
         {
         // Set state when requested.
@@ -734,16 +739,18 @@
     // this frame and the previous frame (this is needed when buffer swapping
     // is used; with buffer copying a single list of dirty regions would
     // suffice).
-    RDirtyRegions dirty;
+
+
+    iTempDirtyRegions.Reset();
     for(i = 0; i < iCurrentDirtyRegions->Count(); ++i)
         {
-        dirty.Append((*iCurrentDirtyRegions)[i]);
+        iTempDirtyRegions.Append((*iCurrentDirtyRegions)[i]);
         }
     if (iPreviousDirtyRegions)
     	{
     	for(i = 0; i < iPreviousDirtyRegions->Count(); ++i)
         	{
-        	AddDirtyRegion((*iPreviousDirtyRegions)[i], dirty, EFalse);
+        	AddDirtyRegion((*iPreviousDirtyRegions)[i], iTempDirtyRegions, EFalse);
         	}
     	}
 
@@ -794,25 +801,25 @@
 	// Set dirty rect in render surface to minimize screen update
 	// Only implemented for BitGdi renderer for now
     TRect mergedDirtyRect;
-    if (dirty.Count() > 0)
+    if (iTempDirtyRegions.Count() > 0)
     	{
-    	mergedDirtyRect = dirty[0];
+    	mergedDirtyRect = iTempDirtyRegions[0];
     	}
     	
 	if (useDirtyRects)
 	    {
 		// When Bitgdi renderer used set dirty rect in render surface
 		// to minimize screen update in CHuiBitgdiRenderSurface::SwapBuffers
-	    if (dirty.Count() == 1)
+	    if (iTempDirtyRegions.Count() == 1)
 		    {
             ClipDirtyRect(mergedDirtyRect, VisibleAreaClippingRect());
             iRenderSurface->SetDirtyRect(mergedDirtyRect);
 		    }
-		else if (dirty.Count() > 1) 
+		else if (iTempDirtyRegions.Count() > 1) 
 		    {
-			for(i = 1; i < dirty.Count(); ++i)
+			for(i = 1; i < iTempDirtyRegions.Count(); ++i)
 				{
-				TRect r(dirty[i]);
+				TRect r(iTempDirtyRegions[i]);
 				// check top left corner to expand or not
 				if (r.iTl.iX < mergedDirtyRect.iTl.iX)
 				    {
@@ -852,8 +859,8 @@
 	// Merge into max one dirty area when HW accelrated drawing is used
 	if (useDirtyRects && IsRendererHWAccelerated())
 	    {
-	    dirty.Reset();
-	    dirty.Append(mergedDirtyRect);
+        iTempDirtyRegions.Reset();
+        iTempDirtyRegions.Append(mergedDirtyRect);
 	    }
 	
 #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL
@@ -865,10 +872,11 @@
 #endif	
 	
     // Usually there is only one dirty region (if any).
-    for(i = 0; i < dirty.Count(); ++i)
+    iCurrentDirtyIndx = 0;
+    for(; iCurrentDirtyIndx < iTempDirtyRegions.Count(); ++iCurrentDirtyIndx)
         {
         // Set up the clipping rectangle.
-        TRect dirtyRect = dirty[i];
+        TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx];
         ClipDirtyRect(dirtyRect, VisibleAreaClippingRect());
         
         iGc->PushClip();
@@ -886,34 +894,7 @@
             iBackgroundColor = oldBgColor;
             }
                 
-        // Clear background for the dirty area
-        if (iBackgroundItems.Count() != 0)
-            {
-            ClearWithBackgroundItems(dirtyRect);    
-            }
-        else
-            {
-            switch (iClearBackground)
-                {
-                case EClearWithColor:
-                    {
-                    ClearWithColor(dirtyRect);                            
-                    break;    
-                    }
-                case EClearWithSkinBackground:
-                    {
-                    ClearWithSkinBackground(dirtyRect);                                                    
-                    break;    
-                    }
-                case EClearNone:
-                default:
-                    {
-                    // Don't do anything
-                    break;    
-                    }                                                
-                }                                    
-            }                                        
-        
+         
         if ( iForegroundBitmapGc && iForegroundTextureTransparency )
             {
             // There is ALF content in the background, we have to
@@ -965,7 +946,7 @@
         iGc->PopClip();
         }
 
-    dirty.Reset();
+    iTempDirtyRegions.Reset();
 
     // There must be no disparity in the number of pushed clipping rectangles.
     // (equivalent to __ASSERT_ALWAYS)
@@ -1787,3 +1768,39 @@
         
     User::LeaveIfError( err );
     }
+
+void CHuiDisplay::DoBackgroundClear()
+    {
+    if(iForegroundTextureTransparency) // alf application is visible -> clear background as requested 
+        {
+        // Clear background for the dirty area
+        TRect dirtyRect = iTempDirtyRegions[iCurrentDirtyIndx];
+        if (iBackgroundItems.Count() != 0)
+            {
+            ClearWithBackgroundItems(dirtyRect);    
+            }
+        else
+            {
+            switch (iClearBackground)
+                {
+                case EClearWithColor:
+                    {
+                    ClearWithColor(dirtyRect);                            
+                    break;    
+                    }
+                case EClearWithSkinBackground:
+                    {
+                    ClearWithSkinBackground(dirtyRect);                                                    
+                    break;    
+                    }
+                case EClearNone:
+                default:
+                    {
+                    // Don't do anything
+                    break;    
+                    }                                                
+                }                                    
+            }
+        }
+    }
+
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp	Fri May 14 02:41:21 2010 +0300
@@ -22,6 +22,16 @@
 #include "HuiRenderPlugin.h"
 #include "HuiCmdBufferBrush.h" // MHuiEffectable
 
+#include "alfmoduletestconf.h"
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    // Provides TLS object data for test cases.
+    // This is used only if module test hooks are set on.
+    #include "huistatictlsdata.h"
+#endif // USE_MODULE_TEST_HOOKS_FOR_ALF
+// Provides module test hook defines.
+#include "alfmoduletestdefines.h"
+
+
 EXPORT_C CHuiFxEffect* CHuiFxEffect::NewL(CHuiFxEngine& aEngine)
     {
     CHuiFxEffect* e = new (ELeave) CHuiFxEffect( aEngine );
@@ -107,6 +117,40 @@
         {
         return ETrue; // fade effect does not have observer that would need notification
         }
+    
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    TTime endTime;
+    endTime.UniversalTime();
+    
+	// There might be several BeginFullScreen for single effects. We want to calculate
+	// reaction time from the first BeginFullScreen event to this point
+    TInt timeStamps = 0;
+    AMT_GET_TIME_POINT_COUNT(iHandle, timeStamps);
+    
+    TInt64 temp;
+    TBool effects(EFalse); // dummy, 1 if effects were on for this time stamp
+    AMT_GET_TIME(temp, iHandle, 0, effects);
+    TTime startTime(temp);
+    
+    AMT_GET_TIME(temp, iHandle, timeStamps - 1, effects);
+    TTime effectStartTime(temp);
+    
+    TInt64 effectTime = endTime.MicroSecondsFrom(effectStartTime).Int64();
+    TReal fps = (TReal)iFramesDrawn / ((TReal)effectTime / 1000000.0f) ; 
+
+    TInt64 totalEffectTime = endTime.MicroSecondsFrom(startTime).Int64();
+    TInt64 reactionTime = effectStartTime.MicroSecondsFrom(startTime).Int64();
+        
+    RDebug::Printf("CHuiFxEffect::NotifyEffectEndObserver - Reaction time \t0x%x\t%f\tVisible effect time:\t%f\ts. (%f FPS). Total effect time:\t%f", 
+            iHandle,
+            (TReal)reactionTime / 1000000.0f,
+            ((TReal)effectTime)/1000000,
+            fps,
+            ((TReal)totalEffectTime)/1000000.0f 
+            );
+    AMT_RESET_TIME(iHandle);
+#endif
+    
     if (iEffectEndObserver)
         {
         // The callback can be called only once when the effect finishes
@@ -553,6 +597,13 @@
 
             if (iFramesDrawn == 1)
                 {
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+				// 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
                 aElapsedTime = 0;
                 iFramesDrawn++;
                 }
--- a/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/HuiRosterImpl.cpp	Fri May 14 02:41:21 2010 +0300
@@ -542,7 +542,10 @@
         DrawSelfFrozen(aGc, display);
         return;
         }
-
+    
+    // this was moved here because otherwise background clear did never end up to effect canvas buffers
+    display->DoBackgroundClear();
+    
     TInt visualCount = 0;
     TInt entryCount = iEntries.Count();
     // Draw the visuals tree in the display.
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp	Fri May 14 02:41:21 2010 +0300
@@ -258,7 +258,9 @@
             tempRegion.AddRect(iCommandBuffers[cb]->iOriginalDisplayRect);
             }
         }    
-    return tempRegion.BoundingRect();
+    TRect result = tempRegion.BoundingRect();
+    tempRegion.Close();
+    return result;
     }
 
 void CHuiCanvasPainter::ClearCapturingBufferArea(const TRect& /*aRect*/)
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp	Fri May 14 02:41:21 2010 +0300
@@ -987,9 +987,11 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
                 iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));
                 }
             
             // Draw            
@@ -998,6 +1000,7 @@
             if (cachedImage->iUseColorModulation)
                 {
                 iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetOpacity(oldOpacity);
                 }
             }        
         }
@@ -1027,9 +1030,11 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));    
                 }
             
             // Draw            
@@ -1038,6 +1043,7 @@
             if (cachedImage->iUseColorModulation)
                 {
                 iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetOpacity(oldOpacity);
                 }
             }
         }
@@ -1068,10 +1074,12 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
                 DrawTextBrush( destinationRect );
-                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));    
                 }
     
             // Draw            
@@ -1079,7 +1087,8 @@
     
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetPenColor(oldPenColor);
+                iCanvasGc->SetOpacity(oldOpacity);                        
                 }
             }
         }
@@ -1114,10 +1123,12 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
                 DrawTextBrush( destinationRect );
-                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));    
                 }
     
             // Draw            
@@ -1125,7 +1136,8 @@
     
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetPenColor(oldPenColor);
+                iCanvasGc->SetOpacity(oldOpacity);                        
                 }
             }    
         }
@@ -1160,10 +1172,12 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
                 DrawTextBrush( destinationRect );
-                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));    
                 }
     
             // Draw            
@@ -1171,7 +1185,8 @@
     
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetPenColor(oldPenColor);
+                iCanvasGc->SetOpacity(oldOpacity);                        
                 }
             }    
         }
@@ -1205,9 +1220,11 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
                 iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));
                 }
     
             // Draw            
@@ -1215,7 +1232,8 @@
     
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetPenColor(oldPenColor);
+                iCanvasGc->SetOpacity(oldOpacity);                        
                 }
             }    
         }
@@ -1248,9 +1266,11 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));    
                 }
     
             // Draw            
@@ -1258,7 +1278,8 @@
     
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetPenColor(oldPenColor); 
+                iCanvasGc->SetOpacity(oldOpacity);                       
                 }
             }
         }
@@ -1292,10 +1313,12 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
                 DrawTextBrush( destinationRect );
-                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));  
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));  
                 }
     
             // Draw            
@@ -1303,7 +1326,8 @@
     
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetPenColor(oldPenColor); 
+                iCanvasGc->SetOpacity(oldOpacity);                       
                 }
             }
         }
@@ -1341,10 +1365,12 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
                 DrawTextBrush( destinationRect );
-                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor)); 
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));   
                 }
     
             // Draw            
@@ -1352,7 +1378,8 @@
     
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetPenColor(oldPenColor);
+                iCanvasGc->SetOpacity(oldOpacity);                        
                 }
             }
         }
@@ -1390,10 +1417,12 @@
             destinationRect.Move(-dx,-dy);
             
             TRgb oldPenColor = iCanvasGc->PenColor();
+            TReal32 oldOpacity = iCanvasGc->Opacity();
             if (cachedImage->iUseColorModulation)
                 {
                 DrawTextBrush( destinationRect );
-                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));    
+                iCanvasGc->SetPenColor(ConvertToLinear(iWsPenColor));  
+                iCanvasGc->SetOpacity(TReal32(iWsPenColor.Alpha() / 255.f));  
                 }
     
             // Draw            
@@ -1401,7 +1430,8 @@
     
             if (cachedImage->iUseColorModulation)
                 {
-                iCanvasGc->SetPenColor(oldPenColor);                        
+                iCanvasGc->SetPenColor(oldPenColor);
+                iCanvasGc->SetOpacity(oldOpacity);                        
                 }
             }
         }
@@ -1876,12 +1906,15 @@
     if (aUpdateDisplay && renderbuffer && iCanvasGc->Gc())
         {
         THuiRealRect updatedRect = aUpdateRegion.BoundingRect();
-
+				  TInt w; 
+				  TInt h ;
         // Handle relative rotation
-        TRect displayArea = iVisual->Display()->VisibleArea();
-        TInt w = displayArea.Width();
-        TInt h = displayArea.Height();
-                
+        if (iVisual->Display())
+            {
+            TRect displayArea = iVisual->Display()->VisibleArea();
+            w = displayArea.Width();
+            h = displayArea.Height();
+            }
         // ...select right rotation...
         if (iRelativeOrientation == CHuiGc::EOrientationCW90)
             {
--- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp	Fri May 14 02:41:21 2010 +0300
@@ -246,6 +246,9 @@
         // Initialize canvas
         canvasGc.SetDefaults();   
 
+        // Ensure that all regions have been shifted to correct origin (before calculating iFullUpdateRegion).
+        UpdateBufferUpdateRegions(aPos);
+        
         // Make sure we got up to date update reagion
         iFullUpdateRegion.Clear();                
         TInt bufferCount = iCommandBuffers.Count();
@@ -313,7 +316,6 @@
             /* Begin draw. If render buffer is used this sets up the render buffer if needed */
             iCanvasWsGc->BeginActionL(aAction,aDisplayRect,aUser,cachePrepared,iFullUpdateRegion);                   
 
-            TBool isFullUpdateRegionCleared = EFalse;
             if(iShapeRegionClearingPending)
                 {
                 #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL
@@ -323,7 +325,6 @@
                 TBool doClear = ETrue;
                 iCanvasWsGc->EnableUpdateRegion(iFullUpdateRegion, doClear);
                 iCanvasWsGc->DisableUpdateRegion(); 
-                isFullUpdateRegionCleared = ETrue;
                 iShapeRegionClearingPending = EFalse;
                 }
 
@@ -472,9 +473,7 @@
                                                TBool aIgnoreClippedBuffers, 
                                                TBool aIgnoreHandledBuffers,
                                                TBool aClearBeforeHandlingBuffers) 
-    {   
-    UpdateBufferUpdateRegions(aPos);
-
+    {
     TInt bufferCount = iCommandBuffers.Count();
     for (TInt cb = 0; cb < bufferCount; cb++)
         {
@@ -623,6 +622,23 @@
     CleanupStack::PopAndDestroy();
     }
 
+void CHuiCanvasWsPainter::DoPeekBufferAndUpdateShapeRegionL()
+    {
+    TBool hadShapeRegion = iShapeRegionAvailable;
+    iShapeRegionAvailable = EFalse;
+    
+    TInt latest = iCommandBuffers.Count() - 1;    
+    DoPeekBufferL(latest);
+    
+    if (hadShapeRegion && !iShapeRegionAvailable)
+        {
+        // Previously we had shape region, but not any more.
+        // So refresh update regions.
+        iShapeRegionClearingPending = ETrue;
+        iShapeRegionClippingPending = ETrue;        
+        }
+    }
+
 void CHuiCanvasWsPainter::DoPeekBufferL(TInt aIndex) 
     {   
     RMemReadStream& readerStream = iWsCommandBufferReader->Stream();
@@ -1270,22 +1286,13 @@
     {
 	CHuiCanvasPainter::SetCommandSetL(aCommands);  
 
-    TInt latest = iCommandBuffers.Count() - 1;
-    DoPeekBufferL(latest);
+    DoPeekBufferAndUpdateShapeRegionL();
     SelectGcL();
        
     // If shape region has changed recalculate all update regions and remove redundant buffers
     if (iShapeRegionClippingPending)
         {
-        TInt bufferCount = iCommandBuffers.Count();
-        for (TInt cb = 0; cb < bufferCount; cb++)
-            {        
-            CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb];
-            cmdbuffer->iUpdateRegion.Copy(cmdbuffer->iOriginalUpdateRegion);                
-            cmdbuffer->iUpdateRegion.Intersect(iShapeRegion);
-            cmdbuffer->iUpdateRegion.Tidy();
-            }
-        iShapeRegionClippingPending = EFalse;       
+        ApplyShapeRegion();       
         RemoveRedundantBuffers();   
         }    
     
@@ -1307,8 +1314,11 @@
 #endif
 
     CHuiCanvasPainter::ClearCommandSet();
+    
+    iShapeRegionAvailable = EFalse;
+    
     // Release currently cached images. 
-    // They may still be taken into use after next HandleBuffferL call.
+    // They may still be taken into use after next HandleBufferL call.
     if (iCanvasVisual)
         {
         iCanvasVisual->Env().CanvasTextureCache().ReleaseAllCachedEntries(*iCanvasVisual); 
@@ -1338,23 +1348,10 @@
 #endif
 
     CHuiCanvasPainter::AddCommandSetL(aMoreCommands);
-    TInt latest = iCommandBuffers.Count() - 1;
-    DoPeekBufferL(latest);     
+    DoPeekBufferAndUpdateShapeRegionL();
     SelectGcL();
     
-    // If shape region has changed recalculate all update regions
-    if (iShapeRegionClippingPending)
-        {
-        TInt bufferCount = iCommandBuffers.Count();
-        for (TInt cb = 0; cb < bufferCount; cb++)
-            {        
-            CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb];
-            cmdbuffer->iUpdateRegion.Copy(cmdbuffer->iOriginalUpdateRegion);                
-            cmdbuffer->iUpdateRegion.Intersect(iShapeRegion);
-            cmdbuffer->iUpdateRegion.Tidy();
-            }
-        iShapeRegionClippingPending = EFalse;       
-        }    
+    ApplyShapeRegion();
     
     RemoveRedundantBuffers();   
     
@@ -2142,27 +2139,19 @@
         for (TInt i=count-1; i>=0; i--)
             {
             TRect rect = iTempRegion[i];
-            TRect screen = iCanvasVisual->Display()->VisibleArea();
-            if (rect.Intersects(screen) || rect == screen)
-                {
-                // - Sometimes updateregion is outiside window (WSERV...why?!) 
-                //   We clip it here to avoid ui probs.
-				// - Lets remove this for now, this seems to break scrollbars again
-				//   when window parent-child relations work..
-				// - Hmm, should we add this anyway because now the idle softkeys are lost again in landscape mode ?
-				// - Added again after WSERV fix in the window parent-child relations
+
+            // - Sometimes updateregion is outiside window (WSERV...why?!) 
+            //   We clip it here to avoid ui probs.
+            // - Lets remove this for now, this seems to break scrollbars again
+            //   when window parent-child relations work..
+            // - Hmm, should we add this anyway because now the idle softkeys are lost again in landscape mode ?
+            // - Added again after WSERV fix in the window parent-child relations
+            // - Rect may be outside the screen and that's fine (Visual may be moved later).
 #ifndef HUI_DISABLE_CANVAS_VISUAL_CLIPPING
-                rect.Intersection(displayRect); 
+            rect.Intersection(displayRect); 
 #endif                
-                iCommandBuffers[aIndex]->iUpdateRegion.AddRect(rect);    
-                iCommandBuffers[aIndex]->iOriginalUpdateRegion.AddRect(rect);    
-                }
-            else
-                {
-#ifdef _DEBUG
-                RDebug::Print(_L("CHuiCanvasWsPainter::WsSetUpdateRegionL: Incorrect update region removed from buffer, this should not happen !"));
-#endif
-                }
+            iCommandBuffers[aIndex]->iUpdateRegion.AddRect(rect);    
+            iCommandBuffers[aIndex]->iOriginalUpdateRegion.AddRect(rect);    
             }                
         
         // Combine areas that are next to each others
@@ -2210,16 +2199,19 @@
         iShapeRegion.Copy(iTempRegion);
 
         // note: iUpdateRegion will be updated later, set flags to indicate pending
+        iShapeRegionAvailable = ETrue;
+        iShapeRegionOrigin = iCanvasVisual->DisplayRect().Round().iTl;
+        
         iShapeRegionClearingPending = ETrue;
-        iShapeRegionClippingPending = ETrue;        
-       }
+        iShapeRegionClippingPending = ETrue;
+        }
     
 	
     #ifdef _DEBUG
     if (iShapeRegion.Count() == 0 && iTempRegion.Count() > 0)
         {
         HUI_DEBUG(_L("CHuiCanvasWsPainter::WsSetShapeRegionL. Error: iShapeRegion not set by any command buffer! However, there exists at least one command buffer that has shape region command."));
-         }
+        }
     #endif
     }
 
@@ -2268,9 +2260,9 @@
     
     RemoveBuffersWithoutRealDrawing();
 
-    // Remove buffers only with moved display rect and modify the clip region
-    // of buffers with changed size instead of completely removing all. 
-    RemoveBuffersWithMovedDisplayRect();
+    // Don't remove command buffers with modified display rect.
+	// Instead, apply clipping.
+    //RemoveBuffersWithMovedDisplayRect();
     ModifyBuffersWithChangedDisplayRect();
     //RemoveBuffersWithOldDisplayRect();
     
@@ -2304,16 +2296,32 @@
     TInt bufferCount = iCommandBuffers.Count();
     TRect canvasRect = iCanvasVisual->DisplayRect().Round();
     TRegionFix<1> region(canvasRect);
+
+    // We must first offset to canvasRect.iTl, otherwise region clipping doesn't work.
+    UpdateBufferUpdateRegions(canvasRect.iTl);
     
     // If the buffers have different update region than CanvasVisual, clip
     // the drawing to canvas visual's & cmdbuffer's updateregions' intersection.
     for (TInt cb = 0; cb < bufferCount; cb++)
         {
         CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb];
-        if (cmdbuffer->iOriginalDisplayRect.Round() != canvasRect)
+        TRect bufRect = cmdbuffer->iOriginalDisplayRect.Round();
+                
+        if (bufRect != canvasRect)
             {
             cmdbuffer->iUpdateRegion.Copy(cmdbuffer->iOriginalUpdateRegion);
+            
+            TPoint deltaPos = cmdbuffer->iPositionForUpdateRegion - cmdbuffer->iOriginalDisplayRect.Round().iTl;
+            cmdbuffer->iUpdateRegion.Offset(deltaPos);
+            
             cmdbuffer->iUpdateRegion.Intersect(region);
+            
+            if ( iShapeRegionAvailable )
+                {
+                TranslateShapeRegion(cmdbuffer->iPositionForUpdateRegion);
+                cmdbuffer->iUpdateRegion.Intersect(iShapeRegion);
+                }
+            
             cmdbuffer->iUpdateRegion.Tidy();
             }
         }
@@ -2383,7 +2391,11 @@
                 {
                 iTempRegion.AddRect(cmdbuffer->iOriginalUpdateRegion[j]);        
                 }
-                       
+            
+            // Translate region to be relative to visual top left corner.
+            TPoint offset = -cmdbuffer->iOriginalDisplayRect.Round().iTl;
+            iTempRegion.Offset(offset);
+            
             // Check older buffers for overlapping regions against current buffer
             if (cb > 0)
                 {                   
@@ -2394,19 +2406,26 @@
                         break;    
                         }
 
-                    CHuiCanvasCommandBuffer* previousCommands = iCommandBuffers[i];            
+                    CHuiCanvasCommandBuffer* previousCommands = iCommandBuffers[i];
+                    TPoint previousCommandsOffset = previousCommands->iOriginalDisplayRect.Round().iTl;
+                    
                     // Keep count how many subregions of the prevous command are contained inside current command buffer region
                     TInt coveredRegionCount = 0;                    
                     for (TInt k=0; k < previousCommands->iOriginalUpdateRegion.Count();k++)
                         {
                         iTempCurrentSubRegion.Clear();
                         iTempIntersectingRegion.Clear();                                               
-                        iTempCurrentSubRegion.AddRect(previousCommands->iOriginalUpdateRegion[k]);                        
+                        iTempCurrentSubRegion.AddRect(previousCommands->iOriginalUpdateRegion[k]);
+                                                
+                        iTempCurrentSubRegion.Offset(-previousCommandsOffset);
+                        
                         iTempIntersectingRegion.Intersection(iTempRegion, iTempCurrentSubRegion);
                         iTempIntersectingRegion.Tidy();
                         
                         if (iTempIntersectingRegion.Count() == 1)
                             {
+                            iTempIntersectingRegion.Offset(previousCommandsOffset);
+                        
                             if (iTempIntersectingRegion[0] == previousCommands->iOriginalUpdateRegion[k])
                                 {
                                 coveredRegionCount++;
@@ -2432,6 +2451,45 @@
         }
     }
 
+void CHuiCanvasWsPainter::ApplyShapeRegion()
+    {
+    // If shape region has changed recalculate all update regions
+    if (iShapeRegionClippingPending)
+        {
+        TRect canvasRect = iCanvasVisual->DisplayRect().Round();
+
+        // We must first offset to canvasRect.iTl, otherwise region clipping doesn't work.
+        UpdateBufferUpdateRegions(canvasRect.iTl);
+
+        TInt bufferCount = iCommandBuffers.Count();
+        for (TInt cb = 0; cb < bufferCount; cb++)
+            {        
+            CHuiCanvasCommandBuffer* cmdbuffer = iCommandBuffers[cb];
+            cmdbuffer->iUpdateRegion.Copy(cmdbuffer->iOriginalUpdateRegion);                
+
+            TPoint deltaPos = cmdbuffer->iPositionForUpdateRegion - cmdbuffer->iOriginalDisplayRect.Round().iTl;
+            cmdbuffer->iUpdateRegion.Offset(deltaPos);
+
+            if ( iShapeRegionAvailable )
+                {
+                TranslateShapeRegion(cmdbuffer->iPositionForUpdateRegion);                 
+                cmdbuffer->iUpdateRegion.Intersect(iShapeRegion);
+                }
+            cmdbuffer->iUpdateRegion.Tidy();
+            }
+        iShapeRegionClippingPending = EFalse;       
+        }    
+    }
+    
+void CHuiCanvasWsPainter::TranslateShapeRegion(const TPoint& aNewOrigin)
+    {
+    if (iShapeRegionOrigin != aNewOrigin)
+        {
+        iShapeRegion.Offset(aNewOrigin - iShapeRegionOrigin);
+        iShapeRegionOrigin = aNewOrigin;
+        }
+    }
+
 CHuiCanvasGc& CHuiCanvasWsPainter::CanvasGc() const
 	{
 	return iCanvasWsGc->CanvasGc();
@@ -2704,18 +2762,28 @@
 	{
 	// iUpdateRegion is in screen coordinates. If visual moves position, iUpdateRegion 
 	// should be updated as well. Otherwise visual will encounter clipping.
-    for (TInt cb = 0; cb < iCommandBuffers.Count(); cb++)
+    TBool updated = EFalse;
+	
+	for (TInt cb = 0; cb < iCommandBuffers.Count(); cb++)
         {
 		if (iCommandBuffers[cb]->iPositionForUpdateRegion != aPos && !iCommandBuffers[cb]->iUpdateRegion.IsEmpty() )
 			{
+			updated = ETrue;
+			
 			TPoint deltaPos = aPos - iCommandBuffers[cb]->iPositionForUpdateRegion;
 			iCommandBuffers[cb]->iUpdateRegion.Offset(deltaPos);
 			iCommandBuffers[cb]->iPositionForUpdateRegion = aPos;
-			iCommandBuffers[cb]->ClearStatusFlags(EHuiCanvasBufferStatusAll);
-			iCommandBuffers[cb]->SetStatusFlags(EHuiCanvasBufferStatusNew);
 			}
+		
+		if (updated)
+		    {
+            // If one command buffer is drawn, then all following command
+            // buffers must be redrawn as well.
+            iCommandBuffers[cb]->ClearStatusFlags(EHuiCanvasBufferStatusAll);
+            iCommandBuffers[cb]->SetStatusFlags(EHuiCanvasBufferStatusNew);			
+            }
         }
-	}
+    }
 
 void CHuiCanvasWsPainter::SetMemoryLevel(THuiMemoryLevel /*aLevel*/)
     {
--- a/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goommemorymonitor.cpp	Fri May 14 02:41:21 2010 +0300
@@ -313,7 +313,7 @@
     {
     FUNC_LOG;
     // Build the list of memory freeing actions (by killing apps)
-    iGOomActionList->BuildKillAppActionListL(*iGOomWindowGroupList, *iConfig);
+    TRAP_IGNORE(iGOomActionList->BuildKillAppActionListL(*iGOomWindowGroupList, *iConfig));
     iGOomActionList->FreeMemory(aMaxPriority);
     }
 
--- a/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/goommonitor/src/goomwindowgrouplist.cpp	Fri May 14 02:41:21 2010 +0300
@@ -75,8 +75,9 @@
     iLowOnMemWgs.Reset();
     RArray<TInt> inactiveSurfaces;
 
-    User::LeaveIfError(iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces));    
-    User::LeaveIfError(iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs));
+    // ignore possible errors, we have information from profiling extension anyway
+    iAlfClient.GetListOfInactiveWindowGroupsWSurfaces(&inactiveSurfaces);    
+    iAlfClient.GetListOfWindowGroupsWSurfaces(&iLowOnMemWgs);
         
     TRACES1("Inactive surfaces count %d", inactiveSurfaces.Count());     
     TRACES1("Windowgroups w/ surfaces count %d", iLowOnMemWgs.Count());     
@@ -87,14 +88,16 @@
     
    //if (inactiveSurfaces.Count() == 1) // ALF only 
    //     {
-        NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
+    NOK_resource_profiling eglQueryProfilingData = (NOK_resource_profiling)eglGetProcAddress("eglQueryProfilingDataNOK");
     
-        if (!eglQueryProfilingData)
-            {
-            TRACES("RefreshL EGL_NOK_resource_profiling not available");
-			return;
-            }
+    if (!eglQueryProfilingData && inactiveSurfaces.Count() == 0)
+        {
+        TRACES("RefreshL EGL_NOK_resource_profiling not available");
+        return;
+        }
     
+    if (eglQueryProfilingData)
+        {
         EGLint data_count;
         EGLint* prof_data;
         TInt i(0);
@@ -202,7 +205,7 @@
                     }
                 }
             }
-     //   }
+        }
                 
     // Refresh window group list
     // get all window groups, with info about parents
--- a/uiacceltk/hitchcock/group/core_exports.inc	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/group/core_exports.inc	Fri May 14 02:41:21 2010 +0300
@@ -3,7 +3,7 @@
 *  Name        : core_exports.inc
 *  Part of     : Alfred UI Toolkit
 *  Description : Exported header files.
-*  Version     : %version: tr1sido#8.1.36 %
+*  Version     : %version: tr1sido#8.1.37 %
 *
 *  Copyright © 2006-2007 Nokia.  All rights reserved.
 *  This material, including documentation and any related computer
@@ -53,6 +53,7 @@
 ../coretoolkit/data/app_activate.fxml /epoc32/release/winscw/urel/z/resource/effects/app_activate.fxml
 ../coretoolkit/data/app_exit.fxml /epoc32/release/winscw/urel/z/resource/effects/app_exit.fxml
 ../coretoolkit/data/app_start.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start.fxml
+../coretoolkit/data/app_start_long.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start_long.fxml
 ../coretoolkit/data/app_start_rect.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start_rect.fxml
 ../coretoolkit/data/app_start_switch.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start_switch.fxml
 ../coretoolkit/data/app_start_switch_rect.fxml /epoc32/release/winscw/urel/z/resource/effects/app_start_switch_rect.fxml
@@ -145,6 +146,7 @@
 ../coretoolkit/data/app_activate.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_activate.fxml
 ../coretoolkit/data/app_exit.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_exit.fxml
 ../coretoolkit/data/app_start.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start.fxml
+../coretoolkit/data/app_start_long.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start_long.fxml
 ../coretoolkit/data/app_start_rect.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start_rect.fxml
 ../coretoolkit/data/app_start_switch.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start_switch.fxml
 ../coretoolkit/data/app_start_switch_rect.fxml /epoc32/release/winscw/udeb/z/resource/effects/app_start_switch_rect.fxml
@@ -237,6 +239,7 @@
 ../coretoolkit/data/app_activate.fxml /epoc32/data/z/resource/effects/app_activate.fxml
 ../coretoolkit/data/app_exit.fxml /epoc32/data/z/resource/effects/app_exit.fxml
 ../coretoolkit/data/app_start.fxml /epoc32/data/z/resource/effects/app_start.fxml
+../coretoolkit/data/app_start_long.fxml /epoc32/data/z/resource/effects/app_start_long.fxml
 ../coretoolkit/data/app_start_rect.fxml /epoc32/data/z/resource/effects/app_start_rect.fxml
 ../coretoolkit/data/app_start_switch.fxml /epoc32/data/z/resource/effects/app_start_switch.fxml
 ../coretoolkit/data/app_start_switch_rect.fxml /epoc32/data/z/resource/effects/app_start_switch_rect.fxml
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfdrawerengine.h	Fri May 14 02:41:21 2010 +0300
@@ -48,7 +48,7 @@
 	virtual void StartEndChecker() = 0;
 	virtual void CancelEndChecker() = 0;
 	virtual void SendBeginFullscreen() = 0;
-	virtual TInt SendEndFullscreen() = 0;
+	virtual TInt SendEndFullscreen(TBool aTimeout = EFalse) = 0;
 	virtual TInt SendAbortFullscreen() = 0;
 	virtual TInt SendAbortControlTransition() = 0;
     virtual	TInt SendBeginControlTransition() = 0;
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/inc/alfserverdrawer.h	Fri May 14 02:41:21 2010 +0300
@@ -69,7 +69,7 @@
     void BeginFullscreen( TInt aAction, const TRect& aEffectRect, 
 						TInt aType, const TUid aUid1, const TUid aUid2, TInt aData,
 						TSecureId aSid1, TInt aWg1, TSecureId aSid2, TInt aWg2);
-    void EndFullscreen();
+    void EndFullscreen(TBool aTimeout = EFalse);
     void CancelFullscreen();
     void AbortFullscreen();
     void RegisterAlfFullScreenEffect( TInt aAction, const TDesC& aResourceDir,
@@ -103,7 +103,7 @@
 
 	TInt SendBeginFullscreen(TInt aHandle, TUint aAction, const TUid& aUid, 
 							 const TUid& aPreviousUid, const TRect& aEffectRect);
-	TInt SendEndFullscreen();
+	TInt SendEndFullscreen(TBool aTimeout = EFalse);
 	TInt SendAbortFullscreen();
 	TInt SendAbortControlTransition();
 	void SendBeginFullscreen();
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfgfxeffects.cpp	Fri May 14 02:41:21 2010 +0300
@@ -48,6 +48,9 @@
 
 #include "wsserverdrawercontroller.h"
 
+#define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
+#include "alfmoduletest.h" 
+
 // Constants
 //const TInt KAlfDefaultFocusGainedEffectDuration = 500;
 //const TInt KAlfDefaultFocusLostEffectDuration = 500;
@@ -118,6 +121,13 @@
 	                                     KThemesTransitionEffects);
     
     iSyncronizedGroupDefitionEndChecker = CEndCheck::NewL(*this);
+    
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    // Initiliaze global data in TLS and Open global module testing chunk and mutex
+    User::LeaveIfError(Dll::SetTls(new(ELeave) CAlfModuleTestDataControl()));
+    User::LeaveIfError(AMT_CONTROL()->OpenGlobalObjects());
+#endif
+
     __ALFFXLOGSTRING("CAlfGfxEffects::ConstructL <<");
     }
 
@@ -191,6 +201,23 @@
 		        // We should not get end full screen if the effect has not been even started
 		        // (could return KErrAbort in aOutBuf)
 		        err = KErrAbort;
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+		        action = inStream.ReadUint32L();
+                TRect effectRect( inStream.ReadInt32L(),
+                    inStream.ReadInt32L(), inStream.ReadInt32L(), inStream.ReadInt32L() );
+                TInt type = inStream.ReadInt32L();
+                uid1 = TUid::Uid( inStream.ReadInt32L() );
+                uid2 = TUid::Uid( inStream.ReadInt32L() );
+                TInt data = inStream.ReadInt32L();
+                
+                if ( type == AknTransEffect::EParameterType )
+                    {
+                    sid1 = TSecureId( inStream.ReadInt32L() ); // secureid is the only thing interesting to us
+                    }
+                TTime time;
+                time.UniversalTime();
+                AMT_ADD_TIME(sid1.iId, time.Int64(), EFalse);
+#endif
 		        break;
 		        }
 		    else
@@ -223,7 +250,7 @@
 #ifdef _DEBUG    
     PrintRequestInfo( op, action);
 #endif    
-            iEngine->EndFullscreen();
+            iEngine->EndFullscreen(EFalse); // not timeout, but official endfullscreen
             break;
         case MAlfGfxEffectPlugin::EAbortFullscreen:
 #ifdef _DEBUG    
--- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Thu May 13 23:40:57 2010 +0300
+++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/alfserverdrawer.cpp	Fri May 14 02:41:21 2010 +0300
@@ -37,11 +37,16 @@
 #include <alflogger.h>
 #include <uiacceltk/HuiUtil.h>
 
+#define AMT_CONTROL() static_cast<CAlfModuleTestDataControl*>(Dll::Tls())
+#include "alfmoduletest.h" 
+
 // 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;
-const TInt KAlfLongEffectTimeout  = 5000000;
+const TInt KAlfShortEffectTimeout     = 4000000;
+const TInt KAlfAppStartEffectTimeout  = 300000;
+const TInt KAlfLongEffectTimeout      = 5000000;
 const TInt KAlfActiveControlFxGranularity = 4;
+const TInt KAlfLongApplicationStartContext = 20;
 
 //const TInt KAlfLongEffectTimeout  = 500000;
 // Timer to send finish full screen effect
@@ -63,6 +68,11 @@
         
         void DoCancel();
 
+    public:
+        
+        TBool iTimeoutTriggered;
+        TBool iIsStartEffect;
+        
     private:
 
         CAlfFinishTimer();
@@ -108,6 +118,7 @@
 void CAlfFinishTimer::Start( TTimeIntervalMicroSeconds32 aPeriod, TCallBack aTimeoutCallback )
     {
     iCallback = aTimeoutCallback; 
+    iTimeoutTriggered = EFalse;
     After( aPeriod );
     }
 
@@ -118,6 +129,7 @@
     //
     if ( iStatus.Int() != KErrCancel )
         {
+        iTimeoutTriggered = ETrue;
         iCallback.CallBack();
         }
     }
@@ -266,6 +278,10 @@
     delete iFinishFullScreen;
     delete iFullScreenTimeout;
     iActiveControlFx.Close();
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    delete AMT_CONTROL();
+    Dll::FreeTls();
+#endif
     }
 
 // ---------------------------------------------------------------------------
@@ -501,11 +517,11 @@
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //
-void CAlfServerDrawer::EndFullscreen()
+void CAlfServerDrawer::EndFullscreen(TBool aTimeout)
     {
     __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen >>");
     CancelEndChecker();
-    iFullScreenController->EndFullscreen(EFalse);
+    iFullScreenController->EndFullscreen(aTimeout);
     iFullScreenController->AppInfoCache().ClearActions();
     __ALFFXLOGSTRING("CAlfServerDrawer::EndFullscreen <<");
     }
@@ -550,6 +566,11 @@
 //  
 void CAlfServerDrawer::DoSendBeginFullscreenL()
     {
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+    TTime time;
+    time.UniversalTime();
+    AMT_ADD_TIME(iToSid.iId, time.Int64(), ETrue);
+#endif    
     __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendBeginFullscreen");
     __ALFFXLOGSTRING(" <- Original window server ids");
     __ALFFXLOGSTRING2("From UID: 0x%X, To UID: 0x%X", iFromUid.iUid, iToUid.iUid);    
@@ -666,6 +687,7 @@
         stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen );
         stream.WriteInt32L(  iToSid.iId ); //iCurrentFullScreenHandle );
         stream.WriteInt32L( iType );
+        stream.WriteInt32L( 0 ); // timeout triggered
       	if ( iType == AknTransEffect::EParameterType && isExit )
       	    {
             stream.WriteInt32L( iToWg );
@@ -679,8 +701,6 @@
             stream.WriteInt32L( iToSid.iId );
             stream.WriteInt32L( iFromSid.iId );
                         
-            stream.WriteInt32L( KErrNotFound ); //  was iToScreen, obsolete
-            stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete
        	    }
        	else if ( iType == AknTransEffect::EParameterType )
        	    {
@@ -695,19 +715,22 @@
             stream.WriteInt32L( iToSid.iId );
             stream.WriteInt32L( iFromSid.iId );
                         
-            stream.WriteInt32L( KErrNotFound );  // was iToScreen, obsolete
-            stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete
             }
         else
             {
-            stream.WriteInt32L( KErrNotFound); // was iFocusWg 
-            stream.WriteInt32L( KErrNotFound); // was iFocusWg 
+            stream.WriteInt32L( KErrNotFound);  // dummy BEGIN
+            stream.WriteInt32L( KErrNotFound);  
+            stream.WriteInt32L( KErrNotFound);  
+            stream.WriteInt32L( KErrNotFound); 
+            stream.WriteInt32L( KErrNotFound);  
+            stream.WriteInt32L( KErrNotFound);  // dummy END
             }
         stream.WriteInt32L( iFlags );
         stream.WriteInt32L( iEffectRect.iTl.iX );
         stream.WriteInt32L( iEffectRect.iTl.iY );
         stream.WriteInt32L( iEffectRect.iBr.iX );
         stream.WriteInt32L( iEffectRect.iBr.iY );
+        
         stream << resourceDir;
         stream << fileName;    
         stream.CommitL();
@@ -725,13 +748,14 @@
     // iFlags and iAction will contain some extra information that can be used to control the effect:
     
     // All of these actions may not produce effects, they are here for now for debugging.
-    
+    TBool isAppStartEffect(EFalse);
     switch ( iAction )
         {
         case AknTransEffect::EApplicationActivate:
             __ALFFXLOGSTRING("EApplicationActivate - 1");
             break;
         case AknTransEffect::EApplicationStart:
+            isAppStartEffect = ETrue;
             __ALFFXLOGSTRING("EApplicationStart - 3");
             break;
         case AknTransEffect::EEmbeddedApplicationStart:
@@ -741,12 +765,15 @@
             __ALFFXLOGSTRING("EApplicationExit - 5");
             break;
         case AknTransEffect::EApplicationStartRect:
+            isAppStartEffect = ETrue;
             __ALFFXLOGSTRING("EApplicationStartRect - 6");
             break;
         case AknTransEffect::EApplicationStartSwitch:
+            isAppStartEffect = ETrue;
             __ALFFXLOGSTRING("EApplicationStartSwitch - 7");
             break;
         case AknTransEffect::EApplicationStartSwitchRect:
+            isAppStartEffect = ETrue;
             __ALFFXLOGSTRING("EApplicationStartSwitchRect - 8");
             break;
         case AknTransEffect::EEmbeddedApplicationExit:
@@ -783,15 +810,27 @@
     // It appears that folder open and close never send endfullscreen, so for them the effect
     // must be started as soon as we get beginfullscreen
     
-    iFullScreenTimeout->Start( KAlfLongEffectTimeout, TCallBack( FullScreenTimeout, this ) );
+    isAppStartEffect = EFalse; // disable different timeout effect for appstart effects
+	
+    if (isAppStartEffect)
+        {
+		// The shorter timeout can be disabled here!
+        iFullScreenTimeout->Start( KAlfAppStartEffectTimeout, TCallBack( FullScreenTimeout, this ) );
+        iFullScreenTimeout->iIsStartEffect = ETrue;
+        }
+    else
+        {
+        iFullScreenTimeout->Start( KAlfLongEffectTimeout, TCallBack( FullScreenTimeout, this ) );
+        iFullScreenTimeout->iIsStartEffect = EFalse;
+        }
     }
     
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 //	
-TInt CAlfServerDrawer::SendEndFullscreen()
+TInt CAlfServerDrawer::SendEndFullscreen(TBool aTimeout)
     {
-    __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen");
+    __ALFFXLOGSTRING3("CAlfServerDrawer::SendEndFullscreen - Timeout: %d, iFullScreenEndSent: %d, IsStartEffect: %d", aTimeout, iFullScreenEndSent, iFullScreenTimeout->iIsStartEffect);
     
     if ( iFullScreenEndSent )
         {
@@ -804,19 +843,13 @@
     iFullScreenTransitionEndObserver->Cancel();
     iFullScreenTimeout->Cancel();
     iFinishFullScreen->Cancel();
-	/*
-    TUint action = iAction;   
-    if ( iType == AknTransEffect::EParameterAvkonInternal )
-        {
-        action = iOldAction;
-        }
-    */
-    // TEMPORARY HACK
-    // REMOVE AFTER APPSHELL HAS BEEN FIXED
-    //iDoNotClearEffectRect = EFalse;
+    TBool triggerStartEffectTimeout= iFullScreenTimeout->iTimeoutTriggered && iFullScreenTimeout->iIsStartEffect;
+    iFullScreenTimeout->iTimeoutTriggered = EFalse;
+    iFullScreenTimeout->iIsStartEffect = EFalse;
     
-    // This is where the second part of the effect should start
-    // The new window should already have something on the screen
+     // This is where the second part of the effect should start
+    // The new window should already have something on the screen.
+	// It might not be the case, if aTimeout is ETrue 
     
     // Send the data to CAlfAppUI via bridge
     
@@ -826,13 +859,27 @@
     
 	TPtrC resourceDir;
 	TPtrC fileName;
+	TInt cachePriority = 0;
+    TInt wantedTime = 0;
+    TInt minTime = 0;
 
+	if (triggerStartEffectTimeout)
+	    {
+        // if the following fails, then the effect from beginfullscreen will be used.
+        TInt err = iPolicyHandler.GetFullscreenKml( KAlfLongApplicationStartContext, iToUid, iFromUid, resourceDir, fileName,
+        cachePriority, wantedTime, minTime );
+		if (err != KErrNone)
+			{
+			triggerStartEffectTimeout = EFalse;
+			}
+	    }
+	
     // We must make a stream of the data as the length may vary.
     // At the moment we only send some numbers, but we should probably include
     // also the effect file name or something else to identify the effect 
     // that is going to be used
     
-    TInt bufferSize = 11 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect
+    TInt bufferSize = 12 * sizeof(TInt); // operation, type, 2 wg ids, 2 app uids, flags and rect, timeoutTriggered
     bufferSize += sizeof(TPtrC);
     bufferSize += resourceDir.Length() * 2;
     bufferSize += sizeof(TPtrC);
@@ -856,29 +903,23 @@
             stream.WriteInt32L( MAlfGfxEffectPlugin::EEndFullscreen );
             stream.WriteInt32L( iCurrentFullScreenHandle );
             stream.WriteInt32L( iType );
-
+            stream.WriteInt32L( triggerStartEffectTimeout );
             stream.WriteInt32L( iToWg );
             stream.WriteInt32L( iFromWg );
 
             // AppUid for the future. alfbridge can figure out the windog groups based on that
             stream.WriteInt32L( iToUid.iUid );
             stream.WriteInt32L( iFromUid.iUid );
+            
+            stream.WriteInt32L( iToSid.iId );
+            stream.WriteInt32L( iFromSid.iId );
 
-            if ( iType == AknTransEffect::EParameterType )
-                {
-                stream.WriteInt32L( iToScreen );
-                stream.WriteInt32L( iFromScreen );
-                }
-            /*else
-                {
-                //stream.WriteInt32L( iFocusWg );
-                //stream.WriteInt32L( iFocusWg );
-//              }*/
             stream.WriteInt32L( iFlags ); 
             stream.WriteInt32L( iEffectRect.iTl.iX );
             stream.WriteInt32L( iEffectRect.iTl.iY );
             stream.WriteInt32L( iEffectRect.iBr.iX );
             stream.WriteInt32L( iEffectRect.iBr.iY );
+            
             stream << resourceDir;
             stream << fileName;    
             stream.CommitL();    
@@ -892,6 +933,7 @@
         }
 
     iFullScreenFinished = EFalse;
+    iFullScreenTimeout->iIsStartEffect = EFalse;
     if ( iAction == AknTransEffect::EApplicationExit /*||
         iAction == 1001*/  ) 
         {
@@ -987,6 +1029,11 @@
 	TPtrC actionString;
 	
 	TInt err = KErrNone;
+#ifdef USE_MODULE_TEST_HOOKS_FOR_ALF
+	TTime time;
+    time.UniversalTime();
+    AMT_ADD_TIME(iControlHandle, time.Int64(), ETrue);
+#endif    
 	err = iPolicyHandler.GetControlKml( iControlUid, iControlAction, resourceDir,
 	    fileName, actionString, cachePriority, wantedTime, minTime );