Author: weiden Date: Fri Nov 16 01:08:13 2007 New Revision: 30477
URL: http://svn.reactos.org/svn/reactos?rev=30477&view=rev Log: Implement GetWindowLongA/W without having to call win32k for most cases
Modified: trunk/reactos/dll/win32/user32/windows/class.c trunk/reactos/dll/win32/user32/windows/window.c trunk/reactos/include/reactos/win32k/ntuser.h trunk/reactos/subsystems/win32/win32k/include/window.h trunk/reactos/subsystems/win32/win32k/include/winpos.h trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c trunk/reactos/subsystems/win32/win32k/ntuser/focus.c trunk/reactos/subsystems/win32/win32k/ntuser/menu.c trunk/reactos/subsystems/win32/win32k/ntuser/misc.c trunk/reactos/subsystems/win32/win32k/ntuser/painting.c trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c trunk/reactos/subsystems/win32/win32k/ntuser/vis.c trunk/reactos/subsystems/win32/win32k/ntuser/windc.c trunk/reactos/subsystems/win32/win32k/ntuser/window.c trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c
Modified: trunk/reactos/dll/win32/user32/windows/class.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/cl... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/class.c (original) +++ trunk/reactos/dll/win32/user32/windows/class.c Fri Nov 16 01:08:13 2007 @@ -329,7 +329,49 @@ STDCALL GetWindowLongA ( HWND hWnd, int nIndex ) { - return NtUserGetWindowLong(hWnd, nIndex, TRUE); + PWINDOW Wnd; + + Wnd = ValidateHwnd(hWnd); + if (Wnd == NULL) + return 0; + + if (nIndex >= 0) + { + if ((DWORD)nIndex + sizeof(LONG) > Wnd->ExtraDataSize) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + return *((LONG *)((PCHAR)(Wnd + 1) + nIndex)); + } + else + { + switch (nIndex) + { + case GWL_EXSTYLE: + return Wnd->ExStyle; + case GWL_STYLE: + return Wnd->Style; + case GWL_HINSTANCE: + return (LONG)Wnd->Instance; + case GWL_ID: + return Wnd->IDMenu; + case GWL_USERDATA: + return Wnd->UserData; + + case GWL_HWNDPARENT: + /* FIXME: Implement in user32 */ + case GWL_WNDPROC: + /* Call win32k for this as a callproc handle may need + to be created */ + return NtUserGetWindowLong(hWnd, nIndex, TRUE); + + default: + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + } }
@@ -340,7 +382,49 @@ STDCALL GetWindowLongW(HWND hWnd, int nIndex) { - return NtUserGetWindowLong(hWnd, nIndex, FALSE); + PWINDOW Wnd; + + Wnd = ValidateHwnd(hWnd); + if (Wnd == NULL) + return 0; + + if (nIndex >= 0) + { + if ((DWORD)nIndex + sizeof(LONG) > Wnd->ExtraDataSize) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + return *((LONG *)((PCHAR)(Wnd + 1) + nIndex)); + } + else + { + switch (nIndex) + { + case GWL_EXSTYLE: + return Wnd->ExStyle; + case GWL_STYLE: + return Wnd->Style; + case GWL_HINSTANCE: + return (LONG)Wnd->Instance; + case GWL_ID: + return Wnd->IDMenu; + case GWL_USERDATA: + return Wnd->UserData; + + case GWL_HWNDPARENT: + /* FIXME: Implement in user32 */ + case GWL_WNDPROC: + /* Call win32k for this as a callproc handle may need + to be created */ + return NtUserGetWindowLong(hWnd, nIndex, FALSE); + + default: + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + } }
/* @@ -350,7 +434,7 @@ STDCALL GetWindowWord(HWND hWnd, int nIndex) { - return (WORD)NtUserGetWindowLong(hWnd, nIndex, TRUE); + return (WORD)GetWindowLongW(hWnd, nIndex); }
/*
Modified: trunk/reactos/dll/win32/user32/windows/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/wi... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/window.c (original) +++ trunk/reactos/dll/win32/user32/windows/window.c Fri Nov 16 01:08:13 2007 @@ -1168,7 +1168,14 @@ BOOL STDCALL IsIconic(HWND hWnd) { - return (NtUserGetWindowLong( hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE) != 0; + PWINDOW Wnd = ValidateHwnd(hWnd); + + if (Wnd != NULL) + { + return (Wnd->Style & WS_MINIMIZE) != 0; + } + + return FALSE; }
@@ -1199,15 +1206,17 @@ BOOL STDCALL IsWindowVisible(HWND hWnd) { - while (NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_CHILD) - { - if (!(NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_VISIBLE)) - { - return(FALSE); - } - hWnd = GetAncestor(hWnd, GA_PARENT); - } - return(NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_VISIBLE); + DWORD Style; + + while ((Style = GetWindowLongW(hWnd, GWL_STYLE)) & WS_CHILD) + { + if (!(Style & WS_VISIBLE)) + return FALSE; + + hWnd = GetAncestor(hWnd, GA_PARENT); + } + + return (GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE) != 0; }
@@ -1223,7 +1232,7 @@ // disabled. I think they stop processing messages but stay appearing // as enabled.
- return (! (NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_DISABLED)); + return !(GetWindowLongW(hWnd, GWL_STYLE) & WS_DISABLED); }
@@ -1233,7 +1242,7 @@ BOOL STDCALL IsZoomed(HWND hWnd) { - return NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MAXIMIZE; + return (GetWindowLongW(hWnd, GWL_STYLE) & WS_MAXIMIZE) != 0; }
@@ -1299,10 +1308,8 @@ BOOL STDCALL OpenIcon(HWND hWnd) { - if (!(NtUserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE)) - { + if (!(GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE)) return FALSE; - }
ShowWindow(hWnd,SW_RESTORE); return TRUE;
Modified: trunk/reactos/include/reactos/win32k/ntuser.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntus... ============================================================================== --- trunk/reactos/include/reactos/win32k/ntuser.h (original) +++ trunk/reactos/include/reactos/win32k/ntuser.h Fri Nov 16 01:08:13 2007 @@ -66,6 +66,17 @@ struct _W32THREADINFO *ti; RECT WindowRect; RECT ClientRect; + /* Size of the extra data associated with the window. */ + ULONG ExtraDataSize; + /* Style. */ + DWORD Style; + /* Extended style. */ + DWORD ExStyle; + /* Handle of the module that created the window. */ + HINSTANCE Instance; + /* Window menu handle or window id */ + UINT IDMenu; + LONG UserData; } WINDOW, *PWINDOW;
typedef struct _W32PROCESSINFO
Modified: trunk/reactos/subsystems/win32/win32k/include/window.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/window.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/window.h Fri Nov 16 01:08:13 2007 @@ -47,30 +47,18 @@ BOOL IsSystem; /* Pointer to the window class. */ PWINDOWCLASS Class; - /* Extended style. */ - DWORD ExStyle; /* Window name. */ UNICODE_STRING WindowName; - /* Style. */ - DWORD Style; /* Context help id */ DWORD ContextHelpId; /* system menu handle. */ HMENU SystemMenu; - /* Handle of the module that created the window. */ - HINSTANCE Instance; /* Entry in the thread's list of windows. */ LIST_ENTRY ListEntry; - /* Pointer to the extra data associated with the window. */ - PCHAR ExtraData; - /* Size of the extra data associated with the window. */ - ULONG ExtraDataSize; /* Handle for the window. */ HWND hSelf; /* Window flags. */ ULONG Flags; - /* Window menu handle or window id */ - UINT IDMenu; /* Handle of region of the window to be updated. */ HANDLE UpdateRegion; /* Handle of the window region. */ @@ -94,7 +82,6 @@ ULONG PropListItems; /* Scrollbar info */ PWINDOW_SCROLLINFO Scroll; - LONG UserData; BOOL Unicode; WNDPROC WndProc; PETHREAD OwnerThread;
Modified: trunk/reactos/subsystems/win32/win32k/include/winpos.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/inc... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/include/winpos.h (original) +++ trunk/reactos/subsystems/win32/win32k/include/winpos.h Fri Nov 16 01:08:13 2007 @@ -10,7 +10,7 @@ (x) < (WndObject)->Wnd->WindowRect.right && \ (y) >= (WndObject)->Wnd->WindowRect.top && \ (y) < (WndObject)->Wnd->WindowRect.bottom && \ - (!(WndObject)->WindowRegion || ((WndObject)->Style & WS_MINIMIZE) || \ + (!(WndObject)->WindowRegion || ((WndObject)->Wnd->Style & WS_MINIMIZE) || \ NtGdiPtInRegion((WndObject)->WindowRegion, (INT)((x) - (WndObject)->Wnd->WindowRect.left), \ (INT)((y) - (WndObject)->Wnd->WindowRect.top))))
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/desktop.c Fri Nov 16 01:08:13 2007 @@ -653,13 +653,15 @@ #else
PWINDOW_OBJECT DesktopWindow; + PWINDOW DesktopWnd;
DesktopWindow = IntGetWindowObject(Desktop->DesktopWindow); if (! DesktopWindow) { return ERROR_INVALID_WINDOW_HANDLE; } - DesktopWindow->Style &= ~WS_VISIBLE; + DesktopWnd = DesktopWindow->Wnd; + DesktopWnd->Style &= ~WS_VISIBLE;
return STATUS_SUCCESS; #endif
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c Fri Nov 16 01:08:13 2007 @@ -147,19 +147,22 @@ HWND hWndFocus = FocusWindow->hSelf; HWND hWndFocusPrev = NULL; PUSER_MESSAGE_QUEUE PrevForegroundQueue; + PWINDOW Wnd;
ASSERT_REFS_CO(Window);
DPRINT("IntSetForegroundAndFocusWindow(%x, %x, %s)\n", hWnd, hWndFocus, MouseActivate ? "TRUE" : "FALSE"); DPRINT("(%wZ)\n", &Window->WindowName);
- if ((Window->Style & (WS_CHILD | WS_POPUP)) == WS_CHILD) + Wnd = Window->Wnd; + + if ((Wnd->Style & (WS_CHILD | WS_POPUP)) == WS_CHILD) { DPRINT("Failed - Child\n"); return FALSE; }
- if (0 == (Window->Style & WS_VISIBLE) && + if (0 == (Wnd->Style & WS_VISIBLE) && Window->OwnerThread->ThreadsProcess != CsrProcess) { DPRINT("Failed - Invisible\n"); @@ -223,10 +226,12 @@ HWND Top; PWINDOW_OBJECT TopWindow; USER_REFERENCE_ENTRY Ref; + PWINDOW Wnd;
ASSERT_REFS_CO(Window);
- if(Window->Style & WS_DISABLED) + Wnd = Window->Wnd; + if(Wnd->Style & WS_DISABLED) { BOOL Ret; PWINDOW_OBJECT TopWnd; @@ -266,6 +271,7 @@ PUSER_MESSAGE_QUEUE ThreadQueue; HWND hWndPrev; HWND hWnd = 0; + PWINDOW Wnd;
if (Window) ASSERT_REFS_CO(Window); @@ -275,9 +281,10 @@
if (Window != 0) { - if ((!(Window->Style & WS_VISIBLE) && + Wnd = Window->Wnd; + if ((!(Wnd->Style & WS_VISIBLE) && Window->OwnerThread->ThreadsProcess != CsrProcess) || - (Window->Style & (WS_POPUP | WS_CHILD)) == WS_CHILD) + (Wnd->Style & (WS_POPUP | WS_CHILD)) == WS_CHILD) { return ThreadQueue ? 0 : ThreadQueue->ActiveWindow; } @@ -521,12 +528,14 @@ HWND hWndPrev; PWINDOW_OBJECT TopWnd; USER_REFERENCE_ENTRY Ref; + PWINDOW Wnd;
ASSERT_REFS_CO(Window);
ThreadQueue = (PUSER_MESSAGE_QUEUE)PsGetCurrentThreadWin32Thread()->MessageQueue;
- if (Window->Style & (WS_MINIMIZE | WS_DISABLED)) + Wnd = Window->Wnd; + if (Wnd->Style & (WS_MINIMIZE | WS_DISABLED)) { return( (ThreadQueue ? ThreadQueue->FocusWindow : 0)); }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/menu.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/menu.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/menu.c Fri Nov 16 01:08:13 2007 @@ -314,7 +314,7 @@ Window = UserGetWindowObject(Menu->MenuInfo.Wnd); if (Window) { - Window->IDMenu = 0; + Window->Wnd->IDMenu = 0; } } ObmDeleteObject(Menu->MenuInfo.Self, otMenu); @@ -1735,7 +1735,7 @@ RETURN(FALSE); }
- hMenu = (HMENU)WindowObject->IDMenu; + hMenu = (HMENU)WindowObject->Wnd->IDMenu;
if (!(MenuObject = UserGetMenuObject(hMenu))) { @@ -2023,7 +2023,7 @@ RETURN(FALSE); }
- if(Window->IDMenu == (UINT)hMenu) + if(Window->Wnd->IDMenu == (UINT)hMenu) { RETURN( IntHiliteMenuItem(Window, Menu, uItemHilite, uHilite)); }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/misc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/misc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/misc.c Fri Nov 16 01:08:13 2007 @@ -268,7 +268,7 @@ RETURN( FALSE); }
- Result = (DWORD)Window->IDMenu; + Result = (DWORD)Window->Wnd->IDMenu;
RETURN( Result); } @@ -346,7 +346,7 @@ RETURN( FALSE); }
- Result = (DWORD)Window->Instance; + Result = (DWORD)Window->Wnd->Instance; RETURN( Result); }
@@ -789,6 +789,7 @@ { BOOL Ret = 0; PWINDOW_OBJECT Window; + PWINDOW Wnd; USER_REFERENCE_ENTRY Ref; DECLARE_RETURN(BOOLEAN);
@@ -800,6 +801,8 @@ RETURN( FALSE); } UserRefObjectCo(Window, &Ref); + + Wnd = Window->Wnd;
/* FIXME: Routine can be 0x53 - 0x5E */ switch (Routine) @@ -813,10 +816,10 @@ PMENU_OBJECT Menu; DPRINT("HWNDLOCK_ROUTINE_DRAWMENUBAR\n"); Ret = FALSE; - if (!((Window->Style & (WS_CHILD | WS_POPUP)) != WS_CHILD)) + if (!((Wnd->Style & (WS_CHILD | WS_POPUP)) != WS_CHILD)) break;
- if(!(Menu = UserGetMenuObject((HMENU) Window->IDMenu))) + if(!(Menu = UserGetMenuObject((HMENU) Wnd->IDMenu))) break;
Menu->MenuInfo.WndOwner = hWnd;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/painting.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/painting.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/painting.c Fri Nov 16 01:08:13 2007 @@ -58,17 +58,19 @@ IntIntersectWithParents(PWINDOW_OBJECT Child, PRECT WindowRect) { PWINDOW_OBJECT ParentWindow; + PWINDOW ParentWnd;
ParentWindow = Child->Parent; while (ParentWindow != NULL) { - if (!(ParentWindow->Style & WS_VISIBLE) || - (ParentWindow->Style & WS_MINIMIZE)) + ParentWnd = ParentWindow->Wnd; + if (!(ParentWnd->Style & WS_VISIBLE) || + (ParentWnd->Style & WS_MINIMIZE)) { return FALSE; }
- if (!IntGdiIntersectRect(WindowRect, WindowRect, &ParentWindow->Wnd->ClientRect)) + if (!IntGdiIntersectRect(WindowRect, WindowRect, &ParentWnd->ClientRect)) { return FALSE; } @@ -85,10 +87,12 @@ IntValidateParent(PWINDOW_OBJECT Child, HRGN hValidateRgn, BOOL Recurse) { PWINDOW_OBJECT ParentWindow = Child->Parent; + PWINDOW ParentWnd;
while (ParentWindow) { - if (ParentWindow->Style & WS_CLIPCHILDREN) + ParentWnd = ParentWindow->Wnd; + if (ParentWnd->Style & WS_CLIPCHILDREN) break;
if (ParentWindow->UpdateRegion != 0) @@ -115,23 +119,25 @@ HRGN FASTCALL IntCalcWindowRgn(PWINDOW_OBJECT Window, BOOL Client) { + PWINDOW Wnd; HRGN hRgnWindow; UINT RgnType;
+ Wnd = Window->Wnd; if (Client) - hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->ClientRect); + hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Wnd->ClientRect); else - hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); - - if (Window->WindowRegion != NULL && !(Window->Style & WS_MINIMIZE)) + hRgnWindow = UnsafeIntCreateRectRgnIndirect(&Wnd->WindowRect); + + if (Window->WindowRegion != NULL && !(Wnd->Style & WS_MINIMIZE)) { NtGdiOffsetRgn(hRgnWindow, - -Window->Wnd->WindowRect.left, - -Window->Wnd->WindowRect.top); + -Wnd->WindowRect.left, + -Wnd->WindowRect.top); RgnType = NtGdiCombineRgn(hRgnWindow, hRgnWindow, Window->WindowRegion, RGN_AND); NtGdiOffsetRgn(hRgnWindow, - Window->Wnd->WindowRect.left, - Window->Wnd->WindowRect.top); + Wnd->WindowRect.left, + Wnd->WindowRect.top); }
return hRgnWindow; @@ -235,6 +241,9 @@ HDC hDC; HWND hWnd = Window->hSelf; HRGN TempRegion; + PWINDOW Wnd; + + Wnd = Window->Wnd;
if (Flags & (RDW_ERASENOW | RDW_UPDATENOW)) { @@ -295,8 +304,8 @@ /* * Paint child windows. */ - if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) && - ((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN))) + if (!(Flags & RDW_NOCHILDREN) && !(Wnd->Style & WS_MINIMIZE) && + ((Flags & RDW_ALLCHILDREN) || !(Wnd->Style & WS_CLIPCHILDREN))) { HWND *List, *phWnd;
@@ -306,7 +315,8 @@ for (phWnd = List; *phWnd; ++phWnd) { Window = UserGetWindowObject(*phWnd); - if (Window && (Window->Style & WS_VISIBLE)) + Wnd = Window->Wnd; + if (Window && (Wnd->Style & WS_VISIBLE)) { USER_REFERENCE_ENTRY Ref; UserRefObjectCo(Window, &Ref); @@ -329,8 +339,11 @@ IntInvalidateWindows(PWINDOW_OBJECT Window, HRGN hRgn, ULONG Flags) { INT RgnType; + PWINDOW Wnd; BOOL HadPaintMessage, HadNCPaintMessage; BOOL HasPaintMessage, HasNCPaintMessage; + + Wnd = Window->Wnd;
/* * If the nonclient is not to be redrawn, clip the region to the client @@ -349,7 +362,7 @@ * Clip the given region with window rectangle (or region) */
- if (!Window->WindowRegion || (Window->Style & WS_MINIMIZE)) + if (!Window->WindowRegion || (Wnd->Style & WS_MINIMIZE)) { HRGN hRgnWindow;
@@ -360,12 +373,12 @@ else { NtGdiOffsetRgn(hRgn, - -Window->Wnd->WindowRect.left, - -Window->Wnd->WindowRect.top); + -Wnd->WindowRect.left, + -Wnd->WindowRect.top); RgnType = NtGdiCombineRgn(hRgn, hRgn, Window->WindowRegion, RGN_AND); NtGdiOffsetRgn(hRgn, - Window->Wnd->WindowRect.left, - Window->Wnd->WindowRect.top); + Wnd->WindowRect.left, + Wnd->WindowRect.top); }
/* @@ -439,14 +452,14 @@ * Process children if needed */
- if (!(Flags & RDW_NOCHILDREN) && !(Window->Style & WS_MINIMIZE) && - ((Flags & RDW_ALLCHILDREN) || !(Window->Style & WS_CLIPCHILDREN))) + if (!(Flags & RDW_NOCHILDREN) && !(Wnd->Style & WS_MINIMIZE) && + ((Flags & RDW_ALLCHILDREN) || !(Wnd->Style & WS_CLIPCHILDREN))) { PWINDOW_OBJECT Child;
for (Child = Window->FirstChild; Child; Child = Child->NextSibling) { - if (Child->Style & WS_VISIBLE) + if (Child->Wnd->Style & WS_VISIBLE) { /* * Recursive call to update children UpdateRegion @@ -497,12 +510,14 @@ BOOL FASTCALL IntIsWindowDrawable(PWINDOW_OBJECT Window) { - PWINDOW_OBJECT Wnd; - - for (Wnd = Window; Wnd != NULL; Wnd = Wnd->Parent) - { + PWINDOW_OBJECT WndObject; + PWINDOW Wnd; + + for (WndObject = Window; WndObject != NULL; WndObject = WndObject->Parent) + { + Wnd = WndObject->Wnd; if (!(Wnd->Style & WS_VISIBLE) || - ((Wnd->Style & WS_MINIMIZE) && (Wnd != Window))) + ((Wnd->Style & WS_MINIMIZE) && (WndObject != Window))) { return FALSE; } @@ -613,7 +628,8 @@ BOOL FASTCALL IntIsWindowDirty(PWINDOW_OBJECT Window) { - return (Window->Style & WS_VISIBLE) && + PWINDOW Wnd = Window->Wnd; + return (Wnd->Style & WS_VISIBLE) && ((Window->UpdateRegion != NULL) || (Window->Flags & WINDOWOBJECT_NEED_INTERNALPAINT) || (Window->Flags & WINDOWOBJECT_NEED_NCPAINT)); @@ -624,19 +640,22 @@ { HWND hChild; PWINDOW_OBJECT TempWindow; + PWINDOW Wnd, TempWnd;
for (; Window != NULL; Window = Window->NextSibling) { + Wnd = Window->Wnd; if (IntWndBelongsToThread(Window, Thread) && IntIsWindowDirty(Window)) { /* Make sure all non-transparent siblings are already drawn. */ - if (Window->ExStyle & WS_EX_TRANSPARENT) + if (Wnd->ExStyle & WS_EX_TRANSPARENT) { for (TempWindow = Window->NextSibling; TempWindow != NULL; TempWindow = TempWindow->NextSibling) { - if (!(TempWindow->ExStyle & WS_EX_TRANSPARENT) && + TempWnd = TempWindow->Wnd; + if (!(TempWnd->ExStyle & WS_EX_TRANSPARENT) && IntWndBelongsToThread(TempWindow, Thread) && IntIsWindowDirty(TempWindow)) { @@ -753,6 +772,7 @@ NTSTATUS Status; DECLARE_RETURN(HDC); USER_REFERENCE_ENTRY Ref; + PWINDOW Wnd;
DPRINT("Enter NtUserBeginPaint\n"); UserEnterExclusive(); @@ -763,6 +783,8 @@ }
UserRefObjectCo(Window, &Ref); + + Wnd = Window->Wnd;
co_UserHideCaret(Window);
@@ -834,7 +856,7 @@ } if (Window->UpdateRegion) { - if (!(Window->Style & WS_CLIPCHILDREN)) + if (!(Wnd->Style & WS_CLIPCHILDREN)) { PWINDOW_OBJECT Child; for (Child = Window->FirstChild; Child; Child = Child->NextSibling) @@ -1616,8 +1638,12 @@ RECT r = *lpRc; LONG ButtonWidth, IconWidth; BOOL HasIcon; + PWINDOW Wnd = NULL;
//ASSERT(pWnd != NULL); + + if (pWnd) + Wnd = pWnd->Wnd;
hMemBmp = NtGdiCreateCompatibleBitmap(hDc, lpRc->right - lpRc->left, @@ -1647,11 +1673,11 @@ VCenter = (lpRc->bottom - lpRc->top) / 2; Padding = VCenter - (Height / 2);
- if ((!hIcon) && (pWnd != NULL)) - { - HasIcon = (uFlags & DC_ICON) && (pWnd->Style & WS_SYSMENU) - && !(uFlags & DC_SMALLCAP) && !(pWnd->ExStyle & WS_EX_DLGMODALFRAME) - && !(pWnd->ExStyle & WS_EX_TOOLWINDOW); + if ((!hIcon) && (Wnd != NULL)) + { + HasIcon = (uFlags & DC_ICON) && (Wnd->Style & WS_SYSMENU) + && !(uFlags & DC_SMALLCAP) && !(Wnd->ExStyle & WS_EX_DLGMODALFRAME) + && !(Wnd->ExStyle & WS_EX_TOOLWINDOW); } else HasIcon = (BOOL) hIcon; @@ -1727,14 +1753,14 @@ COLORREF Colors[2]; PDC pMemDc;
- if (pWnd != NULL) + if (Wnd != NULL) { - if(pWnd->Style & WS_SYSMENU) + if(Wnd->Style & WS_SYSMENU) { r.right -= 3 + ButtonWidth; if(!(uFlags & DC_SMALLCAP)) { - if(pWnd->Style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX)) + if(Wnd->Style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX)) r.right -= 2 + 2 * ButtonWidth; else r.right -= 2; r.right -= 2; @@ -1821,12 +1847,12 @@ ButtonWidth = UserGetSystemMetrics(SM_CXSMSIZE) - 2; else ButtonWidth = UserGetSystemMetrics(SM_CXSIZE) - 2;
- if ((pWnd != NULL) && (pWnd->Style & WS_SYSMENU)) + if ((Wnd != NULL) && (Wnd->Style & WS_SYSMENU)) { r.right -= 3 + ButtonWidth; if(! (uFlags & DC_SMALLCAP)) { - if(pWnd->Style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX)) + if(Wnd->Style & (WS_MAXIMIZEBOX | WS_MINIMIZEBOX)) r.right -= 2 + 2 * ButtonWidth; else r.right -= 2; r.right -= 2;
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/scrollbar.c Fri Nov 16 01:08:13 2007 @@ -60,6 +60,7 @@ IntGetScrollBarRect (PWINDOW_OBJECT Window, INT nBar, PRECT lprect) { BOOL vertical; + PWINDOW Wnd = Window->Wnd; RECT ClientRect = Window->Wnd->ClientRect; RECT WindowRect = Window->Wnd->WindowRect;
@@ -74,7 +75,7 @@ break;
case SB_VERT: - if(Window->ExStyle & WS_EX_LEFTSCROLLBAR) + if(Wnd->ExStyle & WS_EX_LEFTSCROLLBAR) { lprect->right = ClientRect.left - WindowRect.left; lprect->left = lprect->right - UserGetSystemMetrics(SM_CXVSCROLL); @@ -91,7 +92,7 @@
case SB_CTL: IntGetClientRect (Window, lprect); - vertical = ((Window->Style & SBS_VERT) != 0); + vertical = ((Wnd->Style & SBS_VERT) != 0); break;
default: @@ -104,6 +105,7 @@ BOOL FASTCALL IntCalculateThumb(PWINDOW_OBJECT Window, LONG idObject, PSCROLLBARINFO psbi, LPSCROLLINFO psi) { + PWINDOW Wnd = Window->Wnd; INT Thumb, ThumbBox, ThumbPos, cxy, mx; RECT ClientRect;
@@ -119,7 +121,7 @@ break; case SB_CTL: IntGetClientRect (Window, &ClientRect); - if(Window->Style & SBS_VERT) + if(Wnd->Style & SBS_VERT) { Thumb = UserGetSystemMetrics(SM_CYVSCROLL); cxy = ClientRect.bottom - ClientRect.top; @@ -831,8 +833,11 @@ co_UserShowScrollBar(PWINDOW_OBJECT Window, int wBar, DWORD bShow) { DWORD Style, OldStyle; + PWINDOW Wnd;
ASSERT_REFS_CO(Window); + + Wnd = Window->Wnd;
switch(wBar) { @@ -866,20 +871,20 @@ return( TRUE); }
- OldStyle = Window->Style; + OldStyle = Wnd->Style; if(bShow) - Window->Style |= Style; + Wnd->Style |= Style; else - Window->Style &= ~Style; - - if(Window->Style != OldStyle) - { - if(Window->Style & WS_HSCROLL) + Wnd->Style &= ~Style; + + if(Wnd->Style != OldStyle) + { + if(Wnd->Style & WS_HSCROLL) IntUpdateSBInfo(Window, SB_HORZ); - if(Window->Style & WS_VSCROLL) + if(Wnd->Style & WS_VSCROLL) IntUpdateSBInfo(Window, SB_VERT);
- if(Window->Style & WS_VISIBLE) + if(Wnd->Style & WS_VISIBLE) { /* Frame has been changed, let the window redraw itself */ co_WinPosSetWindowPos(Window, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE |
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/vis.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/vis.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/vis.c Fri Nov 16 01:08:13 2007 @@ -39,8 +39,11 @@ { HRGN VisRgn, ClipRgn; PWINDOW_OBJECT PreviousWindow, CurrentWindow, CurrentSibling; + PWINDOW Wnd, CurrentWnd, PreviousWnd, CurrentSiblingWnd;
- if (!(Window->Style & WS_VISIBLE)) + Wnd = Window->Wnd; + + if (!(Wnd->Style & WS_VISIBLE)) { return NULL; } @@ -61,35 +64,38 @@ */
PreviousWindow = Window; + PreviousWnd = PreviousWindow->Wnd; CurrentWindow = Window->Parent; while (CurrentWindow) { - if (!(CurrentWindow->Style & WS_VISIBLE)) + CurrentWnd = CurrentWindow->Wnd; + if (!(CurrentWnd->Style & WS_VISIBLE)) { NtGdiDeleteObject(VisRgn); return NULL; }
- ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->Wnd->ClientRect); + ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWnd->ClientRect); NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND); NtGdiDeleteObject(ClipRgn);
- if ((PreviousWindow->Style & WS_CLIPSIBLINGS) || - (PreviousWindow == Window && ClipSiblings)) + if ((PreviousWnd->Style & WS_CLIPSIBLINGS) || + (PreviousWnd == Wnd && ClipSiblings)) { CurrentSibling = CurrentWindow->FirstChild; while (CurrentSibling != NULL && CurrentSibling != PreviousWindow) { - if ((CurrentSibling->Style & WS_VISIBLE) && - !(CurrentSibling->ExStyle & WS_EX_TRANSPARENT)) + CurrentSiblingWnd = CurrentSibling->Wnd; + if ((CurrentSiblingWnd->Style & WS_VISIBLE) && + !(CurrentSiblingWnd->ExStyle & WS_EX_TRANSPARENT)) { - ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentSibling->Wnd->WindowRect); + ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentSiblingWnd->WindowRect); /* Combine it with the window region if available */ - if (CurrentSibling->WindowRegion && !(CurrentSibling->Style & WS_MINIMIZE)) + if (CurrentSibling->WindowRegion && !(CurrentSiblingWnd->Style & WS_MINIMIZE)) { - NtGdiOffsetRgn(ClipRgn, -CurrentSibling->Wnd->WindowRect.left, -CurrentSibling->Wnd->WindowRect.top); + NtGdiOffsetRgn(ClipRgn, -CurrentSiblingWnd->WindowRect.left, -CurrentSiblingWnd->WindowRect.top); NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentSibling->WindowRegion, RGN_AND); - NtGdiOffsetRgn(ClipRgn, CurrentSibling->Wnd->WindowRect.left, CurrentSibling->Wnd->WindowRect.top); + NtGdiOffsetRgn(ClipRgn, CurrentSiblingWnd->WindowRect.left, CurrentSiblingWnd->WindowRect.top); } NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF); NtGdiDeleteObject(ClipRgn); @@ -99,6 +105,7 @@ }
PreviousWindow = CurrentWindow; + PreviousWnd = PreviousWindow->Wnd; CurrentWindow = CurrentWindow->Parent; }
@@ -107,16 +114,17 @@ CurrentWindow = Window->FirstChild; while (CurrentWindow) { - if ((CurrentWindow->Style & WS_VISIBLE) && - !(CurrentWindow->ExStyle & WS_EX_TRANSPARENT)) + CurrentWnd = CurrentWindow->Wnd; + if ((CurrentWnd->Style & WS_VISIBLE) && + !(CurrentWnd->ExStyle & WS_EX_TRANSPARENT)) { - ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWindow->Wnd->WindowRect); + ClipRgn = UnsafeIntCreateRectRgnIndirect(&CurrentWnd->WindowRect); /* Combine it with the window region if available */ - if (CurrentWindow->WindowRegion && !(CurrentWindow->Style & WS_MINIMIZE)) + if (CurrentWindow->WindowRegion && !(CurrentWnd->Style & WS_MINIMIZE)) { - NtGdiOffsetRgn(ClipRgn, -CurrentWindow->Wnd->WindowRect.left, -CurrentWindow->Wnd->WindowRect.top); + NtGdiOffsetRgn(ClipRgn, -CurrentWnd->WindowRect.left, -CurrentWnd->WindowRect.top); NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentWindow->WindowRegion, RGN_AND); - NtGdiOffsetRgn(ClipRgn, CurrentWindow->Wnd->WindowRect.left, CurrentWindow->Wnd->WindowRect.top); + NtGdiOffsetRgn(ClipRgn, CurrentWnd->WindowRect.left, CurrentWnd->WindowRect.top); } NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF); NtGdiDeleteObject(ClipRgn); @@ -125,11 +133,11 @@ } }
- if (Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) + if (Window->WindowRegion && !(Wnd->Style & WS_MINIMIZE)) { - NtGdiOffsetRgn(VisRgn, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top); + NtGdiOffsetRgn(VisRgn, -Wnd->WindowRect.left, -Wnd->WindowRect.top); NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); - NtGdiOffsetRgn(VisRgn, Window->Wnd->WindowRect.left, Window->Wnd->WindowRect.top); + NtGdiOffsetRgn(VisRgn, Wnd->WindowRect.left, Wnd->WindowRect.top); }
return VisRgn; @@ -143,8 +151,11 @@ HRGN Temp; PWINDOW_OBJECT Parent; USER_REFERENCE_ENTRY Ref; + PWINDOW Wnd, ParentWnd;
ASSERT_REFS_CO(Window); + + Wnd = Window->Wnd;
Temp = NtGdiCreateRectRgn(0, 0, 0, 0); NtGdiCombineRgn(Temp, NewlyExposed, NULL, RGN_COPY); @@ -152,9 +163,10 @@ Parent = Window->Parent; if(Parent) { + ParentWnd = Parent->Wnd; NtGdiOffsetRgn(Temp, - Window->Wnd->WindowRect.left - Parent->Wnd->ClientRect.left, - Window->Wnd->WindowRect.top - Parent->Wnd->ClientRect.top); + Wnd->WindowRect.left - ParentWnd->ClientRect.left, + Wnd->WindowRect.top - ParentWnd->ClientRect.top);
UserRefObjectCo(Parent, &Ref); co_UserRedrawWindow(Parent, NULL, Temp,
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c Fri Nov 16 01:08:13 2007 @@ -115,6 +115,10 @@ DceAllocDCE(PWINDOW_OBJECT Window OPTIONAL, DCE_TYPE Type) { PDCE pDce; + PWINDOW Wnd = NULL; + + if (Window) + Wnd = Window->Wnd;
pDce = ExAllocatePoolWithTag(PagedPool, sizeof(DCE), TAG_PDCE); if(!pDce) @@ -162,13 +166,13 @@ { pDce->DCXFlags = DCX_DCEBUSY;
- if (Window) + if (Wnd) { - if (Window->Style & WS_CLIPCHILDREN) + if (Wnd->Style & WS_CLIPCHILDREN) { pDce->DCXFlags |= DCX_CLIPCHILDREN; } - if (Window->Style & WS_CLIPSIBLINGS) + if (Wnd->Style & WS_CLIPSIBLINGS) { pDce->DCXFlags |= DCX_CLIPSIBLINGS; } @@ -186,6 +190,7 @@ DceSetDrawable(PWINDOW_OBJECT Window OPTIONAL, HDC hDC, ULONG Flags, BOOL SetClipOrigin) { + PWINDOW Wnd; DC *dc = DC_LockDc(hDC); if(!dc) return; @@ -197,15 +202,16 @@ } else { + Wnd = Window->Wnd; if (Flags & DCX_WINDOW) { - dc->w.DCOrgX = Window->Wnd->WindowRect.left; - dc->w.DCOrgY = Window->Wnd->WindowRect.top; + dc->w.DCOrgX = Wnd->WindowRect.left; + dc->w.DCOrgY = Wnd->WindowRect.top; } else { - dc->w.DCOrgX = Window->Wnd->ClientRect.left; - dc->w.DCOrgY = Window->Wnd->ClientRect.top; + dc->w.DCOrgX = Wnd->ClientRect.left; + dc->w.DCOrgY = Wnd->ClientRect.top; } } DC_UnlockDc(dc); @@ -287,6 +293,7 @@ if (Flags & DCX_PARENTCLIP) { PWINDOW_OBJECT Parent; + PWINDOW ParentWnd;
Parent = Window->Parent; if(!Parent) @@ -295,7 +302,9 @@ goto noparent; }
- if (Parent->Style & WS_CLIPSIBLINGS) + ParentWnd = Parent->Wnd; + + if (ParentWnd->Style & WS_CLIPSIBLINGS) { DcxFlags = DCX_CLIPSIBLINGS | (Flags & ~(DCX_CLIPCHILDREN | DCX_WINDOW)); @@ -367,11 +376,14 @@ DCE* Dce; BOOL UpdateVisRgn = TRUE; BOOL UpdateClipOrigin = FALSE; + PWINDOW Wnd = NULL;
if (NULL == Window) { Flags &= ~DCX_USESTYLE; } + else + Wnd = Window->Wnd;
if (NULL == Window || NULL == Window->Dce) { @@ -382,7 +394,7 @@ { Flags &= ~(DCX_CLIPCHILDREN | DCX_CLIPSIBLINGS | DCX_PARENTCLIP);
- if (Window->Style & WS_CLIPSIBLINGS) + if (Wnd->Style & WS_CLIPSIBLINGS) { Flags |= DCX_CLIPSIBLINGS; } @@ -394,8 +406,8 @@ Flags |= DCX_PARENTCLIP; }
- if (Window->Style & WS_CLIPCHILDREN && - !(Window->Style & WS_MINIMIZE)) + if (Wnd->Style & WS_CLIPCHILDREN && + !(Wnd->Style & WS_MINIMIZE)) { Flags |= DCX_CLIPCHILDREN; } @@ -419,18 +431,18 @@
Parent = (Window ? Window->Parent : NULL);
- if (NULL == Window || !(Window->Style & WS_CHILD) || NULL == Parent) + if (NULL == Window || !(Wnd->Style & WS_CHILD) || NULL == Parent) { Flags &= ~DCX_PARENTCLIP; } else if (Flags & DCX_PARENTCLIP) { Flags |= DCX_CACHE; - if ((Window->Style & WS_VISIBLE) && - (Parent->Style & WS_VISIBLE)) + if ((Wnd->Style & WS_VISIBLE) && + (Parent->Wnd->Style & WS_VISIBLE)) { Flags &= ~DCX_CLIPCHILDREN; - if (Parent->Style & WS_CLIPSIBLINGS) + if (Parent->Wnd->Style & WS_CLIPSIBLINGS) { Flags |= DCX_CLIPSIBLINGS; }
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/window.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c Fri Nov 16 01:08:13 2007 @@ -155,11 +155,11 @@ PWINDOW_OBJECT FASTCALL IntGetParent(PWINDOW_OBJECT Wnd) { - if (Wnd->Style & WS_POPUP) + if (Wnd->Wnd->Style & WS_POPUP) { return UserGetWindowObject(Wnd->hOwner); } - else if (Wnd->Style & WS_CHILD) + else if (Wnd->Wnd->Style & WS_CHILD) { return Wnd->Parent; } @@ -326,8 +326,11 @@ PWINDOW_OBJECT Child; PMENU_OBJECT Menu; BOOLEAN BelongsToThreadData; + PWINDOW Wnd;
ASSERT(Window); + + Wnd = Window->Wnd;
if(Window->Status & WINDOWSTATUS_DESTROYING) { @@ -335,7 +338,7 @@ return 0; } Window->Status |= WINDOWSTATUS_DESTROYING; - Window->Style &= ~WS_VISIBLE; + Wnd->Style &= ~WS_VISIBLE; /* remove the window already at this point from the thread window list so we don't get into trouble when destroying the thread windows while we're still in IntDestroyWindow() */ @@ -421,11 +424,11 @@ TIMER_RemoveWindowTimers(Window->hSelf); #endif
- if (!(Window->Style & WS_CHILD) && Window->IDMenu - && (Menu = UserGetMenuObject((HMENU)Window->IDMenu))) + if (!(Wnd->Style & WS_CHILD) && Wnd->IDMenu + && (Menu = UserGetMenuObject((HMENU)Wnd->IDMenu))) { IntDestroyMenuObject(Menu, TRUE, TRUE); - Window->IDMenu = 0; + Wnd->IDMenu = 0; }
if(Window->SystemMenu @@ -475,19 +478,20 @@ VOID FASTCALL IntGetWindowBorderMeasures(PWINDOW_OBJECT Window, UINT *cx, UINT *cy) { - if(HAS_DLGFRAME(Window->Style, Window->ExStyle) && !(Window->Style & WS_MINIMIZE)) + PWINDOW Wnd = Window->Wnd; + if(HAS_DLGFRAME(Wnd->Style, Wnd->ExStyle) && !(Wnd->Style & WS_MINIMIZE)) { *cx = UserGetSystemMetrics(SM_CXDLGFRAME); *cy = UserGetSystemMetrics(SM_CYDLGFRAME); } else { - if(HAS_THICKFRAME(Window->Style, Window->ExStyle)&& !(Window->Style & WS_MINIMIZE)) + if(HAS_THICKFRAME(Wnd->Style, Wnd->ExStyle)&& !(Wnd->Style & WS_MINIMIZE)) { *cx = UserGetSystemMetrics(SM_CXFRAME); *cy = UserGetSystemMetrics(SM_CYFRAME); } - else if(HAS_THINFRAME(Window->Style, Window->ExStyle)) + else if(HAS_THINFRAME(Wnd->Style, Wnd->ExStyle)) { *cx = UserGetSystemMetrics(SM_CXBORDER); *cy = UserGetSystemMetrics(SM_CYBORDER); @@ -556,11 +560,13 @@ BOOL FASTCALL IntGetWindowInfo(PWINDOW_OBJECT Window, PWINDOWINFO pwi) { + PWINDOW Wnd = Window->Wnd; + pwi->cbSize = sizeof(WINDOWINFO); pwi->rcWindow = Window->Wnd->WindowRect; pwi->rcClient = Window->Wnd->ClientRect; - pwi->dwStyle = Window->Style; - pwi->dwExStyle = Window->ExStyle; + pwi->dwStyle = Wnd->Style; + pwi->dwExStyle = Wnd->ExStyle; pwi->dwWindowStatus = (UserGetForegroundWindow() == Window->hSelf); /* WS_ACTIVECAPTION */ IntGetWindowBorderMeasures(Window, &pwi->cxWindowBorders, &pwi->cyWindowBorders); pwi->atomWindowType = (Window->Class ? Window->Class->Atom : 0); @@ -575,22 +581,23 @@ BOOL *Changed) { PMENU_OBJECT OldMenu, NewMenu = NULL; - - if ((Window->Style & (WS_CHILD | WS_POPUP)) == WS_CHILD) + PWINDOW Wnd = Window->Wnd; + + if ((Wnd->Style & (WS_CHILD | WS_POPUP)) == WS_CHILD) { SetLastWin32Error(ERROR_INVALID_WINDOW_HANDLE); return FALSE; }
- *Changed = (Window->IDMenu != (UINT) Menu); + *Changed = (Wnd->IDMenu != (UINT) Menu); if (! *Changed) { return TRUE; }
- if (Window->IDMenu) - { - OldMenu = IntGetMenuObject((HMENU) Window->IDMenu); + if (Wnd->IDMenu) + { + OldMenu = IntGetMenuObject((HMENU) Wnd->IDMenu); ASSERT(NULL == OldMenu || OldMenu->MenuInfo.Wnd == Window->hSelf); } else @@ -623,7 +630,7 @@
}
- Window->IDMenu = (UINT) Menu; + Wnd->IDMenu = (UINT) Menu; if (NULL != NewMenu) { NewMenu->MenuInfo.Wnd = Window->hSelf; @@ -828,15 +835,17 @@ IntIsChildWindow(PWINDOW_OBJECT Parent, PWINDOW_OBJECT BaseWindow) { PWINDOW_OBJECT Window; + PWINDOW Wnd;
Window = BaseWindow; while (Window) { + Wnd = Window->Wnd; if (Window == Parent) { return(TRUE); } - if(!(Window->Style & WS_CHILD)) + if(!(Wnd->Style & WS_CHILD)) { break; } @@ -851,15 +860,17 @@ IntIsWindowVisible(PWINDOW_OBJECT BaseWindow) { PWINDOW_OBJECT Window; + PWINDOW Wnd;
Window = BaseWindow; while(Window) { - if(!(Window->Style & WS_CHILD)) + Wnd = Window->Wnd; + if(!(Wnd->Style & WS_CHILD)) { break; } - if(!(Window->Style & WS_VISIBLE)) + if(!(Wnd->Style & WS_VISIBLE)) { return FALSE; } @@ -867,7 +878,7 @@ Window = Window->Parent; }
- if(Window && Window->Style & WS_VISIBLE) + if(Window && Wnd->Style & WS_VISIBLE) { return TRUE; } @@ -988,11 +999,11 @@ { IntUnlinkWindow(Wnd); InsertAfter = NULL; - if (0 == (Wnd->ExStyle & WS_EX_TOPMOST)) + if (0 == (Wnd->Wnd->ExStyle & WS_EX_TOPMOST)) { /* Not a TOPMOST window, put after TOPMOSTs of new parent */ Sibling = WndNewParent->FirstChild; - while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST)) + while (NULL != Sibling && 0 != (Sibling->Wnd->ExStyle & WS_EX_TOPMOST)) { InsertAfter = Sibling; Sibling = Sibling->NextSibling; @@ -1015,7 +1026,7 @@ * in the z-order and send the expected WM_WINDOWPOSCHANGING and * WM_WINDOWPOSCHANGED notification messages. */ - co_WinPosSetWindowPos(Wnd, (0 == (Wnd->ExStyle & WS_EX_TOPMOST) ? HWND_TOP : HWND_TOPMOST), + co_WinPosSetWindowPos(Wnd, (0 == (Wnd->Wnd->ExStyle & WS_EX_TOPMOST) ? HWND_TOP : HWND_TOPMOST), 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | (WasVisible ? SWP_SHOWWINDOW : 0));
@@ -1102,7 +1113,7 @@
for(Child = Window->FirstChild; Child; Child = Child->NextSibling) { - if(Child->hOwner && Child->Style & WS_VISIBLE) + if(Child->hOwner && Child->Wnd->Style & WS_VISIBLE) { /* * The desktop has a popup window if one of them has @@ -1334,17 +1345,19 @@ for(phWnd = List; *phWnd; phWnd++) { PWINDOW_OBJECT Child; + PWINDOW ChildWnd; if((Child = UserGetWindowObject(*phWnd))) { - if(!(Child->Style & WS_VISIBLE) && (uiFlags & CWP_SKIPINVISIBLE)) + ChildWnd = Child->Wnd; + if(!(ChildWnd->Style & WS_VISIBLE) && (uiFlags & CWP_SKIPINVISIBLE)) { continue; } - if((Child->Style & WS_DISABLED) && (uiFlags & CWP_SKIPDISABLED)) + if((ChildWnd->Style & WS_DISABLED) && (uiFlags & CWP_SKIPDISABLED)) { continue; } - if((Child->ExStyle & WS_EX_TRANSPARENT) && (uiFlags & CWP_SKIPTRANSPARENT)) + if((ChildWnd->ExStyle & WS_EX_TRANSPARENT) && (uiFlags & CWP_SKIPTRANSPARENT)) { continue; } @@ -1429,6 +1442,7 @@ BOOL bUnicodeWindow) { PWINSTATION_OBJECT WinSta; + PWINDOW Wnd = NULL; PWINDOWCLASS *ClassLink, Class = NULL; RTL_ATOM ClassAtom; PWINDOW_OBJECT Window = NULL; @@ -1544,17 +1558,19 @@ /* Create the window object. */ Window = (PWINDOW_OBJECT) ObmCreateObject(gHandleTable, (PHANDLE)&hWnd, - otWindow, sizeof(WINDOW_OBJECT) + Class->WndExtra - ); + otWindow, sizeof(WINDOW_OBJECT)); if (Window) { Window->Wnd = DesktopHeapAlloc(ti->Desktop, - sizeof(WINDOW)); + sizeof(WINDOW) + Class->WndExtra); if (!Window->Wnd) goto AllocErr; - - Window->Wnd->ti = ti; - Window->Wnd->pi = ti->kpi; + Wnd = Window->Wnd; + + RtlZeroMemory(Window->Wnd, + sizeof(WINDOW) + Class->WndExtra); + Wnd->ti = ti; + Wnd->pi = ti->kpi; }
DPRINT("Created object with handle %X\n", hWnd); @@ -1585,8 +1601,8 @@
Window->SystemMenu = (HMENU)0; Window->ContextHelpId = 0; - Window->IDMenu = 0; - Window->Instance = hInstance; + Wnd->IDMenu = 0; + Wnd->Instance = hInstance; Window->hSelf = hWnd;
if (!hMenu) @@ -1594,7 +1610,7 @@
if (0 != (dwStyle & WS_CHILD)) { - Window->IDMenu = (UINT) hMenu; + Wnd->IDMenu = (UINT) hMenu; } else { @@ -1616,7 +1632,7 @@ HasOwner = FALSE; }
- Window->UserData = 0; + Wnd->UserData = 0;
Window->IsSystem = Window->Class->System; if (Window->Class->System) @@ -1638,11 +1654,7 @@ Window->LastChild = NULL; Window->PrevSibling = NULL; Window->NextSibling = NULL; - Window->ExtraDataSize = Window->Class->WndExtra; - - /* extra window data */ - if (Window->Class->WndExtra) - Window->ExtraData = (PCHAR)(Window + 1); + Wnd->ExtraDataSize = Window->Class->WndExtra;
InitializeListHead(&Window->PropListHead); InitializeListHead(&Window->WndObjListHead); @@ -1717,8 +1729,8 @@ Size.cx = nWidth; Size.cy = nHeight;
- Window->ExStyle = dwExStyle; - Window->Style = dwStyle & ~WS_VISIBLE; + Wnd->ExStyle = dwExStyle; + Wnd->Style = dwStyle & ~WS_VISIBLE;
/* call hook */ Cs.lpCreateParams = lpParam; @@ -1729,7 +1741,7 @@ Cs.cy = Size.cy; Cs.x = Pos.x; Cs.y = Pos.y; - Cs.style = Window->Style; + Cs.style = Wnd->Style; Cs.lpszName = (LPCWSTR) WindowName; Cs.lpszClass = (LPCWSTR) ClassName; Cs.dwExStyle = dwExStyle; @@ -1749,7 +1761,7 @@ nHeight = Cs.cy;
/* default positioning for overlapped windows */ - if(!(Window->Style & (WS_POPUP | WS_CHILD))) + if(!(Wnd->Style & (WS_POPUP | WS_CHILD))) { RECT rc, WorkArea; PRTL_USER_PROCESS_PARAMETERS ProcessParams; @@ -1843,16 +1855,16 @@ }
/* Initialize the window dimensions. */ - Window->Wnd->WindowRect.left = Pos.x; - Window->Wnd->WindowRect.top = Pos.y; - Window->Wnd->WindowRect.right = Pos.x + Size.cx; - Window->Wnd->WindowRect.bottom = Pos.y + Size.cy; - if (0 != (Window->Style & WS_CHILD) && ParentWindow) - { - IntGdiOffsetRect(&(Window->Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left, + Wnd->WindowRect.left = Pos.x; + Wnd->WindowRect.top = Pos.y; + Wnd->WindowRect.right = Pos.x + Size.cx; + Wnd->WindowRect.bottom = Pos.y + Size.cy; + if (0 != (Wnd->Style & WS_CHILD) && ParentWindow) + { + IntGdiOffsetRect(&(Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left, ParentWindow->Wnd->ClientRect.top); } - Window->Wnd->ClientRect = Window->Wnd->WindowRect; + Wnd->ClientRect = Wnd->WindowRect;
/* * Get the size and position of the window. @@ -1878,16 +1890,16 @@ Size.cy = 0; }
- Window->Wnd->WindowRect.left = Pos.x; - Window->Wnd->WindowRect.top = Pos.y; - Window->Wnd->WindowRect.right = Pos.x + Size.cx; - Window->Wnd->WindowRect.bottom = Pos.y + Size.cy; - if (0 != (Window->Style & WS_CHILD) && ParentWindow) - { - IntGdiOffsetRect(&(Window->Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left, + Wnd->WindowRect.left = Pos.x; + Wnd->WindowRect.top = Pos.y; + Wnd->WindowRect.right = Pos.x + Size.cx; + Wnd->WindowRect.bottom = Pos.y + Size.cy; + if (0 != (Wnd->Style & WS_CHILD) && ParentWindow) + { + IntGdiOffsetRect(&(Wnd->WindowRect), ParentWindow->Wnd->ClientRect.left, ParentWindow->Wnd->ClientRect.top); } - Window->Wnd->ClientRect = Window->Wnd->WindowRect; + Wnd->ClientRect = Wnd->WindowRect;
/* FIXME: Initialize the window menu. */
@@ -1944,7 +1956,7 @@ { InsertAfter = NULL; Sibling = ParentWindow->FirstChild; - while (Sibling && (Sibling->ExStyle & WS_EX_TOPMOST)) + while (Sibling && (Sibling->Wnd->ExStyle & WS_EX_TOPMOST)) { InsertAfter = Sibling; Sibling = Sibling->NextSibling; @@ -1997,15 +2009,15 @@
DPRINT("IntCreateWindow(): About to send WM_MOVE\n");
- if (0 != (Window->Style & WS_CHILD) && ParentWindow) - { - lParam = MAKE_LONG(Window->Wnd->ClientRect.left - ParentWindow->Wnd->ClientRect.left, - Window->Wnd->ClientRect.top - ParentWindow->Wnd->ClientRect.top); + if (0 != (Wnd->Style & WS_CHILD) && ParentWindow) + { + lParam = MAKE_LONG(Wnd->ClientRect.left - ParentWindow->Wnd->ClientRect.left, + Wnd->ClientRect.top - ParentWindow->Wnd->ClientRect.top); } else { - lParam = MAKE_LONG(Window->Wnd->ClientRect.left, - Window->Wnd->ClientRect.top); + lParam = MAKE_LONG(Wnd->ClientRect.left, + Wnd->ClientRect.top); }
@@ -2019,16 +2031,16 @@ }
/* Show or maybe minimize or maximize the window. */ - if (Window->Style & (WS_MINIMIZE | WS_MAXIMIZE)) + if (Wnd->Style & (WS_MINIMIZE | WS_MAXIMIZE)) { RECT NewPos; UINT16 SwFlag;
- SwFlag = (Window->Style & WS_MINIMIZE) ? SW_MINIMIZE : + SwFlag = (Wnd->Style & WS_MINIMIZE) ? SW_MINIMIZE : SW_MAXIMIZE; co_WinPosMinMaximize(Window, SwFlag, &NewPos); SwFlag = - ((Window->Style & WS_CHILD) || UserGetActiveWindow()) ? + ((Wnd->Style & WS_CHILD) || UserGetActiveWindow()) ? SWP_NOACTIVATE | SWP_NOZORDER | SWP_FRAMECHANGED : SWP_NOZORDER | SWP_FRAMECHANGED; DPRINT("IntCreateWindow(): About to minimize/maximize\n"); @@ -2038,13 +2050,13 @@ }
/* Notify the parent window of a new child. */ - if ((Window->Style & WS_CHILD) && - (!(Window->ExStyle & WS_EX_NOPARENTNOTIFY)) && ParentWindow) + if ((Wnd->Style & WS_CHILD) && + (!(Wnd->ExStyle & WS_EX_NOPARENTNOTIFY)) && ParentWindow) { DPRINT("IntCreateWindow(): About to notify parent\n"); co_IntSendMessage(ParentWindow->hSelf, WM_PARENTNOTIFY, - MAKEWPARAM(WM_CREATE, Window->IDMenu), + MAKEWPARAM(WM_CREATE, Wnd->IDMenu), (LPARAM)Window->hSelf); }
@@ -2059,11 +2071,11 @@ }
/* Initialize and show the window's scrollbars */ - if (Window->Style & WS_VSCROLL) + if (Wnd->Style & WS_VSCROLL) { co_UserShowScrollBar(Window, SB_VERT, TRUE); } - if (Window->Style & WS_HSCROLL) + if (Wnd->Style & WS_HSCROLL) { co_UserShowScrollBar(Window, SB_HORZ, TRUE); } @@ -2201,8 +2213,11 @@ BOOLEAN FASTCALL co_UserDestroyWindow(PWINDOW_OBJECT Window) { BOOLEAN isChild; + PWINDOW Wnd;
ASSERT_REFS_CO(Window); //fixme: temp hack? + + Wnd = Window->Wnd;
/* Check for owner thread */ if ((Window->OwnerThread != PsGetCurrentThread())) @@ -2240,7 +2255,7 @@ #endif
IntEngWindowChanged(Window, WOC_DELETE); - isChild = (0 != (Window->Style & WS_CHILD)); + isChild = (0 != (Wnd->Style & WS_CHILD));
#if 0 /* FIXME */
@@ -3440,6 +3455,7 @@ UserGetWindowLong(HWND hWnd, DWORD Index, BOOL Ansi) { PWINDOW_OBJECT Window, Parent; + PWINDOW Wnd; LONG Result = 0;
DPRINT("NtUserGetWindowLong(%x,%d,%d)\n", hWnd, (INT)Index, Ansi); @@ -3448,6 +3464,8 @@ { return 0; } + + Wnd = Window->Wnd;
/* * WndProc is only available to the owner process @@ -3461,23 +3479,23 @@
if ((INT)Index >= 0) { - if ((Index + sizeof(LONG)) > Window->ExtraDataSize) + if ((Index + sizeof(LONG)) > Window->Wnd->ExtraDataSize) { SetLastWin32Error(ERROR_INVALID_PARAMETER); return 0; } - Result = *((LONG *)(Window->ExtraData + Index)); + Result = *((LONG *)((PCHAR)(Window->Wnd + 1) + Index)); } else { switch (Index) { case GWL_EXSTYLE: - Result = Window->ExStyle; + Result = Wnd->ExStyle; break;
case GWL_STYLE: - Result = Window->Style; + Result = Wnd->Style; break;
case GWL_WNDPROC: @@ -3486,7 +3504,7 @@ break;
case GWL_HINSTANCE: - Result = (LONG) Window->Instance; + Result = (LONG) Wnd->Instance; break;
case GWL_HWNDPARENT: @@ -3501,11 +3519,11 @@ break;
case GWL_ID: - Result = (LONG) Window->IDMenu; + Result = (LONG) Wnd->IDMenu; break;
case GWL_USERDATA: - Result = Window->UserData; + Result = Wnd->UserData; break;
default: @@ -3638,6 +3656,7 @@ co_UserSetWindowLong(HWND hWnd, DWORD Index, LONG NewValue, BOOL Ansi) { PWINDOW_OBJECT Window, Parent; + PWINDOW Wnd; PWINSTATION_OBJECT WindowStation; LONG OldValue; STYLESTRUCT Style; @@ -3653,22 +3672,24 @@ return( 0); }
+ Wnd = Window->Wnd; + if ((INT)Index >= 0) { - if ((Index + sizeof(LONG)) > Window->ExtraDataSize) + if ((Index + sizeof(LONG)) > Wnd->ExtraDataSize) { SetLastWin32Error(ERROR_INVALID_PARAMETER); return( 0); } - OldValue = *((LONG *)(Window->ExtraData + Index)); - *((LONG *)(Window->ExtraData + Index)) = NewValue; + OldValue = *((LONG *)((PCHAR)(Wnd + 1) + Index)); + *((LONG *)((PCHAR)(Wnd + 1) + Index)) = NewValue; } else { switch (Index) { case GWL_EXSTYLE: - OldValue = (LONG) Window->ExStyle; + OldValue = (LONG) Wnd->ExStyle; Style.styleOld = OldValue; Style.styleNew = NewValue;
@@ -3683,16 +3704,16 @@ }
co_IntSendMessage(hWnd, WM_STYLECHANGING, GWL_EXSTYLE, (LPARAM) &Style); - Window->ExStyle = (DWORD)Style.styleNew; + Wnd->ExStyle = (DWORD)Style.styleNew; co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_EXSTYLE, (LPARAM) &Style); break;
case GWL_STYLE: - OldValue = (LONG) Window->Style; + OldValue = (LONG) Wnd->Style; Style.styleOld = OldValue; Style.styleNew = NewValue; co_IntSendMessage(hWnd, WM_STYLECHANGING, GWL_STYLE, (LPARAM) &Style); - Window->Style = (DWORD)Style.styleNew; + Wnd->Style = (DWORD)Style.styleNew; co_IntSendMessage(hWnd, WM_STYLECHANGED, GWL_STYLE, (LPARAM) &Style); break;
@@ -3706,8 +3727,8 @@ }
case GWL_HINSTANCE: - OldValue = (LONG) Window->Instance; - Window->Instance = (HINSTANCE) NewValue; + OldValue = (LONG) Wnd->Instance; + Wnd->Instance = (HINSTANCE) NewValue; break;
case GWL_HWNDPARENT: @@ -3719,13 +3740,13 @@ break;
case GWL_ID: - OldValue = (LONG) Window->IDMenu; - Window->IDMenu = (UINT) NewValue; + OldValue = (LONG) Wnd->IDMenu; + Wnd->IDMenu = (UINT) NewValue; break;
case GWL_USERDATA: - OldValue = Window->UserData; - Window->UserData = NewValue; + OldValue = Wnd->UserData; + Wnd->UserData = NewValue; break;
default: @@ -3806,14 +3827,14 @@ } }
- if (Index > Window->ExtraDataSize - sizeof(WORD)) + if (Index > Window->Wnd->ExtraDataSize - sizeof(WORD)) { SetLastWin32Error(ERROR_INVALID_PARAMETER); RETURN( 0); }
- OldValue = *((WORD *)(Window->ExtraData + Index)); - *((WORD *)(Window->ExtraData + Index)) = NewValue; + OldValue = *((WORD *)((PCHAR)(Window->Wnd + 1) + Index)); + *((WORD *)((PCHAR)(Window->Wnd + 1) + Index)) = NewValue;
RETURN( OldValue);
@@ -3831,6 +3852,7 @@ WINDOWPLACEMENT *lpwndpl) { PWINDOW_OBJECT Window; + PWINDOW Wnd; PINTERNALPOS InternalPos; POINT Size; WINDOWPLACEMENT Safepl; @@ -3844,6 +3866,7 @@ { RETURN( FALSE); } + Wnd = Window->Wnd;
Status = MmCopyFromCaller(&Safepl, lpwndpl, sizeof(WINDOWPLACEMENT)); if(!NT_SUCCESS(Status)) @@ -3857,28 +3880,28 @@ }
Safepl.flags = 0; - if (0 == (Window->Style & WS_VISIBLE)) + if (0 == (Wnd->Style & WS_VISIBLE)) { Safepl.showCmd = SW_HIDE; } else if (0 != (Window->Flags & WINDOWOBJECT_RESTOREMAX) || - 0 != (Window->Style & WS_MAXIMIZE)) + 0 != (Wnd->Style & WS_MAXIMIZE)) { Safepl.showCmd = SW_MAXIMIZE; } - else if (0 != (Window->Style & WS_MINIMIZE)) + else if (0 != (Wnd->Style & WS_MINIMIZE)) { Safepl.showCmd = SW_MINIMIZE; } - else if (0 != (Window->Style & WS_VISIBLE)) + else if (0 != (Wnd->Style & WS_VISIBLE)) { Safepl.showCmd = SW_SHOWNORMAL; }
- Size.x = Window->Wnd->WindowRect.left; - Size.y = Window->Wnd->WindowRect.top; + Size.x = Wnd->WindowRect.left; + Size.y = Wnd->WindowRect.top; InternalPos = WinPosInitInternalPos(Window, &Size, - &Window->Wnd->WindowRect); + &Wnd->WindowRect); if (InternalPos) { Safepl.rcNormalPosition = InternalPos->NormalRect; @@ -4241,6 +4264,7 @@ WINDOWPLACEMENT *lpwndpl) { PWINDOW_OBJECT Window; + PWINDOW Wnd; WINDOWPLACEMENT Safepl; NTSTATUS Status; DECLARE_RETURN(BOOL); @@ -4253,6 +4277,8 @@ { RETURN( FALSE); } + Wnd = Window->Wnd; + Status = MmCopyFromCaller(&Safepl, lpwndpl, sizeof(WINDOWPLACEMENT)); if(!NT_SUCCESS(Status)) { @@ -4266,7 +4292,7 @@
UserRefObjectCo(Window, &Ref);
- if ((Window->Style & (WS_MAXIMIZE | WS_MINIMIZE)) == 0) + if ((Wnd->Style & (WS_MAXIMIZE | WS_MINIMIZE)) == 0) { co_WinPosSetWindowPos(Window, NULL, Safepl.rcNormalPosition.left, Safepl.rcNormalPosition.top, @@ -4339,6 +4365,7 @@ INT Ret; HRGN VisRgn; ROSRGNDATA *pRgn; + PWINDOW Wnd;
if(!Window) { @@ -4348,12 +4375,14 @@ { return ERROR; } + + Wnd = Window->Wnd;
/* Create a new window region using the window rectangle */ VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); NtGdiOffsetRgn(VisRgn, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top); /* if there's a region assigned to the window, combine them both */ - if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) + if(Window->WindowRegion && !(Wnd->Style & WS_MINIMIZE)) NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND); /* Copy the region into hRgn */ NtGdiCombineRgn(hRgn, VisRgn, NULL, RGN_COPY); @@ -4377,6 +4406,7 @@ INT Ret; HRGN VisRgn; ROSRGNDATA *pRgn; + PWINDOW Wnd;
if(!Window) { @@ -4386,12 +4416,14 @@ { return ERROR; } + + Wnd = Window->Wnd;
/* Create a new window region using the window rectangle */ VisRgn = UnsafeIntCreateRectRgnIndirect(&Window->Wnd->WindowRect); NtGdiOffsetRgn(VisRgn, -Window->Wnd->WindowRect.left, -Window->Wnd->WindowRect.top); /* if there's a region assigned to the window, combine them both */ - if(Window->WindowRegion && !(Window->Style & WS_MINIMIZE)) + if(Window->WindowRegion && !(Wnd->Style & WS_MINIMIZE)) NtGdiCombineRgn(VisRgn, VisRgn, Window->WindowRegion, RGN_AND);
if((pRgn = RGNDATA_LockRgn(VisRgn))) @@ -4743,7 +4775,7 @@ } else { - if (pWnd->Style & WS_VISIBLE) + if (pWnd->Wnd->Style & WS_VISIBLE) { /* In Windows, ShowOwnedPopups(FALSE) generates * WM_SHOWWINDOW messages with SW_PARENTCLOSING,
Modified: trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntu... ============================================================================== --- trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c (original) +++ trunk/reactos/subsystems/win32/win32k/ntuser/winpos.c Fri Nov 16 01:08:13 2007 @@ -138,7 +138,7 @@ LONG style;
if (!Wnd) return FALSE; - style = Wnd->Style; + style = Wnd->Wnd->Style; if (!(style & WS_VISIBLE) && Wnd->OwnerThread->ThreadsProcess != CsrProcess) return FALSE; if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE; @@ -157,8 +157,11 @@ PWINDOW_OBJECT WndTo = NULL; HWND Fg; USER_REFERENCE_ENTRY Ref; + PWINDOW Wnd;
ASSERT_REFS_CO(Window); + + Wnd = Window->Wnd;
if (IntIsDesktopWindow(Window)) { @@ -167,7 +170,7 @@ }
/* If this is popup window, try to activate the owner first. */ - if ((Window->Style & WS_POPUP) && (WndTo = IntGetOwner(Window))) + if ((Wnd->Style & WS_POPUP) && (WndTo = IntGetOwner(Window))) { WndTo = UserGetAncestor( WndTo, GA_ROOT ); if (can_activate_window(WndTo)) goto done; @@ -226,11 +229,14 @@ for( i = 0; List[i]; i++) { PWINDOW_OBJECT WndChild; + PWINDOW ChildWnd;
if (!(WndChild = UserGetWindowObject(List[i]))) continue;
- if((WndChild->Style & WS_MINIMIZE) != 0 ) + ChildWnd = WndChild->Wnd; + + if((ChildWnd->Style & WS_MINIMIZE) != 0 ) { USER_REFERENCE_ENTRY Ref; UserRefObjectCo(WndChild, &Ref); @@ -266,6 +272,7 @@ { PWINDOW_OBJECT Parent; UINT XInc, YInc; + PWINDOW Wnd = Window->Wnd;
if (Window->InternalPos == NULL) { @@ -296,11 +303,11 @@ Window->InternalPos->IconPos.x = WorkArea.left; Window->InternalPos->IconPos.y = WorkArea.bottom - UserGetSystemMetrics(SM_CYMINIMIZED); } - if (Window->Style & WS_MINIMIZE) + if (Wnd->Style & WS_MINIMIZE) { Window->InternalPos->IconPos = *pt; } - else if (Window->Style & WS_MAXIMIZE) + else if (Wnd->Style & WS_MAXIMIZE) { Window->InternalPos->MaxPos = *pt; } @@ -317,8 +324,10 @@ POINT Size; PINTERNALPOS InternalPos; UINT SwpFlags = 0; + PWINDOW Wnd;
ASSERT_REFS_CO(Window); + Wnd = Window->Wnd;
Size.x = Window->Wnd->WindowRect.left; Size.y = Window->Wnd->WindowRect.top; @@ -326,7 +335,7 @@
if (InternalPos) { - if (Window->Style & WS_MINIMIZE) + if (Wnd->Style & WS_MINIMIZE) { if (!co_IntSendMessage(Window->hSelf, WM_QUERYOPEN, 0, 0)) { @@ -338,10 +347,10 @@ { case SW_MINIMIZE: { - if (Window->Style & WS_MAXIMIZE) + if (Wnd->Style & WS_MAXIMIZE) { Window->Flags |= WINDOWOBJECT_RESTOREMAX; - Window->Style &= ~WS_MAXIMIZE; + Wnd->Style &= ~WS_MAXIMIZE; } else { @@ -349,7 +358,7 @@ } co_UserRedrawWindow(Window, NULL, 0, RDW_VALIDATE | RDW_NOERASE | RDW_NOINTERNALPAINT); - Window->Style |= WS_MINIMIZE; + Wnd->Style |= WS_MINIMIZE; WinPosFindIconPos(Window, &InternalPos->IconPos); IntGdiSetRect(NewPos, InternalPos->IconPos.x, InternalPos->IconPos.y, UserGetSystemMetrics(SM_CXMINIMIZED), @@ -364,11 +373,11 @@ NULL, NULL); DPRINT("Maximize: %d,%d %dx%d\n", InternalPos->MaxPos.x, InternalPos->MaxPos.y, Size.x, Size.y); - if (Window->Style & WS_MINIMIZE) + if (Wnd->Style & WS_MINIMIZE) { - Window->Style &= ~WS_MINIMIZE; + Wnd->Style &= ~WS_MINIMIZE; } - Window->Style |= WS_MAXIMIZE; + Wnd->Style |= WS_MAXIMIZE; IntGdiSetRect(NewPos, InternalPos->MaxPos.x, InternalPos->MaxPos.y, Size.x, Size.y); break; @@ -376,14 +385,14 @@
case SW_RESTORE: { - if (Window->Style & WS_MINIMIZE) + if (Wnd->Style & WS_MINIMIZE) { - Window->Style &= ~WS_MINIMIZE; + Wnd->Style &= ~WS_MINIMIZE; if (Window->Flags & WINDOWOBJECT_RESTOREMAX) { co_WinPosGetMinMaxInfo(Window, &Size, &InternalPos->MaxPos, NULL, NULL); - Window->Style |= WS_MAXIMIZE; + Wnd->Style |= WS_MAXIMIZE; IntGdiSetRect(NewPos, InternalPos->MaxPos.x, InternalPos->MaxPos.y, Size.x, Size.y); break; @@ -398,11 +407,11 @@ } else { - if (!(Window->Style & WS_MAXIMIZE)) + if (!(Wnd->Style & WS_MAXIMIZE)) { return 0; } - Window->Style &= ~WS_MAXIMIZE; + Wnd->Style &= ~WS_MAXIMIZE; *NewPos = InternalPos->NormalRect; NewPos->right -= NewPos->left; NewPos->bottom -= NewPos->top; @@ -523,8 +532,10 @@ { PWINDOW_OBJECT Parent; UINT wvrFlags = 0; + PWINDOW Wnd;
ASSERT_REFS_CO(Window); + Wnd = Window->Wnd;
/* Send WM_NCCALCSIZE message to get new client area */ if ((WinPos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE) @@ -536,7 +547,7 @@ params.rgrc[1] = Window->Wnd->WindowRect; params.rgrc[2] = Window->Wnd->ClientRect; Parent = Window->Parent; - if (0 != (Window->Style & WS_CHILD) && Parent) + if (0 != (Wnd->Style & WS_CHILD) && Parent) { IntGdiOffsetRect(&(params.rgrc[0]), - Parent->Wnd->ClientRect.left, - Parent->Wnd->ClientRect.top); @@ -552,10 +563,10 @@
/* If the application send back garbage, ignore it */ if (params.rgrc[0].left <= params.rgrc[0].right && - params.rgrc[0].top <= params.rgrc[0].bottom) + params.rgrc[0].top <= params.rgrc[0].bottom) { *ClientRect = params.rgrc[0]; - if ((Window->Style & WS_CHILD) && Parent) + if ((Wnd->Style & WS_CHILD) && Parent) { IntGdiOffsetRect(ClientRect, Parent->Wnd->ClientRect.left, Parent->Wnd->ClientRect.top); @@ -565,16 +576,16 @@
/* FIXME: WVR_ALIGNxxx */
- if (ClientRect->left != Window->Wnd->ClientRect.left || - ClientRect->top != Window->Wnd->ClientRect.top) + if (ClientRect->left != Wnd->ClientRect.left || + ClientRect->top != Wnd->ClientRect.top) { WinPos->flags &= ~SWP_NOCLIENTMOVE; }
if ((ClientRect->right - ClientRect->left != - Window->Wnd->ClientRect.right - Window->Wnd->ClientRect.left) || + Wnd->ClientRect.right - Wnd->ClientRect.left) || (ClientRect->bottom - ClientRect->top != - Window->Wnd->ClientRect.bottom - Window->Wnd->ClientRect.top)) + Wnd->ClientRect.bottom - Wnd->ClientRect.top)) { WinPos->flags &= ~SWP_NOCLIENTSIZE; } @@ -582,8 +593,8 @@ else { if (! (WinPos->flags & SWP_NOMOVE) - && (ClientRect->left != Window->Wnd->ClientRect.left || - ClientRect->top != Window->Wnd->ClientRect.top)) + && (ClientRect->left != Wnd->ClientRect.left || + ClientRect->top != Wnd->ClientRect.top)) { WinPos->flags &= ~SWP_NOCLIENTMOVE; } @@ -600,16 +611,18 @@ PRECT ClientRect) { INT X, Y; + PWINDOW Wnd;
ASSERT_REFS_CO(Window); + Wnd = Window->Wnd;
if (!(WinPos->flags & SWP_NOSENDCHANGING)) { co_IntPostOrSendMessage(Window->hSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM) WinPos); }
- *WindowRect = Window->Wnd->WindowRect; - *ClientRect = Window->Wnd->ClientRect; + *WindowRect = Wnd->WindowRect; + *ClientRect = Wnd->ClientRect;
if (!(WinPos->flags & SWP_NOSIZE)) { @@ -623,7 +636,7 @@ X = WinPos->x; Y = WinPos->y; Parent = Window->Parent; - if ((0 != (Window->Style & WS_CHILD)) && Parent) + if ((0 != (Wnd->Style & WS_CHILD)) && Parent) { X += Parent->Wnd->ClientRect.left; Y += Parent->Wnd->ClientRect.top; @@ -631,11 +644,11 @@
WindowRect->left = X; WindowRect->top = Y; - WindowRect->right += X - Window->Wnd->WindowRect.left; - WindowRect->bottom += Y - Window->Wnd->WindowRect.top; + WindowRect->right += X - Wnd->WindowRect.left; + WindowRect->bottom += Y - Wnd->WindowRect.top; IntGdiOffsetRect(ClientRect, - X - Window->Wnd->WindowRect.left, - Y - Window->Wnd->WindowRect.top); + X - Wnd->WindowRect.left, + Y - Wnd->WindowRect.top); }
WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE; @@ -678,7 +691,7 @@ ChildObject = UserGetWindowObject(List[i]); if (NULL != ChildObject) { - if (0 == (ChildObject->ExStyle & WS_EX_TOPMOST)) + if (0 == (ChildObject->Wnd->ExStyle & WS_EX_TOPMOST)) { break; } @@ -715,7 +728,7 @@ if (!(Wnd = UserGetWindowObject(List[i]))) continue;
- if ((Wnd->Style & WS_POPUP) && + if ((Wnd->Wnd->Style & WS_POPUP) && UserGetWindow(List[i], GW_OWNER) == hWnd) { USER_REFERENCE_ENTRY Ref; @@ -772,7 +785,8 @@ BOOL FASTCALL WinPosFixupFlags(WINDOWPOS *WinPos, PWINDOW_OBJECT Window) { - if (Window->Style & WS_VISIBLE) + PWINDOW Wnd = Window->Wnd; + if (Wnd->Style & WS_VISIBLE) { WinPos->flags &= ~SWP_SHOWWINDOW; } @@ -787,15 +801,15 @@ WinPos->cy = max(WinPos->cy, 0);
/* Check for right size */ - if (Window->Wnd->WindowRect.right - Window->Wnd->WindowRect.left == WinPos->cx && - Window->Wnd->WindowRect.bottom - Window->Wnd->WindowRect.top == WinPos->cy) + if (Wnd->WindowRect.right - Wnd->WindowRect.left == WinPos->cx && + Wnd->WindowRect.bottom - Wnd->WindowRect.top == WinPos->cy) { WinPos->flags |= SWP_NOSIZE; }
/* Check for right position */ - if (Window->Wnd->WindowRect.left == WinPos->x && - Window->Wnd->WindowRect.top == WinPos->y) + if (Wnd->WindowRect.left == WinPos->x && + Wnd->WindowRect.top == WinPos->y) { WinPos->flags |= SWP_NOMOVE; } @@ -805,13 +819,13 @@ WinPos->flags |= SWP_NOACTIVATE; /* Already active */ } else - if ((Window->Style & (WS_POPUP | WS_CHILD)) != WS_CHILD) + if ((Wnd->Style & (WS_POPUP | WS_CHILD)) != WS_CHILD) { /* Bring to the top when activating */ if (!(WinPos->flags & SWP_NOACTIVATE)) { WinPos->flags &= ~SWP_NOZORDER; - WinPos->hwndInsertAfter = (0 != (Window->ExStyle & WS_EX_TOPMOST) ? + WinPos->hwndInsertAfter = (0 != (Wnd->ExStyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_TOP); return TRUE; } @@ -835,7 +849,7 @@ WinPos->hwndInsertAfter = HWND_TOP; } else if (HWND_TOP == WinPos->hwndInsertAfter - && 0 != (Window->ExStyle & WS_EX_TOPMOST)) + && 0 != (Wnd->ExStyle & WS_EX_TOPMOST)) { /* Keep it topmost when it's already topmost */ WinPos->hwndInsertAfter = HWND_TOPMOST; @@ -996,7 +1010,7 @@ { InsertAfterWindow = NULL; Sibling = ParentWindow->FirstChild; - while (NULL != Sibling && 0 != (Sibling->ExStyle & WS_EX_TOPMOST)) + while (NULL != Sibling && 0 != (Sibling->Wnd->ExStyle & WS_EX_TOPMOST)) { InsertAfterWindow = Sibling; Sibling = Sibling->NextSibling; @@ -1028,17 +1042,17 @@ if (InsertAfterWindow != NULL) UserDerefObject(InsertAfterWindow); if ((HWND_TOPMOST == WinPos.hwndInsertAfter) - || (0 != (Window->ExStyle & WS_EX_TOPMOST) + || (0 != (Window->Wnd->ExStyle & WS_EX_TOPMOST) && NULL != Window->PrevSibling - && 0 != (Window->PrevSibling->ExStyle & WS_EX_TOPMOST)) + && 0 != (Window->PrevSibling->Wnd->ExStyle & WS_EX_TOPMOST)) || (NULL != Window->NextSibling - && 0 != (Window->NextSibling->ExStyle & WS_EX_TOPMOST))) - { - Window->ExStyle |= WS_EX_TOPMOST; + && 0 != (Window->NextSibling->Wnd->ExStyle & WS_EX_TOPMOST))) + { + Window->Wnd->ExStyle |= WS_EX_TOPMOST; } else { - Window->ExStyle &= ~ WS_EX_TOPMOST; + Window->Wnd->ExStyle &= ~ WS_EX_TOPMOST; }
} @@ -1077,21 +1091,21 @@ /* Clear the update region */ co_UserRedrawWindow(Window, NULL, 0, RDW_VALIDATE | RDW_NOFRAME | RDW_NOERASE | RDW_NOINTERNALPAINT | RDW_ALLCHILDREN); - if ((Window->Style & WS_VISIBLE) && + if ((Window->Wnd->Style & WS_VISIBLE) && Window->Parent == UserGetDesktopWindow()) { co_IntShellHookNotify(HSHELL_WINDOWDESTROYED, (LPARAM)Window->hSelf); } - Window->Style &= ~WS_VISIBLE; + Window->Wnd->Style &= ~WS_VISIBLE; } else if (WinPos.flags & SWP_SHOWWINDOW) { - if (!(Window->Style & WS_VISIBLE) && + if (!(Window->Wnd->Style & WS_VISIBLE) && Window->Parent == UserGetDesktopWindow()) { co_IntShellHookNotify(HSHELL_WINDOWCREATED, (LPARAM)Window->hSelf); } - Window->Style |= WS_VISIBLE; + Window->Wnd->Style |= WS_VISIBLE; }
if (Window->UpdateRegion != NULL && Window->UpdateRegion != (HRGN)1) @@ -1131,7 +1145,7 @@ */ if (VisBefore != NULL && VisAfter != NULL && !(WinPos.flags & SWP_NOCOPYBITS) && ((WinPos.flags & SWP_NOSIZE) || !(WvrFlags & WVR_REDRAW)) && - !(Window->ExStyle & WS_EX_TRANSPARENT)) + !(Window->Wnd->ExStyle & WS_EX_TRANSPARENT)) { CopyRgn = NtGdiCreateRectRgn(0, 0, 0, 0); RgnType = NtGdiCombineRgn(CopyRgn, VisAfter, VisBefore, RGN_AND); @@ -1243,9 +1257,9 @@ NtGdiOffsetRgn(DirtyRgn, Window->Wnd->WindowRect.left, Window->Wnd->WindowRect.top); - if ((Window->Style & WS_CHILD) && + if ((Window->Wnd->Style & WS_CHILD) && (Parent) && - !(Parent->Style & WS_CLIPCHILDREN)) + !(Parent->Wnd->Style & WS_CLIPCHILDREN)) { IntInvalidateWindows(Parent, DirtyRgn, RDW_ERASE | RDW_INVALIDATE); @@ -1292,7 +1306,7 @@
if (!(WinPos.flags & SWP_NOACTIVATE)) { - if ((Window->Style & (WS_CHILD | WS_POPUP)) == WS_CHILD) + if ((Window->Wnd->Style & (WS_CHILD | WS_POPUP)) == WS_CHILD) { co_IntSendMessage(WinPos.hwnd, WM_CHILDACTIVATE, 0, 0); } @@ -1332,10 +1346,12 @@ RECT NewPos; BOOLEAN ShowFlag; // HRGN VisibleRgn; + PWINDOW Wnd;
ASSERT_REFS_CO(Window); - - WasVisible = (Window->Style & WS_VISIBLE) != 0; + Wnd = Window->Wnd; + + WasVisible = (Wnd->Style & WS_VISIBLE) != 0;
switch (Cmd) { @@ -1360,7 +1376,7 @@ case SW_MINIMIZE: { Swp |= SWP_NOACTIVATE; - if (!(Window->Style & WS_MINIMIZE)) + if (!(Wnd->Style & WS_MINIMIZE)) { Swp |= co_WinPosMinMaximize(Window, SW_MINIMIZE, &NewPos) | SWP_FRAMECHANGED; @@ -1379,7 +1395,7 @@ case SW_SHOWMAXIMIZED: { Swp |= SWP_SHOWWINDOW; - if (!(Window->Style & WS_MAXIMIZE)) + if (!(Wnd->Style & WS_MAXIMIZE)) { Swp |= co_WinPosMinMaximize(Window, SW_MAXIMIZE, &NewPos) | SWP_FRAMECHANGED; @@ -1411,7 +1427,7 @@ case SW_SHOWDEFAULT: case SW_RESTORE: Swp |= SWP_SHOWWINDOW; - if (Window->Style & (WS_MINIMIZE | WS_MAXIMIZE)) + if (Wnd->Style & (WS_MINIMIZE | WS_MAXIMIZE)) { Swp |= co_WinPosMinMaximize(Window, SW_RESTORE, &NewPos) | SWP_FRAMECHANGED; @@ -1435,13 +1451,13 @@ }
/* We can't activate a child window */ - if ((Window->Style & WS_CHILD) && - !(Window->ExStyle & WS_EX_MDICHILD)) + if ((Wnd->Style & WS_CHILD) && + !(Wnd->ExStyle & WS_EX_MDICHILD)) { Swp |= SWP_NOACTIVATE | SWP_NOZORDER; }
- co_WinPosSetWindowPos(Window, 0 != (Window->ExStyle & WS_EX_TOPMOST) + co_WinPosSetWindowPos(Window, 0 != (Wnd->ExStyle & WS_EX_TOPMOST) ? HWND_TOPMOST : HWND_TOP, NewPos.left, NewPos.top, NewPos.right, NewPos.bottom, LOWORD(Swp));
@@ -1475,28 +1491,28 @@ /* FIXME: Check for window destruction. */
if ((Window->Flags & WINDOWOBJECT_NEED_SIZE) && - !(Window->Status & WINDOWSTATUS_DESTROYING)) + !(Window->Status & WINDOWSTATUS_DESTROYING)) { WPARAM wParam = SIZE_RESTORED;
Window->Flags &= ~WINDOWOBJECT_NEED_SIZE; - if (Window->Style & WS_MAXIMIZE) + if (Wnd->Style & WS_MAXIMIZE) { wParam = SIZE_MAXIMIZED; } - else if (Window->Style & WS_MINIMIZE) + else if (Wnd->Style & WS_MINIMIZE) { wParam = SIZE_MINIMIZED; }
co_IntSendMessage(Window->hSelf, WM_SIZE, wParam, - MAKELONG(Window->Wnd->ClientRect.right - - Window->Wnd->ClientRect.left, - Window->Wnd->ClientRect.bottom - - Window->Wnd->ClientRect.top)); + MAKELONG(Wnd->ClientRect.right - + Wnd->ClientRect.left, + Wnd->ClientRect.bottom - + Wnd->ClientRect.top)); co_IntSendMessage(Window->hSelf, WM_MOVE, 0, - MAKELONG(Window->Wnd->ClientRect.left, - Window->Wnd->ClientRect.top)); + MAKELONG(Wnd->ClientRect.left, + Wnd->ClientRect.top)); IntEngWindowChanged(Window, WOC_RGN_CLIENT);
} @@ -1553,6 +1569,7 @@ ) { PWINDOW_OBJECT Current; + PWINDOW CurrentWnd; HWND *List, *phWnd; USER_REFERENCE_ENTRY Ref;
@@ -1564,13 +1581,14 @@ { if (!(Current = UserGetWindowObject(*phWnd))) continue; - - if (!(Current->Style & WS_VISIBLE)) + CurrentWnd = Current->Wnd; + + if (!(CurrentWnd->Style & WS_VISIBLE)) { continue; }
- if ((Current->Style & (WS_POPUP | WS_CHILD | WS_DISABLED)) == + if ((CurrentWnd->Style & (WS_POPUP | WS_CHILD | WS_DISABLED)) == (WS_CHILD | WS_DISABLED)) { continue; @@ -1585,13 +1603,13 @@ *Window = Current; UserRefObject(*Window);
- if (Current->Style & WS_MINIMIZE) + if (CurrentWnd->Style & WS_MINIMIZE) { *HitTest = HTCAPTION; break; }
- if (Current->Style & WS_DISABLED) + if (CurrentWnd->Style & WS_DISABLED) { *HitTest = HTERROR; break; @@ -1612,10 +1630,10 @@ else *HitTest = HTCLIENT;
- if (Point->x >= Current->Wnd->ClientRect.left && - Point->x < Current->Wnd->ClientRect.right && - Point->y >= Current->Wnd->ClientRect.top && - Point->y < Current->Wnd->ClientRect.bottom) + if (Point->x >= CurrentWnd->ClientRect.left && + Point->x < CurrentWnd->ClientRect.right && + Point->y >= CurrentWnd->ClientRect.top && + Point->y < CurrentWnd->ClientRect.bottom) { co_WinPosSearchChildren(Current, OnlyHitTests, Point, Window, HitTest); } @@ -1648,7 +1666,7 @@ return(HTERROR); }
- if (ScopeWin->Style & WS_DISABLED) + if (ScopeWin->Wnd->Style & WS_DISABLED) { return(HTERROR); }