From: Jan Djärv Date: Mon, 5 Jul 2004 07:01:02 +0000 (+0000) Subject: * macterm.c (mac_initialize_display_info): Use CGGetActiveDisplayList X-Git-Tag: ttn-vms-21-2-B4~5544 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=2bac9bb1c6432dc52b16970d94f207c6dc500ed5;p=emacs.git * macterm.c (mac_initialize_display_info): Use CGGetActiveDisplayList instead of CGMainDisplayID (only in OSX 10.2 and later). --- diff --git a/src/ChangeLog b/src/ChangeLog index 8d0d1c17609..3e24370d724 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -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 --git a/src/macterm.c b/src/macterm.c index a5146dc8ec4..7d9c2bf7105 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -8854,8 +8854,21 @@ mac_initialize_display_info () 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,