From 9e8e07b3733651bed8eb4189042fb9201138b63c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 13 Apr 2007 14:54:22 +0000 Subject: [PATCH] Added usleep's to avoid X11 errors when doing X11 calls to close to changes in window size or decoration. --- src/osgViewer/GraphicsWindowX11.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/osgViewer/GraphicsWindowX11.cpp b/src/osgViewer/GraphicsWindowX11.cpp index 8987fe507..7be52d3fa 100644 --- a/src/osgViewer/GraphicsWindowX11.cpp +++ b/src/osgViewer/GraphicsWindowX11.cpp @@ -355,6 +355,11 @@ void GraphicsWindowX11::setWindowDecoration(bool flag) _traits->height = watt.height; #endif + // add usleep here to give window manager a chance to handle the request, if + // we don't add this sleep then any X11 calls right afterwards can produce + // X11 errors. + usleep(100000); + } else osg::notify(osg::NOTICE)<<"Error: GraphicsWindowX11::setBorder(" << flag << ") - couldn't change decorations." << std::endl; @@ -370,6 +375,11 @@ void GraphicsWindowX11::setWindowRectangle(int x, int y, int width, int height) XFlush(display); XSync(display, 0); + + // add usleep here to give window manager a chance to handle the request, if + // we don't add this sleep then any X11 calls right afterwards can produce + // X11 errors. + usleep(100000); } void GraphicsWindowX11::useCursor(bool cursorOn)