AAX: Fix editor size on Windows when DPI scaling moves off the master scale#1679
Open
emezeske wants to merge 1 commit into
Open
AAX: Fix editor size on Windows when DPI scaling moves off the master scale#1679emezeske wants to merge 1 commit into
emezeske wants to merge 1 commit into
Conversation
… scale convertToHostBounds scaled the editor's logical size by the global (master) scale alone. Since Desktop::getDefaultMasterScale() returns 1.0 for any DPI-aware process, the DPI factor now lives on the window's platform scale instead, so the host receives logical-sized bounds and clips the physical-resolution editor (e.g. Pro Tools above 100% Windows scaling). Multiply by both the global scale and the peer's platform scale so the full logical-to-physical factor is applied regardless of which term carries it.
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.
Summary
On Windows, the AAX wrapper reports the editor size to the host in the wrong units when the DPI factor is carried by the window's platform scale rather than the desktop master scale. The host receives logical-sized bounds and clips the physical-resolution editor. This is reproducible in Pro Tools at any Windows display scale above 100%: the plugin UI overflows its window and is clipped.
Regression
This is a regression introduced by 8bbe48c ("Windows: Use 1.0 as the master scale if DPI awareness is available"). That commit changed
Desktop::getDefaultMasterScale()to return1.0whenever DPI awareness is available:double Desktop::getDefaultMasterScale() { - if (isPerMonitorDPIAwareProcess()) + if (setDPIAwareness()) return 1.0; return getGlobalDPI() / USER_DEFAULT_SCREEN_DPI; }Previously only per-monitor-aware processes got a master scale of
1.0; a system-DPI-aware process (which is how Pro Tools runs) gotgetGlobalDPI() / 96(e.g.1.25), and the DPI factor therefore lived on the master scale. After 8bbe48c the master scale for those processes is1.0and the DPI factor lives on the window's platform scale (ComponentPeer::getPlatformScaleFactor()) instead. The peer-based paths (VST3, mouse/window positioning) were updated to match, but the AAX host-bounds conversion still reads only the master scale, so it silently became a no-op for system-DPI-aware hosts and started reporting logical bounds as physical.Root cause
ContentWrapperComponent::convertToHostBoundsscales the editor's logical size into the host's physical pixels by multiplying bygetGlobalScaleFactor()(the desktop master scale) only:auto desktopScale = Desktop::getInstance().getGlobalScaleFactor();Pro Tools runs system-DPI-aware, so after 8bbe48c its master scale is
1.0and its platform scale is the monitor DPI (e.g.1.25). With the master scale alone,convertToHostBoundsreports logical bounds as physical, so the host sizes the view too small while the editor still paints at physical resolution - hence the overflow and clipping.Fix
Multiply by both the global (master) scale and the window's platform scale, so the full logical-to-physical factor is applied regardless of which term carries the DPI factor. The product is invariant to where 8bbe48c leaves it: pre-8bbe48c1 the master scale held the DPI factor and the platform scale was
1.0; post-8bbe48c1 the split is reversed. Either way the product is the true logical-to-physical scale, so this restores the pre-regression sizing without depending on which term the DPI factor is stored in.Testing