Browse Source

Made the OSX window code handle custom desktop scale factors when constraining window positions

tags/2021-05-28
jules 9 years ago
parent
commit
bf48687544
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 6
- 2
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -999,8 +999,10 @@ public:
{
if (constrainer != nullptr && ! isKioskMode())
{
Rectangle<int> pos (convertToRectInt (flippedScreenRect (r)));
Rectangle<int> original (convertToRectInt (flippedScreenRect ([window frame])));
const float scale = getComponent().getDesktopScaleFactor();
Rectangle<int> pos = ScalingHelpers::unscaledScreenPosToScaled (scale, convertToRectInt (flippedScreenRect (r)));
Rectangle<int> original = ScalingHelpers::unscaledScreenPosToScaled (scale, convertToRectInt (flippedScreenRect ([window frame])));
const Rectangle<int> screenBounds (Desktop::getInstance().getDisplays().getTotalBounds (true));
@@ -1023,6 +1025,8 @@ public:
pos.getX() == original.getX() && pos.getRight() != original.getRight());
}
pos = ScalingHelpers::scaledScreenPosToUnscaled (scale, pos);
r = flippedScreenRect (makeNSRect (pos));
}


Loading…
Cancel
Save