当前位置: 首页>>代码示例>>C++>>正文


C++ CEvent::getType方法代码示例

本文整理汇总了C++中CEvent::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ CEvent::getType方法的具体用法?C++ CEvent::getType怎么用?C++ CEvent::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CEvent的用法示例。


在下文中一共展示了CEvent::getType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: lock

void
CEventQueue::addEvent(const CEvent& event)
{
	// discard bogus event types
	switch (event.getType()) {
	case CEvent::kUnknown:
	case CEvent::kSystem:
	case CEvent::kTimer:
		return;

	default:
		break;
	}
	
	if ((event.getFlags() & CEvent::kDeliverImmediately) != 0) {
		dispatchEvent(event);
		CEvent::deleteData(event);
	}
	else {
		CArchMutexLock lock(m_mutex);
		
		// store the event's data locally
		UInt32 eventID = saveEvent(event);
		
		// add it
		if (!m_buffer->addEvent(eventID)) {
			// failed to send event
			removeEvent(eventID);
			CEvent::deleteData(event);
		}
	}
}
开发者ID:rakete,项目名称:synergy-foss,代码行数:32,代码来源:CEventQueue.cpp

示例2: if

CInputFilter::EFilterStatus		
CInputFilter::CMouseButtonCondition::match(const CEvent& event)
{
	static const KeyModifierMask s_ignoreMask =
		KeyModifierAltGr | KeyModifierCapsLock |
		KeyModifierNumLock | KeyModifierScrollLock;

	EFilterStatus status;

	// check for hotkey events
	CEvent::Type type = event.getType();
	if (type == IPrimaryScreen::getButtonDownEvent()) {
		status = kActivate;
	}
	else if (type == IPrimaryScreen::getButtonUpEvent()) {
		status = kDeactivate;
	}
	else {
		return kNoMatch;
	}

	// check if it's the right button and modifiers.  ignore modifiers
	// that cannot be combined with a mouse button.
	IPlatformScreen::CButtonInfo* minfo =
		reinterpret_cast<IPlatformScreen::CButtonInfo*>(event.getData());
	if (minfo->m_button != m_button ||
		(minfo->m_mask & ~s_ignoreMask) != m_mask) {
		return kNoMatch;
	}

	return status;
}
开发者ID:ali1234,项目名称:synergy-old,代码行数:32,代码来源:CInputFilter.cpp

示例3:

void
CInputFilter::sendEvent(CEvent& event)
{
	CEvent::Type type = event.getType();
	// process keyboard modifiers here
	if (type == IPlatformScreen::getKeyDownEvent() ||
		type == IPlatformScreen::getKeyUpEvent() || 
		type == IPlatformScreen::getKeyRepeatEvent()) {
		// get CKeyInfo from event
		IPlatformScreen::CKeyInfo* kinfo =
			reinterpret_cast<IPlatformScreen::CKeyInfo*>(event.getData());

		// save mask
		m_lastMask = kinfo->m_mask;

		// prepare new mask
		KeyModifierMask newMask = kinfo->m_mask;
		updateModifiers();
		newMask &= ~m_clearMask;
		newMask |= m_modifierMask;

		// set new mask
		kinfo->m_mask = newMask;
	}

	// add event to eventqueue
	EVENTQUEUE->addEvent(event);
}
开发者ID:svn2github,项目名称:synergy-plus,代码行数:28,代码来源:CInputFilter.cpp

示例4:

void
CServerApp::closeServer(CServer* server)
{
	if (server == NULL) {
		return;
	}

	// tell all clients to disconnect
	server->disconnect();

	// wait for clients to disconnect for up to timeout seconds
	double timeout = 3.0;
	CEventQueueTimer* timer = EVENTQUEUE->newOneShotTimer(timeout, NULL);
	EVENTQUEUE->adoptHandler(CEvent::kTimer, timer,
		new TMethodEventJob<CServerApp>(this, &CServerApp::handleClientsDisconnected));
	EVENTQUEUE->adoptHandler(CServer::getDisconnectedEvent(), server,
		new TMethodEventJob<CServerApp>(this, &CServerApp::handleClientsDisconnected));
	CEvent event;
	EVENTQUEUE->getEvent(event);
	while (event.getType() != CEvent::kQuit) {
		EVENTQUEUE->dispatchEvent(event);
		CEvent::deleteData(event);
		EVENTQUEUE->getEvent(event);
	}
	EVENTQUEUE->removeHandler(CEvent::kTimer, timer);
	EVENTQUEUE->deleteTimer(timer);
	EVENTQUEUE->removeHandler(CServer::getDisconnectedEvent(), server);

	// done with server
	delete server;
}
开发者ID:axelson,项目名称:synergy-plus,代码行数:31,代码来源:CServerApp.cpp

