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:
parent
a2f7a933e8
commit
9befda5c26
1 changed files with 13 additions and 0 deletions
|
|
@ -15,6 +15,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/dynlib.h"
|
#include "wx/dynlib.h"
|
||||||
|
#include "wx/display.h"
|
||||||
|
|
||||||
namespace wxMSWImpl
|
namespace wxMSWImpl
|
||||||
{
|
{
|
||||||
|
|
@ -35,6 +36,9 @@ public:
|
||||||
AutoSystemDpiAware()
|
AutoSystemDpiAware()
|
||||||
: m_prevContext(WXDPI_AWARENESS_CONTEXT_UNAWARE)
|
: m_prevContext(WXDPI_AWARENESS_CONTEXT_UNAWARE)
|
||||||
{
|
{
|
||||||
|
if ( !Needed() )
|
||||||
|
return;
|
||||||
|
|
||||||
if ( ms_pfnSetThreadDpiAwarenessContext == (SetThreadDpiAwarenessContext_t)-1)
|
if ( ms_pfnSetThreadDpiAwarenessContext == (SetThreadDpiAwarenessContext_t)-1)
|
||||||
{
|
{
|
||||||
wxLoadedDLL dllUser32("user32.dll");
|
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:
|
private:
|
||||||
WXDPI_AWARENESS_CONTEXT m_prevContext;
|
WXDPI_AWARENESS_CONTEXT m_prevContext;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue