Example #1
0
void InputService::cancel(EventId id, InputEvent* evt, InputUser* user, InputDevice* device, InputSource* source, InputCommand* command)
{
	for (EventQueue::iterator itr = _eventQueue.begin(); itr != _eventQueue.end(); )
	{
		EventEntry& entry = *itr;
		if (id && entry.eventID != id) ++itr;
		else
		{
			InputEvent* e = entry.event;
			if (evt && e != evt) ++itr;
			else if (user && !e->isRelated(user)) ++itr;
			else if (device && !e->isRelated(device)) ++itr;
			else if (source && !e->isRelated(source)) ++itr;
			else if (command && !e->isRelated(command)) ++itr;
			else
				_eventQueue.erase(itr++);
		}
	}
}