--- a/uifw/AvKon/src/aknApp.cpp Tue Apr 27 16:55:05 2010 +0300
+++ b/uifw/AvKon/src/aknApp.cpp Tue May 11 16:27:42 2010 +0300
@@ -31,6 +31,7 @@
#include <UikonInternalPSKeys.h>
#include <e32property.h>
#include <AknSgcc.h>
+#include <w32std.h>
LOCAL_C TBool IsInHiddenList(const TUid& aUid)
{
@@ -64,15 +65,40 @@
CApaWindowGroupName* wgName = CApaWindowGroupName::NewLC(ws, myWg);
wgName->SetAppUid(uid);
wgName->SetWindowGroupName(env->RootWin());
-
- // Use a CAknTaskList to check for root instances of apps
- CAknTaskList* taskList = CAknTaskList::NewLC(ws);
- TBool foundInstance = EFalse;
-
+
+ // Use a CAknTaskList to check for root instances of apps
+ CAknTaskList* taskList = CAknTaskList::NewLC(ws);
+ TBool foundInstance = EFalse;
+
// Look for another instance of this app
while (wgId>=0)
{
- if (wgId && wgId != myWg && taskList->IsRootWindowGroup(wgId))
+ TBool rootTask = taskList->IsRootWindowGroup(wgId);
+ TBool rootWg = EFalse;
+ TInt wndPriority = -1;
+ if ( wgId != myWg && wgId > 0 && !rootTask )
+ {
+ wndPriority = ws.GetWindowGroupOrdinalPriority( wgId );
+ RArray<RWsSession::TWindowGroupChainInfo> wgs;
+ // it seems effecient to call WindowGroupList here, this codes will seldom executed.
+ ws.WindowGroupList( wndPriority, &wgs );
+
+ TInt count = wgs.Count();
+ for ( TInt ii=0; ii<count; ii++ )
+ {
+ const RWsSession::TWindowGroupChainInfo& info = wgs[ii];
+ // find the window group id and check that it has no parent
+ if ( info.iId == wgId )
+ {
+ rootWg = (info.iParentId <= 0);
+ break;
+ }
+ }
+
+ wgs.Close();
+ }
+
+ if (wgId && wgId != myWg && ( rootWg || rootTask ) )
{ // found another app, switch to it & die
/*
TApaTask other(ws);