8854 |
dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType); |
dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType); |
8855 |
#ifdef MAC_OSX |
#ifdef MAC_OSX |
8856 |
/* HasDepth returns true if it is possible to have a 32 bit display, |
/* HasDepth returns true if it is possible to have a 32 bit display, |
8857 |
but this may not be what is actually used. Mac OSX can do better. */ |
but this may not be what is actually used. Mac OSX can do better. |
8858 |
dpyinfo->n_planes = CGDisplayBitsPerPixel (CGMainDisplayID ()); |
CGMainDisplayID is only available on OSX 10.2 and higher, but the |
8859 |
|
header for CGGetActiveDisplayList says that the first display returned |
8860 |
|
is the active one, so we use that. */ |
8861 |
|
{ |
8862 |
|
CGDirectDisplayID disp_id[1]; |
8863 |
|
CGDisplayCount disp_count; |
8864 |
|
CGDisplayErr error_code; |
8865 |
|
|
8866 |
|
error_code = CGGetActiveDisplayList (1, disp_id, &disp_count); |
8867 |
|
if (error_code != 0) |
8868 |
|
error ("No display found, CGGetActiveDisplayList error %d", error_code); |
8869 |
|
|
8870 |
|
dpyinfo->n_planes = CGDisplayBitsPerPixel (disp_id[0]); |
8871 |
|
} |
8872 |
#else |
#else |
8873 |
for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1) |
for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1) |
8874 |
if (HasDepth (main_device_handle, dpyinfo->n_planes, |
if (HasDepth (main_device_handle, dpyinfo->n_planes, |