diff --git a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp index 666512611..ead9020b4 100644 --- a/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp +++ b/code/nel/src/3d/driver/opengl/driver_opengl_window.cpp @@ -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) diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp index 4cf2ea2ad..525a59171 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.cpp @@ -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) @@ -442,8 +444,9 @@ 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) + // break if there was no event to handle + // if running embedded in e.g. qt, _eventLoop will be false + while(_eventLoop) { // get the next event to handle NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask diff --git a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h index 1fedc009d..7e46fc6de 100644 --- a/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h +++ b/code/nel/src/3d/driver/opengl/mac/cocoa_event_emitter.h @@ -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);