Add system option to never use AutoSystemDpiAware

Add the option 'msw.native-dialogs-pmdpi' that will always show the native msw dialogs
as per monitor dpi aware, even when there are displays with different dpi.
This commit is contained in:
Maarten Bent 2023-12-10 18:24:14 +01:00
parent 9befda5c26
commit ea5f585e89
No known key found for this signature in database
GPG key ID: 58AAEE3F4A4FD070
2 changed files with 13 additions and 1 deletions

View file

@ -16,6 +16,7 @@
#include "wx/dynlib.h" #include "wx/dynlib.h"
#include "wx/display.h" #include "wx/display.h"
#include "wx/sysopt.h"
namespace wxMSWImpl namespace wxMSWImpl
{ {
@ -68,7 +69,12 @@ public:
static bool Needed() 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; bool diferentDPI = false;
for ( unsigned i = 1; i < wxDisplay::GetCount() && !diferentDPI; ++i ) for ( unsigned i = 1; i < wxDisplay::GetCount() && !diferentDPI; ++i )
diferentDPI = wxDisplay(0u).GetPPI() != wxDisplay(i).GetPPI(); diferentDPI = wxDisplay(0u).GetPPI() != wxDisplay(i).GetPPI();

View file

@ -81,6 +81,12 @@
using it, i.e. this has the same effect as calling using it, i.e. this has the same effect as calling
wxApp::MSWEnableDarkMode(). If set to 2, use dark mode unconditionally, wxApp::MSWEnableDarkMode(). If set to 2, use dark mode unconditionally,
as if this function were called with wxApp::DarkMode_Always argument. 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 @endFlagTable