Get size of DAW plugin window

Hi there, mostly a Pro Tools specific question here… is there any way to get the size of the plugin window the DAW is putting the plugin editor component in?

For example, I make a resizable plugin editor which starts off small, say 50px x 50px. Then, I call a function to check the size of the window the host has given the plugin. In Pro Tools it would be quite wide, but in Reaper it would be narrower. Then, I can resize the plugin to fit the window. Does such a function exist?

I don’t know if there’s a way to get that from the DAW, but I am interested to find out.

It sounds like what you’re looking for is the minimum width & height that the host will draw for its plugin windows?

ComponentPeer::getFrameSize() or ComponentPeer::getFrameSizeIfPresent() may be what you are looking for.
I just remember they were mentioned on the forum when talking about obtaining the size of a native window surrounding a JUCE component, I don’t know if that’s expected to work for plug-in windows

Yes, I am mostly looking to set a sensible minimum size (for a resizable plugin) that suits the DAW. I didn’t think the DAW would share a minimum size directly, hence my ‘starting small’ idea. Thanks @yfede! That looks promising, I’ll test it out and report back!

This was a good idea to try, but so far getFrameSize only reports of a border with 0 values all around.

I checked this with an AudioUnit in Logic, and a VST3 in Reaper. Even though both DAWs add extra space on the top and/or bottom for their own plugin window controls, and Logic enforces a minimum width as well, all I’m seeing is zero-size borders reported.

I also tried looking at the values returned by ComponentPeer::getBounds(), and comparing those to what getLocalBounds() returns (calling these from the Editor resized method). However, they return the same values.

Maybe something could be done with ComponentPeer::getNativeHandle. That would make things more complex though.

Yeah, I found the same a @refusesoftware. Looks like the only way is to hard-code some a DAW to minimum sizes mapping… :frowning: Thanks for your help, all!