- 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 * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * PROJECT: ReactOS kernel
@ -1405,7 +1405,6 @@ NtUserCreateWindowEx(DWORD dwExStyle,
MaxPos.x - WindowObject->WindowRect.left, MaxPos.x - WindowObject->WindowRect.left,
MaxPos.y - WindowObject->WindowRect.top); MaxPos.y - WindowObject->WindowRect.top);
if (NULL != ParentWindow) if (NULL != ParentWindow)
{ {
/* link the window into the parent's child list */ /* link the window into the parent's child list */
@ -3039,52 +3038,53 @@ NtUserSetLogonNotifyWindow(DWORD Unknown0)
*/ */
BOOL STDCALL BOOL STDCALL
NtUserSetMenu( NtUserSetMenu(
HWND hWnd, HWND hWnd,
HMENU hMenu, HMENU hMenu,
BOOL bRepaint) BOOL bRepaint)
{ {
PWINDOW_OBJECT WindowObject; PWINDOW_OBJECT WindowObject;
PMENU_OBJECT MenuObject; PMENU_OBJECT MenuObject;
BOOL Changed = FALSE; BOOL Changed = FALSE;
WindowObject = IntGetWindowObject((HWND)hWnd);
if(!WindowObject) WindowObject = IntGetWindowObject((HWND)hWnd);
{ if (!WindowObject)
SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); {
return FALSE; SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE);
}
if(hMenu)
{
/* assign new menu handle */
MenuObject = IntGetMenuObject((HWND)hMenu);
if(!MenuObject)
{
IntReleaseWindowObject(WindowObject);
SetLastWin32Error(ERROR_INVALID_MENU_HANDLE);
return FALSE; 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); Changed = (WindowObject->IDMenu != (UINT)hMenu);
WindowObject->IDMenu = (UINT)hMenu; WindowObject->IDMenu = (UINT)hMenu;
IntReleaseMenuObject(MenuObject); IntReleaseMenuObject(MenuObject);
} }
else else
{ {
/* remove the menu handle */ /* remove the menu handle */
Changed = (WindowObject->IDMenu != 0); Changed = (WindowObject->IDMenu != 0);
WindowObject->IDMenu = 0; WindowObject->IDMenu = 0;
} }
IntReleaseWindowObject(WindowObject); IntReleaseWindowObject(WindowObject);
if(Changed && bRepaint && IntIsWindowVisible(hWnd)) if (Changed && bRepaint)
{ {
WinPosSetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | WinPosSetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED); 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 * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * 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 * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel * 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 */ /* FIXME: Actually do something with WVR_VALIDRECTS */
if (! (WinPos.flags & SWP_NOMOVE) if (NewClientRect.left != OldClientRect.left ||
&& (NewWindowRect.left != OldWindowRect.left NewClientRect.top != OldClientRect.top)
|| NewWindowRect.top != OldWindowRect.top))
{ {
WinPosInternalMoveWindow(Window, WinPosInternalMoveWindow(Window,
NewWindowRect.left - OldWindowRect.left, NewClientRect.left - OldClientRect.left,
NewWindowRect.top - OldWindowRect.top); NewClientRect.top - OldClientRect.top);
} }
Window->WindowRect = NewWindowRect; Window->WindowRect = NewWindowRect;