]> git.eshelyaron.com Git - emacs.git/commitdiff
* macterm.c (mac_initialize_display_info): Use CGGetActiveDisplayList
authorJan Djärv <jan.h.d@swipnet.se>
Mon, 5 Jul 2004 07:01:02 +0000 (07:01 +0000)
committerJan Djärv <jan.h.d@swipnet.se>
Mon, 5 Jul 2004 07:01:02 +0000 (07:01 +0000)
instead of CGMainDisplayID (only in OSX 10.2 and later).

src/ChangeLog
src/macterm.c

index 8d0d1c1760978f8b803b46f3771d922b2c2a21f0..3e24370d724db9c2c7a17b52370dcb742701b0d9 100644 (file)
@@ -1,3 +1,8 @@
+2004-07-05  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
+
+       * macterm.c (mac_initialize_display_info): Use CGGetActiveDisplayList
+       instead of CGMainDisplayID (only in OSX 10.2 and later).
+
 2004-07-04  John Paul Wallington  <jpw@gnu.org>
 
        * fileio.c (read_file_name_completion_ignore_case): New variable.
index a5146dc8ec4db6ff6717a24b0a35f37d85aca956..7d9c2bf7105c1e844693addb55ce9dc87dd86f91 100644 (file)
@@ -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,