This article is from the Mac Programming FAQ, by Jon Watte email@example.com with numerous contributions by others.
My question to you is: What screen? Many macs have more than one
screen attached. You can use GetDeviceList and walk the devices to find
the screen you're looking for (use TestDeviceAttribute to see whether
it's a screen) or you can call GetMaxDevice() to find the deepest device
your window intersects.
Once you have the device handle, finding the depth is just a
matter of looking at the gdPMap pixMapHandle, and dereference it
to the pmSize field. Done.