summaryrefslogtreecommitdiff
path: root/src/macterm.c
diff options
context:
space:
mode:
authorJan Djärv <jan.h.d@swipnet.se>2004-07-05 07:01:02 +0000
committerJan Djärv <jan.h.d@swipnet.se>2004-07-05 07:01:02 +0000
commit2bac9bb1c6432dc52b16970d94f207c6dc500ed5 (patch)
treede7027c0b0d5266802777a1d9c1f8ceef432b8b5 /src/macterm.c
parent1f724d55e96643fb770cbb4f9e8f4412098f3ae5 (diff)
downloademacs-2bac9bb1c6432dc52b16970d94f207c6dc500ed5.tar.gz
* macterm.c (mac_initialize_display_info): Use CGGetActiveDisplayList
instead of CGMainDisplayID (only in OSX 10.2 and later).
Diffstat (limited to 'src/macterm.c')
-rw-r--r--src/macterm.c17
1 files changed, 15 insertions, 2 deletions
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,