https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5c505d9a9b804a5464f348...
commit 5c505d9a9b804a5464f348ebc09265f28d4b75b4 Author: Doug Lyons douglyons@douglyons.com AuthorDate: Sat Feb 22 23:31:50 2025 -0600 Commit: Hermès Bélusca-Maïto hermes.belusca-maito@reactos.org CommitDate: Wed Mar 12 12:18:53 2025 +0100
[NTUSER] Handle window update region larger than the current window in clip region (#7731)
CORE-18206 CORE-18799 CORE-19371
Fixes infinite loop of: err: Message WM_PAINT count 1 Internal Paint Set? FALSE
The symptom appears in the following scenario (as reported in CORE-18799):
A program (game) runs at a small resolution (e.g. 640 x 480), but the game window gets invalidated at a larger size (e.g. 1152 x 864 screen resolution) before switching to the smaller (640 x 480) size. Because of this, the window's update region is larger than the current window so only the 640 x 480 region gets validated leaving the remaining region invalid. This causes the recurring WM_PAINT messages because there is no way to invalidate the remaining area. --- win32ss/user/ntuser/winpos.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/win32ss/user/ntuser/winpos.c b/win32ss/user/ntuser/winpos.c index d06730112be..da895726b7a 100644 --- a/win32ss/user/ntuser/winpos.c +++ b/win32ss/user/ntuser/winpos.c @@ -2037,7 +2037,17 @@ co_WinPosSetWindowPos( } else if(VisAfter) { - REGION_bOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top); + /* Clip existing update region to new window size */ + if (Window->hrgnUpdate != NULL) + { + PREGION RgnUpdate = REGION_LockRgn(Window->hrgnUpdate); + if (RgnUpdate) + { + RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, VisAfter, RGN_AND); + REGION_UnlockRgn(RgnUpdate); + } + } + REGION_bOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top); }
/*