Fixed handling external window integration osgViewer::GraphicsWindowWin32

This commit is contained in:
Glen A Johnson Jr 2018-03-12 16:36:11 +00:00 committed by Robert Osfield
parent e5ddfcd501
commit 2922eeb2f4

View File

@ -1210,7 +1210,6 @@ void GraphicsWindowWin32::init()
if (_initialized) return; if (_initialized) return;
// getEventQueue()->setCurrentEventState(osgGA::GUIEventAdapter::getAccumulatedEventState().get()); // getEventQueue()->setCurrentEventState(osgGA::GUIEventAdapter::getAccumulatedEventState().get());
WindowData *windowData = _traits.valid() ? dynamic_cast<WindowData*>(_traits->inheritedWindowData.get()) : 0; WindowData *windowData = _traits.valid() ? dynamic_cast<WindowData*>(_traits->inheritedWindowData.get()) : 0;
HWND windowHandle = windowData ? windowData->_hwnd : 0; HWND windowHandle = windowData ? windowData->_hwnd : 0;
@ -1222,19 +1221,20 @@ void GraphicsWindowWin32::init()
_initialized = _ownsWindow ? createWindow() : setWindow(windowHandle); _initialized = _ownsWindow ? createWindow() : setWindow(windowHandle);
_valid = _initialized; _valid = _initialized;
int windowX = 0, windowY = 0, windowWidth = 0, windowHeight = 0;
if (_traits.valid()) if (_ownsWindow)
{ {
windowX = _traits->x; int windowX = _traits->x;
windowY = _traits->y; int windowY = _traits->y;
windowWidth = _traits->width; int windowWidth = _traits->width;
windowHeight = _traits->height; int windowHeight = _traits->height;
if (areWindowDimensionsChanged(_hwnd, _screenOriginX, _screenOriginY, windowX, windowY, windowWidth, windowHeight))
{
resized(windowX, windowY, windowWidth, windowHeight);
}
} }
if (areWindowDimensionsChanged(_hwnd, _screenOriginX, _screenOriginY, windowX, windowY, windowWidth, windowHeight))
{
resized(windowX, windowY, windowWidth, windowHeight);
}
// make sure the event queue has the correct window rectangle size and input range // make sure the event queue has the correct window rectangle size and input range
getEventQueue()->syncWindowRectangleWithGraphicsContext(); getEventQueue()->syncWindowRectangleWithGraphicsContext();
@ -2933,4 +2933,3 @@ void GraphicsWindowWin32::raiseWindow()
SetWindowPos(_hwnd, HWND_NOTOPMOST, _traits->x, _traits->y, _traits->width, _traits->height, SWP_NOMOVE|SWP_NOSIZE); SetWindowPos(_hwnd, HWND_NOTOPMOST, _traits->x, _traits->y, _traits->width, _traits->height, SWP_NOMOVE|SWP_NOSIZE);
} }