diff --git a/windows/dce.c b/windows/dce.c index 15ce2629563..34b7451ebf4 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -560,7 +560,7 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags, HWND hwndChild, WORD cflags ) * WS_CLIPSIBLINGS style */ - while (wndPtr->dwStyle & WS_CHILD) + while (wndPtr->parent) { WIN_UpdateWndPtr(&wndPtr,wndPtr->parent); xoffset -= wndPtr->rectClient.left; diff --git a/windows/dialog.c b/windows/dialog.c index d48983649bc..f1437315123 100644 --- a/windows/dialog.c +++ b/windows/dialog.c @@ -1994,7 +1994,7 @@ HWND WINAPI GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, goto END; } /* Make sure hwndCtrl is a top-level child */ - while ((pWndCtrl->dwStyle & WS_CHILD) && (pWndCtrl->parent != pWndDlg)) + while (pWndCtrl->parent && (pWndCtrl->parent != pWndDlg)) WIN_UpdateWndPtr(&pWndCtrl,pWndCtrl->parent); if (pWndCtrl->parent != pWndDlg) { diff --git a/windows/nonclient.c b/windows/nonclient.c index f61d82e2b65..163411b9971 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -2101,7 +2101,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam ) if (GetCapture() != hwnd) SetCapture( hwnd ); - if (wndPtr->dwStyle & WS_CHILD) + if (wndPtr->parent && (wndPtr->parent->hwndSelf != GetDesktopWindow())) { /* Retrieve a default cache DC (without using the window style) */ hdc = GetDCEx( wndPtr->parent->hwndSelf, 0, DCX_CACHE ); @@ -2235,7 +2235,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam ) if(!DragFullWindows) NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); - if (wndPtr->dwStyle & WS_CHILD) + if (wndPtr->parent && (wndPtr->parent->hwndSelf != GetDesktopWindow())) ReleaseDC( wndPtr->parent->hwndSelf, hdc ); else ReleaseDC( 0, hdc ); @@ -2693,7 +2693,7 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt ) TRACE("Handling WM_SYSCOMMAND %x %ld,%ld\n", wParam, pt.x, pt.y ); - if ((wndPtr->dwStyle & WS_CHILD) && (uCommand != SC_KEYMENU)) + if (wndPtr->parent && (uCommand != SC_KEYMENU)) ScreenToClient( wndPtr->parent->hwndSelf, &pt ); switch (uCommand) diff --git a/windows/win.c b/windows/win.c index 9ba000ead77..e96504b6bff 100644 --- a/windows/win.c +++ b/windows/win.c @@ -1329,11 +1329,11 @@ BOOL WINAPI DestroyWindow( HWND hwnd ) { if (h == hwnd) { - SetFocus(GetWindowLongA(hwnd,GWL_HWNDPARENT)); + SetFocus(GetParent(h)); bFocusSet = TRUE; break; } - h = GetWindowLongA(h,GWL_HWNDPARENT); + h = GetParent(h); } /* If the focus is on the window we will destroy and it has no parent, * set the focus to 0. @@ -2031,9 +2031,7 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval, goto end; case GWL_STYLE: style.styleOld = wndPtr->dwStyle; - newval &= ~(WS_CHILD); /* this bit can't be changed this way */ - style.styleNew = newval | (style.styleOld & (WS_CHILD)); - + style.styleNew = newval; if (wndPtr->flags & WIN_ISWIN32) SendMessageA(hwnd,WM_STYLECHANGING,GWL_STYLE,(LPARAM)&style); wndPtr->dwStyle = style.styleNew; @@ -2454,9 +2452,10 @@ BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child ) BOOL WINAPI IsChild( HWND parent, HWND child ) { WND * wndPtr = WIN_FindWndPtr( child ); - while (wndPtr && (wndPtr->dwStyle & WS_CHILD)) + while (wndPtr && wndPtr->parent) { WIN_UpdateWndPtr(&wndPtr,wndPtr->parent); + if (wndPtr->hwndSelf == GetDesktopWindow()) break; if (wndPtr->hwndSelf == parent) { WIN_ReleaseWndPtr(wndPtr); @@ -2484,7 +2483,7 @@ BOOL WINAPI IsWindowVisible( HWND hwnd ) { BOOL retval; WND *wndPtr = WIN_FindWndPtr( hwnd ); - while (wndPtr && (wndPtr->dwStyle & WS_CHILD)) + while (wndPtr && wndPtr->parent) { if (!(wndPtr->dwStyle & WS_VISIBLE)) { @@ -2496,7 +2495,6 @@ BOOL WINAPI IsWindowVisible( HWND hwnd ) retval = (wndPtr && (wndPtr->dwStyle & WS_VISIBLE)); WIN_ReleaseWndPtr(wndPtr); return retval; - } @@ -3159,7 +3157,7 @@ BOOL16 DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo, BOOL bNoSend ) if( !(ptrQueryWnd->dwStyle & WS_MINIMIZE) ) { tempRect = ptrQueryWnd->rectClient; - if(ptrQueryWnd->dwStyle & WS_CHILD) + if(ptrQueryWnd->parent) MapWindowPoints( ptrQueryWnd->parent->hwndSelf, 0, (LPPOINT)&tempRect, 2 ); diff --git a/windows/winpos.c b/windows/winpos.c index 192a9224479..09cb9482755 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -246,7 +246,7 @@ void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect ) if (!wndPtr) return; CONV_RECT32TO16( &wndPtr->rectWindow, rect ); - if (wndPtr->dwStyle & WS_CHILD) + if (wndPtr->parent) MapWindowPoints16( wndPtr->parent->hwndSelf, 0, (POINT16 *)rect, 2 ); WIN_ReleaseWndPtr(wndPtr); } @@ -261,7 +261,7 @@ BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect ) if (!wndPtr) return FALSE; *rect = wndPtr->rectWindow; - if (wndPtr->dwStyle & WS_CHILD) + if (wndPtr->parent) MapWindowPoints( wndPtr->parent->hwndSelf, 0, (POINT *)rect, 2 ); WIN_ReleaseWndPtr(wndPtr); return TRUE; diff --git a/windows/x11drv/wnd.c b/windows/x11drv/wnd.c index fbed353cc1d..524ac4615ed 100644 --- a/windows/x11drv/wnd.c +++ b/windows/x11drv/wnd.c @@ -851,7 +851,8 @@ void X11DRV_WND_SetFocus(WND *wndPtr) void X11DRV_WND_PreSizeMove(WND *wndPtr) { /* Grab the server only when moving top-level windows without desktop */ - if (!(wndPtr->dwStyle & WS_CHILD) && (X11DRV_GetXRootWindow() == DefaultRootWindow(display))) + if ((X11DRV_GetXRootWindow() == DefaultRootWindow(display)) && + (wndPtr->parent->hwndSelf == GetDesktopWindow())) TSXGrabServer( display ); } @@ -860,8 +861,8 @@ void X11DRV_WND_PreSizeMove(WND *wndPtr) */ void X11DRV_WND_PostSizeMove(WND *wndPtr) { - if (!(wndPtr->dwStyle & WS_CHILD) && - (X11DRV_GetXRootWindow() == DefaultRootWindow(display))) + if ((X11DRV_GetXRootWindow() == DefaultRootWindow(display)) && + (wndPtr->parent->hwndSelf == GetDesktopWindow())) TSXUngrabServer( display ); }