Skip to content

Commit

Permalink
Merge pull request #454 from drowe67/ms-dark-mode-colors
Browse files Browse the repository at this point in the history
Fix Linux display bugs when switching between dark and light mode
  • Loading branch information
tmiw authored Jul 1, 2023
2 parents 95b0eec + 230433d commit e7dd235
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions USER_MANUAL.html
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ <h2 data-number="17.1" id="v1.8.12-tbd-2023"><span class="header-section-number"
<li>Hamlib: set mode before frequency to avoid accidental offsetting. (PR #442, #452)</li>
<li>Fix audio dialog plot display and lockup issues. (PR #450)</li>
<li>Disable PTT and Voice Keyer buttons if only RX devices are configured. (PR #449)</li>
<li>Fix Linux display bugs when switching between dark and light mode. (PR #454)</li>
</ul></li>
<li>Enhancements:
<ul>
Expand Down
1 change: 1 addition & 0 deletions USER_MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Binary file modified USER_MANUAL.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<IAudioDevice> rxInSoundDevice;
Expand Down
11 changes: 11 additions & 0 deletions src/ongui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,3 +704,14 @@ 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 = wxTransparentColour;

m_collpane->SetBackgroundColour(currentControlBackground);
m_collpane->GetPane()->SetBackgroundColour(currentControlBackground);
TopFrame::OnSystemColorChanged(event);
}
5 changes: 3 additions & 2 deletions src/plot_waterfall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/topFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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));

Expand Down
2 changes: 2 additions & 0 deletions src/topFrame.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e7dd235

Please sign in to comment.