From 8eaf36467713e7ba9a1a2272a44aa1581e31c1b0 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 22 May 2021 23:33:40 +0200 Subject: [PATCH] Extract gui_is_dark() to wx_util. --- src/wx/simple_video_view.cc | 9 +-------- src/wx/wx_util.cc | 12 ++++++++++++ src/wx/wx_util.h | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/src/wx/simple_video_view.cc b/src/wx/simple_video_view.cc index 0df4d6d22..1740e0ffd 100644 --- a/src/wx/simple_video_view.cc +++ b/src/wx/simple_video_view.cc @@ -75,14 +75,7 @@ SimpleVideoView::paint () dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2)); } -#if defined(DCPOMATIC_OSX) && wxCHECK_VERSION(3, 1, 0) - auto appearance = wxSystemSettings::GetAppearance(); - auto dark = appearance.IsDark(); -#else - auto dark = false; -#endif - - auto const pad_colour = (_viewer->pad_black() || dark) ? wxColour(0, 0, 0) : wxColour(240, 240, 240); + auto const pad_colour = (_viewer->pad_black() || gui_is_dark()) ? wxColour(0, 0, 0) : wxColour(240, 240, 240); if (out_size.width < panel_size.GetWidth()) { wxPen p (pad_colour); diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 1a34e5fa8..a0beb8f72 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -661,3 +661,15 @@ small_button_size (wxWindow* parent, wxString text) return size; } + +bool +gui_is_dark () +{ +#if defined(DCPOMATIC_OSX) && wxCHECK_VERSION(3, 1, 0) + auto appearance = wxSystemSettings::GetAppearance(); + return appearance.IsDark(); +#else + return false; +#endif +} + diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index aa3dc60db..585a30611 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -119,6 +119,7 @@ extern bool display_progress (wxString title, wxString task); extern bool report_errors_from_last_job (wxWindow* parent); extern wxString bitmap_path (std::string name); extern wxSize small_button_size (wxWindow* parent, wxString text); +extern bool gui_is_dark (); struct Offset -- 2.30.2