DocumentWindow: title bar not visible

I’ve got a case as follows on Windows:

  • I create a new DocumentWindow and add it to Desktop
  • I call:

documentWindow->setBounds (Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea);

The widow fills the screen, but no title bar is visible.

  • When I call:

documentWindow->setBounds (Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea.reduced(50);

then the title bar is visible.

This is with setUsingNativeTitleBar (true)

On Mac it works correctly. Basically, I want to have my document window open with the title bar already visible no matter what size of the window is. It looks like getLocalBounds() called on DocumentWindow sometimes includes area of the title bar, so the whole window area is repainted / covered by a content component. Or maybe I am missing something?

Have you looked at

https://docs.juce.com/master/classResizableWindow.html#a11960e524b3e9046b92d4f9f6e0dac6c

https://docs.juce.com/master/classResizableWindow.html#a44f7200f6fe97b06be121ce5d439058d

or

https://docs.juce.com/master/classDocumentWindow.html#a12c38c5653adf804886d67ec22aee4e0

Off the top of my head I can’t remember if those work with native windows, but worth a shot to see if anything works?

Thanks, yes, I played with these settings, but it even if I remove my content component and create an empty window with size = userArea, then the title bar is not shown.

But if I write
documentWindow->setBounds (Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea.withTrimmedTop (1));

or even:

documentWindow->setBounds (Desktop::getInstance().getDisplays().getPrimaryDisplay()->userArea.expanded (1));

then the title bar is visible. Trimming width, height etc. does not help too, so the conclusion is that the title bar is not drawn (or rather is painted over with a background colour / content component) always when the document window position is (0, 0).

Edit. I think the above statements are not exactly right. When I run this simple code:

            DocumentWindow* dw = new DocumentWindow ("TEST", Colours::white, 7, true);
            dw->setUsingNativeTitleBar (true);
            dw->setBounds (0, 15, 600, 400);
            dw->setVisible (true);

The window appears but with the title bar cut, so Desktop’s y = 0 seems not to be zero? I’m a little bit lost here.