31 #include "alflogger.h" |
31 #include "alflogger.h" |
32 #undef _ALF_LOGGING |
32 #undef _ALF_LOGGING |
33 #else |
33 #else |
34 #include "alflogger.h" |
34 #include "alflogger.h" |
35 #endif |
35 #endif |
|
36 |
|
37 #ifdef ALF_MEMORYLOGGING |
|
38 #include <hal.h> |
|
39 #endif |
|
40 |
36 // --------------------------------------------------------------------------- |
41 // --------------------------------------------------------------------------- |
37 // Constructor |
42 // Constructor |
38 // --------------------------------------------------------------------------- |
43 // --------------------------------------------------------------------------- |
39 // |
44 // |
40 CAlfNode::CAlfNode( ) : |
45 CAlfNode::CAlfNode( ) : |
41 iVisible( ETrue ) |
46 iVisible( ETrue ) |
42 { |
47 { |
43 } |
48 } |
44 |
49 |
|
50 |
|
51 void CAlfNode::ReportOOM() |
|
52 { |
|
53 #ifdef ALF_MEMORYLOGGING |
|
54 RDebug::Printf("CAlfNode::ReportOOM"); |
|
55 |
|
56 TInt totalSpaceAllocated = 0; |
|
57 TInt cellsAllocatedInHeap = User::AllocSize(totalSpaceAllocated); |
|
58 TInt largestFreeBlock = 0; |
|
59 TInt totalFreeSpaceInHeap = User::Available(largestFreeBlock); |
|
60 TInt freeRAM = 0; |
|
61 if ( HAL::Get( HALData::EMemoryRAMFree, freeRAM ) != KErrNone ) |
|
62 { |
|
63 freeRAM = -1; |
|
64 } |
|
65 |
|
66 RDebug::Printf("CAlfNode::ReportOOM - Allocated space: %d, Amount of allocated cells: %d, Largest free block: %d, Free space in heap: %d", |
|
67 totalSpaceAllocated, |
|
68 cellsAllocatedInHeap, |
|
69 largestFreeBlock, |
|
70 totalFreeSpaceInHeap); |
|
71 RDebug::Printf("CAlfNode::ReportOOM - Free RAM in system: %d", freeRAM); |
|
72 #endif |
|
73 } |
45 // --------------------------------------------------------------------------- |
74 // --------------------------------------------------------------------------- |
46 // ConstructL |
75 // ConstructL |
47 // --------------------------------------------------------------------------- |
76 // --------------------------------------------------------------------------- |
48 // |
77 // |
49 void CAlfNode::ConstructL( CAlfHierarchyModel* aModel, RMemReadStream* aStream ) |
78 void CAlfNode::ConstructL( CAlfHierarchyModel* aModel, RMemReadStream* aStream ) |
363 // CAlfNode::TraverseNodeTree |
392 // CAlfNode::TraverseNodeTree |
364 // Traverse through node tree and fill node array |
393 // Traverse through node tree and fill node array |
365 // --------------------------------------------------------------------------- |
394 // --------------------------------------------------------------------------- |
366 // |
395 // |
367 |
396 |
368 // --------------------------------------------------------------------------- |
|
369 // CAlfNode::TraverseNodeTree |
|
370 // Traverse through node tree and fill node array |
|
371 // --------------------------------------------------------------------------- |
|
372 // |
|
373 |
|
374 void CAlfNode::TraverseNodeTree( CAlfNode* node, RPointerArray<CAlfNode>& nodes, TBool aTraverseOnlySiblings, TBool aAddMe) |
397 void CAlfNode::TraverseNodeTree( CAlfNode* node, RPointerArray<CAlfNode>& nodes, TBool aTraverseOnlySiblings, TBool aAddMe) |
375 { |
398 { |
376 // Exit if we've already finished walking the tree. |
399 // Exit if we've already finished walking the tree. |
377 if ( node == NULL) |
400 if ( node == NULL) |
378 { |
401 { |
379 __ALFLOGSTRING(" returning NULL"); |
402 __ALFLOGSTRING("TraverseNodeTree returning - NULL"); |
380 return; |
403 return; |
381 } |
404 } |
382 if (!aTraverseOnlySiblings) |
405 |
383 { |
406 while ( node ) |
384 if ( node->iSpriteChild ) |
407 { |
385 { |
408 if (!aTraverseOnlySiblings) |
386 CAlfNode* spritenode = node->iSpriteChild ; |
409 { |
387 while ( spritenode ) |
410 if ( node->iSpriteChild ) |
388 { |
411 { |
389 nodes.Append( spritenode ); |
412 CAlfNode* spritenode = node->iSpriteChild ; |
390 spritenode = spritenode->iSibling; |
413 while ( spritenode ) |
391 } |
414 { |
392 } |
415 nodes.Append( spritenode ); |
393 |
416 spritenode = spritenode->iSibling; |
394 if( node->iTextCursor ) |
417 } |
395 { |
418 } |
396 nodes.Append(node->iTextCursor ); |
419 |
397 } |
420 if( node->iTextCursor ) |
398 |
421 { |
399 if( node->iAnimChild ) |
422 nodes.Append(node->iTextCursor ); |
400 { |
423 } |
401 CAlfNode* animnode = node->iAnimChild ; |
424 |
402 while ( animnode ) |
425 if( node->iAnimChild ) |
403 { |
426 { |
404 nodes.Append( animnode ); |
427 CAlfNode* animnode = node->iAnimChild ; |
405 animnode = animnode->iSibling; |
428 while ( animnode ) |
406 } |
429 { |
407 } |
430 nodes.Append( animnode ); |
|
431 animnode = animnode->iSibling; |
|
432 } |
|
433 } |
408 |
434 |
409 if ( node->iChild) |
435 if ( node->iChild) |
410 { |
436 { |
411 TraverseNodeTree(node->iChild , nodes, EFalse, ETrue); |
437 TraverseNodeTree(node->iChild , nodes, EFalse, ETrue); |
412 } |
438 } |
413 } |
439 } |
414 |
440 |
415 if (aAddMe) |
441 if (aAddMe) |
416 { |
442 { |
417 nodes.Append( node ); |
443 nodes.Append( node ); |
418 } |
444 } |
419 |
445 |
420 if ( node->iSibling ) |
446 // Without recursion, continue with the following: |
421 { |
447 // TraverseNodeTree(node->iSibling, nodes, ETrue, ETrue); |
422 TraverseNodeTree(node->iSibling, nodes, ETrue, ETrue); |
448 node = node->iSibling; |
|
449 aTraverseOnlySiblings = ETrue; |
|
450 aAddMe = ETrue; |
423 } |
451 } |
424 } |
452 } |
425 |
453 |
426 // --------------------------------------------------------------------------- |
454 // --------------------------------------------------------------------------- |
427 // OrdinalPosition |
455 // OrdinalPosition |
988 // |
1016 // |
989 TAny* CAlfNode::CreateWindowAttributes(TInt& aIndex, TInt aSize ) |
1017 TAny* CAlfNode::CreateWindowAttributes(TInt& aIndex, TInt aSize ) |
990 { |
1018 { |
991 TAny* attributes = NULL; |
1019 TAny* attributes = NULL; |
992 TRAP_IGNORE(attributes = (TAny*)iModel->Server().Bridge()->AppendVarDataL( aSize, aIndex )) |
1020 TRAP_IGNORE(attributes = (TAny*)iModel->Server().Bridge()->AppendVarDataL( aSize, aIndex )) |
993 Mem::FillZ( (TUint8*)attributes, aSize ); // Initialize the returned memory area to 0 |
1021 if (attributes) |
|
1022 { |
|
1023 Mem::FillZ( (TUint8*)attributes, aSize ); // Initialize the returned memory area to 0 |
|
1024 } |
|
1025 else |
|
1026 { |
|
1027 CAlfNode::ReportOOM(); |
|
1028 } |
994 return attributes; |
1029 return attributes; |
995 } |
1030 } |
996 |
1031 |
997 // --------------------------------------------------------------------------- |
1032 // --------------------------------------------------------------------------- |
998 // SiblingOrderChanged |
1033 // SiblingOrderChanged |
1305 { |
1340 { |
1306 //!!!! There is no window??? |
1341 //!!!! There is no window??? |
1307 // position must be updated, because it not necessary the first drawn. |
1342 // position must be updated, because it not necessary the first drawn. |
1308 TInt offset; |
1343 TInt offset; |
1309 TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)CreateWindowAttributes(offset, sizeof(TAlfWindowAttributes)); |
1344 TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)CreateWindowAttributes(offset, sizeof(TAlfWindowAttributes)); |
1310 windowAttributes->iOrdinalPosition = ordinal; |
1345 if (windowAttributes) |
1311 windowAttributes->iWindowNodeType = iType; |
1346 { |
1312 windowAttributes->iScreenNumber = iScreenNumber; |
1347 windowAttributes->iOrdinalPosition = ordinal; |
1313 // for updating window group ordinals |
1348 windowAttributes->iWindowNodeType = iType; |
1314 iModel->Server().Bridge()->AddData( EAlfDSReorder, |
1349 windowAttributes->iScreenNumber = iScreenNumber; |
1315 iGroupId, |
1350 // for updating window group ordinals |
1316 iId, |
1351 iModel->Server().Bridge()->AddData( EAlfDSReorder, |
1317 (TAny*)offset ); |
1352 iGroupId, |
|
1353 iId, |
|
1354 (TAny*)offset ); |
|
1355 } |
|
1356 else |
|
1357 { |
|
1358 CAlfNode::ReportOOM(); |
|
1359 } |
1318 } |
1360 } |
1319 } |
1361 } |
1320 AMT_MAP_NODE_SET_ORDINAL_POSITION(); |
1362 AMT_MAP_NODE_SET_ORDINAL_POSITION(); |
1321 } |
1363 } |
1322 |
1364 |
1382 iType != MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && |
1424 iType != MWsWindowTreeNode::EWinTreeNodeStandardTextCursor && |
1383 !iAlphaChannelTransparencyEnabled) |
1425 !iAlphaChannelTransparencyEnabled) |
1384 { |
1426 { |
1385 nodeFlags |= EAlfWinNodeFlagOpaque; |
1427 nodeFlags |= EAlfWinNodeFlagOpaque; |
1386 } |
1428 } |
1387 |
1429 |
1388 if ( iType == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor ) |
1430 // New drawing commands always replace all the previous drawing commands for text cursor and anim nodes. |
|
1431 if ( iType == MWsWindowTreeNode::EWinTreeNodeStandardTextCursor |
|
1432 || iType == MWsWindowTreeNode:: EWinTreeNodeAnim ) |
1389 { |
1433 { |
1390 emptyBuffer = ETrue; |
1434 emptyBuffer = ETrue; |
1391 } |
1435 } |
1392 |
1436 |
1393 iWindow->PostPartialBuffer( iModel->ChunkBase(aChunkInUse) + aCurrentPos, aFrameSize, aPartial, aLastPart , emptyBuffer, nodeFlags ); |
1437 iWindow->PostPartialBuffer( iModel->ChunkBase(aChunkInUse) + aCurrentPos, aFrameSize, aPartial, aLastPart , emptyBuffer, nodeFlags ); |
1900 |
1951 |
1901 ResolveParent( parentId, iId ); |
1952 ResolveParent( parentId, iId ); |
1902 |
1953 |
1903 TInt offset; |
1954 TInt offset; |
1904 TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)CreateWindowAttributes(offset, sizeof(TAlfWindowAttributes)); |
1955 TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)CreateWindowAttributes(offset, sizeof(TAlfWindowAttributes)); |
1905 windowAttributes->iWindowNodeType = iType; |
1956 if (windowAttributes) |
1906 windowAttributes->iClientHandle = clientHandle; |
1957 { |
1907 windowAttributes->iScreenNumber = iScreenNumber; |
1958 windowAttributes->iWindowNodeType = iType; |
1908 windowAttributes->iSecureId = iSecureId; |
1959 windowAttributes->iClientHandle = clientHandle; |
1909 windowAttributes->iParentNodeId = parentId; |
1960 windowAttributes->iScreenNumber = iScreenNumber; |
1910 |
1961 windowAttributes->iSecureId = iSecureId; |
1911 iModel->Server().Bridge()->AddData( EAlfDSNewWindow, |
1962 windowAttributes->iParentNodeId = parentId; |
1912 iGroupId, |
1963 |
1913 iId, |
1964 iModel->Server().Bridge()->AddData( EAlfDSNewWindow, |
1914 (TAny*)offset ); |
1965 iGroupId, |
1915 |
1966 iId, |
|
1967 (TAny*)offset ); |
|
1968 } |
|
1969 else |
|
1970 { |
|
1971 CAlfNode::ReportOOM(); |
|
1972 } |
|
1973 |
1916 AMT_MAP_STREAMER_NODE_GROUP_CONSTRUCT(); |
1974 AMT_MAP_STREAMER_NODE_GROUP_CONSTRUCT(); |
1917 } |
1975 } |
1918 |
1976 |
1919 // --------------------------------------------------------------------------- |
1977 // --------------------------------------------------------------------------- |
1920 // NewL |
1978 // NewL |
1960 // GroupChainBrokenAfter |
2018 // GroupChainBrokenAfter |
1961 // --------------------------------------------------------------------------- |
2019 // --------------------------------------------------------------------------- |
1962 // |
2020 // |
1963 void CAlfNodeGroup::GroupChainBrokenAfter( ) |
2021 void CAlfNodeGroup::GroupChainBrokenAfter( ) |
1964 { |
2022 { |
|
2023 TUint32 oldChainedTo = 0; |
1965 if ( iChainedTo ) |
2024 if ( iChainedTo ) |
1966 { |
2025 { |
1967 iChainedTo->iChainedFrom = NULL; |
2026 iChainedTo->iChainedFrom = NULL; |
|
2027 oldChainedTo = iChainedTo->iId; |
1968 iChainedTo = NULL; |
2028 iChainedTo = NULL; |
1969 } |
2029 } |
1970 if (iModel) |
2030 if (iModel) |
1971 { |
2031 { |
1972 iModel->Server().Bridge()->AddData( EAlfDSGroupChainBroken, |
2032 iModel->Server().Bridge()->AddData( EAlfDSGroupChainBroken, |
|
2033 oldChainedTo, |
1973 iId, |
2034 iId, |
1974 0, |
|
1975 (TAny*)iScreenNumber ); |
2035 (TAny*)iScreenNumber ); |
1976 } |
2036 } |
1977 |
2037 |
1978 } |
2038 } |
1979 |
2039 |
1988 { |
2048 { |
1989 GroupChainBrokenAfter(); |
2049 GroupChainBrokenAfter(); |
1990 } |
2050 } |
1991 if ( iChainedFrom ) |
2051 if ( iChainedFrom ) |
1992 { |
2052 { |
1993 iChainedFrom->iChainedTo = NULL; |
2053 if (iModel) |
|
2054 { |
|
2055 iModel->Server().Bridge()->AddData( EAlfDSGroupChainBroken, |
|
2056 iChainedFrom->iId, |
|
2057 iId, |
|
2058 (TAny*)iScreenNumber ); |
|
2059 } |
1994 } |
2060 } |
1995 |
2061 |
1996 if (iModel) |
2062 if (iModel) |
1997 { |
2063 { |
1998 TInt offset; |
2064 TInt offset; |
1999 TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)CreateWindowAttributes(offset, sizeof(TAlfWindowAttributes)); |
2065 TAlfWindowAttributes* windowAttributes = (TAlfWindowAttributes*)CreateWindowAttributes(offset, sizeof(TAlfWindowAttributes)); |
2000 windowAttributes->iWindowNodeType = iType; |
2066 if (windowAttributes) |
2001 windowAttributes->iScreenNumber = iScreenNumber; |
2067 { |
2002 |
2068 windowAttributes->iWindowNodeType = iType; |
2003 iModel->Server().Bridge()->AddData( EAlfDSDestroyWindow, |
2069 windowAttributes->iScreenNumber = iScreenNumber; |
2004 iGroupId, |
2070 |
2005 iId, |
2071 iModel->Server().Bridge()->AddData( EAlfDSDestroyWindow, |
2006 (TAny*)offset ); |
2072 iGroupId, |
|
2073 iId, |
|
2074 (TAny*)offset ); |
|
2075 } |
|
2076 else |
|
2077 { |
|
2078 CAlfNode::ReportOOM(); |
|
2079 } |
2007 iWindow = 0; // just in case |
2080 iWindow = 0; // just in case |
2008 } |
2081 } |
2009 RemoveDependencies( iParent->iChild ); |
2082 RemoveDependencies( iParent->iChild ); |
2010 }; |
2083 }; |
2011 |
2084 |
2134 |
2207 |
2135 CreateWindowL(0,0,iParent->iId); // Currently renderstage does not deliver ws/wg handles |
2208 CreateWindowL(0,0,iParent->iId); // Currently renderstage does not deliver ws/wg handles |
2136 TInt offset; |
2209 TInt offset; |
2137 // pass rest of the cursor data |
2210 // pass rest of the cursor data |
2138 TAlfCursorDataBufferAttributes* attributes = (TAlfCursorDataBufferAttributes*)CreateWindowAttributes(offset, sizeof(TAlfCursorDataBufferAttributes)); |
2211 TAlfCursorDataBufferAttributes* attributes = (TAlfCursorDataBufferAttributes*)CreateWindowAttributes(offset, sizeof(TAlfCursorDataBufferAttributes)); |
2139 attributes->iColor = iColor; |
2212 if (attributes) |
2140 attributes->iFlags = iFlags; |
2213 { |
2141 attributes->iFlashInterval = iFlashInterval; |
2214 attributes->iColor = iColor; |
2142 attributes->iScreenNumber = iScreenNumber; |
2215 attributes->iFlags = iFlags; |
2143 |
2216 attributes->iFlashInterval = iFlashInterval; |
2144 aModel->Server().Bridge()->AddData( EAlfDSSetCursorData, |
2217 attributes->iScreenNumber = iScreenNumber; |
2145 iGroupId, |
2218 |
2146 iId, |
2219 aModel->Server().Bridge()->AddData( EAlfDSSetCursorData, |
2147 (TAny*)offset ); |
2220 iGroupId, |
2148 |
2221 iId, |
2149 UpdateOrdinalPosition(); |
2222 (TAny*)offset ); |
2150 |
2223 |
2151 AMT_MAP_STREAMER_TEXT_CURSOR_CONSTRUCT(); |
2224 UpdateOrdinalPosition(); |
|
2225 |
|
2226 AMT_MAP_STREAMER_TEXT_CURSOR_CONSTRUCT(); |
|
2227 } |
|
2228 else |
|
2229 { |
|
2230 CAlfNode::ReportOOM(); |
|
2231 } |
2152 } |
2232 } |
2153 |
2233 |
2154 // --------------------------------------------------------------------------- |
2234 // --------------------------------------------------------------------------- |
2155 // NewL |
2235 // NewL |
2156 // --------------------------------------------------------------------------- |
2236 // --------------------------------------------------------------------------- |
2196 break; |
2276 break; |
2197 } |
2277 } |
2198 } |
2278 } |
2199 TInt offset; |
2279 TInt offset; |
2200 TAlfCursorDataBufferAttributes* attributes = (TAlfCursorDataBufferAttributes*)CreateWindowAttributes(offset, sizeof(TAlfCursorDataBufferAttributes)); |
2280 TAlfCursorDataBufferAttributes* attributes = (TAlfCursorDataBufferAttributes*)CreateWindowAttributes(offset, sizeof(TAlfCursorDataBufferAttributes)); |
2201 attributes->iColor = iColor; |
2281 if (attributes) |
2202 attributes->iFlags = iFlags; |
2282 { |
2203 attributes->iFlashInterval = iFlashInterval; |
2283 attributes->iColor = iColor; |
2204 attributes->iScreenNumber = iScreenNumber; |
2284 attributes->iFlags = iFlags; |
2205 __ALFLOGSTRING("Forwarding cursor data"); |
2285 attributes->iFlashInterval = iFlashInterval; |
2206 iModel->Server().Bridge()->AddData( EAlfDSSetCursorData, |
2286 attributes->iScreenNumber = iScreenNumber; |
|
2287 __ALFLOGSTRING("Forwarding cursor data"); |
|
2288 iModel->Server().Bridge()->AddData( EAlfDSSetCursorData, |
2207 iGroupId, |
2289 iGroupId, |
2208 iId, |
2290 iId, |
2209 (TAny*)offset ); |
2291 (TAny*)offset ); |
2210 |
2292 AMT_MAP_STREAMER_TEXT_CURSOR_CHANGE(); |
2211 AMT_MAP_STREAMER_TEXT_CURSOR_CHANGE(); |
2293 } |
|
2294 else |
|
2295 { |
|
2296 CAlfNode::ReportOOM(); |
|
2297 } |
2212 } |
2298 } |
2213 CAlfNodeTextCursor::~CAlfNodeTextCursor( ) |
2299 CAlfNodeTextCursor::~CAlfNodeTextCursor( ) |
2214 { |
2300 { |
2215 // text cursor is the only text cursor in its parent. No need to check siblings. |
2301 // text cursor is the only text cursor in its parent. No need to check siblings. |
2216 if(iParent) |
2302 if(iParent) |