]> granicus.if.org Git - nethack/commitdiff
(from <Someone>)
authornethack.allison <nethack.allison>
Thu, 18 Apr 2002 22:21:05 +0000 (22:21 +0000)
committernethack.allison <nethack.allison>
Thu, 18 Apr 2002 22:21:05 +0000 (22:21 +0000)
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

index e3b13d642c73b59489008865d1608236b9a25a93..c6a533a440d3862bdcfcc6f2ce1328db99d92be2 100644 (file)
@@ -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);
        }