From 20472e645c7d1c4bcb16dee2346a71dc7e6d7192 Mon Sep 17 00:00:00 2001 From: "nethack.allison" Date: Thu, 18 Apr 2002 22:21:05 +0000 Subject: [PATCH] (from ) W340-6 fix fixed: mswin_menu_size incremented width of the actual menu window each time being called. This only happens if "show window content while dragging" option is set in Windows desktop settings. --- win/win32/mhmenu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/win/win32/mhmenu.c b/win/win32/mhmenu.c index e3b13d642..c6a533a44 100644 --- a/win/win32/mhmenu.c +++ b/win/win32/mhmenu.c @@ -1268,12 +1268,16 @@ void mswin_menu_window_size (HWND hWnd, LPSIZE sz) HDC hdc; PNHMenuWindow data; int i; - RECT rt; + RECT rt, wrt; + int extra_cx; GetClientRect(hWnd, &rt); sz->cx = rt.right - rt.left; sz->cy = rt.bottom - rt.top; + GetWindowRect(hWnd, &wrt); + extra_cx = (wrt.right-wrt.left) - sz->cx; + data = (PNHMenuWindow)GetWindowLong(hWnd, GWL_USERDATA); if(data) { control = GetMenuControl(hWnd); @@ -1331,7 +1335,7 @@ void mswin_menu_window_size (HWND hWnd, LPSIZE sz) sz->cx = max(sz->cx, text_rt.right - text_rt.left + 5*tm.tmAveCharWidth + tm.tmOverhang); SelectObject(hdc, saveFont); } - sz->cx += GetSystemMetrics(SM_CXVSCROLL) + 2*GetSystemMetrics(SM_CXSIZEFRAME); + sz->cx += extra_cx; ReleaseDC(control, hdc); }