29 #include <aknenv.h> |
29 #include <aknenv.h> |
30 #include <akntranseffect.h> // for Transition effect enumerations |
30 #include <akntranseffect.h> // for Transition effect enumerations |
31 #include <UikonInternalPSKeys.h> |
31 #include <UikonInternalPSKeys.h> |
32 #include <e32property.h> |
32 #include <e32property.h> |
33 #include <AknSgcc.h> |
33 #include <AknSgcc.h> |
|
34 #include <w32std.h> |
34 |
35 |
35 LOCAL_C TBool IsInHiddenList(const TUid& aUid) |
36 LOCAL_C TBool IsInHiddenList(const TUid& aUid) |
36 { |
37 { |
37 TBuf16<2 * KMaxHiddenApps> lst; |
38 TBuf16<2 * KMaxHiddenApps> lst; |
38 if(KErrNone != RProperty::Get(KPSUidUikon, KUikAppHiddenList, lst)) |
39 if(KErrNone != RProperty::Get(KPSUidUikon, KUikAppHiddenList, lst)) |
62 // set this apps UID in the window group name to remove the gap between this check and it being set in UpdateTaskNameL() |
63 // set this apps UID in the window group name to remove the gap between this check and it being set in UpdateTaskNameL() |
63 TUid uid(AppDllUid()); |
64 TUid uid(AppDllUid()); |
64 CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(ws, myWg); |
65 CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(ws, myWg); |
65 wgName->SetAppUid(uid); |
66 wgName->SetAppUid(uid); |
66 wgName->SetWindowGroupName(env->RootWin()); |
67 wgName->SetWindowGroupName(env->RootWin()); |
67 |
68 |
68 // Use a CAknTaskList to check for root instances of apps |
69 // Use a CAknTaskList to check for root instances of apps |
69 CAknTaskList* taskList = CAknTaskList::NewLC(ws); |
70 CAknTaskList* taskList = CAknTaskList::NewLC(ws); |
70 TBool foundInstance = EFalse; |
71 TBool foundInstance = EFalse; |
71 |
72 |
72 // Look for another instance of this app |
73 // Look for another instance of this app |
73 while (wgId>=0) |
74 while (wgId>=0) |
74 { |
75 { |
75 if (wgId && wgId != myWg && taskList->IsRootWindowGroup(wgId)) |
76 TBool rootTask = taskList->IsRootWindowGroup(wgId); |
|
77 TBool rootWg = EFalse; |
|
78 TInt wndPriority = -1; |
|
79 if ( wgId != myWg && wgId > 0 && !rootTask ) |
|
80 { |
|
81 wndPriority = ws.GetWindowGroupOrdinalPriority( wgId ); |
|
82 RArray<RWsSession::TWindowGroupChainInfo> wgs; |
|
83 // it seems effecient to call WindowGroupList here, this codes will seldom executed. |
|
84 ws.WindowGroupList( wndPriority, &wgs ); |
|
85 |
|
86 TInt count = wgs.Count(); |
|
87 for ( TInt ii=0; ii<count; ii++ ) |
|
88 { |
|
89 const RWsSession::TWindowGroupChainInfo& info = wgs[ii]; |
|
90 // find the window group id and check that it has no parent |
|
91 if ( info.iId == wgId ) |
|
92 { |
|
93 rootWg = (info.iParentId <= 0); |
|
94 break; |
|
95 } |
|
96 } |
|
97 |
|
98 wgs.Close(); |
|
99 } |
|
100 |
|
101 if (wgId && wgId != myWg && ( rootWg || rootTask ) ) |
76 { // found another app, switch to it & die |
102 { // found another app, switch to it & die |
77 /* |
103 /* |
78 TApaTask other(ws); |
104 TApaTask other(ws); |
79 other.SetWgId(wgId); |
105 other.SetWgId(wgId); |
80 other.BringToForeground(); |
106 other.BringToForeground(); |