Extract dpi_scale_factor() to a function.
[dcpomatic.git] / src / wx / wx_util.cc
index 1a34e5fa808bc992d1bd14bb55368848f0080862..47a6bd5b05141a704ed08a86b3df64c39b9d3d57 100644 (file)
@@ -661,3 +661,30 @@ small_button_size (wxWindow* parent, wxString text)
        return size;
 }
 
        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
+}
+
+
+#if wxCHECK_VERSION(3,1,0)
+double
+dpi_scale_factor (wxWindow* window)
+{
+       return window->GetDPIScaleFactor();
+}
+#else
+double
+dpi_scale_factor (wxWindow*)
+{
+       return 1;
+}
+#endif
+