]> code.delx.au - gnu-emacs/commitdiff
(Fx_display_mm_height, Fx_display_mm_width)
authorYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Tue, 14 Nov 2006 08:21:57 +0000 (08:21 +0000)
committerYAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
Tue, 14 Nov 2006 08:21:57 +0000 (08:21 +0000)
[MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
&& MAC_OS_X_VERSION_MIN_REQUIRED == 1020]: Check if
CGDisplayScreenSize is available.

src/macfns.c

index 9cb9e3e04966632730f14562ad2238610895e474..2df3b4e203e2bd69be33d2e003a3ff278eaab48e 100644 (file)
@@ -3092,18 +3092,30 @@ If omitted or nil, that stands for the selected frame's display.  */)
      Lisp_Object display;
 {
   struct mac_display_info *dpyinfo = check_x_display_info (display);
+
   /* Only of the main display.  */
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  CGSize size;
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+  if (CGDisplayScreenSize != NULL)
+#endif
+    {
+      CGSize size;
 
-  BLOCK_INPUT;
-  size = CGDisplayScreenSize (kCGDirectMainDisplay);
-  UNBLOCK_INPUT;
+      BLOCK_INPUT;
+      size = CGDisplayScreenSize (kCGDirectMainDisplay);
+      UNBLOCK_INPUT;
 
-  return make_number ((int) (size.height + .5f));
-#else
-  /* This is an approximation.  */
-  return make_number ((int) (dpyinfo->height * 25.4 / dpyinfo->resy));
+      return make_number ((int) (size.height + .5f));
+    }
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+  else
+#endif
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030  */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+    {
+      /* This is an approximation.  */
+      return make_number ((int) (dpyinfo->height * 25.4 / dpyinfo->resy));
+    }
 #endif
 }
 
@@ -3116,18 +3128,30 @@ If omitted or nil, that stands for the selected frame's display.  */)
      Lisp_Object display;
 {
   struct mac_display_info *dpyinfo = check_x_display_info (display);
+
   /* Only of the main display.  */
 #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
-  CGSize size;
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+  if (CGDisplayScreenSize != NULL)
+#endif
+    {
+      CGSize size;
 
-  BLOCK_INPUT;
-  size = CGDisplayScreenSize (kCGDirectMainDisplay);
-  UNBLOCK_INPUT;
+      BLOCK_INPUT;
+      size = CGDisplayScreenSize (kCGDirectMainDisplay);
+      UNBLOCK_INPUT;
 
-  return make_number ((int) (size.width + .5f));
-#else
-  /* This is an approximation.  */
-  return make_number ((int) (dpyinfo->width * 25.4 / dpyinfo->resx));
+      return make_number ((int) (size.width + .5f));
+    }
+#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+  else
+#endif
+#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= 1030  */
+#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
+    {
+      /* This is an approximation.  */
+      return make_number ((int) (dpyinfo->width * 25.4 / dpyinfo->resx));
+    }
 #endif
 }