]> code.delx.au - gnu-emacs/blobdiff - src/nsfns.m
Fix warnings on OSX 10.10.
[gnu-emacs] / src / nsfns.m
index f8863e6d40015eb28ff2d72b8a33cdd739990ed4..5f584e1c1bb7224cae8ac066eb0df70543fd2d77 100644 (file)
@@ -1455,6 +1455,15 @@ ns_run_file_dialog (void)
   ns_fd_data.panel = nil;
 }
 
+#ifdef NS_IMPL_COCOA
+#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_9
+#define MODAL_OK_RESPONSE NSModalResponseOK
+#endif
+#endif
+#ifndef MODAL_OK_RESPONSE
+#define MODAL_OK_RESPONSE NSOKButton
+#endif
+
 DEFUN ("ns-read-file-name", Fns_read_file_name, Sns_read_file_name, 1, 5, 0,
        doc: /* Use a graphical panel to read a file name, using prompt PROMPT.
 Optional arg DIR, if non-nil, supplies a default directory.
@@ -1549,7 +1558,7 @@ Optional arg DIR_ONLY_P, if non-nil, means choose only directories.  */)
   while (ns_fd_data.panel != nil)
     [NSApp run];
 
-  ret = (ns_fd_data.ret == NSOKButton);
+  ret = (ns_fd_data.ret == MODAL_OK_RESPONSE);
 
   if (ret)
     {
@@ -2677,7 +2686,16 @@ compute_tip_xy (struct frame *f,
       pt.y = dpyinfo->last_mouse_motion_y;
       /* Convert to screen coordinates */
       pt = [view convertPoint: pt toView: nil];
+#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
       pt = [[view window] convertBaseToScreen: pt];
+#else
+      {
+        NSRect r = NSMakeRect (pt.x, pt.y, 0, 0);
+        r = [[view window] convertRectToScreen: r];
+        pt.x = r.origin.x;
+        pt.y = r.origin.y;
+      }
+#endif
     }
   else
     {