make co_WinPosShowWindow take pWnd, not hWnd

add co_ to some funcs

svn path=/trunk/; revision=17713
This commit is contained in:
Gunnar Dalsnes 2005-09-07 07:53:31 +00:00
parent 3b0b4c10fd
commit 07151bdc1a
5 changed files with 44 additions and 43 deletions

View file

@ -93,8 +93,6 @@ co_DestroyThreadWindows(struct _ETHREAD *Thread);
HWND FASTCALL UserGetShellWindow(); HWND FASTCALL UserGetShellWindow();
HWND FASTCALL UserSetParent(HWND hWndChild, HWND hWndNewParent);
HWND FASTCALL UserGetWindow(HWND hWnd, UINT Relationship); HWND FASTCALL UserGetWindow(HWND hWnd, UINT Relationship);
HDC FASTCALL HDC FASTCALL

View file

@ -29,7 +29,7 @@ BOOLEAN FASTCALL
co_WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, co_WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
INT cy, UINT flags); INT cy, UINT flags);
BOOLEAN FASTCALL BOOLEAN FASTCALL
co_WinPosShowWindow(HWND Wnd, INT Cmd); co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd);
USHORT FASTCALL USHORT FASTCALL
co_WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTests, POINT *WinPoint, co_WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTests, POINT *WinPoint,
PWINDOW_OBJECT* Window); PWINDOW_OBJECT* Window);

View file

@ -853,7 +853,7 @@ co_UserShowScrollBar(PWINDOW_OBJECT Window, int wBar, DWORD bShow)
{ {
IntUpdateSBInfo(Window, SB_CTL); IntUpdateSBInfo(Window, SB_CTL);
co_WinPosShowWindow(Window->hSelf, bShow ? SW_SHOW : SW_HIDE); co_WinPosShowWindow(Window, bShow ? SW_SHOW : SW_HIDE);
return( TRUE); return( TRUE);
} }

View file

