I have a native window (macOS) showing a video in the content component and I want it to keep the original aspect ratio of the video when being resized.
I tried a solution I found here in the forum and it works per se:
double ratio = resolution.width/resolution.height;
_miniPlayerWindow->setResizeLimits(300, 300/ratio, 1500, 1500/ratio);
_miniPlayerWindow->getConstrainer()->setFixedAspectRatio(ratio);
_miniPlayerWindow->setSize(500,500/ratio);
However, this doesn’t take the window title bar into account so I’m getting borders on the left and right as the aspect ratio is only correct for the content, not the content + the title bar. It looks like there’s no way to query that. I tried DocumentWindow::getTitleBarHeight() and it returns 0 for native windows.
Is there a quick and easy approach to this?
I tried setting a fixed size for the title bar but it looks like I can’t get the right value.
Is there a way to attach a constrainer to the content component and make the window use that when resizing?