[PATCH 1/5] comctl32/button: Correctly place parts for buttons with WS_EX_RIGHT.
WS_EX_RIGHT has the same effect as BS_RIGHT. Signed-off-by: Zhiyi Zhang <zzhang(a)codeweavers.com> --- dlls/comctl32/button.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/comctl32/button.c b/dlls/comctl32/button.c index 6a463cb3460..70ac6b1c2da 100644 --- a/dlls/comctl32/button.c +++ b/dlls/comctl32/button.c @@ -1547,17 +1547,15 @@ static BOOL CL_GetIdealSize(BUTTON_INFO *infoPtr, SIZE *size) */ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *labelRc, RECT *imageRc, RECT *textRc) { - LONG style = GetWindowLongW( infoPtr->hwnd, GWL_STYLE ); - LONG ex_style = GetWindowLongW( infoPtr->hwnd, GWL_EXSTYLE ); - LONG split_style = infoPtr->imagelist.himl ? BUTTON_ILStoBS(infoPtr->imagelist.uAlign) : style; WCHAR *text = get_button_text(infoPtr); SIZE imageSize = BUTTON_GetImageSize(infoPtr); - UINT dtStyle = BUTTON_BStoDT(style, ex_style); RECT labelRect, imageRect, imageRectWithMargin, textRect; LONG imageMarginWidth, imageMarginHeight; const RECT *textMargin = BUTTON_GetTextMargin(infoPtr); + LONG style, ex_style, split_style; RECT emptyMargin = {0}; LONG maxTextWidth; + UINT dtStyle; /* Calculate label rectangle according to label type */ if ((imageSize.cx == 0 && imageSize.cy == 0) && (text == NULL || text[0] == '\0')) @@ -1569,6 +1567,14 @@ static UINT BUTTON_CalcLayoutRects(const BUTTON_INFO *infoPtr, HDC hdc, RECT *la return (UINT)-1; } + style = GetWindowLongW(infoPtr->hwnd, GWL_STYLE); + ex_style = GetWindowLongW(infoPtr->hwnd, GWL_EXSTYLE); + /* Add BS_RIGHT directly. When both WS_EX_RIGHT and BS_LEFT are present, it becomes BS_CENTER */ + if (ex_style & WS_EX_RIGHT) + style |= BS_RIGHT; + split_style = infoPtr->imagelist.himl ? BUTTON_ILStoBS(infoPtr->imagelist.uAlign) : style; + dtStyle = BUTTON_BStoDT(style, ex_style); + SetRect(&imageRect, 0, 0, imageSize.cx, imageSize.cy); imageRectWithMargin = imageRect; if (infoPtr->imagelist.himl) -- 2.32.0
participants (1)
-
Zhiyi Zhang