void CInputFilter::CKeystrokeAction::perform(const CEvent& event) { CEvent::Type type = m_press ? IPlatformScreen::getKeyDownEvent(*EVENTQUEUE) : IPlatformScreen::getKeyUpEvent(*EVENTQUEUE); EVENTQUEUE->addEvent(CEvent(IPlatformScreen::getFakeInputBeginEvent(), event.getTarget(), NULL, CEvent::kDeliverImmediately)); EVENTQUEUE->addEvent(CEvent(type, event.getTarget(), m_keyInfo, CEvent::kDeliverImmediately | CEvent::kDontFreeData)); EVENTQUEUE->addEvent(CEvent(IPlatformScreen::getFakeInputEndEvent(), event.getTarget(), NULL, CEvent::kDeliverImmediately)); }
CInputFilter::EFilterStatus CInputFilter::CMouseButtonAction::perform( CEvent& event, void*, EActionMode actionMode) { EActionState newState = switchMode(actionMode); CEvent::Type type; if (newState == kStateOn) { type = IPlatformScreen::getButtonDownEvent(); } else if (newState == kStateOff) { type = IPlatformScreen::getButtonUpEvent(); } else { return kNotHandled; } setState(newState); event = CEvent(type, event.getTarget(), m_buttonInfo, CEvent::kDeliverImmediately | CEvent::kDontFreeData); return kHandled; }
void NetworkTests::sendToServer_mockFile_fileRecieveCompleted(const CEvent& event, void*) { CServer* server = reinterpret_cast<CServer*>(event.getTarget()); EXPECT_TRUE(server->isReceivedFileSizeValid()); m_events.raiseQuitEvent(); }
void NetworkTests::sendToClient_mockFile_fileRecieveCompleted(const CEvent& event, void*) { CClient* client = reinterpret_cast<CClient*>(event.getTarget()); EXPECT_TRUE(client->isReceivedFileSizeValid()); m_events.raiseQuitEvent(); }
void CInputFilter::CSwitchInDirectionAction::perform(const CEvent& event) { CServer::CSwitchInDirectionInfo* info = CServer::CSwitchInDirectionInfo::alloc(m_direction); EVENTQUEUE->addEvent(CEvent(CServer::getSwitchInDirectionEvent(), event.getTarget(), info, CEvent::kDeliverImmediately)); }
void CIpcServer::handleClientDisconnected(const CEvent& e, void*) { CIpcClientProxy* proxy = static_cast<CIpcClientProxy*>(e.getTarget()); CArchMutexLock lock(m_clientsMutex); m_clients.remove(proxy); deleteClient(proxy); LOG((CLOG_DEBUG "ipc client proxy removed, connected=%d", m_clients.size())); }
void CInputFilter::CMouseButtonAction::perform(const CEvent& event) { // send modifiers IPlatformScreen::CKeyInfo* modifierInfo = NULL; if (m_buttonInfo->m_mask != 0) { KeyID key = m_press ? kKeySetModifiers : kKeyClearModifiers; modifierInfo = IKeyState::CKeyInfo::alloc(key, m_buttonInfo->m_mask, 0, 1); EVENTQUEUE->addEvent(CEvent(IPlatformScreen::getKeyDownEvent(*EVENTQUEUE), event.getTarget(), modifierInfo, CEvent::kDeliverImmediately)); } // send button CEvent::Type type = m_press ? IPlatformScreen::getButtonDownEvent() : IPlatformScreen::getButtonUpEvent(); EVENTQUEUE->addEvent(CEvent(type, event.getTarget(), m_buttonInfo, CEvent::kDeliverImmediately | CEvent::kDontFreeData)); }
bool CEventQueue::dispatchEvent(const CEvent& event) { void* target = event.getTarget(); IEventJob* job = getHandler(event.getType(), target); if (job == NULL) { job = getHandler(CEvent::kUnknown, target); } if (job != NULL) { job->run(event); return true; } return false; }
void CInputFilter::CKeyboardBroadcastAction::perform(const CEvent& event) { static const CServer::CKeyboardBroadcastInfo::State s_state[] = { CServer::CKeyboardBroadcastInfo::kOff, CServer::CKeyboardBroadcastInfo::kOn, CServer::CKeyboardBroadcastInfo::kToggle }; // send event CServer::CKeyboardBroadcastInfo* info = CServer::CKeyboardBroadcastInfo::alloc(s_state[m_mode], m_screens); EVENTQUEUE->addEvent(CEvent(CServer::getKeyboardBroadcastEvent(), event.getTarget(), info, CEvent::kDeliverImmediately)); }
void CInputFilter::CLockCursorToScreenAction::perform(const CEvent& event) { static const CServer::CLockCursorToScreenInfo::State s_state[] = { CServer::CLockCursorToScreenInfo::kOff, CServer::CLockCursorToScreenInfo::kOn, CServer::CLockCursorToScreenInfo::kToggle }; // send event CServer::CLockCursorToScreenInfo* info = CServer::CLockCursorToScreenInfo::alloc(s_state[m_mode]); EVENTQUEUE->addEvent(CEvent(CServer::getLockCursorToScreenEvent(), event.getTarget(), info, CEvent::kDeliverImmediately)); }
CInputFilter::EFilterStatus CInputFilter::CSwitchInDirectionAction::perform( CEvent& event, void*, EActionMode actionMode) { // only process "on" or "trigger" action modes if (actionMode != kModeTrigger && actionMode != kModeTurnOn) { return kNotHandled; } CServer::CSwitchInDirectionInfo* info = CServer::CSwitchInDirectionInfo::alloc(m_direction); event = CEvent(CServer::getSwitchInDirectionEvent(), event.getTarget(), info, CEvent::kDeliverImmediately); return kHandled; }
void CInputFilter::CSwitchToScreenAction::perform(const CEvent& event) { // pick screen name. if m_screen is empty then use the screen from // event if it has one. CString screen = m_screen; if (screen.empty() && event.getType() == CServer::getConnectedEvent()) { CServer::CScreenConnectedInfo* info = reinterpret_cast<CServer::CScreenConnectedInfo*>(event.getData()); screen = info->m_screen; } // send event CServer::CSwitchToScreenInfo* info = CServer::CSwitchToScreenInfo::alloc(screen); EVENTQUEUE->addEvent(CEvent(CServer::getSwitchToScreenEvent(), event.getTarget(), info, CEvent::kDeliverImmediately)); }
CInputFilter::EFilterStatus CInputFilter::CLockCursorToScreenAction::perform( CEvent& event, void*, EActionMode actionMode) { EActionState newState = switchMode(actionMode); if (newState != kStateOn && newState != kStateOff) { return kNotHandled; } setState(newState); // prepare event CServer::CLockCursorToScreenInfo* info = CServer::CLockCursorToScreenInfo::alloc(newState != kStateOff); event = CEvent(CServer::getLockCursorToScreenEvent(), event.getTarget(), info, CEvent::kDeliverImmediately); return kHandled; }