From 29ffdb871562027c50a30598603f5bf8e9dd9b3c Mon Sep 17 00:00:00 2001 From: Joachim Henze Date: Sun, 20 Aug 2023 02:49:06 +0200 Subject: [PATCH] [0.4.13] 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 49dbc8fbbb090812d21ac10e79d42c787638e2ec [NTUSER] Whitespace-fixes winpos.c 0.4.15-dev-5684-g 57eb2a6bf469383848a559feedc1eed7fc13dd5c [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 8866b9d7b03e62b3ed3041acb0b3791fbc1733aa Update win32ss/user/ntuser/winpos.c the superseded 0.4.15-dev-5617-g 7866eb28862b31f2ee90045293c662c8ac834a70 [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. --- win32ss/user/ntuser/winpos.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/win32ss/user/ntuser/winpos.c b/win32ss/user/ntuser/winpos.c index 0557b902937..adc0032bd00 100644 --- a/win32ss/user/ntuser/winpos.c +++ b/win32ss/user/ntuser/winpos.c @@ -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 @@ -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; @@ -1747,8 +1746,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 @@ -1948,7 +1945,7 @@ co_WinPosSetWindowPos( Window->state |= WNDS_SENDNCPAINT; } - 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, @@ -2105,7 +2102,7 @@ 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, NC HACK fix. + else if (RgnType != ERROR && RgnType == NULLREGION) // Must be the same. See CORE-7166 & CORE-15934, NC HACK fix. { if ( !PosChanged && !(WinPos.flags & SWP_DEFERERASE) && @@ -2154,7 +2151,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) @@ -2164,7 +2161,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) @@ -2212,7 +2209,7 @@ co_WinPosSetWindowPos( if ( !(Window->style & WS_CHILD) && (Parent) && (Parent->style & WS_CLIPCHILDREN)) { TRACE("SWP_FRAMECHANGED Parent %p WS_CLIPCHILDREN %p\n",Parent,Window); - UserSyncAndPaintWindows( Parent, RDW_CLIPCHILDREN); // NC should redraw here, see NC HACK fix. + UserSyncAndPaintWindows(Parent, RDW_CLIPCHILDREN); // NC should redraw here, see NC HACK fix. } } @@ -3068,7 +3065,7 @@ END: return retvalue; } -BOOL FASTCALL IntEndDeferWindowPosEx( HDWP hdwp, BOOL sAsync ) +BOOL FASTCALL IntEndDeferWindowPosEx(HDWP hdwp, BOOL sAsync) { PSMWP pDWP; PCVR winpos; @@ -3098,7 +3095,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);