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()?