[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.
This commit is contained in:
Doug Lyons
2025-03-12 12:18:53 +01:00
parent f37138ce91
commit 5c505d9a9b
+11 -1
View File
@@ -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);
}
/*