1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Fix auxiliary desktop windows scaling and centring when Desktop::globalScaleFactor != 1.0

This commit is contained in:
ed 2021-09-23 16:39:11 +01:00
parent 46a4dc95a1
commit 8d75a7a400
3 changed files with 5 additions and 3 deletions

View file

@ -499,7 +499,7 @@ protected:
/** @internal */
int getDesktopWindowStyleFlags() const override;
/** @internal */
float getDesktopScaleFactor() const override { return desktopScale; }
float getDesktopScaleFactor() const override { return desktopScale * Desktop::getInstance().getGlobalScaleFactor(); }
private:
//==============================================================================

View file

@ -262,7 +262,7 @@ protected:
/** @internal */
bool keyPressed (const KeyPress&) override;
/** @internal */
float getDesktopScaleFactor() const override { return desktopScale; }
float getDesktopScaleFactor() const override { return desktopScale * Desktop::getInstance().getGlobalScaleFactor(); }
private:
std::unique_ptr<AccessibilityHandler> createAccessibilityHandler() override;

View file

@ -298,7 +298,9 @@ void TopLevelWindow::centreAroundComponent (Component* c, const int width, const
}
else
{
auto targetCentre = c->localPointToGlobal (c->getLocalBounds().getCentre()) / getDesktopScaleFactor();
const auto scale = getDesktopScaleFactor() / Desktop::getInstance().getGlobalScaleFactor();
auto targetCentre = c->localPointToGlobal (c->getLocalBounds().getCentre()) / scale;
auto parentArea = c->getParentMonitorArea();
if (auto* parent = getParentComponent())