@ -913,7 +913,7 @@ IntSetOwner(HWND hWnd, HWND hWndNewOwner)
} }
PWINDOW_OBJECT FASTCALL PWINDOW_OBJECT FASTCALL
IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent) co_IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
{ {
PWINDOW_OBJECT WndOldParent, Sibling, InsertAfter; PWINDOW_OBJECT WndOldParent, Sibling, InsertAfter;
HWND hWnd, hWndNewParent, hWndOldParent; HWND hWnd, hWndNewParent, hWndOldParent;
@ -930,7 +930,7 @@ IntSetParent(PWINDOW_OBJECT Wnd, PWINDOW_OBJECT WndNewParent)
* Windows hides the window first, then shows it again * Windows hides the window first, then shows it again
* including the WM_SHOWWINDOW messages and all * including the WM_SHOWWINDOW messages and all
*/ */
WasVisible = co_WinPosShowWindow(hWnd, SW_HIDE); WasVisible = co_WinPosShowWindow(Wnd, SW_HIDE);
/* Validate that window and parent still exist */ /* Validate that window and parent still exist */
if (!IntIsWindow(hWnd) || !IntIsWindow(hWndNewParent)) if (!IntIsWindow(hWnd) || !IntIsWindow(hWndNewParent))
@ -1984,14 +1984,16 @@ co_IntCreateWindowEx(DWORD dwExStyle,
{ {
co_UserShowScrollBar(Window, SB_HORZ, TRUE); co_UserShowScrollBar(Window, SB_HORZ, TRUE);
} }
UserDereferenceWindowObjectCo(Window);
if (dwStyle & WS_VISIBLE) if (dwStyle & WS_VISIBLE)
{ {
DPRINT("IntCreateWindow(): About to show window\n"); DPRINT("IntCreateWindow(): About to show window\n");
co_WinPosShowWindow(Window->hSelf, dwShowMode); co_WinPosShowWindow(Window, dwShowMode);
} }
//faxme: temp hack
UserDereferenceWindowObjectCo(Window);
DPRINT("IntCreateWindow(): = %X\n", Handle); DPRINT("IntCreateWindow(): = %X\n", Handle);
DPRINT("WindowObject->SystemMenu = 0x%x\n", Window->SystemMenu); DPRINT("WindowObject->SystemMenu = 0x%x\n", Window->SystemMenu);
return((HWND)Handle); return((HWND)Handle);
@ -2098,6 +2100,8 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
{ {
BOOLEAN isChild; BOOLEAN isChild;
ASSERT_REFS(Window);
if (Window == NULL) if (Window == NULL)
{ {
return FALSE; return FALSE;
@ -2113,7 +2117,7 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window)
/* Look whether the focus is within the tree of windows we will /* Look whether the focus is within the tree of windows we will
* be destroying. * be destroying.
*/ */
if (!co_WinPosShowWindow(Window->hSelf, SW_HIDE)) if (!co_WinPosShowWindow(Window, SW_HIDE))
{ {
if (UserGetActiveWindow() == Window->hSelf) if (UserGetActiveWindow() == Window->hSelf)
{ {
@ -2862,7 +2866,7 @@ CLEANUP:
HWND FASTCALL HWND FASTCALL
UserSetParent(HWND hWndChild, HWND hWndNewParent) co_UserSetParent(HWND hWndChild, HWND hWndNewParent)
{ {
PWINDOW_OBJECT Wnd = NULL, WndParent = NULL, WndOldParent; PWINDOW_OBJECT Wnd = NULL, WndParent = NULL, WndOldParent;
HWND hWndOldParent = NULL; HWND hWndOldParent = NULL;
@ -2903,7 +2907,7 @@ UserSetParent(HWND hWndChild, HWND hWndNewParent)
return( NULL); return( NULL);
} }
WndOldParent = IntSetParent(Wnd, WndParent); WndOldParent = co_IntSetParent(Wnd, WndParent);
if (WndOldParent) if (WndOldParent)
{ {
@ -2944,7 +2948,7 @@ NtUserSetParent(HWND hWndChild, HWND hWndNewParent)
DPRINT("Enter NtUserSetParent\n"); DPRINT("Enter NtUserSetParent\n");
UserEnterExclusive(); UserEnterExclusive();
RETURN( UserSetParent(hWndChild, hWndNewParent)); RETURN( co_UserSetParent(hWndChild, hWndNewParent));
CLEANUP: CLEANUP:
DPRINT("Leave NtUserSetParent, ret=%i\n",_ret_); DPRINT("Leave NtUserSetParent, ret=%i\n",_ret_);
@ -3408,7 +3412,7 @@ CLEANUP:
LONG FASTCALL LONG FASTCALL
UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi) co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
{ {
PWINDOW_OBJECT Window, Parent; PWINDOW_OBJECT Window, Parent;
PWINSTATION_OBJECT WindowStation; PWINSTATION_OBJECT WindowStation;
@ -3499,7 +3503,7 @@ UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
if (Parent && (Parent->hSelf == IntGetDesktopWindow())) if (Parent && (Parent->hSelf == IntGetDesktopWindow()))
OldValue = (LONG) IntSetOwner(Window->hSelf, (HWND) NewValue); OldValue = (LONG) IntSetOwner(Window->hSelf, (HWND) NewValue);
else else
OldValue = (LONG) UserSetParent(Window->hSelf, (HWND) NewValue); OldValue = (LONG) co_UserSetParent(Window->hSelf, (HWND) NewValue);
if(Parent) if(Parent)
IntReleaseWindowObject(Parent); IntReleaseWindowObject(Parent);
break; break;
@ -3548,7 +3552,7 @@ NtUserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi)
DPRINT("Enter NtUserSetWindowLong\n"); DPRINT("Enter NtUserSetWindowLong\n");
UserEnterExclusive(); UserEnterExclusive();
RETURN( UserSetWindowLong(hWnd, Index, NewValue, Ansi)); RETURN( co_UserSetWindowLong(hWnd, Index, NewValue, Ansi));
CLEANUP: CLEANUP:
DPRINT("Leave NtUserSetWindowLong, ret=%i\n",_ret_); DPRINT("Leave NtUserSetWindowLong, ret=%i\n",_ret_);
@ -3580,7 +3584,7 @@ NtUserSetWindowWord(HWND hWnd, INT Index, WORD NewValue)
case GWL_ID: case GWL_ID:
case GWL_HINSTANCE: case GWL_HINSTANCE:
case GWL_HWNDPARENT: case GWL_HWNDPARENT:
RETURN( UserSetWindowLong(hWnd, Index, (UINT)NewValue, TRUE)); RETURN( co_UserSetWindowLong(hWnd, Index, (UINT)NewValue, TRUE));
default: default:
if (Index < 0) if (Index < 0)
{ {
@ -4064,7 +4068,7 @@ NtUserSetWindowPlacement(HWND hWnd,
} }
/* FIXME - change window status */ /* FIXME - change window status */
co_WinPosShowWindow(Window->hSelf, Safepl.showCmd); co_WinPosShowWindow(Window, Safepl.showCmd);
if (Window->InternalPos == NULL) if (Window->InternalPos == NULL)
Window->InternalPos = ExAllocatePoolWithTag(PagedPool, sizeof(INTERNALPOS), TAG_WININTLIST); Window->InternalPos = ExAllocatePoolWithTag(PagedPool, sizeof(INTERNALPOS), TAG_WININTLIST);
@ -4245,15 +4249,25 @@ CLEANUP:
* @implemented * @implemented
*/ */
BOOL STDCALL BOOL STDCALL
NtUserShowWindow(HWND hWnd, NtUserShowWindow(HWND hWnd, LONG nCmdShow)
LONG nCmdShow)
{ {
PWINDOW_OBJECT Window;
BOOL ret;
DECLARE_RETURN(BOOL); DECLARE_RETURN(BOOL);
DPRINT("Enter NtUserShowWindow\n"); DPRINT("Enter NtUserShowWindow\n");
UserEnterExclusive(); UserEnterExclusive();
RETURN( co_WinPosShowWindow(hWnd, nCmdShow)); if (!(Window = UserGetWindowObject(hWnd)))
{
RETURN(FALSE);
}
UserReferenceWindowObjectCo(Window);
ret = co_WinPosShowWindow(Window, nCmdShow);
UserReferenceWindowObjectCo(Window);
RETURN(ret);
CLEANUP: CLEANUP:
DPRINT("Leave NtUserShowWindow, ret=%i\n",_ret_); DPRINT("Leave NtUserShowWindow, ret=%i\n",_ret_);

View file

@ -1236,25 +1236,15 @@ co_WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT* ClientRect)
} }
BOOLEAN FASTCALL BOOLEAN FASTCALL
co_WinPosShowWindow(HWND Wnd, INT Cmd) co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
{ {
BOOLEAN WasVisible; BOOLEAN WasVisible;
PWINDOW_OBJECT Window;
NTSTATUS Status;
UINT Swp = 0; UINT Swp = 0;
RECT NewPos; RECT NewPos;
BOOLEAN ShowFlag; BOOLEAN ShowFlag;
// HRGN VisibleRgn; // HRGN VisibleRgn;
Status = ASSERT_REFS(Window);
ObmReferenceObjectByHandle(gHandleTable,
Wnd,
otWindow,
(PVOID*)&Window);
if (!NT_SUCCESS(Status))
{
return(FALSE);
}
WasVisible = (Window->Style & WS_VISIBLE) != 0; WasVisible = (Window->Style & WS_VISIBLE) != 0;
@ -1264,7 +1254,6 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
{ {
if (!WasVisible) if (!WasVisible)
{ {
ObmDereferenceObject(Window);
return(FALSE); return(FALSE);
} }
Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE; Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE;
@ -1336,14 +1325,14 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
ShowFlag = (Cmd != SW_HIDE); ShowFlag = (Cmd != SW_HIDE);
if (ShowFlag != WasVisible) if (ShowFlag != WasVisible)
{ {
co_IntSendMessage(Wnd, WM_SHOWWINDOW, ShowFlag, 0); co_IntSendMessage(Window->hSelf, WM_SHOWWINDOW, ShowFlag, 0);
/* /*
* FIXME: Need to check the window wasn't destroyed during the * FIXME: Need to check the window wasn't destroyed during the
* window procedure. * window procedure.
*/ */
if (!(Window->Parent)) if (!(Window->Parent))
{ {
co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Wnd); co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->hSelf);
} }
} }
@ -1371,15 +1360,15 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
} }
/* Revert focus to parent */ /* Revert focus to parent */
if (Wnd == IntGetThreadFocusWindow() || if (Window->hSelf == IntGetThreadFocusWindow() ||
IntIsChildWindow(Wnd, IntGetThreadFocusWindow())) IntIsChildWindow(Window->hSelf, IntGetThreadFocusWindow()))
{ {
UserSetFocus(Window->Parent->hSelf); UserSetFocus(Window->Parent->hSelf);
} }
if (!(Window->Parent)) if (!(Window->Parent))
{ {
co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Wnd); co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->hSelf);
} }
} }
@ -1400,12 +1389,12 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
wParam = SIZE_MINIMIZED; wParam = SIZE_MINIMIZED;
} }
co_IntSendMessage(Wnd, WM_SIZE, wParam, co_IntSendMessage(Window->hSelf, WM_SIZE, wParam,
MAKELONG(Window->ClientRect.right - MAKELONG(Window->ClientRect.right -
Window->ClientRect.left, Window->ClientRect.left,
Window->ClientRect.bottom - Window->ClientRect.bottom -
Window->ClientRect.top)); Window->ClientRect.top));
co_IntSendMessage(Wnd, WM_MOVE, 0, co_IntSendMessage(Window->hSelf, WM_MOVE, 0,
MAKELONG(Window->ClientRect.left, MAKELONG(Window->ClientRect.left,
Window->ClientRect.top)); Window->ClientRect.top));
IntEngWindowChanged(Window, WOC_RGN_CLIENT); IntEngWindowChanged(Window, WOC_RGN_CLIENT);
@ -1418,8 +1407,6 @@ co_WinPosShowWindow(HWND Wnd, INT Cmd)
WinPosChangeActiveWindow(Wnd, FALSE); WinPosChangeActiveWindow(Wnd, FALSE);
} }
*/ */
ObmDereferenceObject(Window);
return(WasVisible); return(WasVisible);
} }
@ -1431,6 +1418,8 @@ co_WinPosSearchChildren(
PWINDOW_OBJECT Current; PWINDOW_OBJECT Current;
HWND *List, *phWnd; HWND *List, *phWnd;
ASSERT_REFS(ScopeWin);
if ((List = IntWinListChildren(ScopeWin))) if ((List = IntWinListChildren(ScopeWin)))
{ {
for (phWnd = List; *phWnd; ++phWnd) for (phWnd = List; *phWnd; ++phWnd)