From 3308d5b28eac447ad3ab55dbf774f38d0975b875 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sun, 4 Oct 2015 18:12:14 +0000 Subject: [PATCH] winport - fix bugs in fullscreen viewport sizing --- desmume/src/windows/CWindow.cpp | 6 +++++- desmume/src/windows/main.cpp | 11 ++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/desmume/src/windows/CWindow.cpp b/desmume/src/windows/CWindow.cpp index 0d33ef65d..fa3d18a32 100644 --- a/desmume/src/windows/CWindow.cpp +++ b/desmume/src/windows/CWindow.cpp @@ -640,7 +640,8 @@ void WINCLASS::sizingMsg(WPARAM wParam, LPARAM lParam, LONG keepRatio) RECT adjr; SetRect(&adjr,0,0,minWidth,minHeight); - MyAdjustWindowRectEx(&adjr,hwnd); + if(!(keepRatio & FULLSCREEN)) + MyAdjustWindowRectEx(&adjr,hwnd); RECT frameInfo; SetRect(&frameInfo,0,0,0,0); @@ -648,6 +649,9 @@ void WINCLASS::sizingMsg(WPARAM wParam, LPARAM lParam, LONG keepRatio) int frameWidth = frameInfo.right-frameInfo.left; int frameHeight = frameInfo.bottom-frameInfo.top + tbheight; + if((keepRatio & FULLSCREEN)) + frameWidth = frameHeight = 0; + // Calculate the minimum size in pixels _minWidth = adjr.right-adjr.left; _minHeight = adjr.bottom-adjr.top + tbheight; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index b2c0e9f3c..6b987a465 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -4948,9 +4948,14 @@ DOKEYDOWN: int fakeheight = FullScreenRect.bottom-FullScreenRect.top; //now use it to create a new virtual area in the center of the client rect - int xfudge = (fswidth-fakewidth)/2; - int yfudge = (fsheight-fakeheight)/2; - OffsetRect(&FullScreenRect,xfudge,yfudge); + if(ForceRatio) + { + int xfudge = (fswidth-fakewidth)/2; + int yfudge = (fsheight-fakeheight)/2; + OffsetRect(&FullScreenRect,xfudge,yfudge); + } + else + FullScreenRect = fullscreen; } else if(wParam==SIZE_RESTORED) {