[0.4.12] [NtUser] Fix Theme Non Client Painting, fixes the visible parts of regression CORE-15934

Resizing a themed window does not longer show a flashing rectangle in the title-bar after the fix.

Still this seems to be work-in-progress even after this first commit, but makes me happy for 0.4.12RCs
for now.

See CORE-7166 & CORE-15934.

cherry picked from commit 0.4.13-dev-8-g
cfdf36e442
This commit is contained in:
jimtabor 2019-04-10 20:52:01 -05:00 committed by Joachim Henze
parent e1ac9dcd66
commit 3e71805ae1
2 changed files with 28 additions and 51 deletions

View file

@ -41,3 +41,4 @@ BOOL UserDrawCaption(PWND,HDC,RECTL*,HFONT,HICON,const PUNICODE_STRING,UINT);
VOID FASTCALL UpdateThreadWindows(PWND,PTHREADINFO,HRGN);
VOID FASTCALL UserSyncAndPaintWindows(PWND pWnd, ULONG Flags);
VOID FASTCALL IntPaintWindow(PWND);
VOID FASTCALL IntSendNCPaint(PWND,HRGN);

View file

@ -1053,16 +1053,8 @@ static
BOOL
IntValidateParent(PWND Child, PREGION ValidateRgn)
{
PWND ParentWnd = Child;
PWND ParentWnd = Child->spwndParent;
if (ParentWnd->style & WS_CHILD)
{
do
ParentWnd = ParentWnd->spwndParent;
while (ParentWnd->style & WS_CHILD);
}
ParentWnd = Child->spwndParent;
while (ParentWnd)
{
if (ParentWnd->style & WS_CLIPCHILDREN)
@ -1898,8 +1890,7 @@ co_WinPosSetWindowPos(
VisAfter != NULL &&
!(WinPos.flags & SWP_NOCOPYBITS) &&
((WinPos.flags & SWP_NOSIZE) || !(WvrFlags & WVR_REDRAW)) &&
!(Window->ExStyle & WS_EX_TRANSPARENT) ) ||
( !PosChanged && (WinPos.flags & SWP_FRAMECHANGED) && VisBefore) )
!(Window->ExStyle & WS_EX_TRANSPARENT) ) )
{
/*
@ -1991,43 +1982,7 @@ co_WinPosSetWindowPos(
CopyRgn = NULL;
}
if ( !PosChanged && (WinPos.flags & SWP_FRAMECHANGED) && VisBefore )
{
PWND pwnd = Window;
PWND Parent = pwnd->spwndParent;
TRACE("SWP_FRAMECHANGED no chg\n");
if ( pwnd->style & WS_CHILD ) // Fix ProgMan menu bar drawing.
{
TRACE("SWP_FRAMECHANGED win child %p Parent %p\n",pwnd,Parent);
pwnd = Parent ? Parent : pwnd;
}
if ( !(pwnd->style & WS_CHILD) )
{
HDC hdc;
HRGN DcRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
PREGION DcRgnObj = REGION_LockRgn(DcRgn);
TRACE("SWP_FRAMECHANGED Draw\n");
IntGdiCombineRgn(DcRgnObj, VisBefore, NULL, RGN_COPY);
REGION_UnlockRgn(DcRgnObj);
hdc = UserGetDCEx( pwnd,
DcRgn,
DCX_WINDOW|DCX_CACHE|DCX_INTERSECTRGN|DCX_CLIPSIBLINGS|DCX_KEEPCLIPRGN); // DCX_WINDOW, see note above....
NC_DoNCPaint(pwnd, hdc, -1); // Force full redraw of nonclient area.
UserReleaseDC(pwnd, hdc, FALSE);
IntValidateParent(pwnd, DcRgnObj);
GreDeleteObject(DcRgn);
}
}
/* We need to redraw what wasn't visible before */
/* We need to redraw what wasn't visible before or force a redraw */
if (VisAfter != NULL)
{
PREGION DirtyRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
@ -2042,7 +1997,7 @@ co_WinPosSetWindowPos(
RgnType = IntGdiCombineRgn(DirtyRgn, VisAfter, 0, RGN_COPY);
}
if (RgnType != ERROR && RgnType != NULLREGION)
if (RgnType != ERROR && RgnType != NULLREGION) // Regions moved.
{
/* old code
NtGdiOffsetRgn(DirtyRgn, Window->rcWindow.left, Window->rcWindow.top);
@ -2067,6 +2022,27 @@ co_WinPosSetWindowPos(
IntInvalidateWindows( Window, DirtyRgn, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
}
}
else if ( RgnType != ERROR && RgnType == NULLREGION ) // Must be the same. See CORE-7166 & CORE-15934
{
if ( !PosChanged &&
!(WinPos.flags & SWP_DEFERERASE) &&
(WinPos.flags & SWP_FRAMECHANGED) )
{
PWND pwnd = Window;
PWND Parent = Window->spwndParent;
if ( pwnd->style & WS_CHILD ) // Fix ProgMan menu bar drawing.
{
TRACE("SWP_FRAMECHANGED win child %p Parent %p\n",pwnd,Parent);
pwnd = Parent ? Parent : pwnd;
}
if ( !(pwnd->style & WS_CHILD) )
{
IntSendNCPaint(pwnd, HRGN_WINDOW); // Paint the whole frame.
}
}
}
REGION_Delete(DirtyRgn);
}
}
@ -2077,7 +2053,7 @@ co_WinPosSetWindowPos(
}
/* Expose what was covered before but not covered anymore */
if (VisBefore != NULL)
if ( VisBefore != NULL )
{
PREGION ExposedRgn = IntSysCreateRectpRgn(0, 0, 0, 0);
if (ExposedRgn)
@ -2087,7 +2063,7 @@ co_WinPosSetWindowPos(
OldWindowRect.left - NewWindowRect.left,
OldWindowRect.top - NewWindowRect.top);
if (VisAfter != NULL)
if ( VisAfter != NULL )
RgnType = IntGdiCombineRgn(ExposedRgn, ExposedRgn, VisAfter, RGN_DIFF);
if (RgnType != ERROR && RgnType != NULLREGION)