changeset 100802:ded357c75f85

(ns_appkit_version_str): Rename from ns_appkit_version. (ns_appkit_version_int): New function. (x-server-version): Use ns_appkit_version_int and follow 21+ convention of returning 3 integers
author Adrian Robert <Adrian.B.Robert@gmail.com>
date Wed, 31 Dec 2008 14:59:37 +0000
parents da95fec1ae70
children 0186716f4b63
files src/ChangeLog src/nsfns.m
diffstat 2 files changed, 40 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Dec 31 09:58:49 2008 +0000
+++ b/src/ChangeLog	Wed Dec 31 14:59:37 2008 +0000
@@ -1,3 +1,10 @@
+2008-12-31  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+	* nsfns.m (ns_appkit_version_str): Rename from ns_appkit_version.
+	(ns_appkit_version_int): New function.
+	(x-server-version): Use ns_appkit_version_int and follow 21+
+	convention of returning 3 integers.
+
 2008-12-30  Kenichi Handa  <handa@m17n.org>
 
 	* character.h (CHAR_VARIATION_SELECTOR_P): New macro.
--- a/src/nsfns.m	Wed Dec 31 09:58:49 2008 +0000
+++ b/src/nsfns.m	Wed Dec 31 14:59:37 2008 +0000
@@ -952,7 +952,7 @@
 #define Xstr(x) Str(x)
 
 static Lisp_Object
-ns_appkit_version ()
+ns_appkit_version_str ()
 {
   char tmp[80];
 
@@ -967,6 +967,21 @@
 }
 
 
+/* This is for use by x-server-version and collapses all version info we
+   have into a single int.  For a better picture of the implementation
+   running, use ns_appkit_version_str.*/
+static int
+ns_appkit_version_int ()
+{
+#ifdef NS_IMPL_GNUSTEP
+  return GNUSTEP_GUI_MAJOR_VERSION * 100 + GNUSTEP_GNU_MINOR_VERSION;
+#elif defined(NS_IMPL_COCOA)
+  return (int)NSAppKitVersionNumber;
+#endif
+  return 0;
+}
+
+
 static void
 x_icon (struct frame *f, Lisp_Object parms)
 /* --------------------------------------------------------------------------
@@ -1602,14 +1617,26 @@
 
 
 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
-       doc: /* Return the version number of Nextstep display server DISPLAY.
+       doc: /* Return the version numbers of the server of DISPLAY.
+The value is a list of three integers: the major and minor
+version numbers of the X Protocol in use, and the distributor-specific
+release number.  See also the function `x-server-vendor'.
+
+The optional argument DISPLAY specifies which display to ask about.
 DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, the selected frame's display is used.
-See also the function `ns-server-vendor'.  */)
+If omitted or nil, that stands for the selected frame's display.  */)
      (display)
      Lisp_Object display;
 {
-  return ns_appkit_version ();
+  /*NOTE: it is unclear what would best correspond with "protocol";
+          we return 10.3, meaning Panther, since this is roughly the
+          level that GNUstep's APIs correspond to.
+          The last number is where we distinguish between the Apple
+          and GNUstep implementations ("distributor-specific release
+          number") and give int'ized versions of major.minor. */
+  return Fcons (make_number (10),
+		Fcons (make_number (3),
+		       Fcons (make_number (ns_appkit_version_int()), Qnil)));
 }
 
 
@@ -2658,7 +2685,7 @@
 
   DEFVAR_LISP ("ns-version-string", &Vns_version_string,
                doc: /* Toolkit version for NS Windowing.  */);
-  Vns_version_string = ns_appkit_version ();
+  Vns_version_string = ns_appkit_version_str ();
 
   defsubr (&Sns_read_file_name);
   defsubr (&Sns_get_resource);