Thanks - how about this as a new version (I’ve only got one monitor on my mac, so if anyone’s got a multiple monitor setup, I’d be keen to know if it works there too!)
[code]void juce_updateMultiMonitorInfo (Array & monitorCoords, const bool clipToWorkArea) throw()
{
int mainMonitorIndex = 0;
CGDirectDisplayID mainDisplayID = CGMainDisplayID();
CGDisplayCount count = 0;
CGDirectDisplayID disps [8];
if (CGGetActiveDisplayList (numElementsInArray (disps), disps, &count) == noErr)
{
for (int i = 0; i < count; ++i)
{
if (mainDisplayID == disps[i])
mainMonitorIndex = monitorCoords.size();
GDHandle hGDevice;
if (clipToWorkArea
&& DMGetGDeviceByDisplayID ((DisplayIDType) disps[i], &hGDevice, false) == noErr)
{
Rect rect;
GetAvailableWindowPositioningBounds (hGDevice, &rect);
monitorCoords.add (Rectangle (rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top));
}
else
{
const CGRect r (CGDisplayBounds (disps[i]));
monitorCoords.add (Rectangle (r.origin.x,
r.origin.y,
r.size.width,
r.size.height));
}
}
}
// make sure the first in the list is the main monitor
if (mainMonitorIndex > 0)
monitorCoords.swap (mainMonitorIndex, 0);
jassert (monitorCoords.size() > 0);
//xxx need to register for display change callbacks
}[/code]