Disable DPI Awareness in a Plugin

I was wondering if it is possible to supress DPI awareness in a plugin entirely, across Win / Mac / Linux.

I provide plenty of scaling options which the user can choose from, which are enough to support monitors for the next decades.

The main problem I’m trying to work around is that bitmaps will be automatically upscaled to fit the larger UI, which makes them look blurry.

I found this topic here

It mentions a ScopedDPIAwarenessDisabler. I cannot find this in the documentation, so my best guess it that it was deprecated / removed.

Any input welcome!

ScopedDPIAwarenessDisabler doesn’t seem to be deprecated, but it’s Windows-specific. This is a pretty confusing area, but I think you don’t need anything like that in a plugin. At least on Windows, DPI awareness is per thread, so you can’t really disable it on behalf of the host. Plugin DPI awareness is implemented in AudioProcessorEditor::setScaleFactor, so you can disable it by overriding setScaleFactor to do nothing.

1 Like

Thank you for your answer, this is definitely the way to go. There are a few caveats I want to mention:

  1. This does not work on the standalone build of a plugin (ok for my case).

  2. When dragging the window between screens of different DPI settings, the editor window seems to magically gain or loose 10x32 pixels depending on the direction. The components will hence be cropped or an empty space around them will occur. I tried to call setSize() in the setScaleFactor() function as well to override the new size, which doesn’t help. It seems the window enclosing the PluginEditor is being shrunk.

All this was tested on Windows / Bitwig, I will investigate further and post my results here.

All implementations of multimonitor dpi awareness on Windows seem to have one problem or another, I guess it’s one of those cases where Microsoft’s docs are not particularly clear. Unfortunately, I don’t have many options to test this, as the only multimonitor dpi aware host I have is Reaper, besides AudioPluginHost, and an empty setScaleFactor seems to work in both. otoh, the base implementation doesn’t quite work in Reaper -the plugin is correctly scaled, but its window is not. With all the little workarounds, it’s hard to say if it’s a Juce bug or a Reaper bug -the same may apply to Bitwig.