[USER32] Adjust the threshold in CascadeWindows (#4283)

Improve the threshold of CascadeWindows function not to make the windows too small.
This commit is contained in:
Katayama Hirofumi MZ 2022-01-16 09:54:44 +09:00 committed by GitHub
parent 463d312169
commit 2250ce80f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2157,10 +2157,12 @@ CascadeWindows(HWND hwndParent, UINT wFlags, LPCRECT lpRect,
if (info.chwnd != 1 && (GetWindowLongPtrW(hwnd, GWL_STYLE) & WS_THICKFRAME))
{
/* check the size */
#define THRESHOLD(xy) (((xy) * 5) / 7) /* in the rate 5/7 */
cxNew = min(cxNew, THRESHOLD(cxWork));
cyNew = min(cyNew, THRESHOLD(cyWork));
#undef THRESHOLD
#define MIN_THRESHOLD(xy) (((xy) * 4) / 7) /* in the rate 4/7 */
#define MAX_THRESHOLD(xy) (((xy) * 5) / 7) /* in the rate 5/7 */
cxNew = max(min(cxNew, MAX_THRESHOLD(cxWork)), MIN_THRESHOLD(cxWork));
cyNew = max(min(cyNew, MAX_THRESHOLD(cyWork)), MIN_THRESHOLD(cyWork));
#undef MIN_THRESHOLD
#undef MAX_THRESHOLD
if (cx != cxNew || cy != cyNew)
{
/* too large. shrink if we can */