Commit f88e5aa7 authored by Alexandre Julliard's avatar Alexandre Julliard

Cleaned up assumptions about WS_CHILD flag so that we can allow it to

be changed in SetWindowLong.
parent 2f7292cb
...@@ -560,7 +560,7 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags, HWND hwndChild, WORD cflags ) ...@@ -560,7 +560,7 @@ HRGN DCE_GetVisRgn( HWND hwnd, WORD flags, HWND hwndChild, WORD cflags )
* WS_CLIPSIBLINGS style * WS_CLIPSIBLINGS style
*/ */
while (wndPtr->dwStyle & WS_CHILD) while (wndPtr->parent)
{ {
WIN_UpdateWndPtr(&wndPtr,wndPtr->parent); WIN_UpdateWndPtr(&wndPtr,wndPtr->parent);
xoffset -= wndPtr->rectClient.left; xoffset -= wndPtr->rectClient.left;
......
...@@ -1994,7 +1994,7 @@ HWND WINAPI GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl, ...@@ -1994,7 +1994,7 @@ HWND WINAPI GetNextDlgGroupItem( HWND hwndDlg, HWND hwndCtrl,
goto END; goto END;
} }
/* Make sure hwndCtrl is a top-level child */ /* 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); WIN_UpdateWndPtr(&pWndCtrl,pWndCtrl->parent);
if (pWndCtrl->parent != pWndDlg) if (pWndCtrl->parent != pWndDlg)
{ {
......
...@@ -2101,7 +2101,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam ) ...@@ -2101,7 +2101,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
if (GetCapture() != hwnd) SetCapture( hwnd ); 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) */ /* Retrieve a default cache DC (without using the window style) */
hdc = GetDCEx( wndPtr->parent->hwndSelf, 0, DCX_CACHE ); hdc = GetDCEx( wndPtr->parent->hwndSelf, 0, DCX_CACHE );
...@@ -2235,7 +2235,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam ) ...@@ -2235,7 +2235,7 @@ static void NC_DoSizeMove( HWND hwnd, WORD wParam )
if(!DragFullWindows) if(!DragFullWindows)
NC_DrawMovingFrame( hdc, &sizingRect, thickframe ); NC_DrawMovingFrame( hdc, &sizingRect, thickframe );
if (wndPtr->dwStyle & WS_CHILD) if (wndPtr->parent && (wndPtr->parent->hwndSelf != GetDesktopWindow()))
ReleaseDC( wndPtr->parent->hwndSelf, hdc ); ReleaseDC( wndPtr->parent->hwndSelf, hdc );
else else
ReleaseDC( 0, hdc ); ReleaseDC( 0, hdc );
...@@ -2693,7 +2693,7 @@ LONG NC_HandleSysCommand( HWND hwnd, WPARAM wParam, POINT pt ) ...@@ -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 ); 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 ); ScreenToClient( wndPtr->parent->hwndSelf, &pt );
switch (uCommand) switch (uCommand)
......
...@@ -1329,11 +1329,11 @@ BOOL WINAPI DestroyWindow( HWND hwnd ) ...@@ -1329,11 +1329,11 @@ BOOL WINAPI DestroyWindow( HWND hwnd )
{ {
if (h == hwnd) if (h == hwnd)
{ {
SetFocus(GetWindowLongA(hwnd,GWL_HWNDPARENT)); SetFocus(GetParent(h));
bFocusSet = TRUE; bFocusSet = TRUE;
break; break;
} }
h = GetWindowLongA(h,GWL_HWNDPARENT); h = GetParent(h);
} }
/* If the focus is on the window we will destroy and it has no parent, /* If the focus is on the window we will destroy and it has no parent,
* set the focus to 0. * set the focus to 0.
...@@ -2031,9 +2031,7 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval, ...@@ -2031,9 +2031,7 @@ static LONG WIN_SetWindowLong( HWND hwnd, INT offset, LONG newval,
goto end; goto end;
case GWL_STYLE: case GWL_STYLE:
style.styleOld = wndPtr->dwStyle; style.styleOld = wndPtr->dwStyle;
newval &= ~(WS_CHILD); /* this bit can't be changed this way */ style.styleNew = newval;
style.styleNew = newval | (style.styleOld & (WS_CHILD));
if (wndPtr->flags & WIN_ISWIN32) if (wndPtr->flags & WIN_ISWIN32)
SendMessageA(hwnd,WM_STYLECHANGING,GWL_STYLE,(LPARAM)&style); SendMessageA(hwnd,WM_STYLECHANGING,GWL_STYLE,(LPARAM)&style);
wndPtr->dwStyle = style.styleNew; wndPtr->dwStyle = style.styleNew;
...@@ -2454,9 +2452,10 @@ BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child ) ...@@ -2454,9 +2452,10 @@ BOOL16 WINAPI IsChild16( HWND16 parent, HWND16 child )
BOOL WINAPI IsChild( HWND parent, HWND child ) BOOL WINAPI IsChild( HWND parent, HWND child )
{ {
WND * wndPtr = WIN_FindWndPtr( child ); WND * wndPtr = WIN_FindWndPtr( child );
while (wndPtr && (wndPtr->dwStyle & WS_CHILD)) while (wndPtr && wndPtr->parent)
{ {
WIN_UpdateWndPtr(&wndPtr,wndPtr->parent); WIN_UpdateWndPtr(&wndPtr,wndPtr->parent);
if (wndPtr->hwndSelf == GetDesktopWindow()) break;
if (wndPtr->hwndSelf == parent) if (wndPtr->hwndSelf == parent)
{ {
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
...@@ -2484,7 +2483,7 @@ BOOL WINAPI IsWindowVisible( HWND hwnd ) ...@@ -2484,7 +2483,7 @@ BOOL WINAPI IsWindowVisible( HWND hwnd )
{ {
BOOL retval; BOOL retval;
WND *wndPtr = WIN_FindWndPtr( hwnd ); WND *wndPtr = WIN_FindWndPtr( hwnd );
while (wndPtr && (wndPtr->dwStyle & WS_CHILD)) while (wndPtr && wndPtr->parent)
{ {
if (!(wndPtr->dwStyle & WS_VISIBLE)) if (!(wndPtr->dwStyle & WS_VISIBLE))
{ {
...@@ -2496,7 +2495,6 @@ BOOL WINAPI IsWindowVisible( HWND hwnd ) ...@@ -2496,7 +2495,6 @@ BOOL WINAPI IsWindowVisible( HWND hwnd )
retval = (wndPtr && (wndPtr->dwStyle & WS_VISIBLE)); retval = (wndPtr && (wndPtr->dwStyle & WS_VISIBLE));
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
return retval; return retval;
} }
...@@ -3159,7 +3157,7 @@ BOOL16 DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo, BOOL bNoSend ) ...@@ -3159,7 +3157,7 @@ BOOL16 DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo, BOOL bNoSend )
if( !(ptrQueryWnd->dwStyle & WS_MINIMIZE) ) if( !(ptrQueryWnd->dwStyle & WS_MINIMIZE) )
{ {
tempRect = ptrQueryWnd->rectClient; tempRect = ptrQueryWnd->rectClient;
if(ptrQueryWnd->dwStyle & WS_CHILD) if(ptrQueryWnd->parent)
MapWindowPoints( ptrQueryWnd->parent->hwndSelf, 0, MapWindowPoints( ptrQueryWnd->parent->hwndSelf, 0,
(LPPOINT)&tempRect, 2 ); (LPPOINT)&tempRect, 2 );
......
...@@ -246,7 +246,7 @@ void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect ) ...@@ -246,7 +246,7 @@ void WINAPI GetWindowRect16( HWND16 hwnd, LPRECT16 rect )
if (!wndPtr) return; if (!wndPtr) return;
CONV_RECT32TO16( &wndPtr->rectWindow, rect ); CONV_RECT32TO16( &wndPtr->rectWindow, rect );
if (wndPtr->dwStyle & WS_CHILD) if (wndPtr->parent)
MapWindowPoints16( wndPtr->parent->hwndSelf, 0, (POINT16 *)rect, 2 ); MapWindowPoints16( wndPtr->parent->hwndSelf, 0, (POINT16 *)rect, 2 );
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
} }
...@@ -261,7 +261,7 @@ BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect ) ...@@ -261,7 +261,7 @@ BOOL WINAPI GetWindowRect( HWND hwnd, LPRECT rect )
if (!wndPtr) return FALSE; if (!wndPtr) return FALSE;
*rect = wndPtr->rectWindow; *rect = wndPtr->rectWindow;
if (wndPtr->dwStyle & WS_CHILD) if (wndPtr->parent)
MapWindowPoints( wndPtr->parent->hwndSelf, 0, (POINT *)rect, 2 ); MapWindowPoints( wndPtr->parent->hwndSelf, 0, (POINT *)rect, 2 );
WIN_ReleaseWndPtr(wndPtr); WIN_ReleaseWndPtr(wndPtr);
return TRUE; return TRUE;
......
...@@ -851,7 +851,8 @@ void X11DRV_WND_SetFocus(WND *wndPtr) ...@@ -851,7 +851,8 @@ void X11DRV_WND_SetFocus(WND *wndPtr)
void X11DRV_WND_PreSizeMove(WND *wndPtr) void X11DRV_WND_PreSizeMove(WND *wndPtr)
{ {
/* Grab the server only when moving top-level windows without desktop */ /* 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 ); TSXGrabServer( display );
} }
...@@ -860,8 +861,8 @@ void X11DRV_WND_PreSizeMove(WND *wndPtr) ...@@ -860,8 +861,8 @@ void X11DRV_WND_PreSizeMove(WND *wndPtr)
*/ */
void X11DRV_WND_PostSizeMove(WND *wndPtr) void X11DRV_WND_PostSizeMove(WND *wndPtr)
{ {
if (!(wndPtr->dwStyle & WS_CHILD) && if ((X11DRV_GetXRootWindow() == DefaultRootWindow(display)) &&
(X11DRV_GetXRootWindow() == DefaultRootWindow(display))) (wndPtr->parent->hwndSelf == GetDesktopWindow()))
TSXUngrabServer( display ); TSXUngrabServer( display );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment