98 //#define ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER |
99 //#define ALF_DEBUG_VISUALIZE_WINDOWGROUP_ORDER |
99 |
100 |
100 |
101 |
101 const TInt KFadeAction = 6000; |
102 const TInt KFadeAction = 6000; |
102 |
103 |
103 // ======== MEMBER FUNCTIONS ======== |
104 NONSHARABLE_CLASS( TAlfBridgeDrawerWrapper ) : public MAlfDrawerScreenInterface |
|
105 { |
|
106 public: |
|
107 TAlfBridgeDrawerWrapper(CAlfBridge& aBridge); |
|
108 TInt GetSizeAndRotation(TSize& aSize, TInt& aRotation); |
|
109 TInt ReadPixels(CFbsBitmap* aBitmap); |
|
110 private: |
|
111 CAlfBridge& iBridge; |
|
112 }; |
104 |
113 |
105 // ======== MEMBER FUNCTIONS ======== |
114 // ======== MEMBER FUNCTIONS ======== |
106 |
115 |
107 // --------------------------------------------------------------------------- |
116 // --------------------------------------------------------------------------- |
108 // --------------------------------------------------------------------------- |
117 // --------------------------------------------------------------------------- |
353 { |
365 { |
354 __ALFFXLOGSTRING1("CAlfBridge::RemoveVisual 0x%x", aWindowNodeId); |
366 __ALFFXLOGSTRING1("CAlfBridge::RemoveVisual 0x%x", aWindowNodeId); |
355 iWindowHashArray.Remove( aWindowNodeId ); |
367 iWindowHashArray.Remove( aWindowNodeId ); |
356 iPreviouslySearchedVisualId = 0; |
368 iPreviouslySearchedVisualId = 0; |
357 |
369 |
358 AMT_DEC_COUNTER( iTotalVisualCount ); |
370 AMT_DEC_COUNTER( iTotalVisualCount ); |
|
371 |
|
372 AMT_MAP_INC_VALUE( iIntMap, aWindowNodeId, EAlfModuleTestTypeBridgeReleaseWindow ); |
|
373 AMT_MAP_SET_VALUE( iBoolMap, aWindowNodeId, ETrue, EAlfModuleTestTypeBridgeReleaseWindow ); |
359 } |
374 } |
360 |
375 |
361 // --------------------------------------------------------------------------- |
376 // --------------------------------------------------------------------------- |
362 // FindVisual |
377 // FindVisual |
363 // --------------------------------------------------------------------------- |
378 // --------------------------------------------------------------------------- |
617 { |
632 { |
618 if (iAlfScreens[aScreenNumber]->iControlGroups[i].iWindowGroupNodeId == aWindowGroupNodeId) |
633 if (iAlfScreens[aScreenNumber]->iControlGroups[i].iWindowGroupNodeId == aWindowGroupNodeId) |
619 { |
634 { |
620 if (iAlfScreens[aScreenNumber]->iDisplay) |
635 if (iAlfScreens[aScreenNumber]->iDisplay) |
621 { |
636 { |
|
637 RemoveWindowGroupAsAlfApp(iAlfScreens[aScreenNumber]->iControlGroups[i].iClientWindowGroupId); |
|
638 |
622 CHuiControlGroup* controlGroup = iAlfScreens[aScreenNumber]->iControlGroups[i].iControlGroup; |
639 CHuiControlGroup* controlGroup = iAlfScreens[aScreenNumber]->iControlGroups[i].iControlGroup; |
623 CHuiControl& control = controlGroup->Control(0); |
640 CHuiControl& control = controlGroup->Control(0); |
624 CHuiLayout* layout = (CHuiLayout*)&control.Visual(0); |
641 CHuiLayout* layout = (CHuiLayout*)&control.Visual(0); |
625 ResolveAfterEffectAppearingApplicationL(controlGroup); |
642 ResolveAfterEffectAppearingApplicationL(controlGroup); |
626 // wserv has notifed that this control group and its layout should be destroyed. However, we might be |
643 // wserv has notifed that this control group and its layout should be destroyed. However, we might be |
734 layout->ClearFlag(EHuiVisualFlagClipping); // No need to clip, should be faster without clipping |
754 layout->ClearFlag(EHuiVisualFlagClipping); // No need to clip, should be faster without clipping |
735 // IsVisualOpaque should return true if there is no effect. |
755 // IsVisualOpaque should return true if there is no effect. |
736 // So that's why opaque flag is set to this layout. |
756 // So that's why opaque flag is set to this layout. |
737 layout->SetFlag(EHuiVisualFlagOpaqueHint); |
757 layout->SetFlag(EHuiVisualFlagOpaqueHint); |
738 |
758 |
|
759 for( TInt i = 0 ; i < iAlfNativeClientsWgIds.Count() ; i++ ) |
|
760 { |
|
761 if(iAlfNativeClientsWgIds[i] == aClientWindowGroupId) |
|
762 { |
|
763 group->iAlfApp = ETrue; |
|
764 break; |
|
765 } |
|
766 } |
|
767 |
739 TAlfControlGroupEntry entry; |
768 TAlfControlGroupEntry entry; |
740 entry.iControlGroup = group; |
769 entry.iControlGroup = group; |
741 entry.iWindowGroupNodeId = aWindowGroupNodeId; |
770 entry.iWindowGroupNodeId = aWindowGroupNodeId; |
742 entry.iClientWindowGroupId = aClientWindowGroupId; |
771 entry.iClientWindowGroupId = aClientWindowGroupId; |
743 entry.iSecureId = aSecureId; |
772 entry.iSecureId = aSecureId; |
951 if (index == aWhere) |
989 if (index == aWhere) |
952 { |
990 { |
953 TBool lSyncAlfAppAndAlfEventGroup = EFalse; |
991 TBool lSyncAlfAppAndAlfEventGroup = EFalse; |
954 if ( i>0 && aRoster.ControlGroup(i).iAlfApp && aRoster.ControlGroup(i-1).ResourceId() == iAlfWindowGroupNodeId && &aRoster.ControlGroup(i) != &aGroup) |
992 if ( i>0 && aRoster.ControlGroup(i).iAlfApp && aRoster.ControlGroup(i-1).ResourceId() == iAlfWindowGroupNodeId && &aRoster.ControlGroup(i) != &aGroup) |
955 { |
993 { |
956 lSyncAlfAppAndAlfEventGroup = ETrue; |
994 // we still need to check that there are no other alf client window groups on top. |
|
995 // if one native alf application is embedding another native alf application, WServ |
|
996 // seems to update wg chains so that the following check must be done |
|
997 TInt u = i+1; |
|
998 TBool clienWgFoundOntop =EFalse; |
|
999 for(;u < aRoster.Count() - screen->FixedControlGroupCount(); u++) |
|
1000 { |
|
1001 if(aRoster.ControlGroup(u).iAlfApp) |
|
1002 { |
|
1003 clienWgFoundOntop = ETrue; |
|
1004 break; |
|
1005 } |
|
1006 } |
|
1007 |
|
1008 if(!clienWgFoundOntop) |
|
1009 { |
|
1010 lSyncAlfAppAndAlfEventGroup = ETrue; |
|
1011 } |
957 } |
1012 } |
958 aRoster.ShowL(aGroup, i); |
1013 aRoster.ShowL(aGroup, i); |
959 added = ETrue; |
1014 added = ETrue; |
960 if (lSyncAlfAppAndAlfEventGroup && i< (aRoster.Count()-1) ) |
1015 if (lSyncAlfAppAndAlfEventGroup && i< (aRoster.Count()-1) ) |
961 { |
1016 { |
1317 } |
1372 } |
1318 |
1373 |
1319 TBool fullscreenCovered = EFalse; |
1374 TBool fullscreenCovered = EFalse; |
1320 CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; |
1375 CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; |
1321 |
1376 |
1322 //iActiveVisualCount = 0; |
|
1323 iBgSurfaceFound = EFalse; |
1377 iBgSurfaceFound = EFalse; |
1324 iHomeScreenWallpaperWindowFound = EFalse; |
1378 iHomeScreenWallpaperWindowFound = EFalse; |
1325 //iPaintedArea = 0; |
1379 |
1326 |
|
1327 // Check if effect group has an effect with opaque hint. |
1380 // Check if effect group has an effect with opaque hint. |
1328 CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup); |
1381 CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[aScreenNumber]->iFullscreenEffectControlGroup); |
1329 CHuiControl& fxcontrol = fxcontrolgroup.Control(0); |
1382 CHuiControl& fxcontrol = fxcontrolgroup.Control(0); |
1330 CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); |
1383 CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); |
1331 CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); |
1384 CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); |
1384 // Dont mess with alf control group visuals, alf session handling does it for us |
1438 // Dont mess with alf control group visuals, alf session handling does it for us |
1385 if (control.Role() == EAlfSessionContainer) |
1439 if (control.Role() == EAlfSessionContainer) |
1386 { |
1440 { |
1387 CHuiLayout* hostContainer = control.ContainerLayout( NULL ); |
1441 CHuiLayout* hostContainer = control.ContainerLayout( NULL ); |
1388 TInt flags = hostContainer->Flags(); |
1442 TInt flags = hostContainer->Flags(); |
1389 if (!fullscreenCovered) |
1443 if (!fullscreenCovered || alfClientWindowGroupVisible) |
1390 { |
1444 { |
1391 // clear inactive flag if client has not made this controlgroup hidden |
1445 // clear inactive flag if client has not made this controlgroup hidden |
1392 if(!(flags&EHuiVisualFlagUnderOpaqueHint)) |
1446 if(!(flags&EHuiVisualFlagUnderOpaqueHint)) |
1393 { |
1447 { |
1394 alfWindowGroupFoundVisible = ETrue; |
|
1395 if(iAppUi) |
1448 if(iAppUi) |
1396 { |
1449 { |
1397 topMostAlfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup); |
1450 topMostAlfSrvSession = iAppUi->SrvSessionForControlGroup(controlgroup); |
1398 } |
1451 } |
1399 hostContainer->ClearFlags(EHuiVisualFlagInactive); |
1452 TInt clientWindowGroupId = topMostAlfSrvSession->ClientWindowGroup(); |
1400 |
1453 __ALFLOGSTRING1("Alf Application: clientWindowGroupId %d", clientWindowGroupId); |
1401 // just add the rect to covered region because alf draws solid background |
1454 // checking the case if there are multiple alf application openend. |
1402 iTempRegion.AddRect(fullscreen); |
1455 if (clientWindowGroupId == iAppUi->GetLastActiveClient()) |
1403 iTempRegion.Tidy(); |
1456 { |
1404 fullscreenCovered = ETrue; |
1457 alfWindowGroupFoundVisible = ETrue; |
|
1458 hostContainer->ClearFlags(EHuiVisualFlagInactive); |
|
1459 |
|
1460 // just add the rect to covered region because alf draws solid background |
|
1461 iTempRegion.AddRect(fullscreen); |
|
1462 iTempRegion.Tidy(); |
|
1463 fullscreenCovered = ETrue; |
|
1464 alfClientWindowGroupVisible = EFalse; // change flag so that we don't go in this branch again |
|
1465 } |
1405 } |
1466 } |
1406 else // else put as inactive |
1467 else // else put as inactive |
1407 { |
1468 { |
1408 hostContainer->SetFlags(EHuiVisualFlagInactive); |
1469 hostContainer->SetFlags(EHuiVisualFlagInactive); |
1409 } |
1470 } |
1444 if (fullscreenCovered) |
1505 if (fullscreenCovered) |
1445 __ALFLOGSTRING("Full screen covered because of frozen roster content"); |
1506 __ALFLOGSTRING("Full screen covered because of frozen roster content"); |
1446 #endif |
1507 #endif |
1447 } |
1508 } |
1448 |
1509 |
|
1510 // if native alf app is found visible we can assume it should cover whole screen with alfcontent |
|
1511 // this is for embedded native alf application cases. Otherwise chained window groups tend to |
|
1512 // flicker from time to time |
|
1513 if(!fullscreenCovered && controlgroup.iAlfApp) |
|
1514 { |
|
1515 alfClientWindowGroupVisible = ETrue; |
|
1516 } |
|
1517 |
|
1518 |
1449 TBool subTreeCovered = EFalse; |
1519 TBool subTreeCovered = EFalse; |
1450 TBool hasLayers = EFalse; |
1520 TBool hasLayers = EFalse; |
1451 TBool hasActiveVisualsInVisualTree = |
1521 |
1452 HandleLayoutVisualVisibility( layout, controlgroup, control, |
1522 TBool hasActiveVisualsInVisualTree(EFalse); |
1453 fullscreenCovered, fullscreen, screen, |
1523 |
1454 subTreeCovered, hasLayers, IsVisualOpaque(*layout) ); |
1524 //embedded native alf application assumes that it should cover whole screen with alfcontent |
|
1525 // it makes alfeventwindowgroup as inactive and fading is not done on alf content |
|
1526 // this call is exculsive for alfeventwindowgroup |
|
1527 if (alfClientWindowGroupVisible && (controlgroup.ResourceId() == iAlfWindowGroupNodeId)) |
|
1528 { |
|
1529 hasActiveVisualsInVisualTree = |
|
1530 HandleLayoutVisualVisibility( layout, controlgroup, control, |
|
1531 hasActiveVisualsInVisualTree, fullscreen, screen, |
|
1532 subTreeCovered, hasLayers, IsVisualOpaque(*layout),alfClientWindowGroupVisible ); |
|
1533 } |
|
1534 |
|
1535 else |
|
1536 { |
|
1537 hasActiveVisualsInVisualTree = |
|
1538 HandleLayoutVisualVisibility( layout, controlgroup, control, |
|
1539 fullscreenCovered, fullscreen, screen, |
|
1540 subTreeCovered, hasLayers, IsVisualOpaque(*layout) ); |
|
1541 } |
|
1542 |
|
1543 |
1455 TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); |
1544 TBool hasFadeEffectsInVisualTree = (layout->CanvasFlags() & EHuiCanvasFlagExternalFadeExistsInsideVisualTree); |
1456 |
1545 |
|
1546 if(!fullscreenCovered && alfClientWindowGroupVisible) |
|
1547 { |
|
1548 iTempRegion.AddRect(fullscreen); |
|
1549 iTempRegion.Tidy(); |
|
1550 fullscreenCovered = ETrue; |
|
1551 } |
|
1552 |
1457 // If root visuals effect is marked as opaque, then add whole screen area as covered. |
1553 // If root visuals effect is marked as opaque, then add whole screen area as covered. |
1458 if (!fullscreenCovered) |
1554 if (!fullscreenCovered) |
1459 { |
1555 { |
1460 fullscreenCovered = IsOpaqueEffect(layout->Effect()); |
1556 fullscreenCovered = IsOpaqueEffect(layout->Effect()); |
1461 } |
1557 } |
1509 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Active visuals : %d", activevisualcount ); |
1605 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Active visuals : %d", activevisualcount ); |
1510 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Passive visuals: %d", passivevisualcount ); |
1606 __ALFLOGSTRING1(">>>> HandleVisualVisibility: Passive visuals: %d", passivevisualcount ); |
1511 #endif |
1607 #endif |
1512 |
1608 |
1513 } |
1609 } |
1514 |
1610 |
1515 if (iActivated) |
1611 if (iActivated && !iLayoutSwitchInProgress) |
1516 { |
1612 { |
1517 if (iBgSurfaceFound || iHomeScreenWallpaperWindowFound) |
1613 if (iBgSurfaceFound || iHomeScreenWallpaperWindowFound) |
1518 { |
1614 { |
1519 // only bg surface should trigger lowmem |
1615 // only bg surface should trigger lowmem |
1520 if (!iInLowMemMode && iBgSurfaceFound) |
1616 if (!iInLowMemMode && iBgSurfaceFound) |
1521 { |
1617 { |
1522 SetLowMemory(ETrue); |
1618 SetLowMemory(ETrue); |
1523 iInLowMemMode = ETrue; |
1619 iInLowMemMode = ETrue; |
|
1620 } |
|
1621 else if (!iBgSurfaceFound && iInLowMemMode) |
|
1622 { |
|
1623 SetLowMemory(EFalse); |
|
1624 iInLowMemMode = EFalse; |
1524 } |
1625 } |
1525 |
1626 |
1526 // if the background animation is not hidden yet, hide it now |
1627 // if the background animation is not hidden yet, hide it now |
1527 if (!iBgAnimHidden) |
1628 if (!iBgAnimHidden) |
1528 { |
1629 { |
1599 TBool& aFullscreenCovered, |
1700 TBool& aFullscreenCovered, |
1600 TRect& aFullscreen, |
1701 TRect& aFullscreen, |
1601 CAlfScreen* aScreen, |
1702 CAlfScreen* aScreen, |
1602 TBool& aSubtreeVisible, |
1703 TBool& aSubtreeVisible, |
1603 TBool& aHasVisualsWithLayers, |
1704 TBool& aHasVisualsWithLayers, |
1604 TBool aChildCanBeOpaque ) |
1705 TBool aChildCanBeOpaque, |
|
1706 TBool aOnlyForEmbeddedAlfApp) |
1605 { |
1707 { |
1606 TBool visualTreeActive = EFalse; |
1708 TBool visualTreeActive = EFalse; |
1607 TRect visualDisplayRect; |
1709 TRect visualDisplayRect; |
1608 TBool visualRectIsCovered = EFalse; |
1710 TBool visualRectIsCovered = EFalse; |
1609 TBool visualIsOpaque = EFalse; |
1711 TBool visualIsOpaque = EFalse; |
1661 { |
1763 { |
1662 // Check where visual is |
1764 // Check where visual is |
1663 visualDisplayRect = canvasVisual->DisplayRect(); |
1765 visualDisplayRect = canvasVisual->DisplayRect(); |
1664 |
1766 |
1665 // Make sure we clip visual rect to visible screen area |
1767 // Make sure we clip visual rect to visible screen area |
|
1768 ClipVisualRect(visualDisplayRect, aLayout->DisplayRect()); |
1666 ClipVisualRect(visualDisplayRect, aFullscreen); |
1769 ClipVisualRect(visualDisplayRect, aFullscreen); |
1667 |
1770 |
1668 // Check if this visual is covered by other opaque visuals which rects are in "covered" region |
1771 |
1669 visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); |
1772 // Check if this visual is covered by other opaque visuals which rects are in "covered" region |
|
1773 // it should not check for alf event window group, when we have embedded alf application, |
|
1774 // because we have assumed that alf app will have full screen covered |
|
1775 if(!aOnlyForEmbeddedAlfApp) |
|
1776 { |
|
1777 visualRectIsCovered = IsRectCoveredByRegion(visualDisplayRect, iTempRegion); |
|
1778 } |
|
1779 |
1670 } |
1780 } |
1671 |
1781 |
1672 /* if ( layout->Effect() || canvasVisual->Effect() ) |
1782 /* if ( layout->Effect() || canvasVisual->Effect() ) |
1673 { |
1783 { |
1674 visualRectIsCovered = EFalse; |
1784 visualRectIsCovered = EFalse; |
1760 // attached.. |
1870 // attached.. |
1761 if (canvasVisual->IsBackgroundDrawingEnabled() && |
1871 if (canvasVisual->IsBackgroundDrawingEnabled() && |
1762 canvasVisual->LayerExtent() != TRect() && |
1872 canvasVisual->LayerExtent() != TRect() && |
1763 !canvasVisual->LayerUsesAlphaFlag() ) |
1873 !canvasVisual->LayerUsesAlphaFlag() ) |
1764 { |
1874 { |
1765 // if paintedareacount is exactly one, it means that the window |
1875 // if paintedareacount is exactly one or two, it means that the window |
1766 // has background surface but no drawing commands |
1876 // has background surface but no drawing commands |
1767 if (canvasVisual->PaintedAreaCount() == 1) |
1877 TInt areaCount = canvasVisual->PaintedAreaCount(); |
|
1878 // special handling for camera... |
|
1879 TBool incamera = aControlGroup.SecureId() == 0x101f857a; |
|
1880 if (areaCount == 1 || areaCount == 2 || incamera) |
1768 { |
1881 { |
1769 THuiCanvasPaintedArea pa = canvasVisual->PaintedArea(0); |
1882 TBool onlyFullScreenAreas = ETrue; |
1770 TRect r = pa.iPaintedRect.Round(); |
1883 for (TInt count = 0; count < areaCount; count++) |
|
1884 { |
|
1885 TRect area = canvasVisual->PaintedArea(count).iPaintedRect.Round(); |
|
1886 if (area != Display(0)->VisibleArea()) |
|
1887 { |
|
1888 onlyFullScreenAreas = EFalse; |
|
1889 } |
|
1890 } |
1771 // if we found a fullscreen surface with no other drawing commands |
1891 // if we found a fullscreen surface with no other drawing commands |
1772 // we can safely assume that it's about the only thing to be visible |
1892 // we can safely assume that it's about the only thing to be visible |
1773 // and we can release memory occupied by other parts of the system |
1893 // and we can release memory occupied by other parts of the system |
1774 // |
1894 // |
1775 // NOTE: this mechanism keeps the system in low mem state |
1895 // NOTE: this mechanism keeps the system in low mem state |
1776 // if the surface is visible, meaning that for example |
1896 // if the surface is visible, meaning that for example |
1777 // opening an options menu does not instantly trigger normal |
1897 // opening an options menu does not instantly trigger normal |
1778 // memory state. We want to do it like this as otherwise |
1898 // memory state. We want to do it like this as otherwise |
1779 // we would be triggering for example background animation |
1899 // we would be triggering for example background animation |
1780 // on / off quite rapidly........ |
1900 // on / off quite rapidly........ |
1781 if ( r == Display(0)->VisibleArea()) |
1901 if ( onlyFullScreenAreas || incamera) |
1782 { |
1902 { |
1783 // Final test. Surface must not be ALF surface, but some other surface. |
1903 // Final test. Surface must not be ALF surface, but some other surface. |
1784 CHuiControlGroup* alfControlGroup = FindControlGroupBySecureId( iAlfSecureId ); |
1904 CHuiControlGroup* alfControlGroup = FindControlGroupBySecureId( iAlfSecureId ); |
1785 if (alfControlGroup != &aControlGroup) |
1905 if (alfControlGroup != &aControlGroup) |
1786 { |
1906 { |
1827 if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) |
1947 if ( canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation ) |
1828 { |
1948 { |
1829 if ( !canvasVisual->HasCustomShape() ) |
1949 if ( !canvasVisual->HasCustomShape() ) |
1830 { |
1950 { |
1831 TRect displayRect(canvasVisual->DisplayRect()); |
1951 TRect displayRect(canvasVisual->DisplayRect()); |
|
1952 ClipVisualRect(displayRect, aLayout->DisplayRect()); |
1832 ClipVisualRect(displayRect, aFullscreen); |
1953 ClipVisualRect(displayRect, aFullscreen); |
1833 |
1954 |
1834 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1955 #ifdef ALF_DEBUG_PRINT_WINDOWGROUP_ORDER |
1835 __ALFLOGSTRING2("Covered rect: iTl: %i, %i", displayRect.iTl.iX, displayRect.iTl.iY); |
1956 __ALFLOGSTRING2("Covered rect: iTl: %i, %i", displayRect.iTl.iX, displayRect.iTl.iY); |
1836 __ALFLOGSTRING2("Covered rect: iBr: %i, %i", displayRect.iBr.iX, displayRect.iBr.iY); |
1957 __ALFLOGSTRING2("Covered rect: iBr: %i, %i", displayRect.iBr.iX, displayRect.iBr.iY); |
1891 #endif |
2012 #endif |
1892 } |
2013 } |
1893 visualTreeActive |= visualIsActive; |
2014 visualTreeActive |= visualIsActive; |
1894 |
2015 |
1895 // iVisibleVisualCount is cleared in HandleVisualVisibility() |
2016 // iVisibleVisualCount is cleared in HandleVisualVisibility() |
1896 AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); |
2017 AMT_INC_COUNTER_IF( visualIsActive && visualIsOpaque && !visualRectIsCovered, iVisibleVisualCount ); |
|
2018 |
|
2019 AMT_MAP_SET_VALUE_IF( |
|
2020 visualIsActive && visualIsOpaque && !visualRectIsCovered && (canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation), |
|
2021 iBoolMap, |
|
2022 AMT_MAP_CPTR_TO_KEY_CAST( canvasVisual ), |
|
2023 ETrue, |
|
2024 EAlfModuleTestTypeBridgeVisualVisibility); |
|
2025 AMT_MAP_SET_VALUE_IF( |
|
2026 !visualIsActive || !visualIsOpaque || visualRectIsCovered || !(canvasVisual->CanvasFlags() & EHuiCanvasFlagIncludeToVisibilityCalculation), |
|
2027 iBoolMap, |
|
2028 AMT_MAP_CPTR_TO_KEY_CAST( canvasVisual ), |
|
2029 EFalse, |
|
2030 EAlfModuleTestTypeBridgeVisualVisibility); |
1897 } // for loop end : children checking loop |
2031 } // for loop end : children checking loop |
1898 |
2032 |
1899 return visualTreeActive; |
2033 return visualTreeActive; |
1900 } |
2034 } |
1901 |
2035 |
2656 __ALFLOGSTRING("CAlfBridge::HandleSetWindowPosL, EAlfDSSetWindowPos: Visual not found!"); |
2791 __ALFLOGSTRING("CAlfBridge::HandleSetWindowPosL, EAlfDSSetWindowPos: Visual not found!"); |
2657 } |
2792 } |
2658 |
2793 |
2659 AMT_INC_COUNTER_IF( viz, iVisualPositionChangedCount ); |
2794 AMT_INC_COUNTER_IF( viz, iVisualPositionChangedCount ); |
2660 AMT_SET_VALUE_IF( viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); |
2795 AMT_SET_VALUE_IF( viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); |
2661 AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ), |
2796 AMT_MAP_SET_VALUE_IF( viz, iPositionMap, windowNodeId, |
2662 iPositionMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, |
2797 windowAttributes->iPosition, |
2663 windowAttributes->iPosition, EAlfModuleTestTypeBridgeChangePosition ); |
2798 EAlfModuleTestTypeBridgeChangeWindowPosition ); |
2664 } |
2799 } |
2665 |
2800 |
2666 // --------------------------------------------------------------------------- |
2801 // --------------------------------------------------------------------------- |
2667 // HandleSetWindowSizeL |
2802 // HandleSetWindowSizeL |
2668 // --------------------------------------------------------------------------- |
2803 // --------------------------------------------------------------------------- |
2690 } |
2825 } |
2691 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); |
2826 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); |
2692 |
2827 |
2693 AMT_INC_COUNTER_IF(viz, iVisualSizeChangedCount ); |
2828 AMT_INC_COUNTER_IF(viz, iVisualSizeChangedCount ); |
2694 AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); |
2829 AMT_SET_VALUE_IF(viz, iLatestVisualExtentRect, TRect( windowAttributes->iPosition, windowAttributes->iSize ) ); |
2695 AMT_MAP_SET_VALUE_IF( ( viz && iWindowHashArray.Find( windowNodeId ) ), |
2830 |
2696 iSizeMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, |
2831 AMT_MAP_SET_VALUE_IF( viz, iSizeMap, windowNodeId, |
2697 windowAttributes->iSize, EAlfModuleTestTypeBridgeChangeSize ); |
2832 windowAttributes->iSize, |
|
2833 EAlfModuleTestTypeBridgeChangeWindowSize ); |
2698 } |
2834 } |
2699 |
2835 |
2700 // --------------------------------------------------------------------------- |
2836 // --------------------------------------------------------------------------- |
2701 // HandleSetWindowRotationL |
2837 // HandleSetWindowRotationL |
2702 // --------------------------------------------------------------------------- |
2838 // --------------------------------------------------------------------------- |
3120 |
3255 |
3121 // 1. if we get drawing commands after BeginFullScreen, we need to generate EndFullScreen call. |
3256 // 1. if we get drawing commands after BeginFullScreen, we need to generate EndFullScreen call. |
3122 // 2. only the first drawing commands will trigger EndFullScreen |
3257 // 2. only the first drawing commands will trigger EndFullScreen |
3123 // (this mechanism is here because we want to remove delay from fullscreen effects - and EndFullScreens are coming from application too late) |
3258 // (this mechanism is here because we want to remove delay from fullscreen effects - and EndFullScreens are coming from application too late) |
3124 |
3259 |
3125 if (viz->Owner().ControlGroup() == to_group) |
3260 if (viz && viz->Owner().ControlGroup() == to_group) |
3126 { |
3261 { |
3127 if (!iFullScreenEffectData->iDrawingCompleteTimer) |
3262 GfxTriggerEffectWhenFullScreenDrawn(to_group); |
3128 { |
3263 } |
3129 iFullScreenEffectData->InitDelayedEffectL(this, iAlfScreens[0]->Size()); |
|
3130 } |
|
3131 THuiCanvasPaintedArea p = viz->PaintedArea(0); |
|
3132 iFullScreenEffectData->iPaintedRegion.AddRect( p.iPaintedRect.Round() ); |
|
3133 TRect b = iFullScreenEffectData->iPaintedRegion.BoundingRect(); |
|
3134 __ALFFXLOGSTRING3( |
|
3135 "CAlfBridge::HandlePostCanvasBufferL : Effect to visual 0x%x, Covered rect: iTl.iX: %d , iTl.iY: %d", |
|
3136 viz, |
|
3137 b.iTl.iX, |
|
3138 b.iTl.iY); |
|
3139 __ALFFXLOGSTRING2("CAlfBridge::HandlePostCanvasBufferL : iBr.iX: %d, iBr.iY: %d", b.iBr.iX, b.iBr.iY); |
|
3140 } |
|
3141 } |
3264 } |
3142 #endif |
3265 #endif |
3143 } |
3266 } |
3144 |
3267 |
3145 // --------------------------------------------------------------------------- |
3268 // --------------------------------------------------------------------------- |
3146 // HandleGfxEndFullScreenTimeout |
3269 // HandleGfxEndFullScreenTimeout |
3147 // --------------------------------------------------------------------------- |
3270 // --------------------------------------------------------------------------- |
3148 // |
3271 // |
3149 void CAlfBridge::HandleGfxEndFullScreenTimeout(CFullScreenEffectState* aFullScreenEffectData) |
3272 void CAlfBridge::GfxTriggerEndFullScreen(CFullScreenEffectState* aFullScreenEffectData) |
3150 { |
3273 { |
3151 if (aFullScreenEffectData->iEndFullScreen) |
3274 if (aFullScreenEffectData->iEndFullScreen) |
3152 { |
3275 { |
3153 return; |
3276 return; |
3154 } |
3277 } |
3204 aVisual->iOpacity.Set(0.0f); |
3327 aVisual->iOpacity.Set(0.0f); |
3205 } |
3328 } |
3206 } |
3329 } |
3207 else |
3330 else |
3208 { |
3331 { |
|
3332 __ALFFXLOGSTRING2("CAlfBridge::SetWindowActiveL 0x%x has active effect. New state: %d", aVisual, aActive); |
3209 // Has effect |
3333 // Has effect |
3210 // these flags are put to action in RemoveTemporaryPresenterItem |
3334 // these flags are put to action in RemoveTemporaryPresenterItem |
3211 if (aActive) |
3335 if (aActive) |
3212 { |
3336 { |
3213 // this prevents windows appearing before their "effected" time |
3337 // this prevents windows appearing before their "effected" time |
3214 if (!iEffectCleanupStack[effectIndex].iHideWhenFinished) |
3338 if (!iEffectCleanupStack[effectIndex].iHideWhenFinished) |
3215 { |
3339 { |
3216 // this is appear effect. Lets show it |
3340 // this is appear effect. Lets show it. if effect would be stopped |
|
3341 // by some other effect, then EHuiVisualFlagShouldBeShown assures the correct state |
|
3342 // after cleanup. |
3217 aVisual->iOpacity.Set(KAlfVisualDefaultOpacity); |
3343 aVisual->iOpacity.Set(KAlfVisualDefaultOpacity); |
|
3344 aVisual->SetFlag(EHuiVisualFlagShouldBeShown); |
3218 } |
3345 } |
3219 else |
3346 else |
3220 { |
3347 { |
3221 aVisual->SetFlag(EHuiVisualFlagShouldBeShown); |
3348 aVisual->SetFlag(EHuiVisualFlagShouldBeShown); |
3222 } |
3349 } |
3227 // this prevents windows disappearing before their effect has finished, unless it makes no difference. |
3354 // this prevents windows disappearing before their effect has finished, unless it makes no difference. |
3228 // For instance, if the visual is being shown by a screenshot in some other visual, then having this visual around |
3355 // For instance, if the visual is being shown by a screenshot in some other visual, then having this visual around |
3229 // will only break the "live view" |
3356 // will only break the "live view" |
3230 if (iEffectCleanupStack[effectIndex].iCanDestroyOrHideImmediately && !aVisual->Effect()) |
3357 if (iEffectCleanupStack[effectIndex].iCanDestroyOrHideImmediately && !aVisual->Effect()) |
3231 { |
3358 { |
3232 aVisual->ClearFlags(EHuiVisualFlagShouldBeShown | EHuiVisualFlagShouldBeHidden); |
3359 aVisual->ClearFlags(EHuiVisualFlagShouldBeShown); |
|
3360 aVisual->SetFlag(EHuiVisualFlagShouldBeHidden); |
|
3361 //if effect would be stopped by some other effect, then EHuiVisualFlagShouldBeShown flag |
|
3362 // assures the correct state after cleanup. |
3233 aVisual->iOpacity.Set(0.0f); |
3363 aVisual->iOpacity.Set(0.0f); |
3234 } |
3364 } |
3235 else |
3365 else |
3236 { |
3366 { |
3237 aVisual->SetFlag(EHuiVisualFlagShouldBeHidden); |
3367 aVisual->SetFlag(EHuiVisualFlagShouldBeHidden); |
3318 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed |
3448 iAlfScreens[screenNumber]->SetVisualTreeVisibilityChanged(ETrue); // TODO: Check if really changed |
3319 |
3449 |
3320 AMT_INC_COUNTER( iTotalVisualFlagChangedCount ); |
3450 AMT_INC_COUNTER( iTotalVisualFlagChangedCount ); |
3321 AMT_INC_COUNTER_IF( windowAttributes->iActive, iActiveVisualCount ); |
3451 AMT_INC_COUNTER_IF( windowAttributes->iActive, iActiveVisualCount ); |
3322 AMT_INC_COUNTER_IF( !windowAttributes->iActive, iPassiveVisualCount ); |
3452 AMT_INC_COUNTER_IF( !windowAttributes->iActive, iPassiveVisualCount ); |
3323 AMT_MAP_INC_VALUE_IF( ( iWindowHashArray.Find( windowNodeId ) ), |
3453 |
3324 iIntMap, iWindowHashArray.Find( windowNodeId )->iClientSideId, |
3454 AMT_MAP_SET_VALUE( iBoolMap, windowNodeId, windowAttributes->iActive, |
3325 EAlfModuleTestTypeBridgeChangeFlag ); |
3455 EAlfModuleTestTypeBridgeChangeWindowVisibility ); |
|
3456 AMT_MAP_SET_VALUE( iBoolMap, windowNodeId, windowAttributes->iActive, |
|
3457 EAlfModuleTestTypeBridgeActiveWindow ); |
3326 } |
3458 } |
3327 |
3459 |
3328 |
3460 |
3329 // --------------------------------------------------------------------------- |
3461 // --------------------------------------------------------------------------- |
3330 // HandleSetWindowFlagL |
3462 // HandleSetWindowFlagL |
3881 } |
4013 } |
3882 } |
4014 } |
3883 return has; |
4015 return has; |
3884 } |
4016 } |
3885 |
4017 |
|
4018 // --------------------------------------------------------------------------- |
|
4019 // |
|
4020 // --------------------------------------------------------------------------- |
|
4021 // |
|
4022 void CAlfBridge::UpdateRootVisualsToFullscreen() |
|
4023 { |
|
4024 if (!iAlfScreens.Count()) |
|
4025 { |
|
4026 return; |
|
4027 } |
|
4028 |
|
4029 // update all the layouts even inactive ones. |
|
4030 CAlfScreen* screen = iAlfScreens[0]; |
|
4031 TRect fullscreen = TRect(TPoint(0,0), screen->Size()); |
|
4032 for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) |
|
4033 { |
|
4034 CHuiControlGroup& controlgroup = screen->iDisplay->Roster().ControlGroup(j); |
|
4035 CHuiControl& control = controlgroup.Control(0); |
|
4036 |
|
4037 if( control.Role() == EAlfWindowGroupContainer) |
|
4038 { |
|
4039 // Only update layout which are made to correspond window groups. |
|
4040 // Layouts that fullscreen effects are applied to |
|
4041 CHuiCanvasVisual* layout = (CHuiCanvasVisual*)&control.Visual(0); |
|
4042 layout->SetPos(fullscreen.iTl); |
|
4043 layout->SetSize(fullscreen.Size()); |
|
4044 } |
|
4045 } |
|
4046 } |
|
4047 |
|
4048 |
3886 |
4049 |
3887 // --------------------------------------------------------------------------- |
4050 // --------------------------------------------------------------------------- |
3888 // SetupFadeEffectL |
4051 // SetupFadeEffectL |
3889 // |
4052 // |
3890 // NOTE: This method gets called very often, so we should not do anything time |
4053 // NOTE: This method gets called very often, so we should not do anything time |
4224 } |
4389 } |
4225 TBool NeedsStoredBuffers(CHuiFxEngine *aEngine, const TDesC &aFileName) |
4390 TBool NeedsStoredBuffers(CHuiFxEngine *aEngine, const TDesC &aFileName) |
4226 { |
4391 { |
4227 return aEngine->FxmlUsesInput1(aFileName); |
4392 return aEngine->FxmlUsesInput1(aFileName); |
4228 } |
4393 } |
4229 |
4394 TBool FxmlHasOpaqueHint(CHuiFxEngine *aEngine, const TDesC &aFileName) |
|
4395 { |
|
4396 return aEngine->FxmlUsesOpaqueHint(aFileName); |
|
4397 } |
|
4398 |
|
4399 // --------------------------------------------------------------------------- |
|
4400 // StoreLayoutIfRequiredByEffectL |
|
4401 // |
|
4402 // Certains effects require screenshot to be taken when BeginFullScreen event |
|
4403 // is triggered. This method will take a screenshot (of the whole screen), if |
|
4404 // there is enough memory available. |
|
4405 // --------------------------------------------------------------------------- |
|
4406 // |
|
4407 TBool CAlfBridge::StoreLayoutIfRequiredByEffectL(CHuiLayout* aLayout, CFullScreenEffectState& aEvent, TBool& aNeededStoredLayout) |
|
4408 { |
|
4409 aNeededStoredLayout = NeedsStoredBuffers(iHuiEnv->EffectsEngine(), *aEvent.iEffectName); |
|
4410 __ALFFXLOGSTRING2("CAlfBridge::StoreLayoutIfRequiredByEffectL - aHandle: %d, Take screenhot: %d", aEvent.iHandle, aNeededStoredLayout); |
|
4411 if (aNeededStoredLayout) |
|
4412 { |
|
4413 TRAPD(err,StoreRenderBufferStartL(aLayout)); |
|
4414 __ALFFXLOGSTRING1("CAlfBridge::StoreLayoutIfRequiredByEffectL - Screenshot result: KErrNone == %d", err); |
|
4415 if (err == KErrNone) |
|
4416 { |
|
4417 aLayout->SetFreezeState(ETrue); |
|
4418 aEvent.iCanDestroyOrHideImmediately = ETrue; // if children of this layout are hidden or destroyed during effect, that can happen immediately |
|
4419 return ETrue; // storing of content requesteds, could store the content => success |
|
4420 } |
|
4421 else |
|
4422 { |
|
4423 return EFalse; // could not store the content => failed |
|
4424 } |
|
4425 } |
|
4426 else |
|
4427 { |
|
4428 __ALFFXLOGSTRING("CAlfBridge::StoreLayoutIfRequiredByEffectL - Storing not required"); |
|
4429 return ETrue; // no storing requred, no screenshot required => success |
|
4430 } |
|
4431 } |
|
4432 |
4230 TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout) |
4433 TBool CAlfBridge::HandleGfxEventL(CFullScreenEffectState& aEvent, CHuiLayout* aToLayout, CHuiLayout *aFromLayout) |
4231 { |
4434 { |
|
4435 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - To SecureUid: 0x%x, From SecureUid: 0x%x", aEvent.iToSecureId, aEvent.iFromSecureId); |
4232 __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction); |
4436 __ALFFXLOGSTRING4("CAlfBridge::HandleGfxEventL - To layout: 0x%x, From layout: 0x%x, Effect handle: %d, Action: %d", aToLayout, aFromLayout, aEvent.iHandle, aEvent.iAction); |
4233 TInt err = KErrNone; |
4437 TInt err = KErrNone; |
4234 TBool failed = EFalse; |
4438 TBool failed = EFalse; |
4235 |
4439 |
4236 // Check if there is an effects engine in HuiEnv |
4440 // Check if there is an effects engine in HuiEnv |
4249 switch(aEvent.iOperation) |
4453 switch(aEvent.iOperation) |
4250 { |
4454 { |
4251 case MAlfGfxEffectPlugin::EBeginFullscreen: |
4455 case MAlfGfxEffectPlugin::EBeginFullscreen: |
4252 { |
4456 { |
4253 aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); |
4457 aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); |
4254 TBool needStoredBuffers = NeedsStoredBuffers(engine, *aEvent.iEffectName); |
4458 TBool neededStoredBuffers; |
4255 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - EBeginFullScreen: %d, Take screenhot: %d", aEvent.iHandle, needStoredBuffers); |
4459 TBool success = StoreLayoutIfRequiredByEffectL(aToLayout, aEvent, neededStoredBuffers); |
4256 if (needStoredBuffers) |
4460 |
|
4461 // if screenshot was requested and it was possible to take one, then add this layout |
|
4462 // to effectcleanup stack |
|
4463 if (neededStoredBuffers) |
4257 { |
4464 { |
4258 TRAP(err,StoreRenderBufferStartL(aToLayout)); |
4465 TInt dummy; |
4259 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullScreen: Screenshot result: KErrNone == %d", err); |
4466 if (!HasActiveEffect(aToLayout, dummy)) |
4260 if (err == KErrNone) |
4467 { |
4261 { |
4468 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Add layout 0x%x with handle %d to cleanupstack", aToLayout, aEvent.iHandle); |
4262 aToLayout->SetFreezeState(ETrue); |
4469 AddEffectItemL(aEvent.iHandle, aToLayout, NULL, NULL, EFalse, dummy, EFalse); |
4263 aEvent.iCanDestroyOrHideImmediately = ETrue; // if children of this layout are hidden or destroyed during effect, that can happen immediately |
4470 } |
4264 } |
|
4265 else |
|
4266 { |
|
4267 return ETrue; // failed, effect will be canceled |
|
4268 } |
|
4269 } |
4471 } |
|
4472 // Screenshot was requested, but it could not be taken. Lets cancel the effect. |
|
4473 if (!success) |
|
4474 { |
|
4475 return ETrue; // this will cause effect cleanup |
|
4476 } |
|
4477 |
4270 |
4478 |
4271 switch(aEvent.iAction) |
4479 switch(aEvent.iAction) |
4272 { |
4480 { |
4273 case AknTransEffect::EApplicationActivate: |
4481 case AknTransEffect::EApplicationActivate: |
4274 case AknTransEffect::EApplicationStart: |
4482 case AknTransEffect::EApplicationStart: |
4277 case AknTransEffect::EApplicationStartSwitchRect: |
4485 case AknTransEffect::EApplicationStartSwitchRect: |
4278 { |
4486 { |
4279 aToLayout->iOpacity.Set(0.0f); // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground |
4487 aToLayout->iOpacity.Set(0.0f); // these are meant for applications that are not yet ready to be drawn, but possible already on the foreground |
4280 FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); |
4488 FreezeLayoutUntilEffectDestroyedL(aFromLayout, aEvent.iHandle); |
4281 aEvent.iEffectType = CFullScreenEffectState::EStartEffect; |
4489 aEvent.iEffectType = CFullScreenEffectState::EStartEffect; |
|
4490 aEvent.iCanDestroyOrHideImmediately = ETrue; // enable hiding of windows during application start/activate effects |
4282 break; |
4491 break; |
4283 } |
4492 } |
4284 case AknTransEffect::EApplicationExit: |
4493 case AknTransEffect::EApplicationExit: |
4285 { |
4494 { |
4286 aEvent.iEffectType = CFullScreenEffectState::EExitEffect; |
4495 aEvent.iEffectType = CFullScreenEffectState::EExitEffect; |
4297 // effect on a layout must be an application start effect. |
4506 // effect on a layout must be an application start effect. |
4298 // External content visual is not used for that. |
4507 // External content visual is not used for that. |
4299 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Found effect on layout 0x%x. Removing effect 0x%x", aToLayout, aToLayout->Effect()); |
4508 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Found effect on layout 0x%x. Removing effect 0x%x", aToLayout, aToLayout->Effect()); |
4300 aToLayout->SetEffect(NULL); |
4509 aToLayout->SetEffect(NULL); |
4301 } |
4510 } |
4302 if ( aEvent.iAction == AknTransEffect::EApplicationExit && !(aToLayout->Flags() & EHuiVisualFlagInactive)) |
4511 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEventL - Layout 0x%x is active: %d", aToLayout, !TBool(aToLayout->Flags() & EHuiVisualFlagInactive) ); |
|
4512 if (!(aToLayout->Flags() & EHuiVisualFlagInactive)) |
4303 { |
4513 { |
|
4514 TInt index; |
|
4515 if (aToLayout->StoredRenderBuffer() && HasActiveEffect(aToLayout, index) && index != KErrNotFound) |
|
4516 { |
|
4517 // a screenshot has been saved into the layout, and the layout was added to cleanupstack |
|
4518 // for cleaning. SetupEffectLayoutContainerL will add the same layout |
|
4519 // to the cleanupstack, but double cleaning is not a good idea. Thus it is removed here. |
|
4520 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Removing the layout 0x%x with screenshot from iEffectCleanupStack", aToLayout); |
|
4521 iEffectCleanupStack.Remove(index); |
|
4522 } |
4304 // this will tag the visual, that they cannot be hidden by HandleVisualVisibility |
4523 // this will tag the visual, that they cannot be hidden by HandleVisualVisibility |
4305 // Initialize layout for the exit effect |
4524 // Initialize layout for the exit effect |
4306 iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue, aEvent.iCanDestroyOrHideImmediately); |
4525 iLayoutInitializedForExitEffect = SetupEffectLayoutContainerL(aEvent.iHandle, aToLayout, ETrue, aEvent.iCanDestroyOrHideImmediately); |
4307 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullscreen - iLayoutInitializedForExitEffect: %d", iLayoutInitializedForExitEffect); |
4526 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EBeginFullscreen - iLayoutInitializedForExitEffect: %d", iLayoutInitializedForExitEffect); |
4308 aEvent.iSetupDone = iLayoutInitializedForExitEffect; |
4527 aEvent.iSetupDone = iLayoutInitializedForExitEffect; |
4309 } |
4528 } |
4310 else |
4529 else |
4311 { |
4530 { |
4312 iLayoutInitializedForExitEffect = EFalse; |
4531 iLayoutInitializedForExitEffect = EFalse; |
4313 aEvent.iSetupDone = EFalse; |
4532 aEvent.iSetupDone = EFalse; |
|
4533 failed = ETrue; |
4314 } |
4534 } |
4315 return failed; |
4535 return failed; |
4316 } |
4536 } |
4317 default: |
4537 default: |
4318 break; |
4538 break; |
4335 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - loading effect, handle %d", aEvent.iHandle ); |
4555 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - loading effect, handle %d", aEvent.iHandle ); |
4336 if (aEvent.iAction == AknTransEffect::EApplicationExit) |
4556 if (aEvent.iAction == AknTransEffect::EApplicationExit) |
4337 { |
4557 { |
4338 // Exit effect was initialized earlier with EBeginFullscreen event |
4558 // Exit effect was initialized earlier with EBeginFullscreen event |
4339 layoutEffectable = aEvent.iSetupDone; |
4559 layoutEffectable = aEvent.iSetupDone; |
4340 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EEndFullScreen: %d", layoutEffectable); |
4560 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - EEndFullScreen: iSetupDone: %d", layoutEffectable); |
4341 } |
4561 } |
4342 else |
4562 else |
4343 { |
4563 { |
4344 // add visuals to visual cleanupstack |
4564 // add visuals to visual cleanupstack |
4345 aToLayout->SetStoredRenderBufferModificationsEnabled(EFalse); |
4565 aToLayout->SetStoredRenderBufferModificationsEnabled(EFalse); |
|
4566 TInt index; |
|
4567 if (aToLayout->StoredRenderBuffer() && HasActiveEffect(aToLayout, index) && index != KErrNotFound) |
|
4568 { |
|
4569 // a screenshot has been saved into the layout, and the layout was added to cleanupstack |
|
4570 // for cleaning. SetupEffectLayoutContainerL will add the same layout |
|
4571 // to the cleanupstack, but double cleaning is not a good idea. Thus it is removed here. |
|
4572 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Removing the layout 0x%x with screenshot from iEffectCleanupStack", aToLayout); |
|
4573 iEffectCleanupStack.Remove(index); |
|
4574 } |
4346 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse, aEvent.iCanDestroyOrHideImmediately); |
4575 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle,aToLayout, EFalse, aEvent.iCanDestroyOrHideImmediately); |
4347 aEvent.iSetupDone = layoutEffectable; |
4576 aEvent.iSetupDone = layoutEffectable; |
4348 aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); |
4577 aToLayout->SetStoredRenderBufferModificationsEnabled(ETrue); |
4349 } |
4578 } |
4350 |
4579 |
4351 if (layoutEffectable) |
4580 if (layoutEffectable) |
4352 { |
4581 { |
4353 TInt effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; |
4582 TInt effectFlags = 0; |
4354 if (NeedsStoredBuffers(iHuiEnv->EffectsEngine(), *aEvent.iEffectName)) |
4583 TInt activeEffectGroup = engine->ActiveGroupEffect(); |
|
4584 if (activeEffectGroup != KErrNotFound) |
|
4585 { |
|
4586 engine->AddEffectToGroup(activeEffectGroup); |
|
4587 } |
|
4588 __ALFFXLOGSTRING1("CAlfBridge::HandleGfxEventL - Active effect group: %d", activeEffectGroup); |
|
4589 effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; |
|
4590 if (FxmlHasOpaqueHint(iHuiEnv->EffectsEngine(), *aEvent.iEffectName)) |
4355 { |
4591 { |
4356 // Performance improvement, but this would be better to be a special hint param in the fxml |
4592 // Performance improvement, but this would be better to be a special hint param in the fxml |
4357 effectFlags |= KHuiFxOpaqueHint; |
4593 effectFlags |= KHuiFxOpaqueHint; |
4358 } |
4594 } |
4359 |
4595 |
4360 if (aEvent.iRect != TRect()) |
4596 if (aEvent.iRect != TRect()) |
4361 { |
4597 { |
4362 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), &aEvent.iRect, this, aEvent.iHandle, effectFlags )); |
4598 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), activeEffectGroup, &aEvent.iRect, this, aEvent.iHandle, effectFlags )); |
4363 } |
4599 } |
4364 else |
4600 else |
4365 { |
4601 { |
4366 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, effectFlags ) ); |
4602 TRAP( err, engine->LoadGroupEffectL( *aEvent.iEffectName, effect, aToLayout->Effectable(), activeEffectGroup, NULL, this, aEvent.iHandle, effectFlags ) ); |
4367 } |
4603 } |
4368 effect = NULL; |
4604 effect = NULL; |
4369 // only use the effect if the effect file was correctly parsed |
4605 // only use the effect if the effect file was correctly parsed |
4370 if (err != KErrNone) |
4606 if (err != KErrNone) |
4371 { |
4607 { |
4417 __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent BEGIN"); |
4653 __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent BEGIN"); |
4418 if (!iFullScreenEffectData) |
4654 if (!iFullScreenEffectData) |
4419 { |
4655 { |
4420 __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END: none"); |
4656 __ALFFXLOGSTRING("CAlfBridge::HandleGfxStopEvent - END: none"); |
4421 RemoveAllTemporaryPresenterVisuals(); |
4657 RemoveAllTemporaryPresenterVisuals(); |
|
4658 delete iControlEffectData; |
|
4659 iControlEffectData = NULL; |
4422 return; |
4660 return; |
4423 } |
4661 } |
4424 |
4662 |
4425 CFullScreenEffectState* fxData = iFullScreenEffectData; |
4663 CFullScreenEffectState* fxData = iFullScreenEffectData; |
4426 iFullScreenEffectData = NULL; |
4664 iFullScreenEffectData = NULL; |
4427 CleanupStack::PushL( fxData ); |
4665 CleanupStack::PushL( fxData ); |
4428 |
4666 |
4429 __ALFFXLOGSTRING2(" - handle: %d, toAppUid: 0x%x", fxData->iHandle, fxData->iToAppId); |
4667 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxStopEvent - handle: %d, toAppUid: 0x%x", fxData->iHandle, fxData->iToAppId); |
4430 |
4668 |
4431 // clean effects with this handle |
4669 // clean effects with this handle |
4432 RemoveTemporaryPresenterVisual(NULL, fxData->iHandle); |
4670 RemoveTemporaryPresenterVisual(NULL, fxData->iHandle); |
4433 // this was abort, so we might have received earlier event hiding this window. Here we'll bring it |
4671 // this was abort, so we might have received earlier event hiding this window. Here we'll bring it |
4434 // back |
4672 // back |
4505 RMemReadStream stream( bridgeBuffer, length ); |
4746 RMemReadStream stream( bridgeBuffer, length ); |
4506 |
4747 |
4507 // operation tells if this is begin full screen or end full screen |
4748 // operation tells if this is begin full screen or end full screen |
4508 TInt operation = stream.ReadInt32L(); |
4749 TInt operation = stream.ReadInt32L(); |
4509 |
4750 |
|
4751 // If we are in low memory state, we don't want to do any effects |
|
4752 if(iHuiEnv->MemoryLevel() < EHuiMemoryLevelReduced) |
|
4753 { |
|
4754 __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - Returning because memory level below NORMAL"); |
|
4755 stream.Release(); |
|
4756 return; |
|
4757 } |
|
4758 |
4510 if ( operation == MAlfGfxEffectPlugin::EBeginFullscreen ) |
4759 if ( operation == MAlfGfxEffectPlugin::EBeginFullscreen ) |
4511 { |
4760 { |
4512 if ( !iFullScreenEffectData || !iFullScreenEffectData->iSetupDone ) |
4761 if ( !iFullScreenEffectData || !iFullScreenEffectData->iSetupDone ) |
4513 { |
4762 { |
4514 // No fullsceen effect ongoing or fullscreen effect hasn't yet been set up, |
4763 // No fullsceen effect ongoing or fullscreen effect hasn't yet been set up, |
4540 __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - WARNING - Another fullscreen effect to different app. Deleting the previous ongoing effect"); |
4789 __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - WARNING - Another fullscreen effect to different app. Deleting the previous ongoing effect"); |
4541 RemoveEffectFromApp(iFullScreenEffectData->iToSecureId, iFullScreenEffectData->iToWg);// Fullscreen effect for another app has arrived, and the previous has not finished and abort effect was not called. |
4790 RemoveEffectFromApp(iFullScreenEffectData->iToSecureId, iFullScreenEffectData->iToWg);// Fullscreen effect for another app has arrived, and the previous has not finished and abort effect was not called. |
4542 RemoveEffectFromApp(iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg); |
4791 RemoveEffectFromApp(iFullScreenEffectData->iFromSecureId, iFullScreenEffectData->iFromWg); |
4543 // Fullscreen effect for another |
4792 // Fullscreen effect for another |
4544 } |
4793 } |
4545 |
4794 |
|
4795 if (iFullScreenEffectData && iFullScreenEffectData->iToAppId != fxData->iToAppId) |
|
4796 { |
|
4797 // effected application has changed. Only single begin - end request supported at a time. |
|
4798 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - Effect request has changed from appUid 0x%x to 0x%x. Cancel previous effect.", iFullScreenEffectData->iToAppId, fxData->iToAppId); |
|
4799 RemoveEffectFromApp(iFullScreenEffectData->iToAppId); |
|
4800 } |
4546 delete iFullScreenEffectData; |
4801 delete iFullScreenEffectData; |
4547 iFullScreenEffectData = fxData; |
4802 iFullScreenEffectData = fxData; |
4548 iFullScreenEffectData->iAppStartScreenshotItemHandle = fxData->iHandle; |
4803 iFullScreenEffectData->iAppStartScreenshotItemHandle = fxData->iHandle; |
4549 |
4804 |
4550 stream.Release(); |
4805 stream.Release(); |
4593 fxData->iWaitingWindowGroup = EFalse; |
4848 fxData->iWaitingWindowGroup = EFalse; |
4594 |
4849 |
4595 __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEffectsL - Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType); |
4850 __ALFFXLOGSTRING3("CAlfBridge::HandleGfxEffectsL - Operation: %d, handle: %d, type: %d", operation, fxData->iHandle, fxData->iType); |
4596 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - towg: %d, fromwg: %d", fxData->iToWg, fxData->iFromWg); |
4851 __ALFFXLOGSTRING2("CAlfBridge::HandleGfxEffectsL - towg: %d, fromwg: %d", fxData->iToWg, fxData->iFromWg); |
4597 |
4852 |
4598 // find root nodes and attach effects to them |
4853 CHuiControlGroup* toGroup = NULL; |
4599 // First we need a windowgroup node id. So far we have a list of window ids |
4854 |
4600 |
|
4601 // wg2 is the window group that is supposed to disappear from view |
|
4602 // when a new application starts. We don't have any use for it now... |
|
4603 |
|
4604 // This is the group that is disappearing |
|
4605 // Currently we don't add an effect to it. |
|
4606 |
|
4607 // TODO: when ids available from wserv... |
|
4608 // if ( appUid2 ) |
|
4609 //{ |
|
4610 // group2 = FindControlGrouAppUId( appUid2, screen2, &alfGroup ); |
|
4611 // } |
|
4612 //if ( toAppId2 ) |
|
4613 // { |
|
4614 // group2 = FindControlGroupByAppId(toAppId2); |
|
4615 // } |
|
4616 //if ( wg2 && wg2 != KErrNotFound ) |
|
4617 // { |
|
4618 // group2 = FindControlGroupByWindowGroupId( wg2, screen2 ); |
|
4619 // } |
|
4620 // if ( group2 ) |
|
4621 // { |
|
4622 // CHuiControl& control = group2->Control(0); |
|
4623 // layout2 = (CHuiLayout*)&control.Visual(0); |
|
4624 // } |
|
4625 |
|
4626 // This effect is triggered either by BeginFullScreen or by EndFullScreen |
|
4627 // depending on if we have an application that is already running or not |
|
4628 |
|
4629 // TAlfControlGroupEntry* alfGroup = NULL; |
|
4630 |
|
4631 TBool failed = EFalse; |
4855 TBool failed = EFalse; |
4632 if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) |
4856 if (fxData->iToAppId && fxData->iToAppId != KErrNotFound) |
4633 { |
4857 { |
4634 CHuiControlGroup* toGroup = NULL; |
|
4635 CHuiLayout* toLayout = NULL; |
4858 CHuiLayout* toLayout = NULL; |
4636 toGroup = FindControlGroupByFullScreenToEffect(); |
4859 toGroup = FindControlGroupByFullScreenToEffect(); |
4637 |
4860 |
4638 CHuiControlGroup* fromGroup = NULL; |
4861 CHuiControlGroup* fromGroup = NULL; |
4639 CHuiLayout* fromLayout = NULL; |
4862 CHuiLayout* fromLayout = NULL; |
4668 if ( failed ) |
4891 if ( failed ) |
4669 { |
4892 { |
4670 // Effect failed, reset state |
4893 // Effect failed, reset state |
4671 HandleGfxStopEvent( EFalse ); // destroys iFullScreenEffectData |
4894 HandleGfxStopEvent( EFalse ); // destroys iFullScreenEffectData |
4672 } |
4895 } |
|
4896 else |
|
4897 { |
|
4898 // it might be that the application is already having drawing for the whole screen. |
|
4899 // If so, then trigger EndFullScreen immediately. |
|
4900 if (fxData && |
|
4901 toGroup |
|
4902 && fxData->iOperation == MAlfGfxEffectPlugin::EBeginFullscreen |
|
4903 && fxData->iEffectType == CFullScreenEffectState::EStartEffect) |
|
4904 { |
|
4905 GfxTriggerEffectWhenFullScreenDrawn(toGroup); |
|
4906 } |
|
4907 } |
4673 |
4908 |
4674 for (TInt i = 0; i < iAlfScreens.Count(); i++) |
4909 for (TInt i = 0; i < iAlfScreens.Count(); i++) |
4675 { |
4910 { |
4676 iAlfScreens[i]->iDisplay->SetDirty(); |
4911 iAlfScreens[i]->iDisplay->SetDirty(); |
4677 } |
4912 } |
4678 iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; |
4913 iAlfScreens[0]->iVisualTreeVisibilityChanged = ETrue; |
4679 iHuiEnv->ContinueRefresh(); |
4914 iHuiEnv->ContinueRefresh(); |
4680 |
4915 |
4681 __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END"); |
4916 __ALFFXLOGSTRING("CAlfBridge::HandleGfxEffectsL - END"); |
|
4917 } |
|
4918 |
|
4919 TBool CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn(CHuiControlGroup* aToGroup) |
|
4920 { |
|
4921 if (!aToGroup || (aToGroup && aToGroup->Count() == 0)) |
|
4922 { |
|
4923 return EFalse; |
|
4924 } |
|
4925 iTempRegion.Clear(); |
|
4926 |
|
4927 CAlfScreen* screen = iAlfScreens[0]; |
|
4928 TRect fullscreen = TRect(TPoint(0,0), screen->Size()); |
|
4929 TBool fullscreenCovered(EFalse); |
|
4930 TInt dummy = 0; |
|
4931 |
|
4932 CHuiControl& control = aToGroup->Control(0); |
|
4933 CHuiLayout* toLayout = control.VisualCount() > 0 ? (CHuiLayout*)&control.Visual(0) : NULL; |
|
4934 if (!toLayout) |
|
4935 { |
|
4936 return EFalse; |
|
4937 } |
|
4938 TBool opaque = ETrue; // in app start case the layout is propably not opaque. Fake it. |
|
4939 IsFullScreenDrawnRecursive(toLayout, *aToGroup, control, fullscreenCovered, fullscreen, screen, dummy, opaque, iAlfScreens[0]->iDisplay->Orientation()); |
|
4940 fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); |
|
4941 __ALFFXLOGSTRING1("CAlfBridge::GfxTriggerEffectWhenFullScreenDrawn - Covered: %d", fullscreenCovered); |
|
4942 if (fullscreenCovered) |
|
4943 { |
|
4944 GfxTriggerEndFullScreen(iFullScreenEffectData); |
|
4945 return ETrue; |
|
4946 } |
|
4947 return EFalse; |
4682 } |
4948 } |
4683 |
4949 |
4684 // TODO: add effect type to effect struct. remove all fullscreen effects. currently some might hang around |
4950 // TODO: add effect type to effect struct. remove all fullscreen effects. currently some might hang around |
4685 void CAlfBridge::HandleGfxStopEffectsL(TAlfBridgerData data) |
4951 void CAlfBridge::HandleGfxStopEffectsL(TAlfBridgerData data) |
4686 { |
4952 { |
4884 if (sourceVisual.Count()) |
5153 if (sourceVisual.Count()) |
4885 { |
5154 { |
4886 CHuiLayout& layout = static_cast<CHuiLayout&> (aSourceLayout->Visual(i)); |
5155 CHuiLayout& layout = static_cast<CHuiLayout&> (aSourceLayout->Visual(i)); |
4887 AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, EFalse,aIsExitEffect, aCanDestroyOrHideImmediately ); |
5156 AddToEffectLayoutContainerL(aEffectHandle, &layout, NULL, aEffectControl, aItemsDestroyed, EFalse,aIsExitEffect, aCanDestroyOrHideImmediately ); |
4888 } |
5157 } |
|
5158 TInt oldItemsDestroyed = aItemsDestroyed; |
4889 AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately); |
5159 AddEffectItemL(aEffectHandle, &sourceVisual, aTargetLayout, aEffectControl, EFalse, aItemsDestroyed, aIsExitEffect, aCanDestroyOrHideImmediately); |
|
5160 if (oldItemsDestroyed != aItemsDestroyed) |
|
5161 { |
|
5162 // Visual was destroyed. If so, then we must adjust index. |
|
5163 --i; |
|
5164 } |
4890 } |
5165 } |
4891 __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x end of children", aSourceLayout, aSourceLayout->Count()); |
5166 __ALFFXLOGSTRING2("CAlfBridge::AddToEffectLayoutContainerL 0x%x end of children", aSourceLayout, aSourceLayout->Count()); |
4892 } |
5167 } |
4893 |
5168 |
4894 TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately) |
5169 TBool CAlfBridge::SetupEffectLayoutContainerL(TInt aHandle,CHuiLayout* aSourceLayout, TBool aIsExitEffect, TBool aCanDestroyOrHideImmediately) |
4945 if (iControlEffectData) |
5220 if (iControlEffectData) |
4946 { |
5221 { |
4947 delete iControlEffectData; |
5222 delete iControlEffectData; |
4948 iControlEffectData = NULL; |
5223 iControlEffectData = NULL; |
4949 } |
5224 } |
|
5225 |
|
5226 // If we are in low memory state, we don't want to do any effects |
|
5227 if(iHuiEnv->MemoryLevel() < EHuiMemoryLevelReduced) |
|
5228 { |
|
5229 __ALFFXLOGSTRING("CAlfBridge::HandleGfxControlEffectsL - Returning because memory level below NORMAL"); |
|
5230 stream.Release(); |
|
5231 return; |
|
5232 } |
|
5233 |
4950 CControlEffectState* fxData = new (ELeave) CControlEffectState; |
5234 CControlEffectState* fxData = new (ELeave) CControlEffectState; |
4951 CleanupStack::PushL(fxData); |
5235 CleanupStack::PushL(fxData); |
4952 fxData->ConstructL(action, stream); |
5236 fxData->ConstructL(action, stream); |
4953 iControlEffectData = fxData; |
5237 iControlEffectData = fxData; |
4954 CleanupStack::Pop(fxData); |
5238 CleanupStack::Pop(fxData); |
5007 __ALFFXLOGSTRING1("HandleGfxControlEffectsL - 0x%x has active effect. Requesting removal.", aCanvasVisual); |
5291 __ALFFXLOGSTRING1("HandleGfxControlEffectsL - 0x%x has active effect. Requesting removal.", aCanvasVisual); |
5008 // another effect coming to already effected visual. E.g. close options menu, while opening effect still ongoing |
5292 // another effect coming to already effected visual. E.g. close options menu, while opening effect still ongoing |
5009 RemoveTemporaryPresenterVisual(aCanvasVisual); |
5293 RemoveTemporaryPresenterVisual(aCanvasVisual); |
5010 } |
5294 } |
5011 TBool layoutEffectable(EFalse); |
5295 TBool layoutEffectable(EFalse); |
5012 aCanvasVisual->iOpacity.Set(KAlfVisualDefaultOpacity); |
|
5013 if (aEvent.iAction == KGfxControlDisappearAction) |
5296 if (aEvent.iAction == KGfxControlDisappearAction) |
5014 { // TODO: revise |
5297 { // TODO: revise |
5015 // The control stays visible because the inactive flag is not set |
5298 // The control stays visible because the inactive flag is not set |
5016 // if the window is reserved. |
5299 // if the window is reserved. |
5017 /*if (aCanvasVisual->iOpacity.Target() == 0.0f) |
5300 /*if (aCanvasVisual->iOpacity.Target() == 0.0f) |
5028 { |
5311 { |
5029 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, EFalse); |
5312 layoutEffectable = SetupEffectLayoutContainerL(aEvent.iHandle, aCanvasVisual, EFalse, EFalse); |
5030 } |
5313 } |
5031 if (layoutEffectable) |
5314 if (layoutEffectable) |
5032 { |
5315 { |
5033 TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), engine->ActiveGroupEffect(), NULL, this, aEvent.iHandle, KHuiFxDelayRunUntilFirstFrameHasBeenDrawn ) ); |
5316 TInt effectFlags = 0; |
|
5317 |
|
5318 // effect will start delayed anyway when it is syncronized. this flag would break syncronization between effects. |
|
5319 effectFlags = KHuiFxDelayRunUntilFirstFrameHasBeenDrawn; |
|
5320 if (FxmlHasOpaqueHint(iHuiEnv->EffectsEngine(), *aEvent.iEffectName)) |
|
5321 { |
|
5322 effectFlags |= KHuiFxOpaqueHint; |
|
5323 } |
|
5324 |
|
5325 TInt activeEffectGroup = engine->ActiveGroupEffect(); |
|
5326 if (activeEffectGroup != KErrNotFound) |
|
5327 { |
|
5328 engine->AddEffectToGroup(activeEffectGroup); |
|
5329 } |
|
5330 TRAP( err, engine->LoadGroupEffectL(*aEvent.iEffectName, effect, aCanvasVisual->Effectable(), activeEffectGroup, NULL, this, aEvent.iHandle, effectFlags ) ); |
5034 } |
5331 } |
5035 else |
5332 else |
5036 { |
5333 { |
5037 err = KErrNotFound; |
5334 err = KErrNotFound; |
5038 } |
5335 } |
5346 // around will be cleared when HandleGfxStopEffectsL is called |
5643 // around will be cleared when HandleGfxStopEffectsL is called |
5347 |
5644 |
5348 // iFinishedCleanupStackEffects.Append(aHandle); |
5645 // iFinishedCleanupStackEffects.Append(aHandle); |
5349 if (!iEffectEndTimer->IsActive()) |
5646 if (!iEffectEndTimer->IsActive()) |
5350 { |
5647 { |
5351 iEffectEndTimer->AddFinishedHandleL(aHandle); |
5648 TRAP_IGNORE(iEffectEndTimer->AddFinishedHandleL(aHandle)); |
5352 iEffectEndTimer->Start(KEffectCleanupDelayInMs * 1000); |
5649 iEffectEndTimer->Start(KEffectCleanupDelayInMs * 1000); |
5353 } |
5650 } |
5354 else |
5651 else |
5355 { |
5652 { |
5356 iEffectEndTimer->AddFinishedHandleL(aHandle); |
5653 TRAP_IGNORE(iEffectEndTimer->AddFinishedHandleL(aHandle)); |
5357 } |
5654 } |
5358 |
5655 |
5359 // We should do visual visibility scan after effect is ended |
5656 // We should do visual visibility scan after effect is ended |
5360 iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); |
5657 iAlfScreens[0]->SetVisualTreeVisibilityChanged(ETrue); |
5361 } |
5658 } |
5638 // always returns a valid pointer, or NULL. The parameter aRootVisual can |
5935 // always returns a valid pointer, or NULL. The parameter aRootVisual can |
5639 // be NULL, which means that the external content is removed from the canvas |
5936 // be NULL, which means that the external content is removed from the canvas |
5640 // visual |
5937 // visual |
5641 // --------------------------------------------------------------------------- |
5938 // --------------------------------------------------------------------------- |
5642 // |
5939 // |
5643 void CAlfBridge::SetClientWindowForDrawingL(TInt aWindowGroupId, TInt aClientWindowHandle, |
5940 void CAlfBridge::SetClientWindowForDrawingL(TInt /*aWindowGroupId*/, TInt /*aClientWindowHandle*/, |
5644 CHuiVisual* aExternalContentVisual) |
5941 CHuiVisual* /*aExternalContentVisual*/) |
5645 { |
5942 { |
5646 RArray<TAlfWServInfo> winInfoList; |
5943 /* RArray<TAlfWServInfo> winInfoList; |
5647 CleanupClosePushL(winInfoList); |
5944 CleanupClosePushL(winInfoList); |
5648 |
5945 |
5649 // Find canvas visual for the RWindow |
5946 // Find canvas visual for the RWindow |
5650 |
5947 |
5651 (*iHost)->StreamerServer()->WindowMgr()->GetWinInfoListL(aWindowGroupId, aClientWindowHandle, winInfoList ); |
5948 (*iHost)->StreamerServer()->WindowMgr()->GetWinInfoListL(aWindowGroupId, aClientWindowHandle, winInfoList ); |
5726 CHuiTexture* texture = CHuiTexture::NewL(); |
6023 CHuiTexture* texture = CHuiTexture::NewL(); |
5727 CleanupStack::PushL(texture); |
6024 CleanupStack::PushL(texture); |
5728 iAlfScreens[i]->iDisplay->SetForegroundBitmapL( iAlfScreens[i]->iSwRenderingTarget ); |
6025 iAlfScreens[i]->iDisplay->SetForegroundBitmapL( iAlfScreens[i]->iSwRenderingTarget ); |
5729 CleanupStack::Pop(texture); |
6026 CleanupStack::Pop(texture); |
5730 iAlfScreens[i]->iDisplay->SetForegroundTexture(texture); |
6027 iAlfScreens[i]->iDisplay->SetForegroundTexture(texture); |
|
6028 #ifdef ALF_DRAW_FRAME_BEFORE_END_CALLBACK |
|
6029 iHuiEnv->SetRefreshMode(EHuiRefreshModeManual); |
|
6030 #endif // #ifdef ALF_DRAW_FRAME_BEFORE_END_CALLBACK |
5731 } |
6031 } |
5732 else |
6032 else |
5733 { |
6033 { |
5734 iAlfScreens[i]->iDisplay->SetForegroundBitmapL(NULL); |
6034 iAlfScreens[i]->iDisplay->SetForegroundBitmapL(NULL); |
5735 iAlfScreens[i]->iDisplay->SetForegroundTexture(NULL); |
6035 iAlfScreens[i]->iDisplay->SetForegroundTexture(NULL); |
|
6036 #ifdef ALF_DRAW_FRAME_BEFORE_END_CALLBACK |
|
6037 iHuiEnv->SetRefreshMode(EHuiRefreshModeAutomatic); |
|
6038 #endif // #ifdef ALF_DRAW_FRAME_BEFORE_END_CALLBACK |
5736 } |
6039 } |
5737 |
6040 |
5738 // SetCapturingBufferL is called from HandleVisualVisibility. |
6041 // SetCapturingBufferL is called from HandleVisualVisibility. |
5739 iAlfScreens[i]->SetVisualTreeVisibilityChanged(ETrue); |
6042 iAlfScreens[i]->SetVisualTreeVisibilityChanged(ETrue); |
5740 } |
6043 } |
5783 } |
6091 } |
5784 |
6092 |
5785 // --------------------------------------------------------------------------- |
6093 // --------------------------------------------------------------------------- |
5786 // --------------------------------------------------------------------------- |
6094 // --------------------------------------------------------------------------- |
5787 // |
6095 // |
|
6096 void CAlfBridge::InitializeSwRenderingTarget(CFbsBitmap* aBitmap) |
|
6097 { |
|
6098 __ALFLOGSTRING("CAlfBridge::InitializeSwRenderingTarget"); |
|
6099 TAlfBridgeDrawerWrapper wrapper(*this); |
|
6100 AlfDrawerInternal::CopyScreenToBitmap(&wrapper, aBitmap, |
|
6101 TRect(aBitmap->SizeInPixels())); |
|
6102 __ALFLOGSTRING("CAlfBridge::InitializeSwRenderingTarget ok"); |
|
6103 } |
|
6104 |
|
6105 // --------------------------------------------------------------------------- |
|
6106 // --------------------------------------------------------------------------- |
|
6107 // |
5788 void CAlfBridge::SetMemoryLevel(THuiMemoryLevel aMemoryLevel) |
6108 void CAlfBridge::SetMemoryLevel(THuiMemoryLevel aMemoryLevel) |
5789 { |
6109 { |
5790 iCurrentMemoryLevel = aMemoryLevel; |
6110 iCurrentMemoryLevel = aMemoryLevel; |
5791 DoUpdateMemoryLevel(); |
6111 DoUpdateMemoryLevel(); |
5792 } |
6112 } |
5816 // --------------------------------------------------------------------------- |
6136 // --------------------------------------------------------------------------- |
5817 // |
6137 // |
5818 void CAlfBridge::DoUpdateMemoryLevel() |
6138 void CAlfBridge::DoUpdateMemoryLevel() |
5819 { |
6139 { |
5820 THuiMemoryLevel memoryLevel = iCurrentMemoryLevel; |
6140 THuiMemoryLevel memoryLevel = iCurrentMemoryLevel; |
5821 if ( iLowMemoryMode && ( memoryLevel > EHuiMemoryLevelLow ) ) |
6141 if ( iLowMemoryMode && ( memoryLevel > EHuiMemoryLevelReduced ) ) |
5822 { |
6142 { |
5823 memoryLevel = EHuiMemoryLevelLow; |
6143 memoryLevel = EHuiMemoryLevelReduced; |
5824 } |
6144 } |
5825 if ( iForcedSwRendering && ( memoryLevel > EHuiMemoryLevelLowest ) ) |
6145 if ( iForcedSwRendering && ( memoryLevel > EHuiMemoryLevelLowest ) ) |
5826 { |
6146 { |
5827 // For now, we use memory level to force SW rendering |
6147 // For now, we use memory level to force SW rendering |
5828 // to be used. |
6148 // to be used. |
5829 memoryLevel = EHuiMemoryLevelLowest; |
6149 memoryLevel = EHuiMemoryLevelLowest; |
5830 } |
6150 } |
5831 |
6151 |
5832 if ( memoryLevel != iHuiEnv->MemoryLevel() ) |
6152 if ( memoryLevel != iHuiEnv->MemoryLevel() ) |
5833 { |
6153 { |
|
6154 |
5834 __ALFLOGSTRING1("CAlfBridge::DoUpdateMemoryLevel -> %d", memoryLevel); |
6155 __ALFLOGSTRING1("CAlfBridge::DoUpdateMemoryLevel -> %d", memoryLevel); |
5835 TBool nowGoodMemory = !(memoryLevel < EHuiMemoryLevelNormal); |
6156 TBool nowGoodMemory = !(memoryLevel < EHuiMemoryLevelReduced); |
5836 TBool wasGoodMemory = !(iHuiEnv->MemoryLevel() < EHuiMemoryLevelNormal); |
6157 TBool wasGoodMemory = !(iHuiEnv->MemoryLevel() < EHuiMemoryLevelReduced); |
5837 |
6158 |
5838 if (iActivated) |
6159 if (iActivated) |
5839 { |
6160 { |
5840 if (nowGoodMemory && !wasGoodMemory) |
6161 if (nowGoodMemory && !wasGoodMemory) |
5841 { |
6162 { |
5964 } |
6285 } |
5965 } |
6286 } |
5966 if ( lBreak ) |
6287 if ( lBreak ) |
5967 break; |
6288 break; |
5968 } |
6289 } |
5969 |
6290 TBool alreadyExists = EFalse; |
|
6291 for( TInt i = 0 ; i < iAlfNativeClientsWgIds.Count() ; i++ ) |
|
6292 { |
|
6293 if(iAlfNativeClientsWgIds[i] == aId) |
|
6294 { |
|
6295 alreadyExists = ETrue; |
|
6296 } |
|
6297 } |
|
6298 if(!alreadyExists) |
|
6299 { |
|
6300 iAlfNativeClientsWgIds.Append(aId); |
|
6301 } |
|
6302 } |
|
6303 |
|
6304 void CAlfBridge::RemoveWindowGroupAsAlfApp( TInt aId ) |
|
6305 { |
|
6306 for ( TInt j = 0; j < iAlfScreens.Count(); j++ ) |
|
6307 { |
|
6308 for ( TInt i = 0; i < iAlfScreens[j]->iControlGroups.Count(); i++ ) |
|
6309 { |
|
6310 if ( iAlfScreens[j]->iControlGroups[i].iClientWindowGroupId == aId ) |
|
6311 { |
|
6312 iAlfScreens[j]->iControlGroups[i].iControlGroup->iAlfApp = EFalse; |
|
6313 } |
|
6314 } |
|
6315 } |
|
6316 for( TInt i = 0 ; i < iAlfNativeClientsWgIds.Count() ; i++ ) |
|
6317 { |
|
6318 if(iAlfNativeClientsWgIds[i] == aId) |
|
6319 { |
|
6320 iAlfNativeClientsWgIds.Remove(i); |
|
6321 } |
|
6322 } |
5970 } |
6323 } |
5971 |
6324 |
5972 // --------------------------------------------------------------------------- |
6325 // --------------------------------------------------------------------------- |
5973 // --------------------------------------------------------------------------- |
6326 // --------------------------------------------------------------------------- |
5974 // |
6327 // |
5988 CAlfScreen* screen = iAlfScreens[0]; |
6341 CAlfScreen* screen = iAlfScreens[0]; |
5989 TRect fullscreen = TRect(TPoint(0,0), screen->Size()); |
6342 TRect fullscreen = TRect(TPoint(0,0), screen->Size()); |
5990 __ALFFXLOGSTRING3("CAlfBridge::IsFullScreenDrawn - new orientation %d, screen size: (%d,%d)", aOrientation, fullscreen.iBr.iX, fullscreen.iBr.iY ); |
6343 __ALFFXLOGSTRING3("CAlfBridge::IsFullScreenDrawn - new orientation %d, screen size: (%d,%d)", aOrientation, fullscreen.iBr.iX, fullscreen.iBr.iY ); |
5991 TBool fullscreenCovered = EFalse; |
6344 TBool fullscreenCovered = EFalse; |
5992 CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; |
6345 CAlfAppSrvSessionBase* topMostAlfSrvSession = NULL; |
5993 |
6346 |
5994 //iActiveVisualCount = 0; |
|
5995 iBgSurfaceFound = EFalse; |
|
5996 //iPaintedArea = 0; |
|
5997 |
|
5998 // Check if effect group has an effect with opaque hint. |
6347 // Check if effect group has an effect with opaque hint. |
5999 CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[0]->iFullscreenEffectControlGroup); |
6348 CHuiControlGroup& fxcontrolgroup = *(iAlfScreens[0]->iFullscreenEffectControlGroup); |
6000 CHuiControl& fxcontrol = fxcontrolgroup.Control(0); |
6349 CHuiControl& fxcontrol = fxcontrolgroup.Control(0); |
6001 CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); |
6350 CHuiCanvasVisual* fxlayout = (CHuiCanvasVisual*)&fxcontrol.Visual(0); |
6002 CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); |
6351 CHuiVisual* fxExternalContent = fxlayout->ExternalContent(); |
6009 { |
6358 { |
6010 fullscreenCovered = ETrue; |
6359 fullscreenCovered = ETrue; |
6011 } |
6360 } |
6012 |
6361 |
6013 TBool alfWindowGroupFoundVisible = EFalse; |
6362 TBool alfWindowGroupFoundVisible = EFalse; |
|
6363 |
|
6364 AMT_SET_VALUE( iVisibleVisualCount, 0 ); |
6014 |
6365 |
6015 // skip the topmost (effect) layer, start from floating sprite group |
6366 // skip the topmost (effect) layer, start from floating sprite group |
6016 for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) |
6367 for (TInt j=screen->iDisplay->Roster().Count() - screen->FixedControlGroupCount(); j>=0; j--) |
6017 { |
6368 { |
6018 CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j); |
6369 CHuiControlGroup& controlgroup = iAlfScreens[0]->iDisplay->Roster().ControlGroup(j); |
6019 CHuiControl& control = controlgroup.Control(0); |
6370 CHuiControl& control = controlgroup.Control(0); |
6020 |
6371 __ALFFXLOGSTRING1("CAlfBridge::IsFullScreenDrawn : Group owner 0x%x", controlgroup.SecureId()); |
6021 for (TInt ii=0; ii<iAlfScreens[0]->iControlGroups.Count();ii++) |
6372 |
6022 { |
|
6023 if( iAlfScreens[0]->iControlGroups[ii].iControlGroup == &controlgroup ) |
|
6024 { |
|
6025 __ALFFXLOGSTRING1("CAlfBridge::IsFullScreenDrawn : Group owner 0x%x", iAlfScreens[0]->iControlGroups[ii].iSecureId); |
|
6026 break; |
|
6027 } |
|
6028 } |
|
6029 |
6373 |
6030 if (control.Role() == EAlfFpsIndicatorContainer) |
6374 if (control.Role() == EAlfFpsIndicatorContainer) |
6031 { |
6375 { |
6032 // FPS container doesn't contain canvas visuals |
6376 // FPS container doesn't contain canvas visuals |
6033 continue; |
6377 continue; |
6041 fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); |
6385 fullscreenCovered = IsRectCoveredByRegion(fullscreen, iTempRegion); |
6042 |
6386 |
6043 for(TInt ii=0;ii< iTempRegion.Count(); ii++) |
6387 for(TInt ii=0;ii< iTempRegion.Count(); ii++) |
6044 { |
6388 { |
6045 __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawn (%d,%d)-(%d,%d)", iTempRegion[ii].iTl.iX, iTempRegion[ii].iTl.iY , iTempRegion[ii].iBr.iX, iTempRegion[ii].iBr.iY ); |
6389 __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawn (%d,%d)-(%d,%d)", iTempRegion[ii].iTl.iX, iTempRegion[ii].iTl.iY , iTempRegion[ii].iBr.iX, iTempRegion[ii].iBr.iY ); |
6046 return ETrue; |
|
6047 } |
6390 } |
6048 } |
6391 } |
6049 |
6392 |
6050 // Dont mess with alf control group visuals, alf session handling does it for us |
6393 // Dont mess with alf control group visuals, alf session handling does it for us |
6051 if (control.Role() == EAlfSessionContainer) |
6394 if (control.Role() == EAlfSessionContainer) |
6203 iTempRegion.Tidy(); |
6546 iTempRegion.Tidy(); |
6204 __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawnRecursive - Added covered area (%d,%d)-(%d,%d)", visualDisplayRect.iTl.iX, visualDisplayRect.iTl.iY , visualDisplayRect.iBr.iX, visualDisplayRect.iBr.iY ); |
6547 __ALFFXLOGSTRING4("CAlfBridge::IsFullScreenDrawnRecursive - Added covered area (%d,%d)-(%d,%d)", visualDisplayRect.iTl.iX, visualDisplayRect.iTl.iY , visualDisplayRect.iBr.iX, visualDisplayRect.iBr.iY ); |
6205 } |
6548 } |
6206 } |
6549 } |
6207 visualTreeActive |= visualIsActive; |
6550 visualTreeActive |= visualIsActive; |
|
6551 |
|
6552 // iVisibleVisualCount is cleared in HandleVisualVisibility() |
|
6553 AMT_INC_COUNTER_IF( visualIsActive && !visualRectIsCovered , iVisibleVisualCount ); |
6208 } // for loop end : children checking loop |
6554 } // for loop end : children checking loop |
6209 return visualTreeActive; |
6555 return visualTreeActive; |
6210 } |
6556 } |
6211 |
6557 |
6212 |
6558 |
6266 { |
6614 { |
6267 iBridgerClient.SendBlind(KAlfCompositionLayoutSwitchComplete, TIpcArgs()); |
6615 iBridgerClient.SendBlind(KAlfCompositionLayoutSwitchComplete, TIpcArgs()); |
6268 } |
6616 } |
6269 */ |
6617 */ |
6270 // request syncronized frame |
6618 // request syncronized frame |
|
6619 iLayoutSwitchInProgress = EFalse; |
6271 if ( iHuiEnv ) |
6620 if ( iHuiEnv ) |
6272 { |
6621 { |
6273 iIdForLayoutSwitchFrameSync = iIdForEAlfDSSynchronizeOp - KPreventingCollisionOfIdsInSynchDrawRequests; |
6622 iIdForLayoutSwitchFrameSync = iIdForEAlfDSSynchronizeOp - KPreventingCollisionOfIdsInSynchDrawRequests; |
6274 iHuiEnv->Synchronize( iIdForLayoutSwitchFrameSync, this ); |
6623 iHuiEnv->Synchronize( iIdForLayoutSwitchFrameSync, this ); |
6275 } |
6624 } |
6276 } |
6625 } |
6277 |
6626 |
|
6627 TAlfBridgeDrawerWrapper::TAlfBridgeDrawerWrapper(CAlfBridge& aBridge) |
|
6628 : iBridge( aBridge ) |
|
6629 { |
|
6630 } |
|
6631 |
|
6632 TInt TAlfBridgeDrawerWrapper::GetSizeAndRotation(TSize& aSize, TInt& aRotation) |
|
6633 { |
|
6634 return iBridge.GetSizeAndRotation(aSize, aRotation); |
|
6635 } |
|
6636 |
|
6637 TInt TAlfBridgeDrawerWrapper::ReadPixels(CFbsBitmap* aBitmap) |
|
6638 { |
|
6639 return iBridge.ReadPixels(aBitmap); |
|
6640 } |
|
6641 |
|
6642 RAlfBridgerClient* CAlfBridge::BridgerClient() |
|
6643 { |
|
6644 if (iActivated) |
|
6645 { |
|
6646 return &iBridgerClient; |
|
6647 } |
|
6648 return 0; |
|
6649 } |
|
6650 |
6278 |
6651 |
6279 // end of file |
6652 // end of file |