Apply tab to spaces filter to src folder

This commit is contained in:
XinyuHou
2016-12-28 11:50:32 +00:00
committed by Andrew Nelless
parent 4902b8674c
commit deea23f866
545 changed files with 41758 additions and 41758 deletions

View File

@@ -32,112 +32,112 @@ class EventQueueTimer { };
//
OSXEventQueueBuffer::OSXEventQueueBuffer(IEventQueue* events) :
m_event(NULL),
m_eventQueue(events),
m_carbonEventQueue(NULL)
m_event(NULL),
m_eventQueue(events),
m_carbonEventQueue(NULL)
{
// do nothing
// do nothing
}
OSXEventQueueBuffer::~OSXEventQueueBuffer()
{
// release the last event
if (m_event != NULL) {
ReleaseEvent(m_event);
}
// release the last event
if (m_event != NULL) {
ReleaseEvent(m_event);
}
}
void
OSXEventQueueBuffer::init()
{
m_carbonEventQueue = GetCurrentEventQueue();
m_carbonEventQueue = GetCurrentEventQueue();
}
void
OSXEventQueueBuffer::waitForEvent(double timeout)
{
EventRef event;
ReceiveNextEvent(0, NULL, timeout, false, &event);
EventRef event;
ReceiveNextEvent(0, NULL, timeout, false, &event);
}
IEventQueueBuffer::Type
OSXEventQueueBuffer::getEvent(Event& event, UInt32& dataID)
{
// release the previous event
if (m_event != NULL) {
ReleaseEvent(m_event);
m_event = NULL;
}
// release the previous event
if (m_event != NULL) {
ReleaseEvent(m_event);
m_event = NULL;
}
// get the next event
OSStatus error = ReceiveNextEvent(0, NULL, 0.0, true, &m_event);
// get the next event
OSStatus error = ReceiveNextEvent(0, NULL, 0.0, true, &m_event);
// handle the event
if (error == eventLoopQuitErr) {
event = Event(Event::kQuit);
return kSystem;
}
else if (error != noErr) {
return kNone;
}
else {
UInt32 eventClass = GetEventClass(m_event);
switch (eventClass) {
case 'Syne':
dataID = GetEventKind(m_event);
return kUser;
// handle the event
if (error == eventLoopQuitErr) {
event = Event(Event::kQuit);
return kSystem;
}
else if (error != noErr) {
return kNone;
}
else {
UInt32 eventClass = GetEventClass(m_event);
switch (eventClass) {
case 'Syne':
dataID = GetEventKind(m_event);
return kUser;
default:
event = Event(Event::kSystem,
m_eventQueue->getSystemTarget(), &m_event);
return kSystem;
}
}
default:
event = Event(Event::kSystem,
m_eventQueue->getSystemTarget(), &m_event);
return kSystem;
}
}
}
bool
OSXEventQueueBuffer::addEvent(UInt32 dataID)
{
EventRef event;
OSStatus error = CreateEvent(
kCFAllocatorDefault,
'Syne',
dataID,
0,
kEventAttributeNone,
&event);
EventRef event;
OSStatus error = CreateEvent(
kCFAllocatorDefault,
'Syne',
dataID,
0,
kEventAttributeNone,
&event);
if (error == noErr) {
assert(m_carbonEventQueue != NULL);
error = PostEventToQueue(
m_carbonEventQueue,
event,
kEventPriorityStandard);
ReleaseEvent(event);
}
return (error == noErr);
if (error == noErr) {
assert(m_carbonEventQueue != NULL);
error = PostEventToQueue(
m_carbonEventQueue,
event,
kEventPriorityStandard);
ReleaseEvent(event);
}
return (error == noErr);
}
bool
OSXEventQueueBuffer::isEmpty() const
{
EventRef event;
OSStatus status = ReceiveNextEvent(0, NULL, 0.0, false, &event);
return (status == eventLoopTimedOutErr);
EventRef event;
OSStatus status = ReceiveNextEvent(0, NULL, 0.0, false, &event);
return (status == eventLoopTimedOutErr);
}
EventQueueTimer*
OSXEventQueueBuffer::newTimer(double, bool) const
{
return new EventQueueTimer;
return new EventQueueTimer;
}
void
OSXEventQueueBuffer::deleteTimer(EventQueueTimer* timer) const
{
delete timer;
delete timer;
}