From cde65de6a9291b8bee981d41f2995ecdf389a7a3 Mon Sep 17 00:00:00 2001 From: zeromus Date: Sat, 19 Dec 2009 18:31:29 +0000 Subject: [PATCH] smack around window sizing code a little more --- desmume/src/windows/CWindow.cpp | 22 ++++++++++++++++++++-- desmume/src/windows/main.cpp | 6 ++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/desmume/src/windows/CWindow.cpp b/desmume/src/windows/CWindow.cpp index 04dba6bc5..caad08104 100644 --- a/desmume/src/windows/CWindow.cpp +++ b/desmume/src/windows/CWindow.cpp @@ -336,6 +336,24 @@ void WINCLASS::setMinSize(int width, int height) minHeight = height; } +void MyAdjustWindowRectEx(RECT* rect, HWND hwnd) +{ + AdjustWindowRectEx(rect,GetWindowStyle(hwnd),TRUE,GetWindowExStyle(hwnd)); + + //get height of one menu to subtract off + int cymenu = GetSystemMetrics(SM_CYMENU); + + //get the height of the actual menu to add back on + MENUBARINFO mbi; + ZeroMemory(&mbi, sizeof(mbi)); + mbi.cbSize = sizeof(mbi); + GetMenuBarInfo(hwnd, OBJID_MENU, 0, &mbi); + int menuHeight = (mbi.rcBar.bottom - mbi.rcBar.top + 1); + + rect->bottom -= cymenu; + rect->bottom += menuHeight; +} + void WINCLASS::sizingMsg(WPARAM wParam, LPARAM lParam, LONG keepRatio) { RECT *rect = (RECT*)lParam; @@ -359,11 +377,11 @@ void WINCLASS::sizingMsg(WPARAM wParam, LPARAM lParam, LONG keepRatio) RECT adjr; SetRect(&adjr,0,0,minWidth,minHeight); - AdjustWindowRectEx(&adjr,GetWindowStyle(hwnd),TRUE,GetWindowExStyle(hwnd)); + MyAdjustWindowRectEx(&adjr,hwnd); RECT frameInfo; SetRect(&frameInfo,0,0,0,0); - AdjustWindowRectEx(&frameInfo,GetWindowStyle(hwnd),TRUE,GetWindowExStyle(hwnd)); + MyAdjustWindowRectEx(&frameInfo,hwnd); int frameWidth = frameInfo.right-frameInfo.left; int frameHeight = frameInfo.bottom-frameInfo.top; diff --git a/desmume/src/windows/main.cpp b/desmume/src/windows/main.cpp index 9b53d0bc5..49bc73539 100644 --- a/desmume/src/windows/main.cpp +++ b/desmume/src/windows/main.cpp @@ -1959,7 +1959,7 @@ void SetLanguage(int langid) SetThreadLocale(MAKELCID(MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), SORT_DEFAULT)); break; - default: break; + default: break; } @@ -5123,9 +5123,7 @@ LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM case IDM_DEFSIZE: { - if(windowSize != 1) - windowSize = 0; - + windowSize = 1; ScaleScreen(1); } break;