示例5: if

CInputFilter::EFilterStatus
CInputFilter::CKeystrokeCondition::match(CEvent& event, void*,
				EActionMode& outMode)
{
	// check for hotkey events
	CEvent::Type type = event.getType();
	if (type == IPrimaryScreen::getHotKeyDownEvent()) {
		outMode = kModeTurnOn;
	}
	else if (type == IPrimaryScreen::getHotKeyUpEvent()) {
		outMode = kModeTurnOff;
	}
	else {
		return kNoMatch;
	}

	// check if it's our hotkey
	IPrimaryScreen::CHotKeyInfo* kinfo =
		reinterpret_cast<IPlatformScreen::CHotKeyInfo*>(event.getData());
	if (kinfo->m_id != m_id) {
		return kNoMatch;
	}

	// convert event type for toggled conditions
	if (getActionMode() != kModePass) {
		if (type != IPlatformScreen::getHotKeyDownEvent()) {
			return kDiscard;
		}
		outMode = getActionMode();
	}
	return kMatch;
}
开发者ID:svn2github,项目名称:synergy-plus,代码行数:32,代码来源:CInputFilter.cpp

示例6:

void
CEventQueue::loop()
{
	CEvent event;
	getEvent(event);
	while (event.getType() != CEvent::kQuit) {
		dispatchEvent(event);
		CEvent::deleteData(event);
		getEvent(event);
	}
}
开发者ID:rakete,项目名称:synergy-foss,代码行数:11,代码来源:CEventQueue.cpp

示例7: lock

void
CPacketStreamFilter::filterEvent(const CEvent& event)
{
    if (event.getType() == getInputReadyEvent()) {
        CLock lock(&m_mutex);
        if (!readMore()) {
            return;
        }
    }
    else if (event.getType() == getInputShutdownEvent()) {
        // discard this if we have buffered data
        CLock lock(&m_mutex);
        m_inputShutdown = true;
        if (m_size != 0) {
            return;
        }
    }

    // pass event
    CStreamFilter::filterEvent(event);
}
开发者ID:undecided,项目名称:synergy,代码行数:21,代码来源:CPacketStreamFilter.cpp

示例8:

CInputFilter::EFilterStatus
CInputFilter::CScreenConnectedCondition::match(const CEvent& event)
{
	if (event.getType() == CServer::getConnectedEvent()) {
		CServer::CScreenConnectedInfo* info = 
			reinterpret_cast<CServer::CScreenConnectedInfo*>(event.getData());
		if (m_screen == info->m_screen || m_screen.empty()) {
			return kActivate;
		}
	}

	return kNoMatch;
}
开发者ID:ali1234,项目名称:synergy-old,代码行数:13,代码来源:CInputFilter.cpp

示例9: dummyScreen

void
CDaemonApp::mainLoop(bool logToFile)
{
	try
	{
		DAEMON_RUNNING(true);

		if (logToFile)
			CLOG->insert(new CFileLogOutputter(logPath().c_str()));

		CEventQueue eventQueue;

#if SYSAPI_WIN32
		// HACK: create a dummy screen, which can handle system events 
		// (such as a stop request from the service controller).
		CMSWindowsScreen::init(CArchMiscWindows::instanceWin32());
		CScreen dummyScreen(new CMSWindowsScreen(false, true, false));

		string command = ARCH->setting("Command");
		if (command != "") {
			LOG((CLOG_INFO "using last known command: %s", command.c_str()));
			m_relauncher.command(command);
		}

		m_relauncher.startAsync();
#endif

		CEvent event;
		EVENTQUEUE->getEvent(event);
		while (event.getType() != CEvent::kQuit) {
			EVENTQUEUE->dispatchEvent(event);
			CEvent::deleteData(event);
			EVENTQUEUE->getEvent(event);
		}

#if SYSAPI_WIN32
		m_relauncher.stop();
#endif

		DAEMON_RUNNING(false);
	}
	catch (XArch& e) {
		LOG((CLOG_ERR, e.what().c_str()));
	}
	catch (std::exception& e) {
		LOG((CLOG_ERR, e.what()));
	}
	catch (...) {
		LOG((CLOG_ERR, "Unrecognized error."));
	}
}
开发者ID:brainiac,项目名称:SynergyKM,代码行数:51,代码来源:CDaemonApp.cpp

