diff options
| author | Miles Bader | 2006-05-10 20:42:41 +0000 |
|---|---|---|
| committer | Miles Bader | 2006-05-10 20:42:41 +0000 |
| commit | 3bcf2b084a0dd1ff0399480d57b87e01cfe061dc (patch) | |
| tree | 355c68cda5a5c9c73824840df3cdae6320017283 /src | |
| parent | 0ea38cf9dca8f2b148d78f638eed17e8896984af (diff) | |
| parent | d105bfecce2288cd99f591382586a22a4ce1b6f2 (diff) | |
| download | emacs-3bcf2b084a0dd1ff0399480d57b87e01cfe061dc.tar.gz emacs-3bcf2b084a0dd1ff0399480d57b87e01cfe061dc.zip | |
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-60
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 259-273)
- Update from CVS
- lisp/replace.el (occur-engine): Bind `inhibit-field-text-motion' to t
- Merge from gnus--rel--5.10
- Rename "field-at-point" to "field-at-pos"
- (comint-insert-input): Remove redundant calls to setq and goto-char
* gnus--rel--5.10 (patch 99-100)
- Merge from emacs--devo--0
- Update from CVS
Diffstat (limited to 'src')
| -rw-r--r-- | src/.gdbinit | 155 | ||||
| -rw-r--r-- | src/ChangeLog | 200 | ||||
| -rw-r--r-- | src/callproc.c | 2 | ||||
| -rw-r--r-- | src/coding.h | 3 | ||||
| -rw-r--r-- | src/image.c | 26 | ||||
| -rw-r--r-- | src/keyboard.c | 3 | ||||
| -rw-r--r-- | src/keymap.c | 13 | ||||
| -rw-r--r-- | src/mac.c | 125 | ||||
| -rw-r--r-- | src/macfns.c | 80 | ||||
| -rw-r--r-- | src/macgui.h | 7 | ||||
| -rw-r--r-- | src/macmenu.c | 2 | ||||
| -rw-r--r-- | src/macselect.c | 234 | ||||
| -rw-r--r-- | src/macterm.c | 684 | ||||
| -rw-r--r-- | src/macterm.h | 8 | ||||
| -rw-r--r-- | src/minibuf.c | 4 | ||||
| -rw-r--r-- | src/process.c | 10 | ||||
| -rw-r--r-- | src/sound.c | 71 | ||||
| -rw-r--r-- | src/termhooks.h | 6 | ||||
| -rw-r--r-- | src/xdisp.c | 18 | ||||
| -rw-r--r-- | src/xfaces.c | 10 |
20 files changed, 1242 insertions, 419 deletions
diff --git a/src/.gdbinit b/src/.gdbinit index 881a11dc8c0..7de361fddfb 100644 --- a/src/.gdbinit +++ b/src/.gdbinit | |||
| @@ -211,6 +211,7 @@ define pitx | |||
| 211 | printf "vpos=%d hpos=%d", $it->vpos, $it->hpos, | 211 | printf "vpos=%d hpos=%d", $it->vpos, $it->hpos, |
| 212 | printf " y=%d lvy=%d", $it->current_y, $it->last_visible_y | 212 | printf " y=%d lvy=%d", $it->current_y, $it->last_visible_y |
| 213 | printf " x=%d vx=%d-%d", $it->current_x, $it->first_visible_x, $it->last_visible_x | 213 | printf " x=%d vx=%d-%d", $it->current_x, $it->first_visible_x, $it->last_visible_x |
| 214 | printf " w=%d", $it->pixel_width | ||
| 214 | printf " a+d=%d+%d=%d", $it->ascent, $it->descent, $it->ascent+$it->descent | 215 | printf " a+d=%d+%d=%d", $it->ascent, $it->descent, $it->ascent+$it->descent |
| 215 | printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent | 216 | printf " max=%d+%d=%d", $it->max_ascent, $it->max_descent, $it->max_ascent+$it->max_descent |
| 216 | printf "\n" | 217 | printf "\n" |
| @@ -544,6 +545,10 @@ end | |||
| 544 | define xframe | 545 | define xframe |
| 545 | xgetptr $ | 546 | xgetptr $ |
| 546 | print (struct frame *) $ptr | 547 | print (struct frame *) $ptr |
| 548 | xgetptr $->name | ||
| 549 | set $ptr = (struct Lisp_String *) $ptr | ||
| 550 | xprintstr $ptr | ||
| 551 | echo \n | ||
| 547 | end | 552 | end |
| 548 | document xframe | 553 | document xframe |
| 549 | Print $ as a frame pointer, assuming it is an Emacs Lisp frame value. | 554 | Print $ as a frame pointer, assuming it is an Emacs Lisp frame value. |
| @@ -676,6 +681,31 @@ document xcdr | |||
| 676 | Print the cdr of $, assuming it is an Emacs Lisp pair. | 681 | Print the cdr of $, assuming it is an Emacs Lisp pair. |
| 677 | end | 682 | end |
| 678 | 683 | ||
| 684 | define xlist | ||
| 685 | xgetptr $ | ||
| 686 | set $cons = (struct Lisp_Cons *) $ptr | ||
| 687 | xgetptr Qnil | ||
| 688 | set $nil = $ptr | ||
| 689 | set $i = 0 | ||
| 690 | while $cons != $nil && $i < 10 | ||
| 691 | p/x $cons->car | ||
| 692 | xpr | ||
| 693 | xgetptr $cons->u.cdr | ||
| 694 | set $cons = (struct Lisp_Cons *) $ptr | ||
| 695 | set $i = $i + 1 | ||
| 696 | printf "---\n" | ||
| 697 | end | ||
| 698 | if $cons == $nil | ||
| 699 | printf "nil\n" | ||
| 700 | else | ||
| 701 | printf "...\n" | ||
| 702 | p $ptr | ||
| 703 | end | ||
| 704 | end | ||
| 705 | document xlist | ||
| 706 | Print $ assuming it is a list. | ||
| 707 | end | ||
| 708 | |||
| 679 | define xfloat | 709 | define xfloat |
| 680 | xgetptr $ | 710 | xgetptr $ |
| 681 | print ((struct Lisp_Float *) $ptr)->u.data | 711 | print ((struct Lisp_Float *) $ptr)->u.data |
| @@ -694,6 +724,108 @@ document xscrollbar | |||
| 694 | Print $ as a scrollbar pointer. | 724 | Print $ as a scrollbar pointer. |
| 695 | end | 725 | end |
| 696 | 726 | ||
| 727 | define xpr | ||
| 728 | xtype | ||
| 729 | if $type == Lisp_Int | ||
| 730 | xint | ||
| 731 | end | ||
| 732 | if $type == Lisp_Symbol | ||
| 733 | xsymbol | ||
| 734 | end | ||
| 735 | if $type == Lisp_String | ||
| 736 | xstring | ||
| 737 | end | ||
| 738 | if $type == Lisp_Cons | ||
| 739 | xcons | ||
| 740 | end | ||
| 741 | if $type == Lisp_Float | ||
| 742 | xfloat | ||
| 743 | end | ||
| 744 | if $type == Lisp_Misc | ||
| 745 | set $misc = (enum Lisp_Misc_Type) (((struct Lisp_Free *) $ptr)->type) | ||
| 746 | if $misc == Lisp_Misc_Free | ||
| 747 | xmiscfree | ||
| 748 | end | ||
| 749 | if $misc == Lisp_Misc_Boolfwd | ||
| 750 | xboolfwd | ||
| 751 | end | ||
| 752 | if $misc == Lisp_Misc_Marker | ||
| 753 | xmarker | ||
| 754 | end | ||
| 755 | if $misc == Lisp_Misc_Intfwd | ||
| 756 | xintfwd | ||
| 757 | end | ||
| 758 | if $misc == Lisp_Misc_Boolfwd | ||
| 759 | xboolfwd | ||
| 760 | end | ||
| 761 | if $misc == Lisp_Misc_Objfwd | ||
| 762 | xobjfwd | ||
| 763 | end | ||
| 764 | if $misc == Lisp_Misc_Buffer_Objfwd | ||
| 765 | xbufobjfwd | ||
| 766 | end | ||
| 767 | if $misc == Lisp_Misc_Buffer_Local_Value | ||
| 768 | xbuflocal | ||
| 769 | end | ||
| 770 | # if $misc == Lisp_Misc_Some_Buffer_Local_Value | ||
| 771 | # xvalue | ||
| 772 | # end | ||
| 773 | if $misc == Lisp_Misc_Overlay | ||
| 774 | xoverlay | ||
| 775 | end | ||
| 776 | if $misc == Lisp_Misc_Kboard_Objfwd | ||
| 777 | xkbobjfwd | ||
| 778 | end | ||
| 779 | # if $misc == Lisp_Misc_Save_Value | ||
| 780 | # xsavevalue | ||
| 781 | # end | ||
| 782 | end | ||
| 783 | if $type == Lisp_Vectorlike | ||
| 784 | set $size = ((struct Lisp_Vector *) $ptr)->size | ||
| 785 | if ($size & PVEC_FLAG) | ||
| 786 | set $vec = (enum pvec_type) ($size & PVEC_TYPE_MASK) | ||
| 787 | if $vec == PVEC_NORMAL_VECTOR | ||
| 788 | xvector | ||
| 789 | end | ||
| 790 | if $vec == PVEC_PROCESS | ||
| 791 | xprocess | ||
| 792 | end | ||
| 793 | if $vec == PVEC_FRAME | ||
| 794 | xframe | ||
| 795 | end | ||
| 796 | if $vec == PVEC_COMPILED | ||
| 797 | xcompiled | ||
| 798 | end | ||
| 799 | if $vec == PVEC_WINDOW | ||
| 800 | xwindow | ||
| 801 | end | ||
| 802 | if $vec == PVEC_WINDOW_CONFIGURATION | ||
| 803 | xwinconfig | ||
| 804 | end | ||
| 805 | if $vec == PVEC_SUBR | ||
| 806 | xsubr | ||
| 807 | end | ||
| 808 | if $vec == PVEC_CHAR_TABLE | ||
| 809 | xchartable | ||
| 810 | end | ||
| 811 | if $vec == PVEC_BOOL_VECTOR | ||
| 812 | xboolvector | ||
| 813 | end | ||
| 814 | if $vec == PVEC_BUFFER | ||
| 815 | xbuffer | ||
| 816 | end | ||
| 817 | if $vec == PVEC_HASH_TABLE | ||
| 818 | xhashtable | ||
| 819 | end | ||
| 820 | else | ||
| 821 | xvector | ||
| 822 | end | ||
| 823 | end | ||
| 824 | end | ||
| 825 | document xpr | ||
| 826 | Print $ as a lisp object of any type. | ||
| 827 | end | ||
| 828 | |||
| 697 | define xprintstr | 829 | define xprintstr |
| 698 | set $data = $arg0->data | 830 | set $data = $arg0->data |
| 699 | output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~gdb_array_mark_flag : $arg0->size_byte) | 831 | output ($arg0->size > 1000) ? 0 : ($data[0])@($arg0->size_byte < 0 ? $arg0->size & ~gdb_array_mark_flag : $arg0->size_byte) |
| @@ -739,7 +871,7 @@ define xbacktrace | |||
| 739 | xgettype (*$bt->function) | 871 | xgettype (*$bt->function) |
| 740 | if $type == Lisp_Symbol | 872 | if $type == Lisp_Symbol |
| 741 | xprintsym (*$bt->function) | 873 | xprintsym (*$bt->function) |
| 742 | echo \n | 874 | printf " (0x%x)\n", *$bt->args |
| 743 | else | 875 | else |
| 744 | printf "0x%x ", *$bt->function | 876 | printf "0x%x ", *$bt->function |
| 745 | if $type == Lisp_Vectorlike | 877 | if $type == Lisp_Vectorlike |
| @@ -760,6 +892,27 @@ document xbacktrace | |||
| 760 | an error was signaled. | 892 | an error was signaled. |
| 761 | end | 893 | end |
| 762 | 894 | ||
| 895 | define which | ||
| 896 | set debug_print (which_symbols ($arg0)) | ||
| 897 | end | ||
| 898 | document which | ||
| 899 | Print symbols which references a given lisp object, | ||
| 900 | either as its symbol value or symbol function. | ||
| 901 | end | ||
| 902 | |||
| 903 | define xbytecode | ||
| 904 | set $bt = byte_stack_list | ||
| 905 | while $bt | ||
| 906 | xgettype ($bt->byte_string) | ||
| 907 | printf "0x%x => ", $bt->byte_string | ||
| 908 | which $bt->byte_string | ||
| 909 | set $bt = $bt->next | ||
| 910 | end | ||
| 911 | end | ||
| 912 | document xbytecode | ||
| 913 | Print a backtrace of the byte code stack. | ||
| 914 | end | ||
| 915 | |||
| 763 | # Show Lisp backtrace after normal backtrace. | 916 | # Show Lisp backtrace after normal backtrace. |
| 764 | define hookpost-backtrace | 917 | define hookpost-backtrace |
| 765 | set $bt = backtrace_list | 918 | set $bt = backtrace_list |
diff --git a/src/ChangeLog b/src/ChangeLog index f68510f2fb4..d7e8293ad27 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,203 @@ | |||
| 1 | 2006-05-10 Kenichi Handa <handa@m17n.org> | ||
| 2 | |||
| 3 | * xfaces.c (realize_default_face) [HAVE_X_WINDOWS]: If the font | ||
| 4 | chosen for the default face was different from the frame font, | ||
| 5 | adjust the frame font. | ||
| 6 | |||
| 7 | 2006-05-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 8 | |||
| 9 | * image.c (Qduration) [MAC_OS]: Undo previous change. | ||
| 10 | (syms_of_image) [MAC_OS]: Likewise. | ||
| 11 | [MAC_OS] (gif_load): Emulate Graphic Control Extension block. | ||
| 12 | |||
| 13 | * macfns.c (x_to_mac_color): Fix shift amount change. | ||
| 14 | [USE_MAC_FONT_PANEL] (mac_set_font): Use x_get_focus_frame. | ||
| 15 | [USE_MAC_FONT_PANEL] (Fmac_set_font_panel_visibility): Doc fix. | ||
| 16 | |||
| 17 | * macselect.c (Vmac_service_selection) [MAC_OSX]: Rename from | ||
| 18 | Vmac_services_selection. All uses changed. | ||
| 19 | (mac_store_service_event): Rename from mac_store_services_event in | ||
| 20 | extern and calls. | ||
| 21 | |||
| 22 | * macterm.c (Qservice) [MAC_OSX]: Rename from Qservices. All uses | ||
| 23 | changed. | ||
| 24 | [MAC_OSX] (mac_store_service_event): Rename from | ||
| 25 | mac_store_services_event. All callers changed. | ||
| 26 | [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): Add args | ||
| 27 | FACE_ID and C. All callers changed. | ||
| 28 | (x_free_frame_resources) [USE_MAC_FONT_PANEL]: Call | ||
| 29 | mac_set_font_info_for_selection when focus frame is destroyed. | ||
| 30 | (XTread_socket): Revert to FrontNonFloatingWindow/FrontWindow. | ||
| 31 | |||
| 32 | * macterm.h (mac_set_font_info_for_selection): Add 2nd and 3rd | ||
| 33 | args in extern. | ||
| 34 | |||
| 35 | 2006-05-09 Chong Yidong <cyd@stupidchicken.com> | ||
| 36 | |||
| 37 | * keymap.c (describe_map): Avoid generating duplicate entries if | ||
| 38 | the shadowed binding has the same definition. | ||
| 39 | |||
| 40 | 2006-05-09 Kenichi Handa <handa@m17n.org> | ||
| 41 | |||
| 42 | * keymap.c (push_key_description): Handle invalid character key. | ||
| 43 | |||
| 44 | 2006-05-08 Kenichi Handa <handa@m17n.org> | ||
| 45 | |||
| 46 | * callproc.c (Fcall_process): Use system_eol_type for encoding | ||
| 47 | arguments if eol_type is not yet decided. | ||
| 48 | |||
| 49 | * coding.h (system_eol_type): Extern it. | ||
| 50 | |||
| 51 | * coding.c (setup_coding_system): For invalid coding-system, set | ||
| 52 | coding->eol_type to CODING_EOL_UNDECIDED. | ||
| 53 | (encode_coding): Cancel previous change. | ||
| 54 | (shrink_encoding_region): Likewise. | ||
| 55 | (code_convert_region1): Likewise. | ||
| 56 | (code_convert_string1): Likewise. | ||
| 57 | (code_convert_string_norecord): Likewise. | ||
| 58 | |||
| 59 | * fileio.c (choose_write_coding_system): Use system_eol_type for | ||
| 60 | encoding if eol_type is not yet decided. | ||
| 61 | |||
| 62 | * process.c (setup_process_coding_systems): Use system_eol_type | ||
| 63 | for encoding if eol_type is not yet decided. | ||
| 64 | (read_process_output): Likewise. | ||
| 65 | (send_process): Likewise. | ||
| 66 | |||
| 67 | 2006-05-07 Juanma Barranquero <lekktu@gmail.com> | ||
| 68 | |||
| 69 | * minibuf.c (syms_of_minibuf) <history-length>: Fix typo in doc. | ||
| 70 | |||
| 71 | 2006-05-07 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 72 | |||
| 73 | * mac.c (Fmac_clear_font_name_table): Move defun to macfns.c. | ||
| 74 | (syms_of_mac): Likewise for defsubr. | ||
| 75 | |||
| 76 | * macfns.c (mac_set_font): New function. | ||
| 77 | (mac_frame_parm_handlers, syms_of_macfns): Replace x_set_font with it. | ||
| 78 | (mac_window) [TARGET_API_MAC_CARBON && MAC_OSX]: Specify | ||
| 79 | kWindowToolbarButtonAttribute when creating window. | ||
| 80 | (Fmac_clear_font_name_table): Move from macfns.c. | ||
| 81 | (syms_of_macfns): Likewise for defsubr. | ||
| 82 | [USE_MAC_FONT_PANEL] (Fmac_set_font_panel_visibility): New defun. | ||
| 83 | (syms_of_macfns) [USE_MAC_FONT_PANEL]: Defsubr it. | ||
| 84 | |||
| 85 | * macgui.h (USE_MAC_FONT_PANEL): Define to 1 if USE_ATSUI is set | ||
| 86 | and build is done on Mac OS X 10.2 and later. | ||
| 87 | |||
| 88 | * macselect.c (mac_do_receive_drag): Remove unused variable `index'. | ||
| 89 | (mac_store_services_event): Change return type in extern. | ||
| 90 | |||
| 91 | * macterm.c (XLoadQueryFont) [USE_ATSUI]: Set font->mac_fontnum to | ||
| 92 | FMFontFamily value. | ||
| 93 | [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): New function. | ||
| 94 | (x_new_focus_frame) [USE_MAC_FONT_PANEL]: Use it. | ||
| 95 | (QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic): Add extern. | ||
| 96 | (QWindow) [MAC_OSX]: Likewise. | ||
| 97 | (Qfont) [USE_MAC_FONT_PANEL]: Likewise. | ||
| 98 | (Vmac_atsu_font_table) [USE_ATSUI]: New variable. | ||
| 99 | (syms_of_macterm) [USE_ATSUI]: Defvar it. | ||
| 100 | (Qtoolbar_switch_mode) [MAC_OSX]: New variable. | ||
| 101 | (Qpanel_closed, Qselection) [USE_MAC_FONT_PANEL]: Likewise. | ||
| 102 | (syms_of_macterm): Intern and staticpro them. | ||
| 103 | (init_font_name_table) [USE_ATSUI]: Add data to Vmac_atsu_font_table. | ||
| 104 | [TARGET_API_MAC_CARBON] (mac_store_event_ref_as_apple_event): New | ||
| 105 | function. | ||
| 106 | [USE_CARBON_EVENTS] (mac_handle_command_event): Use it. | ||
| 107 | [MAC_OSX] (mac_store_services_event): Likewise. | ||
| 108 | [USE_CARBON_EVENTS] (mac_handle_window_event) [MAC_OSX]: Handle | ||
| 109 | kEventWindowToolbarSwitchMode event. | ||
| 110 | (install_window_handler) [USE_CARBON_EVENTS && MAC_OSX]: Register it. | ||
| 111 | [MAC_OSX] (mac_store_services_event): Change return type to OSStatus. | ||
| 112 | [USE_MAC_FONT_PANEL] (mac_handle_font_event): New function. | ||
| 113 | (install_window_handler) [USE_MAC_FONT_PANEL]: Install it. | ||
| 114 | (XTread_socket): Select window on mouse click if x_focus_frame is NULL. | ||
| 115 | |||
| 116 | * macterm.h (mac_set_font_info_for_selection): Add extern. | ||
| 117 | |||
| 118 | 2006-05-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 119 | |||
| 120 | * image.c (Qduration) [MAC_OS]: New variable. | ||
| 121 | (syms_of_image) [MAC_OS]: Intern and staticpro it. | ||
| 122 | [MAC_OS] (gif_load): Save image extension data in img->data.lisp_val. | ||
| 123 | [MAC_OSX] (image_load_quartz2d): Use cfstring_create_with_utf8_cstring | ||
| 124 | instead of cfstring_create_with_string. | ||
| 125 | |||
| 126 | 2006-05-06 Kim F. Storm <storm@cua.dk> | ||
| 127 | |||
| 128 | * .gdbinit (xframe): Print frame name. | ||
| 129 | (xlist): New command to print a list (max 10 elements). | ||
| 130 | (xpr): Print lisp object of any type. | ||
| 131 | (pitx): Print it->pixel_width. | ||
| 132 | |||
| 133 | 2006-05-05 Kenichi Handa <handa@m17n.org> | ||
| 134 | |||
| 135 | * xdisp.c (handle_composition_prop): Fix for the case of empty | ||
| 136 | composition component. | ||
| 137 | |||
| 138 | 2006-05-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 139 | |||
| 140 | * keyboard.c (make_lispy_event) [MAC_OS]: Get Apple event info | ||
| 141 | from event->arg. | ||
| 142 | |||
| 143 | * termhooks.h (enum event_kind) [MAC_OS]: Update comment for | ||
| 144 | MAC_APPLE_EVENT. | ||
| 145 | |||
| 146 | * macterm.h (mac_make_lispy_event_code): Remove extern. | ||
| 147 | (mac_post_mouse_moved_event): Add extern. | ||
| 148 | (mac_aelist_to_lisp, mac_aedesc_to_lisp): Change arg 1 to | ||
| 149 | `const AEDesc *' in externs. | ||
| 150 | (create_apple_event_from_drag_ref) [TARGET_API_MAC_CARBON]: New extern. | ||
| 151 | |||
| 152 | * mac.c (mac_aelist_to_lisp, mac_aedesc_to_lisp): Change arg 1 to | ||
| 153 | `const AEDesc *'. | ||
| 154 | [TARGET_API_MAC_CARBON] (create_apple_event): New function. | ||
| 155 | [TARGET_API_MAC_CARBON] (create_apple_event_from_event_ref): Use it. | ||
| 156 | Use xrealloc instead of repeated xmalloc/xfree. | ||
| 157 | [TARGET_API_MAC_CARBON] (create_apple_event_from_drag_ref): New | ||
| 158 | function. | ||
| 159 | |||
| 160 | * macmenu.c (restore_menu_items, cleanup_popup_menu): Return a value. | ||
| 161 | |||
| 162 | * macselect.c: Update copyright year. | ||
| 163 | (mac_store_apple_event): Change return type to void in extern. | ||
| 164 | (mac_handle_apple_event): Don't get return value from | ||
| 165 | mac_store_apple_event. | ||
| 166 | [TARGET_API_MAC_CARBON] (Vmac_dnd_known_types): New variable. | ||
| 167 | (syms_of_macselect) [TARGET_API_MAC_CARBON]: Defvar it. | ||
| 168 | [TARGET_API_MAC_CARBON] (mac_do_track_drag): Move function from | ||
| 169 | macterm.c. Use Vmac_dnd_known_types as acceptable flavors. | ||
| 170 | [TARGET_API_MAC_CARBON] (mac_do_receive_drag): Likewise. New | ||
| 171 | implementation using create_apple_event_from_drag_ref. | ||
| 172 | [TARGET_API_MAC_CARBON] (mac_do_track_dragUPP) | ||
| 173 | (mac_do_receive_dragUPP): Move variables from macterm.c. | ||
| 174 | (install_drag_handler, remove_drag_handler): New functions. | ||
| 175 | |||
| 176 | * macterm.c (XTread_socket) [TARGET_API_MAC_CARBON]: Try window | ||
| 177 | path select also for proxy icon click. | ||
| 178 | [TARGET_API_MAC_CARBON] (mac_post_mouse_moved_event): New function. | ||
| 179 | [USE_TOOLKIT_SCROLL_BARS] (scroll_bar_timer_callback): Use it. | ||
| 180 | (xlfdpat_create): Remove unused label `error' and trailing sentences. | ||
| 181 | (mac_do_track_drag, mac_do_receive_drag): Move functions to macselect.c. | ||
| 182 | (mac_do_track_dragUPP, mac_do_receive_dragUPP): Move variables to | ||
| 183 | macselect.c. | ||
| 184 | (install_drag_handler, remove_drag_handler): Add extern. | ||
| 185 | (mac_store_apple_event): Change return type to void. All uses changed. | ||
| 186 | Create Lisp object from Apple event and store it into input event. | ||
| 187 | (mac_make_lispy_event_code): Remove function. | ||
| 188 | [TARGET_API_MAC_CARBON] (mac_store_drag_event): New function. | ||
| 189 | (install_window_handler): Call install_drag_handler. | ||
| 190 | (remove_window_handler): Call remove_drag_handler. | ||
| 191 | |||
| 192 | 2006-05-03 Richard Stallman <rms@gnu.org> | ||
| 193 | |||
| 194 | * sound.c (Fplay_sound_internal): Dynamically allocate | ||
| 195 | current_sound_device and current_sound. | ||
| 196 | (sound_cleanup): Free them. | ||
| 197 | |||
| 198 | * minibuf.c (read_minibuf): Don't use read_minibuf_noninteractive | ||
| 199 | when inside a keyboard macro. | ||
| 200 | |||
| 1 | 2006-05-02 Andreas Schwab <schwab@suse.de> | 201 | 2006-05-02 Andreas Schwab <schwab@suse.de> |
| 2 | 202 | ||
| 3 | * xmenu.c (restore_menu_items): Return a value. | 203 | * xmenu.c (restore_menu_items): Return a value. |
diff --git a/src/callproc.c b/src/callproc.c index 54ebf53979e..5f314f4de2a 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -295,6 +295,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 295 | val = Qnil; | 295 | val = Qnil; |
| 296 | } | 296 | } |
| 297 | setup_coding_system (Fcheck_coding_system (val), &argument_coding); | 297 | setup_coding_system (Fcheck_coding_system (val), &argument_coding); |
| 298 | if (argument_coding.eol_type == CODING_EOL_UNDECIDED) | ||
| 299 | argument_coding.eol_type = system_eol_type; | ||
| 298 | } | 300 | } |
| 299 | } | 301 | } |
| 300 | 302 | ||
diff --git a/src/coding.h b/src/coding.h index 41f4aab509c..aa5c8f05015 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -717,6 +717,9 @@ extern Lisp_Object eol_mnemonic_unix, eol_mnemonic_dos, eol_mnemonic_mac; | |||
| 717 | /* Mnemonic string to indicate type of end-of-line is not yet decided. */ | 717 | /* Mnemonic string to indicate type of end-of-line is not yet decided. */ |
| 718 | extern Lisp_Object eol_mnemonic_undecided; | 718 | extern Lisp_Object eol_mnemonic_undecided; |
| 719 | 719 | ||
| 720 | /* Format of end-of-line decided by system. */ | ||
| 721 | extern int system_eol_type; | ||
| 722 | |||
| 720 | #ifdef emacs | 723 | #ifdef emacs |
| 721 | extern Lisp_Object Qfile_coding_system; | 724 | extern Lisp_Object Qfile_coding_system; |
| 722 | extern Lisp_Object Qcall_process, Qcall_process_region; | 725 | extern Lisp_Object Qcall_process, Qcall_process_region; |
diff --git a/src/image.c b/src/image.c index 688ff200055..f309a401139 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -2628,7 +2628,7 @@ image_load_quartz2d (f, img, png_p) | |||
| 2628 | UNGCPRO; | 2628 | UNGCPRO; |
| 2629 | return 0; | 2629 | return 0; |
| 2630 | } | 2630 | } |
| 2631 | path = cfstring_create_with_string (file); | 2631 | path = cfstring_create_with_utf8_cstring (SDATA (file)); |
| 2632 | url = CFURLCreateWithFileSystemPath (NULL, path, | 2632 | url = CFURLCreateWithFileSystemPath (NULL, path, |
| 2633 | kCFURLPOSIXPathStyle, 0); | 2633 | kCFURLPOSIXPathStyle, 0); |
| 2634 | CFRelease (path); | 2634 | CFRelease (path); |
| @@ -7920,7 +7920,8 @@ gif_load (f, img) | |||
| 7920 | RGBColor bg_color; | 7920 | RGBColor bg_color; |
| 7921 | int width, height; | 7921 | int width, height; |
| 7922 | XImagePtr ximg; | 7922 | XImagePtr ximg; |
| 7923 | TimeValue time; | 7923 | TimeScale time_scale; |
| 7924 | TimeValue time, duration; | ||
| 7924 | int ino; | 7925 | int ino; |
| 7925 | CGrafPtr old_port; | 7926 | CGrafPtr old_port; |
| 7926 | GDHandle old_gdh; | 7927 | GDHandle old_gdh; |
| @@ -8028,6 +8029,7 @@ gif_load (f, img) | |||
| 8028 | image, img->spec); | 8029 | image, img->spec); |
| 8029 | goto error; | 8030 | goto error; |
| 8030 | } | 8031 | } |
| 8032 | time_scale = GetMediaTimeScale (media); | ||
| 8031 | 8033 | ||
| 8032 | specified_bg = image_spec_value (img->spec, QCbackground, NULL); | 8034 | specified_bg = image_spec_value (img->spec, QCbackground, NULL); |
| 8033 | if (!STRINGP (specified_bg) || | 8035 | if (!STRINGP (specified_bg) || |
| @@ -8053,7 +8055,7 @@ gif_load (f, img) | |||
| 8053 | SetGWorld (old_port, old_gdh); | 8055 | SetGWorld (old_port, old_gdh); |
| 8054 | SetMovieActive (movie, 1); | 8056 | SetMovieActive (movie, 1); |
| 8055 | SetMovieGWorld (movie, ximg, NULL); | 8057 | SetMovieGWorld (movie, ximg, NULL); |
| 8056 | SampleNumToMediaTime (media, ino + 1, &time, NULL); | 8058 | SampleNumToMediaTime (media, ino + 1, &time, &duration); |
| 8057 | SetMovieTimeValue (movie, time); | 8059 | SetMovieTimeValue (movie, time); |
| 8058 | MoviesTask (movie, 0L); | 8060 | MoviesTask (movie, 0L); |
| 8059 | DisposeTrackMedia (media); | 8061 | DisposeTrackMedia (media); |
| @@ -8061,6 +8063,24 @@ gif_load (f, img) | |||
| 8061 | DisposeMovie (movie); | 8063 | DisposeMovie (movie); |
| 8062 | if (dh) | 8064 | if (dh) |
| 8063 | DisposeHandle (dh); | 8065 | DisposeHandle (dh); |
| 8066 | |||
| 8067 | /* Save GIF image extension data for `image-extension-data'. | ||
| 8068 | Format is (count IMAGES 0xf9 GRAPHIC_CONTROL_EXTENSION_BLOCK). */ | ||
| 8069 | { | ||
| 8070 | unsigned char gce[4]; | ||
| 8071 | int centisec = ((float)duration / time_scale) * 100.0f + 0.5f; | ||
| 8072 | |||
| 8073 | /* Fill the delay time field. */ | ||
| 8074 | gce[1] = centisec & 0xff; | ||
| 8075 | gce[2] = (centisec >> 8) & 0xff; | ||
| 8076 | /* We don't know about other fields. */ | ||
| 8077 | gce[0] = gce[3] = 0; | ||
| 8078 | |||
| 8079 | img->data.lisp_val = list4 (Qcount, make_number (nsamples), | ||
| 8080 | make_number (0xf9), | ||
| 8081 | make_unibyte_string (gce, 4)); | ||
| 8082 | } | ||
| 8083 | |||
| 8064 | /* Maybe fill in the background field while we have ximg handy. */ | 8084 | /* Maybe fill in the background field while we have ximg handy. */ |
| 8065 | if (NILP (image_spec_value (img->spec, QCbackground, NULL))) | 8085 | if (NILP (image_spec_value (img->spec, QCbackground, NULL))) |
| 8066 | IMAGE_BACKGROUND (img, f, ximg); | 8086 | IMAGE_BACKGROUND (img, f, ximg); |
diff --git a/src/keyboard.c b/src/keyboard.c index e3a77653ed6..b47df2bec7a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -5881,8 +5881,7 @@ make_lispy_event (event) | |||
| 5881 | spec[1] = event->y; | 5881 | spec[1] = event->y; |
| 5882 | return Fcons (Qmac_apple_event, | 5882 | return Fcons (Qmac_apple_event, |
| 5883 | Fcons (Fvector (2, spec), | 5883 | Fcons (Fvector (2, spec), |
| 5884 | Fcons (mac_make_lispy_event_code (event->code), | 5884 | Fcons (event->arg, Qnil))); |
| 5885 | Qnil))); | ||
| 5886 | } | 5885 | } |
| 5887 | #endif | 5886 | #endif |
| 5888 | 5887 | ||
diff --git a/src/keymap.c b/src/keymap.c index f5aea3b3902..fb506200a1c 100644 --- a/src/keymap.c +++ b/src/keymap.c | |||
| @@ -2120,12 +2120,21 @@ push_key_description (c, p, force_multibyte) | |||
| 2120 | int force_multibyte; | 2120 | int force_multibyte; |
| 2121 | { | 2121 | { |
| 2122 | unsigned c2; | 2122 | unsigned c2; |
| 2123 | int valid_p; | ||
| 2123 | 2124 | ||
| 2124 | /* Clear all the meaningless bits above the meta bit. */ | 2125 | /* Clear all the meaningless bits above the meta bit. */ |
| 2125 | c &= meta_modifier | ~ - meta_modifier; | 2126 | c &= meta_modifier | ~ - meta_modifier; |
| 2126 | c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier | 2127 | c2 = c & ~(alt_modifier | ctrl_modifier | hyper_modifier |
| 2127 | | meta_modifier | shift_modifier | super_modifier); | 2128 | | meta_modifier | shift_modifier | super_modifier); |
| 2128 | 2129 | ||
| 2130 | valid_p = SINGLE_BYTE_CHAR_P (c2) || char_valid_p (c2, 0); | ||
| 2131 | if (! valid_p) | ||
| 2132 | { | ||
| 2133 | /* KEY_DESCRIPTION_SIZE is large enough for this. */ | ||
| 2134 | p += sprintf (p, "[%d]", c); | ||
| 2135 | return p; | ||
| 2136 | } | ||
| 2137 | |||
| 2129 | if (c & alt_modifier) | 2138 | if (c & alt_modifier) |
| 2130 | { | 2139 | { |
| 2131 | *p++ = 'A'; | 2140 | *p++ = 'A'; |
| @@ -3310,7 +3319,9 @@ describe_map (map, prefix, elt_describer, partial, shadow, | |||
| 3310 | tem = shadow_lookup (shadow, kludge, Qt); | 3319 | tem = shadow_lookup (shadow, kludge, Qt); |
| 3311 | if (!NILP (tem)) | 3320 | if (!NILP (tem)) |
| 3312 | { | 3321 | { |
| 3313 | if (mention_shadow) | 3322 | /* Avoid generating duplicate entries if the |
| 3323 | shadowed binding has the same definition. */ | ||
| 3324 | if (mention_shadow && !EQ (tem, definition)) | ||
| 3314 | this_shadowed = 1; | 3325 | this_shadowed = 1; |
| 3315 | else | 3326 | else |
| 3316 | continue; | 3327 | continue; |
| @@ -272,7 +272,7 @@ static Lisp_Object Qundecoded_file_name; | |||
| 272 | 272 | ||
| 273 | static Lisp_Object | 273 | static Lisp_Object |
| 274 | mac_aelist_to_lisp (desc_list) | 274 | mac_aelist_to_lisp (desc_list) |
| 275 | AEDescList *desc_list; | 275 | const AEDescList *desc_list; |
| 276 | { | 276 | { |
| 277 | OSErr err; | 277 | OSErr err; |
| 278 | long count; | 278 | long count; |
| @@ -337,7 +337,7 @@ mac_aelist_to_lisp (desc_list) | |||
| 337 | 337 | ||
| 338 | Lisp_Object | 338 | Lisp_Object |
| 339 | mac_aedesc_to_lisp (desc) | 339 | mac_aedesc_to_lisp (desc) |
| 340 | AEDesc *desc; | 340 | const AEDesc *desc; |
| 341 | { | 341 | { |
| 342 | OSErr err = noErr; | 342 | OSErr err = noErr; |
| 343 | DescType desc_type = desc->descriptorType; | 343 | DescType desc_type = desc->descriptorType; |
| @@ -665,33 +665,46 @@ init_coercion_handler () | |||
| 665 | } | 665 | } |
| 666 | 666 | ||
| 667 | #if TARGET_API_MAC_CARBON | 667 | #if TARGET_API_MAC_CARBON |
| 668 | OSErr | 668 | static OSErr |
| 669 | create_apple_event_from_event_ref (event, num_params, names, types, result) | 669 | create_apple_event (class, id, result) |
| 670 | EventRef event; | 670 | AEEventClass class; |
| 671 | UInt32 num_params; | 671 | AEEventID id; |
| 672 | EventParamName *names; | ||
| 673 | EventParamType *types; | ||
| 674 | AppleEvent *result; | 672 | AppleEvent *result; |
| 675 | { | 673 | { |
| 676 | OSErr err; | 674 | OSErr err; |
| 677 | static const ProcessSerialNumber psn = {0, kCurrentProcess}; | 675 | static const ProcessSerialNumber psn = {0, kCurrentProcess}; |
| 678 | AEAddressDesc address_desc; | 676 | AEAddressDesc address_desc; |
| 679 | UInt32 i, size; | ||
| 680 | CFStringRef string; | ||
| 681 | CFDataRef data; | ||
| 682 | char *buf; | ||
| 683 | 677 | ||
| 684 | err = AECreateDesc (typeProcessSerialNumber, &psn, | 678 | err = AECreateDesc (typeProcessSerialNumber, &psn, |
| 685 | sizeof (ProcessSerialNumber), &address_desc); | 679 | sizeof (ProcessSerialNumber), &address_desc); |
| 686 | if (err == noErr) | 680 | if (err == noErr) |
| 687 | { | 681 | { |
| 688 | err = AECreateAppleEvent (0, 0, /* Dummy class and ID. */ | 682 | err = AECreateAppleEvent (class, id, |
| 689 | &address_desc, /* NULL is not allowed | 683 | &address_desc, /* NULL is not allowed |
| 690 | on Mac OS Classic. */ | 684 | on Mac OS Classic. */ |
| 691 | kAutoGenerateReturnID, | 685 | kAutoGenerateReturnID, |
| 692 | kAnyTransactionID, result); | 686 | kAnyTransactionID, result); |
| 693 | AEDisposeDesc (&address_desc); | 687 | AEDisposeDesc (&address_desc); |
| 694 | } | 688 | } |
| 689 | |||
| 690 | return err; | ||
| 691 | } | ||
| 692 | |||
| 693 | OSErr | ||
| 694 | create_apple_event_from_event_ref (event, num_params, names, types, result) | ||
| 695 | EventRef event; | ||
| 696 | UInt32 num_params; | ||
| 697 | EventParamName *names; | ||
| 698 | EventParamType *types; | ||
| 699 | AppleEvent *result; | ||
| 700 | { | ||
| 701 | OSErr err; | ||
| 702 | UInt32 i, size; | ||
| 703 | CFStringRef string; | ||
| 704 | CFDataRef data; | ||
| 705 | char *buf = NULL; | ||
| 706 | |||
| 707 | err = create_apple_event (0, 0, result); /* Dummy class and ID. */ | ||
| 695 | if (err != noErr) | 708 | if (err != noErr) |
| 696 | return err; | 709 | return err; |
| 697 | 710 | ||
| @@ -721,19 +734,88 @@ create_apple_event_from_event_ref (event, num_params, names, types, result) | |||
| 721 | 0, &size, NULL); | 734 | 0, &size, NULL); |
| 722 | if (err != noErr) | 735 | if (err != noErr) |
| 723 | break; | 736 | break; |
| 724 | buf = xmalloc (size); | 737 | buf = xrealloc (buf, size); |
| 725 | err = GetEventParameter (event, names[i], types[i], NULL, | 738 | err = GetEventParameter (event, names[i], types[i], NULL, |
| 726 | size, NULL, buf); | 739 | size, NULL, buf); |
| 727 | if (err == noErr) | 740 | if (err == noErr) |
| 728 | AEPutParamPtr (result, names[i], types[i], buf, size); | 741 | AEPutParamPtr (result, names[i], types[i], buf, size); |
| 729 | xfree (buf); | ||
| 730 | break; | 742 | break; |
| 731 | } | 743 | } |
| 744 | if (buf) | ||
| 745 | xfree (buf); | ||
| 732 | 746 | ||
| 733 | return noErr; | 747 | return noErr; |
| 734 | } | 748 | } |
| 735 | #endif | ||
| 736 | 749 | ||
| 750 | OSErr | ||
| 751 | create_apple_event_from_drag_ref (drag, num_types, types, result) | ||
| 752 | DragRef drag; | ||
| 753 | UInt32 num_types; | ||
| 754 | FlavorType *types; | ||
| 755 | AppleEvent *result; | ||
| 756 | { | ||
| 757 | OSErr err; | ||
| 758 | UInt16 num_items; | ||
| 759 | AppleEvent items; | ||
| 760 | long index; | ||
| 761 | char *buf = NULL; | ||
| 762 | |||
| 763 | err = CountDragItems (drag, &num_items); | ||
| 764 | if (err != noErr) | ||
| 765 | return err; | ||
| 766 | err = AECreateList (NULL, 0, false, &items); | ||
| 767 | if (err != noErr) | ||
| 768 | return err; | ||
| 769 | |||
| 770 | for (index = 1; index <= num_items; index++) | ||
| 771 | { | ||
| 772 | ItemReference item; | ||
| 773 | DescType desc_type = typeNull; | ||
| 774 | Size size; | ||
| 775 | |||
| 776 | err = GetDragItemReferenceNumber (drag, index, &item); | ||
| 777 | if (err == noErr) | ||
| 778 | { | ||
| 779 | int i; | ||
| 780 | |||
| 781 | for (i = 0; i < num_types; i++) | ||
| 782 | { | ||
| 783 | err = GetFlavorDataSize (drag, item, types[i], &size); | ||
| 784 | if (err == noErr) | ||
| 785 | { | ||
| 786 | buf = xrealloc (buf, size); | ||
| 787 | err = GetFlavorData (drag, item, types[i], buf, &size, 0); | ||
| 788 | } | ||
| 789 | if (err == noErr) | ||
| 790 | { | ||
| 791 | desc_type = types[i]; | ||
| 792 | break; | ||
| 793 | } | ||
| 794 | } | ||
| 795 | } | ||
| 796 | err = AEPutPtr (&items, index, desc_type, | ||
| 797 | desc_type != typeNull ? buf : NULL, | ||
| 798 | desc_type != typeNull ? size : 0); | ||
| 799 | if (err != noErr) | ||
| 800 | break; | ||
| 801 | } | ||
| 802 | if (buf) | ||
| 803 | xfree (buf); | ||
| 804 | |||
| 805 | if (err == noErr) | ||
| 806 | { | ||
| 807 | err = create_apple_event (0, 0, result); /* Dummy class and ID. */ | ||
| 808 | if (err == noErr) | ||
| 809 | err = AEPutParamDesc (result, keyDirectObject, &items); | ||
| 810 | if (err != noErr) | ||
| 811 | AEDisposeDesc (result); | ||
| 812 | } | ||
| 813 | |||
| 814 | AEDisposeDesc (&items); | ||
| 815 | |||
| 816 | return err; | ||
| 817 | } | ||
| 818 | #endif /* TARGET_API_MAC_CARBON */ | ||
| 737 | 819 | ||
| 738 | /*********************************************************************** | 820 | /*********************************************************************** |
| 739 | Conversion between Lisp and Core Foundation objects | 821 | Conversion between Lisp and Core Foundation objects |
| @@ -4686,16 +4768,6 @@ On successful conversion, return the result string, else return nil. */) | |||
| 4686 | #endif /* TARGET_API_MAC_CARBON */ | 4768 | #endif /* TARGET_API_MAC_CARBON */ |
| 4687 | 4769 | ||
| 4688 | 4770 | ||
| 4689 | DEFUN ("mac-clear-font-name-table", Fmac_clear_font_name_table, Smac_clear_font_name_table, 0, 0, 0, | ||
| 4690 | doc: /* Clear the font name table. */) | ||
| 4691 | () | ||
| 4692 | { | ||
| 4693 | check_mac (); | ||
| 4694 | mac_clear_font_name_table (); | ||
| 4695 | return Qnil; | ||
| 4696 | } | ||
| 4697 | |||
| 4698 | |||
| 4699 | static Lisp_Object | 4771 | static Lisp_Object |
| 4700 | mac_get_system_locale () | 4772 | mac_get_system_locale () |
| 4701 | { | 4773 | { |
| @@ -5167,7 +5239,6 @@ syms_of_mac () | |||
| 5167 | defsubr (&Smac_get_preference); | 5239 | defsubr (&Smac_get_preference); |
| 5168 | defsubr (&Smac_code_convert_string); | 5240 | defsubr (&Smac_code_convert_string); |
| 5169 | #endif | 5241 | #endif |
| 5170 | defsubr (&Smac_clear_font_name_table); | ||
| 5171 | 5242 | ||
| 5172 | defsubr (&Smac_set_file_creator); | 5243 | defsubr (&Smac_set_file_creator); |
| 5173 | defsubr (&Smac_set_file_type); | 5244 | defsubr (&Smac_set_file_type); |
diff --git a/src/macfns.c b/src/macfns.c index 74b5288e781..8e0d5153034 100644 --- a/src/macfns.c +++ b/src/macfns.c | |||
| @@ -1091,7 +1091,7 @@ x_to_mac_color (colorname) | |||
| 1091 | char *color; | 1091 | char *color; |
| 1092 | unsigned long colorval; | 1092 | unsigned long colorval; |
| 1093 | int i, pos; | 1093 | int i, pos; |
| 1094 | pos = 0; | 1094 | pos = 16; |
| 1095 | 1095 | ||
| 1096 | colorval = 0; | 1096 | colorval = 0; |
| 1097 | color = colorname + 4; | 1097 | color = colorname + 4; |
| @@ -1127,7 +1127,7 @@ x_to_mac_color (colorname) | |||
| 1127 | if (value == ULONG_MAX) | 1127 | if (value == ULONG_MAX) |
| 1128 | break; | 1128 | break; |
| 1129 | colorval |= (value << pos); | 1129 | colorval |= (value << pos); |
| 1130 | pos += 0x8; | 1130 | pos -= 0x8; |
| 1131 | if (i == 2) | 1131 | if (i == 2) |
| 1132 | { | 1132 | { |
| 1133 | if (*end != '\0') | 1133 | if (*end != '\0') |
| @@ -1146,7 +1146,7 @@ x_to_mac_color (colorname) | |||
| 1146 | char *color; | 1146 | char *color; |
| 1147 | unsigned long colorval; | 1147 | unsigned long colorval; |
| 1148 | int i, pos; | 1148 | int i, pos; |
| 1149 | pos = 0; | 1149 | pos = 16; |
| 1150 | 1150 | ||
| 1151 | colorval = 0; | 1151 | colorval = 0; |
| 1152 | color = colorname + 5; | 1152 | color = colorname + 5; |
| @@ -1168,7 +1168,7 @@ x_to_mac_color (colorname) | |||
| 1168 | if (val == 0x100) | 1168 | if (val == 0x100) |
| 1169 | val = 0xFF; | 1169 | val = 0xFF; |
| 1170 | colorval |= (val << pos); | 1170 | colorval |= (val << pos); |
| 1171 | pos += 0x8; | 1171 | pos -= 0x8; |
| 1172 | if (i == 2) | 1172 | if (i == 2) |
| 1173 | { | 1173 | { |
| 1174 | if (*end != '\0') | 1174 | if (*end != '\0') |
| @@ -1919,6 +1919,27 @@ mac_set_scroll_bar_width (f, arg, oldval) | |||
| 1919 | x_set_scroll_bar_width (f, arg, oldval); | 1919 | x_set_scroll_bar_width (f, arg, oldval); |
| 1920 | } | 1920 | } |
| 1921 | 1921 | ||
| 1922 | static void | ||
| 1923 | mac_set_font (f, arg, oldval) | ||
| 1924 | struct frame *f; | ||
| 1925 | Lisp_Object arg, oldval; | ||
| 1926 | { | ||
| 1927 | x_set_font (f, arg, oldval); | ||
| 1928 | #if USE_MAC_FONT_PANEL | ||
| 1929 | { | ||
| 1930 | Lisp_Object focus_frame = x_get_focus_frame (f); | ||
| 1931 | |||
| 1932 | if ((NILP (focus_frame) && f == SELECTED_FRAME ()) | ||
| 1933 | || XFRAME (focus_frame) == f) | ||
| 1934 | { | ||
| 1935 | BLOCK_INPUT; | ||
| 1936 | mac_set_font_info_for_selection (f, DEFAULT_FACE_ID, 0); | ||
| 1937 | UNBLOCK_INPUT; | ||
| 1938 | } | ||
| 1939 | } | ||
| 1940 | #endif | ||
| 1941 | } | ||
| 1942 | |||
| 1922 | #if TARGET_API_MAC_CARBON | 1943 | #if TARGET_API_MAC_CARBON |
| 1923 | static void | 1944 | static void |
| 1924 | mac_update_proxy_icon (f) | 1945 | mac_update_proxy_icon (f) |
| @@ -2213,8 +2234,10 @@ mac_window (f) | |||
| 2213 | #if TARGET_API_MAC_CARBON | 2234 | #if TARGET_API_MAC_CARBON |
| 2214 | CreateNewWindow (kDocumentWindowClass, | 2235 | CreateNewWindow (kDocumentWindowClass, |
| 2215 | kWindowStandardDocumentAttributes | 2236 | kWindowStandardDocumentAttributes |
| 2216 | /* | kWindowToolbarButtonAttribute */, | 2237 | #ifdef MAC_OSX |
| 2217 | &r, &FRAME_MAC_WINDOW (f)); | 2238 | | kWindowToolbarButtonAttribute |
| 2239 | #endif | ||
| 2240 | , &r, &FRAME_MAC_WINDOW (f)); | ||
| 2218 | if (FRAME_MAC_WINDOW (f)) | 2241 | if (FRAME_MAC_WINDOW (f)) |
| 2219 | { | 2242 | { |
| 2220 | SetWRefCon (FRAME_MAC_WINDOW (f), (long) f->output_data.mac); | 2243 | SetWRefCon (FRAME_MAC_WINDOW (f), (long) f->output_data.mac); |
| @@ -4469,6 +4492,43 @@ mac_nav_event_callback (selector, parms, data) | |||
| 4469 | #endif | 4492 | #endif |
| 4470 | 4493 | ||
| 4471 | /*********************************************************************** | 4494 | /*********************************************************************** |
| 4495 | Fonts | ||
| 4496 | ***********************************************************************/ | ||
| 4497 | |||
| 4498 | DEFUN ("mac-clear-font-name-table", Fmac_clear_font_name_table, | ||
| 4499 | Smac_clear_font_name_table, 0, 0, 0, | ||
| 4500 | doc: /* Clear the font name table. */) | ||
| 4501 | () | ||
| 4502 | { | ||
| 4503 | check_mac (); | ||
| 4504 | mac_clear_font_name_table (); | ||
| 4505 | return Qnil; | ||
| 4506 | } | ||
| 4507 | |||
| 4508 | #if USE_MAC_FONT_PANEL | ||
| 4509 | DEFUN ("mac-set-font-panel-visibility", Fmac_set_font_panel_visibility, | ||
| 4510 | Smac_set_font_panel_visibility, 1, 1, 0, | ||
| 4511 | doc: /* Make the font panel visible if and only if VISIBLE is non-nil. | ||
| 4512 | This is for internal use only. Use `mac-font-panel-mode' instead. */) | ||
| 4513 | (visible) | ||
| 4514 | Lisp_Object visible; | ||
| 4515 | { | ||
| 4516 | OSStatus err = noErr; | ||
| 4517 | |||
| 4518 | check_mac (); | ||
| 4519 | |||
| 4520 | BLOCK_INPUT; | ||
| 4521 | if (NILP (visible) == (FPIsFontPanelVisible () == true)) | ||
| 4522 | err = FPShowHideFontPanel (); | ||
| 4523 | UNBLOCK_INPUT; | ||
| 4524 | |||
| 4525 | if (err != noErr) | ||
| 4526 | error ("Cannot change visibility of the font panel"); | ||
| 4527 | return Qnil; | ||
| 4528 | } | ||
| 4529 | #endif | ||
| 4530 | |||
| 4531 | /*********************************************************************** | ||
| 4472 | Initialization | 4532 | Initialization |
| 4473 | ***********************************************************************/ | 4533 | ***********************************************************************/ |
| 4474 | 4534 | ||
| @@ -4484,7 +4544,7 @@ frame_parm_handler mac_frame_parm_handlers[] = | |||
| 4484 | x_set_border_width, | 4544 | x_set_border_width, |
| 4485 | x_set_cursor_color, | 4545 | x_set_cursor_color, |
| 4486 | x_set_cursor_type, | 4546 | x_set_cursor_type, |
| 4487 | x_set_font, | 4547 | mac_set_font, |
| 4488 | x_set_foreground_color, | 4548 | x_set_foreground_color, |
| 4489 | x_set_icon_name, | 4549 | x_set_icon_name, |
| 4490 | 0, /* MAC_TODO: x_set_icon_type, */ | 4550 | 0, /* MAC_TODO: x_set_icon_type, */ |
| @@ -4660,7 +4720,7 @@ Chinese, Japanese, and Korean. */); | |||
| 4660 | load_font_func = x_load_font; | 4720 | load_font_func = x_load_font; |
| 4661 | find_ccl_program_func = x_find_ccl_program; | 4721 | find_ccl_program_func = x_find_ccl_program; |
| 4662 | query_font_func = x_query_font; | 4722 | query_font_func = x_query_font; |
| 4663 | set_frame_fontset_func = x_set_font; | 4723 | set_frame_fontset_func = mac_set_font; |
| 4664 | check_window_system_func = check_mac; | 4724 | check_window_system_func = check_mac; |
| 4665 | 4725 | ||
| 4666 | hourglass_atimer = NULL; | 4726 | hourglass_atimer = NULL; |
| @@ -4679,6 +4739,10 @@ Chinese, Japanese, and Korean. */); | |||
| 4679 | #if TARGET_API_MAC_CARBON | 4739 | #if TARGET_API_MAC_CARBON |
| 4680 | defsubr (&Sx_file_dialog); | 4740 | defsubr (&Sx_file_dialog); |
| 4681 | #endif | 4741 | #endif |
| 4742 | defsubr (&Smac_clear_font_name_table); | ||
| 4743 | #if USE_MAC_FONT_PANEL | ||
| 4744 | defsubr (&Smac_set_font_panel_visibility); | ||
| 4745 | #endif | ||
| 4682 | } | 4746 | } |
| 4683 | 4747 | ||
| 4684 | /* arch-tag: d7591289-f374-4377-b245-12f5dbbb8edc | 4748 | /* arch-tag: d7591289-f374-4377-b245-12f5dbbb8edc |
diff --git a/src/macgui.h b/src/macgui.h index c09f1a8d173..690840c6c33 100644 --- a/src/macgui.h +++ b/src/macgui.h | |||
| @@ -105,6 +105,13 @@ typedef unsigned long Time; | |||
| 105 | #endif | 105 | #endif |
| 106 | #endif | 106 | #endif |
| 107 | 107 | ||
| 108 | /* Whether to use the standard Font Panel floating dialog. */ | ||
| 109 | #ifndef USE_MAC_FONT_PANEL | ||
| 110 | #if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | ||
| 111 | #define USE_MAC_FONT_PANEL 1 | ||
| 112 | #endif | ||
| 113 | #endif | ||
| 114 | |||
| 108 | typedef WindowPtr Window; | 115 | typedef WindowPtr Window; |
| 109 | typedef GWorldPtr Pixmap; | 116 | typedef GWorldPtr Pixmap; |
| 110 | 117 | ||
diff --git a/src/macmenu.c b/src/macmenu.c index be565f89259..e7d69d5657c 100644 --- a/src/macmenu.c +++ b/src/macmenu.c | |||
| @@ -318,6 +318,7 @@ restore_menu_items (saved) | |||
| 318 | menu_items_n_panes = XINT (XCAR (saved)); | 318 | menu_items_n_panes = XINT (XCAR (saved)); |
| 319 | saved = XCDR (saved); | 319 | saved = XCDR (saved); |
| 320 | menu_items_submenu_depth = XINT (XCAR (saved)); | 320 | menu_items_submenu_depth = XINT (XCAR (saved)); |
| 321 | return Qnil; | ||
| 321 | } | 322 | } |
| 322 | 323 | ||
| 323 | /* Push the whole state of menu_items processing onto the specpdl. | 324 | /* Push the whole state of menu_items processing onto the specpdl. |
| @@ -634,6 +635,7 @@ cleanup_popup_menu (arg) | |||
| 634 | Lisp_Object arg; | 635 | Lisp_Object arg; |
| 635 | { | 636 | { |
| 636 | discard_menu_items (); | 637 | discard_menu_items (); |
| 638 | return Qnil; | ||
| 637 | } | 639 | } |
| 638 | 640 | ||
| 639 | DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, | 641 | DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, |
diff --git a/src/macselect.c b/src/macselect.c index fe4a7c8eccc..1b6a1a46cc3 100644 --- a/src/macselect.c +++ b/src/macselect.c | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | /* Selection processing for Emacs on Mac OS. | 1 | /* Selection processing for Emacs on Mac OS. |
| 2 | Copyright (C) 2005 Free Software Foundation, Inc. | 2 | Copyright (C) 2005, 2006 Free Software Foundation, Inc. |
| 3 | 3 | ||
| 4 | This file is part of GNU Emacs. | 4 | This file is part of GNU Emacs. |
| 5 | 5 | ||
| @@ -101,7 +101,7 @@ static Lisp_Object Qmac_scrap_name, Qmac_ostype; | |||
| 101 | 101 | ||
| 102 | #ifdef MAC_OSX | 102 | #ifdef MAC_OSX |
| 103 | /* Selection name for communication via Services menu. */ | 103 | /* Selection name for communication via Services menu. */ |
| 104 | static Lisp_Object Vmac_services_selection; | 104 | static Lisp_Object Vmac_service_selection; |
| 105 | #endif | 105 | #endif |
| 106 | 106 | ||
| 107 | /* Get a reference to the scrap corresponding to the symbol SYM. The | 107 | /* Get a reference to the scrap corresponding to the symbol SYM. The |
| @@ -918,8 +918,8 @@ static struct | |||
| 918 | int size, count; | 918 | int size, count; |
| 919 | } deferred_apple_events; | 919 | } deferred_apple_events; |
| 920 | extern Lisp_Object Qundefined; | 920 | extern Lisp_Object Qundefined; |
| 921 | extern OSErr mac_store_apple_event P_ ((Lisp_Object, Lisp_Object, | 921 | extern void mac_store_apple_event P_ ((Lisp_Object, Lisp_Object, |
| 922 | const AEDesc *)); | 922 | const AEDesc *)); |
| 923 | 923 | ||
| 924 | struct apple_event_binding | 924 | struct apple_event_binding |
| 925 | { | 925 | { |
| @@ -1079,9 +1079,8 @@ mac_handle_apple_event (apple_event, reply, refcon) | |||
| 1079 | { | 1079 | { |
| 1080 | if (INTEGERP (binding)) | 1080 | if (INTEGERP (binding)) |
| 1081 | return XINT (binding); | 1081 | return XINT (binding); |
| 1082 | err = mac_store_apple_event (class_key, id_key, apple_event); | 1082 | mac_store_apple_event (class_key, id_key, apple_event); |
| 1083 | if (err == noErr) | 1083 | return noErr; |
| 1084 | return noErr; | ||
| 1085 | } | 1084 | } |
| 1086 | } | 1085 | } |
| 1087 | return errAEEventNotHandled; | 1086 | return errAEEventNotHandled; |
| @@ -1146,6 +1145,198 @@ DEFUN ("mac-process-deferred-apple-events", Fmac_process_deferred_apple_events, | |||
| 1146 | } | 1145 | } |
| 1147 | 1146 | ||
| 1148 | 1147 | ||
| 1148 | #if TARGET_API_MAC_CARBON | ||
| 1149 | static Lisp_Object Vmac_dnd_known_types; | ||
| 1150 | static pascal OSErr mac_do_track_drag P_ ((DragTrackingMessage, WindowRef, | ||
| 1151 | void *, DragRef)); | ||
| 1152 | static pascal OSErr mac_do_receive_drag P_ ((WindowRef, void *, DragRef)); | ||
| 1153 | static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL; | ||
| 1154 | static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; | ||
| 1155 | |||
| 1156 | extern void mac_store_drag_event P_ ((WindowRef, Point, SInt16, | ||
| 1157 | const AEDesc *)); | ||
| 1158 | |||
| 1159 | static pascal OSErr | ||
| 1160 | mac_do_track_drag (message, window, refcon, drag) | ||
| 1161 | DragTrackingMessage message; | ||
| 1162 | WindowRef window; | ||
| 1163 | void *refcon; | ||
| 1164 | DragRef drag; | ||
| 1165 | { | ||
| 1166 | OSErr err = noErr; | ||
| 1167 | static int can_accept; | ||
| 1168 | UInt16 num_items, index; | ||
| 1169 | |||
| 1170 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) | ||
| 1171 | return dragNotAcceptedErr; | ||
| 1172 | |||
| 1173 | switch (message) | ||
| 1174 | { | ||
| 1175 | case kDragTrackingEnterHandler: | ||
| 1176 | err = CountDragItems (drag, &num_items); | ||
| 1177 | if (err != noErr) | ||
| 1178 | break; | ||
| 1179 | can_accept = 0; | ||
| 1180 | for (index = 1; index <= num_items; index++) | ||
| 1181 | { | ||
| 1182 | ItemReference item; | ||
| 1183 | FlavorFlags flags; | ||
| 1184 | Lisp_Object rest; | ||
| 1185 | |||
| 1186 | err = GetDragItemReferenceNumber (drag, index, &item); | ||
| 1187 | if (err != noErr) | ||
| 1188 | continue; | ||
| 1189 | for (rest = Vmac_dnd_known_types; CONSP (rest); rest = XCDR (rest)) | ||
| 1190 | { | ||
| 1191 | Lisp_Object str; | ||
| 1192 | FlavorType type; | ||
| 1193 | |||
| 1194 | str = XCAR (rest); | ||
| 1195 | if (!(STRINGP (str) && SBYTES (str) == 4)) | ||
| 1196 | continue; | ||
| 1197 | type = EndianU32_BtoN (*((UInt32 *) SDATA (str))); | ||
| 1198 | |||
| 1199 | err = GetFlavorFlags (drag, item, type, &flags); | ||
| 1200 | if (err == noErr) | ||
| 1201 | { | ||
| 1202 | can_accept = 1; | ||
| 1203 | break; | ||
| 1204 | } | ||
| 1205 | } | ||
| 1206 | } | ||
| 1207 | break; | ||
| 1208 | |||
| 1209 | case kDragTrackingEnterWindow: | ||
| 1210 | if (can_accept) | ||
| 1211 | { | ||
| 1212 | RgnHandle hilite_rgn = NewRgn (); | ||
| 1213 | |||
| 1214 | if (hilite_rgn) | ||
| 1215 | { | ||
| 1216 | Rect r; | ||
| 1217 | |||
| 1218 | GetWindowPortBounds (window, &r); | ||
| 1219 | OffsetRect (&r, -r.left, -r.top); | ||
| 1220 | RectRgn (hilite_rgn, &r); | ||
| 1221 | ShowDragHilite (drag, hilite_rgn, true); | ||
| 1222 | DisposeRgn (hilite_rgn); | ||
| 1223 | } | ||
| 1224 | SetThemeCursor (kThemeCopyArrowCursor); | ||
| 1225 | } | ||
| 1226 | break; | ||
| 1227 | |||
| 1228 | case kDragTrackingInWindow: | ||
| 1229 | break; | ||
| 1230 | |||
| 1231 | case kDragTrackingLeaveWindow: | ||
| 1232 | if (can_accept) | ||
| 1233 | { | ||
| 1234 | HideDragHilite (drag); | ||
| 1235 | SetThemeCursor (kThemeArrowCursor); | ||
| 1236 | } | ||
| 1237 | break; | ||
| 1238 | |||
| 1239 | case kDragTrackingLeaveHandler: | ||
| 1240 | break; | ||
| 1241 | } | ||
| 1242 | |||
| 1243 | if (err != noErr) | ||
| 1244 | return dragNotAcceptedErr; | ||
| 1245 | return noErr; | ||
| 1246 | } | ||
| 1247 | |||
| 1248 | static pascal OSErr | ||
| 1249 | mac_do_receive_drag (window, refcon, drag) | ||
| 1250 | WindowRef window; | ||
| 1251 | void *refcon; | ||
| 1252 | DragRef drag; | ||
| 1253 | { | ||
| 1254 | OSErr err; | ||
| 1255 | int num_types, i; | ||
| 1256 | Lisp_Object rest, str; | ||
| 1257 | FlavorType *types; | ||
| 1258 | AppleEvent apple_event; | ||
| 1259 | Point mouse_pos; | ||
| 1260 | SInt16 modifiers; | ||
| 1261 | |||
| 1262 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) | ||
| 1263 | return dragNotAcceptedErr; | ||
| 1264 | |||
| 1265 | num_types = 0; | ||
| 1266 | for (rest = Vmac_dnd_known_types; CONSP (rest); rest = XCDR (rest)) | ||
| 1267 | { | ||
| 1268 | str = XCAR (rest); | ||
| 1269 | if (STRINGP (str) && SBYTES (str) == 4) | ||
| 1270 | num_types++; | ||
| 1271 | } | ||
| 1272 | |||
| 1273 | types = xmalloc (sizeof (FlavorType) * num_types); | ||
| 1274 | i = 0; | ||
| 1275 | for (rest = Vmac_dnd_known_types; CONSP (rest); rest = XCDR (rest)) | ||
| 1276 | { | ||
| 1277 | str = XCAR (rest); | ||
| 1278 | if (STRINGP (str) && SBYTES (str) == 4) | ||
| 1279 | types[i++] = EndianU32_BtoN (*((UInt32 *) SDATA (str))); | ||
| 1280 | } | ||
| 1281 | |||
| 1282 | err = create_apple_event_from_drag_ref (drag, num_types, types, | ||
| 1283 | &apple_event); | ||
| 1284 | xfree (types); | ||
| 1285 | |||
| 1286 | if (err == noErr) | ||
| 1287 | err = GetDragMouse (drag, &mouse_pos, NULL); | ||
| 1288 | if (err == noErr) | ||
| 1289 | { | ||
| 1290 | GlobalToLocal (&mouse_pos); | ||
| 1291 | err = GetDragModifiers (drag, NULL, NULL, &modifiers); | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | if (err == noErr) | ||
| 1295 | { | ||
| 1296 | mac_store_drag_event (window, mouse_pos, modifiers, &apple_event); | ||
| 1297 | AEDisposeDesc (&apple_event); | ||
| 1298 | /* Post a harmless event so as to wake up from ReceiveNextEvent. */ | ||
| 1299 | mac_post_mouse_moved_event (); | ||
| 1300 | return noErr; | ||
| 1301 | } | ||
| 1302 | else | ||
| 1303 | return dragNotAcceptedErr; | ||
| 1304 | } | ||
| 1305 | #endif /* TARGET_API_MAC_CARBON */ | ||
| 1306 | |||
| 1307 | OSErr | ||
| 1308 | install_drag_handler (window) | ||
| 1309 | WindowRef window; | ||
| 1310 | { | ||
| 1311 | OSErr err = noErr; | ||
| 1312 | |||
| 1313 | #if TARGET_API_MAC_CARBON | ||
| 1314 | if (mac_do_track_dragUPP == NULL) | ||
| 1315 | mac_do_track_dragUPP = NewDragTrackingHandlerUPP (mac_do_track_drag); | ||
| 1316 | if (mac_do_receive_dragUPP == NULL) | ||
| 1317 | mac_do_receive_dragUPP = NewDragReceiveHandlerUPP (mac_do_receive_drag); | ||
| 1318 | |||
| 1319 | err = InstallTrackingHandler (mac_do_track_dragUPP, window, NULL); | ||
| 1320 | if (err == noErr) | ||
| 1321 | err = InstallReceiveHandler (mac_do_receive_dragUPP, window, NULL); | ||
| 1322 | #endif | ||
| 1323 | |||
| 1324 | return err; | ||
| 1325 | } | ||
| 1326 | |||
| 1327 | void | ||
| 1328 | remove_drag_handler (window) | ||
| 1329 | WindowRef window; | ||
| 1330 | { | ||
| 1331 | #if TARGET_API_MAC_CARBON | ||
| 1332 | if (mac_do_track_dragUPP) | ||
| 1333 | RemoveTrackingHandler (mac_do_track_dragUPP, window); | ||
| 1334 | if (mac_do_receive_dragUPP) | ||
| 1335 | RemoveReceiveHandler (mac_do_receive_dragUPP, window); | ||
| 1336 | #endif | ||
| 1337 | } | ||
| 1338 | |||
| 1339 | |||
| 1149 | #ifdef MAC_OSX | 1340 | #ifdef MAC_OSX |
| 1150 | void | 1341 | void |
| 1151 | init_service_handler () | 1342 | init_service_handler () |
| @@ -1158,7 +1349,7 @@ init_service_handler () | |||
| 1158 | GetEventTypeCount (specs), specs, NULL, NULL); | 1349 | GetEventTypeCount (specs), specs, NULL, NULL); |
| 1159 | } | 1350 | } |
| 1160 | 1351 | ||
| 1161 | extern OSErr mac_store_services_event P_ ((EventRef)); | 1352 | extern OSStatus mac_store_service_event P_ ((EventRef)); |
| 1162 | 1353 | ||
| 1163 | static OSStatus | 1354 | static OSStatus |
| 1164 | copy_scrap_flavor_data (from_scrap, to_scrap, flavor_type) | 1355 | copy_scrap_flavor_data (from_scrap, to_scrap, flavor_type) |
| @@ -1215,12 +1406,12 @@ mac_handle_service_event (call_ref, event, data) | |||
| 1215 | Lisp_Object rest; | 1406 | Lisp_Object rest; |
| 1216 | ScrapFlavorType flavor_type; | 1407 | ScrapFlavorType flavor_type; |
| 1217 | 1408 | ||
| 1218 | /* Check if Vmac_services_selection is a valid selection that has a | 1409 | /* Check if Vmac_service_selection is a valid selection that has a |
| 1219 | corresponding scrap. */ | 1410 | corresponding scrap. */ |
| 1220 | if (!SYMBOLP (Vmac_services_selection)) | 1411 | if (!SYMBOLP (Vmac_service_selection)) |
| 1221 | err = eventNotHandledErr; | 1412 | err = eventNotHandledErr; |
| 1222 | else | 1413 | else |
| 1223 | err = get_scrap_from_symbol (Vmac_services_selection, 0, &cur_scrap); | 1414 | err = get_scrap_from_symbol (Vmac_service_selection, 0, &cur_scrap); |
| 1224 | if (!(err == noErr && cur_scrap)) | 1415 | if (!(err == noErr && cur_scrap)) |
| 1225 | return eventNotHandledErr; | 1416 | return eventNotHandledErr; |
| 1226 | 1417 | ||
| @@ -1257,7 +1448,7 @@ mac_handle_service_event (call_ref, event, data) | |||
| 1257 | if (err != noErr) | 1448 | if (err != noErr) |
| 1258 | break; | 1449 | break; |
| 1259 | 1450 | ||
| 1260 | if (NILP (Fx_selection_owner_p (Vmac_services_selection))) | 1451 | if (NILP (Fx_selection_owner_p (Vmac_service_selection))) |
| 1261 | break; | 1452 | break; |
| 1262 | else | 1453 | else |
| 1263 | goto copy_all_flavors; | 1454 | goto copy_all_flavors; |
| @@ -1267,7 +1458,7 @@ mac_handle_service_event (call_ref, event, data) | |||
| 1267 | typeScrapRef, NULL, | 1458 | typeScrapRef, NULL, |
| 1268 | sizeof (ScrapRef), NULL, &specific_scrap); | 1459 | sizeof (ScrapRef), NULL, &specific_scrap); |
| 1269 | if (err != noErr | 1460 | if (err != noErr |
| 1270 | || NILP (Fx_selection_owner_p (Vmac_services_selection))) | 1461 | || NILP (Fx_selection_owner_p (Vmac_service_selection))) |
| 1271 | { | 1462 | { |
| 1272 | err = eventNotHandledErr; | 1463 | err = eventNotHandledErr; |
| 1273 | break; | 1464 | break; |
| @@ -1342,7 +1533,7 @@ mac_handle_service_event (call_ref, event, data) | |||
| 1342 | if (!data_exists_p) | 1533 | if (!data_exists_p) |
| 1343 | err = eventNotHandledErr; | 1534 | err = eventNotHandledErr; |
| 1344 | else | 1535 | else |
| 1345 | err = mac_store_services_event (event); | 1536 | err = mac_store_service_event (event); |
| 1346 | } | 1537 | } |
| 1347 | break; | 1538 | break; |
| 1348 | } | 1539 | } |
| @@ -1408,10 +1599,21 @@ set to nil. */); | |||
| 1408 | doc: /* Keymap for Apple events handled by Emacs. */); | 1599 | doc: /* Keymap for Apple events handled by Emacs. */); |
| 1409 | Vmac_apple_event_map = Qnil; | 1600 | Vmac_apple_event_map = Qnil; |
| 1410 | 1601 | ||
| 1602 | #if TARGET_API_MAC_CARBON | ||
| 1603 | DEFVAR_LISP ("mac-dnd-known-types", &Vmac_dnd_known_types, | ||
| 1604 | doc: /* The types accepted by default for dropped data. | ||
| 1605 | The types are chosen in the order they appear in the list. */); | ||
| 1606 | Vmac_dnd_known_types = list4 (build_string ("hfs "), build_string ("utxt"), | ||
| 1607 | build_string ("TEXT"), build_string ("TIFF")); | ||
| 1608 | #ifdef MAC_OSX | ||
| 1609 | Vmac_dnd_known_types = Fcons (build_string ("furl"), Vmac_dnd_known_types); | ||
| 1610 | #endif | ||
| 1611 | #endif | ||
| 1612 | |||
| 1411 | #ifdef MAC_OSX | 1613 | #ifdef MAC_OSX |
| 1412 | DEFVAR_LISP ("mac-services-selection", &Vmac_services_selection, | 1614 | DEFVAR_LISP ("mac-service-selection", &Vmac_service_selection, |
| 1413 | doc: /* Selection name for communication via Services menu. */); | 1615 | doc: /* Selection name for communication via Services menu. */); |
| 1414 | Vmac_services_selection = intern ("PRIMARY"); | 1616 | Vmac_service_selection = intern ("PRIMARY"); |
| 1415 | #endif | 1617 | #endif |
| 1416 | 1618 | ||
| 1417 | QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); | 1619 | QPRIMARY = intern ("PRIMARY"); staticpro (&QPRIMARY); |
diff --git a/src/macterm.c b/src/macterm.c index 8ddd8febd69..e3b8b3b5881 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -4099,6 +4099,11 @@ x_new_focus_frame (dpyinfo, frame) | |||
| 4099 | pending_autoraise_frame = dpyinfo->x_focus_frame; | 4099 | pending_autoraise_frame = dpyinfo->x_focus_frame; |
| 4100 | else | 4100 | else |
| 4101 | pending_autoraise_frame = 0; | 4101 | pending_autoraise_frame = 0; |
| 4102 | |||
| 4103 | #if USE_MAC_FONT_PANEL | ||
| 4104 | if (frame) | ||
| 4105 | mac_set_font_info_for_selection (frame, DEFAULT_FACE_ID, 0); | ||
| 4106 | #endif | ||
| 4102 | } | 4107 | } |
| 4103 | 4108 | ||
| 4104 | x_frame_rehighlight (dpyinfo); | 4109 | x_frame_rehighlight (dpyinfo); |
| @@ -4456,35 +4461,11 @@ scroll_bar_timer_callback (timer, data) | |||
| 4456 | EventLoopTimerRef timer; | 4461 | EventLoopTimerRef timer; |
| 4457 | void *data; | 4462 | void *data; |
| 4458 | { | 4463 | { |
| 4459 | EventRef event = NULL; | 4464 | OSStatus err; |
| 4460 | OSErr err; | ||
| 4461 | |||
| 4462 | err = CreateEvent (NULL, kEventClassMouse, kEventMouseMoved, 0, | ||
| 4463 | kEventAttributeNone, &event); | ||
| 4464 | if (err == noErr) | ||
| 4465 | { | ||
| 4466 | Point mouse_pos; | ||
| 4467 | |||
| 4468 | GetMouse (&mouse_pos); | ||
| 4469 | LocalToGlobal (&mouse_pos); | ||
| 4470 | err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint, | ||
| 4471 | sizeof (Point), &mouse_pos); | ||
| 4472 | } | ||
| 4473 | if (err == noErr) | ||
| 4474 | { | ||
| 4475 | UInt32 modifiers = GetCurrentKeyModifiers (); | ||
| 4476 | 4465 | ||
| 4477 | err = SetEventParameter (event, kEventParamKeyModifiers, typeUInt32, | 4466 | err = mac_post_mouse_moved_event (); |
| 4478 | sizeof (UInt32), &modifiers); | ||
| 4479 | } | ||
| 4480 | if (err == noErr) | ||
| 4481 | err = PostEventToQueue (GetCurrentEventQueue (), event, | ||
| 4482 | kEventPriorityStandard); | ||
| 4483 | if (err == noErr) | 4467 | if (err == noErr) |
| 4484 | scroll_bar_timer_event_posted_p = 1; | 4468 | scroll_bar_timer_event_posted_p = 1; |
| 4485 | |||
| 4486 | if (event) | ||
| 4487 | ReleaseEvent (event); | ||
| 4488 | } | 4469 | } |
| 4489 | 4470 | ||
| 4490 | static OSStatus | 4471 | static OSStatus |
| @@ -6386,7 +6367,12 @@ x_free_frame_resources (f) | |||
| 6386 | f->output_data.mac = NULL; | 6367 | f->output_data.mac = NULL; |
| 6387 | 6368 | ||
| 6388 | if (f == dpyinfo->x_focus_frame) | 6369 | if (f == dpyinfo->x_focus_frame) |
| 6389 | dpyinfo->x_focus_frame = 0; | 6370 | { |
| 6371 | dpyinfo->x_focus_frame = 0; | ||
| 6372 | #if USE_MAC_FONT_PANEL | ||
| 6373 | mac_set_font_info_for_selection (NULL, DEFAULT_FACE_ID, 0); | ||
| 6374 | #endif | ||
| 6375 | } | ||
| 6390 | if (f == dpyinfo->x_focus_event_frame) | 6376 | if (f == dpyinfo->x_focus_event_frame) |
| 6391 | dpyinfo->x_focus_event_frame = 0; | 6377 | dpyinfo->x_focus_event_frame = 0; |
| 6392 | if (f == dpyinfo->x_highlight_frame) | 6378 | if (f == dpyinfo->x_highlight_frame) |
| @@ -6742,10 +6728,6 @@ xlfdpat_create (pattern) | |||
| 6742 | } | 6728 | } |
| 6743 | 6729 | ||
| 6744 | return pat; | 6730 | return pat; |
| 6745 | |||
| 6746 | error: | ||
| 6747 | xlfdpat_destroy (pat); | ||
| 6748 | return NULL; | ||
| 6749 | } | 6731 | } |
| 6750 | 6732 | ||
| 6751 | static INLINE int | 6733 | static INLINE int |
| @@ -6914,6 +6896,8 @@ static Lisp_Object fm_font_family_alist; | |||
| 6914 | #if USE_ATSUI | 6896 | #if USE_ATSUI |
| 6915 | /* Hash table linking font family names to ATSU font IDs. */ | 6897 | /* Hash table linking font family names to ATSU font IDs. */ |
| 6916 | static Lisp_Object atsu_font_id_hash; | 6898 | static Lisp_Object atsu_font_id_hash; |
| 6899 | static Lisp_Object Vmac_atsu_font_table; | ||
| 6900 | extern Lisp_Object QCfamily, QCweight, QCslant, Qnormal, Qbold, Qitalic; | ||
| 6917 | #endif | 6901 | #endif |
| 6918 | 6902 | ||
| 6919 | /* Alist linking character set strings to Mac text encoding and Emacs | 6903 | /* Alist linking character set strings to Mac text encoding and Emacs |
| @@ -7209,8 +7193,21 @@ init_font_name_table () | |||
| 7209 | NULL, NULL); | 7193 | NULL, NULL); |
| 7210 | if (err == noErr) | 7194 | if (err == noErr) |
| 7211 | { | 7195 | { |
| 7196 | FMFontFamily ff; | ||
| 7197 | FMFontStyle style = normal; | ||
| 7198 | |||
| 7212 | decode_mac_font_name (name, name_len + 1, Qnil); | 7199 | decode_mac_font_name (name, name_len + 1, Qnil); |
| 7213 | family = make_unibyte_string (name, name_len); | 7200 | family = make_unibyte_string (name, name_len); |
| 7201 | FMGetFontFamilyInstanceFromFont (font_ids[i], &ff, &style); | ||
| 7202 | Fputhash (make_unibyte_string ((char *)(font_ids + i), | ||
| 7203 | sizeof (ATSUFontID)), | ||
| 7204 | Fcons (QCfamily, | ||
| 7205 | list5 (family, | ||
| 7206 | QCweight, | ||
| 7207 | style & bold ? Qbold : Qnormal, | ||
| 7208 | QCslant, | ||
| 7209 | style & italic ? Qitalic : Qnormal)), | ||
| 7210 | Vmac_atsu_font_table); | ||
| 7214 | if (*name != '.' | 7211 | if (*name != '.' |
| 7215 | && hash_lookup (h, family, &hash_code) < 0) | 7212 | && hash_lookup (h, family, &hash_code) < 0) |
| 7216 | { | 7213 | { |
| @@ -7756,6 +7753,7 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7756 | ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector, | 7753 | ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector, |
| 7757 | kDecomposeDiacriticsSelector}; | 7754 | kDecomposeDiacriticsSelector}; |
| 7758 | Lisp_Object font_id_cons; | 7755 | Lisp_Object font_id_cons; |
| 7756 | FMFontStyle style; | ||
| 7759 | 7757 | ||
| 7760 | font_id_cons = Fgethash (make_unibyte_string (family, strlen (family)), | 7758 | font_id_cons = Fgethash (make_unibyte_string (family, strlen (family)), |
| 7761 | atsu_font_id_hash, Qnil); | 7759 | atsu_font_id_hash, Qnil); |
| @@ -7774,7 +7772,11 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7774 | return NULL; | 7772 | return NULL; |
| 7775 | err = ATSUSetAttributes (mac_style, sizeof (tags) / sizeof (tags[0]), | 7773 | err = ATSUSetAttributes (mac_style, sizeof (tags) / sizeof (tags[0]), |
| 7776 | tags, sizes, values); | 7774 | tags, sizes, values); |
| 7777 | fontnum = -1; | 7775 | if (err != noErr) |
| 7776 | return NULL; | ||
| 7777 | err = FMGetFontFamilyInstanceFromFont (font_id, &fontnum, &style); | ||
| 7778 | if (err != noErr) | ||
| 7779 | fontnum = -1; | ||
| 7778 | scriptcode = kTextEncodingMacUnicode; | 7780 | scriptcode = kTextEncodingMacUnicode; |
| 7779 | } | 7781 | } |
| 7780 | else | 7782 | else |
| @@ -7834,22 +7836,20 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7834 | pcm_init (font->bounds.rows[0], 0x100); | 7836 | pcm_init (font->bounds.rows[0], 0x100); |
| 7835 | 7837 | ||
| 7836 | #if USE_CG_TEXT_DRAWING | 7838 | #if USE_CG_TEXT_DRAWING |
| 7837 | { | 7839 | if (fontnum != -1) |
| 7838 | FMFontFamily font_family; | 7840 | { |
| 7839 | FMFontStyle style; | 7841 | FMFontStyle style; |
| 7840 | ATSFontRef ats_font; | 7842 | ATSFontRef ats_font; |
| 7841 | 7843 | ||
| 7842 | err = FMGetFontFamilyInstanceFromFont (font_id, &font_family, &style); | 7844 | err = FMGetFontFromFontFamilyInstance (fontnum, fontface, |
| 7843 | if (err == noErr) | ||
| 7844 | err = FMGetFontFromFontFamilyInstance (font_family, fontface, | ||
| 7845 | &font_id, &style); | 7845 | &font_id, &style); |
| 7846 | /* Use CG text drawing if italic/bold is not synthesized. */ | 7846 | /* Use CG text drawing if italic/bold is not synthesized. */ |
| 7847 | if (err == noErr && style == fontface) | 7847 | if (err == noErr && style == fontface) |
| 7848 | { | 7848 | { |
| 7849 | ats_font = FMGetATSFontRefFromFont (font_id); | 7849 | ats_font = FMGetATSFontRefFromFont (font_id); |
| 7850 | font->cg_font = CGFontCreateWithPlatformFont (&ats_font); | 7850 | font->cg_font = CGFontCreateWithPlatformFont (&ats_font); |
| 7851 | } | 7851 | } |
| 7852 | } | 7852 | } |
| 7853 | 7853 | ||
| 7854 | if (font->cg_font) | 7854 | if (font->cg_font) |
| 7855 | { | 7855 | { |
| @@ -8340,6 +8340,55 @@ x_find_ccl_program (fontp) | |||
| 8340 | } | 8340 | } |
| 8341 | } | 8341 | } |
| 8342 | 8342 | ||
| 8343 | #if USE_MAC_FONT_PANEL | ||
| 8344 | OSStatus | ||
| 8345 | mac_set_font_info_for_selection (f, face_id, c) | ||
| 8346 | struct frame *f; | ||
| 8347 | int face_id, c; | ||
| 8348 | { | ||
| 8349 | OSStatus err; | ||
| 8350 | EventTargetRef target = NULL; | ||
| 8351 | XFontStruct *font = NULL; | ||
| 8352 | |||
| 8353 | if (f) | ||
| 8354 | { | ||
| 8355 | target = GetWindowEventTarget (FRAME_MAC_WINDOW (f)); | ||
| 8356 | |||
| 8357 | if (FRAME_FACE_CACHE (f) && CHAR_VALID_P (c, 0)) | ||
| 8358 | { | ||
| 8359 | struct face *face; | ||
| 8360 | |||
| 8361 | face_id = FACE_FOR_CHAR (f, FACE_FROM_ID (f, face_id), c); | ||
| 8362 | face = FACE_FROM_ID (f, face_id); | ||
| 8363 | font = face->font; | ||
| 8364 | } | ||
| 8365 | } | ||
| 8366 | |||
| 8367 | if (font == NULL) | ||
| 8368 | err = SetFontInfoForSelection (kFontSelectionATSUIType, 0, NULL, target); | ||
| 8369 | else | ||
| 8370 | { | ||
| 8371 | if (font->mac_fontnum != -1) | ||
| 8372 | { | ||
| 8373 | FontSelectionQDStyle qd_style; | ||
| 8374 | |||
| 8375 | qd_style.version = kFontSelectionQDStyleVersionZero; | ||
| 8376 | qd_style.instance.fontFamily = font->mac_fontnum; | ||
| 8377 | qd_style.instance.fontStyle = font->mac_fontface; | ||
| 8378 | qd_style.size = font->mac_fontsize; | ||
| 8379 | qd_style.hasColor = false; | ||
| 8380 | |||
| 8381 | err = SetFontInfoForSelection (kFontSelectionQDType, | ||
| 8382 | 1, &qd_style, target); | ||
| 8383 | } | ||
| 8384 | else | ||
| 8385 | err = SetFontInfoForSelection (kFontSelectionATSUIType, | ||
| 8386 | 1, &font->mac_style, target); | ||
| 8387 | } | ||
| 8388 | |||
| 8389 | return err; | ||
| 8390 | } | ||
| 8391 | #endif | ||
| 8343 | 8392 | ||
| 8344 | 8393 | ||
| 8345 | /* The Mac Event loop code */ | 8394 | /* The Mac Event loop code */ |
| @@ -8427,6 +8476,14 @@ Point saved_menu_event_location; | |||
| 8427 | /* Apple Events */ | 8476 | /* Apple Events */ |
| 8428 | #if USE_CARBON_EVENTS | 8477 | #if USE_CARBON_EVENTS |
| 8429 | static Lisp_Object Qhicommand; | 8478 | static Lisp_Object Qhicommand; |
| 8479 | #ifdef MAC_OSX | ||
| 8480 | extern Lisp_Object Qwindow; | ||
| 8481 | static Lisp_Object Qtoolbar_switch_mode; | ||
| 8482 | #endif | ||
| 8483 | #if USE_MAC_FONT_PANEL | ||
| 8484 | extern Lisp_Object Qfont; | ||
| 8485 | static Lisp_Object Qpanel_closed, Qselection; | ||
| 8486 | #endif | ||
| 8430 | #endif | 8487 | #endif |
| 8431 | extern int mac_ready_for_apple_events; | 8488 | extern int mac_ready_for_apple_events; |
| 8432 | extern Lisp_Object Qundefined; | 8489 | extern Lisp_Object Qundefined; |
| @@ -8436,18 +8493,14 @@ extern void mac_find_apple_event_spec P_ ((AEEventClass, AEEventID, | |||
| 8436 | Lisp_Object *)); | 8493 | Lisp_Object *)); |
| 8437 | extern OSErr init_coercion_handler P_ ((void)); | 8494 | extern OSErr init_coercion_handler P_ ((void)); |
| 8438 | 8495 | ||
| 8439 | #if TARGET_API_MAC_CARBON | ||
| 8440 | /* Drag and Drop */ | 8496 | /* Drag and Drop */ |
| 8441 | static pascal OSErr mac_do_track_drag (DragTrackingMessage, WindowPtr, void*, DragReference); | 8497 | OSErr install_drag_handler P_ ((WindowRef)); |
| 8442 | static pascal OSErr mac_do_receive_drag (WindowPtr, void*, DragReference); | 8498 | void remove_drag_handler P_ ((WindowRef)); |
| 8443 | static DragTrackingHandlerUPP mac_do_track_dragUPP = NULL; | ||
| 8444 | static DragReceiveHandlerUPP mac_do_receive_dragUPP = NULL; | ||
| 8445 | #endif | ||
| 8446 | 8499 | ||
| 8447 | #if USE_CARBON_EVENTS | 8500 | #if USE_CARBON_EVENTS |
| 8448 | #ifdef MAC_OSX | 8501 | #ifdef MAC_OSX |
| 8449 | extern void init_service_handler (); | 8502 | extern void init_service_handler (); |
| 8450 | static Lisp_Object Qservices, Qpaste, Qperform; | 8503 | static Lisp_Object Qservice, Qpaste, Qperform; |
| 8451 | #endif | 8504 | #endif |
| 8452 | /* Window Event Handler */ | 8505 | /* Window Event Handler */ |
| 8453 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, | 8506 | static pascal OSStatus mac_handle_window_event (EventHandlerCallRef, |
| @@ -8998,47 +9051,84 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) | |||
| 8998 | x_real_positions (f, &f->left_pos, &f->top_pos); | 9051 | x_real_positions (f, &f->left_pos, &f->top_pos); |
| 8999 | } | 9052 | } |
| 9000 | 9053 | ||
| 9001 | OSErr | 9054 | void |
| 9002 | mac_store_apple_event (class, id, desc) | 9055 | mac_store_apple_event (class, id, desc) |
| 9003 | Lisp_Object class, id; | 9056 | Lisp_Object class, id; |
| 9004 | const AEDesc *desc; | 9057 | const AEDesc *desc; |
| 9005 | { | 9058 | { |
| 9006 | OSErr err; | ||
| 9007 | struct input_event buf; | 9059 | struct input_event buf; |
| 9008 | AEDesc *desc_copy; | ||
| 9009 | 9060 | ||
| 9010 | desc_copy = xmalloc (sizeof (AEDesc)); | 9061 | EVENT_INIT (buf); |
| 9011 | err = AEDuplicateDesc (desc, desc_copy); | 9062 | |
| 9012 | if (err == noErr) | 9063 | buf.kind = MAC_APPLE_EVENT; |
| 9013 | { | 9064 | buf.x = class; |
| 9014 | EVENT_INIT (buf); | 9065 | buf.y = id; |
| 9066 | XSETFRAME (buf.frame_or_window, | ||
| 9067 | mac_focus_frame (&one_mac_display_info)); | ||
| 9068 | /* Now that Lisp object allocations are protected by BLOCK_INPUT, it | ||
| 9069 | is safe to use them during read_socket_hook. */ | ||
| 9070 | buf.arg = mac_aedesc_to_lisp (desc); | ||
| 9071 | kbd_buffer_store_event (&buf); | ||
| 9072 | } | ||
| 9015 | 9073 | ||
| 9016 | buf.kind = MAC_APPLE_EVENT; | 9074 | #if TARGET_API_MAC_CARBON |
| 9017 | buf.x = class; | 9075 | static OSStatus |
| 9018 | buf.y = id; | 9076 | mac_store_event_ref_as_apple_event (class, id, class_key, id_key, |
| 9019 | buf.code = (int)desc_copy; | 9077 | event, num_params, names, types) |
| 9020 | XSETFRAME (buf.frame_or_window, | 9078 | AEEventClass class; |
| 9021 | mac_focus_frame (&one_mac_display_info)); | 9079 | AEEventID id; |
| 9022 | buf.arg = Qnil; | 9080 | Lisp_Object class_key, id_key; |
| 9023 | kbd_buffer_store_event (&buf); | 9081 | EventRef event; |
| 9082 | UInt32 num_params; | ||
| 9083 | EventParamName *names; | ||
| 9084 | EventParamType *types; | ||
| 9085 | { | ||
| 9086 | OSStatus err = eventNotHandledErr; | ||
| 9087 | Lisp_Object binding; | ||
| 9088 | |||
| 9089 | mac_find_apple_event_spec (class, id, &class_key, &id_key, &binding); | ||
| 9090 | if (!NILP (binding) && !EQ (binding, Qundefined)) | ||
| 9091 | { | ||
| 9092 | if (INTEGERP (binding)) | ||
| 9093 | err = XINT (binding); | ||
| 9094 | else | ||
| 9095 | { | ||
| 9096 | AppleEvent apple_event; | ||
| 9097 | err = create_apple_event_from_event_ref (event, num_params, | ||
| 9098 | names, types, | ||
| 9099 | &apple_event); | ||
| 9100 | if (err == noErr) | ||
| 9101 | { | ||
| 9102 | mac_store_apple_event (class_key, id_key, &apple_event); | ||
| 9103 | AEDisposeDesc (&apple_event); | ||
| 9104 | } | ||
| 9105 | } | ||
| 9024 | } | 9106 | } |
| 9025 | 9107 | ||
| 9026 | return err; | 9108 | return err; |
| 9027 | } | 9109 | } |
| 9028 | 9110 | ||
| 9029 | Lisp_Object | 9111 | void |
| 9030 | mac_make_lispy_event_code (code) | 9112 | mac_store_drag_event (window, mouse_pos, modifiers, desc) |
| 9031 | int code; | 9113 | WindowRef window; |
| 9114 | Point mouse_pos; | ||
| 9115 | SInt16 modifiers; | ||
| 9116 | const AEDesc *desc; | ||
| 9032 | { | 9117 | { |
| 9033 | AEDesc *desc = (AEDesc *)code; | 9118 | struct input_event buf; |
| 9034 | Lisp_Object obj; | ||
| 9035 | 9119 | ||
| 9036 | obj = mac_aedesc_to_lisp (desc); | 9120 | EVENT_INIT (buf); |
| 9037 | AEDisposeDesc (desc); | ||
| 9038 | xfree (desc); | ||
| 9039 | 9121 | ||
| 9040 | return obj; | 9122 | buf.kind = DRAG_N_DROP_EVENT; |
| 9123 | buf.modifiers = mac_to_emacs_modifiers (modifiers); | ||
| 9124 | buf.timestamp = TickCount () * (1000 / 60); | ||
| 9125 | XSETINT (buf.x, mouse_pos.h); | ||
| 9126 | XSETINT (buf.y, mouse_pos.v); | ||
| 9127 | XSETFRAME (buf.frame_or_window, mac_window_to_frame (window)); | ||
| 9128 | buf.arg = mac_aedesc_to_lisp (desc); | ||
| 9129 | kbd_buffer_store_event (&buf); | ||
| 9041 | } | 9130 | } |
| 9131 | #endif | ||
| 9042 | 9132 | ||
| 9043 | #if USE_CARBON_EVENTS | 9133 | #if USE_CARBON_EVENTS |
| 9044 | static pascal OSStatus | 9134 | static pascal OSStatus |
| @@ -9049,7 +9139,11 @@ mac_handle_command_event (next_handler, event, data) | |||
| 9049 | { | 9139 | { |
| 9050 | OSStatus result, err; | 9140 | OSStatus result, err; |
| 9051 | HICommand command; | 9141 | HICommand command; |
| 9052 | Lisp_Object class_key, id_key, binding; | 9142 | static EventParamName names[] = {kEventParamDirectObject, |
| 9143 | kEventParamKeyModifiers}; | ||
| 9144 | static EventParamType types[] = {typeHICommand, | ||
| 9145 | typeUInt32}; | ||
| 9146 | int num_params = sizeof (names) / sizeof (names[0]); | ||
| 9053 | 9147 | ||
| 9054 | result = CallNextEventHandler (next_handler, event); | 9148 | result = CallNextEventHandler (next_handler, event); |
| 9055 | if (result != eventNotHandledErr) | 9149 | if (result != eventNotHandledErr) |
| @@ -9063,33 +9157,10 @@ mac_handle_command_event (next_handler, event, data) | |||
| 9063 | 9157 | ||
| 9064 | /* A HICommand event is mapped to an Apple event whose event class | 9158 | /* A HICommand event is mapped to an Apple event whose event class |
| 9065 | symbol is `hicommand' and event ID is its command ID. */ | 9159 | symbol is `hicommand' and event ID is its command ID. */ |
| 9066 | class_key = Qhicommand; | 9160 | err = mac_store_event_ref_as_apple_event (0, command.commandID, |
| 9067 | mac_find_apple_event_spec (0, command.commandID, | 9161 | Qhicommand, Qnil, |
| 9068 | &class_key, &id_key, &binding); | 9162 | event, num_params, names, types); |
| 9069 | if (!NILP (binding) && !EQ (binding, Qundefined)) | 9163 | return err == noErr ? noErr : eventNotHandledErr; |
| 9070 | { | ||
| 9071 | if (INTEGERP (binding)) | ||
| 9072 | return XINT (binding); | ||
| 9073 | else | ||
| 9074 | { | ||
| 9075 | AppleEvent apple_event; | ||
| 9076 | static EventParamName names[] = {kEventParamDirectObject, | ||
| 9077 | kEventParamKeyModifiers}; | ||
| 9078 | static EventParamType types[] = {typeHICommand, | ||
| 9079 | typeUInt32}; | ||
| 9080 | err = create_apple_event_from_event_ref (event, 2, names, types, | ||
| 9081 | &apple_event); | ||
| 9082 | if (err == noErr) | ||
| 9083 | { | ||
| 9084 | err = mac_store_apple_event (class_key, id_key, &apple_event); | ||
| 9085 | AEDisposeDesc (&apple_event); | ||
| 9086 | } | ||
| 9087 | if (err == noErr) | ||
| 9088 | return noErr; | ||
| 9089 | } | ||
| 9090 | } | ||
| 9091 | |||
| 9092 | return eventNotHandledErr; | ||
| 9093 | } | 9164 | } |
| 9094 | 9165 | ||
| 9095 | static OSErr | 9166 | static OSErr |
| @@ -9192,6 +9263,33 @@ mac_handle_window_event (next_handler, event, data) | |||
| 9192 | return noErr; | 9263 | return noErr; |
| 9193 | 9264 | ||
| 9194 | break; | 9265 | break; |
| 9266 | |||
| 9267 | #ifdef MAC_OSX | ||
| 9268 | case kEventWindowToolbarSwitchMode: | ||
| 9269 | result = CallNextEventHandler (next_handler, event); | ||
| 9270 | { | ||
| 9271 | static EventParamName names[] = {kEventParamDirectObject, | ||
| 9272 | kEventParamWindowMouseLocation, | ||
| 9273 | kEventParamKeyModifiers, | ||
| 9274 | kEventParamMouseButton, | ||
| 9275 | kEventParamClickCount, | ||
| 9276 | kEventParamMouseChord}; | ||
| 9277 | static EventParamType types[] = {typeWindowRef, | ||
| 9278 | typeQDPoint, | ||
| 9279 | typeUInt32, | ||
| 9280 | typeMouseButton, | ||
| 9281 | typeUInt32, | ||
| 9282 | typeUInt32}; | ||
| 9283 | int num_params = sizeof (names) / sizeof (names[0]); | ||
| 9284 | |||
| 9285 | err = mac_store_event_ref_as_apple_event (0, 0, | ||
| 9286 | Qwindow, | ||
| 9287 | Qtoolbar_switch_mode, | ||
| 9288 | event, num_params, | ||
| 9289 | names, types); | ||
| 9290 | } | ||
| 9291 | return err == noErr ? noErr : result; | ||
| 9292 | #endif | ||
| 9195 | } | 9293 | } |
| 9196 | 9294 | ||
| 9197 | return eventNotHandledErr; | 9295 | return eventNotHandledErr; |
| @@ -9266,45 +9364,96 @@ mac_handle_mouse_event (next_handler, event, data) | |||
| 9266 | return eventNotHandledErr; | 9364 | return eventNotHandledErr; |
| 9267 | } | 9365 | } |
| 9268 | 9366 | ||
| 9367 | #if USE_MAC_FONT_PANEL | ||
| 9368 | static pascal OSStatus | ||
| 9369 | mac_handle_font_event (next_handler, event, data) | ||
| 9370 | EventHandlerCallRef next_handler; | ||
| 9371 | EventRef event; | ||
| 9372 | void *data; | ||
| 9373 | { | ||
| 9374 | OSStatus result, err; | ||
| 9375 | Lisp_Object id_key; | ||
| 9376 | int num_params; | ||
| 9377 | EventParamName *names; | ||
| 9378 | EventParamType *types; | ||
| 9379 | static EventParamName names_sel[] = {kEventParamATSUFontID, | ||
| 9380 | kEventParamATSUFontSize, | ||
| 9381 | kEventParamFMFontFamily, | ||
| 9382 | kEventParamFMFontSize, | ||
| 9383 | kEventParamFontColor}; | ||
| 9384 | static EventParamType types_sel[] = {typeATSUFontID, | ||
| 9385 | typeATSUSize, | ||
| 9386 | typeFMFontFamily, | ||
| 9387 | typeFMFontSize, | ||
| 9388 | typeFontColor}; | ||
| 9389 | |||
| 9390 | result = CallNextEventHandler (next_handler, event); | ||
| 9391 | if (result != eventNotHandledErr) | ||
| 9392 | return result; | ||
| 9393 | |||
| 9394 | switch (GetEventKind (event)) | ||
| 9395 | { | ||
| 9396 | case kEventFontPanelClosed: | ||
| 9397 | id_key = Qpanel_closed; | ||
| 9398 | num_params = 0; | ||
| 9399 | names = NULL; | ||
| 9400 | types = NULL; | ||
| 9401 | break; | ||
| 9402 | |||
| 9403 | case kEventFontSelection: | ||
| 9404 | id_key = Qselection; | ||
| 9405 | num_params = sizeof (names_sel) / sizeof (names_sel[0]); | ||
| 9406 | names = names_sel; | ||
| 9407 | types = types_sel; | ||
| 9408 | break; | ||
| 9409 | } | ||
| 9410 | |||
| 9411 | err = mac_store_event_ref_as_apple_event (0, 0, Qfont, id_key, | ||
| 9412 | event, num_params, | ||
| 9413 | names, types); | ||
| 9414 | |||
| 9415 | return err == noErr ? noErr : eventNotHandledErr; | ||
| 9416 | } | ||
| 9417 | #endif | ||
| 9418 | |||
| 9269 | #ifdef MAC_OSX | 9419 | #ifdef MAC_OSX |
| 9270 | OSErr | 9420 | OSStatus |
| 9271 | mac_store_services_event (event) | 9421 | mac_store_service_event (event) |
| 9272 | EventRef event; | 9422 | EventRef event; |
| 9273 | { | 9423 | { |
| 9274 | OSErr err; | 9424 | OSStatus err; |
| 9275 | AppleEvent apple_event; | ||
| 9276 | Lisp_Object id_key; | 9425 | Lisp_Object id_key; |
| 9426 | int num_params; | ||
| 9427 | EventParamName *names; | ||
| 9428 | EventParamType *types; | ||
| 9429 | static EventParamName names_pfm[] = {kEventParamServiceMessageName, | ||
| 9430 | kEventParamServiceUserData}; | ||
| 9431 | static EventParamType types_pfm[] = {typeCFStringRef, | ||
| 9432 | typeCFStringRef}; | ||
| 9277 | 9433 | ||
| 9278 | switch (GetEventKind (event)) | 9434 | switch (GetEventKind (event)) |
| 9279 | { | 9435 | { |
| 9280 | case kEventServicePaste: | 9436 | case kEventServicePaste: |
| 9281 | id_key = Qpaste; | 9437 | id_key = Qpaste; |
| 9282 | err = create_apple_event_from_event_ref (event, 0, NULL, NULL, | 9438 | num_params = 0; |
| 9283 | &apple_event); | 9439 | names = NULL; |
| 9440 | types = NULL; | ||
| 9284 | break; | 9441 | break; |
| 9285 | 9442 | ||
| 9286 | case kEventServicePerform: | 9443 | case kEventServicePerform: |
| 9287 | { | 9444 | id_key = Qperform; |
| 9288 | static EventParamName names[] = {kEventParamServiceMessageName, | 9445 | num_params = sizeof (names_pfm) / sizeof (names_pfm[0]); |
| 9289 | kEventParamServiceUserData}; | 9446 | names = names_pfm; |
| 9290 | static EventParamType types[] = {typeCFStringRef, | 9447 | types = types_pfm; |
| 9291 | typeCFStringRef}; | ||
| 9292 | |||
| 9293 | id_key = Qperform; | ||
| 9294 | err = create_apple_event_from_event_ref (event, 2, names, types, | ||
| 9295 | &apple_event); | ||
| 9296 | } | ||
| 9297 | break; | 9448 | break; |
| 9298 | 9449 | ||
| 9299 | default: | 9450 | default: |
| 9300 | abort (); | 9451 | abort (); |
| 9301 | } | 9452 | } |
| 9302 | 9453 | ||
| 9303 | if (err == noErr) | 9454 | err = mac_store_event_ref_as_apple_event (0, 0, Qservice, id_key, |
| 9304 | { | 9455 | event, num_params, |
| 9305 | err = mac_store_apple_event (Qservices, id_key, &apple_event); | 9456 | names, types); |
| 9306 | AEDisposeDesc (&apple_event); | ||
| 9307 | } | ||
| 9308 | 9457 | ||
| 9309 | return err; | 9458 | return err; |
| 9310 | } | 9459 | } |
| @@ -9324,15 +9473,28 @@ install_window_handler (window) | |||
| 9324 | {kEventClassWindow, kEventWindowShown}, | 9473 | {kEventClassWindow, kEventWindowShown}, |
| 9325 | {kEventClassWindow, kEventWindowHidden}, | 9474 | {kEventClassWindow, kEventWindowHidden}, |
| 9326 | {kEventClassWindow, kEventWindowExpanded}, | 9475 | {kEventClassWindow, kEventWindowExpanded}, |
| 9327 | {kEventClassWindow, kEventWindowCollapsed}}; | 9476 | {kEventClassWindow, kEventWindowCollapsed}, |
| 9477 | #ifdef MAC_OSX | ||
| 9478 | {kEventClassWindow, kEventWindowToolbarSwitchMode}, | ||
| 9479 | #endif | ||
| 9480 | }; | ||
| 9328 | EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; | 9481 | EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}}; |
| 9329 | static EventHandlerUPP handle_window_eventUPP = NULL; | 9482 | static EventHandlerUPP handle_window_eventUPP = NULL; |
| 9330 | static EventHandlerUPP handle_mouse_eventUPP = NULL; | 9483 | static EventHandlerUPP handle_mouse_eventUPP = NULL; |
| 9484 | #if USE_MAC_FONT_PANEL | ||
| 9485 | EventTypeSpec specs_font[] = {{kEventClassFont, kEventFontPanelClosed}, | ||
| 9486 | {kEventClassFont, kEventFontSelection}}; | ||
| 9487 | static EventHandlerUPP handle_font_eventUPP = NULL; | ||
| 9488 | #endif | ||
| 9331 | 9489 | ||
| 9332 | if (handle_window_eventUPP == NULL) | 9490 | if (handle_window_eventUPP == NULL) |
| 9333 | handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); | 9491 | handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event); |
| 9334 | if (handle_mouse_eventUPP == NULL) | 9492 | if (handle_mouse_eventUPP == NULL) |
| 9335 | handle_mouse_eventUPP = NewEventHandlerUPP (mac_handle_mouse_event); | 9493 | handle_mouse_eventUPP = NewEventHandlerUPP (mac_handle_mouse_event); |
| 9494 | #if USE_MAC_FONT_PANEL | ||
| 9495 | if (handle_font_eventUPP == NULL) | ||
| 9496 | handle_font_eventUPP = NewEventHandlerUPP (mac_handle_font_event); | ||
| 9497 | #endif | ||
| 9336 | err = InstallWindowEventHandler (window, handle_window_eventUPP, | 9498 | err = InstallWindowEventHandler (window, handle_window_eventUPP, |
| 9337 | GetEventTypeCount (specs_window), | 9499 | GetEventTypeCount (specs_window), |
| 9338 | specs_window, NULL, NULL); | 9500 | specs_window, NULL, NULL); |
| @@ -9340,18 +9502,16 @@ install_window_handler (window) | |||
| 9340 | err = InstallWindowEventHandler (window, handle_mouse_eventUPP, | 9502 | err = InstallWindowEventHandler (window, handle_mouse_eventUPP, |
| 9341 | GetEventTypeCount (specs_mouse), | 9503 | GetEventTypeCount (specs_mouse), |
| 9342 | specs_mouse, NULL, NULL); | 9504 | specs_mouse, NULL, NULL); |
| 9343 | #endif | 9505 | #if USE_MAC_FONT_PANEL |
| 9344 | #if TARGET_API_MAC_CARBON | ||
| 9345 | if (mac_do_track_dragUPP == NULL) | ||
| 9346 | mac_do_track_dragUPP = NewDragTrackingHandlerUPP (mac_do_track_drag); | ||
| 9347 | if (mac_do_receive_dragUPP == NULL) | ||
| 9348 | mac_do_receive_dragUPP = NewDragReceiveHandlerUPP (mac_do_receive_drag); | ||
| 9349 | |||
| 9350 | if (err == noErr) | 9506 | if (err == noErr) |
| 9351 | err = InstallTrackingHandler (mac_do_track_dragUPP, window, NULL); | 9507 | err = InstallWindowEventHandler (window, handle_font_eventUPP, |
| 9352 | if (err == noErr) | 9508 | GetEventTypeCount (specs_font), |
| 9353 | err = InstallReceiveHandler (mac_do_receive_dragUPP, window, NULL); | 9509 | specs_font, NULL, NULL); |
| 9510 | #endif | ||
| 9354 | #endif | 9511 | #endif |
| 9512 | if (err == noErr) | ||
| 9513 | err = install_drag_handler (window); | ||
| 9514 | |||
| 9355 | return err; | 9515 | return err; |
| 9356 | } | 9516 | } |
| 9357 | 9517 | ||
| @@ -9359,167 +9519,9 @@ void | |||
| 9359 | remove_window_handler (window) | 9519 | remove_window_handler (window) |
| 9360 | WindowPtr window; | 9520 | WindowPtr window; |
| 9361 | { | 9521 | { |
| 9362 | #if TARGET_API_MAC_CARBON | 9522 | remove_drag_handler (window); |
| 9363 | if (mac_do_track_dragUPP) | ||
| 9364 | RemoveTrackingHandler (mac_do_track_dragUPP, window); | ||
| 9365 | if (mac_do_receive_dragUPP) | ||
| 9366 | RemoveReceiveHandler (mac_do_receive_dragUPP, window); | ||
| 9367 | #endif | ||
| 9368 | } | 9523 | } |
| 9369 | 9524 | ||
| 9370 | #if TARGET_API_MAC_CARBON | ||
| 9371 | static pascal OSErr | ||
| 9372 | mac_do_track_drag (DragTrackingMessage message, WindowPtr window, | ||
| 9373 | void *handlerRefCon, DragReference theDrag) | ||
| 9374 | { | ||
| 9375 | static int can_accept; | ||
| 9376 | short items; | ||
| 9377 | short index; | ||
| 9378 | ItemReference theItem; | ||
| 9379 | FlavorFlags theFlags; | ||
| 9380 | OSErr result; | ||
| 9381 | |||
| 9382 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) | ||
| 9383 | return dragNotAcceptedErr; | ||
| 9384 | |||
| 9385 | switch (message) | ||
| 9386 | { | ||
| 9387 | case kDragTrackingEnterHandler: | ||
| 9388 | CountDragItems (theDrag, &items); | ||
| 9389 | can_accept = 0; | ||
| 9390 | for (index = 1; index <= items; index++) | ||
| 9391 | { | ||
| 9392 | GetDragItemReferenceNumber (theDrag, index, &theItem); | ||
| 9393 | result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags); | ||
| 9394 | if (result == noErr) | ||
| 9395 | { | ||
| 9396 | can_accept = 1; | ||
| 9397 | break; | ||
| 9398 | } | ||
| 9399 | } | ||
| 9400 | break; | ||
| 9401 | |||
| 9402 | case kDragTrackingEnterWindow: | ||
| 9403 | if (can_accept) | ||
| 9404 | { | ||
| 9405 | RgnHandle hilite_rgn = NewRgn (); | ||
| 9406 | Rect r; | ||
| 9407 | struct frame *f = mac_window_to_frame (window); | ||
| 9408 | |||
| 9409 | GetWindowPortBounds (window, &r); | ||
| 9410 | OffsetRect (&r, -r.left, -r.top); | ||
| 9411 | RectRgn (hilite_rgn, &r); | ||
| 9412 | ShowDragHilite (theDrag, hilite_rgn, true); | ||
| 9413 | DisposeRgn (hilite_rgn); | ||
| 9414 | SetThemeCursor (kThemeCopyArrowCursor); | ||
| 9415 | } | ||
| 9416 | break; | ||
| 9417 | |||
| 9418 | case kDragTrackingInWindow: | ||
| 9419 | break; | ||
| 9420 | |||
| 9421 | case kDragTrackingLeaveWindow: | ||
| 9422 | if (can_accept) | ||
| 9423 | { | ||
| 9424 | struct frame *f = mac_window_to_frame (window); | ||
| 9425 | |||
| 9426 | HideDragHilite (theDrag); | ||
| 9427 | SetThemeCursor (kThemeArrowCursor); | ||
| 9428 | } | ||
| 9429 | break; | ||
| 9430 | |||
| 9431 | case kDragTrackingLeaveHandler: | ||
| 9432 | break; | ||
| 9433 | } | ||
| 9434 | |||
| 9435 | return noErr; | ||
| 9436 | } | ||
| 9437 | |||
| 9438 | static pascal OSErr | ||
| 9439 | mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | ||
| 9440 | DragReference theDrag) | ||
| 9441 | { | ||
| 9442 | short items; | ||
| 9443 | short index; | ||
| 9444 | FlavorFlags theFlags; | ||
| 9445 | Point mouse; | ||
| 9446 | OSErr result; | ||
| 9447 | ItemReference theItem; | ||
| 9448 | HFSFlavor data; | ||
| 9449 | Size size = sizeof (HFSFlavor); | ||
| 9450 | Lisp_Object file_list; | ||
| 9451 | |||
| 9452 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) | ||
| 9453 | return dragNotAcceptedErr; | ||
| 9454 | |||
| 9455 | file_list = Qnil; | ||
| 9456 | GetDragMouse (theDrag, &mouse, 0L); | ||
| 9457 | CountDragItems (theDrag, &items); | ||
| 9458 | for (index = 1; index <= items; index++) | ||
| 9459 | { | ||
| 9460 | /* Only handle file references. */ | ||
| 9461 | GetDragItemReferenceNumber (theDrag, index, &theItem); | ||
| 9462 | result = GetFlavorFlags (theDrag, theItem, flavorTypeHFS, &theFlags); | ||
| 9463 | if (result == noErr) | ||
| 9464 | { | ||
| 9465 | OSErr err; | ||
| 9466 | AEDesc desc; | ||
| 9467 | |||
| 9468 | err = GetFlavorData (theDrag, theItem, flavorTypeHFS, | ||
| 9469 | &data, &size, 0L); | ||
| 9470 | if (err == noErr) | ||
| 9471 | err = AECoercePtr (typeFSS, &data.fileSpec, sizeof (FSSpec), | ||
| 9472 | TYPE_FILE_NAME, &desc); | ||
| 9473 | if (err == noErr) | ||
| 9474 | { | ||
| 9475 | Lisp_Object file; | ||
| 9476 | |||
| 9477 | /* x-dnd functions expect undecoded filenames. */ | ||
| 9478 | file = make_uninit_string (AEGetDescDataSize (&desc)); | ||
| 9479 | err = AEGetDescData (&desc, SDATA (file), SBYTES (file)); | ||
| 9480 | if (err == noErr) | ||
| 9481 | file_list = Fcons (file, file_list); | ||
| 9482 | AEDisposeDesc (&desc); | ||
| 9483 | } | ||
| 9484 | } | ||
| 9485 | } | ||
| 9486 | /* If there are items in the list, construct an event and post it to | ||
| 9487 | the queue like an interrupt using kbd_buffer_store_event. */ | ||
| 9488 | if (!NILP (file_list)) | ||
| 9489 | { | ||
| 9490 | struct input_event event; | ||
| 9491 | Lisp_Object frame; | ||
| 9492 | struct frame *f = mac_window_to_frame (window); | ||
| 9493 | SInt16 modifiers; | ||
| 9494 | |||
| 9495 | GlobalToLocal (&mouse); | ||
| 9496 | GetDragModifiers (theDrag, NULL, NULL, &modifiers); | ||
| 9497 | |||
| 9498 | event.kind = DRAG_N_DROP_EVENT; | ||
| 9499 | event.code = 0; | ||
| 9500 | event.modifiers = mac_to_emacs_modifiers (modifiers); | ||
| 9501 | event.timestamp = TickCount () * (1000 / 60); | ||
| 9502 | XSETINT (event.x, mouse.h); | ||
| 9503 | XSETINT (event.y, mouse.v); | ||
| 9504 | XSETFRAME (frame, f); | ||
| 9505 | event.frame_or_window = frame; | ||
| 9506 | event.arg = file_list; | ||
| 9507 | /* Post to the interrupt queue */ | ||
| 9508 | kbd_buffer_store_event (&event); | ||
| 9509 | /* MAC_TODO: Mimic behavior of windows by switching contexts to Emacs */ | ||
| 9510 | { | ||
| 9511 | ProcessSerialNumber psn; | ||
| 9512 | GetCurrentProcess (&psn); | ||
| 9513 | SetFrontProcess (&psn); | ||
| 9514 | } | ||
| 9515 | |||
| 9516 | return noErr; | ||
| 9517 | } | ||
| 9518 | else | ||
| 9519 | return dragNotAcceptedErr; | ||
| 9520 | } | ||
| 9521 | #endif | ||
| 9522 | |||
| 9523 | 9525 | ||
| 9524 | #if __profile__ | 9526 | #if __profile__ |
| 9525 | void | 9527 | void |
| @@ -9805,6 +9807,41 @@ mac_wait_next_event (er, sleep_time, dequeue) | |||
| 9805 | } | 9807 | } |
| 9806 | #endif /* not USE_CARBON_EVENTS */ | 9808 | #endif /* not USE_CARBON_EVENTS */ |
| 9807 | 9809 | ||
| 9810 | #if TARGET_API_MAC_CARBON | ||
| 9811 | OSStatus | ||
| 9812 | mac_post_mouse_moved_event () | ||
| 9813 | { | ||
| 9814 | EventRef event = NULL; | ||
| 9815 | OSStatus err; | ||
| 9816 | |||
| 9817 | err = CreateEvent (NULL, kEventClassMouse, kEventMouseMoved, 0, | ||
| 9818 | kEventAttributeNone, &event); | ||
| 9819 | if (err == noErr) | ||
| 9820 | { | ||
| 9821 | Point mouse_pos; | ||
| 9822 | |||
| 9823 | GetMouse (&mouse_pos); | ||
| 9824 | LocalToGlobal (&mouse_pos); | ||
| 9825 | err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint, | ||
| 9826 | sizeof (Point), &mouse_pos); | ||
| 9827 | } | ||
| 9828 | if (err == noErr) | ||
| 9829 | { | ||
| 9830 | UInt32 modifiers = GetCurrentKeyModifiers (); | ||
| 9831 | |||
| 9832 | err = SetEventParameter (event, kEventParamKeyModifiers, typeUInt32, | ||
| 9833 | sizeof (UInt32), &modifiers); | ||
| 9834 | } | ||
| 9835 | if (err == noErr) | ||
| 9836 | err = PostEventToQueue (GetCurrentEventQueue (), event, | ||
| 9837 | kEventPriorityStandard); | ||
| 9838 | if (event) | ||
| 9839 | ReleaseEvent (event); | ||
| 9840 | |||
| 9841 | return err; | ||
| 9842 | } | ||
| 9843 | #endif | ||
| 9844 | |||
| 9808 | /* Emacs calls this whenever it wants to read an input event from the | 9845 | /* Emacs calls this whenever it wants to read an input event from the |
| 9809 | user. */ | 9846 | user. */ |
| 9810 | int | 9847 | int |
| @@ -9932,7 +9969,13 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9932 | break; | 9969 | break; |
| 9933 | 9970 | ||
| 9934 | case inContent: | 9971 | case inContent: |
| 9935 | if (window_ptr != FRAME_MAC_WINDOW (mac_focus_frame (dpyinfo))) | 9972 | if ( |
| 9973 | #if TARGET_API_MAC_CARBON | ||
| 9974 | FrontNonFloatingWindow () | ||
| 9975 | #else | ||
| 9976 | FrontWindow () | ||
| 9977 | #endif | ||
| 9978 | != window_ptr) | ||
| 9936 | SelectWindow (window_ptr); | 9979 | SelectWindow (window_ptr); |
| 9937 | else | 9980 | else |
| 9938 | { | 9981 | { |
| @@ -10079,20 +10122,18 @@ XTread_socket (sd, expected, hold_quit) | |||
| 10079 | } | 10122 | } |
| 10080 | break; | 10123 | break; |
| 10081 | 10124 | ||
| 10082 | #if TARGET_API_MAC_CARBON | ||
| 10083 | case inProxyIcon: | ||
| 10084 | if (TrackWindowProxyDrag (window_ptr, er.where) | ||
| 10085 | != errUserWantsToDragWindow) | ||
| 10086 | break; | ||
| 10087 | /* fall through */ | ||
| 10088 | #endif | ||
| 10089 | case inDrag: | 10125 | case inDrag: |
| 10090 | #if TARGET_API_MAC_CARBON | 10126 | #if TARGET_API_MAC_CARBON |
| 10127 | case inProxyIcon: | ||
| 10091 | if (IsWindowPathSelectClick (window_ptr, &er)) | 10128 | if (IsWindowPathSelectClick (window_ptr, &er)) |
| 10092 | { | 10129 | { |
| 10093 | WindowPathSelect (window_ptr, NULL, NULL); | 10130 | WindowPathSelect (window_ptr, NULL, NULL); |
| 10094 | break; | 10131 | break; |
| 10095 | } | 10132 | } |
| 10133 | if (part_code == inProxyIcon | ||
| 10134 | && (TrackWindowProxyDrag (window_ptr, er.where) | ||
| 10135 | != errUserWantsToDragWindow)) | ||
| 10136 | break; | ||
| 10096 | DragWindow (window_ptr, er.where, NULL); | 10137 | DragWindow (window_ptr, er.where, NULL); |
| 10097 | #else /* not TARGET_API_MAC_CARBON */ | 10138 | #else /* not TARGET_API_MAC_CARBON */ |
| 10098 | DragWindow (window_ptr, er.where, &qd.screenBits.bounds); | 10139 | DragWindow (window_ptr, er.where, &qd.screenBits.bounds); |
| @@ -11030,7 +11071,14 @@ syms_of_macterm () | |||
| 11030 | #if USE_CARBON_EVENTS | 11071 | #if USE_CARBON_EVENTS |
| 11031 | Qhicommand = intern ("hicommand"); staticpro (&Qhicommand); | 11072 | Qhicommand = intern ("hicommand"); staticpro (&Qhicommand); |
| 11032 | #ifdef MAC_OSX | 11073 | #ifdef MAC_OSX |
| 11033 | Qservices = intern ("services"); staticpro (&Qservices); | 11074 | Qtoolbar_switch_mode = intern ("toolbar-switch-mode"); |
| 11075 | staticpro (&Qtoolbar_switch_mode); | ||
| 11076 | #if USE_MAC_FONT_PANEL | ||
| 11077 | Qpanel_closed = intern ("panel-closed"); staticpro (&Qpanel_closed); | ||
| 11078 | Qselection = intern ("selection"); staticpro (&Qselection); | ||
| 11079 | #endif | ||
| 11080 | |||
| 11081 | Qservice = intern ("service"); staticpro (&Qservice); | ||
| 11034 | Qpaste = intern ("paste"); staticpro (&Qpaste); | 11082 | Qpaste = intern ("paste"); staticpro (&Qpaste); |
| 11035 | Qperform = intern ("perform"); staticpro (&Qperform); | 11083 | Qperform = intern ("perform"); staticpro (&Qperform); |
| 11036 | #endif | 11084 | #endif |
| @@ -11070,7 +11118,7 @@ NOTE: Not supported on Mac yet. */); | |||
| 11070 | x_use_underline_position_properties = 0; | 11118 | x_use_underline_position_properties = 0; |
| 11071 | 11119 | ||
| 11072 | DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, | 11120 | DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, |
| 11073 | doc: /* If not nil, Emacs uses toolkit scroll bars. */); | 11121 | doc: /* If not nil, Emacs uses toolkit scroll bars. */); |
| 11074 | #ifdef USE_TOOLKIT_SCROLL_BARS | 11122 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 11075 | Vx_toolkit_scroll_bars = Qt; | 11123 | Vx_toolkit_scroll_bars = Qt; |
| 11076 | #else | 11124 | #else |
| @@ -11124,23 +11172,23 @@ mouse-3 and the command-key will register for mouse-2. */); | |||
| 11124 | 11172 | ||
| 11125 | #if USE_CARBON_EVENTS | 11173 | #if USE_CARBON_EVENTS |
| 11126 | DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2, | 11174 | DEFVAR_BOOL ("mac-wheel-button-is-mouse-2", &mac_wheel_button_is_mouse_2, |
| 11127 | doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3. | 11175 | doc: /* *Non-nil if the wheel button is mouse-2 and the right click mouse-3. |
| 11128 | Otherwise, the right click will be treated as mouse-2 and the wheel | 11176 | Otherwise, the right click will be treated as mouse-2 and the wheel |
| 11129 | button will be mouse-3. */); | 11177 | button will be mouse-3. */); |
| 11130 | mac_wheel_button_is_mouse_2 = 1; | 11178 | mac_wheel_button_is_mouse_2 = 1; |
| 11131 | 11179 | ||
| 11132 | DEFVAR_BOOL ("mac-pass-command-to-system", &mac_pass_command_to_system, | 11180 | DEFVAR_BOOL ("mac-pass-command-to-system", &mac_pass_command_to_system, |
| 11133 | doc: /* *Non-nil if command key presses are passed on to the Mac Toolbox. */); | 11181 | doc: /* *Non-nil if command key presses are passed on to the Mac Toolbox. */); |
| 11134 | mac_pass_command_to_system = 1; | 11182 | mac_pass_command_to_system = 1; |
| 11135 | 11183 | ||
| 11136 | DEFVAR_BOOL ("mac-pass-control-to-system", &mac_pass_control_to_system, | 11184 | DEFVAR_BOOL ("mac-pass-control-to-system", &mac_pass_control_to_system, |
| 11137 | doc: /* *Non-nil if control key presses are passed on to the Mac Toolbox. */); | 11185 | doc: /* *Non-nil if control key presses are passed on to the Mac Toolbox. */); |
| 11138 | mac_pass_control_to_system = 1; | 11186 | mac_pass_control_to_system = 1; |
| 11139 | 11187 | ||
| 11140 | #endif | 11188 | #endif |
| 11141 | 11189 | ||
| 11142 | DEFVAR_BOOL ("mac-allow-anti-aliasing", &mac_use_core_graphics, | 11190 | DEFVAR_BOOL ("mac-allow-anti-aliasing", &mac_use_core_graphics, |
| 11143 | doc: /* *If non-nil, allow anti-aliasing. | 11191 | doc: /* *If non-nil, allow anti-aliasing. |
| 11144 | The text will be rendered using Core Graphics text rendering which | 11192 | The text will be rendered using Core Graphics text rendering which |
| 11145 | may anti-alias the text. */); | 11193 | may anti-alias the text. */); |
| 11146 | #if USE_CG_DRAWING | 11194 | #if USE_CG_DRAWING |
| @@ -11153,7 +11201,7 @@ may anti-alias the text. */); | |||
| 11153 | creating the terminal frame on Mac OS 9 before loading | 11201 | creating the terminal frame on Mac OS 9 before loading |
| 11154 | term/mac-win.elc. */ | 11202 | term/mac-win.elc. */ |
| 11155 | DEFVAR_LISP ("mac-charset-info-alist", &Vmac_charset_info_alist, | 11203 | DEFVAR_LISP ("mac-charset-info-alist", &Vmac_charset_info_alist, |
| 11156 | doc: /* Alist of Emacs character sets vs text encodings and coding systems. | 11204 | doc: /* Alist of Emacs character sets vs text encodings and coding systems. |
| 11157 | Each entry should be of the form: | 11205 | Each entry should be of the form: |
| 11158 | 11206 | ||
| 11159 | (CHARSET-NAME TEXT-ENCODING CODING-SYSTEM) | 11207 | (CHARSET-NAME TEXT-ENCODING CODING-SYSTEM) |
| @@ -11164,6 +11212,18 @@ CODING_SYSTEM is a coding system corresponding to TEXT-ENCODING. */); | |||
| 11164 | Vmac_charset_info_alist = | 11212 | Vmac_charset_info_alist = |
| 11165 | Fcons (list3 (build_string ("mac-roman"), | 11213 | Fcons (list3 (build_string ("mac-roman"), |
| 11166 | make_number (smRoman), Qnil), Qnil); | 11214 | make_number (smRoman), Qnil), Qnil); |
| 11215 | |||
| 11216 | #if USE_ATSUI | ||
| 11217 | DEFVAR_LISP ("mac-atsu-font-table", &Vmac_atsu_font_table, | ||
| 11218 | doc: /* Hash table of ATSU font IDs vs plist of attributes and values. | ||
| 11219 | Each font ID is represented as a four-byte string in native byte | ||
| 11220 | order. */); | ||
| 11221 | Vmac_atsu_font_table = | ||
| 11222 | make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), | ||
| 11223 | make_float (DEFAULT_REHASH_SIZE), | ||
| 11224 | make_float (DEFAULT_REHASH_THRESHOLD), | ||
| 11225 | Qnil, Qnil, Qnil); | ||
| 11226 | #endif | ||
| 11167 | } | 11227 | } |
| 11168 | 11228 | ||
| 11169 | /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b | 11229 | /* arch-tag: f2259165-4454-4c04-a029-a133c8af7b5b |
diff --git a/src/macterm.h b/src/macterm.h index f23554f01c6..8b45777e546 100644 --- a/src/macterm.h +++ b/src/macterm.h | |||
| @@ -584,10 +584,11 @@ extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, | |||
| 584 | extern void mac_clear_area P_ ((struct frame *, int, int, | 584 | extern void mac_clear_area P_ ((struct frame *, int, int, |
| 585 | unsigned int, unsigned int)); | 585 | unsigned int, unsigned int)); |
| 586 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); | 586 | extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *)); |
| 587 | extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int)); | ||
| 587 | extern OSErr install_window_handler P_ ((WindowPtr)); | 588 | extern OSErr install_window_handler P_ ((WindowPtr)); |
| 588 | extern void remove_window_handler P_ ((WindowPtr)); | 589 | extern void remove_window_handler P_ ((WindowPtr)); |
| 589 | extern Lisp_Object mac_make_lispy_event_code P_ ((int)); | ||
| 590 | extern void do_menu_choice P_ ((SInt32)); | 590 | extern void do_menu_choice P_ ((SInt32)); |
| 591 | extern OSStatus mac_post_mouse_moved_event P_ ((void)); | ||
| 591 | #if USE_CG_DRAWING | 592 | #if USE_CG_DRAWING |
| 592 | extern void mac_prepare_for_quickdraw P_ ((struct frame *)); | 593 | extern void mac_prepare_for_quickdraw P_ ((struct frame *)); |
| 593 | #endif | 594 | #endif |
| @@ -623,12 +624,15 @@ extern void free_frame_menubar P_ ((struct frame *)); | |||
| 623 | /* Defined in mac.c. */ | 624 | /* Defined in mac.c. */ |
| 624 | 625 | ||
| 625 | extern void mac_clear_font_name_table P_ ((void)); | 626 | extern void mac_clear_font_name_table P_ ((void)); |
| 626 | extern Lisp_Object mac_aedesc_to_lisp P_ ((AEDesc *)); | 627 | extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *)); |
| 627 | #if TARGET_API_MAC_CARBON | 628 | #if TARGET_API_MAC_CARBON |
| 628 | extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32, | 629 | extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32, |
| 629 | EventParamName *, | 630 | EventParamName *, |
| 630 | EventParamType *, | 631 | EventParamType *, |
| 631 | AppleEvent *)); | 632 | AppleEvent *)); |
| 633 | extern OSErr create_apple_event_from_drag_ref P_ ((DragRef, UInt32, | ||
| 634 | FlavorType *, | ||
| 635 | AppleEvent *)); | ||
| 632 | extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *)); | 636 | extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *)); |
| 633 | extern CFStringRef cfstring_create_with_string P_ ((Lisp_Object)); | 637 | extern CFStringRef cfstring_create_with_string P_ ((Lisp_Object)); |
| 634 | extern Lisp_Object cfdata_to_lisp P_ ((CFDataRef)); | 638 | extern Lisp_Object cfdata_to_lisp P_ ((CFDataRef)); |
diff --git a/src/minibuf.c b/src/minibuf.c index 2894eb19324..d37f82c9dcd 100644 --- a/src/minibuf.c +++ b/src/minibuf.c | |||
| @@ -523,7 +523,7 @@ read_minibuf (map, initial, prompt, backup_n, expflag, | |||
| 523 | build_string ("Command attempted to use minibuffer while in minibuffer")); | 523 | build_string ("Command attempted to use minibuffer while in minibuffer")); |
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | if (noninteractive) | 526 | if (noninteractive && NILP (Vexecuting_kbd_macro)) |
| 527 | { | 527 | { |
| 528 | val = read_minibuf_noninteractive (map, initial, prompt, | 528 | val = read_minibuf_noninteractive (map, initial, prompt, |
| 529 | make_number (pos), | 529 | make_number (pos), |
| @@ -2790,7 +2790,7 @@ syms_of_minibuf () | |||
| 2790 | DEFVAR_LISP ("history-length", &Vhistory_length, | 2790 | DEFVAR_LISP ("history-length", &Vhistory_length, |
| 2791 | doc: /* *Maximum length for history lists before truncation takes place. | 2791 | doc: /* *Maximum length for history lists before truncation takes place. |
| 2792 | A number means that length; t means infinite. Truncation takes place | 2792 | A number means that length; t means infinite. Truncation takes place |
| 2793 | just after a new element is inserted. Setting the history-length | 2793 | just after a new element is inserted. Setting the `history-length' |
| 2794 | property of a history variable overrides this default. */); | 2794 | property of a history variable overrides this default. */); |
| 2795 | XSETFASTINT (Vhistory_length, 30); | 2795 | XSETFASTINT (Vhistory_length, 30); |
| 2796 | 2796 | ||
diff --git a/src/process.c b/src/process.c index 8e4a0d22160..4e2717577cd 100644 --- a/src/process.c +++ b/src/process.c | |||
| @@ -696,6 +696,8 @@ setup_process_coding_systems (process) | |||
| 696 | = (struct coding_system *) xmalloc (sizeof (struct coding_system)); | 696 | = (struct coding_system *) xmalloc (sizeof (struct coding_system)); |
| 697 | setup_coding_system (p->encode_coding_system, | 697 | setup_coding_system (p->encode_coding_system, |
| 698 | proc_encode_coding_system[outch]); | 698 | proc_encode_coding_system[outch]); |
| 699 | if (proc_encode_coding_system[outch]->eol_type == CODING_EOL_UNDECIDED) | ||
| 700 | proc_encode_coding_system[outch]->eol_type = system_eol_type; | ||
| 699 | } | 701 | } |
| 700 | 702 | ||
| 701 | DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0, | 703 | DEFUN ("processp", Fprocessp, Sprocessp, 1, 1, 0, |
| @@ -5067,6 +5069,10 @@ read_process_output (proc, channel) | |||
| 5067 | p->encode_coding_system = Vlast_coding_system_used; | 5069 | p->encode_coding_system = Vlast_coding_system_used; |
| 5068 | setup_coding_system (p->encode_coding_system, | 5070 | setup_coding_system (p->encode_coding_system, |
| 5069 | proc_encode_coding_system[XINT (p->outfd)]); | 5071 | proc_encode_coding_system[XINT (p->outfd)]); |
| 5072 | if (proc_encode_coding_system[XINT (p->outfd)]->eol_type | ||
| 5073 | == CODING_EOL_UNDECIDED) | ||
| 5074 | proc_encode_coding_system[XINT (p->outfd)]->eol_type | ||
| 5075 | = system_eol_type; | ||
| 5070 | } | 5076 | } |
| 5071 | } | 5077 | } |
| 5072 | 5078 | ||
| @@ -5176,6 +5182,10 @@ read_process_output (proc, channel) | |||
| 5176 | p->encode_coding_system = Vlast_coding_system_used; | 5182 | p->encode_coding_system = Vlast_coding_system_used; |
| 5177 | setup_coding_system (p->encode_coding_system, | 5183 | setup_coding_system (p->encode_coding_system, |
| 5178 | proc_encode_coding_system[XINT (p->outfd)]); | 5184 | proc_encode_coding_system[XINT (p->outfd)]); |
| 5185 | if (proc_encode_coding_system[XINT (p->outfd)]->eol_type | ||
| 5186 | == CODING_EOL_UNDECIDED) | ||
| 5187 | proc_encode_coding_system[XINT (p->outfd)]->eol_type | ||
| 5188 | = system_eol_type; | ||
| 5179 | } | 5189 | } |
| 5180 | } | 5190 | } |
| 5181 | if (coding->carryover_bytes > 0) | 5191 | if (coding->carryover_bytes > 0) |
diff --git a/src/sound.c b/src/sound.c index c1d5c40e9bb..0fbeceb4b9e 100644 --- a/src/sound.c +++ b/src/sound.c | |||
| @@ -452,13 +452,12 @@ static Lisp_Object | |||
| 452 | sound_cleanup (arg) | 452 | sound_cleanup (arg) |
| 453 | Lisp_Object arg; | 453 | Lisp_Object arg; |
| 454 | { | 454 | { |
| 455 | if (current_sound_device) | 455 | if (current_sound_device->close) |
| 456 | { | 456 | current_sound_device->close (current_sound_device); |
| 457 | if (current_sound_device->close) | 457 | if (current_sound->fd > 0) |
| 458 | current_sound_device->close (current_sound_device); | 458 | emacs_close (current_sound->fd); |
| 459 | if (current_sound->fd > 0) | 459 | free (current_sound_device); |
| 460 | emacs_close (current_sound->fd); | 460 | free (current_sound); |
| 461 | } | ||
| 462 | 461 | ||
| 463 | return Qnil; | 462 | return Qnil; |
| 464 | } | 463 | } |
| @@ -991,8 +990,6 @@ Internal use only, use `play-sound' instead.\n */) | |||
| 991 | #ifndef WINDOWSNT | 990 | #ifndef WINDOWSNT |
| 992 | Lisp_Object file; | 991 | Lisp_Object file; |
| 993 | struct gcpro gcpro1, gcpro2; | 992 | struct gcpro gcpro1, gcpro2; |
| 994 | struct sound_device sd; | ||
| 995 | struct sound s; | ||
| 996 | Lisp_Object args[2]; | 993 | Lisp_Object args[2]; |
| 997 | #else /* WINDOWSNT */ | 994 | #else /* WINDOWSNT */ |
| 998 | int len = 0; | 995 | int len = 0; |
| @@ -1010,48 +1007,50 @@ Internal use only, use `play-sound' instead.\n */) | |||
| 1010 | #ifndef WINDOWSNT | 1007 | #ifndef WINDOWSNT |
| 1011 | file = Qnil; | 1008 | file = Qnil; |
| 1012 | GCPRO2 (sound, file); | 1009 | GCPRO2 (sound, file); |
| 1013 | bzero (&sd, sizeof sd); | 1010 | current_sound_device = (struct sound_device *) xmalloc (sizeof (struct sound_device)); |
| 1014 | bzero (&s, sizeof s); | 1011 | bzero (current_sound_device, sizeof (struct sound_device)); |
| 1015 | current_sound_device = &sd; | 1012 | current_sound = (struct sound *) xmalloc (sizeof (struct sound)); |
| 1016 | current_sound = &s; | 1013 | bzero (current_sound, sizeof (struct sound)); |
| 1017 | record_unwind_protect (sound_cleanup, Qnil); | 1014 | record_unwind_protect (sound_cleanup, Qnil); |
| 1018 | s.header = (char *) alloca (MAX_SOUND_HEADER_BYTES); | 1015 | current_sound->header = (char *) alloca (MAX_SOUND_HEADER_BYTES); |
| 1019 | 1016 | ||
| 1020 | if (STRINGP (attrs[SOUND_FILE])) | 1017 | if (STRINGP (attrs[SOUND_FILE])) |
| 1021 | { | 1018 | { |
| 1022 | /* Open the sound file. */ | 1019 | /* Open the sound file. */ |
| 1023 | s.fd = openp (Fcons (Vdata_directory, Qnil), | 1020 | current_sound->fd = openp (Fcons (Vdata_directory, Qnil), |
| 1024 | attrs[SOUND_FILE], Qnil, &file, Qnil); | 1021 | attrs[SOUND_FILE], Qnil, &file, Qnil); |
| 1025 | if (s.fd < 0) | 1022 | if (current_sound->fd < 0) |
| 1026 | sound_perror ("Could not open sound file"); | 1023 | sound_perror ("Could not open sound file"); |
| 1027 | 1024 | ||
| 1028 | /* Read the first bytes from the file. */ | 1025 | /* Read the first bytes from the file. */ |
| 1029 | s.header_size = emacs_read (s.fd, s.header, MAX_SOUND_HEADER_BYTES); | 1026 | current_sound->header_size |
| 1030 | if (s.header_size < 0) | 1027 | = emacs_read (current_sound->fd, current_sound->header, |
| 1028 | MAX_SOUND_HEADER_BYTES); | ||
| 1029 | if (current_sound->header_size < 0) | ||
| 1031 | sound_perror ("Invalid sound file header"); | 1030 | sound_perror ("Invalid sound file header"); |
| 1032 | } | 1031 | } |
| 1033 | else | 1032 | else |
| 1034 | { | 1033 | { |
| 1035 | s.data = attrs[SOUND_DATA]; | 1034 | current_sound->data = attrs[SOUND_DATA]; |
| 1036 | s.header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (s.data)); | 1035 | current_sound->header_size = min (MAX_SOUND_HEADER_BYTES, SBYTES (current_sound->data)); |
| 1037 | bcopy (SDATA (s.data), s.header, s.header_size); | 1036 | bcopy (SDATA (current_sound->data), current_sound->header, current_sound->header_size); |
| 1038 | } | 1037 | } |
| 1039 | 1038 | ||
| 1040 | /* Find out the type of sound. Give up if we can't tell. */ | 1039 | /* Find out the type of sound. Give up if we can't tell. */ |
| 1041 | find_sound_type (&s); | 1040 | find_sound_type (current_sound); |
| 1042 | 1041 | ||
| 1043 | /* Set up a device. */ | 1042 | /* Set up a device. */ |
| 1044 | if (STRINGP (attrs[SOUND_DEVICE])) | 1043 | if (STRINGP (attrs[SOUND_DEVICE])) |
| 1045 | { | 1044 | { |
| 1046 | int len = SCHARS (attrs[SOUND_DEVICE]); | 1045 | int len = SCHARS (attrs[SOUND_DEVICE]); |
| 1047 | sd.file = (char *) alloca (len + 1); | 1046 | current_sound_device->file = (char *) alloca (len + 1); |
| 1048 | strcpy (sd.file, SDATA (attrs[SOUND_DEVICE])); | 1047 | strcpy (current_sound_device->file, SDATA (attrs[SOUND_DEVICE])); |
| 1049 | } | 1048 | } |
| 1050 | 1049 | ||
| 1051 | if (INTEGERP (attrs[SOUND_VOLUME])) | 1050 | if (INTEGERP (attrs[SOUND_VOLUME])) |
| 1052 | sd.volume = XFASTINT (attrs[SOUND_VOLUME]); | 1051 | current_sound_device->volume = XFASTINT (attrs[SOUND_VOLUME]); |
| 1053 | else if (FLOATP (attrs[SOUND_VOLUME])) | 1052 | else if (FLOATP (attrs[SOUND_VOLUME])) |
| 1054 | sd.volume = XFLOAT_DATA (attrs[SOUND_VOLUME]) * 100; | 1053 | current_sound_device->volume = XFLOAT_DATA (attrs[SOUND_VOLUME]) * 100; |
| 1055 | 1054 | ||
| 1056 | args[0] = Qplay_sound_functions; | 1055 | args[0] = Qplay_sound_functions; |
| 1057 | args[1] = sound; | 1056 | args[1] = sound; |
| @@ -1060,27 +1059,15 @@ Internal use only, use `play-sound' instead.\n */) | |||
| 1060 | /* There is only one type of device we currently support, the VOX | 1059 | /* There is only one type of device we currently support, the VOX |
| 1061 | sound driver. Set up the device interface functions for that | 1060 | sound driver. Set up the device interface functions for that |
| 1062 | device. */ | 1061 | device. */ |
| 1063 | vox_init (&sd); | 1062 | vox_init (current_sound_device); |
| 1064 | 1063 | ||
| 1065 | /* Open the device. */ | 1064 | /* Open the device. */ |
| 1066 | sd.open (&sd); | 1065 | current_sound_device->open (current_sound_device); |
| 1067 | 1066 | ||
| 1068 | /* Play the sound. */ | 1067 | /* Play the sound. */ |
| 1069 | s.play (&s, &sd); | 1068 | current_sound->play (current_sound, current_sound_device); |
| 1070 | |||
| 1071 | /* Close the input file, if any. */ | ||
| 1072 | if (!STRINGP (s.data)) | ||
| 1073 | { | ||
| 1074 | emacs_close (s.fd); | ||
| 1075 | s.fd = -1; | ||
| 1076 | } | ||
| 1077 | |||
| 1078 | /* Close the device. */ | ||
| 1079 | sd.close (&sd); | ||
| 1080 | 1069 | ||
| 1081 | /* Clean up. */ | 1070 | /* Clean up. */ |
| 1082 | current_sound_device = NULL; | ||
| 1083 | current_sound = NULL; | ||
| 1084 | UNGCPRO; | 1071 | UNGCPRO; |
| 1085 | 1072 | ||
| 1086 | #else /* WINDOWSNT */ | 1073 | #else /* WINDOWSNT */ |
diff --git a/src/termhooks.h b/src/termhooks.h index 8405cac3b88..de43d580c9b 100644 --- a/src/termhooks.h +++ b/src/termhooks.h | |||
| @@ -332,9 +332,9 @@ enum event_kind | |||
| 332 | /* Generated when an Apple event, a HICommand event, or a Services | 332 | /* Generated when an Apple event, a HICommand event, or a Services |
| 333 | menu event is received and the corresponding handler is | 333 | menu event is received and the corresponding handler is |
| 334 | registered. Members `x' and `y' are for the event class and ID | 334 | registered. Members `x' and `y' are for the event class and ID |
| 335 | symbols, respectively. Member `code' points to the Apple event | 335 | symbols, respectively. Member `arg' is a Lisp object converted |
| 336 | descriptor. Parameters for Non-Apple events are converted to | 336 | from the received Apple event. Parameters for non-Apple events |
| 337 | those in Apple events. */ | 337 | are converted to those in Apple events. */ |
| 338 | MAC_APPLE_EVENT | 338 | MAC_APPLE_EVENT |
| 339 | #endif | 339 | #endif |
| 340 | }; | 340 | }; |
diff --git a/src/xdisp.c b/src/xdisp.c index 63a1338b2cb..b1404d9c593 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -4543,6 +4543,24 @@ handle_composition_prop (it) | |||
| 4543 | 4543 | ||
| 4544 | if (id >= 0) | 4544 | if (id >= 0) |
| 4545 | { | 4545 | { |
| 4546 | struct composition *cmp = composition_table[id]; | ||
| 4547 | |||
| 4548 | if (cmp->glyph_len == 0) | ||
| 4549 | { | ||
| 4550 | /* No glyph. */ | ||
| 4551 | if (STRINGP (it->string)) | ||
| 4552 | { | ||
| 4553 | IT_STRING_CHARPOS (*it) = end; | ||
| 4554 | IT_STRING_BYTEPOS (*it) = string_char_to_byte (it->string, | ||
| 4555 | end); | ||
| 4556 | } | ||
| 4557 | else | ||
| 4558 | { | ||
| 4559 | IT_CHARPOS (*it) = end; | ||
| 4560 | IT_BYTEPOS (*it) = CHAR_TO_BYTE (end); | ||
| 4561 | } | ||
| 4562 | return HANDLED_RECOMPUTE_PROPS; | ||
| 4563 | } | ||
| 4546 | it->method = GET_FROM_COMPOSITION; | 4564 | it->method = GET_FROM_COMPOSITION; |
| 4547 | it->cmp_id = id; | 4565 | it->cmp_id = id; |
| 4548 | it->cmp_len = COMPOSITION_LENGTH (prop); | 4566 | it->cmp_len = COMPOSITION_LENGTH (prop); |
diff --git a/src/xfaces.c b/src/xfaces.c index 3a066ee12c3..5596d5dc613 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -7255,6 +7255,16 @@ realize_default_face (f) | |||
| 7255 | check_lface (lface); | 7255 | check_lface (lface); |
| 7256 | bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs); | 7256 | bcopy (XVECTOR (lface)->contents, attrs, sizeof attrs); |
| 7257 | face = realize_face (c, attrs, DEFAULT_FACE_ID); | 7257 | face = realize_face (c, attrs, DEFAULT_FACE_ID); |
| 7258 | |||
| 7259 | #ifdef HAVE_WINDOW_SYSTEM | ||
| 7260 | #ifdef HAVE_X_WINDOWS | ||
| 7261 | if (face->font != FRAME_FONT (f)) | ||
| 7262 | /* As the font specified for the frame was not acceptable as a | ||
| 7263 | font for the default face (perhaps because auto-scaled fonts | ||
| 7264 | are rejected), we must adjust the frame font. */ | ||
| 7265 | x_set_font (f, build_string (face->font_name), Qnil); | ||
| 7266 | #endif /* HAVE_X_WINDOWS */ | ||
| 7267 | #endif /* HAVE_WINDOW_SYSTEM */ | ||
| 7258 | return 1; | 7268 | return 1; |
| 7259 | } | 7269 | } |
| 7260 | 7270 | ||