From af3e717b3238be2032350a9902819c8854a7db06 Mon Sep 17 00:00:00 2001 From: Filip Navara Date: Sun, 8 Feb 2004 10:53:17 +0000 Subject: [PATCH] - Reclaculate window client size in NtUserSetMenu even if the window isn't visible - Properly move child windows in NtUserSetWindowPos. svn path=/trunk/; revision=8089 --- reactos/subsys/win32k/ntuser/window.c | 82 +++++++++++++-------------- reactos/subsys/win32k/ntuser/winpos.c | 11 ++-- 2 files changed, 46 insertions(+), 47 deletions(-) diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index c0e11791360..6aff80e67cd 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -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; } diff --git a/reactos/subsys/win32k/ntuser/winpos.c b/reactos/subsys/win32k/ntuser/winpos.c index 74f805fcedb..2cef774c86e 100644 --- a/reactos/subsys/win32k/ntuser/winpos.c +++ b/reactos/subsys/win32k/ntuser/winpos.c @@ -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;