From 7dcf5d0097aa0f864b62f47b41ca6af19ef6500e Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Wed, 28 Jun 2023 23:52:13 -0700 Subject: [PATCH 1/6] Fix display bugs related to switching between dark and light modes. --- src/main.h | 2 ++ src/ongui.cpp | 13 +++++++++++++ src/plot_waterfall.cpp | 5 +++-- src/topFrame.cpp | 6 +++--- src/topFrame.h | 2 ++ 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/main.h b/src/main.h index feda6c23c..922c88392 100644 --- a/src/main.h +++ b/src/main.h @@ -552,6 +552,8 @@ class MainFrame : public TopFrame void OnReportFrequencySetFocus(wxFocusEvent& event) override; void OnReportFrequencyKillFocus(wxFocusEvent& event) override; + + void OnSystemColorChanged(wxSysColourChangedEvent& event) override; private: std::shared_ptr rxInSoundDevice; diff --git a/src/ongui.cpp b/src/ongui.cpp index 4957f0f51..101e598d0 100644 --- a/src/ongui.cpp +++ b/src/ongui.cpp @@ -704,3 +704,16 @@ void MainFrame::OnReportFrequencyKillFocus(wxFocusEvent& event) TopFrame::OnReportFrequencyKillFocus(event); } + +void MainFrame::OnSystemColorChanged(wxSysColourChangedEvent& event) +{ + // Works around issues on wxWidgets with certain controls not changing backgrounds + // when the user switches between light and dark mode. + wxColour currentControlBackground = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + + SetBackgroundColour(currentControlBackground); + m_collpane->SetBackgroundColour(currentControlBackground); + m_collpane->GetPane()->SetBackgroundColour(currentControlBackground); + m_auiNbookCtrl->SetBackgroundColour(currentControlBackground); + TopFrame::OnSystemColorChanged(event); +} diff --git a/src/plot_waterfall.cpp b/src/plot_waterfall.cpp index d2ccf55f2..7689b1385 100644 --- a/src/plot_waterfall.cpp +++ b/src/plot_waterfall.cpp @@ -239,10 +239,11 @@ void PlotWaterfall::drawGraticule(wxGraphicsContext* ctx) float f, time, freq_hz_to_px, time_s_to_py; wxBrush ltGraphBkgBrush; + wxColour foregroundColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT); ltGraphBkgBrush.SetStyle(wxBRUSHSTYLE_TRANSPARENT); - ltGraphBkgBrush.SetColour(*wxBLACK); + ltGraphBkgBrush.SetColour(foregroundColor); ctx->SetBrush(ltGraphBkgBrush); - ctx->SetPen(wxPen(BLACK_COLOR, 1)); + ctx->SetPen(wxPen(foregroundColor, 1)); wxGraphicsFont tmpFont = ctx->CreateFont(GetFont(), GetForegroundColour()); ctx->SetFont(tmpFont); diff --git a/src/topFrame.cpp b/src/topFrame.cpp index 2bd66b435..3aafa9a0d 100644 --- a/src/topFrame.cpp +++ b/src/topFrame.cpp @@ -47,8 +47,8 @@ class TabFreeAuiNotebook : public wxAuiNotebook TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxFrame(parent, id, title, pos, size, style) { this->SetSizeHints(wxDefaultSize, wxDefaultSize); - this->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); - this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); + //this->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); + //this->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW)); //===================================================== // Menubar Setup m_menubarMain = new wxMenuBar(wxMB_DOCKABLE); @@ -520,7 +520,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const this->Connect(wxEVT_PAINT, wxPaintEventHandler(TopFrame::topFrame_OnPaint)); this->Connect(wxEVT_SIZE, wxSizeEventHandler(TopFrame::topFrame_OnSize)); this->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TopFrame::topFrame_OnUpdateUI)); - + this->Connect(wxEVT_SYS_COLOUR_CHANGED, wxSysColourChangedEventHandler(TopFrame::OnSystemColorChanged)); this->Connect(m_menuItemExit->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnExit)); this->Connect(m_menuItemOnTop->GetId(), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TopFrame::OnTop)); diff --git a/src/topFrame.h b/src/topFrame.h index 6cb646a2a..4d0d50509 100644 --- a/src/topFrame.h +++ b/src/topFrame.h @@ -220,6 +220,8 @@ class TopFrame : public wxFrame virtual void OnReportFrequencySetFocus(wxFocusEvent& event) { event.Skip(); } virtual void OnReportFrequencyKillFocus(wxFocusEvent& event) { event.Skip(); } + + virtual void OnSystemColorChanged(wxSysColourChangedEvent& event) { event.Skip(); } public: wxToggleButton* m_togBtnOnOff; From 66c70485afca966328a04a4987c02f01f54a4ce5 Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Thu, 29 Jun 2023 00:08:28 -0700 Subject: [PATCH 2/6] Try transparent color instead as the system colors aren't quite the same across platforms. --- src/ongui.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/ongui.cpp b/src/ongui.cpp index 101e598d0..6ba1c608f 100644 --- a/src/ongui.cpp +++ b/src/ongui.cpp @@ -709,9 +709,8 @@ void MainFrame::OnSystemColorChanged(wxSysColourChangedEvent& event) { // Works around issues on wxWidgets with certain controls not changing backgrounds // when the user switches between light and dark mode. - wxColour currentControlBackground = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + wxColour currentControlBackground = wxTransparentColour; - SetBackgroundColour(currentControlBackground); m_collpane->SetBackgroundColour(currentControlBackground); m_collpane->GetPane()->SetBackgroundColour(currentControlBackground); m_auiNbookCtrl->SetBackgroundColour(currentControlBackground); From a3c5ebb31bccb43a757bb5799482abf8caff7de3 Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Thu, 29 Jun 2023 00:14:22 -0700 Subject: [PATCH 3/6] Remove background color change that doesn't do anything. --- src/ongui.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/ongui.cpp b/src/ongui.cpp index 6ba1c608f..16377081c 100644 --- a/src/ongui.cpp +++ b/src/ongui.cpp @@ -713,6 +713,5 @@ void MainFrame::OnSystemColorChanged(wxSysColourChangedEvent& event) m_collpane->SetBackgroundColour(currentControlBackground); m_collpane->GetPane()->SetBackgroundColour(currentControlBackground); - m_auiNbookCtrl->SetBackgroundColour(currentControlBackground); TopFrame::OnSystemColorChanged(event); } From cd0165a5a3f010fa8441e648758290d8891458fd Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Thu, 29 Jun 2023 00:16:16 -0700 Subject: [PATCH 4/6] Add PR #454 to changelog. --- USER_MANUAL.md | 1 + 1 file changed, 1 insertion(+) diff --git a/USER_MANUAL.md b/USER_MANUAL.md index 98c5f38e9..2b1dfa731 100644 --- a/USER_MANUAL.md +++ b/USER_MANUAL.md @@ -873,6 +873,7 @@ LDPC | Low Density Parity Check Codes - a family of powerful FEC codes * Hamlib: set mode before frequency to avoid accidental offsetting. (PR #442, #452) * Fix audio dialog plot display and lockup issues. (PR #450) * Disable PTT and Voice Keyer buttons if only RX devices are configured. (PR #449) + * Fix Linux display bugs when switching between dark and light mode. (PR #454) 2. Enhancements: * Add the ability to request that another FreeDV Reporter user QSY. (PR #434, #453) * Display 'Digital' on button when Analog mode is active. (PR #447) From 230433d74b6e52474859e63b6a02bce9c14affb7 Mon Sep 17 00:00:00 2001 From: Mooneer Salem Date: Thu, 29 Jun 2023 07:47:40 +0000 Subject: [PATCH 5/6] latest user manual PDF --- USER_MANUAL.html | 1 + USER_MANUAL.pdf | Bin 1116608 -> 1117895 bytes 2 files changed, 1 insertion(+) diff --git a/USER_MANUAL.html b/USER_MANUAL.html index f185fcea4..ecf1623d7 100644 --- a/USER_MANUAL.html +++ b/USER_MANUAL.html @@ -613,6 +613,7 @@

Hamlib: set mode before frequency to avoid accidental offsetting. (PR #442, #452)
  • Fix audio dialog plot display and lockup issues. (PR #450)
  • Disable PTT and Voice Keyer buttons if only RX devices are configured. (PR #449)
  • +
  • Fix Linux display bugs when switching between dark and light mode. (PR #454)
  • Enhancements: