How to place window to avoid the dock?

When testing my app with a low screen resolution, I’m finding that giving my window a 0 initial x position can place it under the dock, if the user has it placed on the left. Is there a way to find the position and size of the dock so that my window won’t appear under it?

The mac-specific call to do this would involve GetAvailableWindowPositioningBounds(), which would also help to make sure windows weren’t placed under the title bar at the top, which changes height based on resolution.

Yes, you can use the Desktop class’s monitor sizes - that has an option to get the area outside the dock.

Ah, I didn’t realize that centreWithSize() was eventually getting the work area of the screen’s size. Nice!

What I’m seeing is that as the monitor resolution is dropped, my window is appearing under the menu bar at the top of the screen, although there’s still room at the bottom of the screen (my dock is on the left). You can duplicate this behavior with the juce demo if you drop the screen resolution to 1024x640 (at least it does on my 20" monitor at that resolution) Similarly, at lower resolution, windows are appearing off the left side of the screen.

This might simply be a bug in calculating the clipped work area of the monitor, or it might be an Apple bug, I’m not sure.