diff --git a/src/osgViewer/GraphicsWindowX11.cpp b/src/osgViewer/GraphicsWindowX11.cpp index c560b319a..f93c2caa0 100644 --- a/src/osgViewer/GraphicsWindowX11.cpp +++ b/src/osgViewer/GraphicsWindowX11.cpp @@ -1090,6 +1090,25 @@ void GraphicsWindowX11::swapBuffersImplementation() #endif glXSwapBuffers( _display, _window ); #endif + + + while( XPending(_display) ) + { + XEvent ev; + XNextEvent( _display, &ev ); + + switch( ev.type ) + { + case ClientMessage: + { + if (static_cast(ev.xclient.data.l[0]) == _deleteWindow) + { + OSG_INFO<<"DeleteWindow event received"<closeWindow(); + } + } + } + } } void GraphicsWindowX11::checkEvents() @@ -1461,29 +1480,6 @@ void GraphicsWindowX11::checkEvents() } } - - // - // process events of _display - // - while( XPending(_display) ) - { - XEvent ev; - XNextEvent( _display, &ev ); - - switch( ev.type ) - { - case ClientMessage: - { - if (static_cast(ev.xclient.data.l[0]) == _deleteWindow) - { - OSG_INFO<<"DeleteWindow event received"<closeWindow(); - } - break; - } - } - } - #if 0 if (destroyWindowRequested) {