I just updated to latest develop and noticed that our modal dialogs are now larger than they are supposed to be. This can be reproduced with this code:
juce::DialogWindow::LaunchOptions launchOptions;
launchOptions.useNativeTitleBar = true;
launchOptions.content.setOwned(new WindowComp());
auto wnd = std::unique_ptr<juce::DialogWindow>(launchOptions.create());
wnd->setTitleBarButtonsRequired(0, true);
return wnd->runModalLoop();
WindowComp sets its own size in the constructor and the resulting window’s content is 27 pixels (the title bar height) higher than it’s supposed to be.
The reason seems to be that the constructor of DefaultDialogWindow (which launchOptions.create() calls) will change the size including the title bar height before setUsingNativeTitleBar is set.
Moving the setUsingNativeTitleBar call to the top of the function fixes the issue.
DefaultDialogWindow (LaunchOptions& options)
: DialogWindow (options.dialogTitle, options.dialogBackgroundColour,
options.escapeKeyTriggersCloseButton, true,
options.componentToCentreAround != nullptr
? Component::getApproximateScaleFactorForComponent (options.componentToCentreAround)
: 1.0f)
{
setUsingNativeTitleBar (options.useNativeTitleBar);
if (options.content.willDeleteObject())
setContentOwned (options.content.release(), true);
else
setContentNonOwned (options.content.release(), true);
centreAroundComponent (options.componentToCentreAround, getWidth(), getHeight());
setResizable (options.resizable, options.useBottomRightCornerResizer);
setAlwaysOnTop (WindowUtils::areThereAnyAlwaysOnTopWindows());
}
