Author: jimtabor Date: Wed Aug 10 00:16:57 2016 New Revision: 72180 URL: http://svn.reactos.org/svn/reactos?rev=72180&view=rev Log: [NtUser] - Fix regression from r71846. See CORE-11479 for more details.
Modified: trunk/reactos/win32ss/user/ntuser/nonclient.c trunk/reactos/win32ss/user/ntuser/window.c Modified: trunk/reactos/win32ss/user/ntuser/nonclient.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/nonclient.c?rev=72180&r1=72179&r2=72180&view=diff ============================================================================== --- trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] Wed Aug 10 00:16:57 2016 @@ -944,9 +944,12 @@ if (!(Style & WS_MINIMIZE)) { /* Draw menu bar */ - if (HAS_MENU(pWnd, Style)) - { - CurrentRect.top += MENU_DrawMenuBar(hDC, &CurrentRect, pWnd, FALSE); + if (pWnd->state & WNDS_HASMENU) + { + PMENU menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)); // FIXME! + TempRect = CurrentRect; + TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu; + CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE); } if (ExStyle & WS_EX_CLIENTEDGE) @@ -1110,11 +1113,14 @@ if (!(Style & WS_MINIMIZE)) { /* Draw menu bar */ - if (HAS_MENU(pWnd, Style)) + if (pWnd->state & WNDS_HASMENU) { if (!(Flags & DC_NOSENDMSG)) { - CurrentRect.top += MENU_DrawMenuBar(hDC, &CurrentRect, pWnd, FALSE); + PMENU menu = UserGetMenuObject(UlongToHandle(pWnd->IDMenu)); // FIXME! + TempRect = CurrentRect; + TempRect.bottom = TempRect.top + menu->cyMenu; // Should be pWnd->spmenu->cyMenu; + CurrentRect.top += MENU_DrawMenuBar(hDC, &TempRect, pWnd, FALSE); } } Modified: trunk/reactos/win32ss/user/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window.c?rev=72180&r1=72179&r2=72180&view=diff ============================================================================== --- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original) +++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Wed Aug 10 00:16:57 2016 @@ -3595,6 +3595,30 @@ else Window->ExStyle &= ~WS_EX_WINDOWEDGE; + if ((OldValue & (WS_CHILD | WS_POPUP)) == WS_CHILD) + { + if ((NewValue & (WS_CHILD | WS_POPUP)) != WS_CHILD) + { + //// From child to non-child it should be null already. + ERR("IDMenu going null! %d\n",Window->IDMenu); + Window->IDMenu = 0; // Window->spmenu = 0; + } + } + else + { + if ((NewValue & (WS_CHILD | WS_POPUP)) == WS_CHILD) + { + PMENU pMenu = UserGetMenuObject(UlongToHandle(Window->IDMenu)); + Window->state &= ~WNDS_HASMENU; + if (pMenu) + { + ERR("IDMenu released 0x%p\n",pMenu); + // ROS may not hold a lock after setting menu to window. But it should! + //IntReleaseMenuObject(pMenu); + } + } + } + if ((Style.styleOld ^ Style.styleNew) & WS_VISIBLE) { if (Style.styleOld & WS_VISIBLE) Window->head.pti->cVisWindows--;