Skip to content

Commit 5c505d9

Browse files
Doug-LyonsHBelusca
authored andcommitted
[NTUSER] Handle window update region larger than the current window in clip region (reactos#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.
1 parent f37138c commit 5c505d9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

win32ss/user/ntuser/winpos.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2037,7 +2037,17 @@ co_WinPosSetWindowPos(
20372037
}
20382038
else if(VisAfter)
20392039
{
2040-
REGION_bOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top);
2040+
/* Clip existing update region to new window size */
2041+
if (Window->hrgnUpdate != NULL)
2042+
{
2043+
PREGION RgnUpdate = REGION_LockRgn(Window->hrgnUpdate);
2044+
if (RgnUpdate)
2045+
{
2046+
RgnType = IntGdiCombineRgn(RgnUpdate, RgnUpdate, VisAfter, RGN_AND);
2047+
REGION_UnlockRgn(RgnUpdate);
2048+
}
2049+
}
2050+
REGION_bOffsetRgn(VisAfter, -Window->rcWindow.left, -Window->rcWindow.top);
20412051
}
20422052

20432053
/*

0 commit comments

Comments
 (0)