# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268649817 -7200 # Node ID 10534483575fc7be1a74e9a359f04d579b74b327 # Parent 433cbbb6a04b9786f562cd122d72a3c731e4cf27 Revision: 201010 Kit: 201010 diff -r 433cbbb6a04b -r 10534483575f rom/alfred.iby --- a/rom/alfred.iby Fri Mar 12 15:47:04 2010 +0200 +++ b/rom/alfred.iby Mon Mar 15 12:43:37 2010 +0200 @@ -81,13 +81,18 @@ // Effect fxmls. Keep the list in alphabetical order. When updating the list below, REMEMBER TO ALSO UPDATE core_exports.inc! data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_add_page.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_add_page.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_appear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_bg_appear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_editmode.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_editmode.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_widgetmanager.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_close_widgetmanager.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left_appear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left_appear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left_disappear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_left_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_open_editmode.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_open_editmode.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_open_widgetmanager.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_open_widgetmanager.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_remove_page.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_remove_page.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right_appear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right_appear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right_disappear.fxml RESOURCE_FILES_DIR/effects/activeidle_viewswitch_right_disappear.fxml 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 @@ -97,7 +102,11 @@ data=DATAZ_/RESOURCE_FILES_DIR/effects/appshell_exit.fxml RESOURCE_FILES_DIR/effects/appshell_exit.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/confirmationnote_appear.fxml RESOURCE_FILES_DIR/effects/confirmationnote_appear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/confirmationnote_disappear.fxml RESOURCE_FILES_DIR/effects/confirmationnote_disappear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/contextmenu_appear.fxml RESOURCE_FILES_DIR/effects/contextmenu_appear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/contextmenu_disappear.fxml RESOURCE_FILES_DIR/effects/contextmenu_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/dialer_close.fxml RESOURCE_FILES_DIR/effects/dialer_close.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/dialer_list_appear.fxml RESOURCE_FILES_DIR/effects/dialer_list_appear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/dialer_list_disappear.fxml RESOURCE_FILES_DIR/effects/dialer_list_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/dialer_open.fxml RESOURCE_FILES_DIR/effects/dialer_open.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/discreet_popup_appear.fxml RESOURCE_FILES_DIR/effects/discreet_popup_appear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/discreet_popup_disappear.fxml RESOURCE_FILES_DIR/effects/discreet_popup_disappear.fxml @@ -143,6 +152,12 @@ data=DATAZ_/RESOURCE_FILES_DIR/effects/toolbar_ext_disappear.fxml RESOURCE_FILES_DIR/effects/toolbar_ext_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/touchinput_close.fxml RESOURCE_FILES_DIR/effects/touchinput_close.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/touchinput_open.fxml RESOURCE_FILES_DIR/effects/touchinput_open.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left.fxml RESOURCE_FILES_DIR/effects/viewswitch_left.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left_appear.fxml RESOURCE_FILES_DIR/effects/viewswitch_left_appear2.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_left_disappear.fxml RESOURCE_FILES_DIR/effects/viewswitch_left_disappear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_right.fxml RESOURCE_FILES_DIR/effects/viewswitch_right.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_right_appear.fxml RESOURCE_FILES_DIR/effects/viewswitch_right_appear.fxml +data=DATAZ_/RESOURCE_FILES_DIR/effects/viewswitch_right_disappear.fxml RESOURCE_FILES_DIR/effects/viewswitch_right_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/waitnote_appear.fxml RESOURCE_FILES_DIR/effects/waitnote_appear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/waitnote_disappear.fxml RESOURCE_FILES_DIR/effects/waitnote_disappear.fxml data=DATAZ_/RESOURCE_FILES_DIR/effects/warningnote_appear.fxml RESOURCE_FILES_DIR/effects/warningnote_appear.fxml diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h --- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappserver.h Mon Mar 15 12:43:37 2010 +0200 @@ -260,6 +260,9 @@ */ CAlfAppSrvSessionBase* UpMostClientAboveWg( TInt aWgId ); + + CAlfAppSrvSessionBase* SrvSessionForControlGroup(CHuiControlGroup& aGroup); + public: CAlfAppSrvSessionBase* iOldSession; diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h --- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfappui.h Mon Mar 15 12:43:37 2010 +0200 @@ -196,8 +196,13 @@ void SetAlfWindowGroupId(TInt aWgId); void NotifyLowMemory(TInt aAmountOfFreeMemRequested); TInt ForceSwRendering(TBool aEnabled); + TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation); + TInt ReadPixels(CFbsBitmap* aBitmap); void SetAlfAppWindowGroup( TInt aID ); + CAlfAppSrvSessionBase* SrvSessionForControlGroup(CHuiControlGroup& aGroup); + void DoBlankScreen(const RMessage2& aMessage); + private: void CreateHuiEnvL(); diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_client_server_api/inc/alf/alfdirectclient.h --- a/uiaccelerator_plat/alf_client_server_api/inc/alf/alfdirectclient.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_client_server_api/inc/alf/alfdirectclient.h Mon Mar 15 12:43:37 2010 +0200 @@ -69,6 +69,30 @@ */ IMPORT_C TInt ForceSwRendering( TBool aEnabled ); + /** + * Gets display size and virtual rotation. + * @param aSize this will contain size. + * @param aRotation this will contain rotation. + * @return error code, KErrNone upon success. + * @internal + */ + TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation); + + /** + * Reads pixels from surface to bitmap. + * @param aBitmapHandle bitmap handle. + * @return error code, KErrNone upon success. + * @internal + */ + TInt ReadPixels(TInt aBitmapHandle); + + /** + * NGA Substitute for Avkon screen blanker. + * Only AknCapserver can use this method (protected using SID) + * Does not reference count, i.e. all calls are absolute + * @return error code. + */ + IMPORT_C TInt BlankScreen( TBool aEnabled ); }; #endif diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiCanvasVisual.h Mon Mar 15 12:43:37 2010 +0200 @@ -104,7 +104,13 @@ /** Effect is excluded from parent (or grandparent) effect (if it has effect which is applied to children) */ EHuiCanvasFlagExcludeFromParentEffect = 0x80, /** Hint flag which is used for optimizations. Tells if fade effect(s) exist in visual tree */ - EHuiCanvasFlagExternalFadeExistsInsideVisualTree = 0x100 + EHuiCanvasFlagExternalFadeExistsInsideVisualTree = 0x100, + /** Flag to indicate whether to include this visual to visibility calculation */ + EHuiCanvasFlagIncludeToVisibilityCalculation = 0x200, + /** Flag to indicate whether surface is invisible (based on visibility calculation) */ + EHuiCanvasFlagSurfaceInvisible = 0x400, + /** Flag to indicate whether surface is visible (based on visibility calculation) */ + EHuiCanvasFlagSurfaceVisible = 0x800 }; /** @@ -352,6 +358,26 @@ IMPORT_C TRect& LayerExtent(); IMPORT_C void SetLayerExtent(TRect& aExtent); + // window area +public: + + /** + * Sets shape. This affects only visible area calculation. + */ + IMPORT_C void SetShape(const TPoint& aOrigin, const TRegion& aRegion); + /** + * Returns true if shape is different than display rect. + */ + IMPORT_C TBool HasCustomShape() const; + /** + * Returns origin of window shape. + */ + IMPORT_C TPoint ShapeOrigin() const; + /** + * Returns shape as region. + */ + IMPORT_C const TRegion& ShapeRegion() const; + public: void SetSize(const THuiRealSize& aSize, TInt aTransitionTime=0); @@ -402,6 +428,7 @@ void DrawStoredVisualRenderBuffer(TInt aCanvasDrawMode) const; void DrawStoredFullScreenRenderBuffer(TInt aCanvasDrawMode, CHuiGc& aGc) const; IMPORT_C void FreeRenderBuffer(); + IMPORT_C TRect CommandBufferCoverage(TInt aOrientation); protected: virtual void VisualExtension(const TUid& aExtensionUid, TAny** aExtensionParams); diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiDisplay.h Mon Mar 15 12:43:37 2010 +0200 @@ -790,6 +790,14 @@ IMPORT_C CHuiTexture* ForegroundTexture() const; /** + * Sets foreground texture / bitmap options. + * @param aBlendRequired ETrue if texture should be blend, EFalse if copy + * is sufficient. + * @internal + */ + IMPORT_C void SetForegroundTextureOptions(TBool aBlendRequired); + + /** * Sets bitmap which is drawn on top of the frame * (when used with @c SetForegroundTexture). * @@ -805,6 +813,10 @@ */ IMPORT_C CFbsBitmap* ForegroundBitmap() const; + /** + * Copy raw screen data to bitmap. + */ + IMPORT_C void CopyScreenToBitmapL(CFbsBitmap* aBitmap); private: @@ -1007,6 +1019,8 @@ CFbsBitmapDevice* iForegroundBitmapDevice; /** Graphics context for foreground bitmap */ CFbsBitGc* iForegroundBitmapGc; + /** ETrue if foreground texture should be blend, EFalse otherwise */ + TBool iForegroundTextureTransparency; }; #endif // __HUIDISPLAY_H__ diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiEnv.h Mon Mar 15 12:43:37 2010 +0200 @@ -1004,6 +1004,7 @@ IMPORT_C THuiMemoryLevel MemoryLevel(); void DoSynchronize(); + TBool iPauseDrawing; private: MHuiSynchronizationObserver* iSynchObserver; TInt iSynchId; diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiGc.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiGc.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiGc.h Mon Mar 15 12:43:37 2010 +0200 @@ -933,6 +933,16 @@ */ IMPORT_C void NotifyImagePreferredSize(const THuiImage& aImage, THuiRealRect aRect); +public: + + /** + * Copy screen to bitmap. + * @internal + * @param aBitmap bitmap to which data should be copied. + * @return error code, KErrNone upon success. + */ + TInt CopyScreenToBitmap(CFbsBitmap* aBitmap); + protected: /* Constructors. */ diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiS60Skin.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiS60Skin.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/HuiS60Skin.h Mon Mar 15 12:43:37 2010 +0200 @@ -146,6 +146,9 @@ */ void UpdateBackgroundL(); +private: + + void FreeAllBackgroundTextureResources(); private: @@ -163,7 +166,6 @@ /** Background should be reloaded the next time it is needed. */ TBool iReloadBackground; - TBool iSkinChanged; class CSkinItem : public CBase { diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/huigifanimationtexture.h --- a/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/huigifanimationtexture.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_core_toolkit_api/inc/uiacceltk/huigifanimationtexture.h Mon Mar 15 12:43:37 2010 +0200 @@ -70,6 +70,7 @@ TInt iId; TReal32 iElapsedTime; TInt iAnimatedTextureGroupId; + TBool iOriginalFileInUse; }; diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_extension_api/inc/alf/alfconstants.h --- a/uiaccelerator_plat/alf_extension_api/inc/alf/alfconstants.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_extension_api/inc/alf/alfconstants.h Mon Mar 15 12:43:37 2010 +0200 @@ -538,6 +538,9 @@ EAlfEnableLowMemoryState = 4300, EAlfForceSwRendering, + EAlfBlankScreen, + EAlfGetSizeAndRotation, + EAlfReadPixels, EAlfLastReservedOpCmd = 10000 }; diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionclient.h --- a/uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionclient.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionclient.h Mon Mar 15 12:43:37 2010 +0200 @@ -34,7 +34,8 @@ virtual void LowOnGraphicsMemory()=0; virtual void GraphicsMemoryGood(){} - virtual void AlfBridgeCallback(TInt, TAny*){}; + virtual void AlfBridgeCallback(TInt, TAny*){} + virtual void HideTarget(TInt,TBool){}; }; /** Wrapper class IPC <-> MAlfCompositionController **/ diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_visual_api/inc/alf/alfdrawer.h --- a/uiaccelerator_plat/alf_visual_api/inc/alf/alfdrawer.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_visual_api/inc/alf/alfdrawer.h Mon Mar 15 12:43:37 2010 +0200 @@ -19,6 +19,9 @@ #include +class CWsScreenDevice; +class CFbsBitmap; + /** * This provides additional alf drawing synchronization. * @@ -47,6 +50,21 @@ */ IMPORT_C TInt Finish(); + /** + * Fallback copy screen to bitmap. This copies pixels from UI surface. + * This is similar to @c CWsScreenDevice::CopyScreenToBitmap. That method + * may use GPU memory and so cannot be guaranteed to succeed always. + * + * @param aDevice screendevice. + * @param aBitmap bitmap to which pixels ought to be copied. + * @param aRect rect to copy. + * @return error code. + */ + IMPORT_C static TInt FallbackCopyScreenToBitmap( + CWsScreenDevice& aDevice, + CFbsBitmap* aBitmap, + const TRect& aRect); + private: CAlfDrawer(); void ConstructL(); diff -r 433cbbb6a04b -r 10534483575f uiaccelerator_plat/alf_visual_api/inc/goommonitor/goommonitorplugin.hrh --- a/uiaccelerator_plat/alf_visual_api/inc/goommonitor/goommonitorplugin.hrh Fri Mar 12 15:47:04 2010 +0200 +++ b/uiaccelerator_plat/alf_visual_api/inc/goommonitor/goommonitorplugin.hrh Mon Mar 15 12:43:37 2010 +0200 @@ -25,4 +25,8 @@ // Extension interface "uids" #define KGoomClientSecureId 0x1000 +// Goom Events through Window Server +#define KGoomMemoryLowEvent 0x10282DBF +#define KGoomMemoryGoodEvent 0x20026790 + #endif // GOOMMONITORPLUGIN_HRH diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def --- a/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/AlfDecoderServerClient/bwins/alfdecoderserverclientu.def Mon Mar 15 12:43:37 2010 +0200 @@ -40,4 +40,5 @@ ?SendEvent@CAlfCompositionClientBase@@IAEHHPBXH@Z @ 39 NONAME ; int CAlfCompositionClientBase::SendEvent(int, void const *, int) ??1CAlfCompositionCntrlClient@@UAE@XZ @ 40 NONAME ; CAlfCompositionCntrlClient::~CAlfCompositionCntrlClient(void) ?SetSourceRect@CAlfCompositionSource@@UAEHABVTRect@@@Z @ 41 NONAME ; int CAlfCompositionSource::SetSourceRect(class TRect const &) + ?GetListOfInactiveWindowGroupsWSurfaces@RAlfBridgerClient@@QAEHPAV?$RArray@H@@@Z @ 42 NONAME ; int RAlfBridgerClient::GetListOfInactiveWindowGroupsWSurfaces(class RArray *) diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def --- a/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/AlfDecoderServerClient/eabi/alfdecoderserverclientu.def Mon Mar 15 12:43:37 2010 +0200 @@ -61,4 +61,5 @@ _ZN26CAlfCompositionCntrlClientD2Ev @ 60 NONAME _ZN21CAlfCompositionSource13SetSourceRectERK5TRect @ 61 NONAME _ZThn32_N21CAlfCompositionSource13SetSourceRectERK5TRect @ 62 NONAME + _ZN17RAlfBridgerClient38GetListOfInactiveWindowGroupsWSurfacesEP6RArrayIiE @ 63 NONAME diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp --- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfcompositionclient.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -386,7 +386,18 @@ iController->DeleteTarget(target); break; } - + + case KAlfCompositionTargetVisible: + { + iController->HideTarget(target, EFalse); + break; + } + + case KAlfCompositionTargetHidden: + { + iController->HideTarget(target, ETrue); + break; + } default: break; } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp --- a/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/AlfDecoderServerClient/src/alfdecoderserverclient.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -147,6 +147,30 @@ SendReceive(aOp, aIPCArgs, aStatus ); } + +EXPORT_C TInt RAlfBridgerClient::GetListOfInactiveWindowGroupsWSurfaces(RArray* aWindowGroups) + { + TInt err = KErrNone; + TInt array[10]; + TPtr8 ptr((TUint8*)array,0,40); + err = SendReceive(EAlfGetListOfWGsHavingInactiveSurfaces, TIpcArgs(&ptr)); + if (!err) + { + for(TInt i = 0; i < 10; i++) + { + if (array[i]) + { + aWindowGroups->Append(array[i]); + } + else + { + break; + } + } + } + return err; + } + // Open // --------------------------------------------------------------------------- // diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/AlfRenderStage/inc/alfrssendbuffer.h --- a/uiacceltk/hitchcock/AlfRenderStage/inc/alfrssendbuffer.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/AlfRenderStage/inc/alfrssendbuffer.h Mon Mar 15 12:43:37 2010 +0200 @@ -18,6 +18,8 @@ #ifndef CALFSENDBUFFER_H_ #define CALFSENDBUFFER_H_ +//#define RD_SUBWINDOW_EFFECTS + #include #include #include @@ -119,6 +121,19 @@ void WriteRegionL( const TUint8& aCommand, const TRegion& aRegion ); /** + * Writes ints followed by region. + * + * Convenience function for writing region to the stream + * + * @param aCommand CommandId + * @param aRegion Region + * @param aCount Amount of TInt values to be streamed + * @param aFirst The first value + * @param ... variable aCount-1 amount of TInt values + */ + void WriteRegionIntsL( const TUint8& aCommand, const TRegion& aRegion, TInt aCount, TRefByValue aFirst, ...); + + /** * WriteDescriptorAndIntsL * * Convenience function for writing TDesC reference and TInt values to the stream. @@ -187,13 +202,15 @@ * @param aPoWriteIntList Point array to be streamed */ void WritePointArrayL( const TUint8& aCommand, const TArray* aPoWriteIntList ); - + /** - * WriteFlagsL + * SetOrientation * - * Write flags to the stream - */ - void WriteFlagsL(); + * Set orientation. All drawing buffers will be tagged with the current orientation. + * + * @param aOrientatation New orientation + */ + void SetOrientation(TInt aOrientation); // // ARRAY IMPLEMENTATION @@ -206,7 +223,7 @@ TRect iBoundingRectangle; }; - +#ifdef RD_SUBWINDOW_EFFECTS void WriteArrayHeaderTemplateL(); void InitTOffsetElemArray(RArray &aOffset); void WriteArrayHeaderL(const TOffsetElem &aIndexArrayOffset); @@ -216,6 +233,7 @@ void EndMarkerL(RArray &aOffset, TInt &aMarker, const TRect &aRectangle, TInt aLayerId); void StartMarkerL(TRect aBoundingRectangle, TInt aLayerId); void EndMarkerL(); +#endif // RD_SUBWINDOW_EFFECTS /** * SendL @@ -789,6 +807,7 @@ CAlfCompositionCntrlClient* iAlfCompositionCntrlClient; // array implementation +#ifdef RD_SUBWINDOW_EFFECTS RArray iOffsetArray; TInt iMarker; TRect iBoundingRectangle; @@ -797,5 +816,7 @@ TInt iPreviousBlockOffset; TInt iExtraLayerId; TBool iLayersEnabled; +#endif + TInt iOrientation; }; #endif /*CALFSENDBUFFER_H_*/ diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp --- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrenderstage.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -593,7 +593,7 @@ AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); AMT_INC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup, iRsWindowGroupNodeCount ); - AMT_INC_COUNTER(iRsWindowGroupNodeCount ); + AMT_INC_COUNTER(iRsTotalNodeCount ); } // --------------------------------------------------------------------------- @@ -636,7 +636,7 @@ AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeClient, iRsWindowNodeCount ); AMT_DEC_COUNTER_IF(nodeType==MWsWindowTreeNode::EWinTreeNodeGroup, iRsWindowGroupNodeCount ); - AMT_DEC_COUNTER(iRsWindowGroupNodeCount ); + AMT_DEC_COUNTER(iRsTotalNodeCount ); } // --------------------------------------------------------------------------- @@ -695,6 +695,12 @@ AMT_INC_COUNTER( iRsNodeExtentChangedCount ); AMT_SET_VALUE( iRsLatestNodeExtentRect, aRect ); + AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ), + iSizeMap, aWindowTreeNode.Window()->Handle(), + aRect.Size(), EAlfModuleTestTypeRenderStageChangeSize ); + AMT_MAP_SET_VALUE_IF( ( aWindowTreeNode.Window() ), + iPositionMap, aWindowTreeNode.Window()->Handle(), + aRect.iTl, EAlfModuleTestTypeRenderStageChangePosition ); } // --------------------------------------------------------------------------- @@ -729,14 +735,52 @@ iAlfSendBuffer->CommitL(); AMT_INC_COUNTER( iRsTotalNodeFlagChangedCount ); + AMT_MAP_INC_VALUE_IF( ( aWindowTreeNode.Window() ), + iIntMap, aWindowTreeNode.Window()->Handle(), + EAlfModuleTestTypeRenderStageChangeFlag ); } // --------------------------------------------------------------------------- // AttributeChanged // --------------------------------------------------------------------------- // -void CAlfRenderStage::AttributeChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aAttribute ) +void CAlfRenderStage::AttributeChanged(const MWsWindowTreeNode& aWindowTreeNode, TInt aAttribute) { + if ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeClient && + aWindowTreeNode.Window() != NULL ) + { + TInt32 nodeId = (TInt32)&aWindowTreeNode; + + switch ( aAttribute ) + { + case MWsWindowTreeObserver::EWindowShape: + { + TPoint origin( aWindowTreeNode.Window()->AbsRect().iTl ); + + if ( aWindowTreeNode.Window()->WindowArea().Count() ) + { + iAlfSendBuffer->WriteRegionIntsL( + EAlfNodeSetWindowArea, + aWindowTreeNode.Window()->WindowArea(), + 3, + nodeId, + origin.iX, + origin.iY ); + } + else + { + iAlfSendBuffer->WriteIntsL( EAlfNodeSetWindowArea, 4, nodeId, 0, 0, 0 ); // no region + } + + iAlfSendBuffer->CommitL(); + } + break; + + default: + break; + } + } + if ( aWindowTreeNode.NodeType() == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor ) { TInt32 nodeId = (TInt32)&aWindowTreeNode; @@ -1059,7 +1103,9 @@ } case CAlfHintGraphic::EAlfEndSubWindow: { +#ifdef RD_SUBWINDOW_EFFECTS iAlfSendBuffer->EndMarkerL(); +#endif break; } @@ -1076,7 +1122,9 @@ { case CAlfHintGraphic::EAlfBeginSubWindow: { +#ifdef RD_SUBWINDOW_EFFECTS iAlfSendBuffer->StartMarkerL(aBoundingRectangle, aLayerId); +#endif break; } } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/AlfRenderStage/src/alfrssendbuffer.cpp --- a/uiacceltk/hitchcock/AlfRenderStage/src/alfrssendbuffer.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/AlfRenderStage/src/alfrssendbuffer.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -48,12 +48,17 @@ const TInt KCacheChunkMinSize = 50000; const TUint8 KDivisibleByX = 8; const TInt KWindowFrameHeader1 = 6; // bytes -const TInt KWindowFrameHeader2 = 18 + 10; // bytes // TP +10 +#ifdef RD_SUBWINDOW_EFFECTS +const TInt KWindowFrameHeader2 = 23 + 10; // bytes // TP +10 +#else +const TInt KWindowFrameHeader2 = 23; +#endif const TInt KAllRenderersMask = 63; const TInt KPossiblePerformanceProblemInWindow = 64; const TInt KPossiblePerformanceProblemInWindowThreshold = 1000; +const TInt KFlushBufferTimeout = 50*1000; // 50ms enum TPatternSearchStates { @@ -442,23 +447,6 @@ } // --------------------------------------------------------------------------- -// WriteFlagsL -// --------------------------------------------------------------------------- -// -void CAlfRsSendBuffer::WriteFlagsL( ) - { - if (iDisabled) // return if this send buffer is not in use - { - return; - } - - // space has been reserved for us - WriteInt8L( EAlfFrameFlags ); - WriteInt32L( iFlags); - WriteInt8L( EAlfCommandEndMarker ); - } - -// --------------------------------------------------------------------------- // WriteCommandL // writes 1 TInt value to the stream // --------------------------------------------------------------------------- @@ -666,6 +654,49 @@ } // --------------------------------------------------------------------------- +// WriteRegionIntsL +// --------------------------------------------------------------------------- +// +void CAlfRsSendBuffer::WriteRegionIntsL( const TUint8& aCommand, const TRegion& aRegion, + TInt aCount, TRefByValue aFirst, ...) + { + if (iDisabled) // return if this send buffer is not in use + { + return; + } + + TInt count = aRegion.Count(); + const TInt size = sizeof(TInt32) * ( 4 * count + 1 + aCount); + + if (! InitCommandL( aCommand, size )){ return;} +#ifdef _ALF_PRINT_WS_COMMANDS_ + iCommandDebugger->SetDescriptionAndSize( aCommand, size, R_ALF_COMMAND_DESCRIPTION_ARRAY ); + iCommandDebugger->SetRegion( aRegion ); + iCommandDebugger->Print(); +#endif + + if ( aCount > 0 ) + { + aCount--; // first item is serialized separately. It seems to exist at different location as rest of the parameters. + WriteInt32L( aFirst ); + WriteL( (TUint8*)&aFirst + sizeof(TInt32), aCount * sizeof(TInt32) ); + } + + WriteInt32L( count ); + TInt i = 0; + while( i < count ) + { + WriteL( (TUint8*)&aRegion[i].iTl.iX, 4 * sizeof(TInt32 )); + i++; + } + + if ( !iReceivingDrawingCommands ) + { + WriteInt8L( EAlfCommandEndMarker ); + } + } + +// --------------------------------------------------------------------------- // WriteDescriptorAndIntsL // writes aCount amount of variables to the stream and updates stream index. // --------------------------------------------------------------------------- @@ -973,6 +1004,7 @@ TInt size = sizeof(TUint32) + // windowId sizeof(TUint32) + // next frame offset 3 * sizeof(TUint8) + // command + contains unsupported commands + end marker + sizeof(TUint8) + sizeof(TUint32) + // orientation sizeof(TUint8) + // screen number ( in WriteFollowingFrameOffsetTemplate) sizeof(TUint32) * ( 4 * aRegionSize + 1 ) + // updateregion sizeof(TUint8) * KDivisibleByX + // possible padding @@ -1037,12 +1069,19 @@ { WriteInt8L( 0 ); } +#ifdef RD_SUBWINDOW_EFFECTS iArrayImplOffset = iOffset; InitMarker(iMarker); +#endif WriteInt8L( EAlfFrameContainsUnsupportedCommands ); WriteInt8L( 0 ); + WriteInt8L( EAlfFrameOrientation ); + WriteInt32L( iOrientation ); + // These are for subwindow effects, that are not currently enabled +#ifdef RD_SUBWINDOW_EFFECTS WriteArrayHeaderTemplateL(); InitTOffsetElemArray(iOffsetArray); +#endif // } } @@ -1057,11 +1096,13 @@ { return ETrue; } +#ifdef RD_SUBWINDOW_EFFECTS TOffsetElem e; if (aSendArray) { e = WriteIndexArrayL(iOffsetArray); } +#endif #ifdef _OLD_STREAM if ( iBufStream->Sink() ) @@ -1109,10 +1150,14 @@ } WriteInt8L( EAlfFrameContainsUnsupportedCommands ); WriteInt8L( iNonSupportedCommandsInWindow ); + WriteInt8L( EAlfFrameOrientation ); + WriteInt32L( iOrientation ); +#ifdef RD_SUBWINDOW_EFFECTS if (aSendArray) { WriteArrayHeaderL(e); } +#endif /*iWindowHeaderStruct.iWindowEndOffset = previousPos.Offset(); iWindowHeaderStruct.iUnsupportedCommandsInWindow = iNonSupportedCommandsInWindow; iBufStream->WriteL( (TUint8*)&iWindowHeaderStruct, sizeof(TWindowHeaderStruct) );*/ @@ -1134,6 +1179,7 @@ const TInt KArrayOffsetTemplate = 23456789; const TInt KArraySizeTemplate = 23456789; +#ifdef RD_SUBWINDOW_EFFECTS void CAlfRsSendBuffer::WriteArrayHeaderTemplateL() { WriteInt8L( EAlfCommandIndexArrayHeader ); @@ -1246,6 +1292,8 @@ { EndMarkerL(iOffsetArray, iMarker, iBoundingRectangle, iLayerId); } +#endif // RD_SUBWINDOW_EFFECTS + // --------------------------------------------------------------------------- // SendL // sends data syncronously in one or more packets to the streamer server @@ -1354,15 +1402,17 @@ if ( !iFlushBufferTimer ) { iFlushBufferTimer = CPeriodic::NewL( EPriorityNormal ); - iFlushBufferTimer->Start( 5000, 10 * 1000000 , TCallBack( doFlushBuffer, this )); + iFlushBufferTimer->Start( KFlushBufferTimeout, 10 * 1000000 , TCallBack( doFlushBuffer, this )); } if ( !iFlushBufferTimer->IsActive() ) { //__ALFLOGSTRING("CAlfRsSendBuffer::CommitL, activating timer"); - iFlushBufferTimer->After( 5000 ); + iFlushBufferTimer->After( KFlushBufferTimeout ); } else { + iFlushBufferTimer->Cancel(); + iFlushBufferTimer->After( KFlushBufferTimeout ); //__ALFLOGSTRING("CAlfRsSendBuffer::CommitL, timer already active "); } } @@ -2119,3 +2169,13 @@ #endif iOffset = aOffset; } + +// --------------------------------------------------------------------------- +// SetOrientation +// --------------------------------------------------------------------------- +// +void CAlfRsSendBuffer::SetOrientation(TInt aOrientation) + { + iOrientation = aOrientation; + } + diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF --- a/uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/Client/BWINS/alfclientu.DEF Mon Mar 15 12:43:37 2010 +0200 @@ -1108,4 +1108,6 @@ ?Finish@CAlfDrawer@@QAEHXZ @ 1107 NONAME ; int CAlfDrawer::Finish(void) ??1CAlfDrawer@@UAE@XZ @ 1108 NONAME ; CAlfDrawer::~CAlfDrawer(void) ?NewL@CAlfDrawer@@SAPAV1@XZ @ 1109 NONAME ; class CAlfDrawer * CAlfDrawer::NewL(void) + ?BlankScreen@RAlfDirectClient@@QAEHH@Z @ 1110 NONAME ; int RAlfDirectClient::BlankScreen(int) + ?FallbackCopyScreenToBitmap@CAlfDrawer@@SAHAAVCWsScreenDevice@@PAVCFbsBitmap@@ABVTRect@@@Z @ 1111 NONAME ; int CAlfDrawer::FallbackCopyScreenToBitmap(class CWsScreenDevice &, class CFbsBitmap *, class TRect const &) diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/Client/eabi/alfclientu.DEF --- a/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/Client/eabi/alfclientu.DEF Mon Mar 15 12:43:37 2010 +0200 @@ -1343,4 +1343,6 @@ _ZN10CAlfDrawerD0Ev @ 1342 NONAME _ZN10CAlfDrawerD1Ev @ 1343 NONAME _ZN10CAlfDrawerD2Ev @ 1344 NONAME + _ZN16RAlfDirectClient11BlankScreenEi @ 1345 NONAME + _ZN10CAlfDrawer26FallbackCopyScreenToBitmapER15CWsScreenDeviceP10CFbsBitmapRK5TRect @ 1346 NONAME diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/Client/src/alfdirectclient.cpp --- a/uiacceltk/hitchcock/Client/src/alfdirectclient.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/Client/src/alfdirectclient.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -68,6 +68,49 @@ return SendReceive(EAlfForceSwRendering, TIpcArgs(aEnabled)); } +TInt RAlfDirectClient::GetSizeAndRotation(TSize& aSize, TInt& aRotation) + { + if (!Handle()) + { + TRAPD(err, OpenL()); + if (err) + { + return err; + } + } + + TPckg sizePckg(aSize); + TPckg rotationPckg(aRotation); + return SendReceive(EAlfGetSizeAndRotation, TIpcArgs(&sizePckg, &rotationPckg)); + } + +TInt RAlfDirectClient::ReadPixels(TInt aBitmapHandle) + { + if (!Handle()) + { + TRAPD(err, OpenL()); + if (err) + { + return err; + } + } + + return SendReceive(EAlfReadPixels, TIpcArgs(aBitmapHandle)); + } + +EXPORT_C TInt RAlfDirectClient::BlankScreen( TBool aEnabled ) + { + if (!Handle()) + { + TRAPD(err, OpenL()); + if (err) + { + return err; + } + } + return SendReceive(EAlfBlankScreen, TIpcArgs(aEnabled)); + } + // --------------------------------------------------------------------------- // Constructor // --------------------------------------------------------------------------- diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/Client/src/alfdrawer.cpp --- a/uiacceltk/hitchcock/Client/src/alfdrawer.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/Client/src/alfdrawer.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -19,10 +19,13 @@ #include +#include #include "alfcrppluginclient.h" +#include "alflogger.h" #include #include +#include // Class to hold internal alf drawer data. NONSHARABLE_CLASS( CAlfDrawer::TAlfDrawerData ) @@ -39,6 +42,59 @@ // Creates CAlfCrpPluginClient instance. static CAlfCrpPluginClient* CreateAlfCrpClientL(); +/** + * Misc utility methods for CAlfDrawer. + */ +NONSHARABLE_CLASS(AlfDrawerUtils) + { +public: + + enum TRotation + { + ERotationNone, + ERotation90, + ERotation180, + ERotation270 + }; + + /** + * Inverse rotate. + */ + static void RotateBack(TInt aVirtualRotation, TRect& aRect, TSize aScreenSize) + { + if( aVirtualRotation == ERotation90 || aVirtualRotation == ERotation270 ) + { + RotateRect( aVirtualRotation, aRect, aScreenSize, ETrue ); + } + else if( aVirtualRotation == ERotation180 ) + { + RotateRect( aVirtualRotation, aRect, aScreenSize, EFalse ); + } + } + + /** + * Rotate rect + */ + static void RotateRect(TInt aDirection, TRect& aRect, TSize aScreenSize, TBool aMirror) + { + if (aMirror) aDirection = (aDirection+2)%4; // magic + for (;aDirection > 0; aDirection--) + { + TSize rotatedSize(aRect.Size().iHeight, aRect.Size().iWidth); + aRect = TRect(TPoint(aRect.iTl.iY, aScreenSize.iWidth - aRect.iTl.iX - rotatedSize.iHeight ), rotatedSize); + aScreenSize = TSize(aScreenSize.iHeight, aScreenSize.iWidth); + } + } + + /** + * Copies screen to bitmap using 'read pixels' operation. + */ + static void DoCopyScreenToBitmapL( + CWsScreenDevice& aDevice, + CFbsBitmap* aBitmap, + const TRect& aRect ); + + }; // --------------------------------------------------------------------------- // NewL @@ -92,6 +148,304 @@ } // --------------------------------------------------------------------------- +// FallbackCopyScreenToBitmap +// --------------------------------------------------------------------------- +// +EXPORT_C TInt CAlfDrawer::FallbackCopyScreenToBitmap( + CWsScreenDevice& aDevice, + CFbsBitmap* aBitmap, + const TRect& aRect) + { + TRAPD(err, AlfDrawerUtils::DoCopyScreenToBitmapL(aDevice, aBitmap, aRect)); + return err; + } + +// --------------------------------------------------------------------------- +// DoCopyScreenToBitmapL +// --------------------------------------------------------------------------- +// +void AlfDrawerUtils::DoCopyScreenToBitmapL( + CWsScreenDevice& aDevice, + CFbsBitmap* aBitmap, + const TRect& aRect ) + { + if (aDevice.GetScreenNumber() != 0) // only screen 0 supported for now + { + User::Leave(KErrNotSupported); + } + + if ( !aBitmap || + !aBitmap->Handle() || + aBitmap->IsCompressedInRAM() || + aBitmap->ExtendedBitmapType() != KNullUid ) + { + User::Leave(KErrArgument); + } + + __ALFLOGSTRING("DoCopyScreenToBitmapL begin"); + + RAlfDirectClient client; + CleanupClosePushL(client); + + // Get size & virtual rotation from ALF side. + // GetSizeAndRotation will also create session to server. + + TInt rotation = 0; + TSize size; + User::LeaveIfError(client.GetSizeAndRotation(size, rotation)); + + // Calculate device size in pixels (same as aDevice.SizeInPixels()) + TSize deviceSize = size; + if (rotation == AlfDrawerUtils::ERotation90 || + rotation == AlfDrawerUtils::ERotation270 ) + { + deviceSize.iWidth = size.iHeight; + deviceSize.iHeight = size.iWidth; + } + + // Clip aRect to screen boundaries + TRect actualRect(deviceSize); + actualRect.Intersection(aRect); + + __ALFLOGSTRING2("DoCopyScreenToBitmapL - requested rect origin %d x %d", actualRect.iTl.iX, actualRect.iTl.iY ) ; + __ALFLOGSTRING2("DoCopyScreenToBitmapL - requested rect %d x %d", actualRect.Size().iWidth, actualRect.Size().iHeight ) ; + __ALFLOGSTRING2("DoCopyScreenToBitmapL - bitmap rect %d x %d", aBitmap->SizeInPixels().iWidth, aBitmap->SizeInPixels().iHeight ); + __ALFLOGSTRING1("DoCopyScreenToBitmapL - bitmap mode %d", aBitmap->DisplayMode() ); + + if ( TRect( aBitmap->SizeInPixels() ).IsEmpty() || + actualRect.IsEmpty() ) + { + __ALFLOGSTRING("DoCopyScreenToBitmapL - empty rect or zero bitmap size"); + CleanupStack::PopAndDestroy(); // CleanupClosePushL + return; + } + + // Select display mode. + + TDisplayMode surfaceDisplayMode = EColor64K; + TDisplayMode bitmapDisplayMode = aBitmap->DisplayMode(); + if ( bitmapDisplayMode == EColor16MU || + bitmapDisplayMode == EColor16MA || + bitmapDisplayMode == EColor16MAP ) + { + surfaceDisplayMode = bitmapDisplayMode; + } + + __ALFLOGSTRING3("DoCopyScreenToBitmapL - surface size %d x %d, mode %d", + size.iWidth, size.iHeight, surfaceDisplayMode ) ; + + // Read pixels to temporary bitmap + CFbsBitmap* surfaceBitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL( surfaceBitmap ); + User::LeaveIfError( surfaceBitmap->Create( size, surfaceDisplayMode ) ); + + TInt err = client.ReadPixels( surfaceBitmap->Handle() ); + __ALFLOGSTRING1("DoCopyScreenToBitmapL - ReadPixels returned %d", err); + User::LeaveIfError( err ); + + // Copy data + TInt surfaceStride = CFbsBitmap::ScanLineLength(size.iWidth, surfaceDisplayMode); + __ALFLOGSTRING2("DoCopyScreenToBitmapL - DisplayMode %d, Stride %d", surfaceDisplayMode, surfaceStride); + + TDisplayMode displayMode = surfaceDisplayMode; + + TInt8 bytesPerPixel = 2; + switch( displayMode ) + { + case EColor64K: + { + bytesPerPixel = 2; + break; + } + case EColor16MU: + case EColor16MA: + case EColor16MAP: + { + bytesPerPixel = 4; + break; + } + + default: + { + __ALFLOGSTRING1("DoCopyScreenToBitmapL - display mode not supported %d", displayMode); + User::Leave( KErrNotSupported ); + } + } + + // actualRect (/aRect) must be converted to correct coordinate system. + TRect surfaceRect(actualRect); + AlfDrawerUtils::RotateBack(rotation, surfaceRect, deviceSize); + surfaceRect.Intersection(TRect(size)); + + __ALFLOGSTRING2("DoCopyScreenToBitmapL - surface rect tl %d x %d", surfaceRect.iTl.iX, surfaceRect.iTl.iY ) ; + __ALFLOGSTRING2("DoCopyScreenToBitmapL - surface rect size %d x %d", surfaceRect.Size().iWidth, surfaceRect.Size().iHeight ) ; + + CFbsBitmap* bitmap = NULL; + TBool needTempBitmap = ETrue; + + if( aBitmap->DisplayMode() == displayMode && actualRect == aRect && aBitmap->SizeInPixels() == aRect.Size() ) + { + // Copy data direcly to given bitmap + bitmap = aBitmap; + needTempBitmap = EFalse; + } + else + { + // Create temporary bitmap which maches the sufrace's pixel format and source rect size + bitmap = new (ELeave) CFbsBitmap; + CleanupStack::PushL( bitmap ); + TInt err = bitmap->Create( actualRect.Size(), displayMode ); + __ALFLOGSTRING1("DoCopyScreenToBitmapL - Create returned %d", err ); + User::LeaveIfError( err ); + __ALFLOGSTRING("DoCopyScreenToBitmapL - display mode or size don't mach -> using temp bitmap" ); + } + + surfaceBitmap->BeginDataAccess(); + bitmap->BeginDataAccess(); + + TUint8* surfacePtr = (TUint8*)surfaceBitmap->DataAddress() + surfaceStride * surfaceRect.iTl.iY; + + TUint8* bitmapPtr = (TUint8*)bitmap->DataAddress(); + TInt rowBegin = surfaceRect.iTl.iX * bytesPerPixel; + TInt captureBitmapWidth = surfaceRect.Width() * bytesPerPixel; + + const TSize bitmapSize = bitmap->SizeInPixels(); + + // Initialize with direct copy case parameters + TInt bitmapPtrColumnDelta = bytesPerPixel; + TInt bitmapPtrRowDelta = bitmap->DataStride(); + + const TSize surfaceRectSize(surfaceRect.Size()); + if ( rotation == AlfDrawerUtils::ERotationNone ) + { + __ALFLOGSTRING("DoCopyScreenToBitmapL - direct copy") ; + + // Direct copy case + for ( TInt row = surfaceRectSize.iHeight - 1 ; row >= 0 ; --row ) + { + // Copy only the desired part of the bitmap + memcpy( bitmapPtr, + surfacePtr + rowBegin, + captureBitmapWidth ); + surfacePtr += surfaceStride; + bitmapPtr += bitmap->DataStride(); + } + } + else + { + // Handle rotation cases + // + // 0 degree case + // A B C + // 1 2 3 + // 90 degrees anti-clockwise + // C 3 + // B 2 + // A 1 + // 180 degrees anti-clockwise + // 3 2 1 + // C B A + // 270 degrees anti-clockwise + // 1 A + // 2 B + // 3 C + // + switch (rotation) + { + case AlfDrawerUtils::ERotation90: + bitmapPtrColumnDelta = -bitmap->DataStride(); + bitmapPtrRowDelta = bytesPerPixel; + bitmapPtr += ( bitmapSize.iHeight - 1 ) * bitmap->DataStride(); + break; + case AlfDrawerUtils::ERotation180: + bitmapPtrColumnDelta = -bytesPerPixel; + bitmapPtrRowDelta = -bitmap->DataStride(); + bitmapPtr += ( bitmapSize.iHeight - 1 ) * bitmap->DataStride() + ( bitmapSize.iWidth - 1 ) * bytesPerPixel; + break; + case AlfDrawerUtils::ERotation270: + bitmapPtrColumnDelta = bitmap->DataStride(); + bitmapPtrRowDelta = -bytesPerPixel; + bitmapPtr += ( bitmapSize.iWidth - 1 ) * bytesPerPixel; + break; + default: + break; + } + + // We go through surface row by row, column by column and + // copy pixel data to appropriate place to bitmap + if ( bytesPerPixel == 4 ) + { + __ALFLOGSTRING("DoCopyScreenToBitmapL - four bytes per pixel, rotated copy") ; + + for ( TInt row = surfaceRectSize.iHeight - 1 ; row >= 0 ; --row ) + { + TUint8* rowBitmapPtr = bitmapPtr; + TUint8* rowSurfacePtr = surfacePtr + rowBegin; + for ( TInt column = surfaceRectSize.iWidth - 1 ; column >= 0 ; --column ) + { + *((TUint32*)rowBitmapPtr) = *((TUint32*)rowSurfacePtr); + + rowBitmapPtr += bitmapPtrColumnDelta; + rowSurfacePtr += bytesPerPixel; + } + + surfacePtr += surfaceStride; + bitmapPtr += bitmapPtrRowDelta; + } + } + else + { + // Now bytesPerPixel == 2 + __ALFLOGSTRING("DoCopyScreenToBitmapL - two bytes per pixel, rotated copy") ; + for ( TInt row = surfaceRectSize.iHeight - 1 ; row >= 0 ; --row ) + { + TUint8* rowBitmapPtr = bitmapPtr; + TUint8* rowSurfacePtr = surfacePtr + rowBegin; + for ( TInt column = surfaceRectSize.iWidth - 1 ; column >= 0 ; --column ) + { + *((TUint16*)rowBitmapPtr) = *((TUint16*)rowSurfacePtr); + + rowBitmapPtr += bitmapPtrColumnDelta; + rowSurfacePtr += bytesPerPixel; + } + + surfacePtr += surfaceStride; + bitmapPtr += bitmapPtrRowDelta; + } + } + } + __ALFLOGSTRING("DoCopyScreenToBitmapL - copy finished" ); + surfaceBitmap->EndDataAccess(ETrue); + bitmap->EndDataAccess(); + + if( !needTempBitmap ) + { + bitmap = NULL; + } + else // bitblit the temporary bitmap to given bitmap + { + CFbsBitmapDevice* tempBitmapDevice = CFbsBitmapDevice::NewL( aBitmap ); + CleanupStack::PushL( tempBitmapDevice ); + CFbsBitGc* tempBitmapGc = NULL; + User::LeaveIfError( tempBitmapDevice->CreateContext( tempBitmapGc ) ); + CleanupStack::PushL( tempBitmapGc ); + + tempBitmapGc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); + tempBitmapGc->BitBlt( TPoint(), bitmap ); + + CleanupStack::PopAndDestroy( tempBitmapGc ); + CleanupStack::PopAndDestroy( tempBitmapDevice ); + CleanupStack::PopAndDestroy( bitmap ); + } + + CleanupStack::PopAndDestroy( surfaceBitmap ); + + CleanupStack::PopAndDestroy(); // CleanupClosePushL + + __ALFLOGSTRING("DoCopyScreenToBitmapL - Done"); + } + +// --------------------------------------------------------------------------- // Constructor // --------------------------------------------------------------------------- // diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/CommonInc/alfbridgecommands.h --- a/uiacceltk/hitchcock/CommonInc/alfbridgecommands.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/CommonInc/alfbridgecommands.h Mon Mar 15 12:43:37 2010 +0200 @@ -65,6 +65,7 @@ // 130 EAlfEffectFx, EAlfStopEffectFx, + EAlfStopControlEffectFx, EAlfControlEffectFx, EAlfRegisterEffectFx, EAlfUnregisterEffectFx, @@ -79,6 +80,9 @@ EAlfReleaseTemporaryChunk, EAlfBridgeSetScreenRotation, EAlfDSSynchronize, + EAlfDSSetWindowArea, + EAlfDSSetTransparencyAlphaChannel, + EAlfDSIncludeToVisibilityCalculation, KUnInitialized }; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h --- a/uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/CommonInc/alfdecoderserverclient.h Mon Mar 15 12:43:37 2010 +0200 @@ -50,6 +50,14 @@ IMPORT_C void SendAsynchronous(TInt aOp, const TIpcArgs& aIPCArgs,TRequestStatus& aStatus ); IMPORT_C TInt SendBlind(TInt aOp, const TIpcArgs& aIPCArgs ); + + /** + * Asks list of window groups that have graphics surfaces even + * they are not supposed to be seen on screen + * @param aArray array to be populated + * @return error code. + */ + IMPORT_C TInt GetListOfInactiveWindowGroupsWSurfaces(RArray* aWindowGroups); private: TInt iSpare1; TInt iSpare2; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/CommonInc/alflogger.h --- a/uiacceltk/hitchcock/CommonInc/alflogger.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/CommonInc/alflogger.h Mon Mar 15 12:43:37 2010 +0200 @@ -89,7 +89,7 @@ #define __ALFFXLOGSTRING1(C, X) #define __ALFFXLOGSTRING2(C, X, Y) #define __ALFFXLOGSTRING3(C, X, Y, Z) - #define __ALFFXLOGSTRING4(C, X, Y, W) + #define __ALFFXLOGSTRING4(C, X, Y, Z, W) #endif #if (ALF_FXLOGGING_METHOD==1) @@ -104,7 +104,7 @@ #define __ALFFXLOGSTRING1(C, X) {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue(tempLogDes()),X);} #define __ALFFXLOGSTRING2(C, X, Y) {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue(tempLogDes()),X,Y);} #define __ALFFXLOGSTRING3(C, X, Y, Z) {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue(tempLogDes()),X,Y,Z);} - #define __ALFFXLOGSTRING4(C,X,Y,Z,W) {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue(tempLogDes()),X,Y,Z,W);} + #define __ALFFXLOGSTRING4(C, X, Y, Z, W) {_LIT(tempLogDes,C);RFileLogger::WriteFormat(KLogsDir(),KLogFileName(), EFileLoggingModeAppend, TRefByValue(tempLogDes()),X,Y,Z,W);} #endif #endif // ALFLOGGER_H diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/CommonInc/alfmoduletest.h --- a/uiacceltk/hitchcock/CommonInc/alfmoduletest.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/CommonInc/alfmoduletest.h Mon Mar 15 12:43:37 2010 +0200 @@ -5,13 +5,16 @@ #define ALFMODULETEST_H // Define this to build module testing enchanced version of ALF -// #define USE_MODULE_TEST_HOOKS_FOR_ALF +//#define USE_MODULE_TEST_HOOKS_FOR_ALF #if !defined(USE_MODULE_TEST_HOOKS_FOR_ALF) || !defined(AMT_CONTROL) +#define AMT_DATA() #define AMT_FUNC(func) -#define AMT_FUNC_EXC(func) -#define AMT_FUNC_EXC_IF(cond, func) +#define AMT_FUNC_EXC(func) +#define AMT_FUNC_EXC_RET(ret, func) +#define AMT_FUNC_EXC_IF(cond, func) +#define AMT_FUNC_EXC_IF_RET(cond, ret, func) #define AMT_INC_COUNTER(member) #define AMT_DEC_COUNTER(member) #define AMT_SET_VALUE(member, val) @@ -20,6 +23,16 @@ #define AMT_DEC_COUNTER_IF(cond, member) #define AMT_SET_VALUE_IF(cond, member, val) #define AMT_GET_VALUE_IF(cond, x, member) + +#define AMT_MAP_APPEND(memberMap, key, type, defaultValue) +#define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type) +#define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type) +#define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type) +#define AMT_MAP_SET_VALUE(memberMap, key, value, type) +#define AMT_MAP_INC_VALUE(memberMap, key, type) +#define AMT_MAP_DEC_VALUE(memberMap, key, type) +#define AMT_MAP_RESET(memberMap) + #define AMT_PRINT_STATE() #ifndef AMT_CONTROL @@ -46,8 +59,10 @@ // Generic macros #define AMT_DATA() AMT_CONTROL()->iModuleTestData #define AMT_FUNC(func) if (AMT_DATA()->iIsEnabled) {func;} -#define AMT_FUNC_EXC(func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();} +#define AMT_FUNC_EXC(func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {func;} AMT_CONTROL()->Unlock();} +#define AMT_FUNC_EXC_RET(ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled) {ret = func;} AMT_CONTROL()->Unlock();} #define AMT_FUNC_EXC_IF(cond, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {func;} AMT_CONTROL()->Unlock();} +#define AMT_FUNC_EXC_IF_RET(cond, ret, func) {AMT_CONTROL()->Lock(); if (AMT_DATA()->iIsEnabled && (cond)) {ret = func;} AMT_CONTROL()->Unlock();} // Single operation macros, that will do lock/unlock. #define AMT_INC_COUNTER(member) AMT_FUNC_EXC(AMT_DATA()->member++) @@ -62,11 +77,351 @@ #define AMT_SET_VALUE_IF(cond, member, val) AMT_FUNC_EXC_IF((cond), AMT_DATA()->member=(val)) #define AMT_GET_VALUE_IF(cond, x, member) AMT_FUNC_EXC_IF((cond), (x) = AMT_DATA()->member) +// Map operation macros, that will do lock/unlock +#define AMT_MAP_APPEND(memberMap, key, type, defaultValue) AMT_FUNC_EXC(AMT_DATA()->memberMap.Append(key, type, defaultValue)) +#define AMT_MAP_SET_VALUE_IF(cond, memberMap, key, value, type) AMT_FUNC_EXC_IF((cond), AMT_DATA()->memberMap.SetValue(key, value, type)) +#define AMT_MAP_INC_VALUE_IF(cond, memberMap, key, type) AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.Find(key, type)), AMT_DATA()->memberMap.SetValue(key, AMT_DATA()->memberMap.Find(key, type)->Value() + 1, type)) +#define AMT_MAP_DEC_VALUE_IF(cond, memberMap, key, type) AMT_FUNC_EXC_IF((cond && AMT_DATA()->memberMap.Find(key, type)), AMT_DATA()->memberMap.SetValue(key, AMT_DATA()->memberMap.Find(key, type)->Value() - 1, type)) +#define AMT_MAP_SET_VALUE(memberMap, key, value, type) AMT_FUNC_EXC_IF(ETrue, AMT_DATA()->memberMap.SetValue(key, value, type)) +#define AMT_MAP_INC_VALUE(memberMap, key, type) AMT_MAP_INC_VALUE_IF(ETrue, memberMap, key, type) +#define AMT_MAP_DEC_VALUE(memberMap, key, type) AMT_MAP_DEC_VALUE_IF(ETrue, memberMap, key, type) +#define AMT_MAP_RESET(memberMap) AMT_FUNC_EXC(AMT_DATA()->memberMap.Reset()) // *** Global object names _LIT(KAlfModuleTestChunkName, "ALF_MODULE_TEST_CHUNK"); _LIT(KAlfModuleTestMutexName, "ALF_MODULE_TEST_MUTEX"); + +/** + * TAlfModuleTestType specifies recognized test types. + */ +enum TAlfModuleTestType + { + // Do not use this value when creating item. + EAlfModuleTestTypeNone, + + // Render stage component specific tests + EAlfModuleTestTypeRenderStageChangeSize, + EAlfModuleTestTypeRenderStageChangePosition, + EAlfModuleTestTypeRenderStageChangeFlag, + + // Streamer hierarchy model component specific tests + EAlfModuleTestTypeHierarchyModelChangeSize, + EAlfModuleTestTypeHierarchyModelChangePosition, + EAlfModuleTestTypeHierarchyModelChangeFlag, + + // Server bridge component specific tests + EAlfModuleTestTypeBridgeChangeSize, + EAlfModuleTestTypeBridgeChangePosition, + EAlfModuleTestTypeBridgeChangeFlag, + + // Do not use this value when creating item. + // This is just meant for Find operations when all tests are accepted. + EAlfModuleTestTypeAll + }; + + +/** + * CAlfModuleTestItem + * + * Provides key-value pair that is used in TAlfModuleTestMap. + */ +template< class T > +NONSHARABLE_CLASS( TAlfModuleTestItem ) + { + +public: + + /** + * Constructor to initialize variables. + * + * @param aKey Key that identifies the item. + * In test cases this could be for example handle. + * @param aTestType Defines for what this test item is meant for. + */ + TAlfModuleTestItem( TInt aKey, const TAlfModuleTestType& aTestType, const T& aDefaultValue ): + iKey( aKey ), + iTestType( aTestType ), + iValue( aDefaultValue ), + iValueSetCount( 0 ) + { + } + + + /** + * @param aObject Value to be compared. + * @return ETrue if given object equals the value of this item. + * Else EFalse. + */ + TBool Equals( const T& aValue, const TAlfModuleTestType& aTestType ) const + { + // Also, check that value has been set. If it has not been set, + // then think objects as unequals. + return ( iValueSetCount > 0 + && iValue == aValue + && TestTypeMatch( aTestType ) ); + } + + + /** + * @return TInt Key that should be set during creation of this object. + */ + TInt Key() const + { + return iKey; + } + + /** + * @see ValueSet to check if the value has already been set. + * + * @return const T& Value that corresonds the key. + */ + const T& Value() const + { + return iValue; + } + + + /** + * @param aValue Value to be set for the key + */ + void SetValue( const T& aValue ) + { + iValue = aValue; + ++iValueSetCount; + } + + + /** + * @return TInt Informs how many times the value has been set. + */ + TInt ValueSetCount() const + { + return iValueSetCount; + } + + /** + * @return const TAlfModuleTestType& Defines what the test is for + */ + const TAlfModuleTestType& TestType() const + { + return iTestType; + } + + + /** + * @param aTestType + * @return TBool ETrue if flag matches this item. Else EFalse. + */ + TBool TestTypeMatch( const TAlfModuleTestType& aTestType ) const + { + return ( EAlfModuleTestTypeAll == aTestType + || iTestType == aTestType ); + } + + + /** + * Resets the item info + */ + void Reset() + { + iValueSetCount = 0; + } + + +private: // data + + TInt iKey; + TAlfModuleTestType iTestType; + T iValue; + TInt iValueSetCount; + + }; + + +/** + * Class CAlfModuleTestMap + * + * Provides map functionality for the key-value-pairs. + * In test cases, this should most likely be used so, that + * first test case classes create items with certain keys, for example with handle values. + * Then, define hooks are used in the code to update values that corresond the correct handles. + * In the end, test case classes can check that items have correct values set and if the test + * is passed. + */ +template< class T > +NONSHARABLE_CLASS( TAlfModuleTestMap ) + { +public: + + // Maximum item count in the map + static const TInt KMaxArrayCount = 50; + + + /** + * Constructor to initialize variables. + */ + TAlfModuleTestMap(): + iCount( 0 ), + iSetValueCallCount( 0 ) + { + } + + + /** + * @param aKey + * @param aTestType Informs what type of test is accepted. Others are skipped. + * @return T* Ownership is not transferred. + * NULL if item is not found. + */ + TAlfModuleTestItem< T >* Find( TInt aKey, const TAlfModuleTestType& aTestType ) + { + // Try to find the item corresponding the given key. + for ( TInt i = 0; i < iCount; ++i ) + { + TAlfModuleTestItem< T >& testItem( iArray[ i ] ); + if ( testItem.Key() == aKey + && testItem.TestTypeMatch( aTestType ) ) + { + return &( testItem ); + } + } + // Item corresponding the given key was not found. + return NULL; + } + + + /** + * Function to append new item into the map. + * + * @param aKey + * @param aTestType Describes for what case the appended test item is created for. + * @return TInt System wide error code. + */ + TInt Append( TInt aKey, const TAlfModuleTestType& aTestType, const T& aDefaultValue ) + { + if ( iCount == KMaxArrayCount ) + { + // Array already full. + return KErrOverflow; + } + else if ( Find( aKey, aTestType ) ) + { + // Key has already been inserted. + return KErrAlreadyExists; + } + + // Append new key value set into the array. + iArray[ iCount ] = TAlfModuleTestItem< T >( aKey, aTestType, aDefaultValue ); + ++iCount; + return KErrNone; + } + + + /** + * Sets the value for the item. + * Item itself should already exist in the array before + * setting its value here. See, Append function. + * + * @param aKey + * @param aValue + * @return TInt System wide error code. + */ + TInt SetValue( TInt aKey, const T& aValue, const TAlfModuleTestType& aTestType ) + { + // Increase counter, because this function is called. + ++iSetValueCallCount; + TAlfModuleTestItem< T >* item( Find( aKey, aTestType ) ); + if ( !item ) + { + // Item was not found from the array. + return KErrNotFound; + } + // Item exists. So, set its values. + item->SetValue( aValue ); + return KErrNone; + } + + + /** + * Resets the map + */ + void Reset() + { + // Just reset the counter. + // We do not bother to reset map items, because when counter is reseted + // already set items and their info is left out of the scope. + iCount = 0; + iSetValueCallCount = 0; + } + + + /** + * Checks if all the values of items in the array match the given value. + * + * @param aValue Reference to the value that items are compared to. + * @param aTestType Informs the test type whose items should be compared. + */ + TInt CountEquals( const T& aValue, const TAlfModuleTestType& aTestType ) const + { + TInt count( 0 ); + for ( TInt i = 0; i < iCount; ++i ) + { + if ( iArray[ i ].Equals( aValue, aTestType ) ) + { + // Item matches + ++count; + } + } + return count; + } + + + /** + * @return TInt Number of map items + */ + TInt ItemCount() const + { + return iCount; + } + + + /** + * @return const TAlfModuleTestItem< T >& Reference to the map item + */ + const TAlfModuleTestItem< T >& Item( TInt aIndex ) const + { + return iArray[ aIndex ]; + } + + + /** + * @return TInt Number of times SetValue function has been called + * since last reset. This information can be used + * to check if hooks have been used correct times during + * a test case. Notice, that this informs the number of + * function calls, not the number of times a value has actually + * set for some item. + */ + TInt SetValueCallCount() const + { + return iSetValueCallCount; + } + + +private: // data + + TAlfModuleTestItem< T > iArray[ KMaxArrayCount ]; + // Informs number of array items + TInt iCount; + // Informs how many times SetItem has been called since last reset. + // Notice, that this informs the number of function calls, not the number + // of times a value has actually set for some item. + TInt iSetValueCallCount; + + }; + + /* * Class CAlfModuleTestData */ @@ -115,10 +470,48 @@ iLatestVisualExtentRect.iTl.iX, iLatestVisualExtentRect.iTl.iY, iLatestVisualExtentRect.Width(), iLatestVisualExtentRect.Height()); RDebug::Print(_L("iTotalVisualFlagChangedCount=%d"), iTotalVisualFlagChangedCount); - RDebug::Print(_L("iTotalVisualAttributeChangedCount=%d"), iTotalVisualAttributeChangedCount); + RDebug::Print(_L("iTotalVisualAttributeChangedCount=%d"), iTotalVisualAttributeChangedCount); + RDebug::Print(_L("iSizeMap =>")); + PrintSizeMapState( iSizeMap ); + RDebug::Print(_L("iPositionMap =>")); + PrintPositionMapState( iPositionMap ); RDebug::Print(_L("*** ALF INTERNAL STATE ***")); } + + void PrintSizeMapState( TAlfModuleTestMap< TSize > aMap ) + { + RDebug::Print(_L("*** ALF INTERNAL SIZE MAP STATE -->")); + RDebug::Print(_L("Map item count=%d, SetValue call count=%d"), + aMap.ItemCount(), aMap.SetValueCallCount()); + for ( TInt i = 0; i < aMap.ItemCount(); ++i ) + { + const TAlfModuleTestItem< TSize >& item( aMap.Item( i ) ); + RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d"), + i, item.Key(), item.TestType(), item.ValueSetCount()); + RDebug::Print(_L("Map item index=%d, width=%d, height=%d"), + i, item.Value().iWidth, item.Value().iHeight); + } + RDebug::Print(_L("<-- ALF INTERNAL SIZE MAP STATE ***")); + } + + + void PrintPositionMapState( TAlfModuleTestMap< TPoint > aMap ) + { + RDebug::Print(_L("*** ALF INTERNAL POSITION MAP STATE -->")); + RDebug::Print(_L("Map item count=%d, SetValue call count=%d"), + aMap.ItemCount(), aMap.SetValueCallCount()); + for ( TInt i = 0; i < aMap.ItemCount(); ++i ) + { + const TAlfModuleTestItem< TPoint >& item( aMap.Item( i ) ); + RDebug::Print(_L("Map item %d, iKey=%d, iTestType=%d, iValueSetCount=%d"), + i, item.Key(), item.TestType(), item.ValueSetCount()); + RDebug::Print(_L("Map item index=%d, x=%d, y=%d"), + i, item.Value().iX, item.Value().iY); + } + RDebug::Print(_L("<-- ALF INTERNAL POSITION MAP STATE ***")); + } + public: TBool iIsEnabled; // *** not yet implemented. For run-time enabling/disabling of the test system. @@ -177,6 +570,14 @@ TInt iASE_Temp2; TInt iASE_Temp3; TInt iASE_Temp4; + + // Map that contains integer items that can be specified for certain test cases. + TAlfModuleTestMap< TInt > iIntMap; + // Map that contains size items that can be specified for certain test cases. + TAlfModuleTestMap< TSize > iSizeMap; + // Map that contains position items that can be specified for certain test cases. + TAlfModuleTestMap< TPoint > iPositionMap; + }; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/CommonInc/alfrenderstageutils.h --- a/uiacceltk/hitchcock/CommonInc/alfrenderstageutils.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/CommonInc/alfrenderstageutils.h Mon Mar 15 12:43:37 2010 +0200 @@ -101,6 +101,7 @@ virtual void CommitL() = 0; virtual void WriteIntsL(TUint8 aCommand, TInt aCount, TInt* aArray) = 0; virtual RAlfBridgerClient* Client() = 0; + virtual void SetOrientation(TInt aOrientation) = 0; }; /** diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h --- a/uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/CommonInc/huiwscanvascommands.h Mon Mar 15 12:43:37 2010 +0200 @@ -123,6 +123,7 @@ EAlfContentTag, EAlfFrameFlags, + EAlfFrameOrientation, EAlfPacketReady, EAlfPacketNotReady, @@ -157,9 +158,13 @@ EAlfDebugTrackNode, EAlfNodeLayerExtentChanged, EAlfNodeLayerUsesAlphaFlagChanged, + + // 110 EAlfNodeFadeAllChildren, EAlfCommandIndexArray, EAlfCommandIndexArrayHeader, + EAlfNodeSetWindowArea, + // This must be kept as last command! EAlfLastCommand }; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Inc/alfappsrvsession.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfappsrvsession.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfappsrvsession.h Mon Mar 15 12:43:37 2010 +0200 @@ -367,6 +367,8 @@ void EnvEnableLowMemoryState(const RMessage2& aMessage); void EnvForceSwRendering(const RMessage2& aMessage); + void EnvGetSizeAndRotation(const RMessage2& aMessage); + void EnvReadPixels(const RMessage2& aMessage); private: diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfbridge.h Mon Mar 15 12:43:37 2010 +0200 @@ -65,12 +65,14 @@ CHuiVisual* aEffectedVisual, CHuiVisual* aTemporaryPresenterVisual, TBool aIsLayout, - TBool aHideWhenFinished) + TBool aHideWhenFinished, + TBool aCanDestroyOrHideImmediately) : iHandle(aHandle), iEffectedVisual(aEffectedVisual), iTemporaryPresenterVisual(aTemporaryPresenterVisual), iIsLayout(aIsLayout), - iHideWhenFinished(aHideWhenFinished) + iHideWhenFinished(aHideWhenFinished), + iCanDestroyOrHideImmediately(aCanDestroyOrHideImmediately) { // RDebug::Printf("TEffectCleanupStruct - 0x%x 0x%x, %d", iEffectedVisual, iTemporaryPresenterVisual, iIsLayout ); }; @@ -80,6 +82,8 @@ TBool iIsLayout; TBool iHideWhenFinished; + + TBool iCanDestroyOrHideImmediately; // not own, unless iEffectedVisual has EShouldDestroy flag enabled CHuiVisual* iEffectedVisual; @@ -129,7 +133,18 @@ TRect& aFullscreen, CAlfScreen* aScreen, TBool& aSubtreeVisible, + TBool& aHasVisualsWithLayers, TBool aChildCanBeOpaque ); + + /** + * Updates layer visibilities. + */ + void HandleLayerVisibility( + CHuiLayout* aLayout, + CHuiControlGroup& aControlGroup, + CHuiControl& aControl, + TBool aVisible ); + /** * This method shows the control group in roster, however the aWhere param * is modified so that controlgroup appears at the right position depending on @@ -227,6 +242,21 @@ void LowMemoryCancelAllEffects(); /** + * Gets size & rotation. + * @param aSize size. + * @param aRotation rotation. + * @return error code. + */ + TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation); + + /** + * Reads pixels to bitmap. + * @param aBitmap bitmap. + * @return error code. + */ + TInt ReadPixels(CFbsBitmap* aBitmap); + + /** * Sets HuiControlGroup as Alf application window group */ void SetWindowGroupAsAlfApp(TInt aId); @@ -245,7 +275,10 @@ * gets another N milliseconds. Most cases, the first N milliseconds is enough. */ void HandleGfxEndFullScreenTimeout(CFullScreenEffectState* aFullScreenEffectData); - + + // Experimental + TBool IsFullScreenDrawn( TInt aOrientation); + private: @@ -285,12 +318,14 @@ // This is needed if we have to abort an effect void HandleGfxStopEffectsL( TAlfBridgerData data ); + void HandleGfxStopControlEffectsL( TAlfBridgerData data ); + /** * RemoveEffectFromApp * * Removes effects on appui. */ - void RemoveEffectFromApp(TInt aAppUid); + void RemoveEffectFromApp(TInt aSecureId, TInt aWgId = -1 ); // component effect handling void HandleGfxControlEffectsL( TAlfBridgerData data ); @@ -341,7 +376,7 @@ * @return ETrue, if layout have been initialized succesfully for the effect EFalse, if any visuals have been removed. Effect should not be applied. */ - TBool SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect); + TBool SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately); /* * AddEffectItemL @@ -358,7 +393,8 @@ CHuiControl* aEffectControl, TBool aInsertTemporaryVisual, TBool& aItemDestroyed, - TBool aIsExitEffect = EFalse); + TBool aIsExitEffect = EFalse, + TBool aCanDestroyOrHideImmediately = EFalse); /* @@ -371,20 +407,13 @@ CHuiControl* aEffectControlGroup, TInt& aItemsDestroyed, TBool aAddLayout = ETrue, - TBool aIsExitEffect = EFalse); + TBool aIsExitEffect = EFalse, + TBool aCanDestroyOrHideImmediately = EFalse); /* * ListFamilyTreeL */ void ListFamilyTreeL( RPointerArray& aArray, const CHuiLayout* aLayout ); - /* - * SetupEffectLayoutContainerL - * - * This method creates an own temporary presenter visual visual and binds it to aSourceVisul - * using SetExternalContentL. Finally the effect entry is added to iEffectCleanupStack, - * thus it can be cleaned after effect completion. - */ - void SetupEffectContainerL(TInt aHandle, CHuiCanvasVisual* aSourceVisual, TBool aIsExitEffect); /* * RemoveTemporaryPresenterItem @@ -479,6 +508,12 @@ void HandleSetWindowOpacityL( TAlfBridgerData& aData ); + void HandleSetTransparencyAlphaChannelL( TAlfBridgerData& aData ); + + void HandleIncludeToVisibilityCalculationL( TAlfBridgerData& aData ); + + void HandleSetWindowAreaL( TAlfBridgerData& aData ); + void HandleReorderWindowL( TAlfBridgerData& aData ); void HandlePostCanvasBufferL( TAlfBridgerData& aData ); @@ -605,7 +640,30 @@ TInt& aScreenNumber, TAlfControlGroupEntry** aAlfGroup = NULL ); - CHuiControlGroup* FindControlGroupByAppId( TInt aAppId ); + /** + * Finds control group which matches the given secure ID. For more detailed search, + * you can provide the client window group ID. + * + * @param aSecureId Secure ID to seacrh for + * @param aWgId Client window group ID. Ignored if -1. + * @return Pointer to found control gruop. NULL if not found. + */ + CHuiControlGroup* FindControlGroupBySecureId( TInt aSecureId, TInt aWgId = -1 ) const; + + /** + * Finds control gruop which matches the full screen effect end state. + * + * @return Pointer to found control gruop. NULL if not found. + */ + CHuiControlGroup* FindControlGroupByFullScreenToEffect() const; + + /** + * Finds control gruop which matches the full screen effect start state. + * + * @return Pointer to found control gruop. NULL if not found. + */ + CHuiControlGroup* FindControlGroupByFullScreenFromEffect() const; + /** * This method deletes controlgroup which has been assosiated with given window group id. * Control group may or may not be active in roster. @@ -703,6 +761,19 @@ RPointerArray iAlfScreens; void SetCursorTimerL(TUint aTime = 0, CHuiVisual* aCursor = 0); TBool IsAlfOriginatedWindow(CHuiCanvasVisual& aVisual); + + // Experimental + TBool IsFullScreenDrawnRecursive( + CHuiLayout* aLayout, + CHuiControlGroup& aControlGroup, + CHuiControl& aControl, + TBool& aFullscreenCovered, + TRect& aFullscreen, + CAlfScreen* aScreen, + TBool& aSubtreeVisible, + TBool& aHasVisualsWithLayers, + TBool aChildCanBeOpaque, + TInt aOrientation); NONSHARABLE_CLASS ( TDeadControlGroup ) { @@ -846,6 +917,10 @@ RArray iAlfRegisteredEffects; CHuiEnv* iHuiEnv; CAlfAppUi* iAppUi; + CAlfLayoutSwitchEffectCoordinator* LayoutSwitchEffectCoordinator() + { + return iLayoutSwitchEffectCoordinator; + } private: @@ -879,10 +954,6 @@ TBool iLowMemoryMode; THuiMemoryLevel iCurrentMemoryLevel; - #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF - TInt iTempTotalActiveVisualCount; - TInt iTempTotalPassiveVisualCount; - #endif #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER TInt activevisualcount; TInt passivevisualcount; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfeffectutils.h Mon Mar 15 12:43:37 2010 +0200 @@ -43,6 +43,8 @@ private: // Data CAlfBridge& iBridge; + public: + TInt iSafeCounter; }; @@ -60,7 +62,8 @@ virtual ~CAlfEffectEndTimer(); public: // New functions - void Start( TTimeIntervalMicroSeconds32 aPeriod, TInt aHandle ); + void Start( TTimeIntervalMicroSeconds32 aPeriod ); + void AddFinishedHandleL(TInt aHandle); protected: // Functions from base classes void DoCancel(); @@ -72,8 +75,7 @@ private: // Data CAlfBridge& iBridge; - TInt iHandle; - + RArray iHandles; }; // --------------------------------------------------------- @@ -92,11 +94,24 @@ public: void BeginLayoutSwitch(); void Cancel(); - + TBool LayoutSwitchEffectsExist(); + void EnableSafeCounter(TBool aEnable) + { + if (iRosterFreezeEndTimer) + { + if (aEnable) + { + iRosterFreezeEndTimer->iSafeCounter = 0; + } + else + { + iRosterFreezeEndTimer->iSafeCounter = KErrNotFound; + } + } + } private: AknTransEffect::TContext NextLayoutSwitchContext(); void SetLayoutSwitchEffect(AknTransEffect::TContext aContext); - TBool LayoutSwitchEffectsExist(); private: // Data @@ -104,7 +119,7 @@ AknTransEffect::TContext iLayoutSwitchEffectContext; TThreadPriority iOriginalPriority; CAlfRosterFreezeEndTimer* iRosterFreezeEndTimer; - }; + }; // --------------------------------------------------------- // Effects states are used for effects request that arrive before the effected @@ -160,16 +175,18 @@ void ConstructL(TInt aAction, RMemReadStream& aStream); - TBool ResetTimerL(CAlfBridge* aBridge); + TBool InitDelayedEffectL(CAlfBridge* aBridge, TSize aDisplaySize); void NotifyDrawingTimeout(); // Information from BeginFullScreen TInt iType; - TInt iWg1; - TInt iWg2; + TInt iToWg; + TInt iFromWg; TInt iToAppId; TInt iFromAppId; + TInt iToSecureId; + TInt iFromSecureId; TRect iRect; // ETrue if waiting for window group to appear @@ -182,7 +199,7 @@ // used for resolving the iCleanupStackItem that holds the frozen app layout underneath the starting application TInt iAppStartScreenshotItemHandle; - RRegion iPaintedRegion; + enum TEffectType { ENotDefinedEffect = 0, @@ -191,8 +208,17 @@ }; TEffectType iEffectType; + + // Display dimension, iPaintedRegion is clipped to this when determining, if there is enough drawing to the group TSize iDisplaySize; + + // gathers the painted region for the effected application. When enough region has been painted, the effect is forced. + RRegion iPaintedRegion; + CAlfBridge* iBridge; // for callback. not own. + // If the visual is shown by some other visual by a screenshot, this is set ETrue. + TBool iCanDestroyOrHideImmediately; + CPeriodic* iDrawingCompleteTimer; }; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Inc/alfhierarchymodel.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfhierarchymodel.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfhierarchymodel.h Mon Mar 15 12:43:37 2010 +0200 @@ -162,6 +162,7 @@ void DoNodeWindowGroupChainedL(); void DoNodeWindowGroupChainBrokenAfterL(); void DoNodeAttributeChangedL(); + void DoNodeSetWindowAreaL(); void DoNodeDebugTrackL(); void DoNodeFadeAllChildrenL(); private: // from bridge diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Inc/alfnodes.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfnodes.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfnodes.h Mon Mar 15 12:43:37 2010 +0200 @@ -370,7 +370,8 @@ TInt aScreenNumber ); void MoveToWindowGroup( TUint32 aNewGroupId ); - + void SetWindowAreaL( RMemReadStream* aStream ); + protected: void ConstructL( CAlfHierarchyModel* aModel, RMemReadStream* aStream ); diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerconsts.h Mon Mar 15 12:43:37 2010 +0200 @@ -38,7 +38,11 @@ EAlfBridgerBlindSend, EAlfSetScreenRotation, EAlfGetNativeWindowHandles, - EAlfSynchronize + EAlfSynchronize, + EAlfPostDataToCompositionClient, + EAlfPostDataToCompositionTarget, + EAlfGetListOfWGsHavingInactiveSurfaces, + EAlfQueueRequestBGSessions }; enum TAlfCompOps{ @@ -65,7 +69,9 @@ KAlfCompositionWServScreenNumber, KAlfCompositionSourceScreenNumber, KAlfCompositionGoodOnGraphicsMemory, - KAlfCompositionTargetVisible + KAlfCompositionTargetVisible, + KAlfCompositionTargetHiddenBGAnim, + KAlfCompositionTargetVisibleBGAnim, }; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfstreamerserver.h Mon Mar 15 12:43:37 2010 +0200 @@ -62,6 +62,18 @@ void ValidateToken(CAlfStreamerServerSession* aSession, const RMessage2& aMessage); void FreeCompositionSessionExtents(CAlfStreamerServerSession* aSession); + + // ALF use + void CreatePermissionTokenL(TInt aAlfToken, TInt aWindowHandle, TInt aWindowGroup); + void ReleasePermissionTokenL(TInt aAlfToken); + void QueueRequestSessionsL(TInt aAlfToken, const TPtrC8& aPtr, TInt aOp); + void HandleCompositionRequestL(CAlfStreamerServerSession* aSession, TInt aOp, TPtr8& aClientBuf); + + void RemoveTargetFromInactiveSurfaces(TInt aTarget); + void AddTargetFromInactiveSurfaces(TInt aTarget); + void GetListOfWGsHavingInactiveSurfacesL(const RMessage2& aMessage, TBool aActiveAlso = ETrue); + void QueueRequestBGAnimSessionsL(const TPtrC8& aPtr, TInt aOp); + private: void ConstructL(); @@ -73,6 +85,10 @@ CAlfStreamerServerSession* WservSession(TInt aScreenNumber); + TInt SearchCommonEntryForToken(const RMessage2& aMessage); + CAlfStreamerServerSession* SearchSessionForToken(TInt aToken); + + private: CAlfStreamerBridge* iBridge; // not owned mutable TUint iSessions; @@ -84,15 +100,15 @@ RPointerArray iCompositionHostSessions; RPointerArray iWindowServerSessions; - class CCompositionToken : public CBase - { - public: + class TCompositionToken + { + public: /* * CCompositionToken is used by CAlfCompositionSource and CAlfCompositionHost * for maintaining layer sharing permissions. */ - CCompositionToken( TInt aKey, TInt aSecretKey, TInt aFlags, TInt aTarget, TInt aScreenNumber, TBool aCombinedTarget = EFalse) : + TCompositionToken( TInt aKey, TInt aSecretKey, TInt aFlags, TInt aTarget, TInt aScreenNumber, TBool aCombinedTarget = EFalse) : iKey(aKey), iSecretKey(aSecretKey), iFlags(aFlags), @@ -106,10 +122,25 @@ TInt iTarget; TInt iScreenNumber; TBool iCombinedTarget; + TInt iAlfKey; + }; - RArray iCompositionTokens; + RArray iCompositionTokens; + CAsyncCallBack * iRendezvous; + +public: + struct TAlfCompParams + { + TInt iTarget; + TInt iTarget2; // padding actually + TInt iWindowHandle; + TInt iWindowGroup; + }; + + RArray iAlfTargets; + RArray iInactiveSurfaces; }; NONSHARABLE_CLASS(CAlfStreamerServerSession): public CSession2 @@ -129,6 +160,8 @@ void SetScreenNumber(TInt aScreennumber); TInt ScreenNumber() const; TSurfaceId& ExtentSurfaceId(); + TInt& AlfToken(){ return iAlfToken; } + TBool IsBgAnimSession(){return iIsBgAnimSession;} private: RArray iLoadedPlugins; @@ -143,7 +176,9 @@ // Surface id of the composition client. If composition client has set extent to some other screen than where its actual window is. // This is used to identify layers created for this composition client - TSurfaceId iExtentSurfaceId; + TSurfaceId iExtentSurfaceId; + TInt iAlfToken; + TBool iIsBgAnimSession; }; #endif diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Inc/alfwindow.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfwindow.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfwindow.h Mon Mar 15 12:43:37 2010 +0200 @@ -255,6 +255,39 @@ * @param Duration to new opacity value */ IMPORT_C void SetOpacity(TReal32 aOpacity, TUint aDuration = 0) __SOFTFP; + + /** + * Window area + * @param aOrigin origin of shape. + * @param aRegion window shape. + */ + void SetWindowArea(const TPoint& aOrigin, const TRegion& aRegion); + + /** + * Reset current window area. + */ + void SetWindowArea(); + + /** + * Set transparency alpha channel. + * @param aActive ETrue if transparency alpha channel enabled, EFalse if not. + */ + void SetTransparencyAlphaChannel(TBool aActive); + + /** + * Returns transparency alpha channel. + */ + TBool TransparencyAlphaChannel() const; + + /** + * Returns ETrue if included to visibility calculation. EFalse otherwise. + */ + TBool IsIncludedToVisibilityCalculation() const; + + /** + * Include to visibility calculation. + */ + void IncludeToVisibilityCalculation(TBool aActive); public: // utils @@ -356,6 +389,9 @@ TAlfWindowCommandBufferAttributes* CreateWindowCommandBufferAttributes(TInt& aIndex); + TAny* CreateSetWindowAreaL(TInt& aOffset, TInt aScreenNumber, + const TPoint& aOrigin, const TRegion& aRegion); + void CreateInBufferL(); private: diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Inc/alfwindowdata.h --- a/uiacceltk/hitchcock/ServerCore/Inc/alfwindowdata.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Inc/alfwindowdata.h Mon Mar 15 12:43:37 2010 +0200 @@ -54,6 +54,12 @@ // was not set inactive because was reserved, // should be set inactive as soon as is reserved. TInt iFlags; + + RRegion iWindowArea; + TPoint iWindowAreaOrigin; + + TBool iTransparencyAlphaChannel; + TBool iIncludeToVisibilityCalculation; }; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfappserver.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -1448,3 +1448,20 @@ return sessionAboveGivenWgId; } +CAlfAppSrvSessionBase* CAlfAppServer::SrvSessionForControlGroup(CHuiControlGroup& aGroup) + { + CAlfAppSrvSessionBase* result = NULL; + iSessionIter.SetToFirst(); + while (iSessionIter) + { + CAlfAppSrvSessionBase* session = reinterpret_cast(iSessionIter++); + if ( session->GetHandleFromInterface(EHuiObjectTypeControlGroup, &aGroup) != KErrNotFound ) + { + result = session; + break; + } + } + return result; + } + + diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfappsrvsession.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -364,9 +364,10 @@ { iAnimatedTextures.operator[](index)->EnableAnimation(EFalse); } - +#ifndef SYMBIAN_BUILD_GCE StoreControlGroupOrderL(*display, EFalse ); // do not hide - // background must be drawn as long as the effect is displayed +#endif + // background must be drawn as long as the effect is displayed // as the background will be visible if the effect does not cover full screen // or is partially transparent. } @@ -421,6 +422,7 @@ iControlGroupOrder.AppendL( &group ); } } + // at the end the lowest index the bottom most and the biggest index the top most. // hide at the end so it does not affect the order of the group in the roster @@ -429,7 +431,7 @@ for ( TInt i = 0 ; i < iControlGroupOrder.Count() ; i++ ) { CHuiLayout* hostContainer = iControlGroupOrder[i]->Control(0).ContainerLayout( NULL ); - hostContainer->iOpacity.Set(0.f); + aDisplay.Roster().Hide( *iControlGroupOrder[i] ); } } @@ -437,6 +439,22 @@ void CAlfAppSrvSession::ShowControlGroupsInOrderL(CHuiDisplay& aDisplay) { +#ifdef SYMBIAN_BUILD_GCE + iControlGroupOrder.Reset(); + // gather all the control groups that belong to this session + for ( TInt g = 0 ; g < aDisplay.Roster().Count() ; g++ ) + { + // first append the bottom one + CHuiControlGroup& group = aDisplay.Roster().ControlGroup( g ); + + // make sure we only store control groups for this session + if ( GetHandleFromInterface(EHuiObjectTypeControlGroup, &group) != KErrNotFound ) + { + iControlGroupOrder.AppendL( &group ); + } + } +#endif + // put this session's controlgroups on top while ( iControlGroupOrder.Count() ) { CHuiControlGroup& group = *iControlGroupOrder[iControlGroupOrder.Count()-1]; @@ -445,9 +463,11 @@ if ( GetHandleFromInterface(EHuiObjectTypeControlGroup, &group) != KErrNotFound ) { CHuiLayout* hostContainer = group.Control(0).ContainerLayout( NULL ); - hostContainer->iOpacity.Set(1.f); + #ifdef SYMBIAN_BUILD_GCE - AlfAppUi()->ShowControlGroupL(aDisplay.Roster(), group, KAlfRosterShowAtBottom, 0); + + AlfAppUi()->ShowControlGroupL(aDisplay.Roster(), group, KHuiRosterShowAtTop, 0); + #else aDisplay.Roster().ShowL( group, KAlfRosterShowAtBottom ); #endif @@ -664,7 +684,10 @@ if (iFocused) { #ifdef SYMBIAN_BUILD_GCE - AlfAppUi()->ShowControlGroupL(display.Roster(), controlGroup, where, 0); + CHuiLayout* hostContainer = controlGroup.Control(0).ContainerLayout( NULL ); + if(hostContainer) + hostContainer->ClearFlags( EHuiVisualFlagUnderOpaqueHint); + AlfAppUi()->ShowControlGroupL(display.Roster(), controlGroup, where, 0); #else display.Roster().ShowL(controlGroup, where); #endif @@ -672,10 +695,16 @@ *CHuiStatic::RootWin(), ClientWindowGroup(), PreferredWindowGroupPosition() ); - } else - { + { +#ifdef SYMBIAN_BUILD_GCE + CHuiLayout* hostContainer = controlGroup.Control(0).ContainerLayout( NULL ); + if(hostContainer) + hostContainer->ClearFlags(EHuiVisualFlagUnderOpaqueHint); + AlfAppUi()->ShowControlGroupL(display.Roster(), controlGroup, where, 0); +#else + if (where == KHuiRosterShowAtTop) { if (iControlGroupOrder.Count()) @@ -689,6 +718,7 @@ } else if (where == KHuiRosterShowAtBottom) { + iControlGroupOrder.AppendL(&controlGroup); } else @@ -701,7 +731,8 @@ { iControlGroupOrder.InsertL(&controlGroup, where); } - } + } +#endif } break; @@ -1024,6 +1055,24 @@ EnvForceSwRendering( aMessage ); break; } + + case EAlfGetSizeAndRotation: + { + EnvGetSizeAndRotation( aMessage ); + break; + } + + case EAlfReadPixels: + { + EnvReadPixels( aMessage ); + break; + } + + case EAlfBlankScreen: + { + AlfAppUi()->DoBlankScreen(aMessage); + break; + } default: @@ -1187,6 +1236,12 @@ // hide controlGroupSubSession.SetIsShown( EFalse ); + +#ifdef SYMBIAN_BUILD_GCE + CHuiLayout* hostContainer = controlGroup.Control(0).ContainerLayout( NULL ); + if(hostContainer) + hostContainer->SetFlags(EHuiVisualFlagUnderOpaqueHint); +#else // hide from the roster only if session is focused if ( iFocused ) { @@ -1200,6 +1255,7 @@ iControlGroupOrder.Remove( index ); } } +#endif } // --------------------------------------------------------------------------- @@ -2834,4 +2890,45 @@ aMessage.Complete( err ); } +// --------------------------------------------------------------------------- +// EnvGetSizeAndRotation +// --------------------------------------------------------------------------- +// +void CAlfAppSrvSession::EnvGetSizeAndRotation(const RMessage2& aMessage) + { + TPckgBuf size; + TPckgBuf rotation; + TInt err = AlfAppUi()->GetSizeAndRotation(size(), rotation()); + if ( err == KErrNone ) + { + aMessage.Write(0, size); + aMessage.Write(1, rotation); + } + aMessage.Complete( err ); + } + +// --------------------------------------------------------------------------- +// EnvReadPixels +// --------------------------------------------------------------------------- +// +void CAlfAppSrvSession::EnvReadPixels(const RMessage2& aMessage) + { + TInt bitmapHandle = aMessage.Int0(); + CFbsBitmap* bmp = new CFbsBitmap; + TInt err = KErrNoMemory; + + if ( bmp ) + { + err = bmp->Duplicate( bitmapHandle ); + if ( err == KErrNone ) + { + err = AlfAppUi()->ReadPixels( bmp ); + } + delete bmp; + } + + aMessage.Complete( err ); + } + + // End of file diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfappui.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -36,6 +36,8 @@ #include #include #include +#include +#include "alfeffectutils.h" #ifdef ALF_USE_CANVAS #include @@ -518,7 +520,7 @@ #endif // This is a workaround for possibly missing command buffers at layout switch - iWsSession.ClearAllRedrawStores(); + // iWsSession.ClearAllRedrawStores(); __ALFLOGSTRING2("ALF EventWin: Size(%d,%d)", iWindow->Size().iWidth, iWindow->Size().iHeight ); //and fall through @@ -641,8 +643,6 @@ CHuiDisplay* iMainDisplay; CHuiDisplay* iTVDisplay; CAlfEventBridge* iEventAo; - RAlfTfxClient iDsServer; - TBool iDsActivated; }; // ======== MEMBER FUNCTIONS ======== @@ -980,7 +980,7 @@ { if (iData->iMainDisplay) // TBD: multiple display support once again... { - iData->iMainDisplay->SetClearBackgroundL(CHuiDisplay::EClearNone); + TRAP_IGNORE(iData->iMainDisplay->SetClearBackgroundL(CHuiDisplay::EClearNone)); } } } @@ -1406,26 +1406,6 @@ // void CAlfAppUi::NotifyLowMemory(TInt aAmountOfFreeMemRequested) { - if (!iData->iDsActivated) - { - if (iData->iDsServer.Open() == KErrNone) - { - iData->iDsActivated = ETrue; - } - } - - if (iData->iDsActivated ) - { - if (!aAmountOfFreeMemRequested) - { - iData->iDsServer.SendSynch(KAlfCompositionGoodOnGraphicsMemory, TIpcArgs()); - } - else - { - iData->iDsServer.SendSynch(KAlfCompositionLowOnGraphicsMemory, TIpcArgs()); - } - } - /* // Toggle between normal & low memory levels if (!aAmountOfFreeMemRequested) @@ -1458,8 +1438,76 @@ return iData->iBridgeObj->ForceSwRendering( aEnabled ); } +// --------------------------------------------------------------------------- +// GetSizeAndRotation +// --------------------------------------------------------------------------- +// +TInt CAlfAppUi::GetSizeAndRotation(TSize& aSize, TInt& aRotation) + { + return iData->iBridgeObj->GetSizeAndRotation(aSize, aRotation); + } + +// --------------------------------------------------------------------------- +// ReadPixels +// --------------------------------------------------------------------------- +// +TInt CAlfAppUi::ReadPixels(CFbsBitmap* aBitmap) + { + return iData->iBridgeObj->ReadPixels(aBitmap); + } + void CAlfAppUi::SetAlfAppWindowGroup( TInt aID ) { iData->iBridgeObj->SetWindowGroupAsAlfApp( aID ); } + +CAlfAppSrvSessionBase* CAlfAppUi::SrvSessionForControlGroup(CHuiControlGroup& aGroup) + { + return iData->iServer->SrvSessionForControlGroup(aGroup); + } + +void CAlfAppUi::DoBlankScreen(const RMessage2& aMessage) + { + __ALFLOGSTRING("CAlfAppUi::DoBlankScreen >>"); + TSecureId capServerId(0x10207218); + TSecurityPolicy policy(capServerId); + if (!policy.CheckPolicy(aMessage)) + { + User::Leave(KErrPermissionDenied); + } + + if (iData->iBridgeObj->LayoutSwitchEffectCoordinator()) + { + iData->iBridgeObj->LayoutSwitchEffectCoordinator()->EnableSafeCounter(EFalse); // let capserver rule + } + + TBool pause = aMessage.Int0(); + if ( pause && + CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff ) && + iData->iBridgeObj->LayoutSwitchEffectCoordinator() && + iData->iBridgeObj->LayoutSwitchEffectCoordinator()->LayoutSwitchEffectsExist() + ) + { // don't pause if effects are there, releasing the blanker needs to be allowed still + __ALFLOGSTRING("CAlfAppUi::DoBlankScreen << - Effects on"); + return; + } + + if (pause != iData->iHuiEnv->iPauseDrawing) + { + iData->iHuiEnv->iPauseDrawing = pause; + __ALFLOGSTRING1("CAlfAppUi::DoBlankScreen pausing %d",pause); + TRAP_IGNORE(iData->iHuiEnv->Display(0).Roster().FreezeVisibleContentL(pause)); + if (!pause) + { // make sure that toolkit will traverse through scene + iData->iHuiEnv->StartRefresh(1); + } + else + { + iData->iBridgeObj->LayoutSwitchEffectCoordinator()->Cancel(); + } + } + __ALFLOGSTRING("CAlfAppUi::DoBlankScreen <<"); + // let the session complete message + } + // end of file diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -87,10 +87,11 @@ const TReal32 KAlfVisualDefaultOpacity = 1.0f; //const TReal32 KAlfVisualDefaultOpacity = 0.5f; +const TInt KEffectCleanupDelayInMs = 10; _LIT8(KAlfWindowGroupContainerControlTag, "WGROUP"); -// #define USE_APPLICATION_ENDFULLSCREEN_TIMEOUT +#define USE_APPLICATION_ENDFULLSCREEN_TIMEOUT // This debug option shows window groups in a grid //#define ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER @@ -182,16 +183,7 @@ } #endif #endif //SYMBIAN_BUILD_GCE - // create the key for indication transition ends - // No access restrictions for starters - TInt err = RProperty::Define( KPSAlfDomain, KAlfTransitionStatus, - RProperty::EInt ); - if (!err) - { - // Initialize to no transition - RProperty::Set( KPSAlfDomain, KAlfTransitionStatus, 0 ); - } - + iEffectEndTimer = CAlfEffectEndTimer::NewL( *this ); iWindowHashArray.ReserveL( 500 ); iAlfRegisteredEffects.ReserveL(10); @@ -470,21 +462,68 @@ } // --------------------------------------------------------------------------- +// FindControlGroupBySecureId // --------------------------------------------------------------------------- // -CHuiControlGroup* CAlfBridge::FindControlGroupByAppId( TInt aAppId ) +CHuiControlGroup* CAlfBridge::FindControlGroupBySecureId( TInt aSecureId, TInt aWgId ) const { + if ( aSecureId == 0 ) + { + return NULL; + } + for ( TInt i = 0; i < iAlfScreens[0]->iControlGroups.Count(); i++ ) { - if ( iAlfScreens[0]->iControlGroups[i].iSecureId == aAppId ) + TAlfControlGroupEntry& groupEntry = iAlfScreens[0]->iControlGroups[i]; + if ( groupEntry.iSecureId == aSecureId ) { - return iAlfScreens[0]->iControlGroups[i].iControlGroup; + if ( aWgId != -1 ) + { + // match the window group as well + if ( groupEntry.iClientWindowGroupId == aWgId ) + { + // found match + return groupEntry.iControlGroup; + } + // found a matching SID, but the window group ID was incorrect. keep going... + } + else + { + // done for the day + return groupEntry.iControlGroup; + } } } return NULL; } // --------------------------------------------------------------------------- +// FindControlGroupByFullScreenToEffect +// --------------------------------------------------------------------------- +// +CHuiControlGroup* CAlfBridge::FindControlGroupByFullScreenToEffect() const + { + if ( iFullScreenEffectData ) + { + return FindControlGroupBySecureId( iFullScreenEffectData->iToSecureId, iFullScreenEffectData->iToWg ); + } + return NULL; + } + +// --------------------------------------------------------------------------- +// FindControlGroupByFullScreenFromEffect +// --------------------------------------------------------------------------- +// +CHuiControlGroup* CAlfBridge::FindControlGroupByFullScreenFromEffect() const + { + if ( iFullScreenEffectData ) + { + return FindControlGroupBySecureId( iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg ); + } + return NULL; + } + +// --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // @@ -514,7 +553,7 @@ #ifdef USE_APPLICATION_ENDFULLSCREEN_TIMEOUT if (iFullScreenEffectData && iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect) { - CHuiControlGroup *exitingGroupInEffect = FindControlGroupByAppId(iFullScreenEffectData->iToAppId); + CHuiControlGroup *exitingGroupInEffect = FindControlGroupByFullScreenToEffect(); if (exitingGroupInEffect == aGroup) { CHuiRoster& roster = iAlfScreens[0]->iDisplay->Roster(); @@ -536,8 +575,9 @@ { if (iAlfScreens[0]->iControlGroups[j].iControlGroup == nextToBecomeVisible) { - iFullScreenEffectData->iFromAppId = iAlfScreens[0]->iControlGroups[j].iSecureId; - __ALFFXLOGSTRING1("CAlfBridge::ResolveAfterEffectAppearingApplicationL - Found underneath application uid: 0x%x. Start track drawing for exit effect.", iFullScreenEffectData->iFromAppId ); + iFullScreenEffectData->iFromSecureId = iAlfScreens[0]->iControlGroups[j].iSecureId; + iFullScreenEffectData->iFromWg = iAlfScreens[0]->iControlGroups[j].iClientWindowGroupId; + __ALFFXLOGSTRING2("CAlfBridge::ResolveAfterEffectAppearingApplicationL - Found underneath application uid: 0x%x, window group: %d - Start track drawing for exit effect.", iFullScreenEffectData->iFromAppId, iFullScreenEffectData->iFromWg ); break; } } @@ -682,11 +722,12 @@ // we have received start effect for this group, but the group did not exist in alf universe at the time. hide the group. if (iFullScreenEffectData && iFullScreenEffectData->iWaitingWindowGroup - && iFullScreenEffectData->iToAppId == aSecureId) + && iFullScreenEffectData->iToSecureId == aSecureId) { + iFullScreenEffectData->iToWg = aClientWindowGroupId; CHuiControlGroup* fromGroup = NULL; CHuiLayout* fromLayout = NULL; - fromGroup = FindControlGroupByAppId(iFullScreenEffectData->iFromAppId); + fromGroup = FindControlGroupByFullScreenFromEffect(); if (fromGroup) { CHuiControl& control2 = fromGroup->Control(0); @@ -919,6 +960,8 @@ { if (aRoster.ControlGroup(i).Control(0).Role() == EAlfWindowGroupContainer) { + // increasing the count, assuming that WindowControlGroup is not in the Roster + i++; aRoster.ShowL(aGroup, i); break; } @@ -1079,18 +1122,17 @@ } } #endif - + if (!iActivated) + { + TInt err = iBridgerClient.Connect(); + iActivated = (err == KErrNone); + } + if (iAlfScreens[screenNumber]->IsVisualTreeVisibilityChanged()) { HandleVisualVisibility( screenNumber ); iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(EFalse); } - - if (!iActivated) - { - iBridgerClient.Connect(); - iActivated = ETrue; - } } } @@ -1253,6 +1295,8 @@ } TBool fullscreenCovered = EFalse; + CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; + //iActiveVisualCount = 0; iBgSurfaceFound = EFalse; //iPaintedArea = 0; @@ -1272,10 +1316,10 @@ fullscreenCovered = ETrue; } - #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF - iTempTotalActiveVisualCount = 0; - iTempTotalPassiveVisualCount = 0; - #endif + + TBool alfWindowGroupFoundVisible = EFalse; + + AMT_SET_VALUE( iVisibleVisualCount, 0 ); // skip the topmost (effect) layer, start from floating sprite group for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) @@ -1302,14 +1346,6 @@ } #endif - // Dont mess with alf control group visuals, alf session handling does it for us - // just add the rect to covered region because alf draws solid background. - if (control.Role() == EAlfSessionContainer) - { - iTempRegion.AddRect(fullscreen); - iTempRegion.Tidy(); - continue; - } // For optimization reasons, check if all visuals below in Z-order are covered if (!fullscreenCovered) @@ -1321,6 +1357,63 @@ #endif } + + // Dont mess with alf control group visuals, alf session handling does it for us + if (control.Role() == EAlfSessionContainer) + { + CHuiLayout* hostContainer = control.ContainerLayout( NULL ); + TInt flags = hostContainer->Flags(); + if (!fullscreenCovered) + { + // clear inactive flag if client has not made this controlgroup hidden + if(!(flags&EHuiVisualFlagUnderOpaqueHint)) + { + alfWindowGroupFoundVisible = ETrue; + if(iAppUi) + { + topMostAlfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup); + } + hostContainer->ClearFlags(EHuiVisualFlagInactive); + + // just add the rect to covered region because alf draws solid background + iTempRegion.AddRect(fullscreen); + iTempRegion.Tidy(); + fullscreenCovered = ETrue; + } + else // else put as inactive + { + hostContainer->SetFlags(EHuiVisualFlagInactive); + } + } + else if(!alfWindowGroupFoundVisible || flags&EHuiVisualFlagUnderOpaqueHint) + { + // this alf session control group should not be visible anymore because avkon application is on top + // -> change to inactive + hostContainer->SetFlags(EHuiVisualFlagInactive); + } + else if(!(flags&EHuiVisualFlagUnderOpaqueHint)) // alf app covers full screen + { + // check if current controlgroup belongs to same srvsession as the topmost visible alf session container + CAlfAppSrvSessionBase* alfsrvsession = NULL; + if(iAppUi) + { + alfsrvsession = iAppUi->SrvSessionForControlGroup(controlgroup); + } + if(topMostAlfSrvSession!=NULL && topMostAlfSrvSession == alfsrvsession) + { + hostContainer->ClearFlags(EHuiVisualFlagInactive); + } + else + { + hostContainer->SetFlags(EHuiVisualFlagInactive); + } + } + continue; + } + + + + if (!fullscreenCovered) { fullscreenCovered = screen->iDisplay->Roster().IsVisibleContentFrozen(); @@ -1331,7 +1424,11 @@ } TBool subTreeCovered = EFalse; - TBool hasActiveVisualsInVisualTree = HandleLayoutVisualVisibility( layout, controlgroup, control, fullscreenCovered, fullscreen, screen, subTreeCovered, IsVisualOpaque(*layout) ); + TBool hasLayers = EFalse; + TBool hasActiveVisualsInVisualTree = + HandleLayoutVisualVisibility( layout, controlgroup, control, + fullscreenCovered, fullscreen, screen, + subTreeCovered, hasLayers, IsVisualOpaque(*layout) ); TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); // If root visuals effect is marked as opaque, then add whole screen area as covered. @@ -1340,6 +1437,11 @@ fullscreenCovered = IsOpaqueEffect(layout->Effect()); } + if ( hasLayers && iActivated ) + { + HandleLayerVisibility( layout, controlgroup, control, hasActiveVisualsInVisualTree ); + } + // If we layout is active setup the fade effects. Also if it is inactive, but has been // flagged as containing fade effect, then run the setup as well so that effects which // are no more needed get removed. @@ -1364,16 +1466,19 @@ } } - if (!hasActiveVisualsInVisualTree) + TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive); + if (isLayoutActive && !hasActiveVisualsInVisualTree) { // Setting also the root visual (layout) as inactive, if it had none - // active children. This is because otherwise the Inactive checks won't - // work correctly within RosterImpl ScanDirty & ClearChanged phases. + // active children. This is because otherwise the Inactive checks won't + // work correctly within RosterImpl ScanDirty & ClearChanged phases. layout->SetFlag(EHuiVisualFlagInactive); } - else + else if(!isLayoutActive && hasActiveVisualsInVisualTree) { layout->ClearFlag(EHuiVisualFlagInactive); + layout->SetPos(fullscreen.iTl); + layout->SetSize(fullscreen.Size()); } #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER @@ -1383,29 +1488,38 @@ #endif } - if (iBgSurfaceFound) - { - if (!iInLowMemMode) + if (iActivated) + { + if (iBgSurfaceFound) { - SetLowMemory(ETrue); - iBridgerClient.SendBlind(KAlfCompositionTargetHidden, TIpcArgs()); - iInLowMemMode = ETrue; + if (!iInLowMemMode) + { + SetLowMemory(ETrue); + // Notify Bg anim + iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetHidden)); + iInLowMemMode = ETrue; + } + } + else if (iInLowMemMode) + { + SetLowMemory(EFalse); + // Notify Bg anim + iBridgerClient.SendBlind(EAlfQueueRequestBGSessions, TIpcArgs(KAlfCompositionTargetVisible)); + iInLowMemMode = EFalse; } } - else if (iInLowMemMode) - { - SetLowMemory(EFalse); - iBridgerClient.SendBlind(KAlfCompositionTargetVisible, TIpcArgs()); - iInLowMemMode = EFalse; + + if ( iSwRenderingEnabled ) + { + screen->iDisplay->SetForegroundTextureOptions( alfWindowGroupFoundVisible ); } - // 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 // would clear the screen areas where they do not really draw. if (fadeEffectInScreen) { - TBool firstFadedWindowGroupFound = EFalse; + TBool alwaysblend = EFalse; for (TInt j=0; jiDisplay->Roster().Count() - screen->FixedControlGroupCount(); j++) // skip the topmost (effect) layer { CHuiControlGroup& controlgroup = iAlfScreens[aScreenNumber]->iDisplay->Roster().ControlGroup(j); @@ -1413,7 +1527,7 @@ CHuiVisual* layout = &control.Visual(0); if (layout->Effect() && (layout->Effect()->EffectFlags() & KHuiFadeEffectFlag)) { - if (firstFadedWindowGroupFound) + if (alwaysblend) { TInt flags = layout->Effect()->EffectFlags(); flags |= KHuiFxAlwaysBlend; // Workaround for opaque layout canvasvisual. @@ -1426,18 +1540,12 @@ TInt flags = layout->Effect()->EffectFlags(); flags |= KHuiFxEnableBackgroundInAllLayers; // This forces effect to happen to background pixels that are read from surface. flags |= KHuiFxFrozenBackground; // To get optimal UI performance, we ignore changes in ALF scene when it is faded. + alwaysblend = ETrue; layout->Effect()->SetEffectFlags(flags); - } - - firstFadedWindowGroupFound = ETrue; + } } } } - - AMT_FUNC_EXC(AMT_DATA()->iActiveVisualCount = iTempTotalActiveVisualCount; - AMT_DATA()->iPassiveVisualCount = iTempTotalPassiveVisualCount; - AMT_DATA()->PrintState() - ); } TBool CAlfBridge::HandleLayoutVisualVisibility( @@ -1448,6 +1556,7 @@ TRect& aFullscreen, CAlfScreen* aScreen, TBool& aSubtreeVisible, + TBool& aHasVisualsWithLayers, TBool aChildCanBeOpaque ) { TBool visualTreeActive = EFalse; @@ -1475,9 +1584,17 @@ // For example, parent can have opacity < 1 and that affects children as well. // As another example, parent can have scaling transformation. visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); + + if (!canvasVisual->LayerExtent().IsEmpty()) + { + aHasVisualsWithLayers = ETrue; + } + if (canvasVisual->Count()) { - visualTreeActive |= HandleLayoutVisualVisibility( canvasVisual, aControlGroup, aControl, aFullscreenCovered, aFullscreen, aScreen, visualSubtreeVisible, visualIsOpaque ); + visualTreeActive |= HandleLayoutVisualVisibility( canvasVisual, aControlGroup, aControl, + aFullscreenCovered, aFullscreen, aScreen, + visualSubtreeVisible, aHasVisualsWithLayers, visualIsOpaque ); } #ifdef HUI_DEBUG_TRACK_DRAWING if ( canvasVisual->Tracking() ) @@ -1563,11 +1680,7 @@ { aScreen->iDisplay->SetDirty(); } - - #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF - iTempTotalPassiveVisualCount++; - #endif - + #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER passivevisualcount++; #endif @@ -1606,7 +1719,7 @@ if ( r == Display(0)->VisibleArea()) { // Final test. Surface must not be ALF surface, but some other surface. - CHuiControlGroup* alfControlGroup = FindControlGroupByAppId( iAlfSecureId ); + CHuiControlGroup* alfControlGroup = FindControlGroupBySecureId( iAlfSecureId ); if (alfControlGroup != &aControlGroup) { iBgSurfaceFound = ETrue; @@ -1619,15 +1732,14 @@ { canvasVisual->SetChanged(); } - #ifdef USE_MODULE_TEST_HOOKS_FOR_ALF - iTempTotalActiveVisualCount++; - #endif #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER activevisualcount++; #endif } - + + + // Finally check the area that this visual covers and add it to covered region visualIsActive = !(canvasVisual->Flags() & EHuiVisualFlagInactive); @@ -1648,6 +1760,46 @@ __ALFLOGSTRING2("Visual has painted areas: displayrect: iTl: %i, %i", visualDisplayRect.iTl.iX, visualDisplayRect.iTl.iY); __ALFLOGSTRING2("Visual has painted areas: displayrect: iBr: %i, %i", visualDisplayRect.iBr.iX,visualDisplayRect.iBr.iY); #endif +#ifndef ALF_OLD_VISIBILITY + // New visibility system takes only window shape into account. + if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) + { + if ( !canvasVisual->HasCustomShape() ) + { + TRect displayRect(canvasVisual->DisplayRect()); + ClipVisualRect(displayRect, aFullscreen); + +#ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER + __ALFLOGSTRING2("Covered rect: iTl: %i, %i", displayRect.iTl.iX, displayRect.iTl.iY); + __ALFLOGSTRING2("Covered rect: iBr: %i, %i", displayRect.iBr.iX, displayRect.iBr.iY); +#endif + + iTempRegion.AddRect(displayRect); + iTempRegion.Tidy(); + } + else + { + TRect displayRect = canvasVisual->DisplayRect(); + const TRegion& region = canvasVisual->ShapeRegion(); + TPoint delta = -canvasVisual->ShapeOrigin() + displayRect.iTl; + + for (TInt i = 0; i < region.Count(); ++i) + { + TRect coveredRect(region[i]); + coveredRect.Move(delta); + ClipVisualRect(coveredRect, aFullscreen); + +#ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER + __ALFLOGSTRING2("Covered rect: iTl: %i, %i", coveredRect.iTl.iX, coveredRect.iTl.iY); + __ALFLOGSTRING2("Covered rect: iBr: %i, %i", coveredRect.iBr.iX, coveredRect.iBr.iY); +#endif + + iTempRegion.AddRect(coveredRect); + iTempRegion.Tidy(); + } + } + } +#else for (TInt k=0; k < canvasVisual->PaintedAreaCount(); k++) { THuiCanvasPaintedArea paintArea = canvasVisual->PaintedArea(k); @@ -1673,9 +1825,13 @@ { iTempRegion.AddRect(visualDisplayRect); iTempRegion.Tidy(); - } + } +#endif } visualTreeActive |= visualIsActive; + + // iVisibleVisualCount is cleared in HandleVisualVisibility() + AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); } // for loop end : children checking loop return visualTreeActive; @@ -1685,6 +1841,79 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // +void CAlfBridge::HandleLayerVisibility( + CHuiLayout* aLayout, + CHuiControlGroup& aControlGroup, + CHuiControl& aControl, + TBool aVisible ) + { + CHuiCanvasVisual* canvasVisual = NULL; + + for (TInt i = aLayout->Count()-1; i >= 0; i--) + { + canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i)); + + if (canvasVisual->Count()) + { + HandleLayerVisibility( + canvasVisual, aControlGroup, + aControl, aVisible ); + } + + if (!canvasVisual->LayerExtent().IsEmpty()) + { + // Determine if surface is visible. + TBool surfaceWasVisible = ( canvasVisual->CanvasFlags() & EHuiCanvasFlagSurfaceVisible ); + TBool surfaceWasInvisible = ( canvasVisual->CanvasFlags() & EHuiCanvasFlagSurfaceInvisible ); + __ALFLOGSTRING2("CAlfBridge::HideTarget: %d %d", aVisible, surfaceWasVisible); + + TBool forcedUpdate = !surfaceWasVisible && !surfaceWasInvisible; + + if ( !aVisible && ( forcedUpdate || surfaceWasVisible ) ) + { + // notify surface observer that it has been hidden + __ALFLOGSTRING("CAlfBridge::HideTarget >>"); + TLex8 lex(canvasVisual->Tag()); + TInt windowId(0); + if (lex.Val(windowId) == KErrNone) + { + __ALFLOGSTRING1("CAlfBridge::HideTarget: WindowId: %d", windowId); + canvasVisual->SetCanvasFlags( EHuiCanvasFlagSurfaceInvisible ); + canvasVisual->ClearCanvasFlags( EHuiCanvasFlagSurfaceVisible ); + + iBridgerClient.SendBlind(EAlfPostDataToCompositionTarget, TIpcArgs(KAlfCompositionTargetHidden, windowId)); + iBridgerClient.SendBlind(EAlfPostDataToCompositionClient, TIpcArgs(KAlfCompositionTargetHidden, windowId)); + } + __ALFLOGSTRING("CAlfBridge::HideTarget <<"); + } + else if ( aVisible && ( forcedUpdate || surfaceWasInvisible ) ) + { + // notify surface observer that it has been hidden + __ALFLOGSTRING("CAlfBridge::ShowTarget >>"); + TLex8 lex(canvasVisual->Tag()); + TInt windowId(0); + if (lex.Val(windowId) == KErrNone) + { + __ALFLOGSTRING1("CAlfBridge::ShowTarget: WindowId: %d", windowId); + canvasVisual->ClearCanvasFlags( EHuiCanvasFlagSurfaceInvisible ); + canvasVisual->SetCanvasFlags( EHuiCanvasFlagSurfaceVisible ); + + iBridgerClient.SendBlind(EAlfPostDataToCompositionTarget, TIpcArgs(KAlfCompositionTargetVisible, windowId)); + iBridgerClient.SendBlind(EAlfPostDataToCompositionClient, TIpcArgs(KAlfCompositionTargetVisible, windowId)); + } + __ALFLOGSTRING("CAlfBridge::ShowTarget <<"); + } + else + { + // No change - ignore. + } + } + } // for loop end : children checking loop + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// void CAlfBridge::ClearCanvasVisualCommandSets(TBool aInactiveOnly) { if (!iAlfScreens.Count()) @@ -1825,6 +2054,21 @@ HandleSetWindowOpacityL( data ); break; } + case EAlfDSSetTransparencyAlphaChannel: + { + HandleSetTransparencyAlphaChannelL( data ); + break; + } + case EAlfDSIncludeToVisibilityCalculation: + { + HandleIncludeToVisibilityCalculationL( data ); + break; + } + case EAlfDSSetWindowArea: + { + HandleSetWindowAreaL( data ); + break; + } case EAlfDSRefreshCallback: { iHuiEnv->ContinueRefresh(); @@ -1915,6 +2159,11 @@ HandleGfxStopEffectsL( data ); break; } + case EAlfStopControlEffectFx: + { + HandleGfxStopControlEffectsL( data ); + break; + } case EAlfControlEffectFx: { HandleGfxControlEffectsL( data ); @@ -2135,6 +2384,7 @@ { viz = CHuiCanvasVisual::AddNewL(control, layout); } + __ALFFXLOGSTRING2("CAlfBridge::HandleNewWindowL visual: 0x%x, id 0x%x", viz, windowNodeId); AddVisual( windowNodeId, @@ -2367,6 +2617,9 @@ AMT_INC_COUNTER_IF( viz, iVisualPositionChangedCount ); AMT_SET_VALUE_IF( viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); + AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ), + iPositionMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, + windowAttributes->iPosition, EAlfModuleTestTypeBridgeChangePosition ); } // --------------------------------------------------------------------------- @@ -2397,7 +2650,10 @@ iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); AMT_INC_COUNTER_IF(viz, iVisualSizeChangedCount ); - AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); + AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); + AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ), + iSizeMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, + windowAttributes->iSize, EAlfModuleTestTypeBridgeChangeSize ); } // --------------------------------------------------------------------------- @@ -2457,6 +2713,148 @@ } // --------------------------------------------------------------------------- +// HandleSetTransparencyAlphaChannel +// --------------------------------------------------------------------------- +// +void CAlfBridge::HandleSetTransparencyAlphaChannelL( TAlfBridgerData& aData ) + { + TInt windowNodeId = aData.iInt2; + TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; + // fetch visual + CHuiVisual* viz = FindVisual(windowNodeId); + if (viz) + { +#ifdef HUI_DEBUG_TRACK_DRAWING + if ( viz->Tracking() ) + { + RDebug::Print(_L("CAlfBridge::HandleSetTransparencyAlphaChannel - Tracked visual")); + } +#endif + if ( windowAttributes->iActive ) + { + viz->ClearFlag( EHuiVisualFlagOpaqueHint ); + } + else + { + viz->SetFlag( EHuiVisualFlagOpaqueHint ); + } + + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + } + else + { + __ALFLOGSTRING("CAlfBridge::HandleSetTransparencyAlphaChannel, EAlfDSSetTransparencyAlphaChannel: Visual not found!"); + } + } + +// --------------------------------------------------------------------------- +// HandleSetWindowAreaL +// --------------------------------------------------------------------------- +// +void CAlfBridge::HandleIncludeToVisibilityCalculationL( TAlfBridgerData& aData ) + { + TInt windowNodeId = aData.iInt2; + TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; + // fetch visual + CHuiVisual* viz = FindVisual(windowNodeId); + if (viz) + { +#ifdef HUI_DEBUG_TRACK_DRAWING + if ( viz->Tracking() ) + { + RDebug::Print(_L("CAlfBridge::HandleIncludeToVisibilityCalculationL - Tracked visual")); + } +#endif + if ( windowAttributes->iWindowNodeType == EAlfWinTreeNodeClient ) + { + CHuiCanvasVisual* canvasVisual = static_cast(viz); + + if ( windowAttributes->iActive ) + { + canvasVisual->SetCanvasFlags( EHuiCanvasFlagIncludeToVisibilityCalculation ); + } + else + { + canvasVisual->ClearCanvasFlags( EHuiCanvasFlagIncludeToVisibilityCalculation ); + } + } + + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + } + else + { + __ALFLOGSTRING("CAlfBridge::HandleIncludeToVisibilityCalculationL, EAlfDSIncludeToVisibilityCalculation: Visual not found!"); + } + } + +// --------------------------------------------------------------------------- +// HandleSetWindowAreaL +// --------------------------------------------------------------------------- +// +void CAlfBridge::HandleSetWindowAreaL( TAlfBridgerData& aData ) + { + TInt windowNodeId = aData.iInt2; + TAny* ptr = (TAny*)(*iHost)->GetVarDataL( (TInt)aData.iPtr ); + + TInt screenNumber = 0; + TPoint origin; + TInt count = 0; + RRegion region; + CleanupClosePushL( region ); + + { + RMemReadStream str(ptr, 4*sizeof(TInt32)); + screenNumber = str.ReadInt32L(); + origin.iX = str.ReadInt32L(); + origin.iY = str.ReadInt32L(); + count = str.ReadInt32L(); + str.Release(); + } + + if ( count > 0 ) + { + RMemReadStream str(((TUint8*)ptr) + 4*sizeof(TInt32), 4*sizeof(TInt32)*count); + TRect rect; + for (TInt i = 0; i < count; ++i) + { + rect.iTl.iX = str.ReadInt32L(); + rect.iTl.iY = str.ReadInt32L(); + rect.iBr.iX = str.ReadInt32L(); + rect.iBr.iY = str.ReadInt32L(); + region.AddRect(rect); + } + str.Release(); + } + + + // fetch visual + CHuiVisual* viz = FindVisual(windowNodeId); + if (viz) + { +#ifdef HUI_DEBUG_TRACK_DRAWING + if ( viz->Tracking() ) + { + RDebug::Print(_L("CAlfBridge::HandleSetWindowAreaL - Tracked visual")); + } +#endif + + + CHuiCanvasVisual* canvas = static_cast(viz); + canvas->SetShape( origin, region ); + + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); + } + else + { + __ALFLOGSTRING("CAlfBridge::HandleSetWindowAreaL, EAlfDSSetWindowArea: Visual not found!"); + } + + CleanupStack::PopAndDestroy(); + } + +// --------------------------------------------------------------------------- // HandleReorderWindowL // --------------------------------------------------------------------------- // @@ -2667,17 +3065,17 @@ && iFullScreenEffectData->iEffectType != CFullScreenEffectState::ENotDefinedEffect && !iFullScreenEffectData->iEndFullScreen) { - TInt toAppUid; + + CHuiControlGroup *to_group = NULL; if (iFullScreenEffectData->iEffectType == CFullScreenEffectState::EExitEffect) { - toAppUid = iFullScreenEffectData->iFromAppId; + to_group = FindControlGroupByFullScreenFromEffect(); } else { - toAppUid = iFullScreenEffectData->iToAppId; + to_group = FindControlGroupByFullScreenToEffect(); } - CHuiControlGroup *to_group = FindControlGroupByAppId(toAppUid); // 1. if we get drawing commands after BeginFullScreen, we need to generate EndFullScreen call. // 2. only the first drawing commands will trigger EndFullScreen @@ -2685,8 +3083,10 @@ if (viz->Owner().ControlGroup() == to_group) { - iFullScreenEffectData->ResetTimerL(this); - iFullScreenEffectData->iDisplaySize = iAlfScreens[0]->Size(); + if (!iFullScreenEffectData->iDrawingCompleteTimer) + { + iFullScreenEffectData->InitDelayedEffectL(this, iAlfScreens[0]->Size()); + } THuiCanvasPaintedArea p = viz->PaintedArea(0); iFullScreenEffectData->iPaintedRegion.AddRect( p.iPaintedRect.Round() ); TRect b = iFullScreenEffectData->iPaintedRegion.BoundingRect(); @@ -2698,7 +3098,6 @@ __ALFFXLOGSTRING2("CAlfBridge::HandlePostCanvasBufferL : iBr.iX: %d, iBr.iY: %d", b.iBr.iX, b.iBr.iY); } } - // END TP HACK #endif } @@ -2712,8 +3111,8 @@ { return; } - CHuiControlGroup *to_group = FindControlGroupByAppId(aFullScreenEffectData->iToAppId); - CHuiControlGroup *from_group = FindControlGroupByAppId( aFullScreenEffectData->iFromAppId ); + CHuiControlGroup *to_group = FindControlGroupByFullScreenToEffect(); + CHuiControlGroup *from_group = FindControlGroupByFullScreenFromEffect(); CHuiLayout *to_layout = NULL; CHuiLayout *from_layout = NULL; if (!to_group) // group has been destroyed and moved to effectControlGroup for waiting the application exit effect EndFullScreen trigger @@ -2740,6 +3139,7 @@ } aFullScreenEffectData->iEndFullScreen = ETrue; + iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); } // --------------------------------------------------------------------------- @@ -2783,9 +3183,19 @@ } else { - // this prevents windows disappearing before their effect has finished - aVisual->SetFlag(EHuiVisualFlagShouldBeHidden); - aVisual->ClearFlag(EHuiVisualFlagShouldBeShown); + // this prevents windows disappearing before their effect has finished, unless it makes no difference. + // For instance, if the visual is being shown by a screenshot in some other visual, then having this visual around + // will only break the "live view" + if (iEffectCleanupStack[effectIndex].iCanDestroyOrHideImmediately && !aVisual->Effect()) + { + aVisual->ClearFlags(EHuiVisualFlagShouldBeShown | EHuiVisualFlagShouldBeHidden); + aVisual->iOpacity.Set(0.0f); + } + else + { + aVisual->SetFlag(EHuiVisualFlagShouldBeHidden); + aVisual->ClearFlag(EHuiVisualFlagShouldBeShown); + } } } } @@ -2849,7 +3259,7 @@ } #endif // Uses opacity for now - SetWindowActiveL(viz, windowAttributes->iActive); + SetWindowActiveL(viz, windowAttributes->iActive); } else { @@ -2865,6 +3275,13 @@ } } iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + + AMT_INC_COUNTER( iTotalVisualFlagChangedCount ); + AMT_INC_COUNTER_IF( windowAttributes->iActive, iActiveVisualCount ); + AMT_INC_COUNTER_IF( !windowAttributes->iActive, iPassiveVisualCount ); + AMT_MAP_INC_VALUE_IF( ( iWindowHashArray.Find( windowNodeId ) ), + iIntMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, + EAlfModuleTestTypeBridgeChangeFlag ); } @@ -3068,7 +3485,11 @@ } else { - viz->SetClearBackground(CHuiDisplay::EClearNone); + viz->SetClearBackground(CHuiDisplay::EClearNone); + + // Force update + viz->ClearCanvasFlags( EHuiCanvasFlagSurfaceInvisible ); + viz->ClearCanvasFlags( EHuiCanvasFlagSurfaceVisible ); } } else @@ -3688,6 +4109,7 @@ TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout) { + __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction); TInt err = KErrNone; TBool failed = EFalse; @@ -3718,6 +4140,7 @@ if (err == KErrNone) { aToLayout->SetFreezeState(ETrue); + aEvent.iCanDestroyOrHideImmediately = ETrue; // if children of this layout are hidden or destroyed during effect, that can happen immediately } else { @@ -3727,23 +4150,17 @@ switch(aEvent.iAction) { + case AknTransEffect::EApplicationActivate: case AknTransEffect::EApplicationStart: case AknTransEffect::EApplicationStartRect: + case AknTransEffect::EApplicationStartSwitch: + case AknTransEffect::EApplicationStartSwitchRect: { - aToLayout->iOpacity.Set(0.0f); // these are meant for applications that yet dont have anything to show + aToLayout->iOpacity.Set(0.0f); // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); aEvent.iEffectType = CFullScreenEffectState::EStartEffect; break; } - case AknTransEffect::EApplicationStartSwitch: - case AknTransEffect::EApplicationStartSwitchRect: - { - aToLayout->iOpacity.Set(0.0f); // this is meant for applications that are in the background. - FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); - aEvent.iEffectType = CFullScreenEffectState::EStartEffect; - break; - } - case AknTransEffect::EApplicationExit: { aEvent.iEffectType = CFullScreenEffectState::EExitEffect; @@ -3766,7 +4183,7 @@ { // this will tag the visual, that they cannot be hidden by HandleVisualVisibility // Initialize layout for the exit effect - iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue); + iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue, aEvent.iCanDestroyOrHideImmediately); __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullscreen - iLayoutInitializedForExitEffect: %d", iLayoutInitializedForExitEffect); aEvent.iSetupDone = iLayoutInitializedForExitEffect; } @@ -3806,7 +4223,7 @@ { // add visuals to visual cleanupstack aToLayout->SetStoredRenderBufferModificationsEnabled(EFalse); - layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse); + layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse, aEvent.iCanDestroyOrHideImmediately); aEvent.iSetupDone = layoutEffectable; aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); } @@ -3896,8 +4313,8 @@ // back if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) { - RemoveEffectFromApp(fxData->iToAppId); - RemoveEffectFromApp(fxData->iFromAppId); + RemoveEffectFromApp(fxData->iToSecureId, fxData->iToWg ); + RemoveEffectFromApp(fxData->iFromSecureId, fxData->iFromWg ); } else { @@ -3917,13 +4334,24 @@ __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END"); } -void CAlfBridge::RemoveEffectFromApp(TInt aAppUid) +void CAlfBridge::RemoveEffectFromApp(TInt aSecureId, TInt aWgId ) { - if(aAppUid <= 0) + if(aSecureId == 0) { return; } - CHuiControlGroup* group = FindControlGroupByAppId(aAppUid); + CHuiControlGroup* group = NULL; + if ( aWgId > 0 ) + { + // check with the specific window gruop + group = FindControlGroupBySecureId(aSecureId, aWgId); + } + else + { + // any window gruop will do + group = FindControlGroupBySecureId(aSecureId); + } + if (group) { CHuiControl& control = group->Control(0); @@ -3992,8 +4420,8 @@ if (iFullScreenEffectData && iFullScreenEffectData->iToAppId != fxData->iToAppId) { __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - WARNING - Another fullscreen effect to different app. Deleting the previous ongoing effect"); - RemoveEffectFromApp(iFullScreenEffectData->iToAppId);// Fullscreen effect for another app has arrived, and the previous has not finished and abort effect was not called. - RemoveEffectFromApp(iFullScreenEffectData->iFromAppId); + RemoveEffectFromApp(iFullScreenEffectData->iToSecureId, iFullScreenEffectData->iToWg);// Fullscreen effect for another app has arrived, and the previous has not finished and abort effect was not called. + RemoveEffectFromApp(iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg); // Fullscreen effect for another } @@ -4046,8 +4474,8 @@ fxData->iOperation = operation; fxData->iWaitingWindowGroup = EFalse; - __ALFFXLOGSTRING3("Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType); - __ALFFXLOGSTRING2("wg1: %d, wg2: %d", fxData->iWg1, fxData->iWg2); + __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEffectsL - Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType); + __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - towg: %d, fromwg: %d", fxData->iToWg, fxData->iFromWg); // find root nodes and attach effects to them // First we need a windowgroup node id. So far we have a list of window ids @@ -4081,29 +4509,17 @@ // depending on if we have an application that is already running or not // TAlfControlGroupEntry* alfGroup = NULL; - // TODO: - //wg1 = (*iHost)->FindWgForAppUid(TUid::Uid(toAppId1)); - //if (!wg1 && action != AknTransEffect::EApplicationExit ) - // { - // // window group is not available yet, but it will be created in short while. - // iEffectWaitingWindowgroup.Append(toAppId1); - // } - // TODO: when ids available from wserv... - // if ( appUid1 ) - //{ - // group1 = FindControlGrouAppUId( appUid1, screen1, &alfGroup ); - // } TBool failed = EFalse; if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) { CHuiControlGroup* toGroup = NULL; CHuiLayout* toLayout = NULL; - toGroup = FindControlGroupByAppId(fxData->iToAppId); + toGroup = FindControlGroupByFullScreenToEffect(); CHuiControlGroup* fromGroup = NULL; CHuiLayout* fromLayout = NULL; - fromGroup = FindControlGroupByAppId(fxData->iFromAppId); + fromGroup = FindControlGroupByFullScreenFromEffect(); if (!toGroup) // group has been destroyed and moved to effectControlGroup for waiting the application exit effect EndFullScreen trigger { @@ -4183,6 +4599,27 @@ __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEffectsL - end"); } +void CAlfBridge::HandleGfxStopControlEffectsL(TAlfBridgerData data) + { + TInt length = data.iInt2; + __ALFFXLOGSTRING1("CAlfBridge::HandleGfxStopControlEffectsL - Reading bridge data %d", (TInt)data.iPtr); + void* bridgeBuffer = (void*) (*iHost)->GetEffectsDataL( (TInt)data.iPtr ); + RMemReadStream stream( bridgeBuffer, length ); + + TInt operation = stream.ReadInt32L(); + TInt handle = stream.ReadInt32L(); + stream.Release(); + + if (handle != KErrNotFound) + { + __ALFFXLOGSTRING1("CAlfBridge::HandleGfxStopControlEffectsL - Remove effect with handle: %d", handle); + RemoveTemporaryPresenterVisual(NULL, handle); + iHuiEnv->ContinueRefresh(); + } + __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopControlEffectsL - end"); + } + + void CAlfBridge::HandleRegisterEffectL( TAlfBridgerData data ) { TInt action = data.iInt1; @@ -4238,12 +4675,13 @@ CHuiControl* aEffectControl, TBool aInsertTemporaryVisual, TInt& aItemDestroyed, - TBool aIsExitEffect) + TBool aIsExitEffect, + TBool aCanDestroyOrHideImmediately) { CHuiCanvasVisual* temporaryPresenterVisual = NULL; TInt enableEffect = ETrue; - if (aSourceVisual->iOpacity.Now() >= 0.01) + if (aSourceVisual->iOpacity.Now() >= 0.01 && !(aSourceVisual->Flags() & EHuiVisualFlagShouldBeHidden)) { aSourceVisual->SetFlag(EHuiVisualFlagShouldBeShown); } @@ -4287,7 +4725,8 @@ aSourceVisual, temporaryPresenterVisual, ETrue, - aIsExitEffect); + aIsExitEffect, + aCanDestroyOrHideImmediately); iEffectCleanupStack.AppendL(item); } else @@ -4296,7 +4735,8 @@ // aSourceVisual->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent); TEffectCleanupStruct item = TEffectCleanupStruct(aEffectHandle, aSourceVisual, NULL, EFalse, - aIsExitEffect); + aIsExitEffect, + aCanDestroyOrHideImmediately); iEffectCleanupStack.AppendL(item); } } @@ -4310,12 +4750,13 @@ CHuiControl* aEffectControl, TInt& aItemsDestroyed, TBool aAddLayout, - TBool aIsExitEffect) + TBool aIsExitEffect, + TBool aCanDestroyOrHideImmediately) { __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x is having %d children", aSourceLayout, aSourceLayout->Count()); if (aAddLayout) { - AddEffectItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect); + AddEffectItemL(aEffectHandle, aSourceLayout, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately); } for (TInt i = 0; i < aSourceLayout->Count(); i++) @@ -4325,16 +4766,20 @@ if (sourceVisual.Count()) { CHuiLayout& layout = static_cast (aSourceLayout->Visual(i)); - AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, EFalse,aIsExitEffect ); + AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, EFalse,aIsExitEffect, aCanDestroyOrHideImmediately ); } - AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect); + AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately); } __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x end of children", aSourceLayout, aSourceLayout->Count()); } -TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect) +TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately) { - __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - aHandle: %d, aSourceLayout: 0x%x, aIsExitEffect: % d >>", aHandle, aSourceLayout, aIsExitEffect ); + __ALFFXLOGSTRING4("CAlfBridge::SetupEffectLayoutContainerL - aHandle: %d, aSourceLayout: 0x%x, aIsExitEffect: % d, CanDestroyOrHideImmediately: %d >>", + aHandle, + aSourceLayout, + aIsExitEffect, + aCanDestroyOrHideImmediately ); if (aSourceLayout->Flags() & EHuiVisualFlagDrawOnlyAsExternalContent) { @@ -4349,17 +4794,17 @@ // CHuiCanvasVisual* temporaryPresenterLayout = CHuiCanvasVisual::AddNewL( effectControlGroup, &effectControlGroupLayout); // create presenter visual and set bindings TInt itemsDestroyed(0); - AddToEffectLayoutContainerL(aHandle, aSourceLayout, NULL, &effectControlGroup, itemsDestroyed, EFalse, aIsExitEffect); + AddToEffectLayoutContainerL(aHandle, aSourceLayout, NULL, &effectControlGroup, itemsDestroyed, EFalse, aIsExitEffect, aCanDestroyOrHideImmediately); if (aIsExitEffect) { - CHuiCanvasVisual* temporaryPresenterVisual = AddEffectItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, aIsExitEffect); + CHuiCanvasVisual* temporaryPresenterVisual = AddEffectItemL(aHandle, aSourceLayout, &effectControlGroupLayout, &effectControlGroup, ETrue, itemsDestroyed, aIsExitEffect, EFalse); aSourceLayout->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent); __ALFFXLOGSTRING3("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout)-> 0x%x (presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout, temporaryPresenterVisual); } else { - AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, EFalse); + AddEffectItemL(aHandle, aSourceLayout, NULL, &effectControlGroup, EFalse, itemsDestroyed, EFalse, EFalse); __ALFFXLOGSTRING2("CAlfBridge::SetupEffectLayoutContainerL - adding handle: %d, 0x%x (source layout), NO presenter layout) to iEffectCleanupStack", aHandle, aSourceLayout); } iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; @@ -4372,31 +4817,6 @@ return ETrue; // TBool(!itemsDestroyed); } -void CAlfBridge::SetupEffectContainerL(TInt aHandle, - CHuiCanvasVisual* aSourceVisual, TBool aIsExitEffect) - { - // if the original visual is having an effect, then remove it. - if (HasActiveEffect(aSourceVisual)) - { - RemoveTemporaryPresenterVisual(aSourceVisual); - } - - // Create new temporary presenter visual for the effect - CHuiControl& effectControlGroup = - iAlfScreens[0]->iFullscreenEffectControlGroup->Control(0); - CHuiLayout* layout = (CHuiLayout*) &effectControlGroup.Visual(0); - CHuiCanvasVisual* temporaryPresenterVisual = NULL; - temporaryPresenterVisual = CHuiCanvasVisual::AddNewL(effectControlGroup, layout); - // attach the source to the presenter visual - temporaryPresenterVisual->SetExternalContentL(aSourceVisual); - aSourceVisual->SetFlag(EHuiVisualFlagDrawOnlyAsExternalContent); - temporaryPresenterVisual->ClearFlag(EHuiVisualFlagInactive); - aSourceVisual->SetChanged(); - // append to cleanup stack. this is cleaned in RemoveTemporaryVisuals after effect has finished - iEffectCleanupStack.AppendL(TEffectCleanupStruct(aHandle, aSourceVisual, temporaryPresenterVisual, EFalse /*iIsLayout*/, aIsExitEffect)); - __ALFFXLOGSTRING3("CAlfBridge::SetupEffectContainerL - adding handle: %d, 0x%x (source visual)-> 0x%x (presenter visual)", aHandle, aSourceVisual, temporaryPresenterVisual); - } - void CAlfBridge::HandleGfxControlEffectsL( TAlfBridgerData data ) { TInt action = data.iInt1; @@ -4462,9 +4882,9 @@ if (engine) { // clear out old effect if this visual has one - __ALFFXLOGSTRING1("HandleGfxControlEffectsL - loading effect %S", &aEvent.iEffectName ); + __ALFFXLOGSTRING2("HandleGfxControlEffectsL - loading effect %S on visual 0x%x", aEvent.iEffectName, aCanvasVisual ); __ALFFXLOGSTRING1("HandleGfxControlEffectsL - loading control effect, handle %d", aEvent.iHandle ); - if (HasActiveEffect(aCanvasVisual)) + if (aCanvasVisual->Effect()) { __ALFFXLOGSTRING1("HandleGfxControlEffectsL - 0x%x has active effect. Requesting removal.", aCanvasVisual); // another effect coming to already effected visual. E.g. close options menu, while opening effect still ongoing @@ -4484,11 +4904,11 @@ aCanvasVisual->iOpacity.Set(KAlfVisualDefaultOpacity); // visual->SetFlag(EHuiVisualFlagShouldBeHidden); }*/ - layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, ETrue); + layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, ETrue, EFalse); } else { - layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse); + layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, EFalse); } if (layoutEffectable) { @@ -4552,7 +4972,7 @@ if (showVisual) { sourceViz->iOpacity.Set(KAlfVisualDefaultOpacity); - sourceViz->ClearFlag(EHuiVisualFlagShouldBeShown); // it is now hidden + sourceViz->ClearFlag(EHuiVisualFlagShouldBeShown); // it is now shown } if (destroyVisual) @@ -4632,9 +5052,6 @@ } else { - TLex8 lex(sourceViz->Tag()); - TInt nodeId; - lex.Val(nodeId); DestroyWindow(sourceViz, ETrue); } } @@ -4715,7 +5132,7 @@ return iEffectCleanupStack[i].iHandle; } } - __ALFFXLOGSTRING1(" CAlfBridge::SetupEffectLayoutContainerL - Could not find handle for 0x%x", aVisual); + __ALFFXLOGSTRING1("CAlfBridge::FindEffectHandle - Could not find handle for 0x%x", aVisual); return KErrNotFound; } @@ -4743,13 +5160,13 @@ CHuiLayout* effectControlGroupLayout = (CHuiLayout*) &effectControlGroup.Visual(0); __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - BEGIN - effects in layout %d", effectControlGroupLayout->Count()); - while (iFinishedCleanupStackEffects.Count()) - { - for (TInt i = 0; i < iEffectCleanupStack.Count() && iFinishedCleanupStackEffects.Count(); i++) + while(iFinishedCleanupStackEffects.Count()) + { + for (TInt i = 0; i < iEffectCleanupStack.Count() ; i++) { __ALFFXLOGSTRING2("CAlfBridge::RemoveTemporaryPresenterVisuals - looping, finished count: %d, index in active effecs: %d", iFinishedCleanupStackEffects.Count(), i ); - TEffectCleanupStruct& effectItem = iEffectCleanupStack[i]; + if (iFinishedCleanupStackEffects[0] == effectItem.iHandle) { if (RemoveTemporaryPresenterItem(effectItem)) @@ -4759,12 +5176,19 @@ if (iEffectCleanupStack.Count() > i) { iEffectCleanupStack.Remove(i); + break; } - iFinishedCleanupStackEffects.Remove(0); - i--; } } + iFinishedCleanupStackEffects.Remove(0); + } + + if (iFinishedCleanupStackEffects.Count()) + { + __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - There are still %d finished effects, that could not be found. They have been cleaned already. Reseting the array", iFinishedCleanupStackEffects.Count()); + iFinishedCleanupStackEffects.Reset(); } + iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; // TODO: Check if really changed iAlfScreens[0]->iDisplay->SetDirty(); __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterVisuals - END - effects in layout %d", effectControlGroupLayout->Count()); @@ -4806,7 +5230,12 @@ // iFinishedCleanupStackEffects.Append(aHandle); if (!iEffectEndTimer->IsActive()) { - iEffectEndTimer->Start( 10000, aHandle ); + iEffectEndTimer->AddFinishedHandleL(aHandle); + iEffectEndTimer->Start(KEffectCleanupDelayInMs * 1000); + } + else + { + iEffectEndTimer->AddFinishedHandleL(aHandle); } // We should do visual visibility scan after effect is ended @@ -4821,6 +5250,7 @@ { // effect might have been cleaned even without this callback. e.g. closing of applicaion while option menu disappear // effect is running, would cause it. There is no need to request cleaning again. + __ALFFXLOGSTRING2("CAlfBridge::TransitionFinishedHandlerL - Request cleaning for handle %d on visual 0x%x", aHandle, iEffectCleanupStack[i].iEffectedVisual); iFinishedCleanupStackEffects.Append(aHandle); } } @@ -5284,6 +5714,25 @@ if ( memoryLevel != iHuiEnv->MemoryLevel() ) { __ALFLOGSTRING1("CAlfBridge::DoUpdateMemoryLevel -> %d", memoryLevel); + TBool nowGoodMemory = !(memoryLevel < EHuiMemoryLevelNormal); + TBool wasGoodMemory = !(iHuiEnv->MemoryLevel() < EHuiMemoryLevelNormal); + + if (iActivated) + { + if (nowGoodMemory && !wasGoodMemory) + { + iBridgerClient.SendBlind(KAlfCompositionGoodOnGraphicsMemory, TIpcArgs()); + } + else if (!nowGoodMemory && wasGoodMemory) + { + iBridgerClient.SendBlind(KAlfCompositionLowOnGraphicsMemory, TIpcArgs()); + } + else + { + // No change. + } + } + if ( memoryLevel <= EHuiMemoryLevelLowest) { LowMemoryCancelAllEffects(); @@ -5315,6 +5764,54 @@ // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // +TInt CAlfBridge::GetSizeAndRotation(TSize& aSize, TInt& aRotation) + { + if ( !iAlfScreens.Count() ) + { + return KErrNotReady; + } + + switch (iAlfScreens[0]->iDisplay->Orientation()) + { + case CHuiGc::EOrientationCCW90: + aRotation = 1; + break; + case CHuiGc::EOrientation180: + aRotation = 2; + break; + case CHuiGc::EOrientationCW90: + aRotation = 3; + break; + case CHuiGc::EOrientationNormal: + default: + aRotation = 0; + break; + } + + aSize = iAlfScreens[0]->iDisplay->Size(); + + __ALFLOGSTRING3("CAlfBridge::GetSizeAndRotation %d x %d, rot %d", aSize.iWidth, aSize.iHeight, aRotation); + return KErrNone; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// +TInt CAlfBridge::ReadPixels(CFbsBitmap* aBitmap) + { + if ( !iAlfScreens.Count() ) + { + return KErrNotReady; + } + __ALFLOGSTRING("CAlfBridge::ReadPixels"); + TRAPD(err, iAlfScreens[0]->iDisplay->CopyScreenToBitmapL(aBitmap)); + __ALFLOGSTRING1("CAlfBridge::ReadPixels ret %d", err); + return err; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- +// void CAlfBridge::Synchronized(TInt aId) { // Use P&S for now. @@ -5350,4 +5847,269 @@ return (aVisual.Owner().ControlGroup()->ResourceId() == iAlfWindowGroupNodeId); } +// experimental +TBool CAlfBridge::IsFullScreenDrawn( TInt aOrientation) + { + if (!iAlfScreens.Count()) + return EFalse; + aOrientation = iAlfScreens[0]->iDisplay->Orientation(); + iTempRegion.Clear(); + + CAlfScreen* screen = iAlfScreens[0]; + TRect fullscreen = TRect(TPoint(0,0), screen->Size()); + TBool fadeEffectInScreen = EFalse; + + TBool fullscreenCovered = EFalse; + CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; + + //iActiveVisualCount = 0; + iBgSurfaceFound = EFalse; + //iPaintedArea = 0; + + // Check if effect group has an effect with opaque hint. + CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[0]->iFullscreenEffectControlGroup); + CHuiControl& fxcontrol = fxcontrolgroup.Control(0); + CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); + CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); + + if (fxlayout && IsOpaqueEffect(fxlayout->Effect())) + { + fullscreenCovered = ETrue; + } + else if (fxExternalContent && IsOpaqueEffect(fxExternalContent->Effect())) + { + fullscreenCovered = ETrue; + } + + + TBool alfWindowGroupFoundVisible = EFalse; + + AMT_SET_VALUE( iVisibleVisualCount, 0 ); + + // skip the topmost (effect) layer, start from floating sprite group + for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) + { + CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j); + CHuiControl& control = controlgroup.Control(0); + + if (control.Role() == EAlfFpsIndicatorContainer) + { + // FPS container doesn't contain canvas visuals + continue; + } + + CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0); + + // For optimization reasons, check if all visuals below in Z-order are covered + if (!fullscreenCovered) + { + fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); + } + + // Dont mess with alf control group visuals, alf session handling does it for us + if (control.Role() == EAlfSessionContainer) + { + CHuiLayout* hostContainer = control.ContainerLayout( NULL ); + TInt flags = hostContainer->Flags(); + if (!fullscreenCovered) + { + // clear inactive flag if client has not made this controlgroup hidden + if(!(flags&EHuiVisualFlagUnderOpaqueHint)) + { + alfWindowGroupFoundVisible = ETrue; + if(iAppUi) + { + topMostAlfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup); + } + + // just add the rect to covered region because alf draws solid background + iTempRegion.AddRect(fullscreen); + iTempRegion.Tidy(); + fullscreenCovered = ETrue; + } + } + else if(!alfWindowGroupFoundVisible || flags&EHuiVisualFlagUnderOpaqueHint) + { + // this alf session control group should not be visible anymore because avkon application is on top + // -> change to inactive + + } + else if(!(flags&EHuiVisualFlagUnderOpaqueHint)) // alf app covers full screen + { + // check if current controlgroup belongs to same srvsession as the topmost visible alf session container + CAlfAppSrvSessionBase* alfsrvsession = NULL; + if(iAppUi) + { + alfsrvsession = iAppUi->SrvSessionForControlGroup(controlgroup); + } + if(topMostAlfSrvSession!=NULL && topMostAlfSrvSession == alfsrvsession) + { + + } + else + { + + } + } + continue; + } + + __ALFLOGSTRING1("CAlfBridge::IsFullScreenDraw - fullscreen covered %d", fullscreenCovered) + TBool subTreeCovered = EFalse; + TBool hasLayers = EFalse; + TBool hasActiveVisualsInVisualTree = + IsFullScreenDrawnRecursive( layout, controlgroup, control, fullscreenCovered, fullscreen, screen,subTreeCovered, hasLayers, IsVisualOpaque(*layout), aOrientation ); + TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); + + // If root visuals effect is marked as opaque, then add whole screen area as covered. + if (!fullscreenCovered) + { + fullscreenCovered = IsOpaqueEffect(layout->Effect()); + } + // "has layers" has been removed + // If we layout is active setup the fade effects. Also if it is inactive, but has been + // flagged as containing fade effect, then run the setup as well so that effects which + // are no more needed get removed. + + TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive); + if (isLayoutActive && !hasActiveVisualsInVisualTree) + { + // Setting also the root visual (layout) as inactive, if it had none + // active children. This is because otherwise the Inactive checks won't + // work correctly within RosterImpl ScanDirty & ClearChanged phases. + + } + else if(!isLayoutActive && hasActiveVisualsInVisualTree) + { + } + if (fullscreenCovered) + { + return ETrue; + } + } + return fullscreenCovered; + } + +TBool CAlfBridge::IsFullScreenDrawnRecursive( + CHuiLayout* aLayout, + CHuiControlGroup& aControlGroup, + CHuiControl& aControl, + TBool& aFullscreenCovered, + TRect& aFullscreen, + CAlfScreen* aScreen, + TBool& aSubtreeVisible, + TBool& aHasVisualsWithLayers, + TBool aChildCanBeOpaque, + TInt aOrientation) + { + TBool visualTreeActive = EFalse; + TRect visualDisplayRect; + TBool visualRectIsCovered = EFalse; + TBool visualIsOpaque = EFalse; + TBool visualIsActive = EFalse; + CHuiCanvasVisual* canvasVisual = NULL; + + for (TInt i=aLayout->Count()-1; i >= 0; i--) + { + visualDisplayRect = TRect(0,0,0,0); + visualRectIsCovered = EFalse; + visualIsOpaque = EFalse; + visualIsActive = EFalse; + TBool visualSubtreeVisible = EFalse; + + // Check first if visual itself is hidden or does hide other visuals below + // in z-order. If it does not hide, then we do not add its displayrect to covering + // region. + canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i)); + + // Child can be considered to be opaque only if all parents are opaque and + // visual itself is opaque. + // For example, parent can have opacity < 1 and that affects children as well. + // As another example, parent can have scaling transformation. + visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); + + if (visualIsOpaque && !canvasVisual->LayerExtent().IsEmpty()) + { + aHasVisualsWithLayers = ETrue; + } + + if (canvasVisual->Count()) + { + visualTreeActive |= IsFullScreenDrawnRecursive( canvasVisual, aControlGroup, aControl,aFullscreenCovered, aFullscreen, aScreen,visualSubtreeVisible, aHasVisualsWithLayers, visualIsOpaque, aOrientation ); + } + + + if (visualSubtreeVisible) + { + aSubtreeVisible = ETrue; + } + + // Optimization, it is faster to check fullscreen than read visuals displayrect + if (aFullscreenCovered) + { + visualRectIsCovered = ETrue; + } + else + { + // add the rect only if the window contains drawing for the new orientation + visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation); + + // Make sure we clip visual rect to visible screen area + ClipVisualRect(visualDisplayRect, aFullscreen); + + // Check if this visual is covered by other opaque visuals which rects are in "covered" region + visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); + } + + // Finally check the area that this visual covers and add it to covered region + visualIsActive = !(canvasVisual->Flags() & EHuiVisualFlagInactive); + + // Sprites and effects as we consider them always as transparent and also + // if controlgroup is transformed somehow + + if (aControl.Role() == EAlfFullScreenEffectContainer + || aControl.Role() == EAlfWindowFloatingSpriteContainer || + aControlGroup.IsTransformed()) + { + visualIsOpaque = EFalse; + } + + if (visualIsActive && visualIsOpaque && !visualRectIsCovered) + { + // New visibility system takes only window shape into account. + if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) + { + if ( !canvasVisual->HasCustomShape() ) + { + TRect displayRect(canvasVisual->DisplayRect()); + ClipVisualRect(displayRect, aFullscreen); + iTempRegion.AddRect(displayRect); + iTempRegion.Tidy(); + } + else + { + TRect displayRect = canvasVisual->DisplayRect(); + const TRegion& region = canvasVisual->ShapeRegion(); + TPoint delta = -canvasVisual->ShapeOrigin() + displayRect.iTl; + + for (TInt i = 0; i < region.Count(); ++i) + { + TRect coveredRect(region[i]); + coveredRect.Move(delta); + ClipVisualRect(coveredRect, aFullscreen); + iTempRegion.AddRect(coveredRect); + iTempRegion.Tidy(); + } + } + } + } + visualTreeActive |= visualIsActive; + + // iVisibleVisualCount is cleared in HandleVisualVisibility() + AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); + } // for loop end : children checking loop + + return visualTreeActive; + } + // end of file diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfeffectutils.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -18,10 +18,11 @@ #include #include "alfeffectutils.h" #include - +#include -const TInt KRosterFreezeEndTimeoutInMs = 400; -const TInt KFirstTimeoutForApplicationEndFullScreenInMs = 50; +const TInt KRosterFreezeEndTimeoutInMs = 100; +const TInt KFirstTimeoutForApplicationEndFullScreenInMs = 20; +const TReal KMinimumPaintedAreaBeforeForcedEffect = 0.75; // --------------------------------------------------------- // CAlfRosterFreezeEndTimer @@ -55,6 +56,7 @@ void CAlfRosterFreezeEndTimer::Start( TTimeIntervalMicroSeconds32 aPeriod ) { + __ALFLOGSTRING("CAlfRosterFreezeEndTimer::Start"); if (!IsActive()) { After( aPeriod ); @@ -63,9 +65,34 @@ void CAlfRosterFreezeEndTimer::RunL() { - iBridge.iHuiEnv->Display(0).SetDirty(); - TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse)); - iBridge.SetVisualTreeVisibilityChanged(ETrue); + __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL"); + + TBool timeout = EFalse; + + if (iSafeCounter >= 0) + { + iSafeCounter++; + if (iSafeCounter == 10) + { + timeout = ETrue; + iSafeCounter = 0; + } + } + + if (!iBridge.IsFullScreenDrawn(0) && !timeout) + { + __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL - Not ready in new orientation. waiting 50ms more"); + After( 50000 ); + return; + } + else + { + __ALFLOGSTRING("CAlfRosterFreezeEndTimer::RunL - ready in new orientation. "); + iBridge.iHuiEnv->Display(0).SetDirty(); + iBridge.iHuiEnv->iPauseDrawing = EFalse; + TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(EFalse)); + iBridge.SetVisualTreeVisibilityChanged(ETrue); + } } void CAlfRosterFreezeEndTimer::DoCancel() @@ -166,15 +193,12 @@ // void CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch() { - // Hm. what to do if earlier is already in progress ? - //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch")); - if ( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest ) + if (iRosterFreezeEndTimer) { - // No effects in low memory mode - return; - } - - if (!iLayoutSwitchEffectContext) + iRosterFreezeEndTimer->Cancel(); + } + + if (!iLayoutSwitchEffectContext && !( iBridge.iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest )) { TBool tfxOn = CAknTransitionUtils::TransitionsEnabled(AknTransEffect::ELayoutswitchTransitionsOff ); TBool tfxExists = LayoutSwitchEffectsExist(); @@ -206,7 +230,6 @@ if (iRosterFreezeEndTimer) { - iBridge.iHuiEnv->Display(0).SetDirty(); TRAP_IGNORE(iBridge.iHuiEnv->Display(0).Roster().FreezeVisibleContentL(ETrue)); // Remove all other effects @@ -214,6 +237,7 @@ iBridge.RemoveAllTemporaryPresenterVisuals(); // Set remove freeze timer + __ALFLOGSTRING("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch - Freeze timer started"); iRosterFreezeEndTimer->Start(KRosterFreezeEndTimeoutInMs*1000); } //RDebug::Print(_L("CAlfLayoutSwitchEffectCoordinator::BeginLayoutSwitch - tfx are set OFF -> I am not starting effect.")); @@ -349,6 +373,7 @@ void CAlfEffectEndTimer::ConstructL() { CTimer::ConstructL(); + iHandles.ReserveL(5); CActiveScheduler::Add( this ); } @@ -363,21 +388,30 @@ CAlfEffectEndTimer::~CAlfEffectEndTimer() { - Cancel(); + Cancel(); + iHandles.Close(); } -void CAlfEffectEndTimer::Start( TTimeIntervalMicroSeconds32 aPeriod, TInt aHandle ) +void CAlfEffectEndTimer::Start( TTimeIntervalMicroSeconds32 aPeriod ) { - iHandle = aHandle; After( aPeriod ); } +void CAlfEffectEndTimer::AddFinishedHandleL(TInt aHandle) + { + iHandles.Append(aHandle); + } + void CAlfEffectEndTimer::RunL() { // // timer completes and control is returned to caller // - iBridge.TransitionFinishedHandlerL( iHandle ); + while(iHandles.Count()) + { + iBridge.TransitionFinishedHandlerL( iHandles[0]); + iHandles.Remove(0); + } // We don't become active unless we are explicitly restarted } @@ -437,13 +471,15 @@ iHandle = aStream.ReadInt32L(); iType = aStream.ReadInt32L(); - iWg1 = aStream.ReadInt32L(); - iWg2 = aStream.ReadInt32L(); + iToWg = aStream.ReadInt32L(); + iFromWg = aStream.ReadInt32L(); iToAppId = aStream.ReadInt32L(); iFromAppId = aStream.ReadInt32L(); if (iType == AknTransEffect::EParameterType) { + iToSecureId = aStream.ReadInt32L(); + iFromSecureId = aStream.ReadInt32L(); /*screen1 =*/aStream.ReadInt32L(); /*screen2 =*/aStream.ReadInt32L(); } @@ -465,9 +501,10 @@ return 0; // must return something } -TBool CFullScreenEffectState::ResetTimerL(CAlfBridge* aBridge) +TBool CFullScreenEffectState::InitDelayedEffectL(CAlfBridge* aBridge, TSize aDisplaySize) { iBridge = aBridge; + iDisplaySize = aDisplaySize; if (!iDrawingCompleteTimer) { iDrawingCompleteTimer = CPeriodic::NewL( EPriorityNormal ); @@ -481,8 +518,16 @@ void CFullScreenEffectState::NotifyDrawingTimeout() { - TRect b = iPaintedRegion.BoundingRect(); - if ( (b.Width() * b.Height()) > 0.75 * (iDisplaySize.iWidth * iDisplaySize.iHeight)) + + iPaintedRegion.ClipRect(TRect(0,0, iDisplaySize.iWidth, iDisplaySize.iHeight)); + iPaintedRegion.Tidy(); // remove overlapping regions + TInt size(0); + for(TInt i=0; i< iPaintedRegion.Count();i++ ) + { + size += iPaintedRegion[i].Width()*iPaintedRegion[i].Height(); + } + // lets continue, if the covered area is more than 75% of the screen. This is usually enough. + if ( size > KMinimumPaintedAreaBeforeForcedEffect * (iDisplaySize.iWidth * iDisplaySize.iHeight)) { iBridge->HandleGfxEndFullScreenTimeout(this); delete iDrawingCompleteTimer; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfhierarchymodel.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -555,6 +555,13 @@ DoNodeAttributeChangedL(); break; } + + case EAlfNodeSetWindowArea: + { + DoNodeSetWindowAreaL(); + } + break; + case EAlfCommitBatch: { RequestFrameEndCallback(); @@ -876,7 +883,13 @@ #endif AMT_INC_COUNTER_IF(node, iNodeExtentChangedCount ); - AMT_SET_VALUE_IF(node, iLatestNodeExtentRect, rect ); + AMT_SET_VALUE_IF(node, iLatestNodeExtentRect, rect ); + AMT_MAP_SET_VALUE_IF( ( node && node->iWindow ), + iSizeMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, + rect.Size(), EAlfModuleTestTypeHierarchyModelChangeSize ); + AMT_MAP_SET_VALUE_IF( ( node && node->iWindow ), + iPositionMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, + rect.iTl, EAlfModuleTestTypeHierarchyModelChangePosition ); } // --------------------------------------------------------------------------- @@ -937,7 +950,10 @@ USER_INVARIANT(); } - AMT_INC_COUNTER_IF(node, iTotalNodeFlagChangedCount ); + AMT_INC_COUNTER_IF(node, iTotalNodeFlagChangedCount ); + AMT_MAP_INC_VALUE_IF( ( node && node->iWindow ), + iIntMap, node->iWindow->WsInfo().iClientSideId.iWindowIdentifer, + EAlfModuleTestTypeHierarchyModelChangeFlag ); } // --------------------------------------------------------------------------- @@ -1025,6 +1041,17 @@ { node->Window()->SetLayerUsesAplhaFlag(KWindowIsDSAHost); } + if (extent.IsEmpty()) + { + iServer.ReleasePermissionTokenL(node->iId); + } + else + { + iServer.CreatePermissionTokenL(node->iId, + node->Window()->WsInfo().iClientSideId.iWindowIdentifer, + node->Window()->WsInfo().iClientSideId.iWindowGroupId ); + } + } else if( node ) // this would mean that node has being orphaneded but not yet deleted { @@ -1127,6 +1154,26 @@ AMT_INC_COUNTER_IF(node, iTotalNodeAttributeChangedCount ); } + +// --------------------------------------------------------------------------- +// DoNodeAttributeChangedL +// --------------------------------------------------------------------------- +// +void CAlfHierarchyModel::DoNodeSetWindowAreaL() + { + TUint32 nodeId = (TUint32)iStream->ReadUint32L(); + CAlfNode* node = FindNode(nodeId); + if ( node && node->Type() == MWsWindowTreeNode::EWinTreeNodeClient ) + { + CAlfNodeWindow* w = static_cast(node); + w->SetWindowAreaL( iStream ); + } + else + { + USER_INVARIANT(); // set window area change for unexpected node type. new code needed! + } + } + // --------------------------------------------------------------------------- // DoNodeWindowGroupChainBrokenAfterL // --------------------------------------------------------------------------- diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfnodes.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -1476,6 +1476,8 @@ { iWindow->SetActive( EFalse ); } + + iWindow->IncludeToVisibilityCalculation( iVisible && iNodeActivated ); } break; } @@ -1488,6 +1490,10 @@ case MWsWindowTreeObserver::EAlphaChannelTransparencyEnabled: { iAlphaChannelTransparencyEnabled = aNewValue; + if ( iWindow ) + { + iWindow->SetTransparencyAlphaChannel( aNewValue ); + } break; } } @@ -1637,7 +1643,9 @@ { iWindow->SetActive( ETrue ); } - } + + iWindow->IncludeToVisibilityCalculation( iVisible && iNodeActivated ); + } } else { @@ -1762,6 +1770,38 @@ } // --------------------------------------------------------------------------- +// SetWindowAreaL +// --------------------------------------------------------------------------- +// +void CAlfNodeWindow::SetWindowAreaL( RMemReadStream* aStream ) + { + TPoint pos; + RRegion region; + CleanupClosePushL( region ); + + pos.iX = aStream->ReadInt32L(); + pos.iY = aStream->ReadInt32L(); + + TInt count = aStream->ReadInt32L(); + for ( TInt i = 0; i < count; ++i ) + { + TRect r; + aStream->ReadL((TUint8*)&r.iTl.iX, 4 * sizeof(TInt32 )); + region.AddRect(r); + } + + if ( region.CheckError() ) + { + // Fallback to non-shape version + region.Clear(); + } + + iWindow->SetWindowArea( pos, region ); + + CleanupStack::PopAndDestroy(); + } + +// --------------------------------------------------------------------------- // NewL // --------------------------------------------------------------------------- // diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfsrvdisplaysubsession.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfsrvdisplaysubsession.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfsrvdisplaysubsession.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -33,6 +33,13 @@ #include #include +// ETrue if client defined display quality is supported, EFalse if not. +// As there is other content than this ALF application content in the scene, +// it's better ignore client quality hints. +// Note: If this is supported and client gains focus, client quality setting is +// taken into use and applied to the whole scene. However, when client loses +// focus, quality setting is not restored. +const TBool KAlfSrvClientQualitySupport = EFalse; // ======== MEMBER FUNCTIONS ======== @@ -257,7 +264,12 @@ iBackgroundItems.Reset(); // Set background - Display().SetClearBackgroundL( CHuiDisplay::TClearMode( clearBackground )); + TRAPD(err, Display().SetClearBackgroundL( CHuiDisplay::TClearMode( clearBackground )) ); + // Don't let client see timeout errors from our internal services implementation + if( err != KErrNone && err != KErrTimedOut ) + { + User::Leave(err); + } } // Complete @@ -368,7 +380,7 @@ TPckg valuePckg(value); aMessage.Read(1,valuePckg); - if ( session.IsFocused() ) + if ( KAlfSrvClientQualitySupport && session.IsFocused() ) { // Set quality Display().SetQuality(value); @@ -395,7 +407,7 @@ THuiQuality value = EHuiQualityAccurate; TPckg valuePckg(value); - if ( session.IsFocused() ) + if ( KAlfSrvClientQualitySupport && session.IsFocused() ) { // Get quality value = Display().Quality(); @@ -696,8 +708,11 @@ TRAP_IGNORE(iDisplay->SetClearBackgroundL( CHuiDisplay::TClearMode(iDisplayClearBackground))) } - - iDisplay->SetQuality(THuiQuality(iDisplayRenderingQuality)); + + if ( KAlfSrvClientQualitySupport ) + { + iDisplay->SetQuality(THuiQuality(iDisplayRenderingQuality)); + } iDisplay->SetUseDepth(iDisplayUseDepthTest); UpdateAutomaticFading(); // update non-fading to app ui container diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfstreamerbridge.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerbridge.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerbridge.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -279,42 +279,16 @@ iWgArray = aArray; } -EXPORT_C TUid CAlfStreamerBridge::FindAppUidForWgId(TInt aWgId) +EXPORT_C TUid CAlfStreamerBridge::FindAppUidForWgId(TInt /*aWgId*/) { - if (iWgArray) - {TInt* ptr = iWgArray; - for (TInt i=0; i<39; i=i+2) // magic - { - if (ptr[i] == aWgId) - { - return TUid::Uid(ptr[i+1]); - } - if (!ptr[i]) - { - break; - } - } - } - return KNullUid; + __ASSERT_DEBUG(EFalse, User::Leave(KErrNotSupported)); + return KNullUid; } -EXPORT_C TInt CAlfStreamerBridge::FindWgForAppUid(TUid aAppUid) +EXPORT_C TInt CAlfStreamerBridge::FindWgForAppUid(TUid /*aAppUid*/) { - if (iWgArray) - {TInt* ptr = iWgArray; - for (TInt i=0; i<39; i=i+2) // magic - { - if (ptr[i+1] == aAppUid.iUid) - { - return ptr[i]; - } - if (!ptr[i]) - { - break; - } - } - } - return 0; + __ASSERT_DEBUG(EFalse, User::Leave(KErrNotSupported)); + return 0; } // --------------------------------------------------------------------------- diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfstreamerserver.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -26,6 +26,7 @@ #include "alfstreamerbridge.h" #include "alfwindowmanager.h" #include "alfhierarchymodel.h" +#include "alflogger.h" #include #include #include @@ -209,6 +210,7 @@ iCompositionHostSessions.Close(); iCompositionTokens.Close(); iWindowServerSessions.Close(); + iAlfTargets.Close(); } void CAlfStreamerServer::AppendCompositionSessionL(CAlfStreamerServerSession* aSession, TBool aHost) @@ -282,57 +284,138 @@ void CAlfStreamerServer::HandleCompositionRequestL(CAlfStreamerServerSession* aSession, TInt aOp, const RMessage2& aMessage) { - CAlfStreamerServerSession* wservsession = WservSession( aSession->ScreenNumber() ); - TInt length = aMessage.GetDesLength(0); User::LeaveIfError(length); HBufC8* message = HBufC8::NewLC(length+4); TPtr8 clientBuf = message->Des(); aMessage.ReadL(0,clientBuf); - - if(aOp == KAlfCompOpSetExtent) - { - TInt* ptr = (TInt*)clientBuf.Ptr(); - TInt screennumber = ptr[4]; - if(screennumber!=aSession->ScreenNumber()) - { - aSession->ExtentSurfaceId().iInternal[0] = ptr[5]; - aSession->ExtentSurfaceId().iInternal[1] = ptr[6]; - aSession->ExtentSurfaceId().iInternal[2] = ptr[7]; - aSession->ExtentSurfaceId().iInternal[3] = ptr[8]; - wservsession = WservSession( screennumber ); - } - } - else if(aOp == KAlfCompOpSessionClosed) - { - FreeCompositionSessionExtents(aSession); - } - - TInt session = reinterpret_cast(aSession); - clientBuf.Insert(0, TPtrC8((TUint8*)&session ,sizeof(TInt))); - - if( wservsession ) // don't send to any wservsession if composition source does not have a window anywhere and this is not SetExtent operation - { - QueueRequestForSessionL(wservsession, clientBuf, aOp); - } - - CleanupStack::PopAndDestroy(); // unefficient.. - if (!wservsession) - { - aMessage.Complete(KErrNotReady); - return; - } - + HandleCompositionRequestL(aSession,aOp, clientBuf); + if( aOp == KAlfCompOpCreateSource ) { AppendCompositionSessionL(aSession); + TAlfCompParams* param = (TAlfCompParams*)clientBuf.Ptr(); + for (TInt i = iAlfTargets.Count()-1;i >= 0; i--) + { + if (iAlfTargets[i].iWindowHandle == param->iWindowHandle&& + iAlfTargets[i].iWindowGroup == param->iWindowGroup) + { + aSession->AlfToken() = iAlfTargets[i].iTarget; + __ALFLOGSTRING("CAlfStreamerServer::HandleCompositionRequestL(): Found ALF token for composition session") + } + } aMessage.Complete(reinterpret_cast(aSession)); } else if ( aOp != KAlfCompOpSetZOrder ) { aMessage.Complete(KErrNone); } + + CleanupStack::PopAndDestroy(); // unefficient.. + } + +void CAlfStreamerServer::HandleCompositionRequestL(CAlfStreamerServerSession* aSession, TInt aOp, TPtr8& aClientBuf) + { + CAlfStreamerServerSession* wservsession = WservSession( aSession ? aSession->ScreenNumber() : 0 ); + if (!wservsession) + { + __ALFLOGSTRING("CAlfStreamerServer::HandleCompositionRequestL(): Window server not connected yet") + User::Leave(KErrNotReady); + } + + if( aSession ) + { + if(aOp == KAlfCompOpSetExtent ) + { + TInt* ptr = (TInt*)aClientBuf.Ptr(); + TInt screennumber = ptr[4]; + if(screennumber!=aSession->ScreenNumber()) + { + aSession->ExtentSurfaceId().iInternal[0] = ptr[5]; + aSession->ExtentSurfaceId().iInternal[1] = ptr[6]; + aSession->ExtentSurfaceId().iInternal[2] = ptr[7]; + aSession->ExtentSurfaceId().iInternal[3] = ptr[8]; + wservsession = WservSession( screennumber); + } + } + else if(aOp == KAlfCompOpSessionClosed) + { + FreeCompositionSessionExtents(aSession); + } + TInt targetId = reinterpret_cast(aSession); + aClientBuf.Insert(0, TPtrC8((TUint8*)&targetId,sizeof(TInt))); + } + + if( wservsession ) // don't send to any wservsession if composition source does not have a window anywhere and this is not SetExtent operation + { + QueueRequestForSessionL(wservsession, aClientBuf, aOp); + } + } + +void CAlfStreamerServer::CreatePermissionTokenL(TInt aAlfToken, TInt aWindowHandle, TInt aWindowGroup) + { + __ALFLOGSTRING3("CAlfStreamerServer::CreatePermissionTokenL %d, %d, %d >>",aAlfToken,aWindowHandle,aWindowGroup) + TAlfCompParams param = {aAlfToken, aAlfToken, aWindowHandle, aWindowGroup}; + if (iAlfTargets.Find(param) != KErrNotFound) + { + __ALFLOGSTRING("CAlfStreamerServer::CreatePermissionTokenL: Already added") + return; + } + TPckg ptr(param); + HandleCompositionRequestL(0, KAlfCompOpCreateSource, ptr); + User::LeaveIfError(iAlfTargets.Append(param)); + __ALFLOGSTRING("CAlfStreamerServer::CreatePermissionTokenL <<") + } + +void CAlfStreamerServer::ReleasePermissionTokenL(TInt aAlfToken) + { + __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL >>") + RemoveTargetFromInactiveSurfaces(aAlfToken); + for (TInt i = 0; i < iAlfTargets.Count(); i++) + { + if (iAlfTargets[i].iTarget == aAlfToken) + { + TPckg ptr(aAlfToken); + HandleCompositionRequestL(0, KAlfCompOpSessionClosed, ptr); + iAlfTargets.Remove(i); + __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL: Found <<") + return; + } + } + __ALFLOGSTRING("CAlfStreamerServer::ReleasePermissionTokenL: Not Found <<") + } + +void CAlfStreamerServer::QueueRequestSessionsL(TInt aAlfToken, const TPtrC8& aPtr, TInt aOp) + { + __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL >>") + for(TInt i = iCompositionSessions.Count()-1; i >= 0; i-- ) + { + if (iCompositionSessions[i]->AlfToken() == aAlfToken) + { + if (iCompositionSessions[i]->IsBgAnimSession() && + (aOp == KAlfCompositionTargetHidden || aOp == KAlfCompositionTargetVisible )) + { // omit + continue; + } + + __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL: Session found") + iCompositionSessions[i]->QueueL(aPtr, aOp); + } + } + __ALFLOGSTRING("CAlfStreamerServer::QueueRequestSessionsL <<") + } + + +void CAlfStreamerServer::QueueRequestBGAnimSessionsL(const TPtrC8& aPtr, TInt aOp) + { + for(TInt i = iCompositionSessions.Count()-1; i >= 0; i-- ) + { + if (iCompositionSessions[i]->IsBgAnimSession()) + { + iCompositionSessions[i]->QueueL(aPtr, aOp); + } + } } void CAlfStreamerServer::QueueRequestForSessionL(CAlfStreamerServerSession* aSession, const TPtrC8& aPtr, TInt aOp) @@ -367,14 +450,14 @@ TInt* ptr = (TInt*) clientBuf.Ptr(); TInt newkey = Math::Random(); - TRAPD( err, iCompositionTokens.AppendL( CCompositionToken( newkey, ptr[0] /* customer specified key */, + TRAPD( err, iCompositionTokens.AppendL( TCompositionToken( newkey, ptr[0] /* customer specified key */, ptr[1] /*flags*/, aTarget, aSession->ScreenNumber() ) ) ); if (err) { newkey = 0; } - RDebug::Print(_L("CAlfStreamerServer::CreatePermissionToken - newkey %d target: %d, err: %d"), newkey, aTarget, err ); + __ALFLOGSTRING3("CAlfStreamerServer::CreatePermissionToken - newkey %d target: %d, err: %d", newkey, aTarget, err ) CleanupStack::PopAndDestroy(message); return newkey; @@ -488,7 +571,7 @@ { TRAPD( err, iCompositionTokens.AppendL( - CCompositionToken( + TCompositionToken( ptr[1], // new token ptr[2], // secret key 0, @@ -538,6 +621,69 @@ } } +void CAlfStreamerServer::RemoveTargetFromInactiveSurfaces(TInt aTarget) + { + for (TInt i = 0; i& arrayRef = aActiveAlso?iAlfTargets:iInactiveSurfaces; + + TInt count = arrayRef.Count(); + __ALFLOGSTRING1("CAlfStreamerServer::GetListOfWGsHavingInactiveSurfacesL >> count %d", count) + if ( count == 0) + { + aMessage.Complete(KErrNotFound); + return; + } + + TInt maxLength = aMessage.GetDesMaxLength(0); + TInt* array = new (ELeave) TInt [maxLength/4]; + + count = Min(maxLength/4-1, count); + for ( TInt i = 0; i 0) + { + HBufC8::NewLC(aMessage.GetDesLength(2)); + ptr.Set((TUint8*)buf->Ptr(),clientBufL,clientBufL); + } + TInt op = aMessage.Int0(); + TInt key = aMessage.Int1(); + + aMessage.Complete(KErrNone); + TRAP_IGNORE(server->QueueRequestSessionsL(key, ptr, op);) + if (buf) + { + CleanupStack::PopAndDestroy(); + } + break; + } + + case EAlfPostDataToCompositionTarget: + { + TInt clientBufL = aMessage.GetDesLength(2); + TInt int2 = aMessage.Int1(); + TPtr8 ptr(0,0); + HBufC8* buf = 0; + if (clientBufL > 0) + { + HBufC8::NewLC(clientBufL); + ptr.Set((TUint8*)buf->Ptr(),clientBufL,clientBufL); + } + else + { + ptr.Set((TUint8*)&int2, sizeof(TInt),sizeof(TInt)); + } + TInt op = aMessage.Int0(); + aMessage.Complete(KErrNone); + TRAP_IGNORE(server->HandleCompositionRequestL(0, op, ptr);) + if (buf) + { + CleanupStack::PopAndDestroy(); + } + if (op == KAlfCompositionTargetVisible) + { + server->RemoveTargetFromInactiveSurfaces(int2); + } + else if (op == KAlfCompositionTargetHidden) + { + server->AddTargetFromInactiveSurfaces(int2); + } + break; + } + case EAlfGetListOfWGsHavingInactiveSurfaces: + { + server->GetListOfWGsHavingInactiveSurfacesL(aMessage, EFalse); + break; + } + + case EAlfQueueRequestBGSessions: + { + TInt clientBufL = aMessage.GetDesLength(1); + TPtr8 ptr(0,0); + HBufC8* buf = 0; + if (clientBufL > 0) + { + HBufC8::NewLC(clientBufL); + ptr.Set((TUint8*)buf->Ptr(),clientBufL,clientBufL); + } + TInt op = aMessage.Int0(); + aMessage.Complete(KErrNone); + TRAP_IGNORE(server->QueueRequestBGAnimSessionsL(ptr, op);) + if (buf) + { + CleanupStack::PopAndDestroy(); + } + break; + } + + default: { aMessage.Complete(KErrNotSupported); @@ -707,7 +934,7 @@ { aMessage.Complete(KErrNone); } -// RDebug::Print(_L("CAlfStreamerServerSession::ServiceL exit")); + __ALFLOGSTRING("CAlfStreamerServerSession::ServiceL exit") } void CAlfStreamerServerSession::HandleCompositionOpL(TInt aOp, const RMessage2& aMessage, CAlfStreamerServer* aServer) @@ -746,8 +973,6 @@ break; } - // temp, should go to window server to have more precise control on - // operations case KAlfCompOpCreateToken: { TInt token = aServer->CreatePermissionToken( aMessage, reinterpret_cast(this), this ); @@ -767,12 +992,21 @@ case KAlfCompOpSetRotation: case KAlfCompOpSetExtent: case KAlfCompOpEnableKb: - case KAlfComOpSetBackgroundAnim: case KAlfCompOpSessionClosed: { aServer->HandleCompositionRequestL(this, aOp, aMessage); break; } + case KAlfComOpSetBackgroundAnim: + { + TBool isBg(EFalse); + TPckg ptr(isBg); + aMessage.Read(0,ptr); + iIsBgAnimSession = isBg; + aServer->HandleCompositionRequestL(this, aOp, aMessage); + break; + } + case KAlfCompositionWServScreenNumber: { iScreenNumber = aMessage.Int0(); @@ -796,7 +1030,7 @@ } default: // add debug guards or remove - RDebug::Print(_L("Oops, unknown composition command: %d "), aOp); + __ALFLOGSTRING1("Oops, unknown composition command: %d ", aOp) User::Invariant(); } } @@ -815,7 +1049,7 @@ } else { - RDebug::Print(_L("CAlfStreamerServerSession::CompletedFromQueue err: %d"),err); + __ALFLOGSTRING1("CAlfStreamerServerSession::CompletedFromQueue err: %d",err) } if( !iMessagePtr.IsNull()) { diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfwindow.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfwindow.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfwindow.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -26,6 +26,7 @@ #include "alfwindowdata.h" #include +#include // --------------------------------------------------------------------------- // NewL @@ -53,6 +54,8 @@ delete iData->iInBuffer; delete iData->iOutBuffer; + iData->iWindowArea.Close(); + delete iData; } } @@ -493,6 +496,183 @@ } } + +// --------------------------------------------------------------------------- +// CreateSetWindowAreaL +// --------------------------------------------------------------------------- +// +TAny* CAlfWindow::CreateSetWindowAreaL( + TInt& aOffset, TInt aScreenNumber, const TPoint& aOrigin, const TRegion& aRegion) + { + const TInt size = ( 4*aRegion.Count() + 4 ) * sizeof(TInt32); + TAny* data = (TAny*)iData->iWindowManager->Bridge()->AppendVarDataL( size, aOffset ); + + RMemWriteStream str( data, size ); + str.WriteInt32L( aScreenNumber ); + str.WriteInt32L( aOrigin.iX ); + str.WriteInt32L( aOrigin.iY ); + str.WriteInt32L( aRegion.Count() ); + + for (TInt i = 0; i < aRegion.Count(); ++i ) + { + const TRect rect(aRegion[i]); + str.WriteInt32L(rect.iTl.iX); + str.WriteInt32L(rect.iTl.iY); + str.WriteInt32L(rect.iBr.iX); + str.WriteInt32L(rect.iBr.iY); + } + + return data; + } + +// --------------------------------------------------------------------------- +// SetWindowArea +// --------------------------------------------------------------------------- +// +void CAlfWindow::SetWindowArea() + { + if ( iData->iWindowArea.Count() ) + { + // Now inserted to scene - forward + SetWindowArea(iData->iWindowAreaOrigin, iData->iWindowArea); + iData->iWindowArea.Clear(); + } + } + +// --------------------------------------------------------------------------- +// SetWindowArea +// --------------------------------------------------------------------------- +// +void CAlfWindow::SetWindowArea(const TPoint& aOrigin, const TRegion& aRegion) + { + if ( WsInfo().iNodeType != MWsWindowTreeNode::EWinTreeNodeClient ) + { + return; + } + + if (!IsInsertedToScene()) + { + // Cache data to be able to send once this is inserted to scene + iData->iWindowAreaOrigin = aOrigin; + iData->iWindowArea.Copy(aRegion); + if ( iData->iWindowArea.CheckError() ) + { + iData->iWindowArea.Clear(); + } + return; + } + + TAlfWServInfo wservInfo = WsInfo(); + TInt offset = 0; + TAny* data = NULL; + + TRAP_IGNORE(data = CreateSetWindowAreaL( offset, wservInfo.iScreenNumber, aOrigin, aRegion )); + + if (data) + { + TAlfBridgerData d; + d.Set(EAlfDSSetWindowArea, + wservInfo.iRefId.iWindowGroupId, + wservInfo.iRefId.iWindowIdentifer, + (TAny*)offset); + + iData->iWindowManager->PostIt(d); + } + } + +// --------------------------------------------------------------------------- +// SetTransparencyAlphaChannel +// --------------------------------------------------------------------------- +// +void CAlfWindow::SetTransparencyAlphaChannel(TBool aActive) + { + if ( WsInfo().iNodeType != MWsWindowTreeNode::EWinTreeNodeClient ) + { + return; + } + + if (!IsInsertedToScene()) + { + iData->iTransparencyAlphaChannel = aActive; + return; + } + + TAlfWServInfo wservInfo = WsInfo(); + + TInt offset; + TAlfWindowAttributes* windowAttributes = CreateWindowAttributes(offset); + if ( windowAttributes ) + { + windowAttributes->iActive = aActive; + windowAttributes->iScreenNumber = wservInfo.iScreenNumber; + + TAlfBridgerData d; + d.Set(EAlfDSSetTransparencyAlphaChannel, + wservInfo.iRefId.iWindowGroupId, + wservInfo.iRefId.iWindowIdentifer, + (TAny*)offset); + + if (iData->iWindowManager->PostIt(d)) + { + iData->iTransparencyAlphaChannel = aActive; + } + } + } + +// --------------------------------------------------------------------------- +// TransparencyAlphaChannel +// --------------------------------------------------------------------------- +// +TBool CAlfWindow::TransparencyAlphaChannel() const + { + return iData->iTransparencyAlphaChannel; + } + +// --------------------------------------------------------------------------- +// IsIncludedToVisibilityCalculation +// --------------------------------------------------------------------------- +// +TBool CAlfWindow::IsIncludedToVisibilityCalculation() const + { + return iData->iIncludeToVisibilityCalculation; + } + +// --------------------------------------------------------------------------- +// IncludeToVisibilityCalculation +// --------------------------------------------------------------------------- +// +void CAlfWindow::IncludeToVisibilityCalculation(TBool aActive) + { + if (!IsInsertedToScene()) + { + iData->iIncludeToVisibilityCalculation = aActive; + return; + } + + TAlfWServInfo wservInfo = WsInfo(); + + TInt offset; + TAlfWindowAttributes* windowAttributes = CreateWindowAttributes(offset); + if ( windowAttributes ) + { + windowAttributes->iActive = aActive; + windowAttributes->iScreenNumber = wservInfo.iScreenNumber; + windowAttributes->iWindowNodeType = wservInfo.iNodeType; + + TAlfBridgerData d; + d.Set(EAlfDSIncludeToVisibilityCalculation, + wservInfo.iRefId.iWindowGroupId, + wservInfo.iRefId.iWindowIdentifer, + (TAny*)offset); + + if (iData->iWindowManager->PostIt(d)) + { + iData->iIncludeToVisibilityCalculation = aActive; + } + } + } + + // --------------------------------------------------------------------------- // SetWsInfo // --------------------------------------------------------------------------- @@ -522,8 +702,12 @@ memset(iData, 0, sizeof(TAlfWindowData)); // initialize all values to zero iData->iWindowManager = &aOwner; iData->iIdentifier = aId; - iData->iIsActive = ETrue; + iData->iIsActive = EFalse; iData->iOpacity = 1.0f; + iData->iWindowArea = RRegion(); + iData->iTransparencyAlphaChannel = EFalse; + iData->iIncludeToVisibilityCalculation = EFalse; + SetSize(aSizeInPixels); } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfwindowmanager.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -208,7 +208,9 @@ aWindow->SetOpacity(aWindow->Opacity()); } aWindow->SetSurfaceExtent(aWindow->SurfaceExtent()); - + aWindow->SetWindowArea(); + aWindow->SetTransparencyAlphaChannel(aWindow->TransparencyAlphaChannel()); + aWindow->IncludeToVisibilityCalculation(aWindow->IsIncludedToVisibilityCalculation()); aWindow->SetActive(aWindow->IsActive()); } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/ServerStub/Proxy_src/AlfAppFwProxy.cpp --- a/uiacceltk/hitchcock/ServerStub/Proxy_src/AlfAppFwProxy.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/ServerStub/Proxy_src/AlfAppFwProxy.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -164,7 +164,7 @@ if (!iBitmap) { iBitmap = new (ELeave) CFbsBitmap(); - User::LeaveIfError( iBitmap->Create(skinRect.Size(), EColor64K) ); // is 64k still valid? + User::LeaveIfError( iBitmap->Create(skinRect.Size(), EColor16MAP) ); } User::LeaveIfError(iBitmap->Resize(skinRect.Size())); @@ -323,7 +323,7 @@ void UpdateWgListL() { TInt wgId=0; - const TInt count=iWsSession.NumWindowGroups(); + TInt count=iWsSession.NumWindowGroups(); if (count) { TInt* ptr = iWgIdArray; @@ -333,6 +333,8 @@ CApaWindowGroupName* wgName=CApaWindowGroupName::NewL(iWsSession); CleanupStack::PushL(wgName); User::LeaveIfError(iWsSession.WindowGroupList(wgIdArray)); // all groups + count = wgIdArray->Count(); // count might have changed + iWgEntriesWritten = 0; for (TInt ii=0; ii < count-1; ii++) { diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/backgroundanim/group/bganimhost.mmp --- a/uiacceltk/hitchcock/backgroundanim/group/bganimhost.mmp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/backgroundanim/group/bganimhost.mmp Mon Mar 15 12:43:37 2010 +0200 @@ -23,6 +23,7 @@ TARGET backgroundanimhost.exe TARGETTYPE exe EPOCPROCESSPRIORITY realtimeserver +EPOCHEAPSIZE 0x100000 0x800000 ALWAYS_BUILD_AS_ARM OPTION ARMCC -O3 -Otime --cpu 6 --fpmode fast @@ -51,7 +52,9 @@ SOURCE bganimhost.cpp SOURCE highrestimer.cpp SOURCE themerepositorylistener.cpp +#ifndef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS SOURCE screensaverpropertylistener.cpp +#endif SOURCE sensor.cpp STATICLIBRARY libcrt0.lib diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/backgroundanim/inc/bganimhost.h --- a/uiacceltk/hitchcock/backgroundanim/inc/bganimhost.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/backgroundanim/inc/bganimhost.h Mon Mar 15 12:43:37 2010 +0200 @@ -18,7 +18,7 @@ #include #include #include - +#include #include @@ -30,7 +30,7 @@ #include "../../../../uiaccelerator_plat/alf_visual_api/inc/alf/alfcompositionutility.h" -class CBgAnimHost : public CBase, public MAlfCompositionObserver, public MSensrvDataListener +class CBgAnimHost : public CBase, public MAlfCompositionObserver, public MSensrvDataListener, public MAknsSkinChangeObserver { public: void ConstructL(); @@ -52,7 +52,11 @@ void DataError( CSensrvChannel& aChannel, TSensrvErrorSeverity aError ); void GetDataListenerInterfaceL( TUid aInterfaceUid, TAny*& aInterface); - + // from MAknsSkinChangeObserver + void SkinContentChanged(); + void SkinConfigurationChanged( const TAknsSkinStatusConfigurationChangeReason aReason ); + void SkinPackageChanged( const TAknsSkinStatusPackageChangeReason aReason ); + protected: void CreateWindowL(); void DestroyWindow(); @@ -61,9 +65,12 @@ void CreateWindowSurfaceL(); void ReleaseWindowSurface(TBool aReleaseObserver = ETrue); void LoadPluginL(); + void ReleasePlugin(); void NewFrame(); void HandleScreenSaverEvent(); + TBool GetPluginConfigurationL(); static TInt ScreenSaverCallback(TAny* aPtr); + private: // windowing stuff RWsSession iWsSession; @@ -101,4 +108,7 @@ RPointerArray iSensorListeners; + RAknsSrvSession iSkinSrv; + HBufC* iCurrentPluginDllName; + HBufC* iCurrentPluginAssetDir; }; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/backgroundanim/src/bganimhost.cpp --- a/uiacceltk/hitchcock/backgroundanim/src/bganimhost.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/backgroundanim/src/bganimhost.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -16,7 +16,6 @@ */ #include #include -#include #include #include #include @@ -38,6 +37,9 @@ CBgAnimHost::~CBgAnimHost() { + iSkinSrv.Close(); + delete iCurrentPluginDllName; + delete iCurrentPluginAssetDir; delete iTimer; if (iPlugin) { @@ -45,7 +47,9 @@ free(iPlugin); } iPluginLibrary.Close(); +#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) delete iSCPropertyListener; +#endif delete iThemeRepositoryListener; while (iSensorListeners.Count()) { @@ -79,18 +83,24 @@ CActiveScheduler::Install(ac); iTimer = CHighResTimer::NewL(TCallBack(TimerFunc, this),CActive::EPriorityStandard); iThemeRepositoryListener = CThemeRepositoryListener::NewL(&iRunning); +#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) iSCPropertyListener = CScreenSaverPropertyListener::NewL(TCallBack(ScreenSaverCallback, this)); +#endif CreateWindowL(); + User::LeaveIfError(iSkinSrv.Connect()); // load the initial plugin + GetPluginConfigurationL(); LoadPluginL(); InitEGLL(); CreateWindowSurfaceL(); User::LeaveIfError(iPlugin->gpuresourcesavailable(1)); iThemeRepositoryListener->IssueRequest(); +#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) iSCPropertyListener->IssueRequest(); +#endif } void CBgAnimHost::CreateWindowL() @@ -185,7 +195,7 @@ iSurfaceInitialized = EFalse; - if (aReleaseObserver) + if (aReleaseObserver && iCompSource) { iCompSource->RemoveObserver(*this); delete iCompSource; @@ -385,42 +395,68 @@ } else { - User::After(5000000); + User::After(1000000); } } iSurfaceInitialized = ETrue; } - -void CBgAnimHost::LoadPluginL() + +TBool CBgAnimHost::GetPluginConfigurationL() { // dig out the skin config from skin server HBufC* configstr = NULL; - RAknsSrvSession skinsrv; - User::LeaveIfError(skinsrv.Connect()); - CleanupClosePushL(skinsrv); - CAknsSrvChunkLookup* cl = skinsrv.CreateChunkLookupL(); + CAknsSrvChunkLookup* cl = iSkinSrv.CreateChunkLookupL(); CleanupStack::PushL(cl); CAknsStringItemDef* configitem = static_cast(cl->LookupAndCreateDefL( KAknsIIDPropertyAnimBgParam )); User::LeaveIfNull(configitem); CleanupStack::PushL(configitem); configstr = configitem->String().AllocL(); - CleanupStack::PopAndDestroy(3); // skinsrv, cl, configitem + CleanupStack::PopAndDestroy(2); // cl, configitem CleanupStack::PushL(configstr); - RDebug::Print(_L("----------------------")); - RDebug::Print(_L("backgroundhost config:")); - RDebug::Print(*configstr); - RDebug::Print(_L("----------------------")); TLex lex(*configstr); - TPtrC dllname = lex.NextToken(); - if (!dllname.Length()) + HBufC* dllname = lex.NextToken().AllocL(); + CleanupStack::PushL(dllname); + if (!dllname || !dllname->Length()) + { + User::Leave(KErrNotFound); + } + + HBufC* assetdir = lex.NextToken().AllocL(); + CleanupStack::PushL(assetdir); + if (!assetdir || !assetdir->Length()) { User::Leave(KErrNotFound); } - User::LeaveIfError(iPluginLibrary.Load(dllname)); + TBool confchanged = EFalse; + if (!iCurrentPluginDllName || !iCurrentPluginAssetDir || + (iCurrentPluginDllName && !iCurrentPluginDllName->CompareF(*dllname)) || + (iCurrentPluginAssetDir && !iCurrentPluginAssetDir->CompareF(*assetdir)) ) + + { + confchanged = ETrue; + delete iCurrentPluginDllName; + delete iCurrentPluginAssetDir; + iCurrentPluginDllName = dllname; + iCurrentPluginAssetDir = assetdir; + CleanupStack::Pop(2); // dllname, assetdir + } + else + { + CleanupStack::PopAndDestroy(2); // dllname, assetdir + } + + CleanupStack::PopAndDestroy(); // configstr + + return confchanged; + } + +void CBgAnimHost::LoadPluginL() + { + User::LeaveIfError(iPluginLibrary.Load(*iCurrentPluginDllName)); plugingetinterfacefunc getif = (plugingetinterfacefunc)iPluginLibrary.Lookup(1); if (!getif) { @@ -430,23 +466,10 @@ iPlugin = (plugin_export_v1_t*) getif(1); - TPtrC configpath = lex.NextToken(); - if (!configpath.Length()) - { - User::Leave(KErrNotFound); - } TBuf8<256> pluginpath; - pluginpath.Copy(configpath); + pluginpath.Copy(*iCurrentPluginAssetDir); User::LeaveIfError(iPlugin->initialize((const char*)pluginpath.PtrZ(), KMaxGPUMemUsage)); - -// } -// else -// { -// User::LeaveIfError(iPlugin->initialize("z:\\private\\200286D3", KMaxGPUMemUsage)); -// } - - CleanupStack::PopAndDestroy(); // configstr - + iPlugin->setdisplaydimensions(iDisplaySize.iWidth, iDisplaySize.iHeight); if (iPlugin->desiredsensors && iPlugin->receivesensordata) { @@ -463,6 +486,24 @@ } } +void CBgAnimHost::ReleasePlugin() + { + if (iPlugin) + { + while (iSensorListeners.Count()) + { + delete iSensorListeners[0]; + iSensorListeners.Remove(0); + } + + iPlugin->gpuresourcesavailable(0); + iPlugin->destroy(); + free(iPlugin); + iPlugin = NULL; + iPluginLibrary.Close(); + } + } + void CBgAnimHost::NewFrame() { if (!iRunning) @@ -506,6 +547,12 @@ iTimer->CallBack(100); iTimerRunning = ETrue; iRunning = ETrue; + // we only want to receive skin change messages + // after we have been properly initialized + // and running, close the session without observer + // and re-open with observer + iSkinSrv.Close(); + User::LeaveIfError(iSkinSrv.Connect(this)); CActiveScheduler::Start(); } @@ -535,7 +582,6 @@ return; } - RDebug::Print(_L("!!! - HIDDEN - !!!")); // release gpu resources... iTimer->Cancel(); iTimerRunning = EFalse; @@ -552,8 +598,6 @@ return; } - RDebug::Print(_L("!!! - VISIBLE - !!!")); - if (!iSurfaceInitialized && iCompSource) { iCompSource->RemoveObserver(*this); @@ -573,17 +617,13 @@ void CBgAnimHost::HandleScreenSaverEvent() { - RDebug::Print(_L("-----------------------------------")); - RDebug::Print(_L("CBgAnimHost::HandleScreenSaverEvent")); +#if !defined(SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS) TInt scStatus = iSCPropertyListener->GetScreenSaverStatus(); - RDebug::Print(_L("status: %d, timerrunning %d, surfacecreated %d"),scStatus, iTimerRunning, iSurfaceInitialized); - RDebug::Print(_L("-----------------------------------")); if (scStatus) { // screensaver is ON if (iTimerRunning) { - RDebug::Print(_L("--- screensaver on, stopping timer ---")); iTimer->Cancel(); iTimerRunning = EFalse; } @@ -593,12 +633,11 @@ // screensaver is OFF if (!iTimerRunning && iSurfaceInitialized) { - RDebug::Print(_L("--- screensaver off, starting timer ---")); - iTimerRunning = ETrue; iTimer->CallBack(1); } } +#endif } TInt CBgAnimHost::ScreenSaverCallback(TAny* aPtr) @@ -623,3 +662,34 @@ void CBgAnimHost::GetDataListenerInterfaceL( TUid aInterfaceUid, TAny*& aInterface) { } + +void CBgAnimHost::SkinContentChanged() + { + } + +void CBgAnimHost::SkinConfigurationChanged( const TAknsSkinStatusConfigurationChangeReason aReason ) + { + if (aReason == EAknsSkinStatusConfigurationDeployed && iPlugin) + { + // okay, the skin has changed, let's check that should we load a different + // animation plugin + TBool changed = EFalse; + TRAPD(err, changed = GetPluginConfigurationL()); + if (err || !changed) + { + // plugin configuration has not changed, or there is not animation + // in the theme, just return + return; + } + + CompositionTargetHidden(); + ReleasePlugin(); + + TRAP_IGNORE(LoadPluginL()); + CompositionTargetVisible(); + } + } + +void CBgAnimHost::SkinPackageChanged( const TAknsSkinStatusPackageChangeReason /*aReason*/ ) + { + } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/backgroundanim/src/highrestimer.cpp --- a/uiacceltk/hitchcock/backgroundanim/src/highrestimer.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/backgroundanim/src/highrestimer.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -39,9 +39,9 @@ { wait = 1000; } - if (wait > 15000) + if (wait > 100000) { - wait = 15000; + wait = 100000; } HighRes( TTimeIntervalMicroSeconds32( wait ) ); diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/backgroundanim/src/screensaverpropertylistener.cpp --- a/uiacceltk/hitchcock/backgroundanim/src/screensaverpropertylistener.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/backgroundanim/src/screensaverpropertylistener.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -37,7 +37,6 @@ CleanupStack::PushL(me); me->ConstructL(); CleanupStack::Pop(); - RDebug::Print(_L("screensaverlistener constructed")); return me; } @@ -48,7 +47,6 @@ void CScreenSaverPropertyListener::RunL() { - RDebug::Print(_L("screensaverlistener - runl")); if (iStatus.Int() != KErrCancel) { IssueRequest(); @@ -64,7 +62,6 @@ void CScreenSaverPropertyListener::IssueRequest() { - RDebug::Print(_L("screensaverlistener issuereq")); iSCProperty.Subscribe(iStatus); SetActive(); } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF --- a/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/BWINS/hitchcocku.DEF Mon Mar 15 12:43:37 2010 +0200 @@ -1585,4 +1585,11 @@ ?SkinPackageChanged@CHuiS60Skin@@UAEXW4TAknsSkinStatusPackageChangeReason@@@Z @ 1584 NONAME ; void CHuiS60Skin::SkinPackageChanged(enum TAknsSkinStatusPackageChangeReason) ?SkinConfigurationChanged@CHuiS60Skin@@UAEXW4TAknsSkinStatusConfigurationChangeReason@@@Z @ 1585 NONAME ; void CHuiS60Skin::SkinConfigurationChanged(enum TAknsSkinStatusConfigurationChangeReason) ?Synchronize@CHuiEnv@@QAEXHPAVMHuiSynchronizationObserver@@@Z @ 1586 NONAME ; void CHuiEnv::Synchronize(int, class MHuiSynchronizationObserver *) + ?SetForegroundTextureOptions@CHuiDisplay@@QAEXH@Z @ 1587 NONAME ; void CHuiDisplay::SetForegroundTextureOptions(int) + ?ShapeOrigin@CHuiCanvasVisual@@QBE?AVTPoint@@XZ @ 1588 NONAME ; class TPoint CHuiCanvasVisual::ShapeOrigin(void) const + ?HasCustomShape@CHuiCanvasVisual@@QBEHXZ @ 1589 NONAME ; int CHuiCanvasVisual::HasCustomShape(void) const + ?ShapeRegion@CHuiCanvasVisual@@QBEABVTRegion@@XZ @ 1590 NONAME ; class TRegion const & CHuiCanvasVisual::ShapeRegion(void) const + ?SetShape@CHuiCanvasVisual@@QAEXABVTPoint@@ABVTRegion@@@Z @ 1591 NONAME ; void CHuiCanvasVisual::SetShape(class TPoint const &, class TRegion const &) + ?CommandBufferCoverage@CHuiCanvasVisual@@QAE?AVTRect@@H@Z @ 1592 NONAME ; class TRect CHuiCanvasVisual::CommandBufferCoverage(int) + ?CopyScreenToBitmapL@CHuiDisplay@@QAEXPAVCFbsBitmap@@@Z @ 1593 NONAME ; void CHuiDisplay::CopyScreenToBitmapL(class CFbsBitmap *) diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF --- a/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/eabi/hitchcocku.DEF Mon Mar 15 12:43:37 2010 +0200 @@ -1986,4 +1986,11 @@ _ZThn28_N11CHuiS60Skin18SkinPackageChangedE34TAknsSkinStatusPackageChangeReason @ 1985 NONAME _ZThn28_N11CHuiS60Skin24SkinConfigurationChangedE40TAknsSkinStatusConfigurationChangeReason @ 1986 NONAME _ZN7CHuiEnv11SynchronizeEiP27MHuiSynchronizationObserver @ 1987 NONAME + _ZN11CHuiDisplay27SetForegroundTextureOptionsEi @ 1988 NONAME + _ZN16CHuiCanvasVisual8SetShapeERK6TPointRK7TRegion @ 1989 NONAME + _ZNK16CHuiCanvasVisual11ShapeOriginEv @ 1990 NONAME + _ZNK16CHuiCanvasVisual11ShapeRegionEv @ 1991 NONAME + _ZNK16CHuiCanvasVisual14HasCustomShapeEv @ 1992 NONAME + _ZN16CHuiCanvasVisual21CommandBufferCoverageEi @ 1993 NONAME + _ZN11CHuiDisplay19CopyScreenToBitmapLEP10CFbsBitmap @ 1994 NONAME diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h --- a/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/HuiFxEffectCache.h Mon Mar 15 12:43:37 2010 +0200 @@ -40,6 +40,7 @@ virtual void ParsingEndedBefore()=0; virtual void ParsingEndedAfter(MHuiFxEffectCacheNode *aCached)=0; virtual TBool FxmlUsesInput1()=0; + virtual void Delete()=0; }; class CHuiFxEffectCache : public CBase, public MHuiFxParsingEndedObserver @@ -103,6 +104,7 @@ void ParsingEndedBefore(); void ParsingEndedAfter(MHuiFxEffectCacheNode *aCached); TBool FxmlUsesInput1(); + void Delete(); private: const TDesC *iFileName; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/inc/huicanvaspainter.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaspainter.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaspainter.h Mon Mar 15 12:43:37 2010 +0200 @@ -294,6 +294,12 @@ virtual CHuiCanvasGc& CanvasGc() const = 0; /** + * Clears capturing buffer area with completely transparent. + * @param aRect rect to clear. + */ + virtual void ClearCapturingBufferArea(const TRect& aRect); + + /** * Sets canvas visual that this painter draws into */ void SetVisual(CHuiCanvasVisual* aVisual); @@ -353,6 +359,11 @@ * Does this painter have command buffers older than given time. */ TBool HasOldCommandBuffers(TInt aLifeTimeInMs); + + /** + * Returns the area covered by buffers in the given orientation + */ + TRect CommandBufferCoverage(TInt aOrientation); TInt NumBuffers() const { return iCommandBuffers.Count(); } CHuiCanvasCommandBuffer *At(TInt aIndex) const { return iCommandBuffers[aIndex]; } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/inc/huicanvastexturecache.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvastexturecache.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvastexturecache.h Mon Mar 15 12:43:37 2010 +0200 @@ -219,6 +219,9 @@ // Combined image RArray iSubImages; TSize iImageSize; + + // Used for identifying recycled bitmap handles + TInt64 iSerialNumber; }; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsbitgc.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsbitgc.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsbitgc.h Mon Mar 15 12:43:37 2010 +0200 @@ -65,6 +65,7 @@ virtual void ClearCache(); virtual TBool IsRenderBufferEnabled() const; + virtual void ClearCapturingBufferArea(const TRect& aRect); }; #endif // __HUICANVASWSBITGC_H__ diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsgc.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsgc.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsgc.h Mon Mar 15 12:43:37 2010 +0200 @@ -156,7 +156,8 @@ virtual TInt EnableRenderbuffer(TBool aEnable = ETrue) = 0; virtual THuiCanvasWsGcType Type() const = 0; - + + virtual void ClearCapturingBufferArea(const TRect& aRect) = 0; ~CHuiCanvasWsGc(){} }; diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/inc/huicanvaswshwgc.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswshwgc.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswshwgc.h Mon Mar 15 12:43:37 2010 +0200 @@ -140,6 +140,8 @@ virtual TInt EnableRenderbuffer(TBool aEnable = ETrue); virtual THuiCanvasWsGcType Type() const; + virtual void ClearCapturingBufferArea(const TRect& aRect); + void BeginDrawL(TRect aDisplayRect,const CHuiCanvasVisual& aUser, TBool aIsCachePrepared, const TRegion& aUpdateRegion); void EndDrawL(const TRegion& aUpdateRegion, TBool aUpdateDisplay); void BeginScanL(TRect aDisplayRect,const CHuiCanvasVisual& aUser, TBool aIsCachePrepared, const TRegion& aUpdateRegion); diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswspainter.h Mon Mar 15 12:43:37 2010 +0200 @@ -281,6 +281,8 @@ void WsUseFontL() ; void WsSetShapeRegionL( TInt aIndex ); + virtual void ClearCapturingBufferArea(const TRect& aRect); + private: /** Region which this painter updates with current command buffers */ diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsswgc.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsswgc.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huicanvaswsswgc.h Mon Mar 15 12:43:37 2010 +0200 @@ -148,6 +148,8 @@ virtual TInt EnableRenderbuffer(TBool aEnable = ETrue); virtual THuiCanvasWsGcType Type() const; + virtual void ClearCapturingBufferArea(const TRect& aRect); + protected: void DoBeginDrawL(TBool aIsCachePrepared); diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/inc/huiextension.h --- a/uiacceltk/hitchcock/coretoolkit/inc/huiextension.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/inc/huiextension.h Mon Mar 15 12:43:37 2010 +0200 @@ -68,4 +68,19 @@ TInt iResult; }; +// Uid for Copy Screen To Bitmap extension +const TUid KHuiGcCopyScreenToBitmap = { 0x2002E67B }; + +// Parameter structure for Copy Screen To Bitmap extension +struct THuiGcCopyScreenToBitmapParams + { + // Input parameters + + CFbsBitmap* iBitmap; + + // Output parameters + + TInt iErrorCode; + }; + #endif // __HUIEXTENSION_H__ diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/inc/HuiVg10Gc.h Mon Mar 15 12:43:37 2010 +0200 @@ -39,6 +39,7 @@ class MNVGIcon; class CNvgEngine; #endif +class CFbsBitmap; /** * CHuiVg10Gc implements an OpenVG 1.0 version of the HUITK @@ -433,6 +434,11 @@ void SetQuality(THuiQuality aQuality); + /** + * From CHuiGc. + */ + void GcExtension(const TUid& aExtensionUid, TAny** aExtensionParams); + private: /** * Synchronize a specific OpenVG matrix with the main matrix. @@ -510,6 +516,12 @@ void UsePaintPattern(); void DiscardPaintPattern(); + /** + * Copy screen to bitmap. + * @internal + */ + TInt DoCopyScreenToBitmap(CFbsBitmap* aBitmap); + private: /** Matrix characteristics */ enum TMatrixFlags diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Gc.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -34,6 +34,8 @@ #include "HuiRenderSurface.h" #include "../../CommonInc/uiacceltkdomaincrkeys.h" +#include "huiextension.h" + #include #include #ifdef __NVG @@ -1479,7 +1481,7 @@ destinationRect.iBr.iX -= 0.5f; destinationRect.iBr.iY -= 0.5f; - VGfloat alpha = PenAlpha(); + VGfloat alpha = PenAlpha()/255.0f; vgClearPath(iEllipsePath, VG_PATH_CAPABILITY_APPEND_TO); VGfloat cx = (destinationRect.iTl.iX + destinationRect.iBr.iX) / 2.f; @@ -2322,6 +2324,85 @@ } } +void CHuiVg10Gc::GcExtension(const TUid& aExtensionUid, TAny** aExtensionParams) + { + if ( aExtensionUid == KHuiGcCopyScreenToBitmap && aExtensionParams && *aExtensionParams) + { + THuiGcCopyScreenToBitmapParams* params = static_cast(*aExtensionParams); + params->iErrorCode = DoCopyScreenToBitmap(params->iBitmap); + } + else + { + CHuiGc::GcExtension(aExtensionUid, aExtensionParams); + } + } + +TInt CHuiVg10Gc::DoCopyScreenToBitmap(CFbsBitmap* aBitmap) + { + if (!aBitmap || + !aBitmap->Handle() || + aBitmap->IsCompressedInRAM() || + aBitmap->ExtendedBitmapType() != KNullUid ) + { + return KErrNotSupported; + } + + VGImageFormat dataFormat = VG_sARGB_8888_PRE; + TBool displayModeSupported = ETrue; + switch (aBitmap->DisplayMode()) + { + case EColor16MAP: + dataFormat = VG_sARGB_8888_PRE; + break; + case EColor64K: + dataFormat = VG_sRGB_565; + break; + case EColor16MU: + dataFormat = VG_sXRGB_8888; + break; + case EColor16MA: + dataFormat = VG_sARGB_8888; + break; + + default: + displayModeSupported = EFalse; + break; + } + + if (!displayModeSupported) + { + return KErrNotSupported; + } + + TRect copyRect(aBitmap->SizeInPixels()); + if (copyRect.IsEmpty()) + { + return KErrArgument; + } + + TInt dataStride = CFbsBitmap::ScanLineLength(copyRect.Width(), + aBitmap->DisplayMode()); + + aBitmap->BeginDataAccess(); + TUint8* data = (TUint8*)aBitmap->DataAddress(); + + // image is upside down.. + data += (copyRect.Height() - 1)*dataStride; + dataStride = -dataStride; + + vgReadPixels( + data, + dataStride, + dataFormat, + 0, // sx + 0, // sy + copyRect.Width(), // width + copyRect.Height() // height + ); + + aBitmap->EndDataAccess(EFalse); + return KErrNone; + } // End of file diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/HuiVg10Texture.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -1335,6 +1335,10 @@ // Render the NVGtexture into the image buffer. No transformations are done for this. SetNvgParamsFromIconHeader(*aNvgEngine, aNVGData); + // Always set blending mode to SRC_OVER before drawing NVG content (so that the + // drawn icons would show correctly, and no issues with transparency would arise) + VGint blendMode = vgGeti(VG_BLEND_MODE); + vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); if (iIconCommands) { //HUI_DEBUG(_L("CHuiVg10Texture::CreateRenderedImage() - Drawing iIconCommands")); @@ -1344,10 +1348,7 @@ { // If ObjectCached version failed, try to use the old way //HUI_DEBUG(_L("CHuiVg10Texture::CreateRenderedImage() - Drawing with DrawNvg")); - VGint blendMode = vgGeti(VG_BLEND_MODE); - vgSeti(VG_BLEND_MODE, VG_BLEND_SRC_OVER); aNvgEngine->DrawNvg(GetNvgDataWithoutHeader(aNVGData), aDestSize, NULL, NULL); - vgSeti(VG_BLEND_MODE, blendMode); } // NVG-TLV icon margin special case check: @@ -1366,7 +1367,12 @@ aNvgEngine->DrawNvg(GetNvgDataWithoutHeader(aNVGData), size, NULL, NULL); } } + + // restore the old surface before restoring original modes + oldSurface->MakeCurrent(); // This will also call the SetCurrentRenderSurface + // Return the original blend mode + vgSeti(VG_BLEND_MODE, blendMode); // The NVG draw messes up the paint, scissoring & rects, so mark them as dirty TInt dirtyFlags = EHuiVg10GcStateFlagDirtyPaint | EHuiVg10GcStateFlagDirtyScissor | @@ -1387,7 +1393,6 @@ vgSeti(VG_MATRIX_MODE, VG_MATRIX_IMAGE_USER_TO_SURFACE); vgLoadMatrix(matrix); - oldSurface->MakeCurrent(); // This will also call the SetCurrentRenderSurface // Now we should have a rendered image in the image variable! // Release the surface, but not the context because we used a shared context @@ -1512,18 +1517,20 @@ TSize CHuiVg10Texture::ApplyMargin(VGImage aImage, TSize aSize, EGLDisplay aDisplay, EGLSurface aSurface, EGLContext aContext) { HUI_VG_INVARIANT(); - #ifdef __WINSCW__ - if ( eglMakeCurrent( aDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ) == EGL_FALSE ) - { - HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL NO_Surface could not be made current, eglErr: %04x"), eglGetError()); - return aSize; - } - #endif -#ifndef __WINS__ // Should possibly query the supported mode instead? + +#ifndef __WINSCW__ // Should possibly query the supported mode instead? VGImageFormat imageInternalFormat = VG_sARGB_8888_PRE; #else // This doesn't work in the Emulator anyways.. => remove? VGImageFormat imageInternalFormat = VG_sARGB_8888; + + // If the icon is also a current EGL surface, the getImageSubData + // won't succeed and return "image in use" -error.. + if ( eglMakeCurrent( aDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT ) == EGL_FALSE ) + { + HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL NO_Surface could not be made current, eglErr: %04x"), eglGetError()); + return aSize; + } #endif TInt stride = aSize.iWidth * 4; // VG_sARGB_8888(_PRE) is four bytes long (8888) @@ -1567,14 +1574,16 @@ } delete buf; HUI_VG_INVARIANT(); - #ifdef __WINSCW__ + +#ifdef __WINSCW__ // Make the PBuffer surface current again - if ( eglMakeCurrent(aDisplay, aSurface, aSurface, aContext) == EGL_FALSE ) - { - HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL aSurface could not be made current, eglErr: %04x"), eglGetError()); - return aSize; - } - #endif + if ( eglMakeCurrent(aDisplay, aSurface, aSurface, aContext) == EGL_FALSE ) + { + HUI_DEBUG1(_L("CHuiVg10Texture::ApplyMargin() - EGL aSurface could not be made current, eglErr: %04x"), eglGetError()); + return aSize; + } +#endif + // If icon size has to be changed, clear out old area for new DrawNVG round! if(aSize.iHeight > HaN) { diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/rendervg10/src/huivg10canvasgc.cpp --- a/uiacceltk/hitchcock/coretoolkit/rendervg10/src/huivg10canvasgc.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/rendervg10/src/huivg10canvasgc.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -144,8 +144,10 @@ // Acquire background texture const CHuiTexture* backgroundTexture = NULL; TInt err = CHuiStatic::Env().Skin().GetTexture(EHuiSkinBackgroundTexture, backgroundTexture); - ASSERT(backgroundTexture!=NULL); - __ASSERT_ALWAYS(err == KErrNone, User::Invariant()); + if(err) + { + return; + } // Apply background texture THuiImage background(*backgroundTexture); @@ -197,12 +199,13 @@ iGc->PopClip(); break; case CHuiDisplay::EClearWithSkinBackground: - TRect skinRect; - TRect dummy; - GetRectForItem(item.SkinBackground(), dummy, skinRect); backgroundTexture = s60skin->BackgroundTexture(item.SkinBackground()); if (backgroundTexture) { + TRect skinRect; + TRect dummy; + GetRectForItem(item.SkinBackground(), dummy, skinRect); + THuiImage background(*backgroundTexture); TPoint screenOrigin(0, 0); diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasTextureCache.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -771,19 +771,21 @@ else { // First clear - TRgb clearColor(KRgbBlack); - clearColor.SetAlpha(0); - iTempBitmapGc->SetPenColor(clearColor); - iTempBitmapGc->SetBrushColor(clearColor); + TRgb clearColor; if (iTempBitmap->DisplayMode() == EColor16MA) { + clearColor = aTextImage.iGcParams.iPenColor; iTempBitmapGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); } else { + clearColor = KRgbBlack; iTempBitmapGc->SetDrawMode(CGraphicsContext::EDrawModePEN); } - + + clearColor.SetAlpha(0); + iTempBitmapGc->SetPenColor(clearColor); + iTempBitmapGc->SetBrushColor(clearColor); iTempBitmapGc->Clear(); // Set correct gc settings @@ -1228,19 +1230,20 @@ touchCountChanged |= volatileBitmapOrMask; touchCountChanged |= (aImage.iBitmapTouchCount != bitmapTouchCount); touchCountChanged |= (aImage.iMaskTouchCount != maskTouchCount); - + TBool serialNumberChanged = (aImage.iSerialNumber != bitmap->SerialNumber()); + // Is touch count check enabled ? TBool touchCountCheckEnabled = CHuiStatic::Env().CanvasTextureCache().IsTouchCountCheckEnabled(); // Has it old content at all ? TBool hasContent = aImage.iTexture->HasContent(); - if (!hasContent || (touchCountCheckEnabled && touchCountChanged)) + if (!hasContent || (touchCountCheckEnabled && touchCountChanged) || serialNumberChanged) { // Upload bitmap content...this may be slow depending on used HW acceleration ! if (bitmap->SizeInPixels().iWidth > 0 && bitmap->SizeInPixels().iHeight > 0 && - (!mask || (mask->SizeInPixels().iWidth > 0 && mask->SizeInPixels().iHeight))) + (!mask || (mask->SizeInPixels().iWidth > 0 && mask->SizeInPixels().iHeight > 0))) { // EHuiTextureUploadFlagDoNotRetainResolution should be removed when // texturecoordinates with segmented textures work. @@ -1255,6 +1258,9 @@ CHuiTexture* texture = aImage.iTexture; texture->UploadL(*bitmap, mask, uploadFlags); + // Save the bitmap's serial number to the cached item + aImage.iSerialNumber = bitmap->SerialNumber(); + #ifdef HUI_DEBUG_PRINT_PERFORMANCE_INTERVAL TTime endTime; endTime.UniversalTime(); @@ -1274,6 +1280,11 @@ { RDebug::Print(_L(">>> CHuiCanvasGraphicImageRasterizer::UpdateCachedImageL: Reason for uploading is iMaskTouchCount %i, old was %i "), maskTouchCount, aImage.iMaskTouchCount); } + + if (serialNumberChanged) + { + RDebug::Print(_L(">>> CHuiCanvasGraphicImageRasterizer::UpdateCachedImageL: Reason for uploading is changed bitmap serial number %li, old was %li "), bitmap->SerialNumber(), aImage.iSerialNumber); + } RDebug::Print(_L(">>> CHuiCanvasGraphicImageRasterizer::UpdateCachedImageL: Upload of %ix%i %i+%i took %i ms"), texture->Size().iWidth, @@ -2077,7 +2088,7 @@ // CHuiCanvasTextureCache::CHuiCanvasTextureCache() { - EnableLowMemoryState(EFalse); + SetMemoryLevel(EHuiMemoryLevelNormal); CHuiStatic::Env().AddLowMemoryObserver(this); } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiCanvasVisual.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -77,6 +77,9 @@ // For handling possible background surface that window may have TBool iLayerUsesAlphaFlag; TRect iLayerExtent; + + RRegionBuf<5> iShapeRegion; + TPoint iShapeOrigin; }; EXPORT_C CHuiCanvasVisual* CHuiCanvasVisual::AddNewL(CHuiControl& aOwnerControl, @@ -120,6 +123,8 @@ iCanvasVisualData->iLayerUsesAlphaFlag = EFalse; iCanvasVisualData->iLayerExtent = TRect(); + iCanvasVisualData->iShapeOrigin = TPoint(); + // subwindow effects //EnableBrushesL(ETrue); } @@ -166,6 +171,7 @@ iCanvasVisualData->iPaintedRegion.Close(); iCanvasVisualData->iClipRegion.Close(); iCanvasVisualData->iChildCanvasList.Close(); + iCanvasVisualData->iShapeRegion.Close(); } delete iCanvasVisualData; @@ -548,7 +554,14 @@ // Draws background if it has been defined if (drawVisualContent && IsBackgroundDrawingEnabled()) - { + { + if (iCanvasVisualData->iCanvasPainter && + !iCanvasVisualData->iLayerExtent.IsEmpty()) + { + // In SW rendering case, we support only clearing with transparent. + iCanvasVisualData->iCanvasPainter->ClearCapturingBufferArea(aDisplayRect); + } + iCanvasVisualData->iBackground->DrawSelf(aGc, aDisplayRect); } @@ -1209,6 +1222,32 @@ } +EXPORT_C void CHuiCanvasVisual::SetShape(const TPoint& aOrigin, const TRegion& aRegion) + { + iCanvasVisualData->iShapeOrigin = aOrigin; + iCanvasVisualData->iShapeRegion.Copy(aRegion); + if ( iCanvasVisualData->iShapeRegion.CheckError() ) + { + // fallback to full + iCanvasVisualData->iShapeRegion.Clear(); + } + } + +EXPORT_C TBool CHuiCanvasVisual::HasCustomShape() const + { + return iCanvasVisualData->iShapeRegion.Count(); + } + +EXPORT_C TPoint CHuiCanvasVisual::ShapeOrigin() const + { + return iCanvasVisualData->iShapeOrigin; + } + +EXPORT_C const TRegion& CHuiCanvasVisual::ShapeRegion() const + { + return iCanvasVisualData->iShapeRegion; + } + TBool CHuiCanvasVisual::IsCanvasClippingEnabled() const { return iCanvasVisualData->iCanvasFlags & EHuiCanvasFlagEnableCanvasClipping; @@ -1484,3 +1523,10 @@ } aRecursivePaintRegion.Tidy(); } + +EXPORT_C TRect CHuiCanvasVisual::CommandBufferCoverage(TInt aOrientation) + { + return iCanvasVisualData->iCanvasPainter->CommandBufferCoverage(aOrientation); + } + + diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiDisplay.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -853,7 +853,7 @@ if ( iForegroundBitmapGc ) { - // If we are in SW rendering mode, then SW bitmap is blended. + // If we are in SW rendering mode, then SW bitmap may be blended. // However, it's possible that nothing is drawn below, so clear // background. const TRgb oldBgColor = iBackgroundColor; @@ -891,11 +891,12 @@ } } - if ( iForegroundBitmapGc ) + if ( iForegroundBitmapGc && iForegroundTextureTransparency ) { + // There is ALF content in the background, we have to + // clear foreground bitmap. + iForegroundBitmapGc->Reset(); - iForegroundBitmapGc->SetClippingRegion( iGc->ClipRegion() ); - TRgb clearColor = KRgbBlack; clearColor.SetAlpha(0x00); @@ -1474,8 +1475,10 @@ // Acquire background texture const CHuiTexture* backgroundTexture = NULL; TInt err = iEnv.Skin().GetTexture(EHuiSkinBackgroundTexture, backgroundTexture); - ASSERT(backgroundTexture!=NULL); - __ASSERT_ALWAYS(err == KErrNone, USER_INVARIANT()); + if( err ) + { + return; + } // Apply background texture THuiImage background(*backgroundTexture); @@ -1528,9 +1531,9 @@ break; case EClearWithSkinBackground: backgroundTexture = s60skin->BackgroundTexture(item.SkinBackground()); - TRect skinRect = s60skin->SkinRect(item.SkinBackground()); if (backgroundTexture) { + TRect skinRect = s60skin->SkinRect(item.SkinBackground()); THuiImage background(*backgroundTexture); TPoint screenOrigin(0, 0); @@ -1622,6 +1625,11 @@ return iForegroundTexture; } +EXPORT_C void CHuiDisplay::SetForegroundTextureOptions(TBool aTransparency) + { + iForegroundTextureTransparency = aTransparency; + } + void CHuiDisplay::UpdateForegroundTexture(const TRect& aRect) { if (iForegroundTexture && iForegroundBitmap && !aRect.IsEmpty()) @@ -1651,6 +1659,14 @@ { if (iForegroundTexture) { + THuiQuality originalQuality = iGc->Quality(); + if ( originalQuality != EHuiQualityFast ) + { + // Enforce fast quality to be used - we want one to one mapping + // & no antialiasing. + iGc->SetQuality( EHuiQualityFast ); + } + // The following is similar to HWAcceleratedClearWithSkinBackground, // except blending is enabled. @@ -1663,9 +1679,24 @@ iGc->SetPenColor(KRgbWhite); iGc->SetPenAlpha(255); iGc->SetAlign(EHuiAlignHLeft, EHuiAlignVTop); - iGc->Enable(CHuiGc::EFeatureBlending); + + if ( iForegroundTextureTransparency ) + { + iGc->Enable(CHuiGc::EFeatureBlending); + } + else + { + iGc->Disable(CHuiGc::EFeatureBlending); + } + iGc->Enable(CHuiGc::EFeatureClipping); iGc->DrawImage(image, screenOrigin, image.Texture().Size()); + + if ( originalQuality != EHuiQualityFast ) + { + // Restore original quality. + iGc->SetQuality( originalQuality ); + } } } @@ -1707,3 +1738,17 @@ return iForegroundBitmap; } +EXPORT_C void CHuiDisplay::CopyScreenToBitmapL(CFbsBitmap* aBitmap) + { + MHuiRenderSurface* oldSurface = CHuiStatic::CurrentRenderSurface(); + RenderSurface().MakeCurrent(); + + TInt err = iGc->CopyScreenToBitmap( aBitmap ); + + if (oldSurface && oldSurface != &RenderSurface()) + { + oldSurface->MakeCurrent(); + } + + User::LeaveIfError( err ); + } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiEnv.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -741,9 +741,12 @@ TReal32 elapsedTime = 0; // Investigate whether the environment is released - if(self->iState == EReleased) + if(self->iState == EReleased /*|| self->iPauseDrawing*/ ) { - HUI_DEBUG(_L("CHuiEnv::RefreshCallBack() - Warning: Refresh callback called while environment is released.")); + if (!self->iPauseDrawing) + { + HUI_DEBUG(_L("CHuiEnv::RefreshCallBack() - Warning: Refresh callback called while environment is released.")); + } return KErrNone; } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffect.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -272,6 +272,10 @@ // Check if cache is up-to date or does it need to be refreshed TBool cachedRenderTargetNeedsRefresh = (iRoot->Changed() || aRefreshCachedRenderTarget || (enableBackground && !useFrozenBackground)); + if (!iCachedRenderTarget || (iCachedRenderTarget && iCachedRenderTarget->Size() != iRoot->VisualRect().Size())) + { + cachedRenderTargetNeedsRefresh = ETrue; + } // Try to apply also margins, we cannot just use aDisplayRect directly TRect targetRect = iRoot->VisualRect(); diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiFxEffectCache.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -126,6 +126,7 @@ if (count == 0) { Remove(iCachedEffects, cachedNode); + cachedNode->Delete(); delete cachedNode; } } @@ -313,6 +314,10 @@ delete iFileName; delete iParser; } +void CHuiFxEffectCacheEffectNode::Delete() + { + delete iEffect; + } TPtrC CHuiFxEffectCacheEffectNode::Id() { @@ -371,7 +376,7 @@ void CHuiFxEffectCacheEffectNode::ParsingEndedBefore() { - iParser->Effect( iEffect ); + iParser->Effect( iEffect ); // moves ownership of iEffect to iCachedNodeArray, and will be deleted in UnUse() / Delete(). } void CHuiFxEffectCacheEffectNode::ParsingEndedAfter(MHuiFxEffectCacheNode *aCached) diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiGc.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiGc.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiGc.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -28,6 +28,8 @@ #include "uiacceltk/HuiUtil.h" // For hui assert. #include "uiacceltk/HuiTransformation.h" +#include "huiextension.h" + #include #include @@ -767,6 +769,18 @@ } } +TInt CHuiGc::CopyScreenToBitmap(CFbsBitmap* aBitmap) + { + THuiGcCopyScreenToBitmapParams params; + params.iErrorCode = KErrNotSupported; + params.iBitmap = aBitmap; + TAny* ptr = ¶ms; + + GcExtension(KHuiGcCopyScreenToBitmap, &ptr); + + return params.iErrorCode; + } + EXPORT_C void CHuiGc::TransformDirtyRect(THuiRealRect& /*aRect*/) { // No sensible implementation for HuiGc base class. Implement at least in diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiS60Skin.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -59,7 +59,6 @@ iSkinControlContext = CAknsBasicBackgroundControlContext::NewL( KAknsIIDQsnBgScreen, TRect(TPoint(0, 0), HuiUtil::ScreenSize()), ETrue); iSpare = new (ELeave) TPrivData; - iSkinChanged = ETrue; } @@ -143,7 +142,7 @@ iBackgroundTexture->SetSkinContent(ETrue); iBackgroundTexture->iContentObservers.AppendL(*this); } - else if(iSkinChanged) + else if(iReloadBackground || !iBackgroundTexture->HasContent() ) { iBackgroundTexture->Reset(); delete iBackgroundBitmap; @@ -163,10 +162,33 @@ HUI_DEBUG1(_L("CHuiS60Skin::UpdateBackgroundL - Free memory at exit: %i"), HuiUtil::FreeMemory()); } +void CHuiS60Skin::FreeAllBackgroundTextureResources() + { + // delete old contents + + TBackgroundTexture bgTexture; + TInt itemCount = ((TPrivData*)(iSpare))->iBackgrounds.Count(); + for (TInt index = 0; index < itemCount; index++) + { + bgTexture = ((TPrivData*)(iSpare))->iBackgrounds[index]; + if( bgTexture.iBackgroundTexture ) + { + bgTexture.iBackgroundTexture->Reset(); + } + } + + delete iBackgroundTexture; + iBackgroundTexture = NULL; + delete iBackgroundBitmap; + iBackgroundBitmap = NULL; + iBackgroundRect = TRect(0,0,0,0); + iCachedSkinItems.ResetAndDestroy(); + } + EXPORT_C void CHuiS60Skin::SkinContentChanged() { - iSkinChanged = ETrue; + FreeAllBackgroundTextureResources(); } EXPORT_C void CHuiS60Skin::SkinConfigurationChanged( @@ -191,7 +213,8 @@ if(aSkinTextureId == EHuiSkinBackgroundTexture && CHuiStatic::Renderer().Id () != EHuiRenderPluginBitgdi) { - if(!iBackgroundTexture || iReloadBackground || iSkinChanged) + if(!iBackgroundTexture || ( iBackgroundTexture && !iBackgroundTexture->HasContent() ) || + iReloadBackground ) { UpdateBackgroundL(); iReloadBackground = EFalse; @@ -227,12 +250,11 @@ EXPORT_C void CHuiS60Skin::NotifyDisplaySizeChangedL() { // The background is now different. - SkinContentChanged(); // for changing the iSkinChanged flag + SkinContentChanged(); // to delete old contents + Env().NotifySkinChangedL(); Env().TextStyleManager().NotifyDisplaySizeChangedL(); ReloadBgTexturesL(); - - iSkinChanged = EFalse; } @@ -343,7 +365,7 @@ CFbsBitmap* bitmap = new (ELeave) CFbsBitmap(); CleanupStack::PushL(bitmap); - User::LeaveIfError( bitmap->Create(skinrect.Size(), EColor64K) ); + User::LeaveIfError( bitmap->Create(skinrect.Size(), EColor16MAP) ); CFbsBitmapDevice* device = CFbsBitmapDevice::NewL(bitmap); CleanupStack::PushL(device); @@ -366,7 +388,7 @@ else { CFbsBitmap* bitmap = SearchCachedSkinItemBitmap(aID); - if(iSkinChanged || !bitmap) + if(!bitmap) { TRect skinrect; TRect dummy; @@ -427,7 +449,11 @@ { bgTexture = ((TPrivData*)(iSpare))->iBackgrounds[index]; delete bgTexture.iBackgroundTexture; + bgTexture.iBackgroundTexture = NULL; + // put back. In case of a leave NULL texture is stored and we can try to re-create it later + ((TPrivData*)(iSpare))->iBackgrounds[index] = bgTexture; bgTexture.iBackgroundTexture = CreateSkinBackgroundL(bgTexture.iID); + // texture created succesfully ((TPrivData*)(iSpare))->iBackgrounds[index] = bgTexture; } } @@ -449,8 +475,18 @@ if (bgItem.ClearMode() == CHuiDisplay::EClearWithSkinBackground) { bgTexture.iID = bgItem.SkinBackground(); - bgTexture.iBackgroundTexture = CreateSkinBackgroundL(bgItem.SkinBackground()); - ((TPrivData*)(iSpare))->iBackgrounds.Append(bgTexture); + bgTexture.iBackgroundTexture = NULL; + TRAPD(err, bgTexture.iBackgroundTexture = CreateSkinBackgroundL(bgItem.SkinBackground())); + // if texture creation failed because our own internal services were busy + // still append NULL texture so we know to try it again later + if(err == KErrNone || err == KErrTimedOut ) + { + ((TPrivData*)(iSpare))->iBackgrounds.Append(bgTexture); + } + else + { + User::Leave(err); + } } } } @@ -473,6 +509,19 @@ bgTexture = ((TPrivData*)(iSpare))->iBackgrounds[index]; if (bgTexture.iID == aID) { + if(!bgTexture.iBackgroundTexture && !bgTexture.iBackgroundTexture->HasContent()) + { + delete bgTexture.iBackgroundTexture; + bgTexture.iBackgroundTexture = NULL; + TRAPD(err, bgTexture.iBackgroundTexture = CreateSkinBackgroundL(bgTexture.iID)); + // put bgTexture back to the array also in leave cases + // otherwise we could leave invalid pointer in array + ((TPrivData*)(iSpare))->iBackgrounds[index] = bgTexture; + if(err) + { + return NULL; // creating failed for some reason + } + } return bgTexture.iBackgroundTexture; } } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiStatic.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -70,7 +70,7 @@ iStatus = KErrNotFound; } - static void DoGuardedOpL(const TAlfCommandParams& aInParams, + static TInt DoGuardedOpErrL(const TAlfCommandParams& aInParams, TDes8& aOutParams, RNotifier& aNotifier, const TDesC8* aInParams2 = 0 // ugly extension, really @@ -113,21 +113,36 @@ User::WaitForRequest(me->iTimerStatus); aOutParams.Copy(*me->iRetBuf); delete me; - User::LeaveIfError(err); + return err; } else { me->SetActive(); - User::Leave( KErrTimedOut ); + return KErrTimedOut; } } + static void DoGuardedOpL(const TAlfCommandParams& aInParams, + TDes8& aOutParams, + RNotifier& aNotifier, + const TDesC8* aInParams2 = 0 // ugly extension, really + ) + { + TInt err = DoGuardedOpErrL(aInParams, aOutParams, aNotifier, aInParams2); + User::LeaveIfError(err); + } + static TInt DoGuardedOp(const TAlfCommandParams& aInParams, TDes8& aOutParams, RNotifier& aNotifier) { TInt ret = KErrNone; - TRAP(ret, DoGuardedOpL(aInParams, aOutParams, aNotifier);) + TInt err = KErrNone; + TRAP(ret, err = DoGuardedOpErrL(aInParams, aOutParams, aNotifier);) + if (ret == KErrNone) + { + ret = err; + } return ret; } @@ -176,9 +191,8 @@ iNotif.iLayoutMirrored = (iStatus.Int() > 0); SetActive(); TAlfCommandParams params={EAlfIsMirrorred,0,0,0}; - TPckgC pkg(params); - TBuf8<1> awkwardApiDummy; - iNotif.iNotif.StartNotifierAndGetResponse(iStatus,TUid::Uid(KAlfAppFwProxyUid), pkg, awkwardApiDummy); + iParams() = params; + iNotif.iNotif.StartNotifierAndGetResponse(iStatus,TUid::Uid(KAlfAppFwProxyUid), iParams, iAwkwardApiDummy); } void DoCancel() @@ -189,6 +203,9 @@ private: CAppFwProxy& iNotif; + + TBuf8<1> iAwkwardApiDummy; + TPckgBuf iParams; }; CAppFwProxy():iLayoutMirrored(KErrNotFound) diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiTextureManager.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiTextureManager.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiTextureManager.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -2113,7 +2113,7 @@ HUI_DEBUG5(_L("CHuiTextureManager::RestoreL() - Restoring texture 0x%x (\"%S\", id: %i) [%i/%i]"), tex, &(tex->ImageFileName()), iTextures[i]->iId, i+1, iTextures.Count()); // Restore the texture. - tex->RestoreL(); + TRAP_IGNORE( tex->RestoreL() ); } } else diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/HuiVisual.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -2156,7 +2156,7 @@ { SetFreezeState(EFalse); - __ALFFXLOGSTRING1("CHuiVisual::SetEffect - : 0x%d ", aEffect ); + __ALFFXLOGSTRING2("CHuiVisual::SetEffect - : 0x%d on visual 0x%x", aEffect, this ); // If effect is replaced by a new effect, we don't want the effect end callback // as it would end the new effect if ( iVisualData->iEffect ) diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaspainter.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -68,10 +68,13 @@ CHuiCanvasCommandBuffer* newBuffer = new(ELeave) CHuiCanvasCommandBuffer; CleanupStack::PushL(newBuffer); newBuffer->iCommands = commands; - if (iCanvasVisual && iCanvasVisual->Display()) + + // the orientation will be defined by the commandbuffer + /*if (iCanvasVisual && iCanvasVisual->Display()) { newBuffer->iOrientation = iCanvasVisual->Display()->Orientation(); - } + }*/ + iCommandBuffers.AppendL( newBuffer); CleanupStack::Pop(2, commands); @@ -240,3 +243,25 @@ return EFalse; } + + +TRect CHuiCanvasPainter::CommandBufferCoverage(TInt aOrientation) + { + TInt bufferCount = iCommandBuffers.Count(); + RRegion tempRegion; + + for (TInt cb = 0; cb < bufferCount; cb++) + { + if (iCommandBuffers[cb]->iOrientation == aOrientation) + { + // should this be original display rect or update region + tempRegion.AddRect(iCommandBuffers[cb]->iOriginalDisplayRect); + } + } + return tempRegion.BoundingRect(); + } + +void CHuiCanvasPainter::ClearCapturingBufferArea(const TRect& /*aRect*/) + { + // Not supported by default + } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/huicanvaswsbitgc.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsbitgc.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsbitgc.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -205,3 +205,18 @@ { return ETrue; } + +void CHuiCanvasWsBitGc::ClearCapturingBufferArea(const TRect& aRect) + { + if ( iCapturingBitGc ) + { + TRgb clearColor = KRgbBlack; + clearColor.SetAlpha(0x0); + + iCapturingBitGc->SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); + iCapturingBitGc->SetPenColor(clearColor); + iCapturingBitGc->SetBrushColor(clearColor); + iCapturingBitGc->SetBrushStyle(CGraphicsContext::ESolidBrush); + iCapturingBitGc->Clear(aRect); + } + } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswshwgc.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -2055,6 +2055,11 @@ return EHuiCanvasWsHw; } +void CHuiCanvasWsHwGc::ClearCapturingBufferArea(const TRect& /*aRect*/) + { + // Not supported by HW GC. + } + THuiCanvasDrawMode CHuiCanvasWsHwGc::SelectCanvasDrawMode(TInt aWsDrawMode) { if (aWsDrawMode == MWsGraphicsContext::EDrawModeWriteAlpha) diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswspainter.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -131,7 +131,6 @@ { if (iCanvasVisual) { - iCanvasVisual->Env().CanvasTextureCache().ReleaseAllCachedEntries(*iCanvasVisual); iCanvasVisual->Env().RemoveMemoryLevelObserver(this); } else @@ -369,8 +368,8 @@ * */ TBool clearBeforeHandlingBuffer = iCanvasWsGc->IsRenderBufferEnabled() - && (!(aUser.Flags() & EHuiVisualFlagOpaqueHint) || aUser.IsBackgroundDrawingEnabled()) - && !isFullUpdateRegionCleared; + && (!(aUser.Flags() & EHuiVisualFlagOpaqueHint) || aUser.IsBackgroundDrawingEnabled()); + // TODO: Should avoid trap, but EndActionL must always be called TRAPD(err, DoHandleAllBuffersL( aDisplayRect, aAction, aUser, aGc, aPos, @@ -661,6 +660,14 @@ } break; } + case EAlfFrameOrientation: + { + TInt orientation; + iWsCommandBufferReader->ReadInt32L(orientation); + commandBuffer.iOrientation = (CHuiGc::TOrientation)orientation; + break; + } + case EAlfSetUpdateRegion: { WsSetUpdateRegionL(aIndex); @@ -790,6 +797,13 @@ } break; } + case EAlfFrameOrientation: + { + TInt orientation; + iWsCommandBufferReader->ReadInt32L( orientation ); + break; + } + case EAlfSetUpdateRegion: { WsSetUpdateRegionL(aIndex); @@ -2484,6 +2498,11 @@ return result; } +void CHuiCanvasWsPainter::ClearCapturingBufferArea(const TRect& aRect) + { + iCanvasWsGc->ClearCapturingBufferArea(aRect); + } + TRect CHuiCanvasWsPainter::DirtyRect() const { iTempRegion.Clear(); diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/huicanvaswsswgc.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsswgc.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/huicanvaswsswgc.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -1519,3 +1519,9 @@ { return iAction == EDrawBuffer; } + +void CHuiCanvasWsSwGc::ClearCapturingBufferArea(const TRect& /*aRect*/) + { + // Not supported by fallback GC. + } + diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp --- a/uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/coretoolkit/src/huigifanimationtexture.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -174,7 +174,8 @@ iFrameInterval(-1), iFrameCount(0), iFlags(aFlags), - iId(aId) + iId(aId), + iOriginalFileInUse(EFalse) { } @@ -203,11 +204,16 @@ TChar drive; User::LeaveIfError( DriveInfo::GetDefaultDrive(DriveInfo::EDefaultRam, drive ) ); - iFilename = HBufC::NewL(parse.NameAndExt().Size() + 4); + // 32 extra for textureid and 4 for "temp" + iFilename = HBufC::NewL(parse.NameAndExt().Size() + 4 + 32+ 4); TPtr ptr = iFilename->Des(); ptr.Append(drive); - ptr.Append(_L(":\\")); + ptr.Append(_L(":\\temp")); + // with the texture id:s the + // name should be "unique" + ptr.AppendNum(iTextureId1); + ptr.AppendNum(iTextureId2); ptr.Append(parse.NameAndExt()); RFs fs; @@ -220,10 +226,11 @@ CleanupStack::PopAndDestroy(); if(err != KErrNone) - { - delete iFilename; - iFilename = aFilename.AllocL(); - } + { + iOriginalFileInUse = ETrue; + delete iFilename; + iFilename = aFilename.AllocL(); + } iTexture1 = &iManager.LoadTextureL( @@ -246,18 +253,22 @@ iTexture = 0; - RFs fs; - TInt err = fs.Connect(); - if(err == KErrNone) + // Don't delete the file if the original + // file was in use instead of the RAM copy + if (!iOriginalFileInUse) { - CFileMan* fileman = 0; - TRAP(err, fileman = CFileMan::NewL(fs)); - if(err == KErrNone) + RFs fs; + TInt err = fs.Connect(); + if(err == KErrNone) { - fileman->Delete(iFilename->Des()); + CFileMan* fileman = 0; + TRAP(err, fileman = CFileMan::NewL(fs)); + if(err == KErrNone) + { + fileman->Delete(iFilename->Des()); + } } } - delete iFilename; } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/goommonitor/data/goomconfig.xml --- a/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/goommonitor/data/goomconfig.xml Mon Mar 15 12:43:37 2010 +0200 @@ -27,9 +27,9 @@ --> - - - + + + @@ -72,7 +72,7 @@ --> - + YES --> id must be valid. continue - // YES --> Is this exit event? - // Id found in cache? --> ---> NO --> continue, but refreshed value should overwrite this valua in iEngine. - // NO --> we must wait for the value. - - if (!iToWg) - { - iToWg = iWindowManager->Bridge()->FindWgForAppUid(iToUid); // This call might be now obsolete - } - - __ALFFXLOGSTRING2("Window group from to-Application UID: 0x%X wg: 0x%x", iToUid, iToWg); - } - - // How do we handle the case where we have app id, parent id and focus wg? - - if ( iType == AknTransEffect::EParameterAvkonInternal ) - { - // Is this "from" or "to" or do we just use iFocusWg? - iToWg = iWindowManager->Bridge()->FindWgForAppUid(iToUid); - - __ALFFXLOGSTRING2("Window group from internal-Application UID: 0x%X wg: 0x%x", iToUid, iToWg); - // Is this "from" or "to" or do we just use iFocusWg? - if ( iParentUid != KNullUid ) - { - iFromWg = iWindowManager->Bridge()->FindWgForAppUid(iParentUid); - __ALFFXLOGSTRING2("Window group from parent-Application UID: 0x%X wg: 0x%x", iParentUid, iFromWg); - } - } - - // What do we do if there are no windows? - // We could use the built-in effect layer, but now we just stop here - - // We don't handle the EParameterAvkonInternal type - // TODO: revise this condition, when appui is available from wserv - /*if ( ( ( iFromWg == 0 || iFromWg == KErrNotFound ) && - ( iToWg == 0 || iToWg == KErrNotFound ) && - ( iFocusWg == 0 || iFocusWg == KErrNotFound ) ) || - iType == AknTransEffect::EParameterAvkonInternal ) - { // TODO: Uncomment, when appui available in alfbridge - // bail out, cannot start an effect without any windows - // We don't need to reset the WinIdLists as they have not been filled - iIdle->Start(TCallBack(FailedFullscreen,this)); - return; - } - */ - // If we don't have the target window, we bail out - // This is because we get into trouble if another beginfullscreen - // follows too fast. - /* - if ( iToWg == 0 || iToWg == KErrNotFound ) - { - iIdle->Start(TCallBack(FailedFullscreen,this)); - return; - } - */ - - TBool blocked = iController->IsBlocked( iFromUid, iToUid ); + TBool blocked = iFullScreenController->IsBlocked( iFromUid, iToUid ); if (blocked) { return; @@ -665,12 +590,11 @@ if ( err != KErrNone || fileName.Length() == 0 || !FileExistsL( resourceDir, fileName ) ) { // Did not find an effect file - nothing to show - __ALFFXLOGSTRING2(" <- CAlfServerDrawer:: Could not get full screen kml, error %d %S", err, &fileName) + __ALFFXLOGSTRING2("CAlfServerDrawer::DoSendBeginFullscreenL - Could not get full screen kml, error %d %S", err, &fileName) iFromWg = KErrNotFound; iToWg = KErrNotFound; iFromScreen = KErrNotFound; iToScreen = KErrNotFound; - // iIdle->Start( TCallBack( FailedFullscreen, this ) ); return; } @@ -716,7 +640,7 @@ // 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 = 13 * sizeof(TInt); //operation, TYPE, 2 wg ids, 2 app uids, 2 secure ids, flags and rect bufferSize += sizeof(TPtrC); bufferSize += resourceDir.Length() * 2; bufferSize += sizeof(TPtrC); @@ -725,10 +649,9 @@ // I don't think we need this TInt index = 0; - IncreaseHandle(); + IncreaseFullScreenHandle(); - iTransitionEndObserver->Cancel(); - iIdle->Cancel(); //cancel if running. + iFullScreenTransitionEndObserver->Cancel(); iFinishFullScreen->Cancel(); iFullScreenTimeout->Cancel(); @@ -740,7 +663,7 @@ RMemWriteStream stream( bridgeBuffer, bufferSize ); // The writes should not leave if we have calculated our buffer length correctly. stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginFullscreen ); - stream.WriteInt32L( iCurrHandle ); + stream.WriteInt32L( iCurrentFullScreenHandle ); stream.WriteInt32L( iType ); if ( iType == AknTransEffect::EParameterType && isExit ) { @@ -750,6 +673,10 @@ // AppUid stream.WriteInt32L( iToUid.iUid ); stream.WriteInt32L( iFromUid.iUid ); + + // SecureId + stream.WriteInt32L( iToSid.iId ); + stream.WriteInt32L( iFromSid.iId ); stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete @@ -762,6 +689,10 @@ // AppUid stream.WriteInt32L( iToUid.iUid ); stream.WriteInt32L( iFromUid.iUid ); + + // SecureId + stream.WriteInt32L( iToSid.iId ); + stream.WriteInt32L( iFromSid.iId ); stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete stream.WriteInt32L( KErrNotFound ); // was iToScreen, obsolete @@ -787,7 +718,7 @@ iWindowManager->PostIt( bridgerData ); stream.Close(); - iTransitionEndObserver->StartObserving( TCallBack( TransitionFinished, this ), iCurrHandle ); + iFullScreenTransitionEndObserver->StartObserving( TCallBack( FullScreenTransitionFinished, this ), iCurrentFullScreenHandle ); } // iFlags and iAction will contain some extra information that can be used to control the effect: @@ -859,7 +790,7 @@ // TInt CAlfServerDrawer::SendEndFullscreen() { - __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendEndFullscreen"); + __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen"); if ( iFullScreenEndSent ) { @@ -868,12 +799,11 @@ } iFullScreenEndSent = ETrue; - __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendEndFullscreen"); - iTransitionEndObserver->Cancel(); + __ALFFXLOGSTRING("CAlfServerDrawer::SendEndFullscreen"); + iFullScreenTransitionEndObserver->Cancel(); iFullScreenTimeout->Cancel(); iFinishFullScreen->Cancel(); - iIdle->Cancel(); //cancel if running. - /* + /* TUint action = iAction; if ( iType == AknTransEffect::EParameterAvkonInternal ) { @@ -923,7 +853,7 @@ TRAP_IGNORE( { stream.WriteInt32L( MAlfGfxEffectPlugin::EEndFullscreen ); - stream.WriteInt32L( iCurrHandle ); + stream.WriteInt32L( iCurrentFullScreenHandle ); stream.WriteInt32L( iType ); stream.WriteInt32L( iToWg ); @@ -954,10 +884,10 @@ }); bridgerData.Set( EAlfEffectFx, iAction, bufferSize, (TAny*) index ); - __ALFFXLOGSTRING(" <- CAlfServerDrawer::sending bridgedata"); + __ALFFXLOGSTRING1("CAlfServerDrawer::SendEndFullscreen - sending bridgedata, Current handle %d", iCurrentFullScreenHandle); iWindowManager->PostIt( bridgerData ); stream.Close(); - iTransitionEndObserver->StartObserving( TCallBack( TransitionFinished, this ), iCurrHandle ); + iFullScreenTransitionEndObserver->StartObserving( TCallBack( FullScreenTransitionFinished, this ), iCurrentFullScreenHandle ); } iFullScreenFinished = EFalse; @@ -987,9 +917,8 @@ return KErrNone; } - iTransitionEndObserver->Cancel(); - iIdle->Cancel(); //cancel if running. - + iFullScreenTransitionEndObserver->Cancel(); + iFullScreenFxSent = EFalse; iFullScreenEndSent = ETrue; @@ -1012,7 +941,7 @@ TRAP_IGNORE( { stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortFullscreen ); - stream.WriteInt32L( iCurrHandle ); + stream.WriteInt32L( iCurrentFullScreenHandle ); stream.WriteInt32L( iType ); //if ( iType == AknTransEffect::EParameterType ) { @@ -1070,6 +999,7 @@ if ( fileName.Length() == 0 || !fileExists) { + __ALFFXLOGSTRING2("CAlfServerDrawer::SendBeginControlTransition - Could not get control effect kml, file exists: %d %S. ABORTING!", fileExists, &fileName) return KErrNotFound; } @@ -1103,10 +1033,9 @@ TInt index = 0; - IncreaseHandle(); - iTransitionEndObserver->Cancel(); - iFinishFullScreen->Cancel(); - + IncreaseControlHandle(); + iControlTransitionEndObserver->Cancel(); + iControlTimeout->Cancel(); // control transitions are not supposed to have the phasing of full screen transitions, // we should be ready to go immediately. @@ -1124,7 +1053,7 @@ TRAP_IGNORE( { stream.WriteInt32L( MAlfGfxEffectPlugin::EBeginComponentTransition ); - stream.WriteInt32L( iCurrHandle ); + stream.WriteInt32L( iCurrentControlHandle ); stream.WriteInt32L( iControlHandle ); // window handle stream.WriteInt32L( iControlWindowGroup ); // window group id stream.WriteInt32L( 0 ); // "screen number"; not used; save place for future @@ -1136,14 +1065,15 @@ stream.CommitL(); }); bridgerData.Set( EAlfControlEffectFx, iControlAction, bufferSize, (TAny*) index ); - __ALFFXLOGSTRING(" <- CAlfServerDrawer::sending bridgedata"); + __ALFFXLOGSTRING1("CAlfServerDrawer::SendBeginControlTransition - sending bridgedata, Current handle: %d", iCurrentControlHandle); iWindowManager->PostIt( bridgerData ); stream.Close(); - iTransitionEndObserver->StartObserving( TCallBack( TransitionFinished, this ), iCurrHandle ); + iControlTransitionEndObserver->StartObserving( TCallBack( ControlTransitionFinished, this ), iCurrentControlHandle ); } iFullScreenFinished = EFalse; - iFinishFullScreen->Start( KAlfLongEffectTimeout, TCallBack( ControlTimeout, this ) ); + + iControlTimeout->Start( KAlfLongEffectTimeout, TCallBack( ControlTimeout, this ) ); return KErrNone; } @@ -1154,11 +1084,9 @@ TInt CAlfServerDrawer::SendFinishControlTransition() { // We should now delete the effects from any controls that remain active. - __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendFinishControlTransition"); - iTransitionEndObserver->Cancel(); - iIdle->Cancel(); //cancel if running. - iFinishFullScreen->Cancel(); - + __ALFFXLOGSTRING("CAlfServerDrawer::SendFinishControlTransition >>"); + iControlTransitionEndObserver->Cancel(); + // Send the data to CAlfAppUI via bridge TAlfBridgerData bridgerData; @@ -1178,19 +1106,20 @@ TRAP_IGNORE( { stream.WriteInt32L( MAlfGfxEffectPlugin::EAbortComponentTransition ); - stream.WriteInt32L( iCurrHandle ); + stream.WriteInt32L( iCurrentControlHandle ); stream.WriteInt32L( 0 ); stream.WriteInt32L( 0 ); stream.WriteInt32L( 0 ); stream.WriteInt32L( 0 ); stream.CommitL(); }); - bridgerData.Set( EAlfStopEffectFx, iAction, bufferSize, (TAny*) index ); - __ALFFXLOGSTRING(" <- CAlfServerDrawer::sending bridgedata"); + // TODO, check, if iCurrentHandle is approriate + bridgerData.Set( EAlfStopControlEffectFx, iCurrentControlHandle, bufferSize, (TAny*) index ); + __ALFFXLOGSTRING1("CAlfServerDrawer::sending bridgedata, Stop control handle: %d", iCurrentControlHandle); iWindowManager->PostIt( bridgerData ); stream.Close(); } - + __ALFFXLOGSTRING("CAlfServerDrawer::SendFinishControlTransition <<"); return KErrNone; } @@ -1200,28 +1129,67 @@ TInt CAlfServerDrawer::SendAbortControlTransition() { __ALFFXLOGSTRING(" <- CAlfServerDrawer::SendAbortControlTransition"); - iTransitionEndObserver->Cancel(); + iControlTransitionEndObserver->Cancel(); // We should now delete the effects from any controls that remain active. return SendFinishControlTransition(); } // --------------------------------------------------------------------------- +// CAlfServerDrawer::FromUid // --------------------------------------------------------------------------- // TUid& CAlfServerDrawer::FromUid() { return iFromUid; } - + +// --------------------------------------------------------------------------- +// CAlfServerDrawer::FromSid +// --------------------------------------------------------------------------- +// +TSecureId& CAlfServerDrawer::FromSid() + { + return iFromSid; + } + // --------------------------------------------------------------------------- +// CAlfServerDrawer::FromWg // --------------------------------------------------------------------------- -// +// +TInt CAlfServerDrawer::FromWg() + { + return iFromWg; + } + + +// --------------------------------------------------------------------------- +// CAlfServerDrawer::ToUid +// --------------------------------------------------------------------------- +// TUid& CAlfServerDrawer::ToUid() { return iToUid; } // --------------------------------------------------------------------------- +// CAlfServerDrawer::ToSid +// --------------------------------------------------------------------------- +// +TSecureId& CAlfServerDrawer::ToSid() + { + return iToSid; + } + +// --------------------------------------------------------------------------- +// CAlfServerDrawer::ToWg +// --------------------------------------------------------------------------- +// +TInt CAlfServerDrawer::ToWg() + { + return iToWg; + } + +// --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // TUint& CAlfServerDrawer::Action() @@ -1238,27 +1206,46 @@ } // --------------------------------------------------------------------------- +// Guarantee, that control and fullscreen handles are unique. // --------------------------------------------------------------------------- // -void CAlfServerDrawer::IncreaseHandle() +void CAlfServerDrawer::IncreaseControlHandle() { - iCurrHandle++; + // handles must be unique, but increasing control handle should not change fullscreen handle + TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle; + highestHandle++; + iCurrentControlHandle = highestHandle; } +void CAlfServerDrawer::IncreaseFullScreenHandle() + { + TInt highestHandle = iCurrentControlHandle > iCurrentFullScreenHandle ? iCurrentControlHandle : iCurrentFullScreenHandle; + highestHandle++; + iCurrentFullScreenHandle = highestHandle; + } + // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // -TInt CAlfServerDrawer::CurrentHandle() +TInt CAlfServerDrawer::CurrentControlHandle() { - return iCurrHandle; + return iCurrentControlHandle; } // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- +// +TInt CAlfServerDrawer::CurrentFullScreenHandle() + { + return iCurrentFullScreenHandle; + } + +// --------------------------------------------------------------------------- +// --------------------------------------------------------------------------- // void CAlfServerDrawer::StartEndChecker() { - iController->StartEndChecker(); + iFullScreenController->StartEndChecker(); } // --------------------------------------------------------------------------- @@ -1266,7 +1253,7 @@ // void CAlfServerDrawer::CancelEndChecker() { - iController->CancelEndChecker(); + iFullScreenController->CancelEndChecker(); } TInt CAlfServerDrawer::FullScreenTimeout( TAny* aServerDrawer ) @@ -1294,13 +1281,13 @@ void CAlfServerDrawer::HandleFinishFullScreenTimeout() { - iTransitionEndObserver->Cancel(); + iFullScreenTransitionEndObserver->Cancel(); iFullScreenTimeout->Cancel(); // if we haven't got a pubsub trigger, // we must finish the transition by calling AlfBridge. // If we gor the pubsub trigger, AlfBridge has done its part, // and all we have to do is release the reserved windows. - iController->FullscreenFinished( iCurrHandle ); + iFullScreenController->FullscreenFinished( iCurrentFullScreenHandle ); } TInt CAlfServerDrawer::ControlTimeout( TAny* aServerDrawer ) @@ -1311,25 +1298,37 @@ void CAlfServerDrawer::HandleControlTimeout() { - iTransitionEndObserver->Cancel(); + iControlTransitionEndObserver->Cancel(); iFullScreenFinished = EFalse; - iFullScreenTimeout->Cancel(); - iController->EndControlTransition( iCurrHandle ); + iControlTimeout->Cancel(); + iControlController->EndControlTransition( iCurrentControlHandle ); } -TInt CAlfServerDrawer::TransitionFinished( TAny* aServerDrawer ) +TInt CAlfServerDrawer::FullScreenTransitionFinished( TAny* aServerDrawer ) { - static_cast(aServerDrawer)->HandleTransitionFinished(); + static_cast(aServerDrawer)->HandleFullScreenTransitionFinished(); return KErrNone; } -void CAlfServerDrawer::HandleTransitionFinished() +TInt CAlfServerDrawer::ControlTransitionFinished( TAny* aServerDrawer ) + { + static_cast(aServerDrawer)->HandleControlTransitionFinished(); + return KErrNone; + } + + +void CAlfServerDrawer::HandleFullScreenTransitionFinished() { iFullScreenFinished = ETrue; - iIdle->Cancel(); //cancel if running. - iFinishFullScreen->Cancel(); + iFinishFullScreen->Cancel(); iFullScreenTimeout->Cancel(); - iController->FullscreenFinished( iCurrHandle ); + iFullScreenController->FullscreenFinished( iCurrentFullScreenHandle ); + } + +void CAlfServerDrawer::HandleControlTransitionFinished() + { + iControlTimeout->Cancel(); + iControlController->EndControlTransition( iCurrentControlHandle ); } diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/repositoryhandler.cpp --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/repositoryhandler.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/repositoryhandler.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -67,6 +67,7 @@ // void CRepositoryHandler::RunL() { + __ALFFXLOGSTRING("CRepositoryHandler::RunL (alf)"); iError = iCrep->NotifyRequest(iKey, iStatus); TInt value; TInt err = iCrep->Get(iKey, value); @@ -80,6 +81,7 @@ SetActive(); iError = err; } + __ALFFXLOGSTRING2("CRepositoryHandler::RunL (alf) iValue: %d, iError %d <<", iValue, iError); } // --------------------------------------------------------------------------- diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/states.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -44,7 +44,7 @@ // CStateBase* CRestingState::SignalL(TSignal aSignal) { - __ALFFXLOGSTRING1("CRestingState::SignalL %d >>", aSignal); + __ALFFXLOGSTRING1("CRestingState::SignalL %d (Alf)>>", aSignal); TInt error = KErrNone; switch( aSignal ) { @@ -99,7 +99,7 @@ // CStateBase* CControlState::SignalL(TSignal aSignal) { - __ALFFXLOGSTRING1("CControlState::SignalL %d >>", aSignal); + __ALFFXLOGSTRING1("CControlState::SignalL %d (Alf)>>", aSignal); TInt error = KErrNone; switch( aSignal ) @@ -159,6 +159,7 @@ CStateBase* CPhase1State::SignalL(TSignal aSignal) { TInt error = KErrNone; + __ALFFXLOGSTRING1("CPhase1State::SignalL(TSignal %d) (Alf)", aSignal); switch(aSignal) { case EAbort: @@ -215,7 +216,8 @@ // CStateBase* CPhase2State::SignalL(TSignal aSignal) { - TInt error = KErrNone; + TInt error = KErrNone; + __ALFFXLOGSTRING1("CPhase2State::SignalL %d (Alf)>>", aSignal); switch(aSignal) { case EAbort: diff -r 433cbbb6a04b -r 10534483575f uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp --- a/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp Fri Mar 12 15:47:04 2010 +0200 +++ b/uiacceltk/hitchcock/plugins/alftranseffect/alftranseffectplugin/src/wsserverdrawercontroller.cpp Mon Mar 15 12:43:37 2010 +0200 @@ -238,12 +238,15 @@ const TUint aToUid = buf(); User::LeaveIfError(aFile.Read(buf)); const TUint root = buf(); + User::LeaveIfError(aFile.Read(buf)); + const TUint sid = buf(); if(KErrNone == Append(value)) //dont allow duplicates { const TInt index = IndexOf(value); iAppInfo[index].iFlags = static_cast(flags); iAppInfo[index].iParent = TUid::Uid(aToUid); iAppInfo[index].iRootWgId = static_cast(root); + iAppInfo[index].iSecureId = static_cast(sid); } } } @@ -259,6 +262,7 @@ User::LeaveIfError(aFile.Write(TPckgC(info.iFlags))); User::LeaveIfError(aFile.Write(TPckgC(info.iParent.iUid))); User::LeaveIfError(aFile.Write(TPckgC(info.iRootWgId))); + User::LeaveIfError(aFile.Write(TPckgC(info.iSecureId))); } } @@ -362,7 +366,7 @@ { err = KErrNone; } - + __ALFFXLOGSTRING2("CAppInfoCache::SetUid - 0x%x, append result: %d (alf)", aUid, err); return err; } @@ -375,7 +379,8 @@ iAppInfo[index].iFlags |= aFlag; else iAppInfo[index].iFlags &= ~aFlag; - } + } + __ALFFXLOGSTRING2("CAppInfoCache::SetAppFlags - 0x%x, index: %d (alf)", aUid, index); } @@ -386,12 +391,14 @@ void CAppInfoCache::SetAvkonUid(const TUid& aUid) - { + { + __ALFFXLOGSTRING1("CAppInfoCache::SetAvkonUid 0x%x (alf)", aUid) SetAppFlags(aUid, TAppInfo::EAvkonApp, ETrue); } void CAppInfoCache::RemoveAvkonUid(const TUid& aUid) { + __ALFFXLOGSTRING1("CAppInfoCache::RemoveAvkonUid 0x%x (alf)", aUid) SetAppFlags(aUid, TAppInfo::EAvkonApp, EFalse); } @@ -421,6 +428,16 @@ iAppInfo[IndexOf(aUid.iUid)].iParent = aParentUid; } +void CAppInfoCache::SetSecureId( const TUid& aUid, const TSecureId& aSecureId ) + { + iAppInfo[IndexOf(aUid.iUid)].iSecureId = aSecureId.iId; + } + +void CAppInfoCache::SetWgId( const TUid& aUid, TInt aWgId ) + { + iAppInfo[IndexOf(aUid.iUid)].iRootWgId = aWgId; + } + TInt CAppInfoCache::SetAction(const TUid& aUid, TInt aAction) { @@ -655,7 +672,11 @@ void CWsServerDrawerController::BeginFullscreen(TInt aType, const TUid aUid1, const TUid aUid2, TInt aData ) { TUid toUid = iEngine->ToUid(); + TSecureId toSid = iEngine->ToSid(); + TInt toWg = iEngine->ToWg(); TUid fromUid = iEngine->FromUid(); + TSecureId fromSid = iEngine->FromSid(); + TInt fromWg = iEngine->FromWg(); TInt flags = iEngine->Flags(); #ifdef WSSERVERDRAWER_TIME_LOG //time log if(aFromGfx) @@ -695,7 +716,17 @@ (iEngine->Action() == AknTransEffect::EEmbeddedApplicationStart); iAppInfoCache->SetUid(toUid); + if ( toUid != TUid::Null() ) + { + iAppInfoCache->SetSecureId( toUid, toSid ); + iAppInfoCache->SetWgId( toUid, toWg ); + } iAppInfoCache->SetUid(fromUid); + if ( fromUid != TUid::Null() ) + { + iAppInfoCache->SetSecureId( fromUid, fromSid ); + iAppInfoCache->SetWgId( fromUid, fromWg ); + } if ((toUid != KNullUid) && !isEmbeddedAppContext) { @@ -749,7 +780,8 @@ if(iLastTypeTried == CStateHandler::EExit && fstype == CStateHandler::EActivation) { //the current uid is not valid - return; // activation not ok if exiting + __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Last tried type was exit. Abort."); + return; // activation not ok if exiting } iLastTypeTried = fstype; @@ -758,6 +790,7 @@ if(iExitAborted && CStateHandler::EActivation == fstype) { //the current uid is not valid + __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Exit was aborted. Activation should not happen. Abort."); AbortTransition(); //if exit is aborted, we dont want either activation return; // activation not ok if exiting } @@ -767,6 +800,7 @@ //we should know if its a dsa app before end can be called if(iDSAActive) { + __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort."); return; //Do nothing if dsa active. } @@ -774,6 +808,7 @@ // TODO: remove && !iEngine->WaitingForRootWgId() when appuids available from wserv if(fstype == CStateHandler::ENone) { + __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort."); return; } @@ -781,7 +816,8 @@ //Phone is booting, stop any FS effect. if(!StartCheck(flags)) { - AbortTransition(); + __ALFFXLOGSTRING("CWsServerDrawerController::BeginFullscreen - Phone is booting. Abort."); + AbortTransition(); return; } @@ -789,6 +825,7 @@ // that should be blocked then we abort all ongoing transitions. if(!(AllowedCustomUid(toUid) && AllowedCustomUid(fromUid))) { + __ALFFXLOGSTRING2("CWsServerDrawerController::BeginFullscreen - Blocked uid 0x%x or 0x%x. Abort.", toUid, fromUid); AbortTransition(); return; } @@ -826,6 +863,7 @@ if(CStateHandler::EActivation == fstype && currtype != CStateHandler::EStart && !iAppInfoCache->AvkonUid(toUid)) { + __ALFFXLOGSTRING1("CWsServerDrawerController::BeginFullscreen - Non avkon app 0x%x. Abort.", toUid); return; } @@ -937,10 +975,10 @@ // void CWsServerDrawerController::EndExpired() { - __ALFFXLOGSTRING("CWsServerDrawerController::EndExpired >>"); + __ALFFXLOGSTRING("CWsServerDrawerController::EndExpired (Alf)>>"); AbortTransition(EAbortFullscreen); iExitAborted = EFalse; //This is not valid when we have a time-out - __ALFFXLOGSTRING("CWsServerDrawerController::EndExpired <<"); + __ALFFXLOGSTRING("CWsServerDrawerController::EndExpired (Alf)<<"); } // --------------------------------------------------------------------------- @@ -948,11 +986,13 @@ // void CWsServerDrawerController::EndFullscreen(TBool /*aFromGfx*/) { + __ALFFXLOGSTRING("CWsServerDrawerController::EndFullscreen (Alf)>>"); /* DSA end fix */ if(iDSAActive) { + __ALFFXLOGSTRING("CWsServerDrawerController::EndFullscreen - DSA Active - ABORTING (Alf)"); AbortTransition(); return; //Do nothing if dsa active. } @@ -963,6 +1003,8 @@ #endif //WSSERVERDRAWER_TIME_LOG iStates->Signal(CStateBase::EEndFullscreen); + // the callback for FullScreenFinished will not come. this must be resetted here. + iLastTypeTried = CStateHandler::ENone; } @@ -971,7 +1013,7 @@ // void CWsServerDrawerController::FullscreenFinished(TInt aHandle) { - if(aHandle == iEngine->CurrentHandle()) // Filter away stray finish signals. + if(aHandle == iEngine->CurrentFullScreenHandle()) // Filter away stray finish signals. { iLastTypeTried = CStateHandler::ENone; iStates->Signal(CStateBase::EFinishFullscreen); @@ -1009,7 +1051,7 @@ if(iStates->GetState() == CStateBase::EComponent) { - return iEngine->CurrentHandle(); + return iEngine->CurrentControlHandle(); } else { @@ -1022,7 +1064,7 @@ // void CWsServerDrawerController::EndControlTransition(TInt aHandle) { - if(aHandle == iEngine->CurrentHandle()) //Filter out stray endcomponent. + if(aHandle == iEngine->CurrentControlHandle()) //Filter out stray endcomponent. { iStates->Signal(CStateBase::EFinishComponent); } @@ -1082,12 +1124,14 @@ // void CWsServerDrawerController::AbortTransition(TInt aToAbort) { - __ALFFXLOGSTRING("CWsServerDrawerController::AbortTransition >>"); + __ALFFXLOGSTRING("CWsServerDrawerController::AbortTransition (Alf) >>"); if ( aToAbort == EAbortFullscreen ) { iLastTypeTried = CStateHandler::ENone; iExitAborted = iStates->GetCurrentFullscreenType() == CStateHandler::EExit; + __ALFFXLOGSTRING1("CWsServerDrawerController::AbortTransition , iExitAborted %d (Alf)", iExitAborted); iStates->Signal(CStateBase::EAbortFullscreen); + iExitAborted = EFalse; // end of story for exit effect. } else if ( aToAbort == EAbortControl ) { @@ -1097,9 +1141,11 @@ { iLastTypeTried = CStateHandler::ENone; iExitAborted = iStates->GetCurrentFullscreenType() == CStateHandler::EExit; - iStates->Signal(CStateBase::EAbort); + __ALFFXLOGSTRING1("CWsServerDrawerController::AbortTransition , iExitAborted %d (Alf)", iExitAborted); + iStates->Signal(CStateBase::EAbort); + iExitAborted = EFalse; // end of story for exit effect. } - __ALFFXLOGSTRING("CWsServerDrawerController::AbortTransition <<"); + __ALFFXLOGSTRING("CWsServerDrawerController::AbortTransition (Alf) <<"); } // --------------------------------------------------------------------------- @@ -1108,7 +1154,7 @@ TBool CWsServerDrawerController::IsBlocked( const TUid& aFromUid, const TUid& aToUid ) { TBool result = iStates->IsBlocked( aFromUid, aToUid ); - __ALFFXLOGSTRING1("CWsServerDrawerController::IsBlocked - return %d", result); + __ALFFXLOGSTRING1("CWsServerDrawerController::IsBlocked - return %d (Alf)", result); return result; }