Fix padding around preview in macOS dark mode (#1897).
authorCarl Hetherington <cth@carlh.net>
Fri, 15 Jan 2021 11:49:48 +0000 (12:49 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 15 Jan 2021 11:49:48 +0000 (12:49 +0100)
src/wx/simple_video_view.cc

index 342829471701f31bdee469a73ffd956d4e4a6dca..358e4268c37f13407562895c1261d831dd02bfb7 100644 (file)
@@ -75,18 +75,20 @@ SimpleVideoView::paint ()
                dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2));
        }
 
                dc.DrawBitmap (frame_bitmap, 0, max(0, (panel_size.GetHeight() - out_size.height) / 2));
        }
 
+       auto appearance = wxSystemSettings::GetAppearance();
+       auto const pad_colour = (_viewer->pad_black() || appearance.IsDark()) ? wxColour(0, 0, 0) : wxColour(240, 240, 240);
+
        if (out_size.width < panel_size.GetWidth()) {
        if (out_size.width < panel_size.GetWidth()) {
-               /* XXX: these colours are right for GNOME; may need adjusting for other OS */
-               wxPen   p (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
-               wxBrush b (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
+               wxPen   p (pad_colour);
+               wxBrush b (pad_colour);
                dc.SetPen (p);
                dc.SetBrush (b);
                dc.DrawRectangle (out_size.width, 0, panel_size.GetWidth() - out_size.width, panel_size.GetHeight());
        }
 
        if (out_size.height < panel_size.GetHeight()) {
                dc.SetPen (p);
                dc.SetBrush (b);
                dc.DrawRectangle (out_size.width, 0, panel_size.GetWidth() - out_size.width, panel_size.GetHeight());
        }
 
        if (out_size.height < panel_size.GetHeight()) {
-               wxPen   p (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
-               wxBrush b (_viewer->pad_black() ? wxColour(0, 0, 0) : wxColour(240, 240, 240));
+               wxPen   p (pad_colour);
+               wxBrush b (pad_colour);
                dc.SetPen (p);
                dc.SetBrush (b);
                int const gap = (panel_size.GetHeight() - out_size.height) / 2;
                dc.SetPen (p);
                dc.SetBrush (b);
                int const gap = (panel_size.GetHeight() - out_size.height) / 2;