From cb6d2cf602f246cdfba23b14e4a6a1991b6ee3a1 Mon Sep 17 00:00:00 2001 From: stephena Date: Fri, 17 Sep 2010 19:19:25 +0000 Subject: [PATCH] Fixed bug in app window centering, recently addressed in a 3.2.2 release. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2133 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/emucore/FrameBuffer.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index df71426dc..6983c6901 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -132,10 +132,11 @@ FBInitStatus FrameBuffer::initialize(const string& title, uInt32 width, uInt32 h // Attempt to center the application window in non-fullscreen mode if(!fullScreen() && myOSystem->settings().getBool("center")) { - myOSystem->setAppWindowPos( - (myOSystem->desktopWidth() - mode.screen_w) / 2, - (myOSystem->desktopHeight() - mode.screen_h) / 2, - mode.screen_w, mode.screen_h); + int x = mode.screen_w >= myOSystem->desktopWidth() ? 0 : + ((myOSystem->desktopWidth() - mode.screen_w) >> 1); + int y = mode.screen_h >= myOSystem->desktopHeight() ? 0 : + ((myOSystem->desktopHeight() - mode.screen_h) >> 1); + myOSystem->setAppWindowPos(x, y, mode.screen_w, mode.screen_h); } myImageRect.setWidth(mode.image_w);