- Rename co_IntCreateWindowEx to co_UserCreateWindowEx and refactor it to make it readable
- Also fix the sequence of messages in co_UserCreateWindowEx

svn path=/trunk/; revision=47500
This commit is contained in:
Giannis Adamopoulos
2010-05-31 17:58:05 +00:00
parent 72cb5886ab
commit b95825c931
7 changed files with 455 additions and 615 deletions
@@ -77,6 +77,9 @@ IntGetClassAtom(IN PUNICODE_STRING ClassName,
OUT PCLS *BaseClass OPTIONAL,
OUT PCLS **Link OPTIONAL);
PCLS
IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance);
PCLS
FASTCALL
IntCreateClass(IN CONST WNDCLASSEXW* lpwcx,
@@ -155,7 +155,7 @@ IntDefWindowProc( PWINDOW_OBJECT Window, UINT Msg, WPARAM wParam, LPARAM lParam,
VOID FASTCALL IntNotifyWinEvent(DWORD, PWND, LONG, LONG);
PWND APIENTRY co_IntCreateWindowEx(DWORD,PUNICODE_STRING,PLARGE_STRING,DWORD,LONG,LONG,LONG,LONG,HWND,HMENU,HINSTANCE,LPVOID,DWORD,BOOL);
PWND FASTCALL co_UserCreateWindowEx(CREATESTRUCTW*, PUNICODE_STRING, PLARGE_STRING);
WNDPROC FASTCALL IntGetWindowProc(PWND,BOOL);
/* EOF */
@@ -25,6 +25,8 @@ co_WinPosSetWindowPos(PWINDOW_OBJECT Wnd, HWND WndInsertAfter, INT x, INT y, INT
INT cy, UINT flags);
BOOLEAN FASTCALL
co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd);
void FASTCALL
co_WinPosSendSizeMove(PWINDOW_OBJECT Window);
USHORT FASTCALL
co_WinPosWindowFromPoint(PWINDOW_OBJECT ScopeWin, PUSER_MESSAGE_QUEUE OnlyHitTests, POINT *WinPoint,
PWINDOW_OBJECT* Window);
@@ -1207,6 +1207,57 @@ FoundClass:
return Atom;
}
PCLS
IntGetAndReferenceClass(PUNICODE_STRING ClassName, HINSTANCE hInstance)
{
PCLS *ClassLink, Class = NULL;
RTL_ATOM ClassAtom;
PTHREADINFO pti;
pti = PsGetCurrentThreadWin32Thread();
if ( !(pti->ppi->W32PF_flags & W32PF_CLASSESREGISTERED ))
{
UserRegisterSystemClasses();
}
/* Check the class. */
DPRINT("Class %wZ\n", ClassName);
ClassAtom = IntGetClassAtom(ClassName,
hInstance,
pti->ppi,
&Class,
&ClassLink);
if (ClassAtom == (RTL_ATOM)0)
{
if (IS_ATOM(ClassName->Buffer))
{
DPRINT1("Class 0x%p not found\n", (DWORD_PTR) ClassName->Buffer);
}
else
{
DPRINT1("Class \"%wZ\" not found\n", ClassName);
}
SetLastWin32Error(ERROR_CANNOT_FIND_WND_CLASS);
return NULL;
}
DPRINT("ClassAtom %x\n", ClassAtom);
Class = IntReferenceClass(Class,
ClassLink,
pti->rpdesk);
if (Class == NULL)
{
DPRINT1("Failed to reference window class!\n");
return NULL;
}
return Class;
}
RTL_ATOM
UserRegisterClass(IN CONST WNDCLASSEXW* lpwcx,
IN PUNICODE_STRING ClassName,
@@ -885,6 +885,7 @@ NtUserCreateDesktop(
UNICODE_STRING ClassName, MenuName;
LARGE_STRING WindowName;
PWND pWnd = NULL;
CREATESTRUCTW Cs;
DECLARE_RETURN(HDESK);
DPRINT("Enter NtUserCreateDesktop: %wZ\n", lpszDesktopName);
@@ -1079,20 +1080,14 @@ NtUserCreateDesktop(
RtlZeroMemory(&MenuName, sizeof(MenuName));
RtlZeroMemory(&WindowName, sizeof(WindowName));
pWnd = co_IntCreateWindowEx( 0,
&ClassName,
&WindowName,
(WS_POPUP|WS_CLIPCHILDREN),
0,
0,
100,
100,
NULL,
NULL,
hModClient,
NULL,
0,
TRUE);
RtlZeroMemory(&Cs, sizeof(Cs));
Cs.cx = Cs.cy = 100;
Cs.style = WS_POPUP|WS_CLIPCHILDREN;
Cs.hInstance = hModClient;
Cs.lpszName = (LPCWSTR) &WindowName;
Cs.lpszClass = (LPCWSTR) &ClassName;
pWnd = co_UserCreateWindowEx(&Cs, &ClassName, &WindowName);
if (!pWnd)
{
DPRINT1("Failed to create Message window handle\n");
File diff suppressed because it is too large Load Diff
+28 -22
View File
@@ -1463,6 +1463,33 @@ co_WinPosGetNonClientSize(PWINDOW_OBJECT Window, RECT* WindowRect, RECT* ClientR
return Result;
}
void FASTCALL
co_WinPosSendSizeMove(PWINDOW_OBJECT Window)
{
WPARAM wParam = SIZE_RESTORED;
PWND Wnd = Window->Wnd;
Window->state &= ~WINDOWOBJECT_NEED_SIZE;
if (Wnd->style & WS_MAXIMIZE)
{
wParam = SIZE_MAXIMIZED;
}
else if (Wnd->style & WS_MINIMIZE)
{
wParam = SIZE_MINIMIZED;
}
co_IntSendMessageNoWait(Window->hSelf, WM_SIZE, wParam,
MAKELONG(Wnd->rcClient.right -
Wnd->rcClient.left,
Wnd->rcClient.bottom -
Wnd->rcClient.top));
co_IntSendMessageNoWait(Window->hSelf, WM_MOVE, 0,
MAKELONG(Wnd->rcClient.left,
Wnd->rcClient.top));
IntEngWindowChanged(Window, WOC_RGN_CLIENT);
}
BOOLEAN FASTCALL
co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
{
@@ -1621,28 +1648,7 @@ co_WinPosShowWindow(PWINDOW_OBJECT Window, INT Cmd)
if ((Window->state & WINDOWOBJECT_NEED_SIZE) &&
!(Window->state & WINDOWSTATUS_DESTROYING))
{
WPARAM wParam = SIZE_RESTORED;
Window->state &= ~WINDOWOBJECT_NEED_SIZE;
if (Wnd->style & WS_MAXIMIZE)
{
wParam = SIZE_MAXIMIZED;
}
else if (Wnd->style & WS_MINIMIZE)
{
wParam = SIZE_MINIMIZED;
}
co_IntSendMessageNoWait(Window->hSelf, WM_SIZE, wParam,
MAKELONG(Wnd->rcClient.right -
Wnd->rcClient.left,
Wnd->rcClient.bottom -
Wnd->rcClient.top));
co_IntSendMessageNoWait(Window->hSelf, WM_MOVE, 0,
MAKELONG(Wnd->rcClient.left,
Wnd->rcClient.top));
IntEngWindowChanged(Window, WOC_RGN_CLIENT);
co_WinPosSendSizeMove(Window);
}
/* Activate the window if activation is not requested and the window is not minimized */