diff options
| -rw-r--r-- | src/ChangeLog | 53 | ||||
| -rw-r--r-- | src/mactoolbox.c | 85 |
2 files changed, 130 insertions, 8 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 56676ea95d6..aaa49be146d 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,56 @@ | |||
| 1 | 2008-04-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 2 | |||
| 3 | * mac.c (create_apple_event) [TARGET_API_MAC_CARBON]: | ||
| 4 | Make function non-static. | ||
| 5 | (create_apple_event_from_event_ref) [TARGET_API_MAC_CARBON]: | ||
| 6 | Remove function. | ||
| 7 | (create_apple_event_from_drag_ref) [TARGET_API_MAC_CARBON]: | ||
| 8 | Move to mactoolbox.c. | ||
| 9 | (mac_event_parameters_to_lisp) [TARGET_API_MAC_CARBON]: New function. | ||
| 10 | |||
| 11 | * macgui.h (CGFloat) [!CGFLOAT_DEFINED]: New typedef. | ||
| 12 | (mac_rect_make): New macro. | ||
| 13 | |||
| 14 | * macterm.c (mac_draw_image_string_atsui) [MAC_OSX]: Use CGFloat | ||
| 15 | instead of float. | ||
| 16 | (mac_draw_image_string_cg) [USE_CG_TEXT_DRAWING]: Likewise. | ||
| 17 | (init_cg_color, mac_draw_line, mac_draw_cg_image, XSetForeground) | ||
| 18 | (XSetBackground) [USE_CG_DRAWING]: Likewise. | ||
| 19 | (mac_draw_image_string_atsui) [MAC_OSX]: Use mac_rect_make instead of | ||
| 20 | CGRectMake. | ||
| 21 | (mac_draw_image_string_cg) [USE_CG_TEXT_DRAWING]: Likewise. | ||
| 22 | (mac_erase_rectangle, mac_draw_cg_image, mac_fill_rectangle) | ||
| 23 | (mac_set_clip_rectangles) [USE_CG_DRAWING]: Likewise. | ||
| 24 | (XCreatePixmap, XCreatePixmapFromBitmapData): Use Window | ||
| 25 | instead of WindowRef in argument type. | ||
| 26 | (XCreatePixmap) [!MAC_OS8]: Don't call SetPortWindowPort. | ||
| 27 | (mac_invert_rectangle): Use CGContextSetBlendMode if available. | ||
| 28 | (mac_set_clip_rectangles, mac_reset_clip_rectangles): Take argument F | ||
| 29 | instead of DISPLAY. All uses changed. | ||
| 30 | (mac_handle_size_change): Don't call SET_FRAME_GARBAGED. | ||
| 31 | (x_calc_absolute_position): Simplify so as not to use | ||
| 32 | FRAME_PIXEL_WIDTH/FRAME_PIXEL_HEIGHT. | ||
| 33 | (Vmac_ts_script_language_on_focus, saved_ts_script_language_on_focus) | ||
| 34 | [USE_MAC_TSM]: Make variables static. | ||
| 35 | (mac_store_event_ref_as_apple_event) [TARGET_API_MAC_CARBON]: | ||
| 36 | Don't use create_apple_event_from_event_ref. | ||
| 37 | Use mac_event_parameters_to_lisp. | ||
| 38 | |||
| 39 | * macterm.h (XCreatePixmap, XCreatePixmapFromBitmapData): Use Window | ||
| 40 | instead of WindowRef in argument type. | ||
| 41 | (create_apple_event_from_event_ref, create_apple_event_from_drag_ref) | ||
| 42 | [TARGET_API_MAC_CARBON]: Remove externs. | ||
| 43 | (create_apple_event, mac_event_parameters_to_lisp) | ||
| 44 | [TARGET_API_MAC_CARBON]: Add externs. | ||
| 45 | |||
| 46 | * mactoolbox.c: (Vmac_ts_script_language_on_focus) | ||
| 47 | (saved_ts_script_language_on_focus) [USE_MAC_TSM]: Remove externs. | ||
| 48 | (XTread_socket) [USE_MAC_TOOLBAR]: Select window if its structure part | ||
| 49 | is clicked. | ||
| 50 | (x_activate_menubar): Remove extern for saved_menu_event_location. | ||
| 51 | (create_apple_event_from_drag_ref) [TARGET_API_MAC_CARBON]: | ||
| 52 | Move from mac.c. | ||
| 53 | |||
| 1 | 2008-04-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 54 | 2008-04-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 55 | ||
| 3 | * alloc.c [!SYSTEM_MALLOC && !SYNC_INPUT] (uninterrupt_malloc) | 56 | * alloc.c [!SYSTEM_MALLOC && !SYNC_INPUT] (uninterrupt_malloc) |
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; |