From a4411086e0a68266adf9143f5af3b39e8b37a185 Mon Sep 17 00:00:00 2001 From: SuuperW Date: Wed, 18 Jul 2018 12:19:33 -0500 Subject: [PATCH] Fix issue with resizing the window vertically. --- desmume/src/frontend/windows/main.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp index 9f4431001..d750c3d24 100755 --- a/desmume/src/frontend/windows/main.cpp +++ b/desmume/src/frontend/windows/main.cpp @@ -1137,7 +1137,7 @@ RECT CalculateDisplayLayoutWrapper(RECT rcClient, int targetWidth, int targetHei return rc; } -void UpdateWndRects(HWND hwnd) +void UpdateWndRects(HWND hwnd, RECT* newClientRect = NULL) { POINT ptClient; RECT rc; @@ -1152,7 +1152,11 @@ void UpdateWndRects(HWND hwnd) int oneScreenHeight, gapHeight; int tbheight; - GetClientRect(hwnd, &rc); + //if we're in the middle of resizing the window, GetClientRect will return the old rect + if (newClientRect) + rc = RECT(*newClientRect); + else + GetClientRect(hwnd, &rc); if(maximized) rc = FullScreenRect; @@ -4933,12 +4937,11 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM wndHeightGapless = (MainScreenRect.bottom - MainScreenRect.top) + (SubScreenRect.bottom - SubScreenRect.top); } - if(ForceRatio) - video.screengap = (wndHeight * video.width / wndWidth - video.height); - else - video.screengap = wndHeight * video.height / wndHeightGapless - video.height; + video.screengap = GPU_FRAMEBUFFER_NATIVE_WIDTH * (wndHeight - wndHeightGapless) / wndWidth; - UpdateWndRects(MainWindow->getHWnd()); + rc.bottom -= rc.top; rc.top = 0; + rc.right -= rc.left; rc.left = 0; + UpdateWndRects(MainWindow->getHWnd(), &rc); } } return 1;