DPI Scaling not working on Webview GUI

Heyo,

Been trying to create a webview GUI in Juce. Unfortunately, when I compile to an .exe, the GUI appears very tiny on my 4K monitor, my monitor is using DPI Scaling at 225%.

When viewing the HTML document I made for the GUI in Chrome or Edge, it performs as it should.

I’m having a heck of time finding the proper implementation of how JUCE uses DPI scaling, I did manage to find this but either I did it wrong or it wasn’t what I needed:

JUCE_DISABLE_WIN32_DPI_AWARENESS

Any ideas?

1 Like

Please could you provide some more info:

  • What kind of project are you testing, a plugin or a standalone? You mentioned building an .exe, so I assume it’s a standalone app.
  • What version of Windows are you using for testing?
  • What version of JUCE are you using? Have you tried with the develop branch?
1 Like

Sure thing:

  1. Currently testing as a standalone with the idea of migrating to VST, AU, and MacOS app, and Linux
  2. Currently on Windows 11 24H2
  3. Juce v8.08.

I decided to test out and compile the example WebBrowserDemo within Juce to get an idea of a working example. After compiling with Visual Studio 2022, the .exe opened but the Juce webpage loaded with a staggering amount of script errors.

I ended up finding an open source Github page of some lovely people who created a cross-platform webview library written in C++.

GitHub - MichaelKim/webview: Cross-platform header-only webview library for C++

I compiled with this and worked beautifully first shot.

Have you tried using

JUCE_WIN_PER_MONITOR_DPI_AWARE=1

There is no such thing as JUCE_DISABLE_WIN32_DPI_AWARENESS

It sounds like this is using the legacy webview engine. I recommend trying out the newer “webview2” engine to see whether that helps, both for the demo and for your project. There’s some info on setting things up here:

You’ll need the webview2 package installed: NuGet Gallery | Microsoft.Web.WebView2 1.0.3405.78

To install the package, open a PowerShell and run the following:

Register-PackageSource -provider NuGet -name nugetRepository -location https://www.nuget.org/api/v2
Install-Package Microsoft.Web.WebView2 -Scope CurrentUser -RequiredVersion 1.0.1901.177 -Source nugetRepository
1 Like

otristan

Have you tried using

JUCE_WIN_PER_MONITOR_DPI_AWARE=1

There is no such thing as JUCE_DISABLE_WIN32_DPI_AWARENESS

I thought I had but will try again.

This is the default, so it should already be set unless it’s been explicitly disabled. Leaving this enabled is definitely recommended; rendering is unlikely to look good on high-dpi displays when this is turned off.

1 Like

**reuk **
It sounds like this is using the legacy webview engine. I recommend trying out the newer “webview2” engine to see whether that helps, both for the demo and for your project. There’s some info on setting things up here:

Awesome, will try this out later tonight, thanks.