https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2250ce80f3165462e30cfcd147daaf597b5d1c4f

commit 2250ce80f3165462e30cfcd147daaf597b5d1c4f
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Sun Jan 16 09:54:44 2022 +0900
Commit:     GitHub <[email protected]>
CommitDate: Sun Jan 16 09:54:44 2022 +0900

    [USER32] Adjust the threshold in CascadeWindows (#4283)
    
    Improve the threshold of CascadeWindows function not to make the windows 
too small.
---
 win32ss/user/user32/windows/mdi.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/win32ss/user/user32/windows/mdi.c 
b/win32ss/user/user32/windows/mdi.c
index 2849c0d6612..59a3d06c506 100644
--- a/win32ss/user/user32/windows/mdi.c
+++ b/win32ss/user/user32/windows/mdi.c
@@ -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 */

Reply via email to