aboutsummaryrefslogtreecommitdiffstats
path: root/src/mactoolbox.c
diff options
context:
space:
mode:
authorYAMAMOTO Mitsuharu2008-04-19 01:25:50 +0000
committerYAMAMOTO Mitsuharu2008-04-19 01:25:50 +0000
commit81fe843b5a3cc7708e0800aeb5bc0dbe448e800a (patch)
tree3a7c09fdc590b3e2830382ccff4e4d4f46cb90eb /src/mactoolbox.c
parente4aae3c83758bef69969b9d1cb6379fe2f1143ec (diff)
downloademacs-81fe843b5a3cc7708e0800aeb5bc0dbe448e800a.tar.gz
emacs-81fe843b5a3cc7708e0800aeb5bc0dbe448e800a.zip
(Vmac_ts_script_language_on_focus)
(saved_ts_script_language_on_focus) [USE_MAC_TSM]: Remove externs. (XTread_socket) [USE_MAC_TOOLBAR]: Select window if its structure part is clicked. (x_activate_menubar): Remove extern for saved_menu_event_location. (create_apple_event_from_drag_ref) [TARGET_API_MAC_CARBON]: Move from mac.c.
Diffstat (limited to 'src/mactoolbox.c')
-rw-r--r--src/mactoolbox.c85
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;
120extern Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event; 120extern Lisp_Object Qupdate_active_input_area, Qunicode_for_key_event;
121extern Lisp_Object Vmac_ts_active_input_overlay; 121extern Lisp_Object Vmac_ts_active_input_overlay;
122extern Lisp_Object Qbefore_string; 122extern Lisp_Object Qbefore_string;
123extern Lisp_Object Vmac_ts_script_language_on_focus;
124extern Lisp_Object saved_ts_script_language_on_focus;
125#endif 123#endif
126 124
127static int mac_event_to_emacs_modifiers P_ ((EventRef)); 125static 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));
5704static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL; 5704static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL;
5705static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; 5705static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL;
5706 5706
5707static OSErr
5708create_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
5707static void 5776static void
5708mac_store_drag_event (window, mouse_pos, modifiers, desc) 5777mac_store_drag_event (window, mouse_pos, modifiers, desc)
5709 WindowRef window; 5778 WindowRef window;