From 360de7f15b83287a06cf73eee1abd0b68d01a1a5 Mon Sep 17 00:00:00 2001 From: Don BURNS Date: Mon, 23 Aug 2004 17:17:46 +0000 Subject: [PATCH] Fixed assumption that the users's screen is 1280x1024 when toggling full screen with the 'f' key. --- src/osgProducer/ViewerEventHandler.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/osgProducer/ViewerEventHandler.cpp b/src/osgProducer/ViewerEventHandler.cpp index b90607270..d5371f54e 100644 --- a/src/osgProducer/ViewerEventHandler.cpp +++ b/src/osgProducer/ViewerEventHandler.cpp @@ -781,13 +781,19 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio if (_firstTimeTogglingFullScreen && rs->isFullScreen()) { + unsigned int screenWidth; + unsigned int screenHeight; + rs->getScreenSize( screenWidth, screenHeight ); + unsigned int windowWidth = (unsigned int)((float)screenWidth * 0.625); + unsigned int windowHeight = (unsigned int)((float)windowWidth * 0.75); + int x = (screenWidth - windowWidth) >> 1; + int y = (screenHeight - windowHeight) >> 1; #ifndef WIN32 rs->useBorder(true); - rs->setWindowRectangle(240,220,800,600); #else rs->fullScreen(false); - rs->setWindowRectangle(240,220,800,600); #endif + rs->setWindowRectangle( x, y, windowWidth, windowHeight ); } else {