fixed: nothing happens on osx 10.6
This commit is contained in:
parent
5bb7a9fc7c
commit
75d2c5abf1
|
@ -96,6 +96,8 @@ CEventQueue::~CEventQueue()
|
||||||
void
|
void
|
||||||
CEventQueue::loop()
|
CEventQueue::loop()
|
||||||
{
|
{
|
||||||
|
m_buffer->init();
|
||||||
|
|
||||||
CEvent event;
|
CEvent event;
|
||||||
getEvent(event);
|
getEvent(event);
|
||||||
while (event.getType() != CEvent::kQuit) {
|
while (event.getType() != CEvent::kQuit) {
|
||||||
|
@ -594,9 +596,3 @@ CEventQueue::CTimer::operator<(const CTimer& t) const
|
||||||
{
|
{
|
||||||
return m_time < t.m_time;
|
return m_time < t.m_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
CEventQueue::cacheCurrentEventQueueRef()
|
|
||||||
{
|
|
||||||
m_buffer->cacheCurrentEventQueueRef();
|
|
||||||
}
|
|
||||||
|
|
|
@ -61,8 +61,6 @@ public:
|
||||||
getRegisteredType(const CString& name) const;
|
getRegisteredType(const CString& name) const;
|
||||||
void* getSystemTarget();
|
void* getSystemTarget();
|
||||||
|
|
||||||
void cacheCurrentEventQueueRef();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UInt32 saveEvent(const CEvent& event);
|
UInt32 saveEvent(const CEvent& event);
|
||||||
CEvent removeEvent(UInt32 eventID);
|
CEvent removeEvent(UInt32 eventID);
|
||||||
|
|
|
@ -33,6 +33,7 @@ public:
|
||||||
~CSimpleEventQueueBuffer();
|
~CSimpleEventQueueBuffer();
|
||||||
|
|
||||||
// IEventQueueBuffer overrides
|
// IEventQueueBuffer overrides
|
||||||
|
void init() { }
|
||||||
virtual void waitForEvent(double timeout);
|
virtual void waitForEvent(double timeout);
|
||||||
virtual Type getEvent(CEvent& event, UInt32& dataID);
|
virtual Type getEvent(CEvent& event, UInt32& dataID);
|
||||||
virtual bool addEvent(UInt32 dataID);
|
virtual bool addEvent(UInt32 dataID);
|
||||||
|
@ -40,7 +41,6 @@ public:
|
||||||
virtual CEventQueueTimer*
|
virtual CEventQueueTimer*
|
||||||
newTimer(double duration, bool oneShot) const;
|
newTimer(double duration, bool oneShot) const;
|
||||||
virtual void deleteTimer(CEventQueueTimer*) const;
|
virtual void deleteTimer(CEventQueueTimer*) const;
|
||||||
void cacheCurrentEventQueueRef() { }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::deque<UInt32> CEventDeque;
|
typedef std::deque<UInt32> CEventDeque;
|
||||||
|
|
|
@ -177,8 +177,6 @@ public:
|
||||||
registerTypeOnce(CEvent::Type& type,
|
registerTypeOnce(CEvent::Type& type,
|
||||||
const char* name) = 0;
|
const char* name) = 0;
|
||||||
|
|
||||||
virtual void cacheCurrentEventQueueRef() = 0;
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
|
|
@ -40,6 +40,12 @@ public:
|
||||||
//! @name manipulators
|
//! @name manipulators
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
//! Initialize
|
||||||
|
/*!
|
||||||
|
Useful for platform-specific initialisation from a specific thread.
|
||||||
|
*/
|
||||||
|
virtual void init() = 0;
|
||||||
|
|
||||||
//! Block waiting for an event
|
//! Block waiting for an event
|
||||||
/*!
|
/*!
|
||||||
Wait for an event in the event queue buffer for up to \p timeout
|
Wait for an event in the event queue buffer for up to \p timeout
|
||||||
|
@ -67,8 +73,6 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual bool addEvent(UInt32 dataID) = 0;
|
virtual bool addEvent(UInt32 dataID) = 0;
|
||||||
|
|
||||||
virtual void cacheCurrentEventQueueRef() = 0;
|
|
||||||
|
|
||||||
//@}
|
//@}
|
||||||
//! @name accessors
|
//! @name accessors
|
||||||
//@{
|
//@{
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
virtual ~CMSWindowsEventQueueBuffer();
|
virtual ~CMSWindowsEventQueueBuffer();
|
||||||
|
|
||||||
// IEventQueueBuffer overrides
|
// IEventQueueBuffer overrides
|
||||||
|
virtual void init() { }
|
||||||
virtual void waitForEvent(double timeout);
|
virtual void waitForEvent(double timeout);
|
||||||
virtual Type getEvent(CEvent& event, UInt32& dataID);
|
virtual Type getEvent(CEvent& event, UInt32& dataID);
|
||||||
virtual bool addEvent(UInt32 dataID);
|
virtual bool addEvent(UInt32 dataID);
|
||||||
|
@ -40,8 +41,6 @@ public:
|
||||||
newTimer(double duration, bool oneShot) const;
|
newTimer(double duration, bool oneShot) const;
|
||||||
virtual void deleteTimer(CEventQueueTimer*) const;
|
virtual void deleteTimer(CEventQueueTimer*) const;
|
||||||
|
|
||||||
virtual void cacheCurrentEventQueueRef() {}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DWORD m_thread;
|
DWORD m_thread;
|
||||||
UINT m_userEvent;
|
UINT m_userEvent;
|
||||||
|
|
|
@ -33,7 +33,7 @@ class CEventQueueTimer { };
|
||||||
COSXEventQueueBuffer::COSXEventQueueBuffer(IEventQueue* events) :
|
COSXEventQueueBuffer::COSXEventQueueBuffer(IEventQueue* events) :
|
||||||
m_eventQueue(events),
|
m_eventQueue(events),
|
||||||
m_event(NULL),
|
m_event(NULL),
|
||||||
m_threadEventQueueRef(NULL)
|
m_carbonEventQueue(NULL)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
|
@ -46,6 +46,12 @@ COSXEventQueueBuffer::~COSXEventQueueBuffer()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
COSXEventQueueBuffer::init()
|
||||||
|
{
|
||||||
|
m_carbonEventQueue = GetCurrentEventQueue();
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
COSXEventQueueBuffer::waitForEvent(double timeout)
|
COSXEventQueueBuffer::waitForEvent(double timeout)
|
||||||
{
|
{
|
||||||
|
@ -100,9 +106,15 @@ COSXEventQueueBuffer::addEvent(UInt32 dataID)
|
||||||
kEventAttributeNone,
|
kEventAttributeNone,
|
||||||
&event);
|
&event);
|
||||||
|
|
||||||
if (error == noErr & m_threadEventQueueRef != NULL) {
|
if (error == noErr) {
|
||||||
error = PostEventToQueue(m_threadEventQueueRef, event,
|
|
||||||
|
assert(m_carbonEventQueue != NULL);
|
||||||
|
|
||||||
|
error = PostEventToQueue(
|
||||||
|
m_carbonEventQueue,
|
||||||
|
event,
|
||||||
kEventPriorityStandard);
|
kEventPriorityStandard);
|
||||||
|
|
||||||
ReleaseEvent(event);
|
ReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,9 +140,3 @@ COSXEventQueueBuffer::deleteTimer(CEventQueueTimer* timer) const
|
||||||
{
|
{
|
||||||
delete timer;
|
delete timer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
COSXEventQueueBuffer::cacheCurrentEventQueueRef()
|
|
||||||
{
|
|
||||||
m_threadEventQueueRef = GetCurrentEventQueue();
|
|
||||||
}
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ public:
|
||||||
virtual ~COSXEventQueueBuffer();
|
virtual ~COSXEventQueueBuffer();
|
||||||
|
|
||||||
// IEventQueueBuffer overrides
|
// IEventQueueBuffer overrides
|
||||||
|
virtual void init();
|
||||||
virtual void waitForEvent(double timeout);
|
virtual void waitForEvent(double timeout);
|
||||||
virtual Type getEvent(CEvent& event, UInt32& dataID);
|
virtual Type getEvent(CEvent& event, UInt32& dataID);
|
||||||
virtual bool addEvent(UInt32 dataID);
|
virtual bool addEvent(UInt32 dataID);
|
||||||
|
@ -38,12 +39,11 @@ public:
|
||||||
virtual CEventQueueTimer*
|
virtual CEventQueueTimer*
|
||||||
newTimer(double duration, bool oneShot) const;
|
newTimer(double duration, bool oneShot) const;
|
||||||
virtual void deleteTimer(CEventQueueTimer*) const;
|
virtual void deleteTimer(CEventQueueTimer*) const;
|
||||||
virtual void cacheCurrentEventQueueRef();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EventRef m_event;
|
EventRef m_event;
|
||||||
IEventQueue* m_eventQueue;
|
IEventQueue* m_eventQueue;
|
||||||
EventQueueRef m_threadEventQueueRef;
|
EventQueueRef m_carbonEventQueue;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -37,6 +37,7 @@ public:
|
||||||
virtual ~CXWindowsEventQueueBuffer();
|
virtual ~CXWindowsEventQueueBuffer();
|
||||||
|
|
||||||
// IEventQueueBuffer overrides
|
// IEventQueueBuffer overrides
|
||||||
|
virtual void init() { }
|
||||||
virtual void waitForEvent(double timeout);
|
virtual void waitForEvent(double timeout);
|
||||||
virtual Type getEvent(CEvent& event, UInt32& dataID);
|
virtual Type getEvent(CEvent& event, UInt32& dataID);
|
||||||
virtual bool addEvent(UInt32 dataID);
|
virtual bool addEvent(UInt32 dataID);
|
||||||
|
@ -45,8 +46,6 @@ public:
|
||||||
newTimer(double duration, bool oneShot) const;
|
newTimer(double duration, bool oneShot) const;
|
||||||
virtual void deleteTimer(CEventQueueTimer*) const;
|
virtual void deleteTimer(CEventQueueTimer*) const;
|
||||||
|
|
||||||
virtual void cacheCurrentEventQueueRef() {}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
|
|
|
@ -415,7 +415,6 @@ CApp::handleIpcMessage(const CEvent& e, void*)
|
||||||
void
|
void
|
||||||
CApp::runEventsLoop(void*)
|
CApp::runEventsLoop(void*)
|
||||||
{
|
{
|
||||||
m_events->cacheCurrentEventQueueRef();
|
|
||||||
m_events->loop();
|
m_events->loop();
|
||||||
|
|
||||||
#if defined(MAC_OS_X_VERSION_10_7)
|
#if defined(MAC_OS_X_VERSION_10_7)
|
||||||
|
|
|
@ -61,7 +61,6 @@ public:
|
||||||
MOCK_METHOD0(forIKeyState, IKeyStateEvents&());
|
MOCK_METHOD0(forIKeyState, IKeyStateEvents&());
|
||||||
MOCK_METHOD0(forIPrimaryScreen, IPrimaryScreenEvents&());
|
MOCK_METHOD0(forIPrimaryScreen, IPrimaryScreenEvents&());
|
||||||
MOCK_METHOD0(forIScreen, IScreenEvents&());
|
MOCK_METHOD0(forIScreen, IScreenEvents&());
|
||||||
MOCK_METHOD0(cacheCurrentEventQueueRef, void());
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue