本文整理汇总了C++中TWsEvent::SetType方法的典型用法代码示例。如果您正苦于以下问题:C++ TWsEvent::SetType方法的具体用法?C++ TWsEvent::SetType怎么用?C++ TWsEvent::SetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TWsEvent
的用法示例。
在下文中一共展示了TWsEvent::SetType方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: RunL
/**
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();
}
}
示例2: CloseDialogsL
/**
Utility to close the dialogs once the screen has been compared
with a previous capture of an expected display.
*/
void CConeErrorMsgTestAppUi::CloseDialogsL()
{
User::LeaveIfError(iWs.Connect());
TInt wgFocus = iWs.GetFocusWindowGroup();
const TUint32 ENullWsHandle = 0xFFFFFFFF; // Events delivered to this handle are thrown away
RWindowGroup wg = RWindowGroup(iWs);
wg.Construct(ENullWsHandle);
TInt wgId = wg.Identifier();
TWsEvent event;
event.SetType(EEventKey);
TKeyEvent *keyEvent = event.Key();
keyEvent->iCode = EKeyEscape;
keyEvent->iScanCode = EStdKeyEscape;
keyEvent->iModifiers = 0;
TInt limit = 0;
for(limit = 0; wgFocus != wgId && (limit < 50); limit++)
{
iWs.SendEventToAllWindowGroups(event);
wgFocus = iWs.GetFocusWindowGroup();
RDebug::Print(_L("CloseAllPanicWindowsL() - EKeyEscape sent to Windows Group"));
}
wg.Close();
iWs.Close();
}
示例3: showDebugMessage
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);
}
}
}
示例4: SendMessageToSysAp
void CAknKeyLockControl::SendMessageToSysAp(TInt aMessage)
{
RWsSession& ws = iEikonEnv->WsSession();
TInt wgId=0;
CApaWindowGroupName::FindByAppUid(KSysApUid, ws, wgId);
if (wgId)
{
TWsEvent event;
event.SetType(aMessage);
event.SetTimeNow();
ws.SendEventToWindowGroup(wgId, event);
}
}
示例5: RedrawRequest
EXPORT_C TInt CSDL::RedrawRequest()
{
if(gEpocEnv && gEpocEnv->iDsa)
{
//const TInt err = gEpocEnv->iDsa->RedrawRequest();
TWsEvent event;
event.SetType(EEventScreenDeviceChanged),
event.SetTimeNow();
AppendWsEvent(event);/*
EpocSdlEnv::PostUpdate();
return err; */
}
return KErrNotReady;
}
示例6: SendEventToWindowGroups
/**
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();
}
示例7: Fail
/** Fetches a message
*/
TInt COomMessageFetch::Fail()
{
TWsEvent event;
TPtr8 ptr(NULL,0);
TUid uid;
event.SetType(EEventMessageReady);
event.SetHandle(CLIENT_HANDLE);
event.SetTimeNow();
SEventMessageReady& eventMessageReady=*(SEventMessageReady*)event.EventData();
eventMessageReady.iWindowGroupIdentifier=iWinGroup2.Identifier();
eventMessageReady.iMessageUid=TUid::Uid(UID_VALUE);
eventMessageReady.iMessageParametersSize=MESSAGE_LEN;
TInt ret=TheClient->iWs.FetchMessage(uid,ptr,event);
if (ret==KErrNone)
User::Free((TAny *)ptr.Ptr());
return(ret);
}
示例8: SendWindowEvent
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);
}
}
示例9: SendMessageToApp
void CAppOomMonitorPlugin::SendMessageToApp(TInt aMessage)
{
RWsSession& ws = WsSession();
TInt wgId = 0;
do
{
CApaWindowGroupName::FindByAppUid(iAppUid, ws, wgId);
if (wgId>0)
{
TWsEvent event;
event.SetType(aMessage);
event.SetTimeNow();
ws.SendEventToWindowGroup(wgId, event);
}
}
while (wgId>0);
}
示例10: SendWindowEvent
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);
}
}
示例11: ObserverEvent
TInt CSdlAppServ::ObserverEvent(TInt aEvent, TInt aParam)
{
if(iObserver != NULL)
{
if(RThread().Id() == iMainId)
{
return iObserver->SdlEvent(aEvent, aParam);
}
else if(RThread().Id() == gEpocEnv->iId && EnvUtils::IsOwnThreaded())
{
return iObserver->SdlThreadEvent(aEvent, aParam);
}
else
{
TWsEvent event;
event.SetType(ESDLWsEvent);
TInt load[] = {aEvent, aParam};
Mem::Copy(event.EventData(), load, sizeof(TInt) * 2);
event.SetTimeNow();
EpocSdlEnv::EventQueue().Append(event);
}
}
return 0;
}
示例12: SwitchMemMode
void CMemoryMonitor::SwitchMemMode(TGOomMemMode aMemMode, TBool aForced)
{
if(iMemMode == aMemMode)
{
if(iMemMode == EGOomGoodMemMode)
{
TRACES("CMemoryMonitor::SwitchMemMode NOT switching rendering mode. Already in GOOD Mode");
}
else
{
TRACES("CMemoryMonitor::SwitchMemMode NOT switching rendering mode. Already in LOW Mode");
}
return;
}
#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
TWsEvent event;
if(aMemMode == EGOomLowMemMode)
{
if(!aForced)
{
if(iRendswitched < 3)
iRendswitched ++;
else
return;
}
iLowOnMemWgs.Reset();
iGOomWindowGroupList->GetListOfWindowGroupsWSurfaces(iLowOnMemWgs);
event.SetType(KGoomMemoryLowEvent);
TRACES("CMemoryMonitor::SwitchMemMode. Switching rendering mode to SW, Sending KGoomMemoryLowEvent");
}
else
{
if(!aForced)
{
if(iRendswitched > 0)
{
if(iRendswitched < 3)
iRendswitched ++;
else
{
TRACES("CMemoryMonitor::SwitchMemMode GOOM Detected SW-HW-SW looping. NOT switching to HW rendering mode");
return;
}
}
}
event.SetType(KGoomMemoryGoodEvent);
TRACES("CMemoryMonitor::SwitchMemMode. Switching rendering mode to HW, Sending KGoomMemoryGoodEvent");
}
for (TInt i = iLowOnMemWgs.Count()-1; i>=0; i--)
{
iWs.SendEventToWindowGroup(iLowOnMemWgs[i], event);
TRACES1("CMemoryMonitor::SwitchMemMode. Sending event to wg %d",iLowOnMemWgs[i]);
}
#endif
iMemMode = aMemMode;
}
示例13: TestMessageQueueOverflowL
/**
Test delivery group messages in case when event queue is overflow
*/
void CTMessage::TestMessageQueueOverflowL()
{
const TInt numMaxMessages = 60;
TInt numWasteMessages = 0;
TInt numWgMessages = 5;
TInt gotRealWasteMessages = 0;
TInt gotRealWgMessages = 0;
const TInt oneSecond = 1000000;
const TInt allPossibleMessages = 500;
RWsSession senderWsSession;
RWindowGroup senderGroupWin;
TInt sndrHanGrpWin = 7777;
RWsSession receiverWsSession;
RWindowGroup receiverGroupWin;
TInt rcvrHanGrpWin = 8888;
TRequestStatus testStatus;
TRequestStatus timerStatus;
TWsEvent wasteEvent;
TWsEvent event;
RTimer timer;
timer.CreateLocal();
CleanupClosePushL(timer);
// Create sender WsSession and the window group
User::LeaveIfError(senderWsSession.Connect());
CleanupClosePushL(senderWsSession);
senderGroupWin = RWindowGroup(senderWsSession);
User::LeaveIfError(senderGroupWin.Construct(sndrHanGrpWin));
CleanupClosePushL(senderGroupWin);
// Create reciever WsSession and the window group
User::LeaveIfError(receiverWsSession.Connect());
CleanupClosePushL(receiverWsSession);
receiverGroupWin = RWindowGroup(receiverWsSession);
User::LeaveIfError(receiverGroupWin.Construct(rcvrHanGrpWin));
CleanupClosePushL(receiverGroupWin);
TInt err = KErrNone;
// Send waste events to the receiver and overflow the event queue
for (TInt ind = 0; ind < numMaxMessages; ind++)
{
wasteEvent.SetType(sndrHanGrpWin);
err = senderWsSession.SendEventToWindowGroup(receiverGroupWin.Identifier(), wasteEvent);
if (err != KErrNone)
{
numWasteMessages = ind; // Real number waste messages that was sent
break;
}
}
// Send messages to the receiver
for (TInt ind = 0; ind < numWgMessages; ind++)
{
TInt uidData = ind + sndrHanGrpWin;
TPtr8 msg((unsigned char*) &uidData, sizeof(uidData));
err = senderWsSession.SendMessageToWindowGroup(receiverGroupWin.Identifier(), TUid::Uid(uidData), msg);
if (err != KErrNone)
{
LOG_MESSAGE2(_L("UnExpected Error Code = %d"),err);
numWgMessages = ind; // Real number window group messages that was sent
}
}
// Check and count sent messages
for (TInt ind = 0; ind < allPossibleMessages; ind++)
{
receiverWsSession.EventReady(&testStatus);
timer.After(timerStatus, oneSecond);
User::WaitForRequest(testStatus, timerStatus);
if (testStatus == 0)
{
// Test incoming events
receiverWsSession.GetEvent(event);
if (event.Type() == sndrHanGrpWin)
{
++gotRealWasteMessages;
}
else if (event.Type() == EEventMessageReady)
{
if (gotRealWgMessages == 0)
{
for (TInt ind = 0; ind < numMaxMessages; ind++)
{
wasteEvent.SetType(sndrHanGrpWin);
err = senderWsSession.SendEventToWindowGroup(receiverGroupWin.Identifier(), wasteEvent);
if (err == KErrNone)
{
++numWasteMessages;
//.........这里部分代码省略.........
示例14: SetupL
void CWsGceCscBase::SetupL()
{
iDoTearDown=ETrue;
iRed.SetInternal(0xFFFF0000);
iGreen.SetInternal(0xFF00FF00);
iBlue.SetInternal(0xFF0000FF);
iCyan.SetInternal(0xFF00FFFF);
iMagenta.SetInternal(0xFFFF00FF);
iYellow.SetInternal(0xFFFFFF00);
iWhite.SetInternal(0xFFFFFFFF);
ASSERT_EQUALS_X(iSession.Connect(), KErrNone);
{//Stolen from TAuto CloseAllPanicWindows()
TInt idFocus = iSession.GetFocusWindowGroup();
TWsEvent event;
event.SetType(EEventKey); //EEventKeyDown
TKeyEvent *keyEvent = event.Key();
keyEvent->iCode = EKeyEscape;
keyEvent->iScanCode = EStdKeyEscape;
keyEvent->iModifiers = 0;
TInt theLimit = 50;
while(idFocus != NULL && (theLimit-- > 0))
{
iSession.SendEventToAllWindowGroups(event);
TInt idNewFocus = iSession.GetFocusWindowGroup();
if (idNewFocus!=idFocus)
{
INFO_PRINTF1(_L("A window was closed [probably a panic box from the previous test]."));
}
idFocus=idNewFocus;
}
}
TInt err = KErrNone;
TRAP(err, iScreenDevice = new (ELeave) CWsScreenDevice(iSession));
PRINT_ON_ERROR2_L(err, _L("Failed to create screen device: %d"), err);
ASSERT_EQUALS_X(iScreenDevice->Construct(TGlobalSettings::Instance().iScreen), KErrNone);
iDisplayMode = iScreenDevice->DisplayMode(); // Get default display mode
TRAP(err, iGc = new (ELeave) CWindowGc(iScreenDevice));
PRINT_ON_ERROR2_L(err, _L("Failed to create graphics context: %d"), err);
ASSERT_EQUALS_X(iGc->Construct(), KErrNone);
iGroup = RWindowGroup(iSession);
ASSERT_EQUALS_X(iGroup.Construct(++iWindowHandle,iScreenDevice), KErrNone);
iSession.Flush();
RWindow testTrans(iSession);
ASSERT_EQUALS_X(testTrans.Construct(iGroup, ++iWindowHandle), KErrNone);
iTransparencyEnabled=(testTrans.SetTransparencyFactor(iWhite)==KErrNone);
testTrans.Close();
//clean-up if previous test abended
if (PostTestCleanupInstance().iSharedUtility)
{
//Temp removed - may be causing ONB fails!
// if (PostTestCleanupInstance().iSharedUtility->DestroyAll())
// {
// INFO_PRINTF1(_L("Destroyed some surfaces from previous test."));
//
// }
}
if (!PostTestCleanupInstance().iCleanedUpOnExit)
PostTestCleanupInstance().iCleanedUpOnExit=EFalse;
if (!GCEIsSupported())
{
INFO_PRINTF1(_L("Some Setup skipped: GCE support is not loaded"));
return;
}
TRAPD(err_FailedToCreateSurfaceUtility, iUtility = CSurfaceUtility::NewL( PostTestCleanupInstance().iSharedUtility));
ASSERT_EQUALS(err_FailedToCreateSurfaceUtility,KErrNone);
}