Properly handling cases like calling SetWindowPos while processing

WM_NCCREATE.
oldstable
Eric Pouech 1999-04-18 13:13:40 +00:00 committed by Alexandre Julliard
parent dc7c1b87d4
commit 3be8e3b7ff
3 changed files with 17 additions and 6 deletions

View File

@ -54,7 +54,7 @@ Messages sent:
CreateWindow (for child window, not initially visible) CreateWindow (for child window, not initially visible)
Messages sent: Messages sent:
WM_NCCREATE WM_NCCREATE (Note that win->parent->child will not contain win. link is done after sucessfull WM_NCCREATE)
WM_NCCALCSIZE (wParam=0) WM_NCCALCSIZE (wParam=0)
WM_CREATE WM_CREATE
WM_SIZE WM_SIZE

View File

@ -310,6 +310,7 @@ void WIN_WalkWindows( HWND hwnd, int indent )
BOOL WIN_UnlinkWindow( HWND hwnd ) BOOL WIN_UnlinkWindow( HWND hwnd )
{ {
WND *wndPtr, **ppWnd; WND *wndPtr, **ppWnd;
BOOL ret = FALSE;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE; if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return FALSE;
else if(!wndPtr->parent) else if(!wndPtr->parent)
@ -317,11 +318,16 @@ BOOL WIN_UnlinkWindow( HWND hwnd )
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
return FALSE; return FALSE;
} }
ppWnd = &wndPtr->parent->child; ppWnd = &wndPtr->parent->child;
while (*ppWnd != wndPtr) ppWnd = &(*ppWnd)->next; while (*ppWnd && *ppWnd != wndPtr) ppWnd = &(*ppWnd)->next;
*ppWnd = wndPtr->next; if (*ppWnd)
{
*ppWnd = wndPtr->next;
ret = TRUE;
}
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
return TRUE; return ret;
} }

View File

@ -2525,8 +2525,13 @@ Pos: /* -----------------------------------------------------------------------
if(!(winpos.flags & SWP_NOZORDER)) if(!(winpos.flags & SWP_NOZORDER))
{ {
WIN_UnlinkWindow( winpos.hwnd ); /* upon window creation (while processing WM_NCCREATE), wndPtr->parent is set correctly
WIN_LinkWindow( winpos.hwnd, hwndInsertAfter ); * but wndPtr is not yet in wndPtr->parent->child list
* in those cases (SetWindowPos called while processing WM_NCCREATE),
* do not unlink/link winPtr in parent->child
*/
if ( WIN_UnlinkWindow( winpos.hwnd ) )
WIN_LinkWindow( winpos.hwnd, hwndInsertAfter );
} }
/* Reset active DCEs */ /* Reset active DCEs */