From f013450b8969a9d74cbb0190ef89c41e6d1eb928 Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Fri, 11 Sep 2026 19:35:40 -0700 Subject: [PATCH] FreeDVReporter: only force column relayout on visibility/highlight changes setColumnAutosize_() forces a full column relayout (SetWidth() on every column) on macOS, worked around a wxWidgets rendering bug (see https://github.com/wxWidgets/wxWidgets/issues/25972). It was firing whenever any row's data changed at all (isPendingUpdate), not just when a row's visibility or highlight color changed. On a busy reporter network, isPendingUpdate can be true on effectively every 250ms highlight-timer tick, so this was running continuously rather than only when column widths could plausibly need to change -- matching an observed symptom of the Reporter window's headers redrawing themselves very frequently. Plain data refreshes still go through ItemsChanged() so cell content stays live; only the column-width relayout is now skipped for them. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01Jz1Nz4hmnEzwQ7hjQtCBhk --- src/gui/dialogs/freedv_reporter.cpp | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/src/gui/dialogs/freedv_reporter.cpp b/src/gui/dialogs/freedv_reporter.cpp index 355f74f9..515e9e60 100644 --- a/src/gui/dialogs/freedv_reporter.cpp +++ b/src/gui/dialogs/freedv_reporter.cpp @@ -1281,6 +1281,18 @@ void FreeDVReporterDialog::FreeDVReporterDataModel::updateHighlights() wxDataViewItemArray itemsAdded; wxDataViewItemArray itemsChanged; wxDataViewItemArray itemsDeleted; + + // setColumnAutosize_() forces a full column relayout (SetWidth() on + // every column -- see the macOS branch below), which is only ever + // needed when a row's visibility or highlight color actually + // changes. A plain data refresh (isPendingUpdate, e.g. an updated + // SNR/frequency from a busy reporter network) still needs its cell + // repainted via ItemsChanged() below, but doesn't need the column + // widths touched. On a busy network isPendingUpdate can be true on + // effectively every 250ms tick, so without this the relayout dance + // was running continuously instead of only when actually needed. + bool needsColumnAutosize = false; + for (auto& item : allReporterData_) { if (item.second->isPendingDelete) @@ -1391,18 +1403,26 @@ void FreeDVReporterDialog::FreeDVReporterDataModel::updateHighlights() wxDataViewItem dvi(reportData); itemsChanged.Add(dvi); + + if (isHighlightUpdated) + { + needsColumnAutosize = true; + } } } } } - + if (itemsChanged.size() > 0) { - setColumnAutosize_(false); + if (needsColumnAutosize) + { + setColumnAutosize_(false); + } ItemsChanged(itemsChanged); } - - if (itemsAdded.size() > 0 || itemsDeleted.size() > 0 || itemsChanged.size() > 0) + + if (itemsAdded.size() > 0 || itemsDeleted.size() > 0 || needsColumnAutosize) { setColumnAutosize_(true); }