[COMCTL32]: Fix all tests for BCM_GETIDEALSIZE that we have so far. (It still returns a wrong result for the start button with lautus).

svn path=/trunk/; revision=74037
This commit is contained in:
Giannis Adamopoulos 2017-03-03 13:56:49 +00:00
parent b3ba96d405
commit bf0e8e0bcb

View file

@ -315,16 +315,13 @@ BOOL BUTTON_GetIdealSize(HTHEME theme, HWND hwnd, SIZE* psize)
WCHAR *text; WCHAR *text;
HFONT hFont = 0, hPrevFont = 0; HFONT hFont = 0, hPrevFont = 0;
SIZE TextSize, ImageSize, ButtonSize; SIZE TextSize, ImageSize, ButtonSize;
BOOL ret = FALSE;
pdata = _GetButtonData(hwnd); pdata = _GetButtonData(hwnd);
text = get_button_text( hwnd ); text = get_button_text( hwnd );
hdc = GetDC(hwnd); hdc = GetDC(hwnd);
if (!pdata || !text || !hdc || !text[0]) if (!pdata || !text || !hdc || !text[0])
{
psize->cx = 100;
psize->cy = 100;
goto cleanup; goto cleanup;
}
/* FIXME : Should use GetThemeTextExtent but unfortunately uses DrawTextW which is broken */ /* FIXME : Should use GetThemeTextExtent but unfortunately uses DrawTextW which is broken */
if (theme) if (theme)
@ -381,6 +378,7 @@ BOOL BUTTON_GetIdealSize(HTHEME theme, HWND hwnd, SIZE* psize)
} }
*psize = ButtonSize; *psize = ButtonSize;
ret = TRUE;
cleanup: cleanup:
if (hFont) if (hFont)
@ -390,7 +388,7 @@ cleanup:
if (hdc) if (hdc)
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
return TRUE; return ret;
} }
#endif #endif
@ -575,17 +573,24 @@ LRESULT WINAPI ButtonWndProc_common(HWND hWnd, UINT uMsg,
case BCM_GETIDEALSIZE: case BCM_GETIDEALSIZE:
{ {
HTHEME theme = GetWindowTheme(hWnd); HTHEME theme = GetWindowTheme(hWnd);
BOOL ret = FALSE;
SIZE* pSize = (SIZE*)lParam;
if (btn_type != BS_PUSHBUTTON && btn_type != BS_DEFPUSHBUTTON) if (btn_type == BS_PUSHBUTTON ||
btn_type == BS_DEFPUSHBUTTON ||
btn_type == BS_USERBUTTON)
{
ret = BUTTON_GetIdealSize(theme, hWnd, pSize);
}
if (!ret)
{ {
SIZE* pSize = (SIZE*)lParam;
GetClientRect(hWnd, &rect); GetClientRect(hWnd, &rect);
pSize->cx = rect.right; pSize->cx = rect.right;
pSize->cy = rect.bottom; pSize->cy = rect.bottom;
return TRUE;
} }
return BUTTON_GetIdealSize(theme, hWnd, (SIZE*)lParam); return TRUE;
} }
} }