- Fixed more bugs reported by Wine user32 window test. (72/373 tests fail now)

svn path=/trunk/; revision=6451
This commit is contained in:
Filip Navara 2003-10-28 22:46:30 +00:00
parent e95a291ceb
commit 1f31cc412e
3 changed files with 47 additions and 23 deletions

View file

@ -2542,6 +2542,7 @@ extern "C" {
#define HWND_NOTOPMOST ((HWND)-2)
#define HWND_TOP ((HWND)0)
#define HWND_TOPMOST ((HWND)-1)
#define HWND_MESSAGE ((HWND)-3)
#define SWP_DRAWFRAME (32)
#define SWP_FRAMECHANGED (32)
#define SWP_HIDEWINDOW (128)

View file

@ -1,4 +1,4 @@
/* $Id: window.c,v 1.75 2003/10/25 22:57:34 navaraf Exp $
/* $Id: window.c,v 1.76 2003/10/28 22:46:30 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS user32.dll
@ -402,11 +402,6 @@ CreateWindowExA(DWORD dwExStyle,
ControlsInitCalled = TRUE;
}
if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD && !hWndParent)
{
return (HWND)0; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
}
if (IS_ATOM(lpClassName))
{
RtlInitUnicodeString(&ClassName, NULL);
@ -549,11 +544,6 @@ CreateWindowExW(DWORD dwExStyle,
ControlsInitCalled = TRUE;
}
if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD && !hWndParent)
{
return (HWND)0; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
}
if (IS_ATOM(lpClassName))
{
RtlInitUnicodeString(&ClassName, NULL);

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.122 2003/10/28 20:24:09 navaraf Exp $
/* $Id: window.c,v 1.123 2003/10/28 22:46:30 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -851,6 +851,14 @@ IntSetFocusWindow(HWND hWnd)
}
PWINDOW_OBJECT FASTCALL
IntSetOwner(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewOwner)
{
HWND ret = Wnd->hWndOwner;
Wnd->hWndOwner = WndNewOwner;
return ret;
}
PWINDOW_OBJECT FASTCALL
IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
{
@ -860,6 +868,7 @@ IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
if (Wnd->Self == IntGetDesktopWindow())
{
SetLastWin32Error(STATUS_ACCESS_DENIED);
return NULL;
}
@ -1233,6 +1242,8 @@ NtUserCreateWindowEx(DWORD dwExStyle,
PWNDCLASS_OBJECT ClassObject;
PWINDOW_OBJECT WindowObject;
PWINDOW_OBJECT ParentWindow;
HWND ParentWindowHandle;
HWND OwnerWindowHandle;
PMENU_OBJECT SystemMenu;
UNICODE_STRING WindowName;
NTSTATUS Status;
@ -1259,17 +1270,32 @@ NtUserCreateWindowEx(DWORD dwExStyle,
return((HWND)0);
}
/* FIXME: parent must belong to the current process */
ParentWindowHandle = PsGetWin32Thread()->Desktop->DesktopWindow;
OwnerWindowHandle = NULL;
if (hWndParent != NULL)
if (hWndParent == HWND_MESSAGE)
{
ParentWindow = IntGetWindowObject(hWndParent);
/*
* native ole32.OleInitialize uses HWND_MESSAGE to create the
* message window (style: WS_POPUP|WS_DISABLED)
*/
UNIMPLEMENTED;
}
else
else if (hWndParent)
{
hWndParent = PsGetWin32Thread()->Desktop->DesktopWindow;
ParentWindow = IntGetWindowObject(hWndParent);
if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD)
ParentWindowHandle = hWndParent;
else
OwnerWindowHandle = NtUserGetAncestor(hWndParent, GA_ROOT);
}
else if ((dwStyle & (WS_CHILD | WS_POPUP)) == WS_CHILD)
{
return (HWND)0; /* WS_CHILD needs a parent, but WS_POPUP doesn't */
}
ParentWindow = IntGetWindowObject(ParentWindowHandle);
/* FIXME: parent must belong to the current process */
/* Check the class. */
Status = ClassReferenceClassByNameOrAtom(&ClassObject, lpClassName->Buffer);
@ -1337,7 +1363,8 @@ NtUserCreateWindowEx(DWORD dwExStyle,
WindowObject->Width = nWidth;
WindowObject->Height = nHeight;
WindowObject->ContextHelpId = 0;
WindowObject->ParentHandle = hWndParent;
WindowObject->ParentHandle = ParentWindowHandle;
WindowObject->hWndOwner = OwnerWindowHandle;
WindowObject->IDMenu = (UINT)hMenu;
WindowObject->Instance = hInstance;
WindowObject->Parameters = lpParam;
@ -1449,7 +1476,7 @@ NtUserCreateWindowEx(DWORD dwExStyle,
Cs.lpCreateParams = lpParam;
Cs.hInstance = hInstance;
Cs.hMenu = hMenu;
Cs.hwndParent = hWndParent;
Cs.hwndParent = ParentWindowHandle;
Cs.cx = nWidth;
Cs.cy = nHeight;
Cs.x = x;
@ -2301,7 +2328,7 @@ NtUserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi)
case GWL_HWNDPARENT:
if (WindowObject->ParentHandle == IntGetDesktopWindow())
{
Result = 0;
Result = (LONG) WindowObject->hWndOwner;
}
else
{
@ -3034,8 +3061,14 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
break;
case GWL_HWNDPARENT:
OldValue = (LONG) WindowObject->ParentHandle;
IntSetParent(WindowObject, (HWND) NewValue);
if (WindowObject->ParentHandle == IntGetDesktopWindow())
{
OldValue = (LONG) IntSetOwner(WindowObject, (HWND) NewValue);
}
else
{
OldValue = (LONG) IntSetParent(WindowObject, (HWND) NewValue);
}
break;
case GWL_ID: