diff options
Diffstat (limited to 'src/mactoolbox.c')
| -rw-r--r-- | src/mactoolbox.c | 85 |
1 files changed, 77 insertions, 8 deletions
diff --git a/src/mactoolbox.c b/src/mactoolbox.c index 6b4d22049a9..71abce23fe0 100644 --- a/src/mactoolbox.c +++ b/src/mactoolbox.c | |||
| @@ -120,8 +120,6 @@ extern Lisp_Object Qtext_input; | |||
| 120 | extern Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; | 120 | extern Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; |
| 121 | extern Lisp_Object Vmac_ts_active_input_overlay; | 121 | extern Lisp_Object Vmac_ts_active_input_overlay; |
| 122 | extern Lisp_Object Qbefore_string; | 122 | extern Lisp_Object Qbefore_string; |
| 123 | extern Lisp_Object Vmac_ts_script_language_on_focus; | ||
| 124 | extern Lisp_Object saved_ts_script_language_on_focus; | ||
| 125 | #endif | 123 | #endif |
| 126 | 124 | ||
| 127 | static int mac_event_to_emacs_modifiers P_ ((EventRef)); | 125 | static int mac_event_to_emacs_modifiers P_ ((EventRef)); |
| @@ -606,15 +604,15 @@ install_application_handler () | |||
| 606 | #if USE_MAC_TSM | 604 | #if USE_MAC_TSM |
| 607 | if (err == noErr) | 605 | if (err == noErr) |
| 608 | { | 606 | { |
| 609 | static const EventTypeSpec spec[] = | 607 | static const EventTypeSpec specs[] = |
| 610 | {{kEventClassTextInput, kEventTextInputUpdateActiveInputArea}, | 608 | {{kEventClassTextInput, kEventTextInputUpdateActiveInputArea}, |
| 611 | {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}, | 609 | {kEventClassTextInput, kEventTextInputUnicodeForKeyEvent}, |
| 612 | {kEventClassTextInput, kEventTextInputOffsetToPos}}; | 610 | {kEventClassTextInput, kEventTextInputOffsetToPos}}; |
| 613 | 611 | ||
| 614 | err = InstallApplicationEventHandler (NewEventHandlerUPP | 612 | err = InstallApplicationEventHandler (NewEventHandlerUPP |
| 615 | (mac_handle_text_input_event), | 613 | (mac_handle_text_input_event), |
| 616 | GetEventTypeCount (spec), | 614 | GetEventTypeCount (specs), |
| 617 | spec, NULL, NULL); | 615 | specs, NULL, NULL); |
| 618 | } | 616 | } |
| 619 | #endif | 617 | #endif |
| 620 | 618 | ||
| @@ -3009,8 +3007,8 @@ mac_event_to_emacs_modifiers (EventRef eventRef) | |||
| 3009 | GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, | 3007 | GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32, NULL, |
| 3010 | sizeof (UInt32), NULL, &mods); | 3008 | sizeof (UInt32), NULL, &mods); |
| 3011 | class = GetEventClass (eventRef); | 3009 | class = GetEventClass (eventRef); |
| 3012 | if (!NILP (Vmac_emulate_three_button_mouse) && | 3010 | if (!NILP (Vmac_emulate_three_button_mouse) |
| 3013 | (class == kEventClassMouse || class == kEventClassCommand)) | 3011 | && (class == kEventClassMouse || class == kEventClassCommand)) |
| 3014 | { | 3012 | { |
| 3015 | mods &= ~(optionKey | cmdKey); | 3013 | mods &= ~(optionKey | cmdKey); |
| 3016 | } | 3014 | } |
| @@ -3560,6 +3558,9 @@ XTread_socket (sd, expected, hold_quit) | |||
| 3560 | OSStatus err; | 3558 | OSStatus err; |
| 3561 | HIViewRef ch; | 3559 | HIViewRef ch; |
| 3562 | 3560 | ||
| 3561 | if (FrontNonFloatingWindow () != window_ptr) | ||
| 3562 | SelectWindow (window_ptr); | ||
| 3563 | |||
| 3563 | err = HIViewGetViewForMouseEvent (HIViewGetRoot (window_ptr), | 3564 | err = HIViewGetViewForMouseEvent (HIViewGetRoot (window_ptr), |
| 3564 | eventRef, &ch); | 3565 | eventRef, &ch); |
| 3565 | /* This doesn't work on Mac OS X 10.2. */ | 3566 | /* This doesn't work on Mac OS X 10.2. */ |
| @@ -4248,7 +4249,6 @@ x_activate_menubar (f) | |||
| 4248 | { | 4249 | { |
| 4249 | SInt32 menu_choice; | 4250 | SInt32 menu_choice; |
| 4250 | SInt16 menu_id, menu_item; | 4251 | SInt16 menu_id, menu_item; |
| 4251 | extern Point saved_menu_event_location; | ||
| 4252 | 4252 | ||
| 4253 | set_frame_menubar (f, 0, 1); | 4253 | set_frame_menubar (f, 0, 1); |
| 4254 | BLOCK_INPUT; | 4254 | BLOCK_INPUT; |
| @@ -5704,6 +5704,75 @@ static pascal OSErr mac_do_receive_drag P_ ((WindowRef, void *, DragRef)); | |||
| 5704 | static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL; | 5704 | static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL; |
| 5705 | static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; | 5705 | static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; |
| 5706 | 5706 | ||
| 5707 | static OSErr | ||
| 5708 | create_apple_event_from_drag_ref (drag, num_types, types, result) | ||
| 5709 | DragRef drag; | ||
| 5710 | UInt32 num_types; | ||
| 5711 | const FlavorType *types; | ||
| 5712 | AppleEvent *result; | ||
| 5713 | { | ||
| 5714 | OSErr err; | ||
| 5715 | UInt16 num_items; | ||
| 5716 | AppleEvent items; | ||
| 5717 | long index; | ||
| 5718 | char *buf = NULL; | ||
| 5719 | |||
| 5720 | err = CountDragItems (drag, &num_items); | ||
| 5721 | if (err != noErr) | ||
| 5722 | return err; | ||
| 5723 | err = AECreateList (NULL, 0, false, &items); | ||
| 5724 | if (err != noErr) | ||
| 5725 | return err; | ||
| 5726 | |||
| 5727 | for (index = 1; index <= num_items; index++) | ||
| 5728 | { | ||
| 5729 | ItemReference item; | ||
| 5730 | DescType desc_type = typeNull; | ||
| 5731 | Size size; | ||
| 5732 | |||
| 5733 | err = GetDragItemReferenceNumber (drag, index, &item); | ||
| 5734 | if (err == noErr) | ||
| 5735 | { | ||
| 5736 | int i; | ||
| 5737 | |||
| 5738 | for (i = 0; i < num_types; i++) | ||
| 5739 | { | ||
| 5740 | err = GetFlavorDataSize (drag, item, types[i], &size); | ||
| 5741 | if (err == noErr) | ||
| 5742 | { | ||
| 5743 | buf = xrealloc (buf, size); | ||
| 5744 | err = GetFlavorData (drag, item, types[i], buf, &size, 0); | ||
| 5745 | } | ||
| 5746 | if (err == noErr) | ||
| 5747 | { | ||
| 5748 | desc_type = types[i]; | ||
| 5749 | break; | ||
| 5750 | } | ||
| 5751 | } | ||
| 5752 | } | ||
| 5753 | err = AEPutPtr (&items, index, desc_type, | ||
| 5754 | desc_type != typeNull ? buf : NULL, | ||
| 5755 | desc_type != typeNull ? size : 0); | ||
| 5756 | if (err != noErr) | ||
| 5757 | break; | ||
| 5758 | } | ||
| 5759 | if (buf) | ||
| 5760 | xfree (buf); | ||
| 5761 | |||
| 5762 | if (err == noErr) | ||
| 5763 | { | ||
| 5764 | err = create_apple_event (0, 0, result); /* Dummy class and ID. */ | ||
| 5765 | if (err == noErr) | ||
| 5766 | err = AEPutParamDesc (result, keyDirectObject, &items); | ||
| 5767 | if (err != noErr) | ||
| 5768 | AEDisposeDesc (result); | ||
| 5769 | } | ||
| 5770 | |||
| 5771 | AEDisposeDesc (&items); | ||
| 5772 | |||
| 5773 | return err; | ||
| 5774 | } | ||
| 5775 | |||
| 5707 | static void | 5776 | static void |
| 5708 | mac_store_drag_event (window, mouse_pos, modifiers, desc) | 5777 | mac_store_drag_event (window, mouse_pos, modifiers, desc) |
| 5709 | WindowRef window; | 5778 | WindowRef window; |