From 196021c2769d9a9bacb85113a1760f187fdf6131 Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Mon, 14 Dec 2009 22:58:03 +0000 Subject: [PATCH] [win32k] - Don't store LastChild in WINDOW_OBJECT svn path=/trunk/; revision=44591 --- .../subsystems/win32/win32k/ntuser/window.c | 29 +++++++++++-------- .../subsystems/win32/win32k/ntuser/winpos.c | 13 +++++++-- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/window.c b/reactos/subsystems/win32/win32k/ntuser/window.c index 1050851b392..ff3b89dde7b 100644 --- a/reactos/subsystems/win32/win32k/ntuser/window.c +++ b/reactos/subsystems/win32/win32k/ntuser/window.c @@ -1060,11 +1060,6 @@ IntLinkWindow( /* link after WndPrevSibling */ if ((Wnd->spwndNext = WndPrevSibling->spwndNext)) Wnd->spwndNext->spwndPrev = Wnd; - else if ((Parent = Wnd->spwndParent)) - { - if(Parent->LastChild == WndPrevSibling) - Parent->LastChild = Wnd; - } Wnd->spwndPrev->spwndNext = Wnd; } else @@ -1075,7 +1070,6 @@ IntLinkWindow( Wnd->spwndNext->spwndPrev = Wnd; else if (Parent) { - Parent->LastChild = Wnd; Parent->spwndChild = Wnd; return; } @@ -1276,8 +1270,6 @@ IntUnlinkWindow(PWINDOW_OBJECT Wnd) if (Wnd->spwndNext) Wnd->spwndNext->spwndPrev = Wnd->spwndPrev; - else if (WndParent && WndParent->LastChild == Wnd) - WndParent->LastChild = Wnd->spwndPrev; if (Wnd->spwndPrev) Wnd->spwndPrev->spwndNext = Wnd->spwndNext; @@ -1956,7 +1948,6 @@ AllocErr: Window->OwnerThread = PsGetCurrentThread(); Window->spwndChild = NULL; - Window->LastChild = NULL; Window->spwndPrev = NULL; Window->spwndNext = NULL; @@ -2290,7 +2281,13 @@ AllocErr: { PWINDOW_OBJECT PrevSibling; - PrevSibling = ParentWindow->LastChild; + PrevSibling = ParentWindow->spwndChild; + + if(PrevSibling) + { + while (PrevSibling->spwndNext) + PrevSibling = PrevSibling->spwndNext; + } /* link window as bottom sibling */ IntLinkWindow(Window, ParentWindow, PrevSibling /*prev sibling*/); @@ -3698,8 +3695,16 @@ UserGetWindow(HWND hWnd, UINT Relationship) case GW_HWNDLAST: if((Parent = Window->spwndParent)) { - if (Parent->LastChild) - hWndResult = Parent->LastChild->hSelf; + if (Parent->spwndChild) + { + Window = Parent->spwndChild; + if(Window) + { + while(Window->spwndNext) + Window = Window->spwndNext; + } + hWndResult = Window->hSelf; + } } break; diff --git a/reactos/subsystems/win32/win32k/ntuser/winpos.c b/reactos/subsystems/win32/win32k/ntuser/winpos.c index e23302c6d67..8ad52c861e3 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winpos.c +++ b/reactos/subsystems/win32/win32k/ntuser/winpos.c @@ -1002,10 +1002,17 @@ co_WinPosSetWindowPos( } else if (WinPos.hwndInsertAfter == HWND_BOTTOM) { - if(ParentWindow->LastChild) + if(ParentWindow->spwndChild) { - UserReferenceObject(ParentWindow->LastChild); - InsertAfterWindow = ParentWindow->LastChild; + InsertAfterWindow = ParentWindow->spwndChild; + + if(InsertAfterWindow) + { + while (InsertAfterWindow->spwndNext) + InsertAfterWindow = InsertAfterWindow->spwndNext; + } + + UserReferenceObject(InsertAfterWindow); } else InsertAfterWindow = NULL;