From 84e80576826ee2c87f39192301c92ffc7e169243 Mon Sep 17 00:00:00 2001 From: SuuperW Date: Wed, 18 Jul 2018 12:20:03 -0500 Subject: [PATCH] Resize the window when changing the screen gap. --- desmume/src/frontend/windows/main.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/desmume/src/frontend/windows/main.cpp b/desmume/src/frontend/windows/main.cpp index d750c3d24..15efabe1d 100755 --- a/desmume/src/frontend/windows/main.cpp +++ b/desmume/src/frontend/windows/main.cpp @@ -3708,7 +3708,17 @@ void FixAspectRatio() void SetScreenGap(int gap) { + RECT clientRect; + GetClientRect(MainWindow->getHWnd(), &clientRect); + RECT rc; + GetWindowRect(MainWindow->getHWnd(), &rc); + if (video.rotation == 0 || video.rotation == 180) + rc.bottom += (gap - video.screengap) * (clientRect.right - clientRect.left) / GPU_FRAMEBUFFER_NATIVE_WIDTH; + else + rc.right += (gap - video.screengap) * (clientRect.bottom - clientRect.top - MainWindowToolbar->GetHeight()) / GPU_FRAMEBUFFER_NATIVE_WIDTH; video.screengap = gap; + MoveWindow(MainWindow->getHWnd(), rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE); + SetMinWindowSize(); FixAspectRatio(); UpdateWndRects(MainWindow->getHWnd());