DocumentWindow::getBorderThickness() wrong for native title


I want my ComponentBoundsConstrainer to exactly limit the content component, not the entire window (which is the current behavior). So I am doing this in my DocumentWindow-derived constructor:

  ComponentBoundsConstrainer* constrainer = getConstrainer();
  BorderSize border = getContentComponentBorder();
  constrainer->setMinimumHeight (constrainer->getMinimumHeight() + border.getTop() + border.getBottom());
  constrainer->setMaximumHeight (addLimit (constrainer->getMaximumHeight(), border.getTop() + border.getBottom()));
  constrainer->setMinimumWidth (constrainer->getMinimumWidth() + border.getLeft() + border.getRight());
  constrainer->setMaximumWidth (addLimit (constrainer->getMaximumWidth(), border.getLeft() + border.getRight()));

This code works for non-native title bars, even with attached menus. But The problem is that getContentComponentBorder() returns zero if it’s using a native title bar. This is why:

const BorderSize DocumentWindow::getBorderThickness()
    return BorderSize ((isFullScreen() || isUsingNativeTitleBar())
                            ? 0 : (resizableBorder != 0 ? 4 : 1));

So there seems to be no way for me to get at the border sizes in a platform-independent way.

What should I do? I really need this feature.


getPeer()->getFrameSize() ?


That worked perfectly.