[0.4.11] Anti-flicker backport winpos.c

This effective one-liner-backport fixes flickering in some apps like:
- CORE-7652 Hyperlink Blinking text while installing vc2008 redist package
and many duplicate-tickets of that same symptom, like:
- CORE-18553 CPUID CPU-Z 1.84 "about" flickers
- CORE-7753 Caesar 3: Autorun.exe flickers endlessly
- CORE-10741 API monitor high CPU usage
- CORE-15300 Worksoft Navigator 0.985 installer is locked in an endless redrawing loop
- CORE-16325 Some of MWSnap's installation windows fail to display content
- CORE-17925 MS Visual C++ 2008 Redistributable Setup takes long time
- CORE-18153 BitComet 1.86 forces the shell to a endless redrawing
- CORE-18434 Ubisoft installers (SetupUbi) - continously refresh of window
- CORE-15546 Shed 1.0 from rapps - setup does not draw some dlgs initially, but redraw can be enforced
- CORE-18582 Emule 0.50a - Interface frozen / flickering until window is moved

And since I do also port back the follow-up-commit of that, we can achieve that without introducing
the following regressions which the initial fixes caused:
- CORE-18817 [NTUSER] Winpos.c modification generates bad first drawing of some elements
- CORE-18830 Explorer Drawing glitch: Missing "X" on "Folder" pane when Right Click > Explore from Desktop icons
Those 2 things did not happen in the older releases beforehand.

In sum this is a squashed backport of:
0.4.15-dev-6507-g 49dbc8fbbb [NTUSER] Whitespace-fixes winpos.c
0.4.15-dev-5684-g 57eb2a6bf4 [NTUSER] Missing "X" on "Folder" pane when Right Click > Explore from Desktop icons & Rapps toolbar errors (#5068) CORE-18830, CORE-18817
the superseded 0.4.15-dev-5618-g 8866b9d7b0 Update win32ss/user/ntuser/winpos.c
the superseded 0.4.15-dev-5617-g 7866eb2886 [NTUSER] Fix winpos bug hyperlink&images loop redrawing CORE-7652 (#4995)

To prevent increased binary size for the added conditions in the code in older branches, strip a single good-path-TRACE()
which had no trailing \n in the older branches,
but where that \n was added in master head meanwhile. So that TRACE was a diff to older branches anyway.
This commit is contained in:
Joachim Henze 2023-08-20 02:52:01 +02:00
parent 2f3fea7b5e
commit dafd020c07

View file

@ -1,9 +1,8 @@
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Windows
* FILE: win32ss/user/ntuser/winpos.c
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* PURPOSE: Windows
* PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
*/
#include <win32k.h>
@ -437,7 +436,7 @@ co_WinPosActivateOtherWindow(PWND Wnd)
// Find any window to bring to top. Works Okay for wine since it does not see X11 windows.
WndTo = UserGetDesktopWindow();
WndTo = WndTo->spwndChild;
if ( WndTo == NULL )
if (WndTo == NULL)
{
//ERR("WinPosActivateOtherWindow No window!\n");
return;
@ -1693,8 +1692,6 @@ co_WinPosSetWindowPos(
ASSERT_REFS_CO(Window);
TRACE("pwnd %p, after %p, %d,%d (%dx%d), flags 0x%x",
Window, WndInsertAfter, x, y, cx, cy, flags);
#if DBG
dump_winpos_flags(flags);
#endif
@ -1886,7 +1883,7 @@ co_WinPosSetWindowPos(
DceResetActiveDCEs(Window); // For WS_VISIBLE changes.
if (!(WinPos.flags & SWP_NOREDRAW))
if (!(WinPos.flags & SWP_NOREDRAW) && ((WinPos.flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE))
{
/* Determine the new visible region */
VisAfter = VIS_ComputeVisibleRegion(Window, FALSE, FALSE,
@ -2006,19 +2003,7 @@ co_WinPosSetWindowPos(
{
CopyRgn = NULL;
}
#if 0
/////// Fixes NoPopup tests but breaks msg_paint tests.
if ( !PosChanged && (WinPos.flags & SWP_FRAMECHANGED) && VisBefore)
{
PWND Parent = Window->spwndParent;
ERR("SWP_FRAMECHANGED no chg\n");
if ( !(Window->style & WS_CHILD) && (Parent) && (Parent->style & WS_CLIPCHILDREN))
{
ERR("SWP_FRAMECHANGED Parent WS_CLIPCHILDREN\n");
//IntInvalidateWindows( Window, VisBefore, /*RDW_ERASE |*/ RDW_FRAME | RDW_INVALIDATE | RDW_ALLCHILDREN);
}
}
#endif
/* We need to redraw what wasn't visible before */
if (VisAfter != NULL)
{
@ -2124,7 +2109,7 @@ co_WinPosSetWindowPos(
if ( !(Window->style & WS_CHILD) && (Parent) && (Parent->style & WS_CLIPCHILDREN))
{
TRACE("SWP_FRAMECHANGED Parent WS_CLIPCHILDREN\n");
UserSyncAndPaintWindows( Parent, RDW_CLIPCHILDREN);
UserSyncAndPaintWindows(Parent, RDW_CLIPCHILDREN);
}
}
@ -2980,7 +2965,7 @@ END:
return retvalue;
}
BOOL FASTCALL IntEndDeferWindowPosEx( HDWP hdwp, BOOL sAsync )
BOOL FASTCALL IntEndDeferWindowPosEx(HDWP hdwp, BOOL sAsync)
{
PSMWP pDWP;
PCVR winpos;
@ -3010,7 +2995,7 @@ BOOL FASTCALL IntEndDeferWindowPosEx( HDWP hdwp, BOOL sAsync )
UserRefObjectCo(pwnd, &Ref);
if ( sAsync )
if (sAsync)
{
LRESULT lRes;
PWINDOWPOS ppos = ExAllocatePoolWithTag(PagedPool, sizeof(WINDOWPOS), USERTAG_SWP);