From 65e3591ed207058c0ff842f11b067c4b109f9676 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 1 Oct 2007 11:02:02 +0000 Subject: [PATCH] From David Callu, various fixes for window inheritance --- src/osgViewer/GraphicsWindowX11.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/osgViewer/GraphicsWindowX11.cpp b/src/osgViewer/GraphicsWindowX11.cpp index 4f7b9532b..358357aa5 100644 --- a/src/osgViewer/GraphicsWindowX11.cpp +++ b/src/osgViewer/GraphicsWindowX11.cpp @@ -333,7 +333,7 @@ bool GraphicsWindowX11::setWindowDecorationImplementation(bool flag) bool GraphicsWindowX11::setWindowRectangleImplementation(int x, int y, int width, int height) { - if (!_realized) return false; + if (!_initialized) return false; Display* display = getDisplayToUse(); @@ -352,7 +352,7 @@ bool GraphicsWindowX11::setWindowRectangleImplementation(int x, int y, int width void GraphicsWindowX11::setWindowName(const std::string& name) { - if( _window ) return; + if( _window == 0) return; // char *slist[] = { name.c_str(), 0L }; // XTextProperty xtp; @@ -368,6 +368,8 @@ void GraphicsWindowX11::setWindowName(const std::string& name) XFlush(display); XSync(display,0); + + _traits->windowName = name; } void GraphicsWindowX11::setCursor(MouseCursor mouseCursor) @@ -573,8 +575,8 @@ void GraphicsWindowX11::init() if (_valid == false) { - _display = 0; XCloseDisplay( _display ); + _display = 0; } } @@ -659,8 +661,6 @@ bool GraphicsWindowX11::createWindow() KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask); - setWindowName(_traits->windowName); - XFlush( _eventDisplay ); XSync( _eventDisplay, 0 ); @@ -699,6 +699,9 @@ bool GraphicsWindowX11::setWindow(Window window) //_traits->supportsResize = false; _traits->windowDecoration = false; + + if (_traits->windowName.size()) setWindowName(_traits->windowName); + _eventDisplay = XOpenDisplay(_traits->displayName().c_str()); XFlush( _eventDisplay ); @@ -747,7 +750,7 @@ bool GraphicsWindowX11::releaseContextImplementation() { if (!_realized) { - osg::notify(osg::NOTICE)<<"Warning: GraphicsWindow not realized, cannot do makeCurrent."<