示例10: getHandler

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;
}
开发者ID:rakete,项目名称:synergy-foss,代码行数:14,代码来源:CEventQueue.cpp

示例11:

void
CEvent::deleteData(const CEvent& event)
{
	switch (event.getType()) {
	case kUnknown:
	case kQuit:
	case kSystem:
	case kTimer:
		break;

	default:
		free(event.getData());
		break;
	}
}
开发者ID:svn2github,项目名称:synergy-plus,代码行数:15,代码来源:CEvent.cpp

示例12: evt

void
CInputFilter::handleEvent(const CEvent& event, void* arg)
{
	// get a modifiable copy of this event.
	// set target to us, set kDontFreeData and kDeliverImmediately because the
	// original event will be destroyed after this method exits.
	CEvent evt(event.getType(), this, event.getData(),
								event.getFlags() | CEvent::kDontFreeData |
								CEvent::kDeliverImmediately);

	// clear dirty flag
	m_dirtyFlag = kNotDirty;

	EActionMode	actionMode = kModePass;
	// match event against filter rules and perform actions
	for (CRuleList::iterator rule  = m_ruleList.begin();
							 rule != m_ruleList.end(); ++rule) {
		EFilterStatus conditionStatus;
		EFilterStatus actionStatus;
		conditionStatus = rule->first->match(evt, arg, actionMode);
		if (conditionStatus == kDiscard) {
			return;
		}
		else if (conditionStatus == kNoMatch) {
			continue;
		}

		actionStatus = rule->second->perform(evt, arg, actionMode);
		if (actionStatus == kDiscard) {
			// discard event
			return;
		}
		else if (actionStatus == kNotHandled) {
			continue;
		}
		else if (actionStatus == kUpdateModifiers) {
			updateModifiers();
			return;
		}

		// if we got here then the rule has matched and action returned
		// kHandled, so send the event.
		break;
	}

	sendEvent(evt);
}
开发者ID:svn2github,项目名称:synergy-plus,代码行数:47,代码来源:CInputFilter.cpp

示例13:

void
CEvent::deleteData(const CEvent& event)
{
	switch (event.getType()) {
	case kUnknown:
	case kQuit:
	case kSystem:
	case kTimer:
		break;

	default:
		if ((event.getFlags() & kDontFreeData) == 0) {
			free(event.getData());
			delete event.getDataObject();
		}
		break;
	}
}
开发者ID:BogdanLivadariu,项目名称:synergy,代码行数:18,代码来源:Event.cpp

示例14: myEvent

void
CInputFilter::handleEvent(const CEvent& event, void*)
{
	// copy event and adjust target
	CEvent myEvent(event.getType(), this, event.getData(),
								event.getFlags() | CEvent::kDontFreeData |
								CEvent::kDeliverImmediately);

	// let each rule try to match the event until one does
	for (CRuleList::iterator rule  = m_ruleList.begin();
							 rule != m_ruleList.end(); ++rule) {
		if (rule->handleEvent(myEvent)) {
			// handled
			return;
		}
	}

	// not handled so pass through
	EVENTQUEUE->addEvent(myEvent);
}
开发者ID:ali1234,项目名称:synergy-old,代码行数:20,代码来源:CInputFilter.cpp

示例15:

void
CStreamFilter::filterEvent(const CEvent& event)
{
	EVENTQUEUE->dispatchEvent(CEvent(event.getType(),
						getEventTarget(), event.getData()));
}
开发者ID:JueSungMun,项目名称:SPWC,代码行数:6,代码来源:CStreamFilter.cpp


注:本文中的CEvent::getType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。