- Reclaculate window client size in NtUserSetMenu even if the window isn't visible

- Properly move child windows in NtUserSetWindowPos.

svn path=/trunk/; revision=8089
This commit is contained in:
Filip Navara 2004-02-08 10:53:17 +00:00
parent 7715328fc5
commit af3e717b32
2 changed files with 46 additions and 47 deletions

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: window.c,v 1.181 2004/02/04 23:01:07 gvg Exp $
/* $Id: window.c,v 1.182 2004/02/08 10:53:17 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -1405,7 +1405,6 @@ NtUserCreateWindowEx(DWORD dwExStyle,
MaxPos.x - WindowObject->WindowRect.left,
MaxPos.y - WindowObject->WindowRect.top);
if (NULL != ParentWindow)
{
/* link the window into the parent's child list */
@ -3039,52 +3038,53 @@ NtUserSetLogonNotifyWindow(DWORD Unknown0)
*/
BOOL STDCALL
NtUserSetMenu(
HWND hWnd,
HMENU hMenu,
BOOL bRepaint)
HWND hWnd,
HMENU hMenu,
BOOL bRepaint)
{
PWINDOW_OBJECT WindowObject;
PMENU_OBJECT MenuObject;
BOOL Changed = FALSE;
WindowObject = IntGetWindowObject((HWND)hWnd);
if(!WindowObject)
{
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return FALSE;
}
if(hMenu)
{
/* assign new menu handle */
MenuObject = IntGetMenuObject((HWND)hMenu);
if(!MenuObject)
{
IntReleaseWindowObject(WindowObject);
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
PWINDOW_OBJECT WindowObject;
PMENU_OBJECT MenuObject;
BOOL Changed = FALSE;
WindowObject = IntGetWindowObject((HWND)hWnd);
if (!WindowObject)
{
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
return FALSE;
}
}
if (hMenu)
{
/* assign new menu handle */
MenuObject = IntGetMenuObject((HWND)hMenu);
if (!MenuObject)
{
IntReleaseWindowObject(WindowObject);
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
return FALSE;
}
Changed = (WindowObject->IDMenu != (UINT)hMenu);
WindowObject->IDMenu = (UINT)hMenu;
Changed = (WindowObject->IDMenu != (UINT)hMenu);
WindowObject->IDMenu = (UINT)hMenu;
IntReleaseMenuObject(MenuObject);
}
else
{
/* remove the menu handle */
Changed = (WindowObject->IDMenu != 0);
WindowObject->IDMenu = 0;
}
IntReleaseMenuObject(MenuObject);
}
else
{
/* remove the menu handle */
Changed = (WindowObject->IDMenu != 0);
WindowObject->IDMenu = 0;
}
IntReleaseWindowObject(WindowObject);
IntReleaseWindowObject(WindowObject);
if(Changed && bRepaint && IntIsWindowVisible(hWnd))
{
WinPosSetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
if (Changed && bRepaint)
{
WinPosSetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED);
}
return TRUE;
return TRUE;
}

View file

@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/* $Id: winpos.c,v 1.87 2004/02/04 22:59:04 gvg Exp $
/* $Id: winpos.c,v 1.88 2004/02/08 10:53:17 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -849,13 +849,12 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
/* FIXME: Actually do something with WVR_VALIDRECTS */
if (! (WinPos.flags & SWP_NOMOVE)
&& (NewWindowRect.left != OldWindowRect.left
|| NewWindowRect.top != OldWindowRect.top))
if (NewClientRect.left != OldClientRect.left ||
NewClientRect.top != OldClientRect.top)
{
WinPosInternalMoveWindow(Window,
NewWindowRect.left - OldWindowRect.left,
NewWindowRect.top - OldWindowRect.top);
NewClientRect.left - OldClientRect.left,
NewClientRect.top - OldClientRect.top);
}
Window->WindowRect = NewWindowRect;