|
@@ -53,19 +53,22 @@ static double getDesktopScaleFactor(const uintptr_t parentWindowHandle) |
|
|
return std::max(1.0, std::atof(scale)); |
|
|
return std::max(1.0, std::atof(scale)); |
|
|
|
|
|
|
|
|
#if defined(DISTRHO_OS_WINDOWS) |
|
|
#if defined(DISTRHO_OS_WINDOWS) |
|
|
# if defined(__GNUC__) && (__GNUC__ >= 9) |
|
|
|
|
|
# pragma GCC diagnostic push |
|
|
|
|
|
# pragma GCC diagnostic ignored "-Wcast-function-type" |
|
|
|
|
|
# endif |
|
|
|
|
|
if (const HMODULE Shcore = LoadLibraryA("Shcore.dll")) |
|
|
if (const HMODULE Shcore = LoadLibraryA("Shcore.dll")) |
|
|
{ |
|
|
{ |
|
|
typedef HRESULT(WINAPI* PFN_GetProcessDpiAwareness)(HANDLE, DWORD*); |
|
|
typedef HRESULT(WINAPI* PFN_GetProcessDpiAwareness)(HANDLE, DWORD*); |
|
|
typedef HRESULT(WINAPI* PFN_GetScaleFactorForMonitor)(HMONITOR, DWORD*); |
|
|
typedef HRESULT(WINAPI* PFN_GetScaleFactorForMonitor)(HMONITOR, DWORD*); |
|
|
|
|
|
|
|
|
|
|
|
# if defined(__GNUC__) && (__GNUC__ >= 9) |
|
|
|
|
|
# pragma GCC diagnostic push |
|
|
|
|
|
# pragma GCC diagnostic ignored "-Wcast-function-type" |
|
|
|
|
|
# endif |
|
|
const PFN_GetProcessDpiAwareness GetProcessDpiAwareness |
|
|
const PFN_GetProcessDpiAwareness GetProcessDpiAwareness |
|
|
= (PFN_GetProcessDpiAwareness)GetProcAddress(Shcore, "GetProcessDpiAwareness"); |
|
|
= (PFN_GetProcessDpiAwareness)GetProcAddress(Shcore, "GetProcessDpiAwareness"); |
|
|
const PFN_GetScaleFactorForMonitor GetScaleFactorForMonitor |
|
|
const PFN_GetScaleFactorForMonitor GetScaleFactorForMonitor |
|
|
= (PFN_GetScaleFactorForMonitor)GetProcAddress(Shcore, "GetScaleFactorForMonitor"); |
|
|
= (PFN_GetScaleFactorForMonitor)GetProcAddress(Shcore, "GetScaleFactorForMonitor"); |
|
|
|
|
|
# if defined(__GNUC__) && (__GNUC__ >= 9) |
|
|
|
|
|
# pragma GCC diagnostic pop |
|
|
|
|
|
# endif |
|
|
|
|
|
|
|
|
DWORD dpiAware = 0; |
|
|
DWORD dpiAware = 0; |
|
|
if (GetProcessDpiAwareness && GetScaleFactorForMonitor |
|
|
if (GetProcessDpiAwareness && GetScaleFactorForMonitor |
|
@@ -85,9 +88,6 @@ static double getDesktopScaleFactor(const uintptr_t parentWindowHandle) |
|
|
|
|
|
|
|
|
FreeLibrary(Shcore); |
|
|
FreeLibrary(Shcore); |
|
|
} |
|
|
} |
|
|
# if defined(__GNUC__) && (__GNUC__ >= 9) |
|
|
|
|
|
# pragma GCC diagnostic pop |
|
|
|
|
|
# endif |
|
|
|
|
|
#elif defined(HAVE_X11) |
|
|
#elif defined(HAVE_X11) |
|
|
::Display* const display = XOpenDisplay(nullptr); |
|
|
::Display* const display = XOpenDisplay(nullptr); |
|
|
DISTRHO_SAFE_ASSERT_RETURN(display != nullptr, 1.0); |
|
|
DISTRHO_SAFE_ASSERT_RETURN(display != nullptr, 1.0); |
|
|