From bddec4f91a7021f348685df93fc2b44c07feca0b Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sun, 5 Dec 2004 03:50:47 +0000 Subject: [PATCH] - Allocate the MDI client context structure only once (and don't create a second one in WM_CREATE and leak the first one). - Don't call SetScrollInfo with SB_BOTH. - Don't add empty system icon to the client menu. svn path=/trunk/; revision=11941 --- reactos/lib/user32/windows/mdi.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/reactos/lib/user32/windows/mdi.c b/reactos/lib/user32/windows/mdi.c index 498e5219aab..61244e5b01e 100644 --- a/reactos/lib/user32/windows/mdi.c +++ b/reactos/lib/user32/windows/mdi.c @@ -1137,7 +1137,8 @@ static BOOL MDI_AugmentFrameMenu( HWND frame, HWND hChild ) hSysMenuBitmap = hBmpClose; #endif - if( !InsertMenuA(menu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP, + if( hSysMenuBitmap != NULL && + !InsertMenuA(menu,0,MF_BYPOSITION | MF_BITMAP | MF_POPUP, (UINT_PTR)hSysPopup, (LPSTR)hSysMenuBitmap)) { TRACE("not inserted\n"); @@ -1307,7 +1308,7 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, { MDICLIENTINFO *ci = NULL; - if (WM_NCCREATE != message && WM_CREATE != message + if (WM_NCCREATE != message && NULL == (ci = get_client_info(hwnd))) { return 0; @@ -1332,12 +1333,6 @@ static LRESULT MDIClientWndProc_common( HWND hwnd, UINT message, #ifndef __REACTOS__ WND *wndPtr = WIN_GetPtr( hwnd ); #endif - ci = HeapAlloc(GetProcessHeap(), 0, sizeof(MDICLIENTINFO)); - if (NULL == ci) - { - return -1; - } - SetWindowLongPtr(hwnd, 0, (LONG_PTR) ci); /* Translation layer doesn't know what's in the cs->lpCreateParams * so we have to keep track of what environment we're in. */ @@ -2139,14 +2134,14 @@ void WINAPI CalcChildScroll( HWND hwnd, INT scroll ) info.nMin = childRect.left; info.nMax = childRect.right - clientRect.right; info.nPos = clientRect.left - childRect.left; - SetScrollInfo(hwnd, scroll, &info, TRUE); + SetScrollInfo(hwnd, SB_HORZ, &info, TRUE); if (scroll == SB_HORZ) break; /* fall through */ case SB_VERT: info.nMin = childRect.top; info.nMax = childRect.bottom - clientRect.bottom; info.nPos = clientRect.top - childRect.top; - SetScrollInfo(hwnd, scroll, &info, TRUE); + SetScrollInfo(hwnd, SB_VERT, &info, TRUE); break; } }