From 5d1c48d5ba6f847f63b341be8bceb1823b5fb6d2 Mon Sep 17 00:00:00 2001 From: Jertzukka Date: Mon, 9 Jun 2025 04:27:25 +0300 Subject: [PATCH] Linux/FreeBSD/macOS: Column widths correct initially and on update (#1552) Column width was updated before SlotListCtrl had the slots added, which caused the column width to be incorrect before the first time OnTimer ran to update it. Changing the order ensures the column width is correct on program launch. Also ensure that we do not autosize column to fit empty content. --- src/Main/Forms/MainFrame.cpp | 5 +++-- src/Main/GraphicUserInterface.cpp | 6 +++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Main/Forms/MainFrame.cpp b/src/Main/Forms/MainFrame.cpp index 97c60e7e..c9efd405 100644 --- a/src/Main/Forms/MainFrame.cpp +++ b/src/Main/Forms/MainFrame.cpp @@ -1687,7 +1687,6 @@ namespace VeraCrypt } VolumeInfoList protectionTriggeredVolumes; - SlotListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE); // Update list long prevItemIndex = -1; @@ -1773,8 +1772,10 @@ namespace VeraCrypt } } - if (listChanged) + if (listChanged) { + SlotListCtrl->SetColumnWidth(0, wxLIST_AUTOSIZE); OnListChanged(); + } foreach (shared_ptr volume, protectionTriggeredVolumes) OnHiddenVolumeProtectionTriggered (volume); diff --git a/src/Main/GraphicUserInterface.cpp b/src/Main/GraphicUserInterface.cpp index 85c377f8..883b2d68 100644 --- a/src/Main/GraphicUserInterface.cpp +++ b/src/Main/GraphicUserInterface.cpp @@ -2072,8 +2072,12 @@ namespace VeraCrypt { item.SetText (field); listCtrl->SetItem (item); - if (item.GetColumn() == 3 || item.GetColumn() == 4) + if ((item.GetColumn() == 3 || item.GetColumn() == 4) && !item.GetText().IsEmpty()) listCtrl->SetColumnWidth(item.GetColumn(), wxLIST_AUTOSIZE); + // SlotListCtrl headers do not automatically move with column widths changing on macOS +#ifdef TC_MACOSX + listCtrl->Update(); +#endif changed = true; } }