I don't think the LinuxComponentPeer class checks the constraints. Might be a to-do-list item for us, unless you want to have a look at how the other OSes handle that and have a go at implementing it yourself.. Don't think we'll have time to look at this for at least a month or so.
Thanks for bringing this to our attention. The X11 API is such that we can’t validate custom constrainers in quite the same way as on macOS/Windows. However, we can at least honour the requested min/max width/height:
Hopefully this patch implements the functionality you need. Please let us know if you encounter any problems with this change.
I don’t want to create another thread, so let me mention here that setResizeLimits behaves differently in combination with the maximise button on different platforms and for the native and JUCE title bars. I tested it with a simple GUI project with the line setResizeLimits (400, 200, 800, 600) added in the MainWindow constructor.
Windows 10:
native title bar: the window appears in the top left with 800x600 size, immediately returns to its previous size when dragged
JUCE title bar: full screen
MacOS (BigSur, M1):
native title bar: full screen
JUCE title bar: the window appears in the top left 800x600 size, cannot be dragged at all
Linux (Ubuntu 18.04):
native title bar: full screen
JUCE title bar: full screen
Shouldn’t it either scale to full screen in all cases or just to its resize limits?
Thanks, I think you’re right to point out the inconsistencies in the existing behaviour. The old behaviour is quite confusing and buggy. I’ve tried to improve things in the following series of commits:
The goal is that the behaviour should be almost identical on Linux and Windows, where the windowing models are quite similar. The fullscreen button will always set the window to fullscreen, regardless of the resize limits. If you don’t want to allow the window to enter full-screen mode, disable the full-screen button when creating a DocumentWindow.
On macOS, the situation is a bit more nuanced because there are a couple of different ‘full-screen’ behaviours: zooming, in which the window resizes to its maximum/best size without entering full-screen mode; and true full-screen, in which the window moves to its own dedicated desktop. The full-screen button on the native titlebar should work as expected (enter fullscreen by default, or zoom to the smaller of the window’s max size and the monitor’s size if option-clicked). For the non-native titlebar, only the zooming behaviour is implemented.
Hopefully that is all a bit more intuitive. Please let me know if you have any questions/concerns, or if you encounter any problems after updating to the newest version of JUCE on the develop branch.
Mhh somehow I have a bug: I use setResizeLimits on ubuntu and it works. But if resize the window over a several times to the limit / over the limit, somehow at some point (sometimes the 6th time, sometimes the 8th time etc) the window behaves like there is no resize limit and my app looks bad.
Could there be still something broken on linux?