622 |
ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)}; |
ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)}; |
623 |
static ATSLineLayoutOptions line_layout = |
static ATSLineLayoutOptions line_layout = |
624 |
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
625 |
kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics |
kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics |
626 |
#else |
#else |
627 |
kATSLineIsDisplayOnly | kATSLineFractDisable |
kATSLineIsDisplayOnly | kATSLineFractDisable |
628 |
#endif |
#endif |
8127 |
Carbon/Apple event handlers. */ |
Carbon/Apple event handlers. */ |
8128 |
static struct input_event *read_socket_inev = NULL; |
static struct input_event *read_socket_inev = NULL; |
8129 |
|
|
|
/* Set in term/mac-win.el to indicate that event loop can now generate |
|
|
drag and drop events. */ |
|
|
Lisp_Object Qmac_ready_for_drag_n_drop; |
|
|
|
|
8130 |
Point saved_menu_event_location; |
Point saved_menu_event_location; |
8131 |
|
|
8132 |
/* Apple Events */ |
/* Apple Events */ |
8133 |
static void init_required_apple_events (void); |
#if USE_CARBON_EVENTS |
8134 |
static pascal OSErr |
static Lisp_Object Qhicommand; |
8135 |
do_ae_open_application (const AppleEvent *, AppleEvent *, long); |
#endif |
8136 |
static pascal OSErr |
extern int mac_ready_for_apple_events; |
8137 |
do_ae_print_documents (const AppleEvent *, AppleEvent *, long); |
extern Lisp_Object Qundefined; |
8138 |
static pascal OSErr do_ae_open_documents (AppleEvent *, AppleEvent *, long); |
extern void init_apple_event_handler P_ ((void)); |
8139 |
static pascal OSErr do_ae_quit_application (AppleEvent *, AppleEvent *, long); |
extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID, |
8140 |
|
Lisp_Object *, Lisp_Object *, |
8141 |
|
Lisp_Object *)); |
8142 |
|
|
8143 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
8144 |
/* Drag and Drop */ |
/* Drag and Drop */ |
8148 |
static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; |
static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; |
8149 |
#endif |
#endif |
8150 |
|
|
|
static Lisp_Object Qapplication, Qabout; |
|
8151 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
8152 |
#ifdef MAC_OSX |
#ifdef MAC_OSX |
8153 |
extern void init_service_handler (); |
extern void init_service_handler (); |
8154 |
static Lisp_Object Qpreferences, Qservices, Qpaste, Qperform; |
static Lisp_Object Qservices, Qpaste, Qperform; |
8155 |
#endif |
#endif |
8156 |
/* Window Event Handler */ |
/* Window Event Handler */ |
8157 |
static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, |
static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, |
8696 |
x_real_positions (f, &f->left_pos, &f->top_pos); |
x_real_positions (f, &f->left_pos, &f->top_pos); |
8697 |
} |
} |
8698 |
|
|
8699 |
/* Intialize AppleEvent dispatcher table for the required events. */ |
OSErr |
8700 |
void |
mac_store_apple_event (class, id, desc) |
8701 |
init_required_apple_events () |
Lisp_Object class, id; |
8702 |
{ |
const AEDesc *desc; |
|
OSErr err; |
|
|
long result; |
|
|
|
|
|
/* Make sure we have apple events before starting. */ |
|
|
err = Gestalt (gestaltAppleEventsAttr, &result); |
|
|
if (err != noErr) |
|
|
abort (); |
|
|
|
|
|
if (!(result & (1 << gestaltAppleEventsPresent))) |
|
|
abort (); |
|
|
|
|
|
#if TARGET_API_MAC_CARBON |
|
|
err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, |
|
|
NewAEEventHandlerUPP |
|
|
((AEEventHandlerProcPtr) do_ae_open_application), |
|
|
0L, false); |
|
|
#else |
|
|
err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication, |
|
|
NewAEEventHandlerProc |
|
|
((AEEventHandlerProcPtr) do_ae_open_application), |
|
|
0L, false); |
|
|
#endif |
|
|
if (err != noErr) |
|
|
abort (); |
|
|
|
|
|
#if TARGET_API_MAC_CARBON |
|
|
err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, |
|
|
NewAEEventHandlerUPP |
|
|
((AEEventHandlerProcPtr) do_ae_open_documents), |
|
|
0L, false); |
|
|
#else |
|
|
err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments, |
|
|
NewAEEventHandlerProc |
|
|
((AEEventHandlerProcPtr) do_ae_open_documents), |
|
|
0L, false); |
|
|
#endif |
|
|
if (err != noErr) |
|
|
abort (); |
|
|
|
|
|
#if TARGET_API_MAC_CARBON |
|
|
err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, |
|
|
NewAEEventHandlerUPP |
|
|
((AEEventHandlerProcPtr) do_ae_print_documents), |
|
|
0L, false); |
|
|
#else |
|
|
err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments, |
|
|
NewAEEventHandlerProc |
|
|
((AEEventHandlerProcPtr) do_ae_print_documents), |
|
|
0L, false); |
|
|
#endif |
|
|
if (err != noErr) |
|
|
abort (); |
|
|
|
|
|
#if TARGET_API_MAC_CARBON |
|
|
err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, |
|
|
NewAEEventHandlerUPP |
|
|
((AEEventHandlerProcPtr) do_ae_quit_application), |
|
|
0L, false); |
|
|
#else |
|
|
err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication, |
|
|
NewAEEventHandlerProc |
|
|
((AEEventHandlerProcPtr) do_ae_quit_application), |
|
|
0L, false); |
|
|
#endif |
|
|
if (err != noErr) |
|
|
abort (); |
|
|
} |
|
|
|
|
|
void |
|
|
mac_store_application_menu_event (event) |
|
|
#if USE_CARBON_EVENTS |
|
|
EventRef event; |
|
|
#else |
|
|
UInt32 event; |
|
|
#endif |
|
8703 |
{ |
{ |
8704 |
|
OSErr err = noErr; |
8705 |
struct input_event buf; |
struct input_event buf; |
8706 |
Lisp_Object frame, entry; |
AEDesc *desc_copy; |
|
|
|
|
EVENT_INIT (buf); |
|
8707 |
|
|
8708 |
XSETFRAME (frame, mac_focus_frame (&one_mac_display_info)); |
desc_copy = xmalloc (sizeof (AEDesc)); |
8709 |
buf.kind = MENU_BAR_EVENT; |
if (desc_copy == NULL) |
8710 |
buf.frame_or_window = frame; |
err = memFullErr; |
8711 |
buf.arg = frame; |
else |
8712 |
kbd_buffer_store_event (&buf); |
err = AEDuplicateDesc (desc, desc_copy); |
8713 |
|
if (err == noErr) |
|
buf.arg = Qapplication; |
|
|
kbd_buffer_store_event (&buf); |
|
|
|
|
|
#if USE_CARBON_EVENTS |
|
|
switch (GetEventClass (event)) |
|
8714 |
{ |
{ |
8715 |
#ifdef MAC_OSX |
EVENT_INIT (buf); |
|
case kEventClassService: |
|
|
buf.arg = Qservices; |
|
|
kbd_buffer_store_event (&buf); |
|
|
switch (GetEventKind (event)) |
|
|
{ |
|
|
case kEventServicePaste: |
|
|
entry = Qpaste; |
|
|
break; |
|
8716 |
|
|
8717 |
case kEventServicePerform: |
buf.kind = MAC_APPLE_EVENT; |
8718 |
{ |
buf.x = class; |
8719 |
OSErr err; |
buf.y = id; |
8720 |
CFStringRef message; |
buf.code = (int)desc_copy; |
8721 |
|
XSETFRAME (buf.frame_or_window, |
8722 |
err = GetEventParameter (event, kEventParamServiceMessageName, |
mac_focus_frame (&one_mac_display_info)); |
8723 |
typeCFStringRef, NULL, |
buf.arg = Qnil; |
8724 |
sizeof (CFStringRef), NULL, &message); |
kbd_buffer_store_event (&buf); |
8725 |
buf.arg = Qperform; |
} |
|
kbd_buffer_store_event (&buf); |
|
|
if (err == noErr && message) |
|
|
entry = intern (SDATA (cfstring_to_lisp (message))); |
|
|
else |
|
|
entry = Qnil; |
|
|
} |
|
|
break; |
|
8726 |
|
|
8727 |
default: |
return err; |
8728 |
abort (); |
} |
|
} |
|
|
break; |
|
|
#endif /* MAC_OSX */ |
|
|
case kEventClassCommand: |
|
|
{ |
|
|
HICommand command; |
|
8729 |
|
|
8730 |
GetEventParameter(event, kEventParamDirectObject, typeHICommand, |
Lisp_Object |
8731 |
NULL, sizeof (HICommand), NULL, &command); |
mac_make_lispy_event_code (code) |
8732 |
switch (command.commandID) |
int code; |
8733 |
{ |
{ |
8734 |
case kHICommandAbout: |
AEDesc *desc = (AEDesc *)code; |
8735 |
entry = Qabout; |
Lisp_Object obj; |
|
break; |
|
|
#ifdef MAC_OSX |
|
|
case kHICommandPreferences: |
|
|
entry = Qpreferences; |
|
|
break; |
|
|
#endif /* MAC_OSX */ |
|
|
case kHICommandQuit: |
|
|
entry = Qquit; |
|
|
break; |
|
|
default: |
|
|
abort (); |
|
|
} |
|
|
} |
|
|
break; |
|
8736 |
|
|
8737 |
default: |
obj = mac_aedesc_to_lisp (desc); |
8738 |
abort (); |
AEDisposeDesc (desc); |
8739 |
} |
xfree (desc); |
|
#else /* USE_CARBON_EVENTS */ |
|
|
switch (event) |
|
|
{ |
|
|
case kHICommandAbout: |
|
|
entry = Qabout; |
|
|
break; |
|
|
case kHICommandQuit: |
|
|
entry = Qquit; |
|
|
break; |
|
|
default: |
|
|
abort (); |
|
|
} |
|
|
#endif |
|
8740 |
|
|
8741 |
buf.arg = entry; |
return obj; |
|
kbd_buffer_store_event (&buf); |
|
8742 |
} |
} |
8743 |
|
|
8744 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
8748 |
EventRef event; |
EventRef event; |
8749 |
void *data; |
void *data; |
8750 |
{ |
{ |
8751 |
|
OSStatus result; |
8752 |
|
OSErr err; |
8753 |
HICommand command; |
HICommand command; |
8754 |
OSErr result; |
Lisp_Object class_key, id_key, binding; |
8755 |
|
|
8756 |
GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, |
result = CallNextEventHandler (next_handler, event); |
8757 |
sizeof (HICommand), NULL, &command); |
if (result != eventNotHandledErr) |
8758 |
|
return result; |
8759 |
|
|
8760 |
switch (command.commandID) |
GetEventParameter (event, kEventParamDirectObject, typeHICommand, NULL, |
8761 |
{ |
sizeof (HICommand), NULL, &command); |
|
case kHICommandAbout: |
|
|
#ifdef MAC_OSX |
|
|
case kHICommandPreferences: |
|
|
#endif /* MAC_OSX */ |
|
|
result = CallNextEventHandler (next_handler, event); |
|
|
if (result != eventNotHandledErr) |
|
|
return result; |
|
8762 |
|
|
8763 |
mac_store_application_menu_event (event); |
if (command.commandID == 0) |
8764 |
return noErr; |
return eventNotHandledErr; |
8765 |
|
|
8766 |
default: |
/* A HICommand event is mapped to an Apple event whose event class |
8767 |
break; |
symbol is `hicommand' and event ID is its command ID. */ |
8768 |
} |
class_key = Qhicommand; |
8769 |
|
mac_find_apple_event_spec (0, command.commandID, |
8770 |
|
&class_key, &id_key, &binding); |
8771 |
|
if (!NILP (binding) && !EQ (binding, Qundefined)) |
8772 |
|
if (INTEGERP (binding)) |
8773 |
|
return XINT (binding); |
8774 |
|
else |
8775 |
|
{ |
8776 |
|
AppleEvent apple_event; |
8777 |
|
UInt32 modifiers; |
8778 |
|
static EventParamName names[] = {kEventParamDirectObject, |
8779 |
|
kEventParamKeyModifiers}; |
8780 |
|
static EventParamType types[] = {typeHICommand, |
8781 |
|
typeUInt32}; |
8782 |
|
static UInt32 sizes[] = {sizeof (HICommand), |
8783 |
|
sizeof (UInt32)}; |
8784 |
|
err = create_apple_event_from_event_ref (event, 2, names, types, |
8785 |
|
sizes, &apple_event); |
8786 |
|
if (err == noErr) |
8787 |
|
{ |
8788 |
|
err = mac_store_apple_event (class_key, id_key, &apple_event); |
8789 |
|
AEDisposeDesc (&apple_event); |
8790 |
|
} |
8791 |
|
if (err == noErr) |
8792 |
|
return noErr; |
8793 |
|
} |
8794 |
|
|
8795 |
return eventNotHandledErr; |
return eventNotHandledErr; |
8796 |
} |
} |
8952 |
|
|
8953 |
return eventNotHandledErr; |
return eventNotHandledErr; |
8954 |
} |
} |
8955 |
|
|
8956 |
|
#ifdef MAC_OSX |
8957 |
|
OSErr |
8958 |
|
mac_store_services_event (event) |
8959 |
|
EventRef event; |
8960 |
|
{ |
8961 |
|
OSErr err; |
8962 |
|
AppleEvent apple_event; |
8963 |
|
Lisp_Object id_key; |
8964 |
|
|
8965 |
|
switch (GetEventKind (event)) |
8966 |
|
{ |
8967 |
|
case kEventServicePaste: |
8968 |
|
id_key = Qpaste; |
8969 |
|
err = create_apple_event_from_event_ref (event, 0, NULL, |
8970 |
|
NULL, NULL, &apple_event); |
8971 |
|
break; |
8972 |
|
|
8973 |
|
case kEventServicePerform: |
8974 |
|
{ |
8975 |
|
static EventParamName names[] = {kEventParamServiceMessageName, |
8976 |
|
kEventParamServiceUserData}; |
8977 |
|
static EventParamType types[] = {typeCFStringRef, |
8978 |
|
typeCFStringRef}; |
8979 |
|
static UInt32 sizes[] = {sizeof (CFStringRef), |
8980 |
|
sizeof (CFStringRef)}; |
8981 |
|
|
8982 |
|
id_key = Qperform; |
8983 |
|
err = create_apple_event_from_event_ref (event, 2, names, types, |
8984 |
|
sizes, &apple_event); |
8985 |
|
} |
8986 |
|
break; |
8987 |
|
|
8988 |
|
default: |
8989 |
|
abort (); |
8990 |
|
} |
8991 |
|
|
8992 |
|
if (err == noErr) |
8993 |
|
{ |
8994 |
|
err = mac_store_apple_event (Qservices, id_key, &apple_event); |
8995 |
|
AEDisposeDesc (&apple_event); |
8996 |
|
} |
8997 |
|
|
8998 |
|
return err; |
8999 |
|
} |
9000 |
|
#endif /* MAC_OSX */ |
9001 |
#endif /* USE_CARBON_EVENTS */ |
#endif /* USE_CARBON_EVENTS */ |
9002 |
|
|
9003 |
|
|
9056 |
#endif |
#endif |
9057 |
} |
} |
9058 |
|
|
|
/* Open Application Apple Event */ |
|
|
static pascal OSErr |
|
|
do_ae_open_application(const AppleEvent *pae, AppleEvent *preply, long prefcon) |
|
|
{ |
|
|
return noErr; |
|
|
} |
|
|
|
|
|
|
|
|
/* Called when we receive an AppleEvent with an ID of |
|
|
"kAEOpenDocuments". This routine gets the direct parameter, |
|
|
extracts the FSSpecs in it, and puts their names on a list. */ |
|
|
#pragma options align=mac68k |
|
|
typedef struct SelectionRange { |
|
|
short unused1; // 0 (not used) |
|
|
short lineNum; // line to select (<0 to specify range) |
|
|
long startRange; // start of selection range (if line < 0) |
|
|
long endRange; // end of selection range (if line < 0) |
|
|
long unused2; // 0 (not used) |
|
|
long theDate; // modification date/time |
|
|
} SelectionRange; |
|
|
#pragma options align=reset |
|
|
|
|
|
static pascal OSErr |
|
|
do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon) |
|
|
{ |
|
|
OSErr err, err2; |
|
|
AEDesc the_desc; |
|
|
AEKeyword keyword; |
|
|
DescType actual_type; |
|
|
Size actual_size; |
|
|
SelectionRange position; |
|
|
Lisp_Object file_list = Qnil; |
|
|
|
|
|
xassert (read_socket_inev); |
|
|
|
|
|
err = AEGetParamDesc (message, keyDirectObject, typeAEList, &the_desc); |
|
|
if (err != noErr) |
|
|
goto descriptor_error_exit; |
|
|
|
|
|
err = AEGetParamPtr (message, keyAEPosition, typeChar, &actual_type, &position, sizeof(SelectionRange), &actual_size); |
|
|
if (err == noErr) |
|
|
file_list = Fcons (list3 (make_number (position.lineNum + 1), |
|
|
make_number (position.startRange + 1), |
|
|
make_number (position.endRange + 1)), |
|
|
file_list); |
|
|
|
|
|
/* Check to see that we got all of the required parameters from the |
|
|
event descriptor. For an 'odoc' event this should just be the |
|
|
file list. */ |
|
|
err = AEGetAttributePtr(message, keyMissedKeywordAttr, typeWildCard, |
|
|
&actual_type, (Ptr) &keyword, |
|
|
sizeof (keyword), &actual_size); |
|
|
/* No error means that we found some unused parameters. |
|
|
errAEDescNotFound means that there are no more parameters. If we |
|
|
get an error code other than that, flag it. */ |
|
|
if ((err == noErr) || (err != errAEDescNotFound)) |
|
|
{ |
|
|
err = errAEEventNotHandled; |
|
|
goto error_exit; |
|
|
} |
|
|
err = noErr; |
|
|
|
|
|
/* Got all the parameters we need. Now, go through the direct |
|
|
object list and parse it up. */ |
|
|
{ |
|
|
long num_files_to_open; |
|
|
|
|
|
err = AECountItems (&the_desc, &num_files_to_open); |
|
|
if (err == noErr) |
|
|
{ |
|
|
int i; |
|
|
|
|
|
/* AE file list is one based so just use that for indexing here. */ |
|
|
for (i = 1; i <= num_files_to_open; i++) |
|
|
{ |
|
|
char unix_path_name[MAXPATHLEN]; |
|
|
#ifdef MAC_OSX |
|
|
FSRef fref; |
|
|
|
|
|
err = AEGetNthPtr (&the_desc, i, typeFSRef, &keyword, |
|
|
&actual_type, &fref, sizeof (FSRef), |
|
|
&actual_size); |
|
|
if (err != noErr || actual_type != typeFSRef) |
|
|
continue; |
|
|
|
|
|
if (FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name)) |
|
|
== noErr) |
|
|
#else |
|
|
FSSpec fs; |
|
|
|
|
|
err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type, |
|
|
(Ptr) &fs, sizeof (fs), &actual_size); |
|
|
if (err != noErr) continue; |
|
|
|
|
|
if (fsspec_to_posix_pathname (&fs, unix_path_name, |
|
|
sizeof (unix_path_name) - 1) == noErr) |
|
|
#endif |
|
|
/* x-dnd functions expect undecoded filenames. */ |
|
|
file_list = Fcons (make_unibyte_string (unix_path_name, |
|
|
strlen (unix_path_name)), |
|
|
file_list); |
|
|
} |
|
|
} |
|
|
|
|
|
/* Build a DRAG_N_DROP_EVENT type event as is done in |
|
|
constuct_drag_n_drop in w32term.c. */ |
|
|
if (!NILP (file_list)) |
|
|
{ |
|
|
struct frame *f = mac_focus_frame (&one_mac_display_info); |
|
|
WindowPtr wp; |
|
|
Lisp_Object frame; |
|
|
|
|
|
read_socket_inev->kind = DRAG_N_DROP_EVENT; |
|
|
read_socket_inev->code = 0; |
|
|
read_socket_inev->modifiers = 0; |
|
|
|
|
|
XSETINT (read_socket_inev->x, 0); |
|
|
XSETINT (read_socket_inev->y, 0); |
|
|
|
|
|
XSETFRAME (frame, f); |
|
|
read_socket_inev->frame_or_window = Fcons (frame, file_list); |
|
|
|
|
|
#if 0 |
|
|
/* Regardless of whether Emacs was suspended or in the |
|
|
foreground, ask it to redraw its entire screen. Otherwise |
|
|
parts of the screen can be left in an inconsistent |
|
|
state. */ |
|
|
wp = FRAME_MAC_WINDOW (f); |
|
|
if (wp) |
|
|
#if TARGET_API_MAC_CARBON |
|
|
{ |
|
|
Rect r; |
|
|
|
|
|
GetWindowPortBounds (wp, &r); |
|
|
InvalWindowRect (wp, &r); |
|
|
} |
|
|
#else /* not TARGET_API_MAC_CARBON */ |
|
|
InvalRect (&(wp->portRect)); |
|
|
#endif /* not TARGET_API_MAC_CARBON */ |
|
|
#endif |
|
|
} |
|
|
} |
|
|
|
|
|
error_exit: |
|
|
/* Nuke the coerced file list in any case */ |
|
|
err2 = AEDisposeDesc(&the_desc); |
|
|
|
|
|
descriptor_error_exit: |
|
|
/* InvalRect(&(gFrontMacWindowP->mWP->portRect)); */ |
|
|
return err; |
|
|
} |
|
|
|
|
|
|
|
9059 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
9060 |
static pascal OSErr |
static pascal OSErr |
9061 |
mac_do_track_drag (DragTrackingMessage message, WindowPtr window, |
mac_do_track_drag (DragTrackingMessage message, WindowPtr window, |
9210 |
#endif |
#endif |
9211 |
|
|
9212 |
|
|
|
/* Print Document Apple Event */ |
|
|
static pascal OSErr |
|
|
do_ae_print_documents (const AppleEvent *pAE, AppleEvent *reply, long refcon) |
|
|
{ |
|
|
return errAEEventNotHandled; |
|
|
} |
|
|
|
|
|
|
|
|
static pascal OSErr |
|
|
do_ae_quit_application (AppleEvent* message, AppleEvent *reply, long refcon) |
|
|
{ |
|
|
#if USE_CARBON_EVENTS |
|
|
OSErr err; |
|
|
EventRef event = NULL; |
|
|
static const HICommand quit_command = {kEventAttributeNone, kHICommandQuit}; |
|
|
|
|
|
err = CreateEvent (NULL, kEventClassCommand, kEventCommandProcess, 0, |
|
|
kEventAttributeUserEvent, &event); |
|
|
if (err == noErr) |
|
|
err = SetEventParameter (event, kEventParamDirectObject, typeHICommand, |
|
|
sizeof (HICommand), &quit_command); |
|
|
if (err == noErr) |
|
|
mac_store_application_menu_event (event); |
|
|
if (event) |
|
|
ReleaseEvent (event); |
|
|
|
|
|
if (err == noErr) |
|
|
return noErr; |
|
|
else |
|
|
return errAEEventNotHandled; |
|
|
#else |
|
|
mac_store_application_menu_event (kHICommandQuit); |
|
|
|
|
|
return noErr; |
|
|
#endif |
|
|
} |
|
|
|
|
|
|
|
9213 |
#if __profile__ |
#if __profile__ |
9214 |
void |
void |
9215 |
profiler_exit_proc () |
profiler_exit_proc () |
9263 |
|
|
9264 |
initialize_applescript (); |
initialize_applescript (); |
9265 |
|
|
9266 |
init_required_apple_events (); |
init_apple_event_handler (); |
9267 |
|
|
9268 |
{ |
{ |
9269 |
char **argv; |
char **argv; |
9467 |
mouse_region = NewRgn (); |
mouse_region = NewRgn (); |
9468 |
|
|
9469 |
event_mask = everyEvent; |
event_mask = everyEvent; |
9470 |
if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) |
if (!mac_ready_for_apple_events) |
9471 |
event_mask -= highLevelEventMask; |
event_mask -= highLevelEventMask; |
9472 |
|
|
9473 |
current_tick = TickCount (); |
current_tick = TickCount (); |
10634 |
BLOCK_INPUT; |
BLOCK_INPUT; |
10635 |
|
|
10636 |
#if TARGET_API_MAC_CARBON |
#if TARGET_API_MAC_CARBON |
|
init_required_apple_events (); |
|
10637 |
|
|
10638 |
#if USE_CARBON_EVENTS |
#if USE_CARBON_EVENTS |
10639 |
#ifdef MAC_OSX |
#ifdef MAC_OSX |
10648 |
#endif /* USE_CARBON_EVENTS */ |
#endif /* USE_CARBON_EVENTS */ |
10649 |
|
|
10650 |
#ifdef MAC_OSX |
#ifdef MAC_OSX |
10651 |
|
init_apple_event_handler (); |
10652 |
|
|
10653 |
if (!inhibit_window_system) |
if (!inhibit_window_system) |
10654 |
MakeMeTheFrontProcess (); |
MakeMeTheFrontProcess (); |
10655 |
#endif |
#endif |
10680 |
Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); |
Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); |
10681 |
Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); |
Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); |
10682 |
|
|
10683 |
Qapplication = intern ("application"); staticpro (&Qapplication); |
#if USE_CARBON_EVENTS |
10684 |
Qabout = intern ("about"); staticpro (&Qabout); |
Qhicommand = intern ("hicommand"); staticpro (&Qhicommand); |
10685 |
|
#ifdef MAC_OSX |
|
#if USE_CARBON_EVENTS && defined (MAC_OSX) |
|
|
Qpreferences = intern ("preferences"); staticpro (&Qpreferences); |
|
10686 |
Qservices = intern ("services"); staticpro (&Qservices); |
Qservices = intern ("services"); staticpro (&Qservices); |
10687 |
Qpaste = intern ("paste"); staticpro (&Qpaste); |
Qpaste = intern ("paste"); staticpro (&Qpaste); |
10688 |
Qperform = intern ("perform"); staticpro (&Qperform); |
Qperform = intern ("perform"); staticpro (&Qperform); |
10689 |
#endif |
#endif |
10690 |
|
#endif |
10691 |
|
|
10692 |
#ifdef MAC_OSX |
#ifdef MAC_OSX |
10693 |
Fprovide (intern ("mac-carbon"), Qnil); |
Fprovide (intern ("mac-carbon"), Qnil); |
10696 |
staticpro (&Qreverse); |
staticpro (&Qreverse); |
10697 |
Qreverse = intern ("reverse"); |
Qreverse = intern ("reverse"); |
10698 |
|
|
|
staticpro (&Qmac_ready_for_drag_n_drop); |
|
|
Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); |
|
|
|
|
10699 |
staticpro (&x_display_name_list); |
staticpro (&x_display_name_list); |
10700 |
x_display_name_list = Qnil; |
x_display_name_list = Qnil; |
10701 |
|
|