# HG changeset patch # User Jan Dj¸«£rv # Date 1089010862 0 # Node ID 550df8e670061a8b17c152edf61a020f8d2e6ad2 # Parent 8aa767f7d6055cbea1644ddc768c67905601d8e5 * macterm.c (mac_initialize_display_info): Use CGGetActiveDisplayList instead of CGMainDisplayID (only in OSX 10.2 and later). diff -r 8aa767f7d605 -r 550df8e67006 src/ChangeLog --- a/src/ChangeLog Mon Jul 05 01:58:59 2004 +0000 +++ b/src/ChangeLog Mon Jul 05 07:01:02 2004 +0000 @@ -1,3 +1,8 @@ +2004-07-05 Jan Dj,Ad(Brv + + * macterm.c (mac_initialize_display_info): Use CGGetActiveDisplayList + instead of CGMainDisplayID (only in OSX 10.2 and later). + 2004-07-04 John Paul Wallington * fileio.c (read_file_name_completion_ignore_case): New variable. diff -r 8aa767f7d605 -r 550df8e67006 src/macterm.c --- a/src/macterm.c Mon Jul 05 01:58:59 2004 +0000 +++ b/src/macterm.c Mon Jul 05 07:01:02 2004 +0000 @@ -8854,8 +8854,21 @@ dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType); #ifdef MAC_OSX /* HasDepth returns true if it is possible to have a 32 bit display, - but this may not be what is actually used. Mac OSX can do better. */ - dpyinfo->n_planes = CGDisplayBitsPerPixel (CGMainDisplayID ()); + but this may not be what is actually used. Mac OSX can do better. + CGMainDisplayID is only available on OSX 10.2 and higher, but the + header for CGGetActiveDisplayList says that the first display returned + is the active one, so we use that. */ + { + CGDirectDisplayID disp_id[1]; + CGDisplayCount disp_count; + CGDisplayErr error_code; + + error_code = CGGetActiveDisplayList (1, disp_id, &disp_count); + if (error_code != 0) + error ("No display found, CGGetActiveDisplayList error %d", error_code); + + dpyinfo->n_planes = CGDisplayBitsPerPixel (disp_id[0]); + } #else for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1) if (HasDepth (main_device_handle, dpyinfo->n_planes,