diff --git a/modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp b/modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp index 18dfe2fcce..f8373c3437 100644 --- a/modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp +++ b/modules/juce_gui_basics/windows/juce_TopLevelWindow.cpp @@ -215,9 +215,8 @@ void TopLevelWindow::centreAroundComponent (Component* c, const int width, const return std::make_pair (globalTargetCentre, c->getParentMonitorArea() / scale); }(); - setBounds (Rectangle (targetCentre.x - width / 2, - targetCentre.y - height / 2, - width, height) + setBounds (Rectangle { width, height } + .withCentre (targetCentre) .constrainedWithin (parentArea.reduced (12, 12))); } }