mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-10-07 14:54:00 +08:00
Only use AutoSystemDpiAware when displays have different DPI
So the native win32 dialogs, like font and colour picker, are not shown blurry unnecessary. Fixes #24121
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/dynlib.h"
|
||||
#include "wx/display.h"
|
||||
|
||||
namespace wxMSWImpl
|
||||
{
|
||||
@@ -35,6 +36,9 @@ public:
|
||||
AutoSystemDpiAware()
|
||||
: m_prevContext(WXDPI_AWARENESS_CONTEXT_UNAWARE)
|
||||
{
|
||||
if ( !Needed() )
|
||||
return;
|
||||
|
||||
if ( ms_pfnSetThreadDpiAwarenessContext == (SetThreadDpiAwarenessContext_t)-1)
|
||||
{
|
||||
wxLoadedDLL dllUser32("user32.dll");
|
||||
@@ -62,6 +66,15 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
static bool Needed()
|
||||
{
|
||||
// use system-dpi-aware context when there are displays with different DPI
|
||||
bool diferentDPI = false;
|
||||
for ( unsigned i = 1; i < wxDisplay::GetCount() && !diferentDPI; ++i )
|
||||
diferentDPI = wxDisplay(0u).GetPPI() != wxDisplay(i).GetPPI();
|
||||
return diferentDPI;
|
||||
}
|
||||
|
||||
private:
|
||||
WXDPI_AWARENESS_CONTEXT m_prevContext;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user