changeset 56146:5e784b2ea638

* macfns.c (Fx_display_color_cells): Do not limit return value to 256. * macterm.c (mac_initialize_display_info): Initialize n_planes correctly on Mac OSX.
author Jan Djärv <jan.h.d@swipnet.se>
date Thu, 17 Jun 2004 13:04:25 +0000
parents 80340a31718d
children 6b858fb89033
files src/ChangeLog src/macfns.c src/macterm.c
diffstat 3 files changed, 15 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Jun 17 08:33:27 2004 +0000
+++ b/src/ChangeLog	Thu Jun 17 13:04:25 2004 +0000
@@ -1,3 +1,10 @@
+2004-06-17  Jan Dj,Ad(Brv  <jan.h.d@swipnet.se>
+
+	* macfns.c (Fx_display_color_cells): Do not limit return value to 256.
+
+	* macterm.c (mac_initialize_display_info): Initialize n_planes correctly
+	on Mac OSX.
+
 2004-06-16  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* buffer.c (syms_of_buffer): Clarify `fill-column' docstring.
--- a/src/macfns.c	Thu Jun 17 08:33:27 2004 +0000
+++ b/src/macfns.c	Thu Jun 17 13:04:25 2004 +0000
@@ -2939,8 +2939,8 @@
 {
   struct mac_display_info *dpyinfo = check_x_display_info (display);
 
-  /* MAC_TODO: check whether this is right */
-  return make_number (dpyinfo->n_planes >= 8 ? 256 : 1 << dpyinfo->n_planes - 1);
+  /* We force 24+ bit depths to 24-bit to prevent an overflow.  */
+  return make_number (1 << min (dpyinfo->n_planes, 24));
 }
 
 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
--- a/src/macterm.c	Thu Jun 17 08:33:27 2004 +0000
+++ b/src/macterm.c	Thu Jun 17 13:04:25 2004 +0000
@@ -8840,10 +8840,16 @@
   dpyinfo->resx = 75.0;
   dpyinfo->resy = 75.0;
   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 ());
+#else
   for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1)
     if (HasDepth (main_device_handle, dpyinfo->n_planes,
 		  gdDevType, dpyinfo->color_p))
       break;
+#endif
   dpyinfo->height = (**main_device_handle).gdRect.bottom;
   dpyinfo->width = (**main_device_handle).gdRect.right;
   dpyinfo->grabbed = 0;