From 3326454650c877132ac8f0bf3f9b1f8ce4a1fff6 Mon Sep 17 00:00:00 2001 From: Don BURNS Date: Mon, 23 Aug 2004 20:29:42 +0000 Subject: [PATCH] Fixed error for when screen width * 0.75 is greater than screen height for compute of window size when coming from fullscreen when 'f' key is pushed. --- src/osgProducer/ViewerEventHandler.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/osgProducer/ViewerEventHandler.cpp b/src/osgProducer/ViewerEventHandler.cpp index d5371f54e..00cdf91d8 100644 --- a/src/osgProducer/ViewerEventHandler.cpp +++ b/src/osgProducer/ViewerEventHandler.cpp @@ -783,9 +783,19 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio { unsigned int screenWidth; unsigned int screenHeight; + unsigned int windowWidth; + unsigned int windowHeight; rs->getScreenSize( screenWidth, screenHeight ); - unsigned int windowWidth = (unsigned int)((float)screenWidth * 0.625); - unsigned int windowHeight = (unsigned int)((float)windowWidth * 0.75); + if( screenHeight > screenWidth ) + { + windowWidth = (unsigned int)((float)screenWidth * 0.625); + windowHeight = (unsigned int)((float)windowWidth * 0.75); + } + else + { + windowHeight = (unsigned int)((float)screenHeight * 0.625); + windowWidth = (unsigned int)((float)windowHeight * 1.334); + } int x = (screenWidth - windowWidth) >> 1; int y = (screenHeight - windowHeight) >> 1; #ifndef WIN32