aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2005-12-10 01:49:53 +0000
committerYAMAMOTO Mitsuharu2005-12-10 01:49:53 +0000
commit6a0b5d3781c988dbb3580d64a7a453250702e10c (patch)
tree2c85715fa1a1c475eca5a3ab3e4298dd359ad9fa /src
parent28714a27a112b8caa209894aa0a40329e7bbd586 (diff)
downloademacs-6a0b5d3781c988dbb3580d64a7a453250702e10c.tar.gz
emacs-6a0b5d3781c988dbb3580d64a7a453250702e10c.zip
(Qmac_ready_for_drag_n_drop, Qapplication, Qabout)
(Qpreferences): Remove variables. (syms_of_macterm) : Don't initialize them. (Qhicommand) [USE_CARBON_EVENTS]: New variable. (syms_of_macterm) [USE_CARBON_EVENTS]: Initialize it. (init_required_apple_events, do_ae_open_application) (do_ae_print_documents, do_ae_open_documents) (do_ae_quit_application): Remove functions and prototypes. (mac_ready_for_apple_events, Qundefined, init_apple_event_handler) (mac_find_apple_event_spec): Add externs. (mac_store_application_menu_event): Remove function. (mac_store_apple_event, mac_make_lispy_event_code): New functions. (mac_handle_command_event): Create Apple event from Carbon event. Use mac_store_apple_event instead of mac_store_application_menu_event. [MAC_OSX] (mac_store_services_event): Likewise. (struct SelectionRange, SelectionRange): Remove struct and typedef. [MAC_OS8] (main): Call init_apple_event_handler instead of init_required_apple_events. (mac_initialize) [MAC_OSX]: Likewise. [!USE_CARBON_EVENTS] (mac_wait_next_event): Use mac_ready_for_apple_events instead of Qmac_ready_for_drag_n_drop.
Diffstat (limited to 'src')
-rw-r--r--src/macterm.c534
1 files changed, 137 insertions, 397 deletions
diff --git a/src/macterm.c b/src/macterm.c
index babb009f022..5d8fb1d5f51 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -622,7 +622,7 @@ atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout)
622 ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)}; 622 ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)};
623 static ATSLineLayoutOptions line_layout = 623 static ATSLineLayoutOptions line_layout =
624#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 624#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
625 kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics 625 kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics
626#else 626#else
627 kATSLineIsDisplayOnly | kATSLineFractDisable 627 kATSLineIsDisplayOnly | kATSLineFractDisable
628#endif 628#endif
@@ -8127,20 +8127,18 @@ Lisp_Object Vmac_pass_control_to_system;
8127 Carbon/Apple event handlers. */ 8127 Carbon/Apple event handlers. */
8128static struct input_event *read_socket_inev = NULL; 8128static struct input_event *read_socket_inev = NULL;
8129 8129
8130/* Set in term/mac-win.el to indicate that event loop can now generate
8131 drag and drop events. */
8132Lisp_Object Qmac_ready_for_drag_n_drop;
8133
8134Point saved_menu_event_location; 8130Point saved_menu_event_location;
8135 8131
8136/* Apple Events */ 8132/* Apple Events */
8137static void init_required_apple_events (void); 8133#if USE_CARBON_EVENTS
8138static pascal OSErr 8134static Lisp_Object Qhicommand;
8139do_ae_open_application (const AppleEvent *, AppleEvent *, long); 8135#endif
8140static pascal OSErr 8136extern int mac_ready_for_apple_events;
8141do_ae_print_documents (const AppleEvent *, AppleEvent *, long); 8137extern Lisp_Object Qundefined;
8142static pascal OSErr do_ae_open_documents (AppleEvent *, AppleEvent *, long); 8138extern void init_apple_event_handler P_ ((void));
8143static pascal OSErr do_ae_quit_application (AppleEvent *, AppleEvent *, long); 8139extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID,
8140 Lisp_Object *, Lisp_Object *,
8141 Lisp_Object *));
8144 8142
8145#if TARGET_API_MAC_CARBON 8143#if TARGET_API_MAC_CARBON
8146/* Drag and Drop */ 8144/* Drag and Drop */
@@ -8150,11 +8148,10 @@ static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL;
8150static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; 8148static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL;
8151#endif 8149#endif
8152 8150
8153static Lisp_Object Qapplication, Qabout;
8154#if USE_CARBON_EVENTS 8151#if USE_CARBON_EVENTS
8155#ifdef MAC_OSX 8152#ifdef MAC_OSX
8156extern void init_service_handler (); 8153extern void init_service_handler ();
8157static Lisp_Object Qpreferences, Qservices, Qpaste, Qperform; 8154static Lisp_Object Qservices, Qpaste, Qperform;
8158#endif 8155#endif
8159/* Window Event Handler */ 8156/* Window Event Handler */
8160static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, 8157static pascal OSStatus mac_handle_window_event (EventHandlerCallRef,
@@ -8699,179 +8696,49 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out)
8699 x_real_positions (f, &f->left_pos, &f->top_pos); 8696 x_real_positions (f, &f->left_pos, &f->top_pos);
8700} 8697}
8701 8698
8702/* Intialize AppleEvent dispatcher table for the required events. */ 8699OSErr
8703void 8700mac_store_apple_event (class, id, desc)
8704init_required_apple_events () 8701 Lisp_Object class, id;
8705{ 8702 const AEDesc *desc;
8706 OSErr err;
8707 long result;
8708
8709 /* Make sure we have apple events before starting. */
8710 err = Gestalt (gestaltAppleEventsAttr, &result);
8711 if (err != noErr)
8712 abort ();
8713
8714 if (!(result & (1 << gestaltAppleEventsPresent)))
8715 abort ();
8716
8717#if TARGET_API_MAC_CARBON
8718 err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
8719 NewAEEventHandlerUPP
8720 ((AEEventHandlerProcPtr) do_ae_open_application),
8721 0L, false);
8722#else
8723 err = AEInstallEventHandler(kCoreEventClass, kAEOpenApplication,
8724 NewAEEventHandlerProc
8725 ((AEEventHandlerProcPtr) do_ae_open_application),
8726 0L, false);
8727#endif
8728 if (err != noErr)
8729 abort ();
8730
8731#if TARGET_API_MAC_CARBON
8732 err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
8733 NewAEEventHandlerUPP
8734 ((AEEventHandlerProcPtr) do_ae_open_documents),
8735 0L, false);
8736#else
8737 err = AEInstallEventHandler(kCoreEventClass, kAEOpenDocuments,
8738 NewAEEventHandlerProc
8739 ((AEEventHandlerProcPtr) do_ae_open_documents),
8740 0L, false);
8741#endif
8742 if (err != noErr)
8743 abort ();
8744
8745#if TARGET_API_MAC_CARBON
8746 err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
8747 NewAEEventHandlerUPP
8748 ((AEEventHandlerProcPtr) do_ae_print_documents),
8749 0L, false);
8750#else
8751 err = AEInstallEventHandler(kCoreEventClass, kAEPrintDocuments,
8752 NewAEEventHandlerProc
8753 ((AEEventHandlerProcPtr) do_ae_print_documents),
8754 0L, false);
8755#endif
8756 if (err != noErr)
8757 abort ();
8758
8759#if TARGET_API_MAC_CARBON
8760 err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
8761 NewAEEventHandlerUPP
8762 ((AEEventHandlerProcPtr) do_ae_quit_application),
8763 0L, false);
8764#else
8765 err = AEInstallEventHandler(kCoreEventClass, kAEQuitApplication,
8766 NewAEEventHandlerProc
8767 ((AEEventHandlerProcPtr) do_ae_quit_application),
8768 0L, false);
8769#endif
8770 if (err != noErr)
8771 abort ();
8772}
8773
8774void
8775mac_store_application_menu_event (event)
8776#if USE_CARBON_EVENTS
8777 EventRef event;
8778#else
8779 UInt32 event;
8780#endif
8781{ 8703{
8704 OSErr err = noErr;
8782 struct input_event buf; 8705 struct input_event buf;
8783 Lisp_Object frame, entry; 8706 AEDesc *desc_copy;
8784
8785 EVENT_INIT (buf);
8786
8787 XSETFRAME (frame, mac_focus_frame (&one_mac_display_info));
8788 buf.kind = MENU_BAR_EVENT;
8789 buf.frame_or_window = frame;
8790 buf.arg = frame;
8791 kbd_buffer_store_event (&buf);
8792
8793 buf.arg = Qapplication;
8794 kbd_buffer_store_event (&buf);
8795 8707
8796#if USE_CARBON_EVENTS 8708 desc_copy = xmalloc (sizeof (AEDesc));
8797 switch (GetEventClass (event)) 8709 if (desc_copy == NULL)
8710 err = memFullErr;
8711 else
8712 err = AEDuplicateDesc (desc, desc_copy);
8713 if (err == noErr)
8798 { 8714 {
8799#ifdef MAC_OSX 8715 EVENT_INIT (buf);
8800 case kEventClassService:
8801 buf.arg = Qservices;
8802 kbd_buffer_store_event (&buf);
8803 switch (GetEventKind (event))
8804 {
8805 case kEventServicePaste:
8806 entry = Qpaste;
8807 break;
8808 8716
8809 case kEventServicePerform: 8717 buf.kind = MAC_APPLE_EVENT;
8810 { 8718 buf.x = class;
8811 OSErr err; 8719 buf.y = id;
8812 CFStringRef message; 8720 buf.code = (int)desc_copy;
8813 8721 XSETFRAME (buf.frame_or_window,
8814 err = GetEventParameter (event, kEventParamServiceMessageName, 8722 mac_focus_frame (&one_mac_display_info));
8815 typeCFStringRef, NULL, 8723 buf.arg = Qnil;
8816 sizeof (CFStringRef), NULL, &message); 8724 kbd_buffer_store_event (&buf);
8817 buf.arg = Qperform; 8725 }
8818 kbd_buffer_store_event (&buf);
8819 if (err == noErr && message)
8820 entry = intern (SDATA (cfstring_to_lisp (message)));
8821 else
8822 entry = Qnil;
8823 }
8824 break;
8825 8726
8826 default: 8727 return err;
8827 abort (); 8728}
8828 }
8829 break;
8830#endif /* MAC_OSX */
8831 case kEventClassCommand:
8832 {
8833 HICommand command;
8834 8729
8835 GetEventParameter(event, kEventParamDirectObject, typeHICommand, 8730Lisp_Object
8836 NULL, sizeof (HICommand), NULL, &command); 8731mac_make_lispy_event_code (code)
8837 switch (command.commandID) 8732 int code;
8838 { 8733{
8839 case kHICommandAbout: 8734 AEDesc *desc = (AEDesc *)code;
8840 entry = Qabout; 8735 Lisp_Object obj;
8841 break;
8842#ifdef MAC_OSX
8843 case kHICommandPreferences:
8844 entry = Qpreferences;
8845 break;
8846#endif /* MAC_OSX */
8847 case kHICommandQuit:
8848 entry = Qquit;
8849 break;
8850 default:
8851 abort ();
8852 }
8853 }
8854 break;
8855 8736
8856 default: 8737 obj = mac_aedesc_to_lisp (desc);
8857 abort (); 8738 AEDisposeDesc (desc);
8858 } 8739 xfree (desc);
8859#else /* USE_CARBON_EVENTS */
8860 switch (event)
8861 {
8862 case kHICommandAbout:
8863 entry = Qabout;
8864 break;
8865 case kHICommandQuit:
8866 entry = Qquit;
8867 break;
8868 default:
8869 abort ();
8870 }
8871#endif
8872 8740
8873 buf.arg = entry; 8741 return obj;
8874 kbd_buffer_store_event (&buf);
8875} 8742}
8876 8743
8877#if USE_CARBON_EVENTS 8744#if USE_CARBON_EVENTS
@@ -8881,28 +8748,49 @@ mac_handle_command_event (next_handler, event, data)
8881 EventRef event; 8748 EventRef event;
8882 void *data; 8749 void *data;
8883{ 8750{
8751 OSStatus result;
8752 OSErr err;
8884 HICommand command; 8753 HICommand command;
8885 OSErr result; 8754 Lisp_Object class_key, id_key, binding;
8886 8755
8887 GetEventParameter(event, kEventParamDirectObject, typeHICommand, NULL, 8756 result = CallNextEventHandler (next_handler, event);
8888 sizeof (HICommand), NULL, &command); 8757 if (result != eventNotHandledErr)
8758 return result;
8889 8759
8890 switch (command.commandID) 8760 GetEventParameter (event, kEventParamDirectObject, typeHICommand, NULL,
8891 { 8761 sizeof (HICommand), NULL, &command);
8892 case kHICommandAbout:
8893#ifdef MAC_OSX
8894 case kHICommandPreferences:
8895#endif /* MAC_OSX */
8896 result = CallNextEventHandler (next_handler, event);
8897 if (result != eventNotHandledErr)
8898 return result;
8899 8762
8900 mac_store_application_menu_event (event); 8763 if (command.commandID == 0)
8901 return noErr; 8764 return eventNotHandledErr;
8902 8765
8903 default: 8766 /* A HICommand event is mapped to an Apple event whose event class
8904 break; 8767 symbol is `hicommand' and event ID is its command ID. */
8905 } 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 }
8906 8794
8907 return eventNotHandledErr; 8795 return eventNotHandledErr;
8908} 8796}
@@ -9064,6 +8952,52 @@ mac_handle_mouse_event (next_handler, event, data)
9064 8952
9065 return eventNotHandledErr; 8953 return eventNotHandledErr;
9066} 8954}
8955
8956#ifdef MAC_OSX
8957OSErr
8958mac_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 */
9067#endif /* USE_CARBON_EVENTS */ 9001#endif /* USE_CARBON_EVENTS */
9068 9002
9069 9003
@@ -9122,159 +9056,6 @@ remove_window_handler (window)
9122#endif 9056#endif
9123} 9057}
9124 9058
9125/* Open Application Apple Event */
9126static pascal OSErr
9127do_ae_open_application(const AppleEvent *pae, AppleEvent *preply, long prefcon)
9128{
9129 return noErr;
9130}
9131
9132
9133/* Called when we receive an AppleEvent with an ID of
9134 "kAEOpenDocuments". This routine gets the direct parameter,
9135 extracts the FSSpecs in it, and puts their names on a list. */
9136#pragma options align=mac68k
9137typedef struct SelectionRange {
9138 short unused1; // 0 (not used)
9139 short lineNum; // line to select (<0 to specify range)
9140 long startRange; // start of selection range (if line < 0)
9141 long endRange; // end of selection range (if line < 0)
9142 long unused2; // 0 (not used)
9143 long theDate; // modification date/time
9144} SelectionRange;
9145#pragma options align=reset
9146
9147static pascal OSErr
9148do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon)
9149{
9150 OSErr err, err2;
9151 AEDesc the_desc;
9152 AEKeyword keyword;
9153 DescType actual_type;
9154 Size actual_size;
9155 SelectionRange position;
9156 Lisp_Object file_list = Qnil;
9157
9158 xassert (read_socket_inev);
9159
9160 err = AEGetParamDesc (message, keyDirectObject, typeAEList, &the_desc);
9161 if (err != noErr)
9162 goto descriptor_error_exit;
9163
9164 err = AEGetParamPtr (message, keyAEPosition, typeChar, &actual_type, &position, sizeof(SelectionRange), &actual_size);
9165 if (err == noErr)
9166 file_list = Fcons (list3 (make_number (position.lineNum + 1),
9167 make_number (position.startRange + 1),
9168 make_number (position.endRange + 1)),
9169 file_list);
9170
9171 /* Check to see that we got all of the required parameters from the
9172 event descriptor. For an 'odoc' event this should just be the
9173 file list. */
9174 err = AEGetAttributePtr(message, keyMissedKeywordAttr, typeWildCard,
9175 &actual_type, (Ptr) &keyword,
9176 sizeof (keyword), &actual_size);
9177 /* No error means that we found some unused parameters.
9178 errAEDescNotFound means that there are no more parameters. If we
9179 get an error code other than that, flag it. */
9180 if ((err == noErr) || (err != errAEDescNotFound))
9181 {
9182 err = errAEEventNotHandled;
9183 goto error_exit;
9184 }
9185 err = noErr;
9186
9187 /* Got all the parameters we need. Now, go through the direct
9188 object list and parse it up. */
9189 {
9190 long num_files_to_open;
9191
9192 err = AECountItems (&the_desc, &num_files_to_open);
9193 if (err == noErr)
9194 {
9195 int i;
9196
9197 /* AE file list is one based so just use that for indexing here. */
9198 for (i = 1; i <= num_files_to_open; i++)
9199 {
9200 char unix_path_name[MAXPATHLEN];
9201#ifdef MAC_OSX
9202 FSRef fref;
9203
9204 err = AEGetNthPtr (&the_desc, i, typeFSRef, &keyword,
9205 &actual_type, &fref, sizeof (FSRef),
9206 &actual_size);
9207 if (err != noErr || actual_type != typeFSRef)
9208 continue;
9209
9210 if (FSRefMakePath (&fref, unix_path_name, sizeof (unix_path_name))
9211 == noErr)
9212#else
9213 FSSpec fs;
9214
9215 err = AEGetNthPtr(&the_desc, i, typeFSS, &keyword, &actual_type,
9216 (Ptr) &fs, sizeof (fs), &actual_size);
9217 if (err != noErr) continue;
9218
9219 if (fsspec_to_posix_pathname (&fs, unix_path_name,
9220 sizeof (unix_path_name) - 1) == noErr)
9221#endif
9222 /* x-dnd functions expect undecoded filenames. */
9223 file_list = Fcons (make_unibyte_string (unix_path_name,
9224 strlen (unix_path_name)),
9225 file_list);
9226 }
9227 }
9228
9229 /* Build a DRAG_N_DROP_EVENT type event as is done in
9230 constuct_drag_n_drop in w32term.c. */
9231 if (!NILP (file_list))
9232 {
9233 struct frame *f = mac_focus_frame (&one_mac_display_info);
9234 WindowPtr wp;
9235 Lisp_Object frame;
9236
9237 read_socket_inev->kind = DRAG_N_DROP_EVENT;
9238 read_socket_inev->code = 0;
9239 read_socket_inev->modifiers = 0;
9240
9241 XSETINT (read_socket_inev->x, 0);
9242 XSETINT (read_socket_inev->y, 0);
9243
9244 XSETFRAME (frame, f);
9245 read_socket_inev->frame_or_window = Fcons (frame, file_list);
9246
9247#if 0
9248 /* Regardless of whether Emacs was suspended or in the
9249 foreground, ask it to redraw its entire screen. Otherwise
9250 parts of the screen can be left in an inconsistent
9251 state. */
9252 wp = FRAME_MAC_WINDOW (f);
9253 if (wp)
9254#if TARGET_API_MAC_CARBON
9255 {
9256 Rect r;
9257
9258 GetWindowPortBounds (wp, &r);
9259 InvalWindowRect (wp, &r);
9260 }
9261#else /* not TARGET_API_MAC_CARBON */
9262 InvalRect (&(wp->portRect));
9263#endif /* not TARGET_API_MAC_CARBON */
9264#endif
9265 }
9266 }
9267
9268error_exit:
9269 /* Nuke the coerced file list in any case */
9270 err2 = AEDisposeDesc(&the_desc);
9271
9272descriptor_error_exit:
9273 /* InvalRect(&(gFrontMacWindowP->mWP->portRect)); */
9274 return err;
9275}
9276
9277
9278#if TARGET_API_MAC_CARBON 9059#if TARGET_API_MAC_CARBON
9279static pascal OSErr 9060static pascal OSErr
9280mac_do_track_drag (DragTrackingMessage message, WindowPtr window, 9061mac_do_track_drag (DragTrackingMessage message, WindowPtr window,
@@ -9429,44 +9210,6 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon,
9429#endif 9210#endif
9430 9211
9431 9212
9432/* Print Document Apple Event */
9433static pascal OSErr
9434do_ae_print_documents (const AppleEvent *pAE, AppleEvent *reply, long refcon)
9435{
9436 return errAEEventNotHandled;
9437}
9438
9439
9440static pascal OSErr
9441do_ae_quit_application (AppleEvent* message, AppleEvent *reply, long refcon)
9442{
9443#if USE_CARBON_EVENTS
9444 OSErr err;
9445 EventRef event = NULL;
9446 static const HICommand quit_command = {kEventAttributeNone, kHICommandQuit};
9447
9448 err = CreateEvent (NULL, kEventClassCommand, kEventCommandProcess, 0,
9449 kEventAttributeUserEvent, &event);
9450 if (err == noErr)
9451 err = SetEventParameter (event, kEventParamDirectObject, typeHICommand,
9452 sizeof (HICommand), &quit_command);
9453 if (err == noErr)
9454 mac_store_application_menu_event (event);
9455 if (event)
9456 ReleaseEvent (event);
9457
9458 if (err == noErr)
9459 return noErr;
9460 else
9461 return errAEEventNotHandled;
9462#else
9463 mac_store_application_menu_event (kHICommandQuit);
9464
9465 return noErr;
9466#endif
9467}
9468
9469
9470#if __profile__ 9213#if __profile__
9471void 9214void
9472profiler_exit_proc () 9215profiler_exit_proc ()
@@ -9520,7 +9263,7 @@ main (void)
9520 9263
9521 initialize_applescript (); 9264 initialize_applescript ();
9522 9265
9523 init_required_apple_events (); 9266 init_apple_event_handler ();
9524 9267
9525 { 9268 {
9526 char **argv; 9269 char **argv;
@@ -9724,7 +9467,7 @@ mac_wait_next_event (er, sleep_time, dequeue)
9724 mouse_region = NewRgn (); 9467 mouse_region = NewRgn ();
9725 9468
9726 event_mask = everyEvent; 9469 event_mask = everyEvent;
9727 if (NILP (Fboundp (Qmac_ready_for_drag_n_drop))) 9470 if (!mac_ready_for_apple_events)
9728 event_mask -= highLevelEventMask; 9471 event_mask -= highLevelEventMask;
9729 9472
9730 current_tick = TickCount (); 9473 current_tick = TickCount ();
@@ -10891,7 +10634,6 @@ mac_initialize ()
10891 BLOCK_INPUT; 10634 BLOCK_INPUT;
10892 10635
10893#if TARGET_API_MAC_CARBON 10636#if TARGET_API_MAC_CARBON
10894 init_required_apple_events ();
10895 10637
10896#if USE_CARBON_EVENTS 10638#if USE_CARBON_EVENTS
10897#ifdef MAC_OSX 10639#ifdef MAC_OSX
@@ -10906,6 +10648,8 @@ mac_initialize ()
10906#endif /* USE_CARBON_EVENTS */ 10648#endif /* USE_CARBON_EVENTS */
10907 10649
10908#ifdef MAC_OSX 10650#ifdef MAC_OSX
10651 init_apple_event_handler ();
10652
10909 if (!inhibit_window_system) 10653 if (!inhibit_window_system)
10910 MakeMeTheFrontProcess (); 10654 MakeMeTheFrontProcess ();
10911#endif 10655#endif
@@ -10936,15 +10680,14 @@ syms_of_macterm ()
10936 Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier)); 10680 Fput (Qhyper, Qmodifier_value, make_number (hyper_modifier));
10937 Fput (Qsuper, Qmodifier_value, make_number (super_modifier)); 10681 Fput (Qsuper, Qmodifier_value, make_number (super_modifier));
10938 10682
10939 Qapplication = intern ("application"); staticpro (&Qapplication); 10683#if USE_CARBON_EVENTS
10940 Qabout = intern ("about"); staticpro (&Qabout); 10684 Qhicommand = intern ("hicommand"); staticpro (&Qhicommand);
10941 10685#ifdef MAC_OSX
10942#if USE_CARBON_EVENTS && defined (MAC_OSX)
10943 Qpreferences = intern ("preferences"); staticpro (&Qpreferences);
10944 Qservices = intern ("services"); staticpro (&Qservices); 10686 Qservices = intern ("services"); staticpro (&Qservices);
10945 Qpaste = intern ("paste"); staticpro (&Qpaste); 10687 Qpaste = intern ("paste"); staticpro (&Qpaste);
10946 Qperform = intern ("perform"); staticpro (&Qperform); 10688 Qperform = intern ("perform"); staticpro (&Qperform);
10947#endif 10689#endif
10690#endif
10948 10691
10949#ifdef MAC_OSX 10692#ifdef MAC_OSX
10950 Fprovide (intern ("mac-carbon"), Qnil); 10693 Fprovide (intern ("mac-carbon"), Qnil);
@@ -10953,9 +10696,6 @@ syms_of_macterm ()
10953 staticpro (&Qreverse); 10696 staticpro (&Qreverse);
10954 Qreverse = intern ("reverse"); 10697 Qreverse = intern ("reverse");
10955 10698
10956 staticpro (&Qmac_ready_for_drag_n_drop);
10957 Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop");
10958
10959 staticpro (&x_display_name_list); 10699 staticpro (&x_display_name_list);
10960 x_display_name_list = Qnil; 10700 x_display_name_list = Qnil;
10961 10701