VST3: Fix DPI scaling issues caused by JUCE 8.0.13 DPI changes#1664
Open
emezeske wants to merge 1 commit into
Open
VST3: Fix DPI scaling issues caused by JUCE 8.0.13 DPI changes#1664emezeske wants to merge 1 commit into
emezeske wants to merge 1 commit into
Conversation
… DPI A per-monitor-DPI-aware plug-in window is already scaled by the OS, so a setContentScaleFactor at or below the window's own DPI scale carries no new information. Applying it as a platform-scale override double-scales the editor when the factor matches the DPI, or shrinks it below the OS scale when the factor is smaller (some hosts send 1.0, or a no-op value before the window has a valid DPI). Only honour a content scale that exceeds the window's own DPI scaling, which is the only case that represents extra scaling the host wants.
Collaborator
|
This pull request has been mentioned on The JUCE Forum. There might be relevant details there: https://forum.juce.com/t/windows-dpi-scaling-broken-in-juce-8-0-13-for-some-daws-renoise/68923/1 |
Author
|
I have manually tested this change in recent versions of the following DAWs: Ableton (with auto-scale both on and off) |
Collaborator
|
This pull request has been mentioned on The JUCE Forum. There might be relevant details there: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix double-scaled plug-in editors on Windows in hosts that send a redundant content scale
The problem
On a high-DPI Windows display the plug-in UI has to be drawn bigger (e.g. 1.25x at 125%). There are two independent ways a plug-in can be told to do that:
IPlugViewContentScaleSupport::setContentScaleFactor(...).Some hosts do both at once for the same factor: the window is DPI-aware and the host also sends a content scale equal to the monitor's DPI. When that happens, if the desktop scaling is e.g. 1.25 JUCE applies the 1.25 twice and the editor renders at ~1.56x.
I observed this in Renoise, where the plugin window is too large and scaled up too much.
Why it works in most hosts but breaks in Renoise
Most hosts pick one mechanism: per-monitor-aware hosts (Reaper, Cubase, etc.) rely on the OS and send no content scale (or 1.0). Renoise (and Tracktion Waveform) are DPI-aware and call
setContentScaleFactorwith a factor equal to the monitor DPI, so the same scale is counted twice. It is not a Renoise-specific bug; it is any host that supplies a content scale a DPI-aware window does not need.Why old JUCE worked and 8.0.13 broke it
This regressed in
fcf1971122("Plugin Client: Change scaling mechanism on Linux/Windows plugins"), which changed how the host content scale is applied:AffineTransformon the editor, independent of the window's OS/peer DPI scaling. The two lived in separate channels and did not stack, so a redundant host scale was harmless.ComponentPeer::setCustomPlatformScaleFactor), andconvertToHostBoundsnow multiplies bydesktopScale * platformScale. The host scale and the window's own DPI scaling now occupy the same channel, so a host scale that equals the DPI gets multiplied in on top of it, leading to double-scaling.The fix
In
JuceVST3Editor::setContentScaleFactor, ignore any content scale that is at or below the window's own DPI scale (getScaleFactorForWindow). The OS already applies that much to a DPI-aware window, so such a factor carries no new information; only a factor that exceeds the window's DPI represents extra scaling the host actually wants.This is correct in every case:
getScaleFactorForWindowreturns 1.0, so a real host scale (> 1.0) is never mistaken for redundant and is still applied.It restores the pre-8.0.13 result (a single DPI scaling) without reverting the new mechanism, and is a no-op for any host that was not already sending a redundant content scale.