since some time there is a bug in displaying Dialog Windows with juce title bars, at least on Mac.
When the main app window gets resized, the title bar of the Dialog Window opened from that app “jumps” to the bottom of the window, but without moving the close button and the title, leaving the window garbled.
Wenn using a system native title bar this does not happen.
I’ve noticed some weirdness with non-native title bars on macOS lately too. Just curious - does this only happen on specific macOS versions (like Sequoia) or is it across the board? It definitely sounds like a bounds calculation issue when the parent window notifies the child of a resize.
Thanks for reporting this issue. Please could you provide some example code that demonstrates the problem? Do you see this problem in any of the demos provided with JUCE?
When I run the WindowsDemo example and click the button to open some secondary windows, I am then able to resize the main app window by clicking and dragging on the edge of the window with the mouse. The secondary windows are unaffected when I do this, i.e. resizing the main app window doesn’t seem to garble the secondary windows with JUCE titlebars. Thefore, I suspect the issue is triggered by something else in your project, and we’ll need some more information (ideally a small example project) in order to continue investigating.
In the WindowsDemo please go to the class WindowsDemo and put the following lines at the end of the resized() method:
if ( dialogWindow.getComponent() )
dialogWindow->getContentComponent()->setBounds(0, 0, 300, 200);
Then when you run the demo and resize the main window you will see the jump in the dialogWindow and you will not be able to move the window by grabbing it at the title bar. Also the size of the window will increase although the size of the content has not changed by this code.
In my case the title bar jumps visibly to the bottom which might have something to do with how i do things but the error is also reproducible in general as described above.
So, apparently it has nothing to do with resizing the main window but with setting the bounds of the content component of the dialog window instead of setting the size.
Has this ever behaved in the way you’re expecting? I see the same behaviour back to JUCE 6.1.6. Based on the code you provided, I think the current behaviour is what I’d expect to see.
Note that this line is both setting the size of the content component and also changing its position in the window, which is probably not what you want.
The titlebar can’t be grabbed because the content component is now positioned at the top left of the window, over the titlebar, and therefore intercepts all mouse clicks instead of the titlebar.
The size of the window increases because the dialog window borders are added to the content component bounds. The line at the bottom of showDialogWindow() sets the initial window size to be 300x200 including decorations. When you set a size of 300x200 on the content component, the dialog window computes a new size by adding its borders and titlebar to the content component bounds.
Instead of calling setBounds you could try calling setSize on the content component to avoid moving it over the titlebar, or calling setContentComponentSize on the dialog window itself.
Hi @reuk , yes, the behaviour is probably present since long time, i just noticed it. In my case it rarely happens but some usecases in our software trigger this behaviour. I will switch away from setBounds then and use your suggestions, although the behaviour still feels like a bug.