changeset 68038:d6e0fb5cc470

(Fx_server_version): Use gestaltSystemVersionMajor, gestaltSystemVersionMinor, and gestaltSystemVersionBugFix on Mac OS X 10.4 and later.
author YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
date Thu, 05 Jan 2006 08:14:33 +0000
parents e70c943e7ff3
children c83d0a0de875
files src/macfns.c
diffstat 1 files changed, 22 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/macfns.c	Thu Jan 05 08:14:12 2006 +0000
+++ b/src/macfns.c	Thu Jan 05 08:14:33 2006 +0000
@@ -2880,24 +2880,37 @@
      (display)
      Lisp_Object display;
 {
-  int mac_major_version;
-  SInt32 response;
+  UInt32 response, major, minor, bugfix;
   OSErr err;
 
   BLOCK_INPUT;
   err = Gestalt (gestaltSystemVersion, &response);
+  if (err == noErr)
+    if (response >= 0x00001040)
+      {
+	err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */
+	if (err == noErr)
+	  err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */
+	if (err == noErr)
+	  err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */
+      }
+    else
+      {
+	bugfix = response & 0xf;
+	response >>= 4;
+	minor = response & 0xf;
+	response >>= 4;
+	/* convert BCD to int */
+	major = response - (response >> 4) * 6;
+      }
   UNBLOCK_INPUT;
 
   if (err != noErr)
     error ("Cannot get Mac OS version");
 
-  mac_major_version = (response >> 8) & 0xff;
-  /* convert BCD to int */
-  mac_major_version -= (mac_major_version >> 4) * 6;
-
-  return Fcons (make_number (mac_major_version),
-		Fcons (make_number ((response >> 4) & 0xf),
-		       Fcons (make_number (response & 0xf),
+  return Fcons (make_number (major),
+		Fcons (make_number (minor),
+		       Fcons (make_number (bugfix),
 			      Qnil)));
 }