diff --git a/include/wx/msw/private/dpiaware.h b/include/wx/msw/private/dpiaware.h index 122546df8a..eb5df72484 100644 --- a/include/wx/msw/private/dpiaware.h +++ b/include/wx/msw/private/dpiaware.h @@ -16,6 +16,7 @@ #include "wx/dynlib.h" #include "wx/display.h" +#include "wx/sysopt.h" namespace wxMSWImpl { @@ -68,7 +69,12 @@ public: static bool Needed() { - // use system-dpi-aware context when there are displays with different DPI + // use system-dpi-aware context when: + // - the user did not set an option to force per-monitor context + // - there are displays with different DPI + if ( wxSystemOptions::GetOptionInt("msw.native-dialogs-pmdpi") == 1 ) + return false; + bool diferentDPI = false; for ( unsigned i = 1; i < wxDisplay::GetCount() && !diferentDPI; ++i ) diferentDPI = wxDisplay(0u).GetPPI() != wxDisplay(i).GetPPI(); diff --git a/interface/wx/sysopt.h b/interface/wx/sysopt.h index c19865d0b8..2fc3bdd2dc 100644 --- a/interface/wx/sysopt.h +++ b/interface/wx/sysopt.h @@ -81,6 +81,12 @@ using it, i.e. this has the same effect as calling wxApp::MSWEnableDarkMode(). If set to 2, use dark mode unconditionally, as if this function were called with wxApp::DarkMode_Always argument. + @flag{msw.native-dialogs-pmdpi} + Some native win32 dialogs (like the font and colour pickers) are not + per-monitor DPI aware, and wxWidgets will forcefully show them as + system DPI aware when there are monitors with different DPI connected. + If set to 1, these dialogs will always be shown as per-monitor DPI + aware (when enabled in the manifest). @endFlagTable