diff options
Diffstat (limited to 'src/macfns.c')
| -rw-r--r-- | src/macfns.c | 34 |
1 files changed, 25 insertions, 9 deletions
diff --git a/src/macfns.c b/src/macfns.c index 26d63ec99af..d90344dc1d0 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -2294,8 +2294,6 @@ XParseGeometry (string, x, y, width, height) | |||
| 2294 | 2294 | ||
| 2295 | /* Create and set up the Mac window for frame F. */ | 2295 | /* Create and set up the Mac window for frame F. */ |
| 2296 | 2296 | ||
| 2297 | extern OSErr install_window_handler (WindowPtr); | ||
| 2298 | |||
| 2299 | static void | 2297 | static void |
| 2300 | mac_window (f) | 2298 | mac_window (f) |
| 2301 | struct frame *f; | 2299 | struct frame *f; |
| @@ -4356,7 +4354,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4356 | options.actionButtonLabel = CFSTR ("Ok"); | 4354 | options.actionButtonLabel = CFSTR ("Ok"); |
| 4357 | options.windowTitle = CFSTR ("Enter name"); | 4355 | options.windowTitle = CFSTR ("Enter name"); |
| 4358 | 4356 | ||
| 4359 | if (!NILP(default_filename)) | 4357 | if (STRINGP (default_filename)) |
| 4360 | { | 4358 | { |
| 4361 | Lisp_Object utf8 = ENCODE_UTF_8 (default_filename); | 4359 | Lisp_Object utf8 = ENCODE_UTF_8 (default_filename); |
| 4362 | char *begPtr = SDATA(utf8); | 4360 | char *begPtr = SDATA(utf8); |
| @@ -4381,22 +4379,29 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4381 | } | 4379 | } |
| 4382 | 4380 | ||
| 4383 | /* Set the default location and continue*/ | 4381 | /* Set the default location and continue*/ |
| 4384 | if (status == noErr) { | 4382 | if (status == noErr) |
| 4385 | if (!NILP(dir)) { | 4383 | { |
| 4386 | FSRef defLoc; | ||
| 4387 | AEDesc defLocAed; | 4384 | AEDesc defLocAed; |
| 4385 | #ifdef MAC_OSX | ||
| 4386 | FSRef defLoc; | ||
| 4388 | status = FSPathMakeRef(SDATA(ENCODE_FILE(dir)), &defLoc, NULL); | 4387 | status = FSPathMakeRef(SDATA(ENCODE_FILE(dir)), &defLoc, NULL); |
| 4388 | #else | ||
| 4389 | FSSpec defLoc; | ||
| 4390 | status = posix_pathname_to_fsspec (SDATA (ENCODE_FILE (dir)), &defLoc); | ||
| 4391 | #endif | ||
| 4389 | if (status == noErr) | 4392 | if (status == noErr) |
| 4390 | { | 4393 | { |
| 4394 | #ifdef MAC_OSX | ||
| 4391 | AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed); | 4395 | AECreateDesc(typeFSRef, &defLoc, sizeof(FSRef), &defLocAed); |
| 4396 | #else | ||
| 4397 | AECreateDesc(typeFSS, &defLoc, sizeof(FSSpec), &defLocAed); | ||
| 4398 | #endif | ||
| 4392 | NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed); | 4399 | NavCustomControl(dialogRef, kNavCtlSetLocation, (void*) &defLocAed); |
| 4393 | AEDisposeDesc(&defLocAed); | 4400 | AEDisposeDesc(&defLocAed); |
| 4394 | } | 4401 | } |
| 4402 | status = NavDialogRun(dialogRef); | ||
| 4395 | } | 4403 | } |
| 4396 | 4404 | ||
| 4397 | status = NavDialogRun(dialogRef); | ||
| 4398 | } | ||
| 4399 | |||
| 4400 | if (saveName) CFRelease(saveName); | 4405 | if (saveName) CFRelease(saveName); |
| 4401 | if (message) CFRelease(message); | 4406 | if (message) CFRelease(message); |
| 4402 | 4407 | ||
| @@ -4413,11 +4418,22 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) | |||
| 4413 | { | 4418 | { |
| 4414 | NavReplyRecord reply; | 4419 | NavReplyRecord reply; |
| 4415 | AEDesc aed; | 4420 | AEDesc aed; |
| 4421 | #ifdef MAC_OSX | ||
| 4416 | FSRef fsRef; | 4422 | FSRef fsRef; |
| 4423 | #else | ||
| 4424 | FSSpec fs; | ||
| 4425 | #endif | ||
| 4417 | status = NavDialogGetReply(dialogRef, &reply); | 4426 | status = NavDialogGetReply(dialogRef, &reply); |
| 4427 | |||
| 4428 | #ifdef MAC_OSX | ||
| 4418 | AECoerceDesc(&reply.selection, typeFSRef, &aed); | 4429 | AECoerceDesc(&reply.selection, typeFSRef, &aed); |
| 4419 | AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef)); | 4430 | AEGetDescData(&aed, (void *) &fsRef, sizeof (FSRef)); |
| 4420 | FSRefMakePath(&fsRef, (UInt8 *) filename, sizeof (filename)); | 4431 | FSRefMakePath(&fsRef, (UInt8 *) filename, sizeof (filename)); |
| 4432 | #else | ||
| 4433 | AECoerceDesc (&reply.selection, typeFSS, &aed); | ||
| 4434 | AEGetDescData (&aed, (void *) &fs, sizeof (FSSpec)); | ||
| 4435 | fsspec_to_posix_pathname (&fs, filename, sizeof (filename) - 1); | ||
| 4436 | #endif | ||
| 4421 | AEDisposeDesc(&aed); | 4437 | AEDisposeDesc(&aed); |
| 4422 | if (reply.saveFileName) | 4438 | if (reply.saveFileName) |
| 4423 | { | 4439 | { |