Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 623d954df672d3c63884d8ed0cf95a43b366a5d1 Mon Sep 17 00:00:00 2001
- From: gocha <[email protected]>
- Date: Mon, 10 Jan 2011 13:42:01 +0900
- Subject: [PATCH 1/3] Improved window resize accuracy, it should work better for 1x.
- Thanks http://blogs.msdn.com/b/oldnewthing/archive/2003/09/11/54885.aspx
- ---
- win32/wsnes9x.cpp | 32 +++++++++++++++++++++++---------
- 1 files changed, 23 insertions(+), 9 deletions(-)
- diff --git a/win32/wsnes9x.cpp b/win32/wsnes9x.cpp
- index f353532..23f1f79 100644
- --- a/win32/wsnes9x.cpp
- +++ b/win32/wsnes9x.cpp
- @@ -2058,15 +2058,29 @@ LRESULT CALLBACK WinProc(
- case ID_WINDOW_SIZE_2X:
- case ID_WINDOW_SIZE_3X:
- case ID_WINDOW_SIZE_4X:
- - UINT factor,newWidth,newHeight;
- - factor = (wParam & 0xffff) - ID_WINDOW_SIZE_1X + 1;
- - newWidth = GUI.AspectWidth * factor;
- - newHeight = (GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT) * factor;
- - newWidth += 2*(GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXDLGFRAME));
- - newHeight += 2*(GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYDLGFRAME)) +
- - GetSystemMetrics(SM_CYCAPTION) + (GUI.HideMenu ? 0 : (GetSystemMetrics(SM_CYMENU) +
- - (factor<2 ? GetSystemMetrics(SM_CYMENU) : 0)));
- - SetWindowPos(GUI.hWnd,0,0,0,newWidth,newHeight,SWP_NOMOVE);
- + {
- + UINT factor, newWidth, newHeight;
- + factor = (wParam & 0xffff) - ID_WINDOW_SIZE_1X + 1;
- + newWidth = GUI.AspectWidth * factor;
- + newHeight = (GUI.HeightExtend ? SNES_HEIGHT_EXTENDED : SNES_HEIGHT) * factor;
- +
- + RECT rcWindow = { 0, 0, newWidth, newHeight };
- + AdjustWindowRectEx(&rcWindow, GetWindowStyle(GUI.hWnd), !GUI.HideMenu, GetWindowExStyle(GUI.hWnd));
- +
- + if (!GUI.HideMenu)
- + {
- + RECT rcTemp = rcWindow;
- + rcTemp.bottom = 0x7FFF; // "Infinite" height
- + SendMessage(GUI.hWnd, WM_NCCALCSIZE, FALSE, (LPARAM)&rcTemp);
- +
- + // Adjust our previous calculation to compensate for menu
- + // wrapping.
- + rcWindow.bottom += rcTemp.top;
- + }
- +
- + SetWindowPos(GUI.hWnd, NULL, 0, 0, rcWindow.right - rcWindow.left,
- + rcWindow.bottom - rcWindow.top, SWP_NOMOVE);
- + }
- break;
- case ID_WINDOW_STRETCH:
- GUI.Stretch = !GUI.Stretch;
- --
- 1.7.3.1.msysgit.0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement