Ideal way to handle maximize on dual screen systems


By default JUCE is maximising my window to the primary display, regardless of which display the window was actually located in when the maximise button was clicked.

I’m not seeing anything obvious for changing the bahaviour of maximise directly, so is the proper solution to use a ComponentsBoundsConstrainer to define the second display? This doesn’t seem right as it would stop the user from dragging the window back onto the primary display.

What am I missing?


it should be working on win32,
you are probably using the linux code, in juce_linux_windowing.cpp:931

if (fullScreen != shouldBeFullScreen) { if (shouldBeFullScreen) r = Desktop::getInstance().getMainMonitorArea();

should probably be :

if (fullScreen != shouldBeFullScreen) { if (shouldBeFullScreen) r = getComponent().getParentMonitorArea();


Actually I’m current on OSX, but I’ll take a look at the platform stuff for that too.



OK, your fix is needed for OSX also.

For reference: line 1035 in should be fixed as above.

Jules, is there any reason why things aren’t this way currently? Is there some gotcha hiding in here that I should be aware of?


TBH I just don’t think I ever made it smart enough to pick the right monitor…