From 4bf117aabd766b1776d3f1f32dbae3a804096727 Mon Sep 17 00:00:00 2001 From: Dimitri Schoolwerth Date: Tue, 22 Dec 2020 02:09:21 +0100 Subject: [PATCH] Mac: Adjust wxDataViewCtrl column width calculator Slightly improve the maximum column width calculator by rounding up the (non-integer) width of cells using ceil() instead of adding 1 unconditionally. See #19003. --- src/osx/cocoa/dataview.mm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 361407cb5a..4e23c12d81 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -2198,7 +2198,7 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos) void UpdateWithRow(int row) { NSCell *cell = [m_view preparedCellAtColumn:m_column row:row]; - unsigned cellWidth = [cell cellSize].width + 1/*round the float up*/; + unsigned cellWidth = ceil([cell cellSize].width); if ( m_indent ) cellWidth += m_indent * [m_view levelForRow:row]; @@ -2228,7 +2228,7 @@ void wxCocoaDataViewControl::FitColumnWidthToContent(unsigned int pos) if ( [column headerCell] ) { - calculator.UpdateWithWidth([[column headerCell] cellSize].width + 1/*round the float up*/); + calculator.UpdateWithWidth(ceil([[column headerCell] cellSize].width)); } // The code below deserves some explanation. For very large controls, we