diff -r 1801340c26a2 -r e5af45d51884 uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp --- a/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Thu Aug 19 10:48:02 2010 +0300 +++ b/uiacceltk/hitchcock/ServerCore/Src/alfbridge.cpp Tue Aug 31 16:07:35 2010 +0300 @@ -84,13 +84,6 @@ #include #endif -#ifdef ALF_MEMORYLOGGING -#include -#endif - -#include -#include - const TInt KVisualTransformationStepRotate = 0; const TReal32 KAlfVisualDefaultOpacity = 1.0f; @@ -139,9 +132,6 @@ // its layout properly. const TInt KAlfCheckCoverageFromMultipleGroups = 20; -// Duration to wait if visual is not ready for current orientation. -// 1 unit = 50ms. -const TInt KAlfCheckVisualIsNotReady = 15; NONSHARABLE_CLASS( TAlfBridgeDrawerWrapper ) : public MAlfDrawerScreenInterface { @@ -206,7 +196,6 @@ delete iEffectEndTimer; iDeadControlGroups.Close(); iEffectWindowGroups.Close(); - iWindowChainsArray.Close(); delete iFSFxData; delete iFSFXDataPart2; @@ -280,11 +269,7 @@ void CAlfBridge::RegisterFadeEffectL() { // TODO: RND, REMOVE MMC DRIVE-F, WHEN NOT REQUIRED FOR TESTING -#ifdef USE_ALTERNATIVE_EFFECTS_FROM_MMC _LIT(KDrivePrefence,"FZC"); -#else - _LIT(KDrivePrefence,"Z"); -#endif // Force register fade effect. Try first MMC, then ROM. CHuiFxEngine* engine = iHuiEnv->EffectsEngine(); RFs& fs = CHuiStatic::FsSession(); @@ -475,57 +460,7 @@ while(node); return NULL; } - -// --------------------------------------------------------------------------- -// FindChainedGroup -// --------------------------------------------------------------------------- -// -TUint32 CAlfBridge::FindChainedGroup( - TUint32 aTreeNodeId) - { - THashMapIter iter(iWindowChainsArray); - TChainData const * data = 0; - do - { - data = iter.NextValue(); - if (data && data->iParent == aTreeNodeId) - { - TUint32 chainedTo = FindChainedGroup(data->iChainee); - if (!chainedTo) - { - return data->iChainee; - } - else - { - return chainedTo; - } - } - } - while(data); - return NULL; - } - -// --------------------------------------------------------------------------- -// IsChainedGroup -// --------------------------------------------------------------------------- -// -TBool CAlfBridge::IsChainedGroup( - TUint32 aTreeNodeId) - { - THashMapIter iter(iWindowChainsArray); - TChainData const * data = 0; - do - { - data = iter.NextValue(); - if (data && data->iChainee == aTreeNodeId) - { - return ETrue; - } - } - while(data); - return EFalse; - } - + // --------------------------------------------------------------------------- // --------------------------------------------------------------------------- // @@ -545,13 +480,13 @@ // FindClientWindowGroupId // --------------------------------------------------------------------------- // -TInt CAlfBridge::FindClientWindowGroupId(CHuiControlGroup& aControlGroup ) - { - for (TInt i=0; iiControlGroups.Count();i++) - { - if( iAlfScreens[0]->iControlGroups[i].iControlGroup == &aControlGroup ) - { - return iAlfScreens[0]->iControlGroups[i].iClientWindowGroupId; +TInt CAlfBridge::FindClientWindowGroupId( TInt aScreenNumber, CHuiControlGroup& aControlGroup ) + { + for (TInt i=0; iiControlGroups.Count();i++) + { + if( iAlfScreens[aScreenNumber]->iControlGroups[i].iControlGroup == &aControlGroup ) + { + return iAlfScreens[aScreenNumber]->iControlGroups[i].iClientWindowGroupId; } } return KErrNotFound; @@ -561,13 +496,13 @@ // FindWindowGroupNodeId // --------------------------------------------------------------------------- // -TInt CAlfBridge::FindWindowGroupNodeId(CHuiControlGroup& aControlGroup ) const - { - for (TInt i=0; iiControlGroups.Count();i++) - { - if( iAlfScreens[0]->iControlGroups[i].iControlGroup == &aControlGroup ) - { - return iAlfScreens[0]->iControlGroups[i].iWindowGroupNodeId; +TInt CAlfBridge::FindWindowGroupNodeId( TInt aScreenNumber, CHuiControlGroup& aControlGroup ) const + { + for (TInt i=0; iiControlGroups.Count();i++) + { + if( iAlfScreens[aScreenNumber]->iControlGroups[i].iControlGroup == &aControlGroup ) + { + return iAlfScreens[aScreenNumber]->iControlGroups[i].iWindowGroupNodeId; } } return KErrNotFound; @@ -641,28 +576,6 @@ } // --------------------------------------------------------------------------- -// FindControlGroupBySecureId -// May return multiple groups -// --------------------------------------------------------------------------- -// -void CAlfBridge::FindControlGroupBySecureId( TInt aSecureId, RPointerArray& aGroupList) - { - if ( aSecureId == 0 ) - { - return; - } - - for ( TInt i = 0; i < iAlfScreens[0]->iControlGroups.Count(); i++ ) - { - TAlfControlGroupEntry& groupEntry = iAlfScreens[0]->iControlGroups[i]; - if ( groupEntry.iSecureId == aSecureId ) - { - aGroupList.Append(groupEntry.iControlGroup); - } - } - } - -// --------------------------------------------------------------------------- // FindControlGroupByFullScreenToEffect // --------------------------------------------------------------------------- // @@ -881,7 +794,7 @@ TInt aSecureId, TInt aScreenNumber ) { - CHuiControlGroup* group = FindControlGroup(aWindowGroupNodeId); + CHuiControlGroup* group = FindControlGroup(aWindowGroupNodeId,aScreenNumber); if (!group) { group = &iHuiEnv->NewControlGroupL(aWindowGroupNodeId); @@ -917,11 +830,6 @@ entry.iWindowGroupNodeId = aWindowGroupNodeId; entry.iClientWindowGroupId = aClientWindowGroupId; entry.iSecureId = aSecureId; - // Add to the control group. HandleGfxEventL effect redirection will need this information - entry.iScreenNumber = aScreenNumber; - iAlfScreens[aScreenNumber]->iControlGroups.Append(entry); - CleanupStack::Pop(group); - // we have received start effect for this group, but the group did not exist in alf universe at the time. hide the group. if (iFSFxData && (iFSFxData->State() == EWaitingWindowGroup || iFSFxData->State() == EEndFullScreenReceivedWaitingWindowGroup) @@ -962,6 +870,11 @@ HandleGfxStopEvent( EFalse ); // destroys iFSFxData and iFSFXDataPart2 } } + entry.iScreenNumber = aScreenNumber; +// entry.iRole = EHuiWindowGroupContainer; + + iAlfScreens[aScreenNumber]->iControlGroups.Append(entry); + CleanupStack::Pop(group); if (iAlfScreens[aScreenNumber]->iDisplay) ShowControlGroupL(iAlfScreens[aScreenNumber]->iDisplay->Roster(), *group, KHuiRosterShowAtTop, aScreenNumber); @@ -1176,14 +1089,14 @@ { lSyncDone = ETrue; CHuiControlGroup &lGroup = aRoster.ControlGroup(i+1); - TInt clientWindowGroupId = FindClientWindowGroupId(lGroup ); + TInt clientWindowGroupId = FindClientWindowGroupId( aScreenNumber, lGroup ); iAppUi->AdjustWindowGroupPositionL(clientWindowGroupId,CAlfAppServer::EBehindOfParent); } if(!lSyncDone && aGroup.iAlfApp && aRoster.ControlGroup(i-1).ResourceId() != iAlfWindowGroupNodeId ) { CHuiControlGroup &lGroup = aRoster.ControlGroup(i); - TInt clientWindowGroupId = FindClientWindowGroupId(lGroup ); + TInt clientWindowGroupId = FindClientWindowGroupId( aScreenNumber, lGroup ); iAppUi->AdjustWindowGroupPositionL(clientWindowGroupId,CAlfAppServer::EBehindOfParent); } break; @@ -1232,7 +1145,7 @@ { iAlfWindowGroupNodeId = iAlfScreens[0]->iControlGroups[i].iWindowGroupNodeId; - CHuiControlGroup* controlGroup = FindControlGroup(iAlfWindowGroupNodeId); + CHuiControlGroup* controlGroup = FindControlGroup(iAlfWindowGroupNodeId, 0); CHuiControl& control = controlGroup->Control(0); CHuiVisual* layout = &control.Visual(0); iAlfScreens[0]->iDisplay->Roster().SetAlfEventWindow(layout); @@ -1366,7 +1279,7 @@ numBuf.AppendNum(fps, TRealFormat(5,1)); TRAP_IGNORE( { - iAlfScreens[0]->iFPSText->SetTextL( numBuf ); + iAlfScreens[screenNumber]->iFPSText->SetTextL( numBuf ); }) } } @@ -1377,10 +1290,10 @@ iActivated = (err == KErrNone); } - if (iAlfScreens[0]->IsVisualTreeVisibilityChanged()) + if (iAlfScreens[screenNumber]->IsVisualTreeVisibilityChanged()) { HandleVisualVisibility( screenNumber ); - iAlfScreens[0]->SetVisualTreeVisibilityChanged(EFalse); + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(EFalse); } } } @@ -1443,10 +1356,7 @@ transparent |= (!((aVisual.Flags() & EHuiVisualFlagOpaqueHint) == EHuiVisualFlagOpaqueHint)); transparent |= (aVisual.iOpacity.Now() < KAlfVisualDefaultOpacity); transparent |= (aVisual.iOpacity.Target() < KAlfVisualDefaultOpacity); - if(aVisual.Effect()) - { - transparent |= (aVisual.iEffectOpacity < KAlfVisualDefaultOpacity); - } + return !transparent; } @@ -1577,7 +1487,6 @@ TBool alfWindowGroupFoundVisible = EFalse; TBool alfClientWindowGroupVisible = EFalse; - TBool firstAlfControlGroupFound = EFalse; AMT_SET_VALUE( iVisibleVisualCount, 0 ); @@ -1630,7 +1539,7 @@ } // !fullscreenCovered need to be checked because for fullscreen // alf applications alf event window group could be on top of alf client windowgroup - if ( (!firstAlfControlGroupFound || !fullscreenCovered) && activeSession) + if ( (alfClientWindowGroupVisible || !fullscreenCovered) && activeSession) { // clear inactive flag if client has not made this controlgroup hidden if(!(flags&EHuiVisualFlagUnderOpaqueHint)) @@ -1651,11 +1560,7 @@ iTempRegion.AddRect(fullscreen); iTempRegion.Tidy(); fullscreenCovered = ETrue; - firstAlfControlGroupFound = ETrue; // change flag so that we don't go in this branch again - } - else - { - hostContainer->SetFlags(EHuiVisualFlagInactive); + alfClientWindowGroupVisible = EFalse; // change flag so that we don't go in this branch again } } } @@ -1725,56 +1630,9 @@ subTreeCovered, hasLayers, IsVisualOpaque(*layout) ); } - if ( hasLayers && iActivated ) - { - HandleLayerVisibility( layout, controlgroup, control, hasActiveVisualsInVisualTree ); - } - - TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive); - - // we need to set /clear inactive flags before we evaluate the fade effect, - // otherwise the fade effect will be removed without a reason in - // some use cases - if (isLayoutActive && (fullscreenCovered || (!hasActiveVisualsInVisualTree && !IsOpaqueEffect(layout->Effect())))) - { - // don't inactivate alf event wg if alf client is visible - if( !( alfClientWindowGroupVisible && (controlgroup.ResourceId() == iAlfWindowGroupNodeId)) ) - // Setting also the root visual (layout) as inactive, if it had none - // active children. This is because otherwise the Inactive checks won't - // work correctly within RosterImpl ScanDirty & ClearChanged phases. - // If root visual is having an opaque effect, it must remain active - { - layout->SetFlag(EHuiVisualFlagInactive); - } - } - else if(!isLayoutActive && !fullscreenCovered && (hasActiveVisualsInVisualTree || IsOpaqueEffect(layout->Effect())) || - (alfClientWindowGroupVisible && (controlgroup.ResourceId() == iAlfWindowGroupNodeId)) ) - { - layout->ClearFlag(EHuiVisualFlagInactive); - layout->SetPos(fullscreen.iTl); - layout->SetSize(fullscreen.Size()); - - // New visible window group may have received effect just before appearing to the screen. - // start the effect if this is the case. - if(iFSFxData && iFSFxData->iToSecureId == controlgroup.SecureId() ) - { - TInt windowGroupId = FindClientWindowGroupId(controlgroup); - - if (iFSFxData->iToWg == windowGroupId && iFSFxData->State() == EWaitEndFullScreen && - iFSFxData->iTwoPhaseEffect <= CFullScreenEffectState::ESecondPartActive) - { - GfxTriggerEffectWhenFullScreenDrawn(&controlgroup); - } - } - } - - // If root visuals effect is marked as opaque, then add whole screen area as covered. - if (!fullscreenCovered) - { - fullscreenCovered = IsOpaqueEffect(layout->Effect()); - } - - + + TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); + // if native alf app is found visible and the client it self is not covering whole screen, we can assume that alf content // fills the rest. // this is for embedded native alf application cases. Otherwise chained window groups tend to @@ -1791,9 +1649,39 @@ alfClientWindowGroupVisible = ETrue; } } + + // If root visuals effect is marked as opaque, then add whole screen area as covered. + if (!fullscreenCovered) + { + fullscreenCovered = IsOpaqueEffect(layout->Effect()); + } + + if ( hasLayers && iActivated ) + { + HandleLayerVisibility( layout, controlgroup, control, hasActiveVisualsInVisualTree ); + } + + TBool isLayoutActive = !(layout->Flags() & EHuiVisualFlagInactive); + + // we need to set /clear inactive flags before we evaluate the fade effect, + // otherwise the fade effect will be removed without a reason in + // some use cases + if (isLayoutActive && !hasActiveVisualsInVisualTree && !IsOpaqueEffect(layout->Effect())) + { + // Setting also the root visual (layout) as inactive, if it had none + // active children. This is because otherwise the Inactive checks won't + // work correctly within RosterImpl ScanDirty & ClearChanged phases. + // If root visual is having an opaque effect, it must remain active + layout->SetFlag(EHuiVisualFlagInactive); + } + else if(!isLayoutActive && (hasActiveVisualsInVisualTree || IsOpaqueEffect(layout->Effect()))) + { + layout->ClearFlag(EHuiVisualFlagInactive); + layout->SetPos(fullscreen.iTl); + layout->SetSize(fullscreen.Size()); + } + - TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); - // 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. @@ -2516,12 +2404,6 @@ HandleIncludeToVisibilityCalculationL( data ); break; } - case EAlfDSSetScreenDeviceValid: - { - HandleSetScreenDeviceValidL( data ); - break; - } - case EAlfDSSetWindowArea: { HandleSetWindowAreaL( data ); @@ -2570,12 +2452,14 @@ } case EAlfDSGroupChained: { - HandleGroupChained(data); + __ALFLOGSTRING("CAlfBridge::DoDispatchL, EAlfDSGroupChained"); + // TODO, link groups break; } case EAlfDSGroupChainBroken: { - HandleGroupChainBroken(data); + __ALFLOGSTRING("CAlfBridge::DoDispatchL, EAlfDSGroupChainBroken"); + // TODO, break link break; } case EAlfDSMoveWindowToNewGroup: @@ -2784,6 +2668,7 @@ TInt windowGroupNodeId = aData.iInt1; TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; __ALFLOGSTRING1("CAlfBridge::HandleNewWindowL: new window %d!",windowNodeId); switch (windowAttributes->iWindowNodeType) @@ -2794,8 +2679,7 @@ windowGroupNodeId, windowAttributes->iClientHandle, windowAttributes->iSecureId, - 0 // Only one screen for avkon content supported - ); + screenNumber); // We just received notification for our own window group creation, store its node id for doing // faster lookups later... @@ -2811,11 +2695,11 @@ case EAlfWinTreeNodeSprite: case EAlfWinTreeNodeTextCursor: { - CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId); + CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId,screenNumber); // Floating sprites only require own group. Normal sprites should behave as normal visuals. if (!controlGroup && windowAttributes->iWindowNodeType == EAlfWinTreeNodeSprite ) { - controlGroup = iAlfScreens[0]->iFloatingSpriteControlGroup; + controlGroup = iAlfScreens[screenNumber]->iFloatingSpriteControlGroup; } if (controlGroup) @@ -2893,11 +2777,7 @@ __ALFLOGSTRING("CAlfBridge::HandleNewWindowL: Unknown window node type received !"); } } - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); - -#ifdef ALF_MEMORYLOGGING - ReportMemory(); -#endif + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); } // --------------------------------------------------------------------------- @@ -2980,13 +2860,14 @@ TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); - + TInt screenNumber = windowAttributes->iScreenNumber; + switch (windowAttributes->iWindowNodeType) { case EAlfWinTreeNodeGroup: { HandleVisualVisibility(0); - DeleteControlGroupL(windowGroupNodeId); + DeleteControlGroupL(windowGroupNodeId, screenNumber); break; } case EAlfWinTreeNodeClient: @@ -3006,7 +2887,7 @@ CHuiCanvasVisual* viz; viz = (CHuiCanvasVisual*)FindVisual(windowNodeId); - CHuiControlGroup* controlGroup = FindControlGroup( windowGroupNodeId); + CHuiControlGroup* controlGroup = FindControlGroup( windowGroupNodeId, screenNumber ); // Sprite is in its own group, and can be deleted normally. if ( !controlGroup && windowAttributes->iWindowNodeType != EAlfWinTreeNodeSprite ) { @@ -3046,7 +2927,7 @@ } // TODO: Toolkit does not support recycling (of visuals), // this is not in line with Nokia environmental policy... - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); } // --------------------------------------------------------------------------- @@ -3057,6 +2938,7 @@ { TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; // fetch visual CHuiVisual* viz = FindVisual(windowNodeId); if (viz) @@ -3068,8 +2950,8 @@ } #endif - viz->SetPos(windowAttributes->iPosition, windowAttributes->iTransitionTime); - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + viz->SetPos(windowAttributes->iPosition, windowAttributes->iTransitionTime); + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed } else { @@ -3091,6 +2973,7 @@ { TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; // fetch visual CHuiVisual* viz = FindVisual(windowNodeId); if (viz) @@ -3107,7 +2990,7 @@ { __ALFLOGSTRING("CAlfBridge::HandleSetWindowSizeL, EAlfDSSetWindowSize: Visual not found!"); } - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); AMT_INC_COUNTER_IF(viz, iVisualSizeChangedCount ); AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); @@ -3153,6 +3036,7 @@ { TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; // fetch visual CHuiVisual* viz = FindVisual(windowNodeId); if (viz) @@ -3163,9 +3047,9 @@ RDebug::Print(_L("CAlfBridge::HandleSetWindowOpacityL - Tracked visual")); } #endif - viz->iOpacity.Set(windowAttributes->iOpacity, windowAttributes->iTransitionTime); - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed - } + viz->iOpacity.Set(windowAttributes->iOpacity, windowAttributes->iTransitionTime); + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + } else { __ALFLOGSTRING("CAlfBridge::HandleSetWindowOpacityL, EAlfDSSetWindowOpacity: Visual not found!"); @@ -3180,6 +3064,7 @@ { TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; // fetch visual CHuiVisual* viz = FindVisual(windowNodeId); if (viz) @@ -3199,7 +3084,7 @@ viz->SetFlag( EHuiVisualFlagOpaqueHint ); } - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed } else { @@ -3215,6 +3100,7 @@ { TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; // fetch visual CHuiVisual* viz = FindVisual(windowNodeId); if (viz) @@ -3239,7 +3125,7 @@ } } - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed } else { @@ -3248,42 +3134,6 @@ } // --------------------------------------------------------------------------- -// HandleSetScreenDeviceValidL -// --------------------------------------------------------------------------- -// -void CAlfBridge::HandleSetScreenDeviceValidL( TAlfBridgerData& aData ) - { - TInt windowNodeId = aData.iInt2; - TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); - - // fetch visual - CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId); - if (viz) - { -#ifdef HUI_DEBUG_TRACK_DRAWING - if ( viz->Tracking() ) - { - RDebug::Print(_L("CAlfBridge::HandleSetScreenDeviceValidL - Tracked visual")); - } -#endif - if ( windowAttributes->iActive ) - { - viz->ClearCanvasFlags( EHuiCanvasVisualFlagNotReady ); - } - else - { - viz->SetCanvasFlags( EHuiCanvasVisualFlagNotReady ); - } - - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); - } - else - { - __ALFLOGSTRING("CAlfBridge::HandleSetScreenDeviceValidL, EAlfDSSetScreenDeviceValid: Visual not found!"); - } - } - -// --------------------------------------------------------------------------- // HandleSetWindowAreaL // --------------------------------------------------------------------------- // @@ -3292,6 +3142,7 @@ TInt windowNodeId = aData.iInt2; TAny* ptr = (TAny*)(*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = 0; TPoint origin; TInt count = 0; RRegion region; @@ -3299,7 +3150,7 @@ { RMemReadStream str(ptr, 4*sizeof(TInt32)); - str.ReadInt32L(); // screen number, obsolete + screenNumber = str.ReadInt32L(); origin.iX = str.ReadInt32L(); origin.iY = str.ReadInt32L(); count = str.ReadInt32L(); @@ -3337,7 +3188,7 @@ CHuiCanvasVisual* canvas = static_cast(viz); canvas->SetShape( origin, region ); - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); } else { @@ -3356,6 +3207,7 @@ TInt windowGroupNodeId = aData.iInt1; TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*) (*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; TInt ordinalPosition = windowAttributes->iOrdinalPosition; switch (windowAttributes->iWindowNodeType) @@ -3375,9 +3227,7 @@ } #endif - TBool wasInvalidReachable = IsVisualNotReadyReachable(); - - CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId); + CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId,screenNumber); if (!controlGroup) { @@ -3385,11 +3235,11 @@ } ResolveAfterEffectAppearingApplicationL(controlGroup); // does nothing, if effect is not active on this control group // Window server nodes are in inverted Z-order, we switch it here. - iAlfScreens[0]->iDisplay->Roster().Hide(*controlGroup); + iAlfScreens[screenNumber]->iDisplay->Roster().Hide(*controlGroup); TInt wsWindowGroupCount = 0; - for (TInt i=0; iiDisplay->Roster().Count();i++) + for (TInt i=0; iiDisplay->Roster().Count();i++) { - if (iAlfScreens[0]->iDisplay->Roster().ControlGroup(i).Control(0).Role()==EHuiWindowGroupContainer) + if (iAlfScreens[screenNumber]->iDisplay->Roster().ControlGroup(i).Control(0).Role()==EHuiWindowGroupContainer) { wsWindowGroupCount++; } @@ -3407,30 +3257,16 @@ ordinalPosition = -1; // show at top ? } - if (iAlfScreens[0]->iDisplay && controlGroup) + if (iAlfScreens[screenNumber]->iDisplay && controlGroup) { - ShowControlGroupL(iAlfScreens[0]->iDisplay->Roster(), *controlGroup, ordinalPosition); + ShowControlGroupL(iAlfScreens[screenNumber]->iDisplay->Roster(), *controlGroup, ordinalPosition, screenNumber); } else { - __ALFLOGSTRING1("CAlfBridge::HandleReorderWindowL, EAlfDSReorder: Control group not found! Id: %d ", windowNodeId ); + __ALFLOGSTRING2("CAlfBridge::HandleReorderWindowL, EAlfDSReorder: Control group not found! Screen: %d, Id: %d ", screenNumber, windowNodeId ); } - ReorderAlfControlGroupsL(); - - // Usually, layout switch is initiated by akncapserver before window group in new orientation - // becomes visible. However, sometimes either akncapserver isn't fast enough or then applications - // perform operations in wrong order. To reduce flickering, uiaccelerator provides implicit blanker. - - // We will check if there is a visual that is not ready for current orientation. - // If such visual is found before fullscreen is covered then we will enable - // implicit blanker. That gives akncapserver some time to start layout switch. - - if (!wasInvalidReachable && IsVisualNotReadyReachable()) - { - iLayoutSwitchEffectCoordinator->ImplicitBlank(); - } - + ReorderAlfControlGroupsL(screenNumber); break; } case EAlfWinTreeNodeClient: @@ -3468,7 +3304,7 @@ } else { - __ALFLOGSTRING1("CAlfBridge::HandleReorderWindowL, EAlfDSReorder: Visual not found! Id: %d ", windowNodeId ); + __ALFLOGSTRING2("CAlfBridge::HandleReorderWindowL, EAlfDSReorder: Visual not found! Screen: %d, Id: %d ", screenNumber, windowNodeId ); } break; } @@ -3479,7 +3315,7 @@ } } - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed AMT_MAP_BRIDGE_SET_ORDINAL_POSITION(); } @@ -3493,6 +3329,7 @@ TInt windowGroupNodeId = aData.iInt1; TInt windowNodeId = aData.iInt2; TAlfWindowCommandBufferAttributes* bufferAttributes = (TAlfWindowCommandBufferAttributes*)(*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = bufferAttributes->iScreenNumber; CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId); @@ -3504,7 +3341,7 @@ #ifdef HUI_DEBUG_TRACK_DRAWING TBool tracking( EFalse ); CHuiControlGroup* controlGroup = FindControlGroup( windowGroupNodeId, screenNumber ); - CAlfScreen* screen = iAlfScreens[0]; + CAlfScreen* screen = iAlfScreens[screenNumber]; //TInt clientWindowGroupId = FindClientWindowGroupId( screenNumber, *controlGroup ); // NOTE, THE FOLLOWING WServClientFileName MAY CAUSE DEADLOCK. @@ -3527,7 +3364,7 @@ { // For performance resons, only set visual tree changed if this // was the first buffer for the window. - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); } TPtrC8 commands((TUint8*)bufferAttributes->iBuffer, bufferAttributes->iBufferLength); @@ -3588,10 +3425,8 @@ } else { - __ALFLOGSTRING2("CAlfBridge::HandlePostCanvasBufferL, EAlfDSPostCanvasBuffer: Visual not found! Id: %d, GroupId: %d ", windowNodeId, windowGroupNodeId ); + __ALFLOGSTRING3("CAlfBridge::HandlePostCanvasBufferL, EAlfDSPostCanvasBuffer: Visual not found! Screen: %d, Id: %d, GroupId: %d ", screenNumber, windowNodeId, windowGroupNodeId ); } - // Uncomment the following for tracking which application is doing drawing - //__ALFFXLOGSTRING1("CAlfBridge::HandlePostCanvasBufferL 0x%x", viz->Owner().ControlGroup()->SecureId()); #ifdef USE_APPLICATION_ENDFULLSCREEN_TIMEOUT if (iFSFxData && iFSFxData->iEffectType != CFullScreenEffectState::ENotDefinedEffect @@ -3670,7 +3505,6 @@ TInt effectIndex; if (!HasActiveEffect(aVisual, effectIndex)) { - __ALFFXLOGSTRING2("CAlfBridge::SetWindowActiveL 0x%x - New state: %d", aVisual, aActive); // Does not have effect if (aActive) { @@ -3736,6 +3570,7 @@ TInt windowGroupNodeId = aData.iInt1; TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)(*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; if (windowAttributes->iWindowNodeType == EAlfWinTreeNodeTextCursor && iCursorTimer) { @@ -3754,7 +3589,7 @@ { case EAlfWinTreeNodeGroup: { - CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId); + CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId,screenNumber); if (controlGroup) { CHuiControl& control = controlGroup->Control(0); @@ -3800,7 +3635,7 @@ break; } } - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed AMT_INC_COUNTER( iTotalVisualFlagChangedCount ); AMT_INC_COUNTER_IF( windowAttributes->iActive, iActiveVisualCount ); @@ -3822,6 +3657,7 @@ TInt windowGroupNodeId = aData.iInt1; TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)(*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; TInt windowFlag = windowAttributes->iActive; THuiVisualFlags visualFlag = (THuiVisualFlags)0; switch(windowFlag) @@ -3843,7 +3679,7 @@ { case EAlfWinTreeNodeGroup: { - CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId); + CHuiControlGroup* controlGroup = FindControlGroup(windowGroupNodeId,screenNumber); if (controlGroup) { CHuiControl& control = controlGroup->Control(0); @@ -3904,7 +3740,7 @@ break; } } - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed } // --------------------------------------------------------------------------- @@ -3988,14 +3824,14 @@ TInt windowGroupNodeId = aData.iInt1; TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)(*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; // fetch visual CHuiCanvasVisual* viz = FindVisual(windowNodeId); - CHuiControlGroup* controlgroup = FindControlGroup(windowGroupNodeId, 0); - + // We should not do this for alf window, but renderstage does not know if it is // handling alf window or other window, so we ignore the request here if needed. // TODO: When alf apps work in multiple display, check here for every displays alf groups... - if (viz && iAlfWindowGroupNodeId != windowGroupNodeId && controlgroup && controlgroup->SecureId() != iAlfSecureId ) + if (viz && iAlfWindowGroupNodeId != windowGroupNodeId) { viz->SetLayerExtent(windowAttributes->iSurfaceExtent); // Set surface extend area to be cleared with fully transparent color @@ -4024,7 +3860,7 @@ if (iAlfWindowGroupNodeId != windowGroupNodeId) __ALFLOGSTRING("CAlfBridge::HandleSetSurfaceExtentL, EAlfDSSetSurfaceExtent: Visual not found!"); } - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed } // --------------------------------------------------------------------------- @@ -4036,6 +3872,7 @@ TInt windowGroupNodeId = aData.iInt1; TInt windowNodeId = aData.iInt2; TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)(*iHost)->GetVarDataL( (TInt)aData.iPtr ); + TInt screenNumber = windowAttributes->iScreenNumber; // fetch visual CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId); @@ -4052,7 +3889,7 @@ if (iAlfWindowGroupNodeId != windowGroupNodeId) __ALFLOGSTRING("CAlfBridge::HandleLayerUsesAlphaFlagChanged: Visual not found!"); } - iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed + iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed } @@ -4470,18 +4307,9 @@ effectFlags |= KHuiFxEffectExcludeChildrenFlag; //RDebug::Print(_L("CAlfBridge::SetupFadeEffectL - no children faded by parent")); } - - if (iHuiEnv->MemoryLevel() <= EHuiMemoryLevelLowest) - { - __ALFFXLOGSTRING("CAlfBridge::SetupFadeEffectL - Skipping because in SW rendering mode"); - didFadeEffectLoad = EFalse; - } - else - { - __ALFFXLOGSTRING1("CAlfBridge::SetupFadeEffectL - insert fade 0x%x", &aVisual); - TRAP( err, engine->LoadEffectL(*iFadeEffectFile, effect, aVisual.Effectable(), NULL, NULL, 0, effectFlags ) ); - didFadeEffectLoad = ETrue; - } + __ALFFXLOGSTRING1("CAlfBridge::SetupFadeEffectL - insert fade 0x%x", &aVisual); + TRAP( err, engine->LoadEffectL(*iFadeEffectFile, effect, aVisual.Effectable(), NULL, NULL, 0, effectFlags ) ); + didFadeEffectLoad = ETrue; } } } @@ -4506,45 +4334,6 @@ return (didFadeEffectLoad || alreadyFaded); } -// --------------------------------------------------------------------------- -// HandleGroupChained -// -// Chain information is used for redirecting effects to correct windowgroup -// --------------------------------------------------------------------------- -// -void CAlfBridge::HandleGroupChained( TAlfBridgerData& aData) - { - TInt parentId = aData.iInt1; - TInt chainedId = aData.iInt2; - - TChainData data(parentId, chainedId); - iWindowChainsArray.Insert(parentId,data); - __ALFFXLOGSTRING3("CAlfBridge::DoDispatchL, EAlfDSGroupChained %d chained to %d (host), iWindowChainsArray.Count() = %d", chainedId, parentId, iWindowChainsArray.Count()); -#ifdef _ALF_FXLOGGING - CHuiControlGroup* parent = FindControlGroup(parentId); - CHuiControlGroup* chained = FindControlGroup(chainedId); - - if (parent) - { - RDebug::Printf("CAlfBridge::DoDispatch - parent: 0x%x", parent->SecureId()); - } - if (chained) - { - RDebug::Printf("CAlfBridge::DoDispatch - chained: 0x%x", chained->SecureId()); - } -#endif - } - -// --------------------------------------------------------------------------- -// HandleGroupChainBroken -// --------------------------------------------------------------------------- -// -void CAlfBridge::HandleGroupChainBroken( TAlfBridgerData& aData) - { - TInt parentId = aData.iInt2; - iWindowChainsArray.Remove(parentId); - __ALFFXLOGSTRING2("CAlfBridge::DoDispatchL, EAlfDSGroupChainBroken - parent: %d, iWindowChainsArray.Count() = %d", parentId, iWindowChainsArray.Count()); - } // --------------------------------------------------------------------------- // HandleMoveWindowToNewGroupL @@ -4553,6 +4342,7 @@ void CAlfBridge::HandleMoveWindowToNewGroupL( TAlfBridgerData& aData ) { TInt windowNodeId = aData.iInt1; + TInt screenNumber = aData.iInt2; TInt newWindowGroupNodeId = (TInt)aData.iPtr; CHuiCanvasVisual* viz = (CHuiCanvasVisual*)FindVisual(windowNodeId); @@ -4562,7 +4352,7 @@ TInt oldWindowGroupId = 0; if ( oldControlGroup ) { - oldWindowGroupId = FindWindowGroupNodeId(*oldControlGroup ); + oldWindowGroupId = FindWindowGroupNodeId(screenNumber, *oldControlGroup ); } __ALFLOGSTRING3("CAlfBridge::HandleMoveWindowToNewGroupL moving nodeId 0x%x from group 0x%x to 0x%x ",windowNodeId, oldWindowGroupId, newWindowGroupNodeId ); #endif @@ -4596,7 +4386,7 @@ viz->Owner().Remove(viz); // #2 insert visual to the beginning of the new group - CHuiControlGroup* newControlGroup = FindControlGroup(newWindowGroupNodeId); + CHuiControlGroup* newControlGroup = FindControlGroup(newWindowGroupNodeId,screenNumber); if (newControlGroup) { CHuiControl& newControl = newControlGroup->Control(0); @@ -4642,7 +4432,7 @@ } else { - CHuiControlGroup* cg = FindControlGroup(windowNodeId); // TODO: Screen + CHuiControlGroup* cg = FindControlGroup(windowNodeId, 0); // TODO: Screen if (cg) { CHuiControl& control = cg->Control(0); @@ -4834,117 +4624,11 @@ } } -// --------------------------------------------------------------------------- -// HandleGfxRedirection -// -// This effect might have been request for the host application, while the intent was to show it on the application started embedded. -// Embedded application has its _own_ windowgroup separate from the host application. Fullscreen effect are shown on a windowgroup level. -// e.g. Messaging -> New Message (editor), or Settings -> Themes (application) -// Wserv notifies us the window group chaining of applications. See HandleGroupChained and HandleGroupChainBroken for more details. This code -// will redirect the requested effect on correct windowgroup. -// -// NOTE! If embedded application effects are implemented, this will need revision -// --------------------------------------------------------------------------- - -void CAlfBridge::HandleGfxRedirection(CFullScreenEffectState& aEvent, CHuiLayout*& aToLayout) - { - __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Redirection check for SecureId 0x%x. Effect setup result: %d.", aEvent.iToSecureId, aEvent.iSetupDone); - TInt windowGroupNodeId = FindWindowGroupNodeId(*((*aToLayout).Owner().ControlGroup())); - CHuiControlGroup* chainedGroup = NULL; - - // check, if the effect is being asked for chained application. This propably indicates that there are two or more instances of it and - // effect was supposed to go to the single standalone instance - if (IsChainedGroup(windowGroupNodeId)) - { - RPointerArray groupList; - FindControlGroupBySecureId(aEvent.iToSecureId, groupList); - TInt i = groupList.Count(); - TInt standaloneGroups = 0; - while(--i >= 0) - { - windowGroupNodeId = FindWindowGroupNodeId(*groupList[i]); - - if (!IsChainedGroup(windowGroupNodeId)) - { - // This is an educated guess, which will make the standalone version to have effect. - // Currently (tm) standard appstart effect is never requested for embbedded instances. - chainedGroup = groupList[i]; - standaloneGroups++; - __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Wg id: %d is NOT chained. Index: %d",windowGroupNodeId, i); - } - else - { - __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Wg id: %d IS chained. Index: %d", windowGroupNodeId, i); - } - } - groupList.Close(); - // Skip effect redirection if the end result is uncertain. This is the case, if - // there are multiple standalone app groups (e.g. single application having multiple groups), - if (standaloneGroups>1) - { - chainedGroup = NULL; - aEvent.iIsRedirected = ETrue; - if (iFSFXDataPart2) - { - iFSFXDataPart2->iIsRedirected = ETrue; - } - } - } - else - { - // Which group is chained to this group? - TUint32 chainedId = FindChainedGroup(windowGroupNodeId); - chainedGroup = FindControlGroup(chainedId); - } - - // Redirection is skipped if the host layout has been already prepared (in practice added - // to iEffectCleanupStack) for the effect. - if (chainedGroup && !aEvent.iSetupDone) - { - __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Chained app found for this application. Transferring effect from 0x%x to 0x%x.", aToLayout->Owner().ControlGroup()->SecureId(), chainedGroup->SecureId()); - aToLayout = (CHuiLayout*)&chainedGroup->Control(0).Visual(0); - // we'll change the original effect request to point to this new group. Thus, if effect is - // canceled, it will be removed from the right place. - - aEvent.iToSecureId = chainedGroup->SecureId(); // Update the effect - aEvent.iToWg = FindClientWindowGroupId(*chainedGroup); - - if (iFSFXDataPart2) - { - iFSFXDataPart2->iToSecureId = aEvent.iToSecureId; - iFSFXDataPart2->iToWg = aEvent.iToWg; - } - } - else - { - __ALFFXLOGSTRING2("CAlfBridge::HandleGfxRedirection - Skip redirection for SecureId 0x%x. Chained group: 0x%x", aEvent.iToSecureId, chainedGroup); - } - // Redirection attemp is allowed to happen only once, because this redirects effects for - // _running_ embedded applications that must exist at the time of the request. - // We are not interested in the embedded applications effects. Start effects for embedded applications - // are not currently supported. - aEvent.iIsRedirected = ETrue; - if (iFSFXDataPart2) - { - iFSFXDataPart2->iIsRedirected = ETrue; - } - } - -// --------------------------------------------------------------------------- -// HandleGfxEventL -// -// --------------------------------------------------------------------------- -// -TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout* /*aFromLayout */) - { - __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - Operation: %d, To SecureUid: 0x%x, From SecureUid: 0x%x, effect %S", aEvent.iOperation, aEvent.iToSecureId, aEvent.iFromSecureId, aEvent.iEffectName); - __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEventL - To layout: 0x%x Effect handle: %d, Action: %d", aToLayout, aEvent.iHandle, aEvent.iAction); - - if (!aEvent.iIsRedirected) - { - HandleGfxRedirection(aEvent, aToLayout); - } - +TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout) + { + __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEventL - To SecureUid: 0x%x, From SecureUid: 0x%x, effect %S", aEvent.iToSecureId, aEvent.iFromSecureId, aEvent.iEffectName); + __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction); + TInt err = KErrNone; TBool failed = EFalse; @@ -4996,6 +4680,8 @@ case AknTransEffect::EApplicationStartSwitchRect: case KAlfFSTaskSwapperAppStart: { + aToLayout->iOpacity.Set(0.0f); // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground + FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); aEvent.iEffectType = CFullScreenEffectState::EStartEffect; if (iFSFXDataPart2) { @@ -5078,18 +4764,10 @@ if (aToLayout) { - // 1. If this is timeout, then we should be update the - // screenshot for the long app start effect usage. - // 2. For the second part of the effect, screenshot must be - // update. Thus the transition may continue smoothly, where app_start_long.fxml finished. - // 3. Sometimes BeginFullScreen has not run for the effect. For instance - // when window group is created after EndFullScreen was received. - TBool requiresScreenshot = NeedsStoredBuffers(iHuiEnv->EffectsEngine(), *aEvent.iEffectName); - TBool hasScreenshot = TBool(aToLayout->StoredRenderBuffer()); - if ((aEvent.iLongAppStartTimeout && !hasScreenshot) // (1) - || aEvent.iTwoPhaseEffect == CFullScreenEffectState::ESecondPartActive // (2) - || (requiresScreenshot && !hasScreenshot) // (3) - ) + // if this was timeout appstart effect, we need to take screenshot at this point. + // It was not taken in the beginfullscreen + + if (aEvent.iLongAppStartTimeout) { __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - taking screenshot for the timeout appstart effect. Handle: %d", aEvent.iHandle ); aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); @@ -5130,18 +4808,13 @@ } else { - // SetupEffectLayoutContainerL always returns ETrue. Code cleanup needed. layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, ETrue, EFalse, aEvent.iCanDestroyOrHideImmediately); } - aEvent.iSetupDone = ETrue; - if (iFSFXDataPart2) - { - iFSFXDataPart2->iSetupDone = aEvent.iSetupDone; - } + aEvent.iSetupDone = layoutEffectable; aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); } - if (layoutEffectable) // Note, this is always ETrue + if (layoutEffectable) { TInt effectFlags = 0; TInt activeEffectGroup = engine->ActiveGroupEffect(); @@ -5151,7 +4824,8 @@ } __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Active effect group: %d", activeEffectGroup); effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; - if (FxmlHasOpaqueHint(iHuiEnv->EffectsEngine(), *aEvent.iEffectName)) + if (FxmlHasOpaqueHint(iHuiEnv->EffectsEngine(), *aEvent.iEffectName) || + aEvent.iTwoPhaseEffect == CFullScreenEffectState::ESecondPartActive) { effectFlags |= KHuiFxOpaqueHint; } @@ -5223,11 +4897,8 @@ { // Freeze only, if buffer was reserved succesfully aLayout->SetFreezeState(ETrue); - if (!HasActiveEffect(aLayout)) - { - TBool itemsDestroyed; - AddFxItemL(aHandle, aLayout, NULL, NULL, EFalse, itemsDestroyed, ETrue, EFalse); - } + TBool itemsDestroyed; + AddFxItemL(aHandle, aLayout, NULL, NULL, EFalse, itemsDestroyed, ETrue, EFalse); iFSFxData->iAppStartScreenshotItemHandle = aHandle; } } @@ -5338,7 +5009,7 @@ // If we are in low memory state, we don't want to do any effects if(iHuiEnv->MemoryLevel() < EHuiMemoryLevelReduced) { - __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - WARNING! - Returning because memory level below NORMAL - EFFECT IS NOT SHOWN!"); + __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - Returning because memory level below NORMAL"); stream.Release(); return; } @@ -5576,7 +5247,6 @@ && fxData->iOperation == MAlfGfxEffectPlugin::EBeginFullscreen && fxData->iEffectType == CFullScreenEffectState::EStartEffect) { - __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - Try triggering effect immediately"); GfxTriggerEffectWhenFullScreenDrawn(toGroup); } } @@ -5626,10 +5296,9 @@ CHuiControl& control = aToGroup->Control(0); CHuiLayout* toLayout = control.VisualCount() > 0 ? (CHuiLayout*)&control.Visual(0) : NULL; - if (!toLayout || (toLayout->Flags() & EHuiVisualFlagInactive )) + if (!toLayout) { // no point starting effect, if the layout is still inactive. - __ALFFXLOGSTRING1("CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn - Do not trigger. Layout 0x%x inactive or not found.", toLayout); return EFalse; } TBool opaque = ETrue; // in app start case the layout is propably not opaque. Fake it. @@ -5638,7 +5307,7 @@ // alf content check is relavant only for alf apps if (!fullscreenCovered && aToGroup->iAlfApp) { - TInt clientGroupId = FindClientWindowGroupId(*aToGroup); + TInt clientGroupId = FindClientWindowGroupId(0, *aToGroup); if (clientGroupId != KErrNotFound) { fullscreenCovered = HasActiveAlfContent(clientGroupId); @@ -5990,7 +5659,9 @@ CControlEffectState* fxData = new (ELeave) CControlEffectState; CleanupStack::PushL(fxData); fxData->ConstructL(action, stream); - + iControlEffectData = fxData; + CleanupStack::Pop(fxData); + // We now have all the data sent to us. stream.Release(); @@ -6003,22 +5674,21 @@ if (visual) { - HandleGfxControlEventL(*fxData, visual); - CleanupStack::PopAndDestroy(fxData); + HandleGfxControlEventL(*iControlEffectData, visual); } else { - iControlEffectData = fxData; // move ownership - // Control was not found. Apply effect later when control appears in HandleNewWindow __ALFFXLOGSTRING2("CAlfBridge::HandleGfxControlEffectsL - Control not found. iClientHandle %d, iClientGroupHandle %d", iControlEffectData->iClientHandle, iControlEffectData->iClientGroupHandle); - CleanupStack::Pop(fxData); return; } iAlfScreens[0]->iDisplay->SetDirty(); iHuiEnv->ContinueRefresh(); + delete iControlEffectData; + iControlEffectData = NULL; + __ALFFXLOGSTRING("HandleGfxControlEffectsL - end"); } @@ -6267,7 +5937,7 @@ sourceViz->Owner().Remove(sourceViz); delete sourceViz; - __ALFFXLOGSTRING1("CAlfBridge::CleanFxItem - Destroying sourceViz: 0x%x", sourceViz); + __ALFFXLOGSTRING1("CAlfBridge::RemoveTemporaryPresenterItem - Destroying sourceViz: 0x%x", sourceViz); aEffectItem.iEffectedVisual = NULL; } else @@ -6282,7 +5952,7 @@ TBool CAlfBridge::CleanFxVisual(CHuiVisual* aVisual, TInt aHandle) { - __ALFFXLOGSTRING2("CAlfBridge::CleanFxVisual - cleaning handle: %d, 0x%x", aHandle, aVisual); + __ALFFXLOGSTRING2("CAlfBridge::RemoveTemporaryPresenterVisual - cleaning handle: %d, 0x%x", aHandle, aVisual); TInt visualsRemoved = 0; for (TInt i = 0; i < iEffectCleanupStack.Count(); i++) { @@ -6892,14 +6562,6 @@ { iManualRefreshTimer->Cancel(); } - if (!aEnable) - { - ClearRasterizerCache(); - } - -#ifdef ALF_MEMORYLOGGING - ReportMemory(); -#endif } // --------------------------------------------------------------------------- @@ -7509,14 +7171,6 @@ TRect displayRect = visualDisplayRect; visualDisplayRect = canvasVisual->CommandBufferCoverage(aOrientation); - if (aDuration <= KAlfCheckVisualIsNotReady && !visualRectIsCovered && visualIsVisible && - !displayRect.IsEmpty() && (canvasVisual->CanvasFlags() & EHuiCanvasVisualFlagNotReady)) - { - __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready - invalid screen device reachable"); - visualTreeReady = EFalse; - break; - } - // Heuristic: Check that visual drawing isn't completely empty. if ( aDuration <= KAlfCheckVisualDrawingNotEmpty && !visualRectIsCovered && visualIsVisible && visualDisplayRect.IsEmpty() ) @@ -7597,262 +7251,6 @@ return visualTreeReady; } -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -TBool CAlfBridge::IsVisualNotReadyReachable() - { - TBool invalidReachable = ETrue; - - if (!iAlfScreens.Count()) - { - return EFalse; - } - - iTempRegion.Clear(); - iTempRegion2.Clear(); - - CAlfScreen* screen = iAlfScreens[0]; - TRect fullscreen = TRect(TPoint(0,0), screen->Size()); - TInt orientation = screen->iDisplay->Orientation(); - - TBool fullscreenCovered = EFalse; - TBool alfClientWindowGroupVisible = EFalse; - - // Skip the topmost (effect) layer, start from floating sprite group - for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) - { - CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(j); - CHuiControl& control = controlgroup.Control(0); - - if (control.Role() == EHuiFpsIndicatorContainer) - { - // 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); - } - - if (fullscreenCovered) - { - break; - } - - // ALF applications are handled by checking if their visuals cover the whole screen. - if (control.Role() == EHuiSessionContainer) - { - CHuiLayout* hostContainer = control.ContainerLayout( NULL ); - TInt flags = hostContainer->Flags(); - if (alfClientWindowGroupVisible) - { - // check visual sizes if client has not made this control group hidden - if(!(flags&EHuiVisualFlagUnderOpaqueHint)) - { - if(iAppUi) - { - CAlfAppSrvSessionBase* alfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup); - - TInt clientWindowGroupId = alfSrvSession->ClientWindowGroup(); - // checking the case if there are multiple alf application openend. - if (clientWindowGroupId == iAppUi->GetLastActiveClient()) - { - return EFalse; - } - } - } - } - continue; - } - - TBool hasActiveVisualsInVisualTree(EFalse); - - if (alfClientWindowGroupVisible && (controlgroup.ResourceId() == iAlfWindowGroupNodeId)) - { - invalidReachable = - IsVisualNotReadyReachableRecursive( layout, controlgroup, control, - hasActiveVisualsInVisualTree, fullscreen, screen, - IsVisualOpaque(*layout), alfClientWindowGroupVisible); - } - else - { - invalidReachable = - IsVisualNotReadyReachableRecursive( layout, controlgroup, control, - fullscreenCovered, fullscreen, screen, - IsVisualOpaque(*layout), EFalse); - } - - if (invalidReachable) - { - // Problem found in IsInvalidScreenDeviceVisualReachableRecursive - break; - } - - if ( controlgroup.iAlfApp && layout->iOpacity.Now() > 0.0f ) - { - alfClientWindowGroupVisible = ETrue; - } - } - - iTempRegion2.Clear(); - - return invalidReachable; - } - -// --------------------------------------------------------------------------- -// --------------------------------------------------------------------------- -// -TBool CAlfBridge::IsVisualNotReadyReachableRecursive( - CHuiLayout* aLayout, - CHuiControlGroup& aControlGroup, - CHuiControl& aControl, - TBool& aFullscreenCovered, - const TRect& aFullscreen, - CAlfScreen* aScreen, - TBool aChildCanBeOpaque, - TBool aOnlyForEmbeddedAlfApp) - { - TBool invalidReachable = 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; - - canvasVisual = (CHuiCanvasVisual*)(&aLayout->Visual(i)); - - // Distraction windows are completely ignored. - TBool distractionWindow = (canvasVisual->CanvasFlags() & EHuiCanvasFlagDistractionWindow); - if ( distractionWindow ) - { - continue; - } - - visualIsOpaque = aChildCanBeOpaque && IsVisualOpaque(*canvasVisual); - TBool visualIsVisible = (canvasVisual->iOpacity.Now() > 0.01f); - - if (canvasVisual->Count() && visualIsVisible) - { - invalidReachable = IsVisualNotReadyReachableRecursive( canvasVisual, aControlGroup, aControl, - aFullscreenCovered, aFullscreen, aScreen, - visualIsOpaque, EFalse); - - if (invalidReachable) - { - break; - } - } - - // Calculate visual display rect - visualDisplayRect = canvasVisual->DisplayRect(); - - ClipVisualRect(visualDisplayRect, aLayout->DisplayRect()); - ClipVisualRect(visualDisplayRect, aFullscreen); - - // Check if covered. - if (aFullscreenCovered) - { - visualRectIsCovered = ETrue; - } - else - { - // Check if this visual is covered by other opaque visuals which rects are in "covered" region - // it should not check for alf event window group, when we have embedded alf application, - // because we have assumed that alf app will have full screen covered - if(!aOnlyForEmbeddedAlfApp) - { - visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); - } - } - - // Determine if visual is active from coverage point of view. - visualIsActive = EFalse; - if (visualRectIsCovered) - { - if (!(canvasVisual->Flags() & EHuiVisualFlagAlwaysDraw)) - { - visualIsActive = EFalse; - } - else - { - visualIsActive = ETrue; - } - } - else - { - visualIsActive = ETrue; - } - - // Sprites and effects as we consider them always as transparent and also - // if controlgroup is transformed somehow - if (aControl.Role() == EHuiFullScreenEffectContainer || - aControl.Role() == EHuiWindowFloatingSpriteContainer || - aControlGroup.IsTransformed()) - { - visualIsOpaque = EFalse; - } - - // Check that command buffers are ok. - if ( visualIsActive ) - { - if (!visualRectIsCovered && visualIsVisible && !visualDisplayRect.IsEmpty() && - (canvasVisual->CanvasFlags() & EHuiCanvasVisualFlagNotReady)) - { - __ALFLOGSTRING("CAlfBridge::IsLayoutSwitchReady not ready reachable"); - invalidReachable = ETrue; - break; - } - } - - 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, aLayout->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(); - } - } - } - } // for loop end : children checking loop - - return invalidReachable; - } - TBool CAlfBridge::IsFullScreenDrawnRecursiveAlfContent(CHuiVisual* aVisual, TRect& aFullScreen) { if(aVisual) @@ -8141,39 +7539,4 @@ return hasAlfContent; } -void CAlfBridge::ReportMemory() - { -#ifdef ALF_MEMORYLOGGING - TInt totalSpaceAllocated = 0; - TInt cellsAllocatedInHeap = User::AllocSize(totalSpaceAllocated); - TInt largestFreeBlock = 0; - TInt totalFreeSpaceInHeap = User::Available(largestFreeBlock); - TInt freeRAM = 0; - if ( HAL::Get( HALData::EMemoryRAMFree, freeRAM ) != KErrNone ) - { - freeRAM = -1; - } - TInt timestamp = User::NTickCount(); - - RDebug::Printf("%x CAlfBridge::ReportMemory - Allocated space: %d, Amount of allocated cells: %d, Largest free block: %d, Free space in heap: %d", - timestamp, - totalSpaceAllocated, - cellsAllocatedInHeap, - largestFreeBlock, - totalFreeSpaceInHeap); - RDebug::Printf("%x CAlfBridge::ReportMemory - Free RAM in system: %d", timestamp, freeRAM); -#endif - } - -void CAlfBridge::ClearRasterizerCache() - { - CFbsRasterizer* rasterizer = CFbsBitmap::Rasterizer(); - MFbsRasterizerClearCache* cacheInterfacePtr = NULL; - rasterizer->GetInterface(TUid::Uid(KUidFbsRasterizerClearCache), (TAny*&)cacheInterfacePtr); - if (cacheInterfacePtr) - { - cacheInterfacePtr->ClearCache(); - } - } - // end of file