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.
while (ns_fd_data.panel != nil)
[NSApp run];
- ret = (ns_fd_data.ret == NSOKButton);
+ ret = (ns_fd_data.ret == MODAL_OK_RESPONSE);
if (ret)
{
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
{