Ok, i think i found where it's happening:
the call stack looks as follows:
MainContentComponent::displaySeparateWindows()
with execution paused on the line:
pianoRollWindow->setBounds(desktopW /2, desktopH/2, 1000, prwheight);
ResizableWindow::setResizeLimits( 640, 180, 1786, 180 ) comes next in the callstack, with the line
defaultConstainer.setSizeLimits( 640, 180, 1786, 180 )
the next line is setBoundsConstrained( getBounds() );
This line leads to the next item in the callstack:
ResizableWindow::setBoundsConstrained( const Rectangle<int>& newBounds)
When I mouse over newBounds, the values for the rect are:
{pos={x=0,y=31} w=624 h = 141 }
So, the call to getBounds() is returning the 141 for some reason, instead of returning 180.
Let's take a look at what defaultConstrainer.setSizeLimits() does:
a bunch of calls to jmax() set everything in the default constrainer to what is expected..
getBounds returned (0,0,128,128), then we do constrainer->setBoundsForComponent()
somehow, we hit ComponentPeer* Component::getPeer(), where flags.hasHeavyweightPeerFlag is true.
Eventually we end up on BorderSize<int> getFrameSize(), which returns a window border of (31, 8, 8, 8 )
next we arrive in ComponentBoundsConstrainer::setBoundsForComponent() on lines 130 in juce_ComponentBoundsConstrainer
border.addTo (bounds);
checkBounds (bounds,
border.addedTo (component->getBounds()), limits,
isStretchingTop, isStretchingLeft,
isStretchingBottom, isStretchingRight);
border.subtractFrom (bounds);
if I place watches on the variables 'border', 'bounds', and 'limits', and I step thru each line starting with border.addTo( bounds );
return Rectangle<ValueType> (original.getX() - left, //0 - 8 = -8
original.getY() - top, //0 - 31 = -31
original.getWidth() + (left + right), //128 + 8 + 8=144
original.getHeight() + (top + bottom)); //128 + 31 + 8=167
we get a rectangle 'bounds' = { x=-8, y=-31, w=144, h=167 }
checkBounds is called with the following params:
ComponentBoundsConstrainer::checkBounds( {pos={x=-8 y=-31 } w=144 h=167 }, //bounds
{pos={x=-8 y=-31 } w=144 h=167 }, //border.addedTo(component->getBounds())
{pos={x=0 y=0} w=1786 h=882 }, //limits
false, false, false, false );
line 178 changes bounds.width from 144 to 640
line 183 changes bounds.height from 167 to 180
line 197 changes bounds.Y from -31 to 0
border.subtractedFrom(bounds) changes bounds from { x=-8, y=0, w=640, h=180 } to { x=0, y=31, w=624, h=141 }
so now we call applyBoundsToComponent(), which calls component->setBounds( bounds ) with this height of 141 instead of 180.
So, somehow, 180 was converted to 141 by way of the window border being {31, 8, 8, 8 }. 180 - (31 + 8) = 141.
With all that said, the solution seems to be to change prwHeight to be:
int prwHeight = pianoRollWindow->getFixedHeight();
#if JUCE_WINDOWS
prwHeight += pianoRollWindow->getBorderThickness().getTopAndBottom();
#endif
Unfortunately, getTopAndBottom() returns {0, 0, 0, 0}. When i click on my pianoRollWindow to resize it, it stopped shrinking vertically, but as soon as I try to resize it (increase the width, cuz it's supposed to have a fixed height), it's like the component scales itself inside the Window, so it'll still be 180 pixels high, in a space that is only 180-31-8 pixels tall. it's really strange.