678 { |
678 { |
679 TInt count( allWgIds.Count() ); |
679 TInt count( allWgIds.Count() ); |
680 for ( TInt i( 0 ); i < count; i++ ) |
680 for ( TInt i( 0 ); i < count; i++ ) |
681 { |
681 { |
682 RWsSession::TWindowGroupChainInfo info = allWgIds[i]; |
682 RWsSession::TWindowGroupChainInfo info = allWgIds[i]; |
683 if ( info.iId == aWgId ) |
683 if ( info.iId == aWgId && info.iParentId > 0) |
684 { |
684 { |
685 parent = info.iParentId; |
685 parent = info.iParentId; |
686 break; |
686 break; |
687 } |
687 } |
688 } |
688 } |
689 } |
689 } |
690 allWgIds.Close(); |
690 allWgIds.Close(); |
|
691 return parent; |
|
692 } |
|
693 |
|
694 // -------------------------------------------------------------------------- |
|
695 // CTsFswEngine::FindMostTopParentWgId |
|
696 // -------------------------------------------------------------------------- |
|
697 // |
|
698 TInt CTsFswEngine::FindMostTopParentWgId( TInt aWgId ) |
|
699 { |
|
700 TInt parent( KErrNotFound ); |
|
701 parent = FindParentWgId( aWgId ); |
|
702 if( parent != KErrNotFound) |
|
703 { |
|
704 TInt topParent = FindMostTopParentWgId(parent); |
|
705 if( topParent != KErrNotFound ) |
|
706 { |
|
707 parent = topParent; |
|
708 } |
|
709 } |
691 return parent; |
710 return parent; |
692 } |
711 } |
693 |
712 |
694 // -------------------------------------------------------------------------- |
713 // -------------------------------------------------------------------------- |
695 // CTsFswEngine::FindAppNameLC |
714 // CTsFswEngine::FindAppNameLC |
899 } |
918 } |
900 |
919 |
901 // -------------------------------------------------------------------------- |
920 // -------------------------------------------------------------------------- |
902 // CTsFswEngine::AssignScreenshotHandle |
921 // CTsFswEngine::AssignScreenshotHandle |
903 // Called when a screenshot arrives to check if there is a corresponding |
922 // Called when a screenshot arrives to check if there is a corresponding |
904 // application in the task list. |
923 // application in the task list. Firstly try to match screenshot into parental |
|
924 // application then into standalone one. |
905 // -------------------------------------------------------------------------- |
925 // -------------------------------------------------------------------------- |
906 // |
926 // |
907 void CTsFswEngine::AssignScreenshotHandle( TInt aWgIdForScreenshot, |
927 void CTsFswEngine::AssignScreenshotHandle( TInt aWgIdForScreenshot, |
908 TInt aBitmapHandle ) |
928 TInt aBitmapHandle ) |
909 { |
929 { |
910 TBool changed = EFalse; |
930 TBool changed = EFalse; |
911 TInt parentWgId = FindParentWgId( aWgIdForScreenshot ); |
931 TInt parentWgId = FindMostTopParentWgId( aWgIdForScreenshot ); |
912 // now parentWgId is a valid wgid or KErrNotFound (-1) |
932 // now parentWgId is a valid wgid or KErrNotFound (-1) |
913 for ( TInt i = 0, ie = iData.Count(); i != ie; ++i ) |
933 if (parentWgId != KErrNotFound) |
914 { |
934 { |
915 if ( iData[i]->Widget() ) |
935 AssignScreenshotHandle( parentWgId, aBitmapHandle, changed ); |
916 { |
936 } |
917 // Do not do anything for now => no screenshot for widgets. |
937 if (!changed) |
918 continue; |
938 { |
919 } |
939 AssignScreenshotHandle( aWgIdForScreenshot, aBitmapHandle, changed ); |
920 TInt appWgId = iData[i]->WgId(); |
940 } |
921 if ( appWgId == aWgIdForScreenshot || appWgId == parentWgId ) |
|
922 { |
|
923 iData[i]->SetScreenshotHandle( aBitmapHandle ); |
|
924 changed = ETrue; |
|
925 break; |
|
926 } |
|
927 } |
|
928 if ( changed ) |
941 if ( changed ) |
929 { |
942 { |
930 iObserver.FswDataChanged(); |
943 iObserver.FswDataChanged(); |
931 } |
944 } |
932 } |
945 } |
|
946 |
|
947 // -------------------------------------------------------------------------- |
|
948 // CTsFswEngine::AssignScreenshotHandle |
|
949 // Called when a screenshot arrives to check if there is a corresponding |
|
950 // application in the task list. It might be tried to be match into parental |
|
951 // or standalone application. |
|
952 // -------------------------------------------------------------------------- |
|
953 // |
|
954 void CTsFswEngine::AssignScreenshotHandle(TInt aWgIdForScreenshot, |
|
955 TInt aBitmapHandle, TBool& aAsigned) |
|
956 { |
|
957 aAsigned = EFalse; |
|
958 for (TInt i = 0, ie = iData.Count(); i != ie; ++i) |
|
959 { |
|
960 if (iData[i]->Widget()) |
|
961 { |
|
962 // Do not do anything for now => no screenshot for widgets. |
|
963 continue; |
|
964 } |
|
965 TInt appWgId = iData[i]->WgId(); |
|
966 if (appWgId == aWgIdForScreenshot) |
|
967 { |
|
968 iData[i]->SetScreenshotHandle(aBitmapHandle); |
|
969 aAsigned = ETrue; |
|
970 break; |
|
971 } |
|
972 } |
|
973 } |
933 |
974 |
934 // -------------------------------------------------------------------------- |
975 // -------------------------------------------------------------------------- |
935 // CTsFswEngine::LookupScreenshotHandle |
976 // CTsFswEngine::LookupScreenshotHandle |
936 // Called to check if there is a screenshot already stored for the given |
977 // Called to check if there is a screenshot already stored for the given |
937 // app. (or a screenshot with a wgid for which aWgIdForApp is the parent) |
978 // app. (or a screenshot with a wgid for which aWgIdForApp is the parent) |