[PATCH 0/1] MR2835: comctl32/toolbar: Always center bitmap for buttons.
The current implementation doesn't work when we set the button with a size that is greater than the size of bitmap. Likely it isn't easy to test this automatically, attached is the testcase I wrote for it. And this is the comparison:  [toolbar_button_bitmap_testcase.tar.gz](/uploads/51b3018645f7aa46d444cd8d696716e1/toolbar_button_bitmap_testcase.tar.gz) -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2835
From: Jactry Zeng <jzeng(a)codeweavers.com> The current implementation doesn't work when we set the button with a size that is greater than the size of bitmap. --- dlls/comctl32/toolbar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dlls/comctl32/toolbar.c b/dlls/comctl32/toolbar.c index 02538eeb649..433df5d209b 100644 --- a/dlls/comctl32/toolbar.c +++ b/dlls/comctl32/toolbar.c @@ -967,7 +967,7 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc, else rcBitmap.left += ((rc.right - rc.left) - infoPtr->nBitmapWidth) / 2; - rcBitmap.top += infoPtr->szPadding.cy / 2; + rcBitmap.top += ((rc.bottom - rc.top) - infoPtr->nBitmapHeight) / 2; TRACE("iBitmap=%d, start=(%ld,%ld) w=%d, h=%d\n", btnPtr->iBitmap, rcBitmap.left, rcBitmap.top, infoPtr->nBitmapWidth, infoPtr->nBitmapHeight); @@ -988,6 +988,7 @@ TOOLBAR_DrawButton (const TOOLBAR_INFO *infoPtr, TBUTTON_INFO *btnPtr, HDC hdc, rcText.top += infoPtr->szPadding.cy/2 + infoPtr->nBitmapHeight + 1; else rcText.top += infoPtr->szPadding.cy/2 + 2; + rcText.top += rcBitmap.top; } } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/2835
This looks still doesn't fit all the cases, as the pictures I have in #MR 2849 showed, the text of the buttons in the place bar is missing. Will try it again. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/2835#note_33070
participants (2)
-
Jactry Zeng -
Jactry Zeng (@jactry)