Fixed #1151 OVQT !_Pumping assert when entering settings dialog

This commit is contained in:
rti 2010-12-12 19:08:44 +01:00
parent 9f0b717db6
commit 78229f4b67
3 changed files with 11 additions and 7 deletions

View file

@ -1023,7 +1023,7 @@ bool CDriverGL::setDisplay(nlWindow wnd, const GfxMode &mode, bool show, bool re
[_ctx flushBuffer];
[_glView display];
_EventEmitter.init(this, _glView);
_EventEmitter.init(this, _glView, _DestroyWindow);
#elif defined(NL_OS_UNIX)

View file

@ -222,10 +222,12 @@ static bool isTextKeyEvent(NSEvent* event)
return false;
}
void CCocoaEventEmitter::init(NL3D::IDriver* driver, CocoaOpenGLView* glView)
void CCocoaEventEmitter::init(
NL3D::IDriver* driver, CocoaOpenGLView* glView, bool eventLoop)
{
_driver = driver;
_glView = glView;
_driver = driver;
_glView = glView;
_eventLoop = eventLoop;
}
bool CCocoaEventEmitter::processMessage(NSEvent* event, CEventServer* server)
@ -443,7 +445,8 @@ typedef bool (*cocoaProc)(NL3D::IDriver*, const void* e);
void CCocoaEventEmitter::submitEvents(CEventServer& server, bool /* allWins */)
{
// break if there was no event to handle
while(true)
// if running embedded in e.g. qt, _eventLoop will be false
while(_eventLoop)
{
// get the next event to handle
NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask

View file

@ -34,6 +34,7 @@ class CCocoaEventEmitter : public IEventEmitter
{
bool _emulateRawMode;
bool _setToEmulateRawMode;
bool _eventLoop;
NL3D::IDriver* _driver;
CocoaOpenGLView* _glView;
@ -48,7 +49,7 @@ public:
_glView(nil),
_server(NULL) { }
void init(NL3D::IDriver* driver, CocoaOpenGLView* glView);
void init(NL3D::IDriver*, CocoaOpenGLView*, bool eventLoop);
bool processMessage(NSEvent* event, CEventServer* server = NULL);
virtual void submitEvents(CEventServer& server, bool allWindows);
virtual void emulateMouseRawMode(bool enable);