Re: [PATCH v2 0/3] MR4484: comctl32: Use selected font to determine default min tab width
Nikolay Sivov (@nsivov) commented about dlls/comctl32/tab.c:
- if (infoPtr->tabMinWidth < 0) - oldcx = DEFAULT_MIN_TAB_WIDTH; - else + if (infoPtr->tabMinWidth < 0) { + TEXTMETRICW text_metrics; + HDC hdc = GetDC(infoPtr->hwnd); + HFONT oldFont = SelectObject(hdc, infoPtr->hFont); + GetTextMetricsW(hdc, &text_metrics); + oldcx = text_metrics.tmAveCharWidth * MIN_CHAR_LENGTH + infoPtr->uHItemPadding * 2; + SelectObject(hdc, oldFont); + ReleaseDC(infoPtr->hwnd, hdc); + } else { oldcx = infoPtr->tabMinWidth; + } infoPtr->tabMinWidth = cx; TAB_SetItemBounds(infoPtr); Could we move this segment to SetItemBounds()? It does exactly the same calculation. At the very least we should consider a helper. Or maybe we could return oldcx value from SetItemBounds()?
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/4484#note_54425
participants (1)
-
Nikolay Sivov (@nsivov)