[PATCH 0/2] MR11540: comctl32: Clamp child height when cyIntegral is zero.
Clamp child height between cyMinChild and cyMaxChild when no height increment is specified. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58683 -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11540
From: Maotong Zhang <zmtong1988@gmail.com> Add a test for RBBS_VARIABLEHEIGHT bands with cyIntegral and cyChild to zero. Verify that cyChild falls back to cyMinChild. --- dlls/comctl32/tests/rebar.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c index 18877165193..cb34f2a94b0 100644 --- a/dlls/comctl32/tests/rebar.c +++ b/dlls/comctl32/tests/rebar.c @@ -704,6 +704,28 @@ static void test_layout(void) DestroyWindow(hRebar); + /* VARHEIGHT with cyIntegral == 0 and cyChild == 0 */ + hRebar = create_rebar_control(0); + SetWindowLongA(hRebar, GWL_STYLE, GetWindowLongA(hRebar, GWL_STYLE) | RBS_AUTOSIZE); + rbi.cbSize = REBARBANDINFOA_V6_SIZE; + rbi.fMask = RBBIM_CHILD | RBBIM_CHILDSIZE | RBBIM_SIZE | RBBIM_STYLE; + rbi.fStyle = RBBS_VARIABLEHEIGHT; + rbi.cx = 90; + rbi.cxMinChild = 50; + rbi.cyMinChild = 10; + rbi.cyMaxChild = 200; + rbi.cyIntegral = 0; + rbi.cyChild = 0; + rbi.hwndChild = build_toolbar(0, hRebar); + SendMessageA(hRebar, RB_INSERTBANDA, -1, (LPARAM)&rbi); + + rbi.fMask = RBBIM_CHILDSIZE; + ok(SendMessageA(hRebar, RB_GETBANDINFOA, 0, (LPARAM)&rbi), "RB_GETBANDINFOA failed\n"); + todo_wine + compare(rbi.cyChild, 10, "%d"); + + DestroyWindow(hRebar); + rbsize_results_free(); } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11540
From: Maotong Zhang <zmtong1988@gmail.com> Clamp child height between cyMinChild and cyMaxChild when no height increment is specified. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=58683 --- dlls/comctl32/rebar.c | 6 +++++- dlls/comctl32/tests/rebar.c | 1 - 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/dlls/comctl32/rebar.c b/dlls/comctl32/rebar.c index 15bc0d5aaec..6708c418467 100644 --- a/dlls/comctl32/rebar.c +++ b/dlls/comctl32/rebar.c @@ -465,7 +465,11 @@ static int round_child_height(const REBAR_BAND *lpBand, int cyHeight) { int cy = 0; if (lpBand->cyIntegral == 0) - return min(cyHeight, lpBand->cyMaxChild); + { + cyHeight = max(cyHeight, (int)lpBand->cyMinChild); + cyHeight = min(cyHeight, (int)lpBand->cyMaxChild); + return cyHeight; + } cy = max(cyHeight - (int)lpBand->cyMinChild, 0); cy = lpBand->cyMinChild + (cy/lpBand->cyIntegral) * lpBand->cyIntegral; cy = min(cy, lpBand->cyMaxChild); diff --git a/dlls/comctl32/tests/rebar.c b/dlls/comctl32/tests/rebar.c index cb34f2a94b0..26b48a075fb 100644 --- a/dlls/comctl32/tests/rebar.c +++ b/dlls/comctl32/tests/rebar.c @@ -721,7 +721,6 @@ static void test_layout(void) rbi.fMask = RBBIM_CHILDSIZE; ok(SendMessageA(hRebar, RB_GETBANDINFOA, 0, (LPARAM)&rbi), "RB_GETBANDINFOA failed\n"); - todo_wine compare(rbi.cyChild, 10, "%d"); DestroyWindow(hRebar); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/11540
This merge request was approved by Zhiyi Zhang. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/11540
participants (3)
-
Maotong Zhang -
Maotong Zhang (@xiaotong) -
Zhiyi Zhang (@zhiyi)