Browse Source

Fix initial scale factor value for wasm builds

Signed-off-by: falkTX <falktx@falktx.com>
pull/479/head
falkTX 5 months ago
parent
commit
4513981221
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      distrho/src/DistrhoUI.cpp

+ 6
- 2
distrho/src/DistrhoUI.cpp View File

@@ -26,7 +26,9 @@
# include <stdint.h> # include <stdint.h>
#endif #endif


#if defined(DISTRHO_OS_WINDOWS)
#if defined(DISTRHO_OS_WASM)
# include <emscripten/emscripten.h>
#elif defined(DISTRHO_OS_WINDOWS)
# include <winsock2.h> # include <winsock2.h>
# include <windows.h> # include <windows.h>
#elif defined(HAVE_X11) #elif defined(HAVE_X11)
@@ -94,7 +96,9 @@ static double getDesktopScaleFactor(const uintptr_t parentWindowHandle)
if (const char* const scale = getenv("DPF_SCALE_FACTOR")) if (const char* const scale = getenv("DPF_SCALE_FACTOR"))
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_WASM)
return emscripten_get_device_pixel_ratio();
#elif defined(DISTRHO_OS_WINDOWS)
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*);


Loading…
Cancel
Save