Mercurial > emacs
comparison src/macterm.c @ 67788:114d965dfb60
Don't include sys/param.h.
(init_coercion_handler): Add extern.
[MAC_OS8] (main): Call init_coercion_handler.
(mac_initialize) [MAC_OSX]: Likewise.
[TARGET_API_MAC_CARBON] (mac_do_receive_drag): Use coercion of
Apple event data for translation from/to file names.
author | YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
---|---|
date | Sat, 24 Dec 2005 02:50:45 +0000 |
parents | 330ac31a0c82 |
children | d88b44855af3 d0eee3282e6b |
comparison
equal
deleted
inserted
replaced
67787:8c306a35f0b0 | 67788:114d965dfb60 |
---|---|
66 | 66 |
67 #include <ctype.h> | 67 #include <ctype.h> |
68 #include <errno.h> | 68 #include <errno.h> |
69 #include <setjmp.h> | 69 #include <setjmp.h> |
70 #include <sys/stat.h> | 70 #include <sys/stat.h> |
71 #include <sys/param.h> | |
72 | 71 |
73 #include "charset.h" | 72 #include "charset.h" |
74 #include "coding.h" | 73 #include "coding.h" |
75 #include "frame.h" | 74 #include "frame.h" |
76 #include "dispextern.h" | 75 #include "dispextern.h" |
8199 extern Lisp_Object Qundefined; | 8198 extern Lisp_Object Qundefined; |
8200 extern void init_apple_event_handler P_ ((void)); | 8199 extern void init_apple_event_handler P_ ((void)); |
8201 extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID, | 8200 extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID, |
8202 Lisp_Object *, Lisp_Object *, | 8201 Lisp_Object *, Lisp_Object *, |
8203 Lisp_Object *)); | 8202 Lisp_Object *)); |
8203 extern OSErr init_coercion_handler P_ ((void)); | |
8204 | 8204 |
8205 #if TARGET_API_MAC_CARBON | 8205 #if TARGET_API_MAC_CARBON |
8206 /* Drag and Drop */ | 8206 /* Drag and Drop */ |
8207 static pascal OSErr mac_do_track_drag (DragTrackingMessage, WindowPtr, void*, DragReference); | 8207 static pascal OSErr mac_do_track_drag (DragTrackingMessage, WindowPtr, void*, DragReference); |
8208 static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); | 8208 static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); |
9205 /* Only handle file references. */ | 9205 /* Only handle file references. */ |
9206 GetDragItemReferenceNumber (theDrag, index, &theItem); | 9206 GetDragItemReferenceNumber (theDrag, index, &theItem); |
9207 result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags); | 9207 result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags); |
9208 if (result == noErr) | 9208 if (result == noErr) |
9209 { | 9209 { |
9210 #ifdef MAC_OSX | 9210 OSErr err; |
9211 FSRef fref; | 9211 AEDesc desc; |
9212 #endif | 9212 |
9213 char unix_path_name[MAXPATHLEN]; | 9213 err = GetFlavorData (theDrag, theItem, flavorTypeHFS, |
9214 | 9214 &data, &size, 0L); |
9215 GetFlavorData (theDrag, theItem, flavorTypeHFS, &data, &size, 0L); | 9215 if (err == noErr) |
9216 #ifdef MAC_OSX | 9216 err = AECoercePtr (typeFSS, &data.fileSpec, sizeof (FSSpec), |
9217 /* Use Carbon routines, otherwise it converts the file name | 9217 TYPE_FILE_NAME, &desc); |
9218 to /Macintosh HD/..., which is not correct. */ | 9218 if (err == noErr) |
9219 FSpMakeFSRef (&data.fileSpec, &fref); | 9219 { |
9220 if (! FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name))); | 9220 Lisp_Object file; |
9221 #else | 9221 |
9222 if (fsspec_to_posix_pathname (&data.fileSpec, unix_path_name, | 9222 /* x-dnd functions expect undecoded filenames. */ |
9223 sizeof (unix_path_name) - 1) == noErr) | 9223 file = make_uninit_string (AEGetDescDataSize (&desc)); |
9224 #endif | 9224 err = AEGetDescData (&desc, SDATA (file), SBYTES (file)); |
9225 /* x-dnd functions expect undecoded filenames. */ | 9225 if (err == noErr) |
9226 file_list = Fcons (make_unibyte_string (unix_path_name, | 9226 file_list = Fcons (file, file_list); |
9227 strlen (unix_path_name)), | 9227 AEDisposeDesc (&desc); |
9228 file_list); | 9228 } |
9229 } | 9229 } |
9230 } | 9230 } |
9231 /* If there are items in the list, construct an event and post it to | 9231 /* If there are items in the list, construct an event and post it to |
9232 the queue like an interrupt using kbd_buffer_store_event. */ | 9232 the queue like an interrupt using kbd_buffer_store_event. */ |
9233 if (!NILP (file_list)) | 9233 if (!NILP (file_list)) |
9314 #endif | 9314 #endif |
9315 | 9315 |
9316 init_emacs_passwd_dir (); | 9316 init_emacs_passwd_dir (); |
9317 | 9317 |
9318 init_environ (); | 9318 init_environ (); |
9319 | |
9320 init_coercion_handler (); | |
9319 | 9321 |
9320 initialize_applescript (); | 9322 initialize_applescript (); |
9321 | 9323 |
9322 init_apple_event_handler (); | 9324 init_apple_event_handler (); |
9323 | 9325 |
10703 | 10705 |
10704 init_menu_bar (); | 10706 init_menu_bar (); |
10705 #endif /* USE_CARBON_EVENTS */ | 10707 #endif /* USE_CARBON_EVENTS */ |
10706 | 10708 |
10707 #ifdef MAC_OSX | 10709 #ifdef MAC_OSX |
10710 init_coercion_handler (); | |
10711 | |
10708 init_apple_event_handler (); | 10712 init_apple_event_handler (); |
10709 | 10713 |
10710 if (!inhibit_window_system) | 10714 if (!inhibit_window_system) |
10711 MakeMeTheFrontProcess (); | 10715 MakeMeTheFrontProcess (); |
10712 #endif | 10716 #endif |