Thx mayur,
that is an absolutely great idea to solve the problem in this way.
But i have some trouble with the implementation... :-(
The on top icon derives from CCoeControl. In the ContructL a window will be created and i call EnableFocusChangeEvents() and EnableGroupChangeEvents() on the regarding window group:
Code:
...
void COnTopIcon::ConstructL() {
iWindowGroup = RWindowGroup(iCoeEnv->WsSession());
User::LeaveIfError(iWindowGroup.Construct((TUint32)&iWindowGroup));
iWindowGroup.SetOrdinalPosition(0, ECoeWinPriorityAlwaysAtFront);
iWindowGroup.EnableReceiptOfFocus(EFalse);
iWindowGroup.EnableFocusChangeEvents();
iWindowGroup.EnableGroupChangeEvents();
CreateWindowL(&iWindowGroup);
iIndicator = CEikonEnv::Static()->CreateBitmapL(iDataManager->GetMbmFile(), EMbmLogo12x12);
iIndicatorMask = CEikonEnv::Static()->CreateBitmapL(iDataManager->GetMbmFile(), EMbmLogo12x12_mask);
SetRect(TRect(TPoint(KIndicatorPosX, KIndicatorPosY), iIndicator->SizeInPixels()));
DrawNow();
iFocusObserver = CFocusObserver::NewL(this, iCoeEnv->WsSession());
iFocusObserver->StartL();
ActivateL();
}
...
Furthermore a CActive should handle the focus event listening (iFocusObserver):
Code:
...
void CFocusObserver::StartL() {
iWs.EventReady(&iStatus);
SetActive();
}
void CFocusObserver::RunL() {
const TUid KUidPhone = { 0x100058b3 };
TInt wgid = iWs.GetFocusWindowGroup();
CApaWindowGroupName* gn = CApaWindowGroupName::NewLC(iWs, wgid);
TUid uid = gn->AppUid();
iOnTopIcon->MakeVisible((uid == KUidPhone));
StartL();
}
void CFocusObserver::DoCancel() {
iWs.EventReadyCancel();
}
...
The app will crash without an specific error.
If i not call the StartL() of the focus observer the app works fine (without the focus change handling).
I tried to debug this, but the app crashes at any point in the EIKCORE.DLL after the ConstructL() of my AppUI class.
Does anybody have an idea, where i make a mistake?
Thank you all...