From 077c2732b85a3d06463c314c27178c6505c5e409 Mon Sep 17 00:00:00 2001 From: Ove Kaaven Date: Fri, 19 Feb 1999 15:27:58 +0000 Subject: [PATCH] Added extra child arguments to DCE_GetVisRgn() to be able to handle PARENTDC class style combined with CLIPCHILDREN window style, to prevent mis-redraws in Free Agent 16-bit. --- include/dce.h | 2 +- windows/dce.c | 36 ++++++++++++++++++++++++++++++++---- windows/winpos.c | 4 ++-- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/include/dce.h b/include/dce.h index 506bfedacf2..96db5d11237 100644 --- a/include/dce.h +++ b/include/dce.h @@ -51,7 +51,7 @@ extern DCE* DCE_AllocDCE( HWND32 hWnd, DCE_TYPE type ); extern DCE* DCE_FreeDCE( DCE *dce ); extern void DCE_FreeWindowDCE( WND* ); extern INT16 DCE_ExcludeRgn( HDC32, WND*, HRGN32 ); -extern HRGN32 DCE_GetVisRgn( HWND32, WORD ); +extern HRGN32 DCE_GetVisRgn( HWND32, WORD, HWND32, WORD ); extern BOOL32 DCE_InvalidateDCE( WND*, const RECT32* ); #endif /* __WINE_DCE_H */ diff --git a/windows/dce.c b/windows/dce.c index a47d0e0aad7..8aee87eac7b 100644 --- a/windows/dce.c +++ b/windows/dce.c @@ -410,11 +410,12 @@ static BOOL32 DCE_AddClipRects( WND *pWndStart, WND *pWndEnd, * clipped by the client area of all ancestors, and then optionally * by siblings and children. */ -HRGN32 DCE_GetVisRgn( HWND32 hwnd, WORD flags ) +HRGN32 DCE_GetVisRgn( HWND32 hwnd, WORD flags, HWND32 hwndChild, WORD cflags ) { HRGN32 hrgnVis = 0; RECT32 rect; WND *wndPtr = WIN_FindWndPtr( hwnd ); + WND *childWnd = WIN_FindWndPtr( hwndChild ); /* Get visible rectangle and create a region with it. */ @@ -449,6 +450,32 @@ HRGN32 DCE_GetVisRgn( HWND32 hwnd, WORD flags ) &rect, xoffset, yoffset ); } + /* We may need to clip children of child window, if a window with PARENTDC + * class style and CLIPCHILDREN window style (like in Free Agent 16 + * preference dialogs) gets here, we take the region for the parent window + * but apparently still need to clip the children of the child window... */ + + if( (cflags & DCX_CLIPCHILDREN) && childWnd && childWnd->child ) + { + if( flags & DCX_WINDOW ) + { + /* adjust offsets since child window rectangles are + * in client coordinates */ + + xoffset = wndPtr->rectClient.left - wndPtr->rectWindow.left; + yoffset = wndPtr->rectClient.top - wndPtr->rectWindow.top; + } + else + xoffset = yoffset = 0; + + /* client coordinates of child window */ + xoffset += childWnd->rectClient.left; + yoffset += childWnd->rectClient.top; + + DCE_AddClipRects( childWnd->child, NULL, hrgnClip, + &rect, xoffset, yoffset ); + } + /* sibling window rectangles are in client * coordinates of the parent window */ @@ -714,7 +741,8 @@ HDC32 WINAPI GetDCEx32( HWND32 hwnd, HRGN32 hrgnClip, DWORD flags ) else dcxFlags = flags & ~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_WINDOW); - hrgnVisible = DCE_GetVisRgn( parentPtr->hwndSelf, dcxFlags ); + hrgnVisible = DCE_GetVisRgn( parentPtr->hwndSelf, dcxFlags, + wndPtr->hwndSelf, flags ); if( flags & DCX_WINDOW ) OffsetRgn32( hrgnVisible, -wndPtr->rectWindow.left, -wndPtr->rectWindow.top ); @@ -733,7 +761,7 @@ HDC32 WINAPI GetDCEx32( HWND32 hwnd, HRGN32 hrgnClip, DWORD flags ) SYSMETRICS_CYSCREEN ); else { - hrgnVisible = DCE_GetVisRgn( hwnd, flags ); + hrgnVisible = DCE_GetVisRgn( hwnd, flags, 0, 0 ); DCE_OffsetVisRgn( hdc, hrgnVisible ); } @@ -874,7 +902,7 @@ BOOL16 WINAPI DCHook( HDC16 hDC, WORD code, DWORD data, LPARAM lParam ) if( dce->DCXflags & DCX_DCEBUSY ) { SetHookFlags(hDC, DCHF_VALIDATEVISRGN); - hVisRgn = DCE_GetVisRgn(dce->hwndCurrent, dce->DCXflags); + hVisRgn = DCE_GetVisRgn(dce->hwndCurrent, dce->DCXflags, 0, 0); TRACE(dc,"\tapplying saved clipRgn\n"); diff --git a/windows/winpos.c b/windows/winpos.c index 7dd7354b229..7a4ff6ae5a7 100644 --- a/windows/winpos.c +++ b/windows/winpos.c @@ -2045,7 +2045,7 @@ static UINT32 WINPOS_SizeMoveClean( WND* Wnd, HRGN32 oldVisRgn, LPRECT32 lpOldWndRect, LPRECT32 lpOldClientRect, UINT32 uFlags ) { - HRGN32 newVisRgn = DCE_GetVisRgn(Wnd->hwndSelf,DCX_WINDOW | DCX_CLIPSIBLINGS); + HRGN32 newVisRgn = DCE_GetVisRgn(Wnd->hwndSelf,DCX_WINDOW | DCX_CLIPSIBLINGS,0,0); HRGN32 dirtyRgn = CreateRectRgn32(0,0,0,0); int other, my; @@ -2333,7 +2333,7 @@ BOOL32 WINAPI SetWindowPos32( HWND32 hwnd, HWND32 hwndInsertAfter, if ( !X11DRV_WND_GetXWindow(wndPtr) && !(winpos.flags & SWP_NOREDRAW) && ((winpos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_FRAMECHANGED)) != (SWP_NOMOVE | SWP_NOSIZE)) ) - visRgn = DCE_GetVisRgn(hwnd, DCX_WINDOW | DCX_CLIPSIBLINGS); + visRgn = DCE_GetVisRgn(hwnd, DCX_WINDOW | DCX_CLIPSIBLINGS, 0, 0); /* Send WM_NCCALCSIZE message to get new client area */ if( (winpos.flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE )