From 3d77abc06d7a30b2b32a73eaeee2811421d9564b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 20 Apr 2015 10:43:00 +0000 Subject: [PATCH] Merged correction to coordinates from svn/trunk git-svn-id: http://svn.openscenegraph.org/osg/OpenSceneGraph/branches/OpenSceneGraph-3.2@14853 16af8721-9629-0410-8352-f15c8da7e697 --- src/osgViewer/GraphicsWindowX11.cpp | 37 +++++++++++++++++++---------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/osgViewer/GraphicsWindowX11.cpp b/src/osgViewer/GraphicsWindowX11.cpp index 42148ee36..9a1379704 100644 --- a/src/osgViewer/GraphicsWindowX11.cpp +++ b/src/osgViewer/GraphicsWindowX11.cpp @@ -962,11 +962,14 @@ bool GraphicsWindowX11::createWindow() XFlush( _display ); XSync( _display, 0 ); - // now update the window dimensions to account for any size changes made by the window manager, - XGetWindowAttributes( _display, _window, &watt ); - if (_traits->x != watt.x || _traits->y != watt.y - ||_traits->width != watt.width || _traits->height != watt.height) + // get window geometry relative to root window/screen + Window child_return; + int windowX, windowY; + XGetWindowAttributes( _display, _window, &watt ); + XTranslateCoordinates( _display, _window, watt.root, watt.x, watt.y, &windowX, &windowY, &child_return); + + if (_traits->x != windowX || _traits->y != windowY ||_traits->width != watt.width || _traits->height != watt.height) { if (doFullSceenWorkAround) @@ -978,9 +981,10 @@ bool GraphicsWindowX11::createWindow() XSync(_display, 0); XGetWindowAttributes( _display, _window, &watt ); + XTranslateCoordinates( _display, _window, watt.root, watt.x, watt.y, &windowX, &windowY, &child_return); } - resized( watt.x, watt.y, watt.width, watt.height ); + resized( windowX, windowY, watt.width, watt.height ); } //OSG_NOTICE<<"After sync apply.x = "<(ev.xclient.data.l[0]) == _deleteWindow) { - OSG_NOTICE<<"DeleteWindow event received"<closeWindow(eventTime); } @@ -1252,15 +1256,13 @@ bool GraphicsWindowX11::checkEvents() break; case DestroyNotify : - OSG_NOTICE<<"DestroyNotify event received"<x || windowY != _traits->y || windowWidth != _traits->width || windowHeight != _traits->height) { + resized(windowX, windowY, windowWidth, windowHeight); getEventQueue()->windowResize(windowX, windowY, windowWidth, windowHeight, resizeTime);