void CGlobalSettings::SetScreenNoL(TInt aScreenNo) { RWsSession session; ASSERT_EQUALS(session.Connect(), KErrNone); TInt maxScreens=session.NumberOfScreens(); if (maxScreens>aScreenNo) { INFO_PRINTF2(_L("New screen number for all output selected: %i"),aScreenNo); { CWsScreenDevice screen(session); screen.Construct(aScreenNo); screen.SetCurrentRotations(0,CFbsBitGc::TGraphicsOrientation(0)); screen.SetScreenMode(0); screen.SetAppScreenMode(0); } settings_instance.iScreen=aScreenNo; session.Flush(); session.Close(); } else { INFO_PRINTF1(_L("**************************")); INFO_PRINTF1(_L("")); INFO_PRINTF3(_L("Can't set screen output to %i. Only got %i screens"),aScreenNo,maxScreens); INFO_PRINTF2(_L("Screen number for all output remains at: %i"),settings_instance.iScreen); INFO_PRINTF1(_L("")); INFO_PRINTF1(_L("**************************")); session.Flush(); session.Close(); User::Leave(KErrTEFUnitFail); } }
/** Test using an indipendent method that GCE version of WServ is running * This method can be called at any time, even by external code, but creates temporary window session objects * * @return true if WServ version is GCE technology, false if legacy technology **/ TBool CWsGceCscBase::GCEIsSupportedStatic() { CFbsDrawDevice* screenDevice=NULL; RWsSession session; if (session.Connect()!=KErrNone) { return EFalse; } CWsScreenDevice screen(session); if (screen.Construct(TGlobalSettings::Instance().iScreen)!=KErrNone) { return EFalse; } TDisplayMode displayMode=screen.DisplayMode(); TRAPD(err, screenDevice = CFbsDrawDevice::NewScreenDeviceL(TGlobalSettings::Instance().iScreen, displayMode)); TBool rv=EFalse; if(err == KErrNone) { TAny* p=NULL; rv=(screenDevice->GetInterface(KSurfaceInterfaceID, p)==KErrNone); delete screenDevice; } return rv; }
// --------------------------------------------------------------------------- // CCmFmUpnpMngr::ScreenSizeL // --------------------------------------------------------------------------- // void CCmFmUpnpMngr::ScreenSizeL() { LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ScreenSizeL start")); RWsSession session; TInt error = session.Connect() ; CleanupClosePushL( session ); if ( !error ) { CWsScreenDevice* screenDevice = new ( ELeave ) CWsScreenDevice( session ); if ( screenDevice && !screenDevice->Construct() ) { iScreenSize = screenDevice->SizeInPixels(); } delete screenDevice; screenDevice = NULL; } else { TRACE(Print(_L("[FILL MNGR]\t ScreenSizeL error = %d"), error )); } CleanupStack::PopAndDestroy( &session ); LOG(_L("[FILL MNGR]\t CCmFmUpnpMngr::ScreenSizeL end")); }
void CTTSprite::GeneralTestsL() { // // Close cursor while still active on a window // RWindow win(TheClient->iWs); win.Construct(*TheClient->iGroup->GroupWin(),1); win.Activate(); SetUpPointerCursorL(iCursor1,TheClient->iWs); win.SetCustomPointerCursor(iCursor1); iCursor1.Close(); // // Close window while cursor active on it // SetUpPointerCursorL(iCursor1,TheClient->iWs); win.SetCustomPointerCursor(iCursor1); win.Close(); iCursor1.Close(); // // Close session with: // An open cursor active on a window & A closed cursor active on another window // RWsSession ws; User::LeaveIfError(ws.Connect()); // use correct screen // ws.SetFocusScreen(iTest->iScreenNumber); CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws); CleanupStack::PushL(screen); User::LeaveIfError(screen->Construct(0)); RWindowGroup group(ws); User::LeaveIfError(group.Construct(123)); group.EnableReceiptOfFocus(EFalse); // Stop auto group switching on close RWindow win2(ws); User::LeaveIfError(win2.Construct(group, 1)); win2.Activate(); RWindow win3(ws); User::LeaveIfError(win3.Construct(group, 2)); win3.Activate(); // SetUpPointerCursorL(iCursor1,ws); SetUpPointerCursorL(iCursor2,ws); win2.SetCustomPointerCursor(iCursor1); win3.SetCustomPointerCursor(iCursor2); // TSpriteMember member; member.iBitmap=member.iMaskBitmap=NULL; TInt err = iCursor1.UpdateMember(9999,member); TEST(err==KErrArgument); if (err!=KErrArgument) INFO_PRINTF3(_L("iCursor1.UpdateMember(9999,member) return value - Expected: %d, Actual: %d"), KErrArgument, err); iCursor1.Close(); CleanupStack::PopAndDestroy(screen); ws.Close(); }
/** @SYMTestCaseID GRAPHICS-WSERV-GCE-0700 @SYMDEF DEF123129 @SYMTestCaseDesc Test activating a sprite twice does not cause the system to hang @SYMTestPriority High @SYMTestStatus Implemented @SYMTestActions Construct a sprite and add a member to it. Activate twice. @SYMTestExpectedResults The test should terminate smoothly and it should not hang the system. */ void CTTSprite::DoubleActivateL() { RWsSession ws; User::LeaveIfError(ws.Connect()); CleanupClosePushL(ws); RWindowGroup group(ws); User::LeaveIfError(group.Construct(890, EFalse)); CleanupClosePushL(group); RWsSprite sprite = RWsSprite(ws); User::LeaveIfError(sprite.Construct(group,TPoint(),0)); CleanupClosePushL(sprite); CFbsBitmap* bitmap=new(ELeave) CFbsBitmap; CleanupStack::PushL(bitmap); User::LeaveIfError(bitmap->Create(TSize(10,12),EColor256)); TSpriteMember member; member.iMaskBitmap=NULL; member.iInvertMask=EFalse; member.iDrawMode=CGraphicsContext::EDrawModePEN; member.iOffset=TPoint(); member.iInterval=TTimeIntervalMicroSeconds32(0); member.iBitmap=bitmap; User::LeaveIfError(sprite.AppendMember(member)); User::LeaveIfError(sprite.Activate()); User::LeaveIfError(sprite.Activate()); sprite.Close(); CleanupStack::PopAndDestroy(4, &ws); group.Close(); ws.Close(); }
TVerdict CApStartTestStep::doTestStepL() { INFO_PRINTF1(_L("CApStartTestStep started....\n")); __UHEAP_MARK; RWsSession wsSession; User::LeaveIfError(wsSession.Connect()); CleanupClosePushL(wsSession); TRAPD(err, TestStartAndForgetL(wsSession)); TESTE(KErrNone == err, err); TRAP(err, TestStartAndFollowUpL(wsSession)); TESTE(KErrNone == err, err); CleanupStack::PopAndDestroy(); //wsSession.Close(); TRAP(err, TestInitApparcL()); TESTE(KErrNone == err, err); __UHEAP_MARKEND; INFO_PRINTF1(_L(".... CApStartTestStep finished!!")); return TestStepResult(); }
// ----------------------------------------------------------------------------- // CSisxUISilentHandler::BringToForeground // Swithces application to foreground or background. Used when user confirmation // dialog is used dialog is used in silent installation // ----------------------------------------------------------------------------- // void CSisxUISilentHandler::BringToForeground( TBool aForeground ) { RWsSession ws; if ( ws.Connect() == KErrNone ) { CleanupClosePushL(ws); TApaTaskList tasklist(ws); if ( aForeground ) { TApaTask task = tasklist.FindApp( TUid::Uid(KSWInstSvrUid) ); if ( task.Exists() ) { task.BringToForeground(); } } else { TApaTask task = tasklist.FindApp( TUid::Uid(KSWInstSvrUid) ); if ( task.Exists() ) { task.SendToBackground(); } } CleanupStack::PopAndDestroy(); //ws } }
void showDebugMessage( const char* source, const char* message ) { if ( source && message ) { memset(g_szSource, 0, sizeof(g_szSource) ); memset(g_szMessage, 0, sizeof(g_szMessage) ); memcpy( g_szSource, source, strlen(source) > 20 ? 20 : strlen(source) ); memcpy( g_szMessage, message, strlen(message) > 100 ? 100 : strlen(message)); // Create a window server event RWsSession wsSession; TWsEvent event; if ( wsSession.Connect() == KErrNone ) { // Set event data. eventType.data = KData; event.SetType(EEventUser + ECmdShowDebugWindow); // set event type event.SetTimeNow(); // set the event time event.SetHandle(wsSession.WsHandle()); // set window server handle // Send the created event wsSession.SendEventToAllWindowGroups(event); } } }
/** Inform with a message ,the timer seconds remaining till its up.\n Send event to windows group when timer time is up .\n */ void CTestTimer::RunL() { --iSecondsRemaining; if (iSecondsRemaining>0) { QueueAndInfoPrint(); } else { User::InfoPrint(_L("Time's up")); iCompleted = ETrue; CCoeEnv* env = CCoeEnv::Static(); TWsEvent theEvent; theEvent.SetType(EEventUser + 1); RWsSession ws; TInt theRes = ws.Connect(); if(theRes == KErrNone) { RWindowGroup& winGroup = env->RootWin(); theEvent.SetType(EEventUser + 1); theEvent.SetTimeNow(); TInt theId = winGroup.Identifier(); ws.SendEventToWindowGroup(theId, theEvent); } ws.Close(); } }
void CTcAppLauncher::RunL() { // Fatal error occurred, report User::LeaveIfError( iStatus.Int() ); if( iDismissDialog ) { TKeyEvent event; event.iCode = EKeyDevice3; RWsSession wsSession; User::LeaveIfError( wsSession.Connect() ); wsSession.SimulateKeyEvent( event ); wsSession.Close(); } RApaLsSession apparc; User::LeaveIfError( apparc.Connect() ); CleanupClosePushL( apparc ); CApaCommandLine* cmdLine = CApaCommandLine::NewLC(); cmdLine->SetExecutableNameL( iAppName ); cmdLine->SetCommandL( EApaCommandRun ); User::LeaveIfError( apparc.StartApp( *cmdLine ) ); CleanupStack::PopAndDestroy( 2 ); // Write log entry LOG( _L("[APPLAUNCHER] Client restarted.") ); delete this; }
// ---------------------------------------------------------------------------- // // ---------------------------------------------------------------------------- // TBool CWrtHarvester::CheckTaskExistsL() { TUid widgetAppUid( TUid::Uid( KWidgetAppUid ) ); RWsSession wsSession; // Create Window server session User::LeaveIfError( wsSession.Connect() ); TApaTaskList taskList( wsSession ); TApaTask task = taskList.FindApp( widgetAppUid ); return task.Exists()?ETrue:EFalse; }
TInt LoadsOfText(TInt aOwningGroup) { RWsSession ws; ws.Connect(); CWsScreenDevice *device=new(ELeave) CWsScreenDevice(ws); device->Construct(); RWindowGroup group(ws); group.Construct(ENullWsHandle); group.SetOwningWindowGroup(aOwningGroup); TSize scrSize(device->SizeInPixels()); // RWindow window(ws); window.Construct(group,ENullWsHandle); window.SetExtent(TPoint(), scrSize); window.Activate(); // CWindowGc *gc; device->CreateContext(gc); window.BeginRedraw(); gc->Activate(window); gc->Clear(); window.EndRedraw(); TFontSpec fspec(KTestFontTypefaceName,200); CFbsFont *font; User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips((CFont *&)font, fspec)); gc->UseFont(font); TBuf<100> loadsatext(_L("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890zyxwvutsrqponmlkjihgfedcba")); TInt ascent=font->AscentInPixels(); TInt fheight=font->HeightInPixels(); for(TInt nTimes=0;nTimes<10;nTimes++) { TPoint pos; // for(pos.iY=ascent;pos.iY<scrSize.iHeight;pos.iY+=font->HeightInPixels()) // gc->DrawText(loadsatext,pos); for(pos.iY=0;pos.iY<scrSize.iHeight;pos.iY+=fheight) gc->DrawText(loadsatext,TRect(pos,TPoint(scrSize.iWidth,pos.iY+fheight)),ascent); gc->Clear(); } gc->Deactivate(); // ws.Flush(); delete gc; device->ReleaseFont(font); window.Close(); group.Close(); delete device; ws.Close(); return(KErrNone); }
void CSyncEngineWrap::SendWindowEvent(TInt aEvent) { // Create a window server event RWsSession wsSession; TWsEvent event; if (wsSession.Connect() == KErrNone) { // Set event data. eventType.data = KData; event.SetType(EEventUser + aEvent); // set event type event.SetTimeNow(); // set the event time event.SetHandle(wsSession.WsHandle()); // set window server handle // Send the created event wsSession.SendEventToAllWindowGroups(event); } }
/** * Runs the test in a second thread. * * @param aFunctionIndex The drawing function command to be executed. All commands are defined in TestFunctionIndex. */ TInt CTW32CmdBuf::DoTestCmdBufFunctionL(TTestFunctionIndex aFunctionIndex) { RWsSession session; User::LeaveIfError(session.Connect()); CleanupClosePushL(session); CWsScreenDevice *device = new(ELeave) CWsScreenDevice(session); CleanupStack::PushL(device); User::LeaveIfError(device->Construct(CTestBase::iScreenNo)); CWindowGc* gc; User::LeaveIfError(device->CreateContext(gc)); CleanupStack::PushL(gc); RWindowGroup group(session); User::LeaveIfError(group.Construct(1, EFalse)); CleanupClosePushL(group); RWindow window(session); User::LeaveIfError(window.Construct(group, 2)); CleanupClosePushL(window); window.SetExtent(TPoint(0,0), TSize(200, 200)); User::LeaveIfError(window.SetRequiredDisplayMode(EColor64K)); window.Activate(); gc->Activate(window); session.SetAutoFlush(EFalse); window.Invalidate(); window.BeginRedraw(); for(TInt i=KMinTestIterations; i<KMaxTestIterations; ++i) { for(TInt j=0; j<i; ++j) { gc->Clear(); } CFbsBitmap* bitmap = new(ELeave) CFbsBitmap; CleanupStack::PushL(bitmap); User::LeaveIfError(bitmap->Create(TSize(100, 100), EColor64K)); CFbsBitmap* mask = new(ELeave) CFbsBitmap; CleanupStack::PushL(mask); User::LeaveIfError(mask->Create(TSize(100, 100), EColor64K)); KTestFunctions[aFunctionIndex](gc, bitmap, mask); CleanupStack::PopAndDestroy(2); session.Flush(); } window.EndRedraw(); gc->Deactivate(); CleanupStack::PopAndDestroy(5); return KErrNone; }
void CTGdi::NonDrawing() // // Test all non-drawing GDI functions // { TDisplayMode mode=TheClient->iScreen->DisplayMode(); TEST((mode!=ERgb) && (mode!=ENone)); RWsSession session; TInt res = session.Connect(); TEST(res == KErrNone); CArrayFixFlat<TInt>* modeList= new CArrayFixFlat<TInt> (15); if(!modeList) return; #if defined(SYMBIAN_GRAPHICS_GCE) res = session.GetColorModeList(iTest->iScreenNumber, modeList); #else res = session.GetColorModeList(modeList); #endif //SYMBIAN_GRAPHICS_GCE session.Close(); TEST(res == KErrNone); if(res != KErrNone) { modeList->Reset(); delete modeList; return; } TBool found = EFalse; for(TInt ii = 0; ii < modeList->Count() && !found; ii++) { TDisplayMode mode1 = (TDisplayMode) ((*modeList)[ii]); if(mode == mode1) { found = ETrue; } } modeList->Reset(); delete modeList; TEST(found); }
void SendWindowEvent(TInt aEvent, const char* data) { // Create a window server event RWsSession wsSession; TWsEvent event; if ( wsSession.Connect() == KErrNone ) { // Set event data. eventType.data = KData; event.SetType(EEventUser + aEvent); // set event type event.SetTimeNow(); // set the event time event.SetHandle(wsSession.WsHandle()); // set window server handle if ( data ) ((char**)event.EventData())[0] = strdup(data); // Send the created event wsSession.SendEventToAllWindowGroups(event); } }
void CWsGraphicShareBase::ConstructL() { User::LeaveIfError(iWs.Connect()); iScreen=new(ELeave) CWsScreenDevice(iWs); User::LeaveIfError(iScreen->Construct(iScreenNumber)); iGc=new(ELeave) CWindowGc(iScreen); User::LeaveIfError(iGc->Construct()); iGroupWin=new(ELeave) RWindowGroup(iWs); iGroupWin->Construct(1); iWin=new(ELeave) RWindow(iWs); iWin->Construct(*iGroupWin,ENullWsHandle); iWin->SetRequiredDisplayMode(EColor256); iWin->SetExtent(TPoint(0,0),iScreen->SizeInPixels()); iWin->Activate(); iWin->BeginRedraw(); iWin->EndRedraw(); iWs.Flush(); }
// ============================================================================ // CWidgetEntry::Active() // Is widget running? 0 if not, non zero if running. // // @since 3.1 // ============================================================================ // TInt CWidgetEntry::ActiveL() { if ( iActive ) { // check that WidgetUI didn't crash, this assumes all widgets // in the registry are running under WidgetUI RWsSession wsSession; User::LeaveIfError( wsSession.Connect() ); CleanupClosePushL( wsSession ); TApaTaskList taskList( wsSession ); TApaTask task = taskList.FindApp( KUidWidgetUi ); if ( EFalse == task.Exists() ) { // widget UI crashed, reset active iActive = 0; } CleanupStack::PopAndDestroy( &wsSession ); } return iActive; }
/* ----------------------------------------------------------------------------- ----------------------------------------------------------------------------- */ TInt CExPolicy_Server::KillTasks(TUid& aUid) { TInt RetErr(KErrNone); RWsSession wsSession; RetErr= wsSession.Connect(); if(RetErr == KErrNone) { TApaTaskList taskList( wsSession ); TApaTask task = taskList.FindApp(aUid); if( task.Exists() ) { task.KillTask(); } } wsSession.Close(); return RetErr; }
void CCustomCmdTestDeviceSecurityCheck::SimulatePasswordEntry() { RWsSession wsSession; TInt err = wsSession.Connect(); TEST(KErrNone == err); const TInt okButtonPos1 = 60; //the position of ok button const TInt okButtonPos2 = 600; //the position of ok button //Simulate the key press ,(comma) in to pin notifier dialogue TRawEvent eventDown; TRawEvent eventUp; eventDown.Set(TRawEvent::EKeyDown, EStdKeyComma); UserSvr::AddEvent(eventDown); eventUp.Set(TRawEvent::EKeyUp, EStdKeyComma); UserSvr::AddEvent(eventUp); User::After(100000); //Enter wrong pwd if iWrongPwd is ETrue if(iWrongPwd) { eventDown.Set(TRawEvent::EKeyDown, EStdKeyComma); UserSvr::AddEvent(eventDown); eventUp.Set(TRawEvent::EKeyUp, EStdKeyComma); UserSvr::AddEvent(eventUp); User::After(100000); //Reset it to false as wrong password should be entered only once iWrongPwd = EFalse; } eventDown.Set(TRawEvent::EButton1Down, okButtonPos1,okButtonPos2); UserSvr::AddEvent(eventDown); eventUp.Set(TRawEvent::EButton1Up, okButtonPos1,okButtonPos2); UserSvr::AddEvent(eventUp); User::After(100000); wsSession.Flush(); wsSession.Close(); }
void CTScreenDevice::ConstructL() { //The following is just another test... it doesn't leave any resources for use by the test class AFAICT... RWsSession aSession; CWsScreenDevice *device1; CWsScreenDevice *device2; CWsScreenDevice *device3; aSession.Connect(); device1=new(ELeave) CWsScreenDevice(aSession); device1->Construct(iTest->iScreenNumber); delete device1; device1=new(ELeave) CWsScreenDevice(aSession); device1->Construct(iTest->iScreenNumber); device2=new(ELeave) CWsScreenDevice(aSession); device2->Construct(iTest->iScreenNumber); device3=new(ELeave) CWsScreenDevice(aSession); device3->Construct(iTest->iScreenNumber); delete device3; CFbsFont *font; User::LeaveIfError(device1->GetNearestFontToDesignHeightInTwips((CFont *&)font,TFontSpec())); RWindowGroup group(aSession); group.Construct(777); group.SetOwningWindowGroup(TheClient->iGroup->GroupWin()->Identifier()); RWindow win(aSession); win.Construct(group,77); CWindowGc *gc=new(ELeave) CWindowGc(device1); gc->Construct(); gc->Activate(win); gc->UseFont(font); device1->ReleaseFont(font); aSession.Flush(); delete gc; win.Close(); group.Close(); delete device1; delete device2; aSession.Close(); }
/** @SYMTestCaseID GRAPHICS_WSERV_DYNAMICRES_0100L @SYMTestCaseDesc GetInterface in classic @SYMREQ @SYMPREQ PREQ2102 @SYMTestType CT @SYMTestPriority @SYMTestPurpose GetInterface should always return NULL in classic @SYMTestActions Create an RWsSession Create a CWsScreenDevice Call GetInterface with various GUIDS. @SYMTestExpectedResults Should always return NULL **/ void CWsDynamicResClassic::GRAPHICS_WSERV_DYNAMICRES_0100L() { RWsSession session; session.Connect(); CWsScreenDevice* screenDevice = NULL; TRAPD(err, screenDevice = new (ELeave) CWsScreenDevice(session)); PRINT_ON_ERROR2_L(err, _L("Failed to create screen device: %d"), err); if (screenDevice) { ASSERT_EQUALS_X(screenDevice->Construct(0), KErrNone); void* interface = screenDevice->GetInterface(12344321); ASSERT_NULL (interface); interface = screenDevice->GetInterface(0); ASSERT_NULL (interface); } delete screenDevice; session.Close(); }
/** Handle the window events.\n Create a window server session and connect the client\n Set the event type and call the SendEventToWindowGroup().\n Close the session on completion \n */ void CDefocusingEdwinUi::SendEventToWindowGroups(TWsEvent& aEvent) { RWsSession ws; TInt theRes = ws.Connect(); TEST(theRes == KErrNone); RWindowGroup& winGroup = iCoeEnv->RootWin(); TInt theId = winGroup.Identifier(); aEvent.SetType(EEventKeyDown); aEvent.SetTimeNow(); ws.SendEventToWindowGroup(theId, aEvent); aEvent.SetType(EEventKey); aEvent.SetTimeNow(); ws.SendEventToWindowGroup(theId, aEvent); aEvent.SetType(EEventKeyUp); aEvent.SetTimeNow(); ws.SendEventToWindowGroup(theId, aEvent); ws.Close(); }
void PlayerController::GoToNowPlaying() { if (playerLaunched) { //Launch player RWsSession wsSession; User::LeaveIfError( wsSession.Connect() ); TApaTaskList list(wsSession); TApaTask task = list.FindApp(KMusicPlayerAppUid); CMPXParameter* param = new ( ELeave ) CMPXParameter(); CleanupStack::PushL( param ); param->iType.iUid = KMPXPluginTypePlaybackUid; param->iCmdForward = EMPXCmdFwdNone; CBufBase* buffer = CBufFlat::NewL(3 ); CleanupStack::PushL( buffer ); RBufWriteStream writeStream( *buffer ); CleanupClosePushL( writeStream ); param->ExternalizeL( writeStream ); writeStream.CommitL(); buffer->Compress(); CleanupStack::PopAndDestroy( &writeStream ); if ( task.Exists() ) { wsSession.SendMessageToWindowGroup( task.WgId(), KAppUidMusicPlayerX, buffer->Ptr( 0 ) ); } else { RApaLsSession ls; CleanupClosePushL( ls ); User::LeaveIfError( ls.Connect() ); TApaAppInfo appInfo; User::LeaveIfError( ls.GetAppInfo( appInfo, KAppUidMusicPlayerX ) ); CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(); apaCommandLine->SetExecutableNameL( appInfo.iFullName ); apaCommandLine->SetTailEndL( buffer->Ptr( 0 ) ); User::LeaveIfError( ls.StartApp( *apaCommandLine ) ); CleanupStack::PopAndDestroy(); // apaCommandLine CleanupStack::PopAndDestroy(); // ls } CleanupStack::PopAndDestroy( buffer ); CleanupStack::PopAndDestroy( param ); wsSession.Close(); } else if (radioLaunched) { RApaLsSession ls; CleanupClosePushL( ls ); User::LeaveIfError( ls.Connect() ); TApaAppInfo appInfo; User::LeaveIfError( ls.GetAppInfo( appInfo, KRadioUid ) ); CApaCommandLine* apaCommandLine = CApaCommandLine::NewLC(); apaCommandLine->SetExecutableNameL( appInfo.iFullName ); User::LeaveIfError( ls.StartApp( *apaCommandLine ) ); CleanupStack::PopAndDestroy(); // apaCommandLine CleanupStack::PopAndDestroy(); // ls } }
void MainL() { RWsSession ws; ws.Connect(); CWsScreenDevice* scr = new(ELeave) CWsScreenDevice(ws); scr->Construct(); CWindowGc* gc = new(ELeave) CWindowGc(scr); gc->Construct(); RWindowGroup grp(ws); grp.Construct(0xc0decafe, ETrue); RWindow win(ws); win.Construct(grp, 0xbeefcafe); win.SetExtent(TPoint(20,160), TSize(320,240)); win.Activate(); win.Invalidate(); win.BeginRedraw(); gc->Activate(win); gc->SetPenStyle(CGraphicsContext::ENullPen); gc->SetBrushStyle(CGraphicsContext::ESolidBrush); TBool color = EFalse; if (Profiler::Start() == KErrNotFound) { _LIT(KProfiler,"profiler"); _LIT(KStart,"start -noui -drive=S"); RProcess p; if (p.Create(KProfiler,KStart) == KErrNone) { p.Resume(); p.Close(); } } for (TInt col=0; col<KCol; ++col) { color = !color; for (TInt row=0; row<KRow; ++row) { TRect rect; rect.iTl.iX = col * KSize.iWidth; rect.iTl.iY = row * KSize.iHeight; rect.SetSize(KSize); color = !color; gc->SetBrushColor(color? KRgbBlue : KRgbBlack); gc->DrawRect(rect); } } gc->Deactivate(); win.EndRedraw(); ws.Flush(); User::After(3000000); win.Close(); grp.Close(); delete gc; delete scr; ws.Close(); Profiler::Stop(); Profiler::Close(); Profiler::Unload(); }
void CTScreenDevice::TwipsCacheFlushL() { RWsSession session; CWsScreenDevice* device; CFont* font; CFont* font2; const TFontSpec fontspec(KTestFontTypefaceName,250); TPixelsTwipsAndRotation sizeAndRotation; // create a CWsScreenDevice instance User::LeaveIfError(session.Connect()); device=new(ELeave) CWsScreenDevice(session); device->Construct(iTest->iScreenNumber); // Record a font height for use by latter tests User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); const TInt height0=font->HeightInPixels(); device->ReleaseFont(font); // 1. find font with best-matching height in twips, // 2. change twips size of the screen (leaving pixel-size same), // 3. find font with best-matching height in twips, // 4. make sure that the newly found font is not the same as previous and has the different height in pixels device->GetDefaultScreenSizeAndRotation(sizeAndRotation); #if defined(EXTRA_LOGGING) _LIT(KLog1,"Font height: %d for unchanged device. pixels=%d,%d twips=%d,%d"); LOG_MESSAGE6(KLog1,height0,sizeAndRotation.iPixelSize.iWidth,sizeAndRotation.iPixelSize.iHeight ,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight); #endif sizeAndRotation.iTwipsSize.iHeight=2000; sizeAndRotation.iTwipsSize.iWidth =3000; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); TInt height=font->HeightInPixels(); #if defined(EXTRA_LOGGING) _LIT(KLog2,"Font height: %d for device with twips set to 2000x3000"); LOG_MESSAGE2(KLog2,height); #endif TFontSpec returnedSpec=font->FontSpecInTwips(); sizeAndRotation.iTwipsSize.iHeight=4000; sizeAndRotation.iTwipsSize.iWidth =6000; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec)); TInt height2=font2->HeightInPixels(); TFontSpec returnedSpec2 = font2->FontSpecInTwips(); #if defined(EXTRA_LOGGING) _LIT(KLog3,"Font height: %d for device with twips set to 4000x6000"); LOG_MESSAGE2(KLog3,height2); #endif TEST(font!=font2); TEST(height!=height2); _LIT(KLogErrM,"Font Heights in pixels match unexpectantly, height=%d"); if (height==height2) INFO_PRINTF2(KLogErrM,height); device->ReleaseFont(font2); device->ReleaseFont(font); // 1. find font with best-matching height in twips, // 2. change pixel size of the screen (leaving twip-size same), // 3. find font with best-matching height in twips, // 4. make sure that the newly found font is not the same as previous and has the different height in pixels device->GetDefaultScreenSizeAndRotation(sizeAndRotation); sizeAndRotation.iPixelSize.iHeight=240; sizeAndRotation.iPixelSize.iWidth =640; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); height=font->HeightInPixels(); returnedSpec=font->FontSpecInTwips(); #if defined(EXTRA_LOGGING) _LIT(KLog4,"Font height: %d for device with pixels set to 240x640 twips=%d,%d"); LOG_MESSAGE4(KLog4,height,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight); #endif sizeAndRotation.iPixelSize.iHeight=480; sizeAndRotation.iPixelSize.iWidth =1280; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec)); height2=font2->HeightInPixels(); returnedSpec2=font2->FontSpecInTwips(); #if defined(EXTRA_LOGGING) _LIT(KLog5,"Font height: %d for device with pixels set to 480x1280"); LOG_MESSAGE2(KLog5,height2); #endif TEST(font!=font2); TEST(height!=height2); if (height==height2) INFO_PRINTF2(KLogErrM,height); device->ReleaseFont(font2); device->ReleaseFont(font); // 1. double the width and height of screen in both pixels and twips // 2. find font with best-matching height in twips, // 3. make sure that the newly found font is the same as previous and has the same height in pixels device->GetDefaultScreenSizeAndRotation(sizeAndRotation); device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); sizeAndRotation.iPixelSize.iHeight*=2; sizeAndRotation.iPixelSize.iWidth *=2; sizeAndRotation.iTwipsSize.iHeight*=2; sizeAndRotation.iTwipsSize.iWidth *=2; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec)); height2=font2->HeightInPixels(); #if defined(EXTRA_LOGGING) _LIT(KLog6,"Font height: %d for device doubled size. pixels=%d,%d twips=%d,%d"); LOG_MESSAGE6(KLog6,height2,sizeAndRotation.iPixelSize.iWidth,sizeAndRotation.iPixelSize.iHeight ,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight); #endif TEST(font==font2); TEST(height0==height2); _LIT(KLogErrD,"Font Heights in pixels don't match, expected=%d, actual=%d"); if (height0!=height2) INFO_PRINTF3(KLogErrD,height0,height2); device->ReleaseFont(font2); device->ReleaseFont(font); // 1. swap width and height sizes of screen for both pixels and twips // 2. find font with best-matching height in twips, // 3. make sure that the newly found font is the same as previous and has the same height in pixels device->GetDefaultScreenSizeAndRotation(sizeAndRotation); device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font,fontspec)); TInt swap=sizeAndRotation.iPixelSize.iHeight; sizeAndRotation.iPixelSize.iHeight=sizeAndRotation.iPixelSize.iWidth; sizeAndRotation.iPixelSize.iWidth =swap; swap=sizeAndRotation.iTwipsSize.iHeight; sizeAndRotation.iTwipsSize.iHeight=sizeAndRotation.iTwipsSize.iWidth; sizeAndRotation.iTwipsSize.iWidth =swap; device->SetScreenSizeAndRotation(sizeAndRotation); User::LeaveIfError(device->GetNearestFontToDesignHeightInTwips(font2,fontspec)); height2 = font2->HeightInPixels(); #if defined(EXTRA_LOGGING) _LIT(KLog7,"Font height: %d for device rotated size. pixels=%d,%d twips=%d,%d"); LOG_MESSAGE6(KLog7,height2,sizeAndRotation.iPixelSize.iWidth,sizeAndRotation.iPixelSize.iHeight ,sizeAndRotation.iTwipsSize.iWidth,sizeAndRotation.iTwipsSize.iHeight); #endif TEST(font==font2); TEST(height0==height2); if (height0!=height2) INFO_PRINTF3(KLogErrD,height0,height2); device->ReleaseFont(font2); device->ReleaseFont(font); delete device; session.Close(); }
// Each test step must supply a implementation for doTestStepL enum TVerdict CTestAppLoaderEndTask::doTestStepL( void ) { // Printing to the console and log file INFO_PRINTF1(_L("TEST-> END TASK")); TPtrC program; if ( !GetStringFromConfig(ConfigSection(), KProgram, program) ) { ERR_PRINTF2(KErrMissingParameter, &KProgram()); SetTestStepResult(EFail); } else { RApaLsSession apaLsSession; User::LeaveIfError(apaLsSession.Connect()); CleanupClosePushL(apaLsSession); User::LeaveIfError(apaLsSession.GetAllApps()); RWsSession ws; User::LeaveIfError(ws.Connect()); CleanupClosePushL(ws); TInt numWindowGroups = ws.NumWindowGroups(); CArrayFixFlat<TInt>* windowGroupList = new(ELeave) CArrayFixFlat<TInt>(numWindowGroups); CleanupStack::PushL(windowGroupList); // Populate array with current group list ids User::LeaveIfError(ws.WindowGroupList(windowGroupList)); CApaWindowGroupName* windowGroupName = CApaWindowGroupName::NewLC(ws); /* Note: we use windowGroupList->Count() instead of numWindowGroups, as in the middle of the * update the list could change in length (or worse, be reduced) thus producing an out of bounds * error if numWindowGroups were used */ TBool searching=ETrue; for ( TInt i=0; (i<windowGroupList->Count()) && searching; ++i ) { TInt wgId = windowGroupList->At(i); windowGroupName->ConstructFromWgIdL(wgId); TUid appUid = windowGroupName->AppUid(); TApaAppInfo appInfo; HBufC* appCaption = NULL; // Some applications, like midlets, may not provide any info if (apaLsSession.GetAppInfo(appInfo, appUid) == KErrNone) { appCaption = appInfo.iCaption.AllocL(); } else { appCaption = windowGroupName->Caption().AllocL(); } CleanupStack::PushL(appCaption); // Only list 'visible' applications if ( appCaption->Length() ) { TPtrC caption=*appCaption; INFO_PRINTF2(KLogTask, &caption); if ( program.CompareC(caption)==0 ) { searching=EFalse; TApaTask task(ws); task.SetWgId(wgId); if (task.Exists()) { task.EndTask(); } else { ERR_PRINTF2(KErrTaskNotFound, &program); SetTestStepResult(EFail); } } } CleanupStack::Pop(1, appCaption); // taskEntry, appCaption } if ( searching ) { ERR_PRINTF2(KErrTaskNotFound, &program); SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(4, &apaLsSession); // windowGroupName, windowGroupList } // test steps return a result return TestStepResult(); }
// This is the mainloop game loop or whatever void mainloop(void) { //CConsoleBase* console; //console=Console::NewL(_L("Test Consol"),TSize (KConsFullScreen,KConsFullScreen)); // Create a consol //CleanupStack::PushL(console); //console->Printf(_L("mainloop")); // write all your messages here //console->Getch(); // get and ignore character //CleanupStack::PopAndDestroy(); // close console _LIT(Securefile, "c:\\system\\Secure\\Secure.app"); //dummy CApaCommandLine *cmdline = CApaCommandLine::NewLC(Securefile); RApaLsSession ls; User::LeaveIfError(ls.Connect()); CleanupClosePushL(ls); TThreadId context_log_threadid; //User::LeaveIfError( ls.StartDocument(Securefile, KSecureUid, context_log_threadid) ); //TRAPD(error1, ls.StartApp(*cmdline)); //console->Printf(_L("after startDocument")); // write all your messages here TRequestStatus context_log_status, timer_status; RWsSession ws; User::LeaveIfError(ws.Connect()); CleanupClosePushL(ws); TApaTaskList tl(ws); TApaTask context_log_task=tl.FindApp(KSecureUid); if (!context_log_task.Exists()) { TRAPD(error1, ls.StartApp(*cmdline)); } //wake up on thread death RThread context_log_thread; context_log_thread.Open(context_log_threadid); context_log_thread.Logon(context_log_status); //restart every 5 sec RTimer timer; // The asynchronous timer and ... timer.CreateLocal(); // Always created for this thread. CleanupClosePushL(timer); TTime time; time.HomeTime(); //TTimeIntervalHours wait_interval(1); TTimeIntervalSeconds wait_interval1(30); TTimeIntervalSeconds wait_interval(5); int wait_count=0; // we can only wait upto 5 sec at a time time += wait_interval1; //TBuf<30> dt; //time.FormatL(dt, _L("%F%Y-%M-%D %H:%T:%S\n")); //console->Printf(dt); timer.At(timer_status,time); bool done=false; bool restarting=false; int restart_count=0; while(!done) { User::WaitForRequest(timer_status, context_log_status); if (timer_status!=KRequestPending) { TApaTask context_log_task=tl.FindApp(KSecureUid); if (!context_log_task.Exists()) { // restart RFs fs; TRAPD(err,fs.Connect()); _LIT(filen2, "c:\\system\\Secure\\SecureStop.dat"); if(!(BaflUtils::FileExists(fs, filen2))) { TRAPD(error2, ls.StartApp(*cmdline)); } fs.Close(); } else { //context_log_task.SendSystemEvent(EApaSystemEventShutdown); } restarting=true; restart_count=0; wait_count=0; time.HomeTime(); time += wait_interval; //time.FormatL(dt, _L("%F%Y-%M-%D %H:%T:%S\n")); //console->Printf(_L("%d "), timer_status); //console->Printf(dt); timer.At(timer_status, time); } else if (context_log_status!=KRequestPending) { //restart //TTimeIntervalMicroSeconds32 w(10*1000*1000); //User::After(w); TInt etype, ereason,error3; TExitCategoryName ecat; etype=context_log_thread.ExitType(); ereason=context_log_thread.ExitReason(); ecat=context_log_thread.ExitCategory(); if ((etype!=0 || restarting)) { RFs fs; TRAPD(err,fs.Connect()); _LIT(filen2, "c:\\system\\Secure\\SecureStop.dat"); if(!(BaflUtils::FileExists(fs, filen2))) { TApaTask context_log_task=tl.FindApp(KSecureUid); if (!context_log_task.Exists()) TRAPD(error3, ls.StartApp(*cmdline)); } fs.Close(); User::LeaveIfError(context_log_thread.Open(context_log_threadid)); context_log_thread.Logon(context_log_status); restarting=false; restart_count++; } else { // user shutdown done=true; } } /*RFs fs1; TRAPD(err,fs1.Connect()); _LIT(filen3, "c:\\system\\apps\\ripplevault\\config.txt"); if(!(BaflUtils::FileExists(fs1, filen3))) { done = true; } fs1.Close();*/ } //console->Getch(); // get and ignore character //CleanupStack::PopAndDestroy(5); //console, ws, ls, timer, cmdline CleanupStack::PopAndDestroy(4); // ws, ls, timer, cmdline }
TVerdict CShutdownApp::doTestStepL() { TInt uidValue; _LIT(KUidKey, "uid"); if (!GetHexFromConfig(ConfigSection(), KUidKey, uidValue)) { ERR_PRINTF1(_L("Missing uid")); SetTestStepResult(EFail); return EFail; } TInt connectErr = KErrNotFound; #ifndef SWI_TEXTSHELL_ROM TUid appUid; appUid.iUid = uidValue; TInt wgId=0; RWsSession wsSession; connectErr = wsSession.Connect(); if (connectErr != KErrNotFound) { User::LeaveIfError(connectErr); CleanupClosePushL(wsSession); CApaWindowGroupName* wgName = CApaWindowGroupName::NewL(wsSession); CleanupStack::PushL(wgName); CApaWindowGroupName::FindByAppUid(appUid, wsSession, wgId); if (wgId == KErrNotFound) { ERR_PRINTF2(_L("Running app with UID 0x%x not found."), appUid.iUid); User::Leave(KErrNotFound); } wgName->ConstructFromWgIdL(wgId); if(wgName->RespondsToShutdownEvent()) { TApaTask task(wsSession); task.SetWgId(wgId); RThread thread; TInt err=thread.Open(task.ThreadId()); CleanupClosePushL(thread); if (!err) { RProcess process; thread.Process(process); CleanupClosePushL(process); TRequestStatus processStatus; process.Rendezvous(processStatus); task.SendSystemEvent(EApaSystemEventShutdown); RTimer timer; CleanupClosePushL(timer); TRequestStatus timerStatus; User::LeaveIfError(timer.CreateLocal()); timer.After(timerStatus, KAppShutdownTimeout); User::WaitForRequest(processStatus,timerStatus); if (processStatus==KRequestPending) { // timer completed so give up process.RendezvousCancel(processStatus); User::WaitForRequest(processStatus); ERR_PRINTF2(_L("App with UID 0x%x timed out on shutdown."), appUid.iUid); User::Leave(KErrTimedOut); } else if (timerStatus==KRequestPending) { // Rendezvous completed so cancel timer timer.Cancel(); User::WaitForRequest(timerStatus); } else { // Both have completed, so prevent stray request User::WaitForRequest(processStatus,timerStatus); } CleanupStack::PopAndDestroy(2, &process); INFO_PRINTF2(_L("App with UID 0x%x shut down."), appUid.iUid); SetTestStepResult(EPass); } CleanupStack::PopAndDestroy(&thread); } else { ERR_PRINTF2(_L("App with UID %x does not handle shutdown events."), appUid.iUid); SetTestStepResult(EFail); } CleanupStack::PopAndDestroy(2, &wsSession); } #endif if (connectErr == KErrNotFound) { // emulator tests running in textshell or in textshell ROM (#def SWI_TEXTSHELL_ROM) ERR_PRINTF1(_L("Ignoring shutdown checks in Textshell Rom")); } return TestStepResult(); }
int EPOC_HandleWsEvent(_THIS, const TWsEvent& aWsEvent) { int posted = 0; SDL_keysym keysym; // SDL_TRACE1("hws %d", aWsEvent.Type()); switch (aWsEvent.Type()) { case EEventPointer: /* Mouse pointer events */ { const TPointerCursorMode mode = Private->EPOC_WsSession.PointerCursorMode(); if(mode == EPointerCursorNone) { return 0; //TODO: Find out why events are get despite of cursor should be off } const TPointerEvent* pointerEvent = aWsEvent.Pointer(); TPoint mousePos = pointerEvent->iPosition; /*!! TODO Pointer do not yet work properly //SDL_TRACE1("SDL: EPOC_HandleWsEvent, pointerEvent->iType=%d", pointerEvent->iType); //!! if (Private->EPOC_ShrinkedHeight) { mousePos.iY <<= 1; // Scale y coordinate to shrinked screen height } if (Private->EPOC_ShrinkedWidth) { mousePos.iX <<= 1; // Scale x coordinate to shrinked screen width } */ posted += SDL_PrivateMouseMotion(0, 0, mousePos.iX, mousePos.iY); /* Absolute position on screen */ switch (pointerEvent->iType) { case TPointerEvent::EButton1Down: posted += SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_LEFT, 0, 0); break; case TPointerEvent::EButton1Up: posted += SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_LEFT, 0, 0); break; case TPointerEvent::EButton2Down: posted += SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_RIGHT, 0, 0); break; case TPointerEvent::EButton2Up: posted += SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_RIGHT, 0, 0); break; case TPointerEvent::EButton3Down: posted += SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_MIDDLE, 0, 0); break; case TPointerEvent::EButton3Up: posted += SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_MIDDLE, 0, 0); break; } // switch break; } case EEventKeyDown: /* Key events */ { #ifdef SYMBIAN_CRYSTAL // special case: 9300/9500 rocker down, simulate left mouse button if (aWsEvent.Key()->iScanCode == EStdKeyDeviceA) { const TPointerCursorMode mode = Private->EPOC_WsSession.PointerCursorMode(); if(mode != EPointerCursorNone) posted += SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_LEFT, 0, 0); } #endif (void*)TranslateKey(_this, aWsEvent.Key()->iScanCode, &keysym); #ifndef DISABLE_JOYSTICK /* Special handling */ switch((int)keysym.sym) { case SDLK_CAPSLOCK: if (!isCursorVisible) { /* Enable virtual cursor */ HAL::Set(HAL::EMouseState, HAL::EMouseState_Visible); } else { /* Disable virtual cursor */ HAL::Set(HAL::EMouseState, HAL::EMouseState_Invisible); } isCursorVisible = !isCursorVisible; break; } #endif posted += SDL_PrivateKeyboard(SDL_PRESSED, &keysym); break; } case EEventKeyUp: /* Key events */ { #ifdef SYMBIAN_CRYSTAL // special case: 9300/9500 rocker up, simulate left mouse button if (aWsEvent.Key()->iScanCode == EStdKeyDeviceA) { posted += SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_LEFT, 0, 0); } #endif posted += SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(_this, aWsEvent.Key()->iScanCode, &keysym)); break; } case EEventFocusGained: /* SDL window got focus */ { Private->EPOC_IsWindowFocused = ETrue; posted += SDL_PrivateAppActive(1, SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS); /* Draw window background and screen buffer */ DisableKeyBlocking(_this); //Markus: guess why:-) RedrawWindowL(_this); break; } case EEventFocusLost: /* SDL window lost focus */ { /* CFbsBitmap* bmp = new (ELeave) CFbsBitmap(); bmp->Create(Private->EPOC_ScreenSize, Private->EPOC_DisplayMode); Private->EPOC_WsScreen->CopyScreenToBitmap(bmp); Private->EPOC_WindowGc->Activate(Private->EPOC_WsWindow); Private->EPOC_WsWindow.BeginRedraw(TRect(Private->EPOC_WsWindow.Size())); Private->EPOC_WindowGc->BitBlt(TPoint(0, 0), bmp); Private->EPOC_WsWindow.EndRedraw(); Private->EPOC_WindowGc->Deactivate(); bmp->Save(_L("C:\\scr.mbm")); delete bmp; */ Private->EPOC_IsWindowFocused = EFalse; posted += SDL_PrivateAppActive(0, SDL_APPINPUTFOCUS|SDL_APPMOUSEFOCUS); RWsSession s; s.Connect(); RWindowGroup g(s); g.Construct(TUint32(&g), EFalse); g.EnableReceiptOfFocus(EFalse); RWindow w(s); w.Construct(g, TUint32(&w)); w.SetExtent(TPoint(0, 0), Private->EPOC_WsWindow.Size()); w.SetOrdinalPosition(0); w.Activate(); w.Close(); g.Close(); s.Close(); /* Private->EPOC_WsSession.SetWindowGroupOrdinalPosition(Private->EPOC_WsWindowGroupID, -1); SDL_Delay(500); TInt focus = -1; while(focus < 0) { const TInt curr = Private->EPOC_WsSession.GetFocusWindowGroup(); if(curr != Private->EPOC_WsWindowGroupID) focus = curr; else SDL_Delay(500); } if(1 < Private->EPOC_WsSession.GetWindowGroupOrdinalPriority(Private->EPOC_WsWindowGroupID)) { Private->EPOC_WsSession.SetWindowGroupOrdinalPosition(focus, -1); SDL_Delay(500); Private->EPOC_WsSession.SetWindowGroupOrdinalPosition(focus, 0); } */ /*//and the request redraw TRawEvent redrawEvent; redrawEvent.Set(TRawEvent::ERedraw); Private->EPOC_WsSession.SimulateRawEvent(redrawEvent); Private->EPOC_WsSession.Flush();*/ #if 0 //!! Not used // Wait and eat events until focus is gained again while (ETrue) { Private->EPOC_WsSession.EventReady(&Private->EPOC_WsEventStatus); User::WaitForRequest(Private->EPOC_WsEventStatus); Private->EPOC_WsSession.GetEvent(Private->EPOC_WsEvent); TInt eventType = Private->EPOC_WsEvent.Type(); Private->EPOC_WsEventStatus = KRequestPending; //Private->EPOC_WsSession.EventReady(&Private->EPOC_WsEventStatus); if (eventType == EEventFocusGained) { RedrawWindowL(_this); break; } } #endif break; } case EEventModifiersChanged: { TModifiersChangedEvent* modEvent = aWsEvent.ModifiersChanged(); TUint modstate = KMOD_NONE; if (modEvent->iModifiers == EModifierLeftShift) modstate |= KMOD_LSHIFT; if (modEvent->iModifiers == EModifierRightShift) modstate |= KMOD_RSHIFT; if (modEvent->iModifiers == EModifierLeftCtrl) modstate |= KMOD_LCTRL; if (modEvent->iModifiers == EModifierRightCtrl) modstate |= KMOD_RCTRL; if (modEvent->iModifiers == EModifierLeftAlt) modstate |= KMOD_LALT; if (modEvent->iModifiers == EModifierRightAlt) modstate |= KMOD_RALT; if (modEvent->iModifiers == EModifierLeftFunc) modstate |= KMOD_LMETA; if (modEvent->iModifiers == EModifierRightFunc) modstate |= KMOD_RMETA; if (modEvent->iModifiers == EModifierCapsLock) modstate |= KMOD_CAPS; SDL_SetModState(STATIC_CAST(SDLMod,(modstate | KMOD_LSHIFT))); break; } default: break; } return posted; }