diff options
| author | Miles Bader | 2005-07-14 08:02:00 +0000 |
|---|---|---|
| committer | Miles Bader | 2005-07-14 08:02:00 +0000 |
| commit | bacb9790f594207469f22ed9f3e8085ab76e5e2b (patch) | |
| tree | b1cee62715d6cd2797f3122e4f058d7bc18ceef6 /src | |
| parent | d3e4babdd1267fb5690a17949196640a47c6f159 (diff) | |
| parent | ead25b5cabbe092711864eae13a76437e6a65ce1 (diff) | |
| download | emacs-bacb9790f594207469f22ed9f3e8085ab76e5e2b.tar.gz emacs-bacb9790f594207469f22ed9f3e8085ab76e5e2b.zip | |
Revision: miles@gnu.org--gnu-2005/emacs--unicode--0--patch-69
Merge from emacs--cvs-trunk--0
Patches applied:
* emacs--cvs-trunk--0 (patch 474-484)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 88-91)
- Merge from emacs--cvs-trunk--0
- Update FSF's address in GPL notices
- Update from CVS
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 144 | ||||
| -rw-r--r-- | src/alloc.c | 35 | ||||
| -rw-r--r-- | src/bytecode.c | 14 | ||||
| -rw-r--r-- | src/coding.c | 2 | ||||
| -rw-r--r-- | src/coding.h | 2 | ||||
| -rw-r--r-- | src/eval.c | 16 | ||||
| -rw-r--r-- | src/indent.c | 8 | ||||
| -rw-r--r-- | src/keyboard.c | 10 | ||||
| -rw-r--r-- | src/lisp.h | 2 | ||||
| -rw-r--r-- | src/lread.c | 10 | ||||
| -rw-r--r-- | src/mac.c | 294 | ||||
| -rw-r--r-- | src/macterm.c | 467 | ||||
| -rw-r--r-- | src/window.c | 13 | ||||
| -rw-r--r-- | src/xdisp.c | 60 | ||||
| -rw-r--r-- | src/xfaces.c | 5 | ||||
| -rw-r--r-- | src/xselect.c | 1 |
16 files changed, 709 insertions, 374 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 8501f8fd9dc..f3f865612f6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,130 @@ | |||
| 1 | 2005-07-13 Kim F. Storm <storm@cua.dk> | ||
| 2 | |||
| 3 | * xdisp.c (start_display): Don't reseat to next visible line start | ||
| 4 | if current start position is in a string or image. | ||
| 5 | (move_it_vertically_backward): Be sure to move out of strings and | ||
| 6 | images when moving it2 forward. | ||
| 7 | (move_it_by_lines): When moving forward, move to next buffer | ||
| 8 | position if we end up in a string or image. When moving backward, | ||
| 9 | count rows moved over when moving to start of current row in case | ||
| 10 | row starts in middle of a string or image. Also move further | ||
| 11 | backward if we end up in a string or image. | ||
| 12 | (try_cursor_movement): if overlay string spans multiple lines, | ||
| 13 | move backward to set cursor on start of an overlay string. | ||
| 14 | (cursor_row_p): Row is ok if cursor is at newline from string, but | ||
| 15 | string starts on this line (so we always position cursor at start | ||
| 16 | of string). | ||
| 17 | |||
| 18 | * indent.c (Fvertical_motion): If start position is on an image, | ||
| 19 | don't move back if we move too far (that's almost certain to happen). | ||
| 20 | |||
| 21 | * xdisp.c (cursor_row_fully_visible_p): Allow partially visible | ||
| 22 | row in minibuffer windows. | ||
| 23 | (try_window): Don't check margins in minibuffer windows. | ||
| 24 | |||
| 25 | 2005-07-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 26 | |||
| 27 | * macterm.c: Don't include stdlib.h or composite.h. | ||
| 28 | (x_use_underline_position_properties, last_mouse_press_frame) | ||
| 29 | (x_noop_count, Qvendor_specific_keysyms): Remove unused variables. | ||
| 30 | (syms_of_macterm, mac_initialize): Don't initialize them. | ||
| 31 | (waiting_for_input, initial_argv, initial_argc) | ||
| 32 | (Vcommand_line_args, Vx_no_window_manager, errno, window_scroll) | ||
| 33 | (set_frame_menubar, path_from_vol_dir_name): Remove externs. | ||
| 34 | (extra_keyboard_modifiers): Fix type in extern. | ||
| 35 | (x_window_to_frame, x_window_to_scroll_bar): Remove declarations. | ||
| 36 | (x_scroll_bar_report_motion): Add argument types to declaration. | ||
| 37 | (mac_compute_glyph_string_overhangs): Add declaration. | ||
| 38 | (disable_mouse_highlight): Remove unused variable. | ||
| 39 | [USE_TOOLKIT_SCROLL_BARS] (construct_scroll_bar_click) | ||
| 40 | (x_scroll_bar_handle_press, x_scroll_bar_handle_release) | ||
| 41 | (x_scroll_bar_handle_drag): Remove argument `timestamp'. All | ||
| 42 | callers changed. | ||
| 43 | [USE_TOOLKIT_SCROLL_BARS] (construct_scroll_bar_click): Don't set | ||
| 44 | timestamp. | ||
| 45 | [USE_CARBON_EVENTS] (mac_handle_mouse_event): Likewise. | ||
| 46 | (x_scroll_bar_create, XTset_vertical_scroll_bar): Show scroll bar | ||
| 47 | only when its width is less than the height. | ||
| 48 | (XTredeem_scroll_bar): Sync with xterm.c. | ||
| 49 | (font_name_table, font_name_table_size, font_name_count): Make | ||
| 50 | static. | ||
| 51 | (drag_and_drop_file_list): Remove variable. Previous use is now | ||
| 52 | local to function. | ||
| 53 | (do_ae_open_documents): Move DRAG_N_DROP event construction part | ||
| 54 | from XTread_socket. | ||
| 55 | (XTread_socket): Consolidate setting of event timestamp. Move | ||
| 56 | DRAG_N_DROP event construction part to do_ae_open_documents. | ||
| 57 | Support extra_keyboard_modifiers. | ||
| 58 | |||
| 59 | * xfaces.c (try_font_list) [MAC_OS]: Try font family name | ||
| 60 | beginning with that for ASCII. | ||
| 61 | |||
| 62 | 2005-07-13 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 63 | |||
| 64 | * alloc.c (gc_cons_combined_threshold, Vgc_cons_percentage): New vars. | ||
| 65 | (Fgarbage_collect, init_alloc_once): Set gc_cons_combined_threshold. | ||
| 66 | (syms_of_alloc): Declare gc-cons-percentage. | ||
| 67 | |||
| 68 | * eval.c (Feval, Ffuncall): | ||
| 69 | * keyboard.c (read_char): | ||
| 70 | * bytecode.c (MAYBE_GC): Use gc_cons_combined_threshold. | ||
| 71 | |||
| 72 | * lisp.h (gc_cons_combined_threshold): Declare. | ||
| 73 | |||
| 74 | 2005-07-12 Kim F. Storm <storm@cua.dk> | ||
| 75 | |||
| 76 | * coding.c (Qprocess_argument): | ||
| 77 | * coding.h (Qprocess_argument): Remove unused var. | ||
| 78 | |||
| 79 | * xselect.c (intern): Remove dup. intern and staticpro for QTIMESTAMP. | ||
| 80 | |||
| 81 | 2005-07-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 82 | |||
| 83 | * mac.c [!TARGET_API_MAC_CARBON]: Include charset.h, coding.h, and | ||
| 84 | Endian.h. | ||
| 85 | [!MAC_OSX] (fchmod, fchown): New functions. | ||
| 86 | (mac_get_code_from_arg): Don't accept Lisp integer as argument. | ||
| 87 | Use SBYTES and EndianU32_BtoN. | ||
| 88 | (mac_get_object_from_code): Return 4 byte string even if argument | ||
| 89 | is 0. Use make_unibyte_string and EndianU32_NtoB. | ||
| 90 | (Fmac_get_file_creator, Fmac_get_file_type, Fmac_set_file_creator) | ||
| 91 | (Fmac_set_file_type): Fix documents and argument declarations. | ||
| 92 | Don't specify kFSCatInfoNodeFlags. Support Mac OS Classic. | ||
| 93 | |||
| 94 | 2005-07-11 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 95 | |||
| 96 | * window.c (Frecenter): Yet another int/Lisp_Object mixup (YAILOM). | ||
| 97 | |||
| 98 | 2005-07-11 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 99 | |||
| 100 | * xfaces.c (x_update_menu_appearance): Use fontSet resource for | ||
| 101 | Lucid if X_I18N, font otherwise. | ||
| 102 | |||
| 103 | 2005-07-10 Steven Tamm <steventamm@mac.com> | ||
| 104 | |||
| 105 | * mac.c (Fmac_get_file_type, Fmac_get_file_creator): Add. | ||
| 106 | (Fmac_set_file_type, Fmac_set_file_creator): Add. | ||
| 107 | (mac_get_object_from_code, mac_get_code_from_arg): Add. | ||
| 108 | |||
| 109 | 2005-07-10 Richard M. Stallman <rms@gnu.org> | ||
| 110 | |||
| 111 | * lread.c (Qeval_buffer_list, Veval_buffer_list): New vars. | ||
| 112 | (syms_of_lread): Set up eval-buffer-list. | ||
| 113 | (Feval_buffer, Feval_region): Bind eval-buffer-list. | ||
| 114 | |||
| 115 | 2005-07-08 Richard M. Stallman <rms@gnu.org> | ||
| 116 | |||
| 117 | * eval.c (Fdefvar): Allow defvaring a constant to itself quoted. | ||
| 118 | |||
| 119 | 2005-07-08 Kim F. Storm <storm@cua.dk> | ||
| 120 | |||
| 121 | * keyboard.c (menu_bar_items): Don't GCPRO menu_bar_items_vector here. | ||
| 122 | (syms_of_keyboard): Initialize and staticpro menu_bar_items_vector. | ||
| 123 | |||
| 124 | 2005-07-07 Kim F. Storm <storm@cua.dk> | ||
| 125 | |||
| 126 | * window.c (Frecenter): Fix last change (set iarg before use). | ||
| 127 | |||
| 1 | 2005-07-06 Richard M. Stallman <rms@gnu.org> | 128 | 2005-07-06 Richard M. Stallman <rms@gnu.org> |
| 2 | 129 | ||
| 3 | * window.c (Frecenter): When arg is inside the scroll margin, | 130 | * window.c (Frecenter): When arg is inside the scroll margin, |
| @@ -7,7 +134,7 @@ | |||
| 7 | 134 | ||
| 8 | * w32console.c (initialize_w32_display): Detect when the console | 135 | * w32console.c (initialize_w32_display): Detect when the console |
| 9 | dimensions are insane, and default to 80x25 instead. | 136 | dimensions are insane, and default to 80x25 instead. |
| 10 | (w32_use_full_screen_buffer): default to NIL. | 137 | (w32_use_full_screen_buffer): Default to NIL. |
| 11 | 138 | ||
| 12 | 2005-07-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 139 | 2005-07-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 13 | 140 | ||
| @@ -15,11 +142,11 @@ | |||
| 15 | VERTICAL_BORDER_FACE_ID for vertical border line. | 142 | VERTICAL_BORDER_FACE_ID for vertical border line. |
| 16 | (mac_encode_char): Call check_ccl_update in advance. | 143 | (mac_encode_char): Call check_ccl_update in advance. |
| 17 | (mac_to_x_fontname, x_font_name_to_mac_font_name) | 144 | (mac_to_x_fontname, x_font_name_to_mac_font_name) |
| 18 | (init_font_name_table, mac_do_list_fonts, XLoadQueryFont): Don't | 145 | (init_font_name_table, mac_do_list_fonts, XLoadQueryFont): |
| 19 | assume that font family length is less than 32. | 146 | Don't assume that font family length is less than 32. |
| 20 | (x_compute_min_glyph_bounds): Make static. | 147 | (x_compute_min_glyph_bounds): Make static. |
| 21 | (x_load_font): Never set fonts_changed_p to zero. | 148 | (x_load_font): Never set fonts_changed_p to zero. |
| 22 | 149 | ||
| 23 | 2005-07-04 Lute Kamstra <lute@gnu.org> | 150 | 2005-07-04 Lute Kamstra <lute@gnu.org> |
| 24 | 151 | ||
| 25 | * Update FSF's address in GPL notices. | 152 | * Update FSF's address in GPL notices. |
| @@ -67,8 +194,7 @@ | |||
| 67 | 194 | ||
| 68 | 2005-07-01 Masatake YAMATO <jet@gyve.org> | 195 | 2005-07-01 Masatake YAMATO <jet@gyve.org> |
| 69 | 196 | ||
| 70 | * emacs.c (main): Passing ADD_NO_RANDOMIZE to | 197 | * emacs.c (main): Passing ADD_NO_RANDOMIZE to `personality'. |
| 71 | `personality'. | ||
| 72 | 198 | ||
| 73 | 2005-06-30 Juri Linkov <juri@jurta.org> | 199 | 2005-06-30 Juri Linkov <juri@jurta.org> |
| 74 | 200 | ||
| @@ -196,7 +322,7 @@ | |||
| 196 | 322 | ||
| 197 | 2005-06-22 Miles Bader <miles@gnu.org> | 323 | 2005-06-22 Miles Bader <miles@gnu.org> |
| 198 | 324 | ||
| 199 | * xfaces.c (Qvertical_border): Renamed from `Qvertical_divider'. | 325 | * xfaces.c (Qvertical_border): Rename from `Qvertical_divider'. |
| 200 | (realize_basic_faces, syms_of_xfaces): Update references to it. | 326 | (realize_basic_faces, syms_of_xfaces): Update references to it. |
| 201 | * dispextern.h (enum face_id): Rename `VERTICAL_DIVIDER_FACE_ID' | 327 | * dispextern.h (enum face_id): Rename `VERTICAL_DIVIDER_FACE_ID' |
| 202 | to `VERTICAL_BORDER_FACE_ID'. | 328 | to `VERTICAL_BORDER_FACE_ID'. |
| @@ -235,8 +361,8 @@ | |||
| 235 | 361 | ||
| 236 | 2005-06-17 Richard M. Stallman <rms@gnu.org> | 362 | 2005-06-17 Richard M. Stallman <rms@gnu.org> |
| 237 | 363 | ||
| 238 | * xdisp.c (get_next_display_element): Reverse | 364 | * xdisp.c (get_next_display_element): |
| 239 | test of Vshow_nonbreak_escape. | 365 | Reverse test of Vshow_nonbreak_escape. |
| 240 | 366 | ||
| 241 | * term.c (produce_special_glyphs): Use spec_glyph_lookup_face. | 367 | * term.c (produce_special_glyphs): Use spec_glyph_lookup_face. |
| 242 | (Ftty_no_underline): New function. | 368 | (Ftty_no_underline): New function. |
diff --git a/src/alloc.c b/src/alloc.c index 26d41c12b50..5c5252b1ba1 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -174,7 +174,9 @@ EMACS_INT strings_consed; | |||
| 174 | 174 | ||
| 175 | /* Number of bytes of consing since GC before another GC should be done. */ | 175 | /* Number of bytes of consing since GC before another GC should be done. */ |
| 176 | 176 | ||
| 177 | EMACS_INT gc_cons_threshold; | 177 | static EMACS_INT gc_cons_threshold; |
| 178 | EMACS_INT gc_cons_combined_threshold; | ||
| 179 | static Lisp_Object Vgc_cons_percentage; | ||
| 178 | 180 | ||
| 179 | /* Nonzero during GC. */ | 181 | /* Nonzero during GC. */ |
| 180 | 182 | ||
| @@ -4854,6 +4856,26 @@ returns nil, because real GC can't be done. */) | |||
| 4854 | if (gc_cons_threshold < 10000) | 4856 | if (gc_cons_threshold < 10000) |
| 4855 | gc_cons_threshold = 10000; | 4857 | gc_cons_threshold = 10000; |
| 4856 | 4858 | ||
| 4859 | gc_cons_combined_threshold = gc_cons_threshold; | ||
| 4860 | |||
| 4861 | if (FLOATP (Vgc_cons_percentage)) | ||
| 4862 | { /* Set gc_cons_combined_threshold. */ | ||
| 4863 | EMACS_INT total = 0; | ||
| 4864 | EMACS_INT threshold; | ||
| 4865 | total += total_conses * sizeof (struct Lisp_Cons); | ||
| 4866 | total += total_symbols * sizeof (struct Lisp_Symbol); | ||
| 4867 | total += total_markers * sizeof (union Lisp_Misc); | ||
| 4868 | total += total_string_size; | ||
| 4869 | total += total_vector_size * sizeof (Lisp_Object); | ||
| 4870 | total += total_floats * sizeof (struct Lisp_Float); | ||
| 4871 | total += total_intervals * sizeof (struct interval); | ||
| 4872 | total += total_strings * sizeof (struct Lisp_String); | ||
| 4873 | |||
| 4874 | threshold = total * XFLOAT_DATA (Vgc_cons_percentage); | ||
| 4875 | if (threshold > gc_cons_combined_threshold) | ||
| 4876 | gc_cons_combined_threshold = threshold; | ||
| 4877 | } | ||
| 4878 | |||
| 4857 | if (garbage_collection_messages) | 4879 | if (garbage_collection_messages) |
| 4858 | { | 4880 | { |
| 4859 | if (message_p || minibuf_level > 0) | 4881 | if (message_p || minibuf_level > 0) |
| @@ -5943,6 +5965,7 @@ init_alloc_once () | |||
| 5943 | staticidx = 0; | 5965 | staticidx = 0; |
| 5944 | consing_since_gc = 0; | 5966 | consing_since_gc = 0; |
| 5945 | gc_cons_threshold = 100000 * sizeof (Lisp_Object); | 5967 | gc_cons_threshold = 100000 * sizeof (Lisp_Object); |
| 5968 | gc_cons_combined_threshold = gc_cons_threshold; | ||
| 5946 | #ifdef VIRT_ADDR_VARIES | 5969 | #ifdef VIRT_ADDR_VARIES |
| 5947 | malloc_sbrk_unused = 1<<22; /* A large number */ | 5970 | malloc_sbrk_unused = 1<<22; /* A large number */ |
| 5948 | malloc_sbrk_used = 100000; /* as reasonable as any number */ | 5971 | malloc_sbrk_used = 100000; /* as reasonable as any number */ |
| @@ -5974,7 +5997,15 @@ allocated since the last garbage collection. All data types count. | |||
| 5974 | Garbage collection happens automatically only when `eval' is called. | 5997 | Garbage collection happens automatically only when `eval' is called. |
| 5975 | 5998 | ||
| 5976 | By binding this temporarily to a large number, you can effectively | 5999 | By binding this temporarily to a large number, you can effectively |
| 5977 | prevent garbage collection during a part of the program. */); | 6000 | prevent garbage collection during a part of the program. |
| 6001 | See also `gc-cons-percentage'. */); | ||
| 6002 | |||
| 6003 | DEFVAR_LISP ("gc-cons-percentage", &Vgc_cons_percentage, | ||
| 6004 | doc: /* *Portion of the heap used for allocation. | ||
| 6005 | Garbage collection can happen automatically once this portion of the heap | ||
| 6006 | has been allocated since the last garbage collection. | ||
| 6007 | If this portion is smaller than `gc-cons-threshold', this is ignored. */); | ||
| 6008 | Vgc_cons_percentage = make_float (0.1); | ||
| 5978 | 6009 | ||
| 5979 | DEFVAR_INT ("pure-bytes-used", &pure_bytes_used, | 6010 | DEFVAR_INT ("pure-bytes-used", &pure_bytes_used, |
| 5980 | doc: /* Number of bytes of sharable Lisp data allocated so far. */); | 6011 | doc: /* Number of bytes of sharable Lisp data allocated so far. */); |
diff --git a/src/bytecode.c b/src/bytecode.c index 42b2cdfd635..580fdc67119 100644 --- a/src/bytecode.c +++ b/src/bytecode.c | |||
| @@ -355,13 +355,13 @@ unmark_byte_stack () | |||
| 355 | /* Garbage collect if we have consed enough since the last time. | 355 | /* Garbage collect if we have consed enough since the last time. |
| 356 | We do this at every branch, to avoid loops that never GC. */ | 356 | We do this at every branch, to avoid loops that never GC. */ |
| 357 | 357 | ||
| 358 | #define MAYBE_GC() \ | 358 | #define MAYBE_GC() \ |
| 359 | if (consing_since_gc > gc_cons_threshold) \ | 359 | if (consing_since_gc > gc_cons_combined_threshold) \ |
| 360 | { \ | 360 | { \ |
| 361 | BEFORE_POTENTIAL_GC (); \ | 361 | BEFORE_POTENTIAL_GC (); \ |
| 362 | Fgarbage_collect (); \ | 362 | Fgarbage_collect (); \ |
| 363 | AFTER_POTENTIAL_GC (); \ | 363 | AFTER_POTENTIAL_GC (); \ |
| 364 | } \ | 364 | } \ |
| 365 | else | 365 | else |
| 366 | 366 | ||
| 367 | /* Check for jumping out of range. */ | 367 | /* Check for jumping out of range. */ |
diff --git a/src/coding.c b/src/coding.c index 77a344eba72..8b1d3a6b626 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -316,7 +316,7 @@ Lisp_Object QCdecode_translation_table, QCencode_translation_table; | |||
| 316 | Lisp_Object QCpost_read_conversion, QCpre_write_conversion; | 316 | Lisp_Object QCpost_read_conversion, QCpre_write_conversion; |
| 317 | 317 | ||
| 318 | extern Lisp_Object Qinsert_file_contents, Qwrite_region; | 318 | extern Lisp_Object Qinsert_file_contents, Qwrite_region; |
| 319 | Lisp_Object Qcall_process, Qcall_process_region, Qprocess_argument; | 319 | Lisp_Object Qcall_process, Qcall_process_region; |
| 320 | Lisp_Object Qstart_process, Qopen_network_stream; | 320 | Lisp_Object Qstart_process, Qopen_network_stream; |
| 321 | Lisp_Object Qtarget_idx; | 321 | Lisp_Object Qtarget_idx; |
| 322 | 322 | ||
diff --git a/src/coding.h b/src/coding.h index aab23a2fbf6..f96b86b2413 100644 --- a/src/coding.h +++ b/src/coding.h | |||
| @@ -704,7 +704,7 @@ extern Lisp_Object eol_mnemonic_undecided; | |||
| 704 | 704 | ||
| 705 | #ifdef emacs | 705 | #ifdef emacs |
| 706 | extern Lisp_Object Qfile_coding_system; | 706 | extern Lisp_Object Qfile_coding_system; |
| 707 | extern Lisp_Object Qcall_process, Qcall_process_region, Qprocess_argument; | 707 | extern Lisp_Object Qcall_process, Qcall_process_region; |
| 708 | extern Lisp_Object Qstart_process, Qopen_network_stream; | 708 | extern Lisp_Object Qstart_process, Qopen_network_stream; |
| 709 | extern Lisp_Object Qwrite_region; | 709 | extern Lisp_Object Qwrite_region; |
| 710 | 710 | ||
diff --git a/src/eval.c b/src/eval.c index f625258229e..3b4e9fe0324 100644 --- a/src/eval.c +++ b/src/eval.c | |||
| @@ -807,8 +807,16 @@ usage: (defvar SYMBOL &optional INITVALUE DOCSTRING) */) | |||
| 807 | 807 | ||
| 808 | sym = Fcar (args); | 808 | sym = Fcar (args); |
| 809 | if (SYMBOL_CONSTANT_P (sym)) | 809 | if (SYMBOL_CONSTANT_P (sym)) |
| 810 | error ("Constant symbol `%s' specified in defvar", | 810 | { |
| 811 | SDATA (SYMBOL_NAME (sym))); | 811 | /* For updward compatibility, allow (defvar :foo (quote :foo)). */ |
| 812 | tem = Fcar (Fcdr (args)); | ||
| 813 | if (! (CONSP (tem) | ||
| 814 | && EQ (XCAR (tem), Qquote) | ||
| 815 | && CONSP (XCDR (tem)) | ||
| 816 | && EQ (XCAR (XCDR (tem)), sym))) | ||
| 817 | error ("Constant symbol `%s' specified in defvar", | ||
| 818 | SDATA (SYMBOL_NAME (sym))); | ||
| 819 | } | ||
| 812 | 820 | ||
| 813 | tail = Fcdr (args); | 821 | tail = Fcdr (args); |
| 814 | if (!NILP (Fcdr (Fcdr (tail)))) | 822 | if (!NILP (Fcdr (Fcdr (tail)))) |
| @@ -2085,7 +2093,7 @@ DEFUN ("eval", Feval, Seval, 1, 1, 0, | |||
| 2085 | return form; | 2093 | return form; |
| 2086 | 2094 | ||
| 2087 | QUIT; | 2095 | QUIT; |
| 2088 | if (consing_since_gc > gc_cons_threshold) | 2096 | if (consing_since_gc > gc_cons_combined_threshold) |
| 2089 | { | 2097 | { |
| 2090 | GCPRO1 (form); | 2098 | GCPRO1 (form); |
| 2091 | Fgarbage_collect (); | 2099 | Fgarbage_collect (); |
| @@ -2785,7 +2793,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) | |||
| 2785 | register int i; | 2793 | register int i; |
| 2786 | 2794 | ||
| 2787 | QUIT; | 2795 | QUIT; |
| 2788 | if (consing_since_gc > gc_cons_threshold) | 2796 | if (consing_since_gc > gc_cons_combined_threshold) |
| 2789 | Fgarbage_collect (); | 2797 | Fgarbage_collect (); |
| 2790 | 2798 | ||
| 2791 | if (++lisp_eval_depth > max_lisp_eval_depth) | 2799 | if (++lisp_eval_depth > max_lisp_eval_depth) |
diff --git a/src/indent.c b/src/indent.c index 721b9ea640f..7ad56e02ff3 100644 --- a/src/indent.c +++ b/src/indent.c | |||
| @@ -2074,6 +2074,7 @@ whether or not it is currently displayed in some window. */) | |||
| 2074 | { | 2074 | { |
| 2075 | int it_start; | 2075 | int it_start; |
| 2076 | int oselective; | 2076 | int oselective; |
| 2077 | int start_on_image_p; | ||
| 2077 | 2078 | ||
| 2078 | SET_TEXT_POS (pt, PT, PT_BYTE); | 2079 | SET_TEXT_POS (pt, PT, PT_BYTE); |
| 2079 | start_display (&it, w, pt); | 2080 | start_display (&it, w, pt); |
| @@ -2085,6 +2086,7 @@ whether or not it is currently displayed in some window. */) | |||
| 2085 | while the end position is really at some X > 0, the same X that | 2086 | while the end position is really at some X > 0, the same X that |
| 2086 | PT had. */ | 2087 | PT had. */ |
| 2087 | it_start = IT_CHARPOS (it); | 2088 | it_start = IT_CHARPOS (it); |
| 2089 | start_on_image_p = (it.method == GET_FROM_IMAGE); | ||
| 2088 | reseat_at_previous_visible_line_start (&it); | 2090 | reseat_at_previous_visible_line_start (&it); |
| 2089 | it.current_x = it.hpos = 0; | 2091 | it.current_x = it.hpos = 0; |
| 2090 | /* Temporarily disable selective display so we don't move too far */ | 2092 | /* Temporarily disable selective display so we don't move too far */ |
| @@ -2094,8 +2096,10 @@ whether or not it is currently displayed in some window. */) | |||
| 2094 | it.selective = oselective; | 2096 | it.selective = oselective; |
| 2095 | 2097 | ||
| 2096 | /* Move back if we got too far. This may happen if | 2098 | /* Move back if we got too far. This may happen if |
| 2097 | truncate-lines is on and PT is beyond right margin. */ | 2099 | truncate-lines is on and PT is beyond right margin. |
| 2098 | if (IT_CHARPOS (it) > it_start && XINT (lines) > 0) | 2100 | It may also happen if it_start is on an image -- |
| 2101 | in that case, don't go back. */ | ||
| 2102 | if (IT_CHARPOS (it) > it_start && XINT (lines) > 0 && !start_on_image_p) | ||
| 2099 | move_it_by_lines (&it, -1, 0); | 2103 | move_it_by_lines (&it, -1, 0); |
| 2100 | 2104 | ||
| 2101 | it.vpos = 0; | 2105 | it.vpos = 0; |
diff --git a/src/keyboard.c b/src/keyboard.c index 1ab4be0347c..9da6ce92471 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -2778,7 +2778,7 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu) | |||
| 2778 | available, garbage collect if there has been enough | 2778 | available, garbage collect if there has been enough |
| 2779 | consing going on to make it worthwhile. */ | 2779 | consing going on to make it worthwhile. */ |
| 2780 | if (!detect_input_pending_run_timers (0) | 2780 | if (!detect_input_pending_run_timers (0) |
| 2781 | && consing_since_gc > gc_cons_threshold / 2) | 2781 | && consing_since_gc > gc_cons_combined_threshold / 2) |
| 2782 | Fgarbage_collect (); | 2782 | Fgarbage_collect (); |
| 2783 | 2783 | ||
| 2784 | redisplay (); | 2784 | redisplay (); |
| @@ -6916,8 +6916,6 @@ menu_bar_items (old) | |||
| 6916 | 6916 | ||
| 6917 | int i; | 6917 | int i; |
| 6918 | 6918 | ||
| 6919 | struct gcpro gcpro1; | ||
| 6920 | |||
| 6921 | /* In order to build the menus, we need to call the keymap | 6919 | /* In order to build the menus, we need to call the keymap |
| 6922 | accessors. They all call QUIT. But this function is called | 6920 | accessors. They all call QUIT. But this function is called |
| 6923 | during redisplay, during which a quit is fatal. So inhibit | 6921 | during redisplay, during which a quit is fatal. So inhibit |
| @@ -6933,8 +6931,6 @@ menu_bar_items (old) | |||
| 6933 | menu_bar_items_vector = Fmake_vector (make_number (24), Qnil); | 6931 | menu_bar_items_vector = Fmake_vector (make_number (24), Qnil); |
| 6934 | menu_bar_items_index = 0; | 6932 | menu_bar_items_index = 0; |
| 6935 | 6933 | ||
| 6936 | GCPRO1 (menu_bar_items_vector); | ||
| 6937 | |||
| 6938 | /* Build our list of keymaps. | 6934 | /* Build our list of keymaps. |
| 6939 | If we recognize a function key and replace its escape sequence in | 6935 | If we recognize a function key and replace its escape sequence in |
| 6940 | keybuf with its symbol, or if the sequence starts with a mouse | 6936 | keybuf with its symbol, or if the sequence starts with a mouse |
| @@ -7038,7 +7034,6 @@ menu_bar_items (old) | |||
| 7038 | menu_bar_items_index = i; | 7034 | menu_bar_items_index = i; |
| 7039 | 7035 | ||
| 7040 | Vinhibit_quit = oquit; | 7036 | Vinhibit_quit = oquit; |
| 7041 | UNGCPRO; | ||
| 7042 | return menu_bar_items_vector; | 7037 | return menu_bar_items_vector; |
| 7043 | } | 7038 | } |
| 7044 | 7039 | ||
| @@ -11009,6 +11004,9 @@ syms_of_keyboard () | |||
| 11009 | menu_bar_one_keymap_changed_items = Qnil; | 11004 | menu_bar_one_keymap_changed_items = Qnil; |
| 11010 | staticpro (&menu_bar_one_keymap_changed_items); | 11005 | staticpro (&menu_bar_one_keymap_changed_items); |
| 11011 | 11006 | ||
| 11007 | menu_bar_items_vector = Qnil; | ||
| 11008 | staticpro (&menu_bar_items_vector); | ||
| 11009 | |||
| 11012 | defsubr (&Sevent_convert_list); | 11010 | defsubr (&Sevent_convert_list); |
| 11013 | defsubr (&Sread_key_sequence); | 11011 | defsubr (&Sread_key_sequence); |
| 11014 | defsubr (&Sread_key_sequence_vector); | 11012 | defsubr (&Sread_key_sequence_vector); |
diff --git a/src/lisp.h b/src/lisp.h index 890359750ec..aaee9dcc879 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -1888,7 +1888,7 @@ extern int consing_since_gc; | |||
| 1888 | 1888 | ||
| 1889 | /* Threshold for doing another gc. */ | 1889 | /* Threshold for doing another gc. */ |
| 1890 | 1890 | ||
| 1891 | extern EMACS_INT gc_cons_threshold; | 1891 | extern EMACS_INT gc_cons_combined_threshold; |
| 1892 | 1892 | ||
| 1893 | /* Structure for recording stack slots that need marking. */ | 1893 | /* Structure for recording stack slots that need marking. */ |
| 1894 | 1894 | ||
diff --git a/src/lread.c b/src/lread.c index 72f758e0735..52a68923682 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -87,6 +87,7 @@ Lisp_Object Qvariable_documentation, Vvalues, Vstandard_input, Vafter_load_alist | |||
| 87 | Lisp_Object Qascii_character, Qload, Qload_file_name; | 87 | Lisp_Object Qascii_character, Qload, Qload_file_name; |
| 88 | Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; | 88 | Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; |
| 89 | Lisp_Object Qinhibit_file_name_operation; | 89 | Lisp_Object Qinhibit_file_name_operation; |
| 90 | Lisp_Object Qeval_buffer_list, Veval_buffer_list; | ||
| 90 | 91 | ||
| 91 | /* Used instead of Qget_file_char while loading *.elc files compiled | 92 | /* Used instead of Qget_file_char while loading *.elc files compiled |
| 92 | by Emacs 21 or older. */ | 93 | by Emacs 21 or older. */ |
| @@ -1643,6 +1644,7 @@ This function preserves the position of point. */) | |||
| 1643 | if (NILP (filename)) | 1644 | if (NILP (filename)) |
| 1644 | filename = XBUFFER (buf)->filename; | 1645 | filename = XBUFFER (buf)->filename; |
| 1645 | 1646 | ||
| 1647 | specbind (Qeval_buffer_list, Fcons (buf, Veval_buffer_list)); | ||
| 1646 | specbind (Qstandard_output, tem); | 1648 | specbind (Qstandard_output, tem); |
| 1647 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); | 1649 | record_unwind_protect (save_excursion_restore, save_excursion_save ()); |
| 1648 | BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); | 1650 | BUF_SET_PT (XBUFFER (buf), BUF_BEGV (XBUFFER (buf))); |
| @@ -1678,6 +1680,7 @@ This function does not move point. */) | |||
| 1678 | else | 1680 | else |
| 1679 | tem = printflag; | 1681 | tem = printflag; |
| 1680 | specbind (Qstandard_output, tem); | 1682 | specbind (Qstandard_output, tem); |
| 1683 | specbind (Qeval_buffer_list, Fcons (cbuf, Veval_buffer_list)); | ||
| 1681 | 1684 | ||
| 1682 | /* readevalloop calls functions which check the type of start and end. */ | 1685 | /* readevalloop calls functions which check the type of start and end. */ |
| 1683 | readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, | 1686 | readevalloop (cbuf, 0, XBUFFER (cbuf)->filename, Feval, |
| @@ -4099,6 +4102,10 @@ to load. See also `load-dangerous-libraries'. */); | |||
| 4099 | Vbytecomp_version_regexp | 4102 | Vbytecomp_version_regexp |
| 4100 | = build_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); | 4103 | = build_string ("^;;;.\\(in Emacs version\\|bytecomp version FSF\\)"); |
| 4101 | 4104 | ||
| 4105 | DEFVAR_LISP ("eval-buffer-list", &Veval_buffer_list, | ||
| 4106 | doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */); | ||
| 4107 | Veval_buffer_list = Qnil; | ||
| 4108 | |||
| 4102 | /* Vsource_directory was initialized in init_lread. */ | 4109 | /* Vsource_directory was initialized in init_lread. */ |
| 4103 | 4110 | ||
| 4104 | load_descriptor_list = Qnil; | 4111 | load_descriptor_list = Qnil; |
| @@ -4146,6 +4153,9 @@ to load. See also `load-dangerous-libraries'. */); | |||
| 4146 | Qload_file_name = intern ("load-file-name"); | 4153 | Qload_file_name = intern ("load-file-name"); |
| 4147 | staticpro (&Qload_file_name); | 4154 | staticpro (&Qload_file_name); |
| 4148 | 4155 | ||
| 4156 | Qeval_buffer_list = intern ("eval-buffer-list"); | ||
| 4157 | staticpro (&Qeval_buffer_list); | ||
| 4158 | |||
| 4149 | staticpro (&dump_path); | 4159 | staticpro (&dump_path); |
| 4150 | 4160 | ||
| 4151 | staticpro (&read_objects); | 4161 | staticpro (&read_objects); |
| @@ -34,10 +34,9 @@ Boston, MA 02110-1301, USA. */ | |||
| 34 | 34 | ||
| 35 | #include "macterm.h" | 35 | #include "macterm.h" |
| 36 | 36 | ||
| 37 | #if TARGET_API_MAC_CARBON | ||
| 38 | #include "charset.h" | 37 | #include "charset.h" |
| 39 | #include "coding.h" | 38 | #include "coding.h" |
| 40 | #else /* not TARGET_API_MAC_CARBON */ | 39 | #if !TARGET_API_MAC_CARBON |
| 41 | #include <Files.h> | 40 | #include <Files.h> |
| 42 | #include <MacTypes.h> | 41 | #include <MacTypes.h> |
| 43 | #include <TextUtils.h> | 42 | #include <TextUtils.h> |
| @@ -53,6 +52,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 53 | #include <Processes.h> | 52 | #include <Processes.h> |
| 54 | #include <EPPC.h> | 53 | #include <EPPC.h> |
| 55 | #include <MacLocales.h> | 54 | #include <MacLocales.h> |
| 55 | #include <Endian.h> | ||
| 56 | #endif /* not TARGET_API_MAC_CARBON */ | 56 | #endif /* not TARGET_API_MAC_CARBON */ |
| 57 | 57 | ||
| 58 | #include <utime.h> | 58 | #include <utime.h> |
| @@ -1021,7 +1021,7 @@ xrm_cfproperty_list_to_value (plist) | |||
| 1021 | CFTypeID type_id = CFGetTypeID (plist); | 1021 | CFTypeID type_id = CFGetTypeID (plist); |
| 1022 | 1022 | ||
| 1023 | if (type_id == CFStringGetTypeID ()) | 1023 | if (type_id == CFStringGetTypeID ()) |
| 1024 | return cfstring_to_lisp (plist); | 1024 | return cfstring_to_lisp (plist); |
| 1025 | else if (type_id == CFNumberGetTypeID ()) | 1025 | else if (type_id == CFNumberGetTypeID ()) |
| 1026 | { | 1026 | { |
| 1027 | CFStringRef string; | 1027 | CFStringRef string; |
| @@ -2490,6 +2490,22 @@ chmod (const char *path, mode_t mode) | |||
| 2490 | 2490 | ||
| 2491 | 2491 | ||
| 2492 | int | 2492 | int |
| 2493 | fchmod (int fd, mode_t mode) | ||
| 2494 | { | ||
| 2495 | /* say it always succeed for now */ | ||
| 2496 | return 0; | ||
| 2497 | } | ||
| 2498 | |||
| 2499 | |||
| 2500 | int | ||
| 2501 | fchown (int fd, uid_t owner, gid_t group) | ||
| 2502 | { | ||
| 2503 | /* say it always succeed for now */ | ||
| 2504 | return 0; | ||
| 2505 | } | ||
| 2506 | |||
| 2507 | |||
| 2508 | int | ||
| 2493 | dup (int oldd) | 2509 | dup (int oldd) |
| 2494 | { | 2510 | { |
| 2495 | #ifdef __MRC__ | 2511 | #ifdef __MRC__ |
| @@ -3388,12 +3404,278 @@ initialize_applescript () | |||
| 3388 | } | 3404 | } |
| 3389 | 3405 | ||
| 3390 | 3406 | ||
| 3391 | void terminate_applescript() | 3407 | void |
| 3408 | terminate_applescript() | ||
| 3392 | { | 3409 | { |
| 3393 | OSADispose (as_scripting_component, as_script_context); | 3410 | OSADispose (as_scripting_component, as_script_context); |
| 3394 | CloseComponent (as_scripting_component); | 3411 | CloseComponent (as_scripting_component); |
| 3395 | } | 3412 | } |
| 3396 | 3413 | ||
| 3414 | /* Convert a lisp string to the 4 byte character code. */ | ||
| 3415 | |||
| 3416 | OSType | ||
| 3417 | mac_get_code_from_arg(Lisp_Object arg, OSType defCode) | ||
| 3418 | { | ||
| 3419 | OSType result; | ||
| 3420 | if (NILP(arg)) | ||
| 3421 | { | ||
| 3422 | result = defCode; | ||
| 3423 | } | ||
| 3424 | else | ||
| 3425 | { | ||
| 3426 | /* check type string */ | ||
| 3427 | CHECK_STRING(arg); | ||
| 3428 | if (SBYTES (arg) != 4) | ||
| 3429 | { | ||
| 3430 | error ("Wrong argument: need string of length 4 for code"); | ||
| 3431 | } | ||
| 3432 | result = EndianU32_BtoN (*((UInt32 *) SDATA (arg))); | ||
| 3433 | } | ||
| 3434 | return result; | ||
| 3435 | } | ||
| 3436 | |||
| 3437 | /* Convert the 4 byte character code into a 4 byte string. */ | ||
| 3438 | |||
| 3439 | Lisp_Object | ||
| 3440 | mac_get_object_from_code(OSType defCode) | ||
| 3441 | { | ||
| 3442 | UInt32 code = EndianU32_NtoB (defCode); | ||
| 3443 | |||
| 3444 | return make_unibyte_string ((char *)&code, 4); | ||
| 3445 | } | ||
| 3446 | |||
| 3447 | |||
| 3448 | DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1, 1, 0, | ||
| 3449 | doc: /* Get the creator code of FILENAME as a four character string. */) | ||
| 3450 | (filename) | ||
| 3451 | Lisp_Object filename; | ||
| 3452 | { | ||
| 3453 | OSErr status; | ||
| 3454 | #ifdef MAC_OSX | ||
| 3455 | FSRef fref; | ||
| 3456 | #else | ||
| 3457 | FSSpec fss; | ||
| 3458 | #endif | ||
| 3459 | OSType cCode; | ||
| 3460 | Lisp_Object result = Qnil; | ||
| 3461 | CHECK_STRING (filename); | ||
| 3462 | |||
| 3463 | if (NILP(Ffile_exists_p(filename)) || !NILP(Ffile_directory_p(filename))) { | ||
| 3464 | return Qnil; | ||
| 3465 | } | ||
| 3466 | filename = Fexpand_file_name (filename, Qnil); | ||
| 3467 | |||
| 3468 | BLOCK_INPUT; | ||
| 3469 | #ifdef MAC_OSX | ||
| 3470 | status = FSPathMakeRef(SDATA(ENCODE_FILE(filename)), &fref, NULL); | ||
| 3471 | #else | ||
| 3472 | status = posix_pathname_to_fsspec (SDATA (ENCODE_FILE (filename)), &fss); | ||
| 3473 | #endif | ||
| 3474 | |||
| 3475 | if (status == noErr) | ||
| 3476 | { | ||
| 3477 | #ifdef MAC_OSX | ||
| 3478 | FSCatalogInfo catalogInfo; | ||
| 3479 | |||
| 3480 | status = FSGetCatalogInfo(&fref, kFSCatInfoFinderInfo, | ||
| 3481 | &catalogInfo, NULL, NULL, NULL); | ||
| 3482 | #else | ||
| 3483 | FInfo finder_info; | ||
| 3484 | |||
| 3485 | status = FSpGetFInfo (&fss, &finder_info); | ||
| 3486 | #endif | ||
| 3487 | if (status == noErr) | ||
| 3488 | { | ||
| 3489 | #ifdef MAC_OSX | ||
| 3490 | result = mac_get_object_from_code(((FileInfo*)&catalogInfo.finderInfo)->fileCreator); | ||
| 3491 | #else | ||
| 3492 | result = mac_get_object_from_code (finder_info.fdCreator); | ||
| 3493 | #endif | ||
| 3494 | } | ||
| 3495 | } | ||
| 3496 | UNBLOCK_INPUT; | ||
| 3497 | if (status != noErr) { | ||
| 3498 | error ("Error while getting file information."); | ||
| 3499 | } | ||
| 3500 | return result; | ||
| 3501 | } | ||
| 3502 | |||
| 3503 | DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0, | ||
| 3504 | doc: /* Get the type code of FILENAME as a four character string. */) | ||
| 3505 | (filename) | ||
| 3506 | Lisp_Object filename; | ||
| 3507 | { | ||
| 3508 | OSErr status; | ||
| 3509 | #ifdef MAC_OSX | ||
| 3510 | FSRef fref; | ||
| 3511 | #else | ||
| 3512 | FSSpec fss; | ||
| 3513 | #endif | ||
| 3514 | OSType cCode; | ||
| 3515 | Lisp_Object result = Qnil; | ||
| 3516 | CHECK_STRING (filename); | ||
| 3517 | |||
| 3518 | if (NILP(Ffile_exists_p(filename)) || !NILP(Ffile_directory_p(filename))) { | ||
| 3519 | return Qnil; | ||
| 3520 | } | ||
| 3521 | filename = Fexpand_file_name (filename, Qnil); | ||
| 3522 | |||
| 3523 | BLOCK_INPUT; | ||
| 3524 | #ifdef MAC_OSX | ||
| 3525 | status = FSPathMakeRef(SDATA(ENCODE_FILE(filename)), &fref, NULL); | ||
| 3526 | #else | ||
| 3527 | status = posix_pathname_to_fsspec (SDATA (ENCODE_FILE (filename)), &fss); | ||
| 3528 | #endif | ||
| 3529 | |||
| 3530 | if (status == noErr) | ||
| 3531 | { | ||
| 3532 | #ifdef MAC_OSX | ||
| 3533 | FSCatalogInfo catalogInfo; | ||
| 3534 | |||
| 3535 | status = FSGetCatalogInfo(&fref, kFSCatInfoFinderInfo, | ||
| 3536 | &catalogInfo, NULL, NULL, NULL); | ||
| 3537 | #else | ||
| 3538 | FInfo finder_info; | ||
| 3539 | |||
| 3540 | status = FSpGetFInfo (&fss, &finder_info); | ||
| 3541 | #endif | ||
| 3542 | if (status == noErr) | ||
| 3543 | { | ||
| 3544 | #ifdef MAC_OSX | ||
| 3545 | result = mac_get_object_from_code(((FileInfo*)&catalogInfo.finderInfo)->fileType); | ||
| 3546 | #else | ||
| 3547 | result = mac_get_object_from_code (finder_info.fdType); | ||
| 3548 | #endif | ||
| 3549 | } | ||
| 3550 | } | ||
| 3551 | UNBLOCK_INPUT; | ||
| 3552 | if (status != noErr) { | ||
| 3553 | error ("Error while getting file information."); | ||
| 3554 | } | ||
| 3555 | return result; | ||
| 3556 | } | ||
| 3557 | |||
| 3558 | DEFUN ("mac-set-file-creator", Fmac_set_file_creator, Smac_set_file_creator, 1, 2, 0, | ||
| 3559 | doc: /* Set creator code of file FILENAME to CODE. | ||
| 3560 | If non-nil, CODE must be a 4-character string. Otherwise, 'EMAx' is | ||
| 3561 | assumed. Return non-nil if successful. */) | ||
| 3562 | (filename, code) | ||
| 3563 | Lisp_Object filename, code; | ||
| 3564 | { | ||
| 3565 | OSErr status; | ||
| 3566 | #ifdef MAC_OSX | ||
| 3567 | FSRef fref; | ||
| 3568 | #else | ||
| 3569 | FSSpec fss; | ||
| 3570 | #endif | ||
| 3571 | OSType cCode; | ||
| 3572 | CHECK_STRING (filename); | ||
| 3573 | |||
| 3574 | cCode = mac_get_code_from_arg(code, 'EMAx'); | ||
| 3575 | |||
| 3576 | if (NILP(Ffile_exists_p(filename)) || !NILP(Ffile_directory_p(filename))) { | ||
| 3577 | return Qnil; | ||
| 3578 | } | ||
| 3579 | filename = Fexpand_file_name (filename, Qnil); | ||
| 3580 | |||
| 3581 | BLOCK_INPUT; | ||
| 3582 | #ifdef MAC_OSX | ||
| 3583 | status = FSPathMakeRef(SDATA(ENCODE_FILE(filename)), &fref, NULL); | ||
| 3584 | #else | ||
| 3585 | status = posix_pathname_to_fsspec (SDATA (ENCODE_FILE (filename)), &fss); | ||
| 3586 | #endif | ||
| 3587 | |||
| 3588 | if (status == noErr) | ||
| 3589 | { | ||
| 3590 | #ifdef MAC_OSX | ||
| 3591 | FSCatalogInfo catalogInfo; | ||
| 3592 | FSRef parentDir; | ||
| 3593 | status = FSGetCatalogInfo(&fref, kFSCatInfoFinderInfo, | ||
| 3594 | &catalogInfo, NULL, NULL, &parentDir); | ||
| 3595 | #else | ||
| 3596 | FInfo finder_info; | ||
| 3597 | |||
| 3598 | status = FSpGetFInfo (&fss, &finder_info); | ||
| 3599 | #endif | ||
| 3600 | if (status == noErr) | ||
| 3601 | { | ||
| 3602 | #ifdef MAC_OSX | ||
| 3603 | ((FileInfo*)&catalogInfo.finderInfo)->fileCreator = cCode; | ||
| 3604 | status = FSSetCatalogInfo(&fref, kFSCatInfoFinderInfo, &catalogInfo); | ||
| 3605 | /* TODO: on Mac OS 10.2, we need to touch the parent dir, FNNotify? */ | ||
| 3606 | #else | ||
| 3607 | finder_info.fdCreator = cCode; | ||
| 3608 | status = FSpSetFInfo (&fss, &finder_info); | ||
| 3609 | #endif | ||
| 3610 | } | ||
| 3611 | } | ||
| 3612 | UNBLOCK_INPUT; | ||
| 3613 | if (status != noErr) { | ||
| 3614 | error ("Error while setting creator information."); | ||
| 3615 | } | ||
| 3616 | return Qt; | ||
| 3617 | } | ||
| 3618 | |||
| 3619 | DEFUN ("mac-set-file-type", Fmac_set_file_type, Smac_set_file_type, 2, 2, 0, | ||
| 3620 | doc: /* Set file code of file FILENAME to CODE. | ||
| 3621 | CODE must be a 4-character string. Return non-nil if successful. */) | ||
| 3622 | (filename, code) | ||
| 3623 | Lisp_Object filename, code; | ||
| 3624 | { | ||
| 3625 | OSErr status; | ||
| 3626 | #ifdef MAC_OSX | ||
| 3627 | FSRef fref; | ||
| 3628 | #else | ||
| 3629 | FSSpec fss; | ||
| 3630 | #endif | ||
| 3631 | OSType cCode; | ||
| 3632 | CHECK_STRING (filename); | ||
| 3633 | |||
| 3634 | cCode = mac_get_code_from_arg(code, 0); /* Default to empty code*/ | ||
| 3635 | |||
| 3636 | if (NILP(Ffile_exists_p(filename)) || !NILP(Ffile_directory_p(filename))) { | ||
| 3637 | return Qnil; | ||
| 3638 | } | ||
| 3639 | filename = Fexpand_file_name (filename, Qnil); | ||
| 3640 | |||
| 3641 | BLOCK_INPUT; | ||
| 3642 | #ifdef MAC_OSX | ||
| 3643 | status = FSPathMakeRef(SDATA(ENCODE_FILE(filename)), &fref, NULL); | ||
| 3644 | #else | ||
| 3645 | status = posix_pathname_to_fsspec (SDATA (ENCODE_FILE (filename)), &fss); | ||
| 3646 | #endif | ||
| 3647 | |||
| 3648 | if (status == noErr) | ||
| 3649 | { | ||
| 3650 | #ifdef MAC_OSX | ||
| 3651 | FSCatalogInfo catalogInfo; | ||
| 3652 | FSRef parentDir; | ||
| 3653 | status = FSGetCatalogInfo(&fref, kFSCatInfoFinderInfo, | ||
| 3654 | &catalogInfo, NULL, NULL, &parentDir); | ||
| 3655 | #else | ||
| 3656 | FInfo finder_info; | ||
| 3657 | |||
| 3658 | status = FSpGetFInfo (&fss, &finder_info); | ||
| 3659 | #endif | ||
| 3660 | if (status == noErr) | ||
| 3661 | { | ||
| 3662 | #ifdef MAC_OSX | ||
| 3663 | ((FileInfo*)&catalogInfo.finderInfo)->fileType = cCode; | ||
| 3664 | status = FSSetCatalogInfo(&fref, kFSCatInfoFinderInfo, &catalogInfo); | ||
| 3665 | /* TODO: on Mac OS 10.2, we need to touch the parent dir, FNNotify? */ | ||
| 3666 | #else | ||
| 3667 | finder_info.fdType = cCode; | ||
| 3668 | status = FSpSetFInfo (&fss, &finder_info); | ||
| 3669 | #endif | ||
| 3670 | } | ||
| 3671 | } | ||
| 3672 | UNBLOCK_INPUT; | ||
| 3673 | if (status != noErr) { | ||
| 3674 | error ("Error while setting creator information."); | ||
| 3675 | } | ||
| 3676 | return Qt; | ||
| 3677 | } | ||
| 3678 | |||
| 3397 | 3679 | ||
| 3398 | /* Compile and execute the AppleScript SCRIPT and return the error | 3680 | /* Compile and execute the AppleScript SCRIPT and return the error |
| 3399 | status as function value. A zero is returned if compilation and | 3681 | status as function value. A zero is returned if compilation and |
| @@ -4361,6 +4643,10 @@ syms_of_mac () | |||
| 4361 | #endif | 4643 | #endif |
| 4362 | defsubr (&Smac_clear_font_name_table); | 4644 | defsubr (&Smac_clear_font_name_table); |
| 4363 | 4645 | ||
| 4646 | defsubr (&Smac_set_file_creator); | ||
| 4647 | defsubr (&Smac_set_file_type); | ||
| 4648 | defsubr (&Smac_get_file_creator); | ||
| 4649 | defsubr (&Smac_get_file_type); | ||
| 4364 | defsubr (&Sdo_applescript); | 4650 | defsubr (&Sdo_applescript); |
| 4365 | defsubr (&Smac_file_name_to_posix); | 4651 | defsubr (&Smac_file_name_to_posix); |
| 4366 | defsubr (&Sposix_file_name_to_mac); | 4652 | defsubr (&Sposix_file_name_to_mac); |
diff --git a/src/macterm.c b/src/macterm.c index 53028f973f2..9420f236e59 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -22,10 +22,10 @@ Boston, MA 02110-1301, USA. */ | |||
| 22 | 22 | ||
| 23 | #include <config.h> | 23 | #include <config.h> |
| 24 | #include <signal.h> | 24 | #include <signal.h> |
| 25 | |||
| 25 | #include <stdio.h> | 26 | #include <stdio.h> |
| 26 | #include <stdlib.h> | 27 | |
| 27 | #include "lisp.h" | 28 | #include "lisp.h" |
| 28 | #include "charset.h" | ||
| 29 | #include "blockinput.h" | 29 | #include "blockinput.h" |
| 30 | 30 | ||
| 31 | #include "macterm.h" | 31 | #include "macterm.h" |
| @@ -62,8 +62,6 @@ Boston, MA 02110-1301, USA. */ | |||
| 62 | 62 | ||
| 63 | #include "systty.h" | 63 | #include "systty.h" |
| 64 | #include "systime.h" | 64 | #include "systime.h" |
| 65 | #include "atimer.h" | ||
| 66 | #include "keymap.h" | ||
| 67 | 65 | ||
| 68 | #include <ctype.h> | 66 | #include <ctype.h> |
| 69 | #include <errno.h> | 67 | #include <errno.h> |
| @@ -71,7 +69,8 @@ Boston, MA 02110-1301, USA. */ | |||
| 71 | #include <sys/stat.h> | 69 | #include <sys/stat.h> |
| 72 | #include <sys/param.h> | 70 | #include <sys/param.h> |
| 73 | 71 | ||
| 74 | #include "keyboard.h" | 72 | #include "charset.h" |
| 73 | #include "coding.h" | ||
| 75 | #include "frame.h" | 74 | #include "frame.h" |
| 76 | #include "dispextern.h" | 75 | #include "dispextern.h" |
| 77 | #include "fontset.h" | 76 | #include "fontset.h" |
| @@ -82,10 +81,11 @@ Boston, MA 02110-1301, USA. */ | |||
| 82 | #include "disptab.h" | 81 | #include "disptab.h" |
| 83 | #include "buffer.h" | 82 | #include "buffer.h" |
| 84 | #include "window.h" | 83 | #include "window.h" |
| 84 | #include "keyboard.h" | ||
| 85 | #include "intervals.h" | 85 | #include "intervals.h" |
| 86 | #include "composite.h" | 86 | #include "atimer.h" |
| 87 | #include "keymap.h" | ||
| 87 | #include "character.h" | 88 | #include "character.h" |
| 88 | #include "coding.h" | ||
| 89 | #include "ccl.h" | 89 | #include "ccl.h" |
| 90 | 90 | ||
| 91 | /* Set of macros that handle mapping of Mac modifier keys to emacs. */ | 91 | /* Set of macros that handle mapping of Mac modifier keys to emacs. */ |
| @@ -116,15 +116,6 @@ static int any_help_event_p; | |||
| 116 | /* Last window where we saw the mouse. Used by mouse-autoselect-window. */ | 116 | /* Last window where we saw the mouse. Used by mouse-autoselect-window. */ |
| 117 | static Lisp_Object last_window; | 117 | static Lisp_Object last_window; |
| 118 | 118 | ||
| 119 | /* Non-zero means make use of UNDERLINE_POSITION font properties. */ | ||
| 120 | |||
| 121 | int x_use_underline_position_properties; | ||
| 122 | |||
| 123 | /* Non-zero means draw block and hollow cursor as wide as the glyph | ||
| 124 | under it. For example, if a block cursor is over a tab, it will be | ||
| 125 | drawn as wide as that tab on the display. */ | ||
| 126 | |||
| 127 | |||
| 128 | /* This is a chain of structures for all the X displays currently in | 119 | /* This is a chain of structures for all the X displays currently in |
| 129 | use. */ | 120 | use. */ |
| 130 | 121 | ||
| @@ -150,8 +141,6 @@ struct mac_display_info one_mac_display_info; | |||
| 150 | 141 | ||
| 151 | extern struct frame *updating_frame; | 142 | extern struct frame *updating_frame; |
| 152 | 143 | ||
| 153 | extern int waiting_for_input; | ||
| 154 | |||
| 155 | /* This is a frame waiting to be auto-raised, within XTread_socket. */ | 144 | /* This is a frame waiting to be auto-raised, within XTread_socket. */ |
| 156 | 145 | ||
| 157 | struct frame *pending_autoraise_frame; | 146 | struct frame *pending_autoraise_frame; |
| @@ -179,7 +168,6 @@ struct frame *pending_autoraise_frame; | |||
| 179 | /* Where the mouse was last time we reported a mouse event. */ | 168 | /* Where the mouse was last time we reported a mouse event. */ |
| 180 | 169 | ||
| 181 | static Rect last_mouse_glyph; | 170 | static Rect last_mouse_glyph; |
| 182 | static Lisp_Object last_mouse_press_frame; | ||
| 183 | 171 | ||
| 184 | /* The scroll bar in which the last X motion event occurred. | 172 | /* The scroll bar in which the last X motion event occurred. |
| 185 | 173 | ||
| @@ -213,45 +201,24 @@ static int volatile input_signal_count; | |||
| 213 | static int input_signal_count; | 201 | static int input_signal_count; |
| 214 | #endif | 202 | #endif |
| 215 | 203 | ||
| 216 | /* Used locally within XTread_socket. */ | 204 | extern Lisp_Object Vsystem_name; |
| 217 | |||
| 218 | static int x_noop_count; | ||
| 219 | |||
| 220 | /* Initial values of argv and argc. */ | ||
| 221 | |||
| 222 | extern char **initial_argv; | ||
| 223 | extern int initial_argc; | ||
| 224 | |||
| 225 | extern Lisp_Object Vcommand_line_args, Vsystem_name; | ||
| 226 | |||
| 227 | /* Tells if a window manager is present or not. */ | ||
| 228 | |||
| 229 | extern Lisp_Object Vx_no_window_manager; | ||
| 230 | |||
| 231 | extern int errno; | ||
| 232 | 205 | ||
| 233 | /* A mask of extra modifier bits to put into every keyboard char. */ | 206 | /* A mask of extra modifier bits to put into every keyboard char. */ |
| 234 | 207 | ||
| 235 | extern int extra_keyboard_modifiers; | 208 | extern EMACS_INT extra_keyboard_modifiers; |
| 236 | 209 | ||
| 237 | /* The keysyms to use for the various modifiers. */ | 210 | /* The keysyms to use for the various modifiers. */ |
| 238 | 211 | ||
| 239 | static Lisp_Object Qalt, Qhyper, Qsuper, Qmodifier_value; | 212 | static Lisp_Object Qalt, Qhyper, Qsuper, Qmodifier_value; |
| 240 | 213 | ||
| 241 | static Lisp_Object Qvendor_specific_keysyms; | ||
| 242 | |||
| 243 | #if 0 | ||
| 244 | extern XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *)); | ||
| 245 | #endif | ||
| 246 | |||
| 247 | extern int inhibit_window_system; | 214 | extern int inhibit_window_system; |
| 248 | 215 | ||
| 249 | #if __MRC__ && !TARGET_API_MAC_CARBON | 216 | #if __MRC__ && !TARGET_API_MAC_CARBON |
| 250 | QDGlobals qd; /* QuickDraw global information structure. */ | 217 | QDGlobals qd; /* QuickDraw global information structure. */ |
| 251 | #endif | 218 | #endif |
| 252 | 219 | ||
| 220 | #define mac_window_to_frame(wp) (((mac_output *) GetWRefCon (wp))->mFP) | ||
| 253 | 221 | ||
| 254 | struct frame * x_window_to_frame (struct mac_display_info *, WindowPtr); | ||
| 255 | struct mac_display_info *mac_display_info_for_display (Display *); | 222 | struct mac_display_info *mac_display_info_for_display (Display *); |
| 256 | static void x_update_window_end P_ ((struct window *, int, int)); | 223 | static void x_update_window_end P_ ((struct window *, int, int)); |
| 257 | static int x_io_error_quitter P_ ((Display *)); | 224 | static int x_io_error_quitter P_ ((Display *)); |
| @@ -291,17 +258,18 @@ static void x_flush P_ ((struct frame *f)); | |||
| 291 | static void x_update_begin P_ ((struct frame *)); | 258 | static void x_update_begin P_ ((struct frame *)); |
| 292 | static void x_update_window_begin P_ ((struct window *)); | 259 | static void x_update_window_begin P_ ((struct window *)); |
| 293 | static void x_after_update_window_line P_ ((struct glyph_row *)); | 260 | static void x_after_update_window_line P_ ((struct glyph_row *)); |
| 261 | static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, | ||
| 262 | enum scroll_bar_part *, | ||
| 263 | Lisp_Object *, Lisp_Object *, | ||
| 264 | unsigned long *)); | ||
| 294 | 265 | ||
| 295 | static int is_emacs_window (WindowPtr); | 266 | static int is_emacs_window (WindowPtr); |
| 296 | 267 | ||
| 297 | int x_bitmap_icon (struct frame *, Lisp_Object); | 268 | int x_bitmap_icon (struct frame *, Lisp_Object); |
| 298 | void x_make_frame_visible (struct frame *); | 269 | void x_make_frame_visible (struct frame *); |
| 299 | 270 | ||
| 300 | extern void window_scroll (Lisp_Object, int, int, int); | ||
| 301 | |||
| 302 | /* Defined in macmenu.h. */ | 271 | /* Defined in macmenu.h. */ |
| 303 | extern void menubar_selection_callback (FRAME_PTR, int); | 272 | extern void menubar_selection_callback (FRAME_PTR, int); |
| 304 | extern void set_frame_menubar (FRAME_PTR, int, int); | ||
| 305 | 273 | ||
| 306 | /* X display function emulation */ | 274 | /* X display function emulation */ |
| 307 | 275 | ||
| @@ -914,24 +882,6 @@ mac_copy_area_with_mask (display, src, mask, dest, gc, src_x, src_y, | |||
| 914 | } | 882 | } |
| 915 | 883 | ||
| 916 | 884 | ||
| 917 | #if 0 | ||
| 918 | /* Convert a pair of local coordinates to global (screen) coordinates. | ||
| 919 | Assume graphic port has been properly set. */ | ||
| 920 | static void | ||
| 921 | local_to_global_coord (short *h, short *v) | ||
| 922 | { | ||
| 923 | Point p; | ||
| 924 | |||
| 925 | p.h = *h; | ||
| 926 | p.v = *v; | ||
| 927 | |||
| 928 | LocalToGlobal (&p); | ||
| 929 | |||
| 930 | *h = p.h; | ||
| 931 | *v = p.v; | ||
| 932 | } | ||
| 933 | #endif | ||
| 934 | |||
| 935 | /* Mac replacement for XCopyArea: used only for scrolling. */ | 885 | /* Mac replacement for XCopyArea: used only for scrolling. */ |
| 936 | 886 | ||
| 937 | static void | 887 | static void |
| @@ -955,23 +905,10 @@ mac_scroll_area (display, w, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 955 | Rect src_r, dest_r; | 905 | Rect src_r, dest_r; |
| 956 | 906 | ||
| 957 | SetPort (w); | 907 | SetPort (w); |
| 958 | #if 0 | ||
| 959 | mac_set_colors (gc, NULL); | ||
| 960 | #endif | ||
| 961 | 908 | ||
| 962 | SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); | 909 | SetRect (&src_r, src_x, src_y, src_x + width, src_y + height); |
| 963 | SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); | 910 | SetRect (&dest_r, dest_x, dest_y, dest_x + width, dest_y + height); |
| 964 | 911 | ||
| 965 | #if 0 | ||
| 966 | /* Need to use global coordinates and screenBits since src and dest | ||
| 967 | areas overlap in general. */ | ||
| 968 | local_to_global_coord (&src_r.left, &src_r.top); | ||
| 969 | local_to_global_coord (&src_r.right, &src_r.bottom); | ||
| 970 | local_to_global_coord (&dest_r.left, &dest_r.top); | ||
| 971 | local_to_global_coord (&dest_r.right, &dest_r.bottom); | ||
| 972 | |||
| 973 | CopyBits (&qd.screenBits, &qd.screenBits, &src_r, &dest_r, srcCopy, 0); | ||
| 974 | #else | ||
| 975 | /* In Color QuickDraw, set ForeColor and BackColor as follows to avoid | 912 | /* In Color QuickDraw, set ForeColor and BackColor as follows to avoid |
| 976 | color mapping in CopyBits. Otherwise, it will be slow. */ | 913 | color mapping in CopyBits. Otherwise, it will be slow. */ |
| 977 | ForeColor (blackColor); | 914 | ForeColor (blackColor); |
| @@ -979,7 +916,6 @@ mac_scroll_area (display, w, gc, src_x, src_y, width, height, dest_x, dest_y) | |||
| 979 | CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); | 916 | CopyBits (&(w->portBits), &(w->portBits), &src_r, &dest_r, srcCopy, 0); |
| 980 | 917 | ||
| 981 | mac_set_colors (gc, NULL); | 918 | mac_set_colors (gc, NULL); |
| 982 | #endif | ||
| 983 | #endif /* not TARGET_API_MAC_CARBON */ | 919 | #endif /* not TARGET_API_MAC_CARBON */ |
| 984 | } | 920 | } |
| 985 | 921 | ||
| @@ -1347,7 +1283,6 @@ mac_draw_vertical_window_border (w, x, y0, y1) | |||
| 1347 | f->output_data.mac->normal_gc, x, y0, x, y1); | 1283 | f->output_data.mac->normal_gc, x, y0, x, y1); |
| 1348 | } | 1284 | } |
| 1349 | 1285 | ||
| 1350 | |||
| 1351 | /* End update of window W (which is equal to updated_window). | 1286 | /* End update of window W (which is equal to updated_window). |
| 1352 | 1287 | ||
| 1353 | Draw vertical borders between horizontally adjacent windows, and | 1288 | Draw vertical borders between horizontally adjacent windows, and |
| @@ -1359,7 +1294,7 @@ mac_draw_vertical_window_border (w, x, y0, y1) | |||
| 1359 | 1294 | ||
| 1360 | W may be a menu bar pseudo-window in case we don't have X toolkit | 1295 | W may be a menu bar pseudo-window in case we don't have X toolkit |
| 1361 | support. Such windows don't have a cursor, so don't display it | 1296 | support. Such windows don't have a cursor, so don't display it |
| 1362 | here. */ | 1297 | here. */ |
| 1363 | 1298 | ||
| 1364 | static void | 1299 | static void |
| 1365 | x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p) | 1300 | x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p) |
| @@ -1392,14 +1327,6 @@ x_update_window_end (w, cursor_on_p, mouse_face_overwritten_p) | |||
| 1392 | dpyinfo->mouse_face_window = Qnil; | 1327 | dpyinfo->mouse_face_window = Qnil; |
| 1393 | } | 1328 | } |
| 1394 | 1329 | ||
| 1395 | #if 0 | ||
| 1396 | /* Unhide the caret. This won't actually show the cursor, unless it | ||
| 1397 | was visible before the corresponding call to HideCaret in | ||
| 1398 | x_update_window_begin. */ | ||
| 1399 | if (w32_use_visible_system_caret) | ||
| 1400 | SendMessage (w32_system_caret_hwnd, WM_EMACS_SHOW_CARET, 0, 0); | ||
| 1401 | #endif | ||
| 1402 | |||
| 1403 | updated_window = NULL; | 1330 | updated_window = NULL; |
| 1404 | } | 1331 | } |
| 1405 | 1332 | ||
| @@ -1485,19 +1412,18 @@ x_after_update_window_line (desired_row) | |||
| 1485 | height > 0)) | 1412 | height > 0)) |
| 1486 | { | 1413 | { |
| 1487 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); | 1414 | int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); |
| 1415 | |||
| 1488 | /* Internal border is drawn below the tool bar. */ | 1416 | /* Internal border is drawn below the tool bar. */ |
| 1489 | if (WINDOWP (f->tool_bar_window) | 1417 | if (WINDOWP (f->tool_bar_window) |
| 1490 | && w == XWINDOW (f->tool_bar_window)) | 1418 | && w == XWINDOW (f->tool_bar_window)) |
| 1491 | y -= width; | 1419 | y -= width; |
| 1492 | 1420 | ||
| 1493 | BLOCK_INPUT; | 1421 | BLOCK_INPUT; |
| 1494 | |||
| 1495 | XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), | 1422 | XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
| 1496 | 0, y, width, height, 0); | 1423 | 0, y, width, height, 0); |
| 1497 | XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), | 1424 | XClearArea (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f), |
| 1498 | FRAME_PIXEL_WIDTH (f) - width, y, | 1425 | FRAME_PIXEL_WIDTH (f) - width, y, |
| 1499 | width, height, 0); | 1426 | width, height, 0); |
| 1500 | |||
| 1501 | UNBLOCK_INPUT; | 1427 | UNBLOCK_INPUT; |
| 1502 | } | 1428 | } |
| 1503 | } | 1429 | } |
| @@ -1583,6 +1509,7 @@ x_draw_fringe_bitmap (w, row, p) | |||
| 1583 | } | 1509 | } |
| 1584 | 1510 | ||
| 1585 | 1511 | ||
| 1512 | |||
| 1586 | /* This is called when starting Emacs and when restarting after | 1513 | /* This is called when starting Emacs and when restarting after |
| 1587 | suspend. When starting Emacs, no window is mapped. And nothing | 1514 | suspend. When starting Emacs, no window is mapped. And nothing |
| 1588 | must be done to Emacs's own window if it is suspended (though that | 1515 | must be done to Emacs's own window if it is suspended (though that |
| @@ -1601,6 +1528,7 @@ XTreset_terminal_modes () | |||
| 1601 | { | 1528 | { |
| 1602 | } | 1529 | } |
| 1603 | 1530 | ||
| 1531 | |||
| 1604 | 1532 | ||
| 1605 | /*********************************************************************** | 1533 | /*********************************************************************** |
| 1606 | Display Iterator | 1534 | Display Iterator |
| @@ -1791,6 +1719,7 @@ mac_encode_char (c, char2b, font_info, charset, two_byte_p) | |||
| 1791 | ***********************************************************************/ | 1719 | ***********************************************************************/ |
| 1792 | 1720 | ||
| 1793 | 1721 | ||
| 1722 | |||
| 1794 | static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); | 1723 | static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); |
| 1795 | static void x_set_glyph_string_gc P_ ((struct glyph_string *)); | 1724 | static void x_set_glyph_string_gc P_ ((struct glyph_string *)); |
| 1796 | static void x_draw_glyph_string_background P_ ((struct glyph_string *, | 1725 | static void x_draw_glyph_string_background P_ ((struct glyph_string *, |
| @@ -1799,6 +1728,7 @@ static void x_draw_glyph_string_foreground P_ ((struct glyph_string *)); | |||
| 1799 | static void x_draw_composite_glyph_string_foreground P_ ((struct glyph_string *)); | 1728 | static void x_draw_composite_glyph_string_foreground P_ ((struct glyph_string *)); |
| 1800 | static void x_draw_glyph_string_box P_ ((struct glyph_string *)); | 1729 | static void x_draw_glyph_string_box P_ ((struct glyph_string *)); |
| 1801 | static void x_draw_glyph_string P_ ((struct glyph_string *)); | 1730 | static void x_draw_glyph_string P_ ((struct glyph_string *)); |
| 1731 | static void mac_compute_glyph_string_overhangs P_ ((struct glyph_string *)); | ||
| 1802 | static void x_set_cursor_gc P_ ((struct glyph_string *)); | 1732 | static void x_set_cursor_gc P_ ((struct glyph_string *)); |
| 1803 | static void x_set_mode_line_face_gc P_ ((struct glyph_string *)); | 1733 | static void x_set_mode_line_face_gc P_ ((struct glyph_string *)); |
| 1804 | static void x_set_mouse_face_gc P_ ((struct glyph_string *)); | 1734 | static void x_set_mouse_face_gc P_ ((struct glyph_string *)); |
| @@ -3402,7 +3332,6 @@ XTring_bell () | |||
| 3402 | } | 3332 | } |
| 3403 | } | 3333 | } |
| 3404 | 3334 | ||
| 3405 | |||
| 3406 | 3335 | ||
| 3407 | /* Specify how many text lines, from the top of the window, | 3336 | /* Specify how many text lines, from the top of the window, |
| 3408 | should be affected by insert-lines and delete-lines operations. | 3337 | should be affected by insert-lines and delete-lines operations. |
| @@ -3837,43 +3766,6 @@ x_get_keysym_name (keysym) | |||
| 3837 | 3766 | ||
| 3838 | 3767 | ||
| 3839 | 3768 | ||
| 3840 | #if 0 | ||
| 3841 | /* Mouse clicks and mouse movement. Rah. */ | ||
| 3842 | |||
| 3843 | /* Prepare a mouse-event in *RESULT for placement in the input queue. | ||
| 3844 | |||
| 3845 | If the event is a button press, then note that we have grabbed | ||
| 3846 | the mouse. */ | ||
| 3847 | |||
| 3848 | static Lisp_Object | ||
| 3849 | construct_mouse_click (result, event, f) | ||
| 3850 | struct input_event *result; | ||
| 3851 | EventRecord *event; | ||
| 3852 | struct frame *f; | ||
| 3853 | { | ||
| 3854 | Point mouseLoc; | ||
| 3855 | |||
| 3856 | result->kind = MOUSE_CLICK_EVENT; | ||
| 3857 | result->code = 0; /* only one mouse button */ | ||
| 3858 | result->timestamp = event->when; | ||
| 3859 | result->modifiers = event->what == mouseDown ? down_modifier : up_modifier; | ||
| 3860 | |||
| 3861 | mouseLoc = event->where; | ||
| 3862 | |||
| 3863 | SetPortWindowPort (FRAME_MAC_WINDOW (f)); | ||
| 3864 | |||
| 3865 | GlobalToLocal (&mouseLoc); | ||
| 3866 | XSETINT (result->x, mouseLoc.h); | ||
| 3867 | XSETINT (result->y, mouseLoc.v); | ||
| 3868 | |||
| 3869 | XSETFRAME (result->frame_or_window, f); | ||
| 3870 | |||
| 3871 | result->arg = Qnil; | ||
| 3872 | return Qnil; | ||
| 3873 | } | ||
| 3874 | #endif | ||
| 3875 | |||
| 3876 | |||
| 3877 | /* Function to report a mouse movement to the mainstream Emacs code. | 3769 | /* Function to report a mouse movement to the mainstream Emacs code. |
| 3878 | The input handler calls this. | 3770 | The input handler calls this. |
| 3879 | 3771 | ||
| @@ -3929,18 +3821,11 @@ note_mouse_movement (frame, pos) | |||
| 3929 | } | 3821 | } |
| 3930 | } | 3822 | } |
| 3931 | 3823 | ||
| 3932 | /* This is used for debugging, to turn off note_mouse_highlight. */ | ||
| 3933 | |||
| 3934 | int disable_mouse_highlight; | ||
| 3935 | |||
| 3936 | |||
| 3937 | 3824 | ||
| 3938 | /************************************************************************ | 3825 | /************************************************************************ |
| 3939 | Mouse Face | 3826 | Mouse Face |
| 3940 | ************************************************************************/ | 3827 | ************************************************************************/ |
| 3941 | 3828 | ||
| 3942 | static struct scroll_bar *x_window_to_scroll_bar (); | ||
| 3943 | static void x_scroll_bar_report_motion (); | ||
| 3944 | static int glyph_rect P_ ((struct frame *f, int, int, Rect *)); | 3829 | static int glyph_rect P_ ((struct frame *f, int, int, Rect *)); |
| 3945 | 3830 | ||
| 3946 | 3831 | ||
| @@ -4152,20 +4037,16 @@ static OSStatus install_scroll_bar_timer P_ ((void)); | |||
| 4152 | static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval)); | 4037 | static OSStatus set_scroll_bar_timer P_ ((EventTimerInterval)); |
| 4153 | static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode)); | 4038 | static int control_part_code_to_scroll_bar_part P_ ((ControlPartCode)); |
| 4154 | static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, | 4039 | static void construct_scroll_bar_click P_ ((struct scroll_bar *, int, |
| 4155 | unsigned long, | ||
| 4156 | struct input_event *)); | 4040 | struct input_event *)); |
| 4157 | static OSErr get_control_part_bounds P_ ((ControlHandle, ControlPartCode, | 4041 | static OSErr get_control_part_bounds P_ ((ControlHandle, ControlPartCode, |
| 4158 | Rect *)); | 4042 | Rect *)); |
| 4159 | static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, | 4043 | static void x_scroll_bar_handle_press P_ ((struct scroll_bar *, |
| 4160 | ControlPartCode, | 4044 | ControlPartCode, |
| 4161 | unsigned long, | ||
| 4162 | struct input_event *)); | 4045 | struct input_event *)); |
| 4163 | static void x_scroll_bar_handle_release P_ ((struct scroll_bar *, | 4046 | static void x_scroll_bar_handle_release P_ ((struct scroll_bar *, |
| 4164 | unsigned long, | ||
| 4165 | struct input_event *)); | 4047 | struct input_event *)); |
| 4166 | static void x_scroll_bar_handle_drag P_ ((WindowPtr, struct scroll_bar *, | 4048 | static void x_scroll_bar_handle_drag P_ ((WindowPtr, struct scroll_bar *, |
| 4167 | Point, unsigned long, | 4049 | Point, struct input_event *)); |
| 4168 | struct input_event *)); | ||
| 4169 | static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *, | 4050 | static void x_set_toolkit_scroll_bar_thumb P_ ((struct scroll_bar *, |
| 4170 | int, int, int)); | 4051 | int, int, int)); |
| 4171 | 4052 | ||
| @@ -4264,10 +4145,9 @@ control_part_code_to_scroll_bar_part (part_code) | |||
| 4264 | } | 4145 | } |
| 4265 | 4146 | ||
| 4266 | static void | 4147 | static void |
| 4267 | construct_scroll_bar_click (bar, part, timestamp, bufp) | 4148 | construct_scroll_bar_click (bar, part, bufp) |
| 4268 | struct scroll_bar *bar; | 4149 | struct scroll_bar *bar; |
| 4269 | int part; | 4150 | int part; |
| 4270 | unsigned long timestamp; | ||
| 4271 | struct input_event *bufp; | 4151 | struct input_event *bufp; |
| 4272 | { | 4152 | { |
| 4273 | bufp->kind = SCROLL_BAR_CLICK_EVENT; | 4153 | bufp->kind = SCROLL_BAR_CLICK_EVENT; |
| @@ -4275,7 +4155,6 @@ construct_scroll_bar_click (bar, part, timestamp, bufp) | |||
| 4275 | bufp->arg = Qnil; | 4155 | bufp->arg = Qnil; |
| 4276 | bufp->part = part; | 4156 | bufp->part = part; |
| 4277 | bufp->code = 0; | 4157 | bufp->code = 0; |
| 4278 | bufp->timestamp = timestamp; | ||
| 4279 | XSETINT (bufp->x, 0); | 4158 | XSETINT (bufp->x, 0); |
| 4280 | XSETINT (bufp->y, 0); | 4159 | XSETINT (bufp->y, 0); |
| 4281 | bufp->modifiers = 0; | 4160 | bufp->modifiers = 0; |
| @@ -4299,10 +4178,9 @@ get_control_part_bounds (ch, part_code, rect) | |||
| 4299 | } | 4178 | } |
| 4300 | 4179 | ||
| 4301 | static void | 4180 | static void |
| 4302 | x_scroll_bar_handle_press (bar, part_code, timestamp, bufp) | 4181 | x_scroll_bar_handle_press (bar, part_code, bufp) |
| 4303 | struct scroll_bar *bar; | 4182 | struct scroll_bar *bar; |
| 4304 | ControlPartCode part_code; | 4183 | ControlPartCode part_code; |
| 4305 | unsigned long timestamp; | ||
| 4306 | struct input_event *bufp; | 4184 | struct input_event *bufp; |
| 4307 | { | 4185 | { |
| 4308 | int part = control_part_code_to_scroll_bar_part (part_code); | 4186 | int part = control_part_code_to_scroll_bar_part (part_code); |
| @@ -4312,7 +4190,7 @@ x_scroll_bar_handle_press (bar, part_code, timestamp, bufp) | |||
| 4312 | 4190 | ||
| 4313 | if (part != scroll_bar_handle) | 4191 | if (part != scroll_bar_handle) |
| 4314 | { | 4192 | { |
| 4315 | construct_scroll_bar_click (bar, part, timestamp, bufp); | 4193 | construct_scroll_bar_click (bar, part, bufp); |
| 4316 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code); | 4194 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code); |
| 4317 | set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY); | 4195 | set_scroll_bar_timer (SCROLL_BAR_FIRST_DELAY); |
| 4318 | } | 4196 | } |
| @@ -4323,14 +4201,13 @@ x_scroll_bar_handle_press (bar, part_code, timestamp, bufp) | |||
| 4323 | } | 4201 | } |
| 4324 | 4202 | ||
| 4325 | static void | 4203 | static void |
| 4326 | x_scroll_bar_handle_release (bar, timestamp, bufp) | 4204 | x_scroll_bar_handle_release (bar, bufp) |
| 4327 | struct scroll_bar *bar; | 4205 | struct scroll_bar *bar; |
| 4328 | unsigned long timestamp; | ||
| 4329 | struct input_event *bufp; | 4206 | struct input_event *bufp; |
| 4330 | { | 4207 | { |
| 4331 | if (last_scroll_bar_part != scroll_bar_handle | 4208 | if (last_scroll_bar_part != scroll_bar_handle |
| 4332 | || !GC_NILP (bar->dragging)) | 4209 | || !GC_NILP (bar->dragging)) |
| 4333 | construct_scroll_bar_click (bar, scroll_bar_end_scroll, timestamp, bufp); | 4210 | construct_scroll_bar_click (bar, scroll_bar_end_scroll, bufp); |
| 4334 | 4211 | ||
| 4335 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0); | 4212 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), 0); |
| 4336 | set_scroll_bar_timer (kEventDurationForever); | 4213 | set_scroll_bar_timer (kEventDurationForever); |
| @@ -4341,11 +4218,10 @@ x_scroll_bar_handle_release (bar, timestamp, bufp) | |||
| 4341 | } | 4218 | } |
| 4342 | 4219 | ||
| 4343 | static void | 4220 | static void |
| 4344 | x_scroll_bar_handle_drag (win, bar, mouse_pos, timestamp, bufp) | 4221 | x_scroll_bar_handle_drag (win, bar, mouse_pos, bufp) |
| 4345 | WindowPtr win; | 4222 | WindowPtr win; |
| 4346 | struct scroll_bar *bar; | 4223 | struct scroll_bar *bar; |
| 4347 | Point mouse_pos; | 4224 | Point mouse_pos; |
| 4348 | unsigned long timestamp; | ||
| 4349 | struct input_event *bufp; | 4225 | struct input_event *bufp; |
| 4350 | { | 4226 | { |
| 4351 | ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); | 4227 | ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); |
| @@ -4365,13 +4241,13 @@ x_scroll_bar_handle_drag (win, bar, mouse_pos, timestamp, bufp) | |||
| 4365 | top_range = (XINT (bar->track_height) - (r.bottom - r.top)) * | 4241 | top_range = (XINT (bar->track_height) - (r.bottom - r.top)) * |
| 4366 | (1.0 + (float) GetControlViewSize (ch) / GetControl32BitMaximum (ch)) | 4242 | (1.0 + (float) GetControlViewSize (ch) / GetControl32BitMaximum (ch)) |
| 4367 | + .5; | 4243 | + .5; |
| 4368 | 4244 | ||
| 4369 | if (top < 0) | 4245 | if (top < 0) |
| 4370 | top = 0; | 4246 | top = 0; |
| 4371 | if (top > top_range) | 4247 | if (top > top_range) |
| 4372 | top = top_range; | 4248 | top = top_range; |
| 4373 | 4249 | ||
| 4374 | construct_scroll_bar_click (bar, scroll_bar_handle, timestamp, bufp); | 4250 | construct_scroll_bar_click (bar, scroll_bar_handle, bufp); |
| 4375 | XSETINT (bufp->x, top); | 4251 | XSETINT (bufp->x, top); |
| 4376 | XSETINT (bufp->y, top_range); | 4252 | XSETINT (bufp->y, top_range); |
| 4377 | } | 4253 | } |
| @@ -4409,7 +4285,7 @@ x_scroll_bar_handle_drag (win, bar, mouse_pos, timestamp, bufp) | |||
| 4409 | else if (part != last_scroll_bar_part | 4285 | else if (part != last_scroll_bar_part |
| 4410 | || scroll_bar_timer_event_posted_p) | 4286 | || scroll_bar_timer_event_posted_p) |
| 4411 | { | 4287 | { |
| 4412 | construct_scroll_bar_click (bar, part, timestamp, bufp); | 4288 | construct_scroll_bar_click (bar, part, bufp); |
| 4413 | last_scroll_bar_part = part; | 4289 | last_scroll_bar_part = part; |
| 4414 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code); | 4290 | HiliteControl (SCROLL_BAR_CONTROL_HANDLE (bar), part_code); |
| 4415 | set_scroll_bar_timer (SCROLL_BAR_CONTINUOUS_DELAY); | 4291 | set_scroll_bar_timer (SCROLL_BAR_CONTINUOUS_DELAY); |
| @@ -4480,11 +4356,11 @@ x_scroll_bar_create (w, top, left, width, height, disp_top, disp_height) | |||
| 4480 | r.bottom = disp_top + disp_height; | 4356 | r.bottom = disp_top + disp_height; |
| 4481 | 4357 | ||
| 4482 | #if TARGET_API_MAC_CARBON | 4358 | #if TARGET_API_MAC_CARBON |
| 4483 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, | 4359 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", width < disp_height, |
| 4484 | kControlScrollBarProc, (long) bar); | 4360 | 0, 0, 0, kControlScrollBarProc, (long) bar); |
| 4485 | #else | 4361 | #else |
| 4486 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", 1, 0, 0, 0, | 4362 | ch = NewControl (FRAME_MAC_WINDOW (f), &r, "\p", width < disp_height, |
| 4487 | scrollBarProc, (long) bar); | 4363 | 0, 0, 0, scrollBarProc, (long) bar); |
| 4488 | #endif | 4364 | #endif |
| 4489 | SET_SCROLL_BAR_CONTROL_HANDLE (bar, ch); | 4365 | SET_SCROLL_BAR_CONTROL_HANDLE (bar, ch); |
| 4490 | 4366 | ||
| @@ -4609,10 +4485,12 @@ x_scroll_bar_remove (bar) | |||
| 4609 | UNBLOCK_INPUT; | 4485 | UNBLOCK_INPUT; |
| 4610 | } | 4486 | } |
| 4611 | 4487 | ||
| 4488 | |||
| 4612 | /* Set the handle of the vertical scroll bar for WINDOW to indicate | 4489 | /* Set the handle of the vertical scroll bar for WINDOW to indicate |
| 4613 | that we are displaying PORTION characters out of a total of WHOLE | 4490 | that we are displaying PORTION characters out of a total of WHOLE |
| 4614 | characters, starting at POSITION. If WINDOW has no scroll bar, | 4491 | characters, starting at POSITION. If WINDOW has no scroll bar, |
| 4615 | create one. */ | 4492 | create one. */ |
| 4493 | |||
| 4616 | static void | 4494 | static void |
| 4617 | XTset_vertical_scroll_bar (w, portion, whole, position) | 4495 | XTset_vertical_scroll_bar (w, portion, whole, position) |
| 4618 | struct window *w; | 4496 | struct window *w; |
| @@ -4707,7 +4585,8 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 4707 | MoveControl (ch, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, disp_top); | 4585 | MoveControl (ch, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, disp_top); |
| 4708 | SizeControl (ch, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, | 4586 | SizeControl (ch, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
| 4709 | disp_height); | 4587 | disp_height); |
| 4710 | ShowControl (ch); | 4588 | if (sb_width < disp_height) |
| 4589 | ShowControl (ch); | ||
| 4711 | 4590 | ||
| 4712 | /* Remember new settings. */ | 4591 | /* Remember new settings. */ |
| 4713 | XSETINT (bar->left, sb_left); | 4592 | XSETINT (bar->left, sb_left); |
| @@ -4810,6 +4689,7 @@ XTredeem_scroll_bar (window) | |||
| 4810 | struct window *window; | 4689 | struct window *window; |
| 4811 | { | 4690 | { |
| 4812 | struct scroll_bar *bar; | 4691 | struct scroll_bar *bar; |
| 4692 | struct frame *f; | ||
| 4813 | 4693 | ||
| 4814 | /* We can't redeem this window's scroll bar if it doesn't have one. */ | 4694 | /* We can't redeem this window's scroll bar if it doesn't have one. */ |
| 4815 | if (NILP (window->vertical_scroll_bar)) | 4695 | if (NILP (window->vertical_scroll_bar)) |
| @@ -4818,36 +4698,33 @@ XTredeem_scroll_bar (window) | |||
| 4818 | bar = XSCROLL_BAR (window->vertical_scroll_bar); | 4698 | bar = XSCROLL_BAR (window->vertical_scroll_bar); |
| 4819 | 4699 | ||
| 4820 | /* Unlink it from the condemned list. */ | 4700 | /* Unlink it from the condemned list. */ |
| 4821 | { | 4701 | f = XFRAME (WINDOW_FRAME (window)); |
| 4822 | FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); | 4702 | if (NILP (bar->prev)) |
| 4823 | 4703 | { | |
| 4824 | if (NILP (bar->prev)) | 4704 | /* If the prev pointer is nil, it must be the first in one of |
| 4825 | { | 4705 | the lists. */ |
| 4826 | /* If the prev pointer is nil, it must be the first in one of | 4706 | if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) |
| 4827 | the lists. */ | 4707 | /* It's not condemned. Everything's fine. */ |
| 4828 | if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) | 4708 | return; |
| 4829 | /* It's not condemned. Everything's fine. */ | 4709 | else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), |
| 4830 | return; | 4710 | window->vertical_scroll_bar)) |
| 4831 | else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), | 4711 | FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; |
| 4832 | window->vertical_scroll_bar)) | 4712 | else |
| 4833 | FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; | 4713 | /* If its prev pointer is nil, it must be at the front of |
| 4834 | else | 4714 | one or the other! */ |
| 4835 | /* If its prev pointer is nil, it must be at the front of | 4715 | abort (); |
| 4836 | one or the other! */ | 4716 | } |
| 4837 | abort (); | 4717 | else |
| 4838 | } | 4718 | XSCROLL_BAR (bar->prev)->next = bar->next; |
| 4839 | else | ||
| 4840 | XSCROLL_BAR (bar->prev)->next = bar->next; | ||
| 4841 | 4719 | ||
| 4842 | if (! NILP (bar->next)) | 4720 | if (! NILP (bar->next)) |
| 4843 | XSCROLL_BAR (bar->next)->prev = bar->prev; | 4721 | XSCROLL_BAR (bar->next)->prev = bar->prev; |
| 4844 | 4722 | ||
| 4845 | bar->next = FRAME_SCROLL_BARS (f); | 4723 | bar->next = FRAME_SCROLL_BARS (f); |
| 4846 | bar->prev = Qnil; | 4724 | bar->prev = Qnil; |
| 4847 | XSETVECTOR (FRAME_SCROLL_BARS (f), bar); | 4725 | XSETVECTOR (FRAME_SCROLL_BARS (f), bar); |
| 4848 | if (! NILP (bar->next)) | 4726 | if (! NILP (bar->next)) |
| 4849 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); | 4727 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); |
| 4850 | } | ||
| 4851 | } | 4728 | } |
| 4852 | 4729 | ||
| 4853 | /* Remove all scroll bars on FRAME that haven't been saved since the | 4730 | /* Remove all scroll bars on FRAME that haven't been saved since the |
| @@ -4986,8 +4863,8 @@ x_scroll_bar_note_movement (bar, y_pos, t) | |||
| 4986 | 4863 | ||
| 4987 | #endif /* !USE_TOOLKIT_SCROLL_BARS */ | 4864 | #endif /* !USE_TOOLKIT_SCROLL_BARS */ |
| 4988 | 4865 | ||
| 4989 | /* Return information to the user about the current position of the | 4866 | /* Return information to the user about the current position of the mouse |
| 4990 | mouse on the scroll bar. */ | 4867 | on the scroll bar. */ |
| 4991 | 4868 | ||
| 4992 | static void | 4869 | static void |
| 4993 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | 4870 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) |
| @@ -5516,6 +5393,7 @@ mac_get_window_bounds (f, inner, outer) | |||
| 5516 | } | 5393 | } |
| 5517 | 5394 | ||
| 5518 | 5395 | ||
| 5396 | |||
| 5519 | /* Calculate the absolute position in frame F | 5397 | /* Calculate the absolute position in frame F |
| 5520 | from its current recorded position values and gravity. */ | 5398 | from its current recorded position values and gravity. */ |
| 5521 | 5399 | ||
| @@ -5747,7 +5625,6 @@ x_set_mouse_pixel_position (f, pix_x, pix_y) | |||
| 5747 | UNBLOCK_INPUT; | 5625 | UNBLOCK_INPUT; |
| 5748 | #endif | 5626 | #endif |
| 5749 | } | 5627 | } |
| 5750 | |||
| 5751 | 5628 | ||
| 5752 | /* focus shifting, raising and lowering. */ | 5629 | /* focus shifting, raising and lowering. */ |
| 5753 | 5630 | ||
| @@ -5774,6 +5651,7 @@ x_unfocus_frame (f) | |||
| 5774 | } | 5651 | } |
| 5775 | 5652 | ||
| 5776 | /* Raise frame F. */ | 5653 | /* Raise frame F. */ |
| 5654 | |||
| 5777 | void | 5655 | void |
| 5778 | x_raise_frame (f) | 5656 | x_raise_frame (f) |
| 5779 | struct frame *f; | 5657 | struct frame *f; |
| @@ -5787,6 +5665,7 @@ x_raise_frame (f) | |||
| 5787 | } | 5665 | } |
| 5788 | 5666 | ||
| 5789 | /* Lower frame F. */ | 5667 | /* Lower frame F. */ |
| 5668 | |||
| 5790 | void | 5669 | void |
| 5791 | x_lower_frame (f) | 5670 | x_lower_frame (f) |
| 5792 | struct frame *f; | 5671 | struct frame *f; |
| @@ -6195,9 +6074,9 @@ x_get_font_info (f, font_idx) | |||
| 6195 | } | 6074 | } |
| 6196 | 6075 | ||
| 6197 | /* the global font name table */ | 6076 | /* the global font name table */ |
| 6198 | char **font_name_table = NULL; | 6077 | static char **font_name_table = NULL; |
| 6199 | int font_name_table_size = 0; | 6078 | static int font_name_table_size = 0; |
| 6200 | int font_name_count = 0; | 6079 | static int font_name_count = 0; |
| 6201 | 6080 | ||
| 6202 | /* Alist linking character set strings to Mac text encoding and Emacs | 6081 | /* Alist linking character set strings to Mac text encoding and Emacs |
| 6203 | coding system. */ | 6082 | coding system. */ |
| @@ -7460,22 +7339,6 @@ x_find_ccl_program (fontp) | |||
| 7460 | #define MIN_DOC_SIZE 64 | 7339 | #define MIN_DOC_SIZE 64 |
| 7461 | #define MAX_DOC_SIZE 32767 | 7340 | #define MAX_DOC_SIZE 32767 |
| 7462 | 7341 | ||
| 7463 | #if 0 | ||
| 7464 | /* sleep time for WaitNextEvent */ | ||
| 7465 | #define WNE_SLEEP_AT_SUSPEND 10 | ||
| 7466 | #define WNE_SLEEP_AT_RESUME 1 | ||
| 7467 | |||
| 7468 | /* the flag appl_is_suspended is used both for determining the sleep | ||
| 7469 | time to be passed to WaitNextEvent and whether the cursor should be | ||
| 7470 | drawn when updating the display. The cursor is turned off when | ||
| 7471 | Emacs is suspended. Redrawing it is unnecessary and what needs to | ||
| 7472 | be done depends on whether the cursor lies inside or outside the | ||
| 7473 | redraw region. So we might as well skip drawing it when Emacs is | ||
| 7474 | suspended. */ | ||
| 7475 | static Boolean app_is_suspended = false; | ||
| 7476 | static long app_sleep_time = WNE_SLEEP_AT_RESUME; | ||
| 7477 | #endif | ||
| 7478 | |||
| 7479 | #define EXTRA_STACK_ALLOC (256 * 1024) | 7342 | #define EXTRA_STACK_ALLOC (256 * 1024) |
| 7480 | 7343 | ||
| 7481 | #define ARGV_STRING_LIST_ID 129 | 7344 | #define ARGV_STRING_LIST_ID 129 |
| @@ -7512,8 +7375,8 @@ Lisp_Object Vmac_pass_command_to_system; | |||
| 7512 | Lisp_Object Vmac_pass_control_to_system; | 7375 | Lisp_Object Vmac_pass_control_to_system; |
| 7513 | 7376 | ||
| 7514 | /* Points to the variable `inev' in the function XTread_socket. It is | 7377 | /* Points to the variable `inev' in the function XTread_socket. It is |
| 7515 | used for passing an input event to the function back from a Carbon | 7378 | used for passing an input event to the function back from |
| 7516 | event handler. */ | 7379 | Carbon/Apple event handlers. */ |
| 7517 | static struct input_event *read_socket_inev = NULL; | 7380 | static struct input_event *read_socket_inev = NULL; |
| 7518 | #endif | 7381 | #endif |
| 7519 | 7382 | ||
| @@ -7521,8 +7384,6 @@ static struct input_event *read_socket_inev = NULL; | |||
| 7521 | drag and drop events. */ | 7384 | drag and drop events. */ |
| 7522 | Lisp_Object Qmac_ready_for_drag_n_drop; | 7385 | Lisp_Object Qmac_ready_for_drag_n_drop; |
| 7523 | 7386 | ||
| 7524 | Lisp_Object drag_and_drop_file_list; | ||
| 7525 | |||
| 7526 | Point saved_menu_event_location; | 7387 | Point saved_menu_event_location; |
| 7527 | 7388 | ||
| 7528 | /* Apple Events */ | 7389 | /* Apple Events */ |
| @@ -7858,20 +7719,12 @@ static void | |||
| 7858 | do_app_resume () | 7719 | do_app_resume () |
| 7859 | { | 7720 | { |
| 7860 | /* Window-activate events will do the job. */ | 7721 | /* Window-activate events will do the job. */ |
| 7861 | #if 0 | ||
| 7862 | app_is_suspended = false; | ||
| 7863 | app_sleep_time = WNE_SLEEP_AT_RESUME; | ||
| 7864 | #endif | ||
| 7865 | } | 7722 | } |
| 7866 | 7723 | ||
| 7867 | static void | 7724 | static void |
| 7868 | do_app_suspend () | 7725 | do_app_suspend () |
| 7869 | { | 7726 | { |
| 7870 | /* Window-deactivate events will do the job. */ | 7727 | /* Window-deactivate events will do the job. */ |
| 7871 | #if 0 | ||
| 7872 | app_is_suspended = true; | ||
| 7873 | app_sleep_time = WNE_SLEEP_AT_SUSPEND; | ||
| 7874 | #endif | ||
| 7875 | } | 7728 | } |
| 7876 | 7729 | ||
| 7877 | 7730 | ||
| @@ -8425,8 +8278,6 @@ mac_handle_mouse_event (next_handler, event, data) | |||
| 8425 | XSETINT (read_socket_inev->x, point.h); | 8278 | XSETINT (read_socket_inev->x, point.h); |
| 8426 | XSETINT (read_socket_inev->y, point.v); | 8279 | XSETINT (read_socket_inev->y, point.v); |
| 8427 | XSETFRAME (read_socket_inev->frame_or_window, f); | 8280 | XSETFRAME (read_socket_inev->frame_or_window, f); |
| 8428 | read_socket_inev->timestamp = | ||
| 8429 | EventTimeToTicks (GetEventTime (event)) * (1000/60); | ||
| 8430 | 8281 | ||
| 8431 | return noErr; | 8282 | return noErr; |
| 8432 | } | 8283 | } |
| @@ -8500,11 +8351,6 @@ do_ae_open_application(const AppleEvent *pae, AppleEvent *preply, long prefcon) | |||
| 8500 | } | 8351 | } |
| 8501 | 8352 | ||
| 8502 | 8353 | ||
| 8503 | /* Defined in mac.c. */ | ||
| 8504 | extern int | ||
| 8505 | path_from_vol_dir_name (char *, int, short, long, char *); | ||
| 8506 | |||
| 8507 | |||
| 8508 | /* Called when we receive an AppleEvent with an ID of | 8354 | /* Called when we receive an AppleEvent with an ID of |
| 8509 | "kAEOpenDocuments". This routine gets the direct parameter, | 8355 | "kAEOpenDocuments". This routine gets the direct parameter, |
| 8510 | extracts the FSSpecs in it, and puts their names on a list. */ | 8356 | extracts the FSSpecs in it, and puts their names on a list. */ |
| @@ -8528,6 +8374,9 @@ do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon) | |||
| 8528 | DescType actual_type; | 8374 | DescType actual_type; |
| 8529 | Size actual_size; | 8375 | Size actual_size; |
| 8530 | SelectionRange position; | 8376 | SelectionRange position; |
| 8377 | Lisp_Object file_list = Qnil; | ||
| 8378 | |||
| 8379 | xassert (read_socket_inev); | ||
| 8531 | 8380 | ||
| 8532 | err = AEGetParamDesc (message, keyDirectObject, typeAEList, &the_desc); | 8381 | err = AEGetParamDesc (message, keyDirectObject, typeAEList, &the_desc); |
| 8533 | if (err != noErr) | 8382 | if (err != noErr) |
| @@ -8535,10 +8384,10 @@ do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon) | |||
| 8535 | 8384 | ||
| 8536 | err = AEGetParamPtr (message, keyAEPosition, typeChar, &actual_type, &position, sizeof(SelectionRange), &actual_size); | 8385 | err = AEGetParamPtr (message, keyAEPosition, typeChar, &actual_type, &position, sizeof(SelectionRange), &actual_size); |
| 8537 | if (err == noErr) | 8386 | if (err == noErr) |
| 8538 | drag_and_drop_file_list = Fcons (list3 (make_number (position.lineNum + 1), | 8387 | file_list = Fcons (list3 (make_number (position.lineNum + 1), |
| 8539 | make_number (position.startRange + 1), | 8388 | make_number (position.startRange + 1), |
| 8540 | make_number (position.endRange + 1)), | 8389 | make_number (position.endRange + 1)), |
| 8541 | drag_and_drop_file_list); | 8390 | file_list); |
| 8542 | 8391 | ||
| 8543 | /* Check to see that we got all of the required parameters from the | 8392 | /* Check to see that we got all of the required parameters from the |
| 8544 | event descriptor. For an 'odoc' event this should just be the | 8393 | event descriptor. For an 'odoc' event this should just be the |
| @@ -8592,12 +8441,49 @@ do_ae_open_documents(AppleEvent *message, AppleEvent *reply, long refcon) | |||
| 8592 | sizeof (unix_path_name) - 1) == noErr) | 8441 | sizeof (unix_path_name) - 1) == noErr) |
| 8593 | #endif | 8442 | #endif |
| 8594 | /* x-dnd functions expect undecoded filenames. */ | 8443 | /* x-dnd functions expect undecoded filenames. */ |
| 8595 | drag_and_drop_file_list = | 8444 | file_list = Fcons (make_unibyte_string (unix_path_name, |
| 8596 | Fcons (make_unibyte_string (unix_path_name, | 8445 | strlen (unix_path_name)), |
| 8597 | strlen (unix_path_name)), | 8446 | file_list); |
| 8598 | drag_and_drop_file_list); | ||
| 8599 | } | 8447 | } |
| 8600 | } | 8448 | } |
| 8449 | |||
| 8450 | /* Build a DRAG_N_DROP_EVENT type event as is done in | ||
| 8451 | constuct_drag_n_drop in w32term.c. */ | ||
| 8452 | if (!NILP (file_list)) | ||
| 8453 | { | ||
| 8454 | struct frame *f = mac_focus_frame (&one_mac_display_info); | ||
| 8455 | WindowPtr wp; | ||
| 8456 | Lisp_Object frame; | ||
| 8457 | |||
| 8458 | read_socket_inev->kind = DRAG_N_DROP_EVENT; | ||
| 8459 | read_socket_inev->code = 0; | ||
| 8460 | read_socket_inev->modifiers = 0; | ||
| 8461 | |||
| 8462 | XSETINT (read_socket_inev->x, 0); | ||
| 8463 | XSETINT (read_socket_inev->y, 0); | ||
| 8464 | |||
| 8465 | XSETFRAME (frame, f); | ||
| 8466 | read_socket_inev->frame_or_window = Fcons (frame, file_list); | ||
| 8467 | |||
| 8468 | #if 0 | ||
| 8469 | /* Regardless of whether Emacs was suspended or in the | ||
| 8470 | foreground, ask it to redraw its entire screen. Otherwise | ||
| 8471 | parts of the screen can be left in an inconsistent | ||
| 8472 | state. */ | ||
| 8473 | wp = FRAME_MAC_WINDOW (f); | ||
| 8474 | if (wp) | ||
| 8475 | #if TARGET_API_MAC_CARBON | ||
| 8476 | { | ||
| 8477 | Rect r; | ||
| 8478 | |||
| 8479 | GetWindowPortBounds (wp, &r); | ||
| 8480 | InvalWindowRect (wp, &r); | ||
| 8481 | } | ||
| 8482 | #else /* not TARGET_API_MAC_CARBON */ | ||
| 8483 | InvalRect (&(wp->portRect)); | ||
| 8484 | #endif /* not TARGET_API_MAC_CARBON */ | ||
| 8485 | #endif | ||
| 8486 | } | ||
| 8601 | } | 8487 | } |
| 8602 | 8488 | ||
| 8603 | error_exit: | 8489 | error_exit: |
| @@ -8690,11 +8576,12 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | |||
| 8690 | ItemReference theItem; | 8576 | ItemReference theItem; |
| 8691 | HFSFlavor data; | 8577 | HFSFlavor data; |
| 8692 | Size size = sizeof (HFSFlavor); | 8578 | Size size = sizeof (HFSFlavor); |
| 8579 | Lisp_Object file_list; | ||
| 8693 | 8580 | ||
| 8694 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) | 8581 | if (GetFrontWindowOfClass (kMovableModalWindowClass, false)) |
| 8695 | return dragNotAcceptedErr; | 8582 | return dragNotAcceptedErr; |
| 8696 | 8583 | ||
| 8697 | drag_and_drop_file_list = Qnil; | 8584 | file_list = Qnil; |
| 8698 | GetDragMouse (theDrag, &mouse, 0L); | 8585 | GetDragMouse (theDrag, &mouse, 0L); |
| 8699 | CountDragItems (theDrag, &items); | 8586 | CountDragItems (theDrag, &items); |
| 8700 | for (index = 1; index <= items; index++) | 8587 | for (index = 1; index <= items; index++) |
| @@ -8720,15 +8607,14 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | |||
| 8720 | sizeof (unix_path_name) - 1) == noErr) | 8607 | sizeof (unix_path_name) - 1) == noErr) |
| 8721 | #endif | 8608 | #endif |
| 8722 | /* x-dnd functions expect undecoded filenames. */ | 8609 | /* x-dnd functions expect undecoded filenames. */ |
| 8723 | drag_and_drop_file_list = | 8610 | file_list = Fcons (make_unibyte_string (unix_path_name, |
| 8724 | Fcons (make_unibyte_string (unix_path_name, | 8611 | strlen (unix_path_name)), |
| 8725 | strlen (unix_path_name)), | 8612 | file_list); |
| 8726 | drag_and_drop_file_list); | ||
| 8727 | } | 8613 | } |
| 8728 | } | 8614 | } |
| 8729 | /* If there are items in the list, construct an event and post it to | 8615 | /* If there are items in the list, construct an event and post it to |
| 8730 | the queue like an interrupt using kbd_buffer_store_event. */ | 8616 | the queue like an interrupt using kbd_buffer_store_event. */ |
| 8731 | if (!NILP (drag_and_drop_file_list)) | 8617 | if (!NILP (file_list)) |
| 8732 | { | 8618 | { |
| 8733 | struct input_event event; | 8619 | struct input_event event; |
| 8734 | Lisp_Object frame; | 8620 | Lisp_Object frame; |
| @@ -8745,7 +8631,7 @@ mac_do_receive_drag (WindowPtr window, void *handlerRefCon, | |||
| 8745 | XSETINT (event.x, mouse.h); | 8631 | XSETINT (event.x, mouse.h); |
| 8746 | XSETINT (event.y, mouse.v); | 8632 | XSETINT (event.y, mouse.v); |
| 8747 | XSETFRAME (frame, f); | 8633 | XSETFRAME (frame, f); |
| 8748 | event.frame_or_window = Fcons (frame, drag_and_drop_file_list); | 8634 | event.frame_or_window = Fcons (frame, file_list); |
| 8749 | event.arg = Qnil; | 8635 | event.arg = Qnil; |
| 8750 | /* Post to the interrupt queue */ | 8636 | /* Post to the interrupt queue */ |
| 8751 | kbd_buffer_store_event (&event); | 8637 | kbd_buffer_store_event (&event); |
| @@ -9004,6 +8890,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9004 | { | 8890 | { |
| 9005 | int do_help = 0; | 8891 | int do_help = 0; |
| 9006 | struct frame *f; | 8892 | struct frame *f; |
| 8893 | unsigned long timestamp; | ||
| 9007 | 8894 | ||
| 9008 | /* It is necessary to set this (additional) argument slot of an | 8895 | /* It is necessary to set this (additional) argument slot of an |
| 9009 | event to nil because keyboard.c protects incompletely | 8896 | event to nil because keyboard.c protects incompletely |
| @@ -9014,6 +8901,12 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9014 | inev.arg = Qnil; | 8901 | inev.arg = Qnil; |
| 9015 | 8902 | ||
| 9016 | #if USE_CARBON_EVENTS | 8903 | #if USE_CARBON_EVENTS |
| 8904 | timestamp = GetEventTime (eventRef) / kEventDurationMillisecond; | ||
| 8905 | #else | ||
| 8906 | timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ | ||
| 8907 | #endif | ||
| 8908 | |||
| 8909 | #if USE_CARBON_EVENTS | ||
| 9017 | /* Handle new events */ | 8910 | /* Handle new events */ |
| 9018 | if (!mac_convert_event_ref (eventRef, &er)) | 8911 | if (!mac_convert_event_ref (eventRef, &er)) |
| 9019 | { | 8912 | { |
| @@ -9114,8 +9007,6 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9114 | #endif | 9007 | #endif |
| 9115 | XSETINT (inev.x, mouse_loc.h); | 9008 | XSETINT (inev.x, mouse_loc.h); |
| 9116 | XSETINT (inev.y, mouse_loc.v); | 9009 | XSETINT (inev.y, mouse_loc.v); |
| 9117 | inev.timestamp = er.when * (1000 / 60); | ||
| 9118 | /* ticks to milliseconds */ | ||
| 9119 | 9010 | ||
| 9120 | if (dpyinfo->grabbed && tracked_scroll_bar | 9011 | if (dpyinfo->grabbed && tracked_scroll_bar |
| 9121 | || ch != 0 | 9012 | || ch != 0 |
| @@ -9149,10 +9040,9 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9149 | &er, &inev); | 9040 | &er, &inev); |
| 9150 | else if (er.what == mouseDown) | 9041 | else if (er.what == mouseDown) |
| 9151 | x_scroll_bar_handle_press (bar, control_part_code, | 9042 | x_scroll_bar_handle_press (bar, control_part_code, |
| 9152 | inev.timestamp, &inev); | 9043 | &inev); |
| 9153 | else | 9044 | else |
| 9154 | x_scroll_bar_handle_release (bar, inev.timestamp, | 9045 | x_scroll_bar_handle_release (bar, &inev); |
| 9155 | &inev); | ||
| 9156 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 9046 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| 9157 | x_scroll_bar_handle_click (bar, control_part_code, | 9047 | x_scroll_bar_handle_click (bar, control_part_code, |
| 9158 | &er, &inev); | 9048 | &er, &inev); |
| @@ -9326,8 +9216,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9326 | if (dpyinfo->grabbed && tracked_scroll_bar) | 9216 | if (dpyinfo->grabbed && tracked_scroll_bar) |
| 9327 | #ifdef USE_TOOLKIT_SCROLL_BARS | 9217 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 9328 | x_scroll_bar_handle_drag (wp, tracked_scroll_bar, | 9218 | x_scroll_bar_handle_drag (wp, tracked_scroll_bar, |
| 9329 | mouse_pos, er.when * (1000 / 60), | 9219 | mouse_pos, &inev); |
| 9330 | &inev); | ||
| 9331 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 9220 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| 9332 | x_scroll_bar_note_movement (tracked_scroll_bar, | 9221 | x_scroll_bar_note_movement (tracked_scroll_bar, |
| 9333 | mouse_pos.v | 9222 | mouse_pos.v |
| @@ -9415,11 +9304,10 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9415 | 9304 | ||
| 9416 | EVENT_INIT (event); | 9305 | EVENT_INIT (event); |
| 9417 | event.kind = NO_EVENT; | 9306 | event.kind = NO_EVENT; |
| 9418 | x_scroll_bar_handle_release (tracked_scroll_bar, | 9307 | x_scroll_bar_handle_release (tracked_scroll_bar, &event); |
| 9419 | er.when * (1000 / 60), | ||
| 9420 | &event); | ||
| 9421 | if (event.kind != NO_EVENT) | 9308 | if (event.kind != NO_EVENT) |
| 9422 | { | 9309 | { |
| 9310 | event.timestamp = timestamp; | ||
| 9423 | kbd_buffer_store_event_hold (&event, hold_quit); | 9311 | kbd_buffer_store_event_hold (&event, hold_quit); |
| 9424 | count++; | 9312 | count++; |
| 9425 | } | 9313 | } |
| @@ -9495,6 +9383,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9495 | event.kind = LANGUAGE_CHANGE_EVENT; | 9383 | event.kind = LANGUAGE_CHANGE_EVENT; |
| 9496 | event.arg = Qnil; | 9384 | event.arg = Qnil; |
| 9497 | event.code = current_key_script; | 9385 | event.code = current_key_script; |
| 9386 | event.timestamp = timestamp; | ||
| 9498 | kbd_buffer_store_event (&event); | 9387 | kbd_buffer_store_event (&event); |
| 9499 | count++; | 9388 | count++; |
| 9500 | } | 9389 | } |
| @@ -9559,58 +9448,18 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9559 | #else | 9448 | #else |
| 9560 | inev.modifiers = mac_to_emacs_modifiers (er.modifiers); | 9449 | inev.modifiers = mac_to_emacs_modifiers (er.modifiers); |
| 9561 | #endif | 9450 | #endif |
| 9451 | inev.modifiers |= (extra_keyboard_modifiers | ||
| 9452 | & (meta_modifier | alt_modifier | ||
| 9453 | | hyper_modifier | super_modifier)); | ||
| 9562 | XSETFRAME (inev.frame_or_window, mac_focus_frame (dpyinfo)); | 9454 | XSETFRAME (inev.frame_or_window, mac_focus_frame (dpyinfo)); |
| 9563 | inev.timestamp = er.when * (1000 / 60); /* ticks to milliseconds */ | ||
| 9564 | break; | 9455 | break; |
| 9565 | 9456 | ||
| 9566 | case kHighLevelEvent: | 9457 | case kHighLevelEvent: |
| 9567 | drag_and_drop_file_list = Qnil; | 9458 | read_socket_inev = &inev; |
| 9568 | 9459 | AEProcessAppleEvent (&er); | |
| 9569 | AEProcessAppleEvent(&er); | 9460 | read_socket_inev = NULL; |
| 9570 | 9461 | break; | |
| 9571 | /* Build a DRAG_N_DROP_EVENT type event as is done in | ||
| 9572 | constuct_drag_n_drop in w32term.c. */ | ||
| 9573 | if (!NILP (drag_and_drop_file_list)) | ||
| 9574 | { | ||
| 9575 | struct frame *f = mac_focus_frame (dpyinfo); | ||
| 9576 | WindowPtr wp; | ||
| 9577 | Lisp_Object frame; | ||
| 9578 | |||
| 9579 | inev.kind = DRAG_N_DROP_EVENT; | ||
| 9580 | inev.code = 0; | ||
| 9581 | inev.timestamp = er.when * (1000 / 60); | ||
| 9582 | /* ticks to milliseconds */ | ||
| 9583 | #if USE_CARBON_EVENTS | ||
| 9584 | inev.modifiers = mac_event_to_emacs_modifiers (eventRef); | ||
| 9585 | #else | ||
| 9586 | inev.modifiers = mac_to_emacs_modifiers (er.modifiers); | ||
| 9587 | #endif | ||
| 9588 | |||
| 9589 | XSETINT (inev.x, 0); | ||
| 9590 | XSETINT (inev.y, 0); | ||
| 9591 | |||
| 9592 | XSETFRAME (frame, f); | ||
| 9593 | inev.frame_or_window = Fcons (frame, drag_and_drop_file_list); | ||
| 9594 | |||
| 9595 | #if 0 | ||
| 9596 | /* Regardless of whether Emacs was suspended or in the | ||
| 9597 | foreground, ask it to redraw its entire screen. | ||
| 9598 | Otherwise parts of the screen can be left in an | ||
| 9599 | inconsistent state. */ | ||
| 9600 | wp = FRAME_MAC_WINDOW (f); | ||
| 9601 | if (wp) | ||
| 9602 | #if TARGET_API_MAC_CARBON | ||
| 9603 | { | ||
| 9604 | Rect r; | ||
| 9605 | 9462 | ||
| 9606 | GetWindowPortBounds (wp, &r); | ||
| 9607 | InvalWindowRect (wp, &r); | ||
| 9608 | } | ||
| 9609 | #else /* not TARGET_API_MAC_CARBON */ | ||
| 9610 | InvalRect (&(wp->portRect)); | ||
| 9611 | #endif /* not TARGET_API_MAC_CARBON */ | ||
| 9612 | #endif | ||
| 9613 | } | ||
| 9614 | default: | 9463 | default: |
| 9615 | break; | 9464 | break; |
| 9616 | } | 9465 | } |
| @@ -9620,6 +9469,7 @@ XTread_socket (sd, expected, hold_quit) | |||
| 9620 | 9469 | ||
| 9621 | if (inev.kind != NO_EVENT) | 9470 | if (inev.kind != NO_EVENT) |
| 9622 | { | 9471 | { |
| 9472 | inev.timestamp = timestamp; | ||
| 9623 | kbd_buffer_store_event_hold (&inev, hold_quit); | 9473 | kbd_buffer_store_event_hold (&inev, hold_quit); |
| 9624 | count++; | 9474 | count++; |
| 9625 | } | 9475 | } |
| @@ -10092,7 +9942,7 @@ mac_check_for_quit_char () | |||
| 10092 | kbd_buffer_store_event (&e); | 9942 | kbd_buffer_store_event (&e); |
| 10093 | } | 9943 | } |
| 10094 | } | 9944 | } |
| 10095 | #endif /* MAC_OSX */ | 9945 | #endif /* MAC_OSX */ |
| 10096 | 9946 | ||
| 10097 | static void | 9947 | static void |
| 10098 | init_menu_bar () | 9948 | init_menu_bar () |
| @@ -10195,7 +10045,6 @@ mac_initialize () | |||
| 10195 | off the bottom */ | 10045 | off the bottom */ |
| 10196 | baud_rate = 19200; | 10046 | baud_rate = 19200; |
| 10197 | 10047 | ||
| 10198 | x_noop_count = 0; | ||
| 10199 | last_tool_bar_item = -1; | 10048 | last_tool_bar_item = -1; |
| 10200 | any_help_event_p = 0; | 10049 | any_help_event_p = 0; |
| 10201 | 10050 | ||
| @@ -10267,12 +10116,6 @@ syms_of_macterm () | |||
| 10267 | staticpro (&last_mouse_scroll_bar); | 10116 | staticpro (&last_mouse_scroll_bar); |
| 10268 | last_mouse_scroll_bar = Qnil; | 10117 | last_mouse_scroll_bar = Qnil; |
| 10269 | 10118 | ||
| 10270 | staticpro (&Qvendor_specific_keysyms); | ||
| 10271 | Qvendor_specific_keysyms = intern ("vendor-specific-keysyms"); | ||
| 10272 | |||
| 10273 | staticpro (&last_mouse_press_frame); | ||
| 10274 | last_mouse_press_frame = Qnil; | ||
| 10275 | |||
| 10276 | Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); | 10119 | Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); |
| 10277 | staticpro (&Qmac_ready_for_drag_n_drop); | 10120 | staticpro (&Qmac_ready_for_drag_n_drop); |
| 10278 | 10121 | ||
| @@ -10284,14 +10127,6 @@ syms_of_macterm () | |||
| 10284 | Vx_toolkit_scroll_bars = Qnil; | 10127 | Vx_toolkit_scroll_bars = Qnil; |
| 10285 | #endif | 10128 | #endif |
| 10286 | 10129 | ||
| 10287 | DEFVAR_BOOL ("x-use-underline-position-properties", | ||
| 10288 | &x_use_underline_position_properties, | ||
| 10289 | doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties. | ||
| 10290 | nil means ignore them. If you encounter fonts with bogus | ||
| 10291 | UNDERLINE_POSITION font properties, for example 7x13 on XFree prior | ||
| 10292 | to 4.1, set this to nil. */); | ||
| 10293 | x_use_underline_position_properties = 0; | ||
| 10294 | |||
| 10295 | staticpro (&last_mouse_motion_frame); | 10130 | staticpro (&last_mouse_motion_frame); |
| 10296 | last_mouse_motion_frame = Qnil; | 10131 | last_mouse_motion_frame = Qnil; |
| 10297 | 10132 | ||
diff --git a/src/window.c b/src/window.c index 941c0a00133..9ae9bbf55f4 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -1472,7 +1472,7 @@ delete_window (window) | |||
| 1472 | 1472 | ||
| 1473 | /* Check if we have a v/hchild with a v/hchild. In that case remove | 1473 | /* Check if we have a v/hchild with a v/hchild. In that case remove |
| 1474 | one of them. */ | 1474 | one of them. */ |
| 1475 | 1475 | ||
| 1476 | if (! NILP (par->vchild) && ! NILP (XWINDOW (par->vchild)->vchild)) | 1476 | if (! NILP (par->vchild) && ! NILP (XWINDOW (par->vchild)->vchild)) |
| 1477 | { | 1477 | { |
| 1478 | p = XWINDOW (par->vchild); | 1478 | p = XWINDOW (par->vchild); |
| @@ -5357,6 +5357,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5357 | { | 5357 | { |
| 5358 | arg = Fprefix_numeric_value (arg); | 5358 | arg = Fprefix_numeric_value (arg); |
| 5359 | CHECK_NUMBER (arg); | 5359 | CHECK_NUMBER (arg); |
| 5360 | iarg = XINT (arg); | ||
| 5360 | } | 5361 | } |
| 5361 | 5362 | ||
| 5362 | set_buffer_internal (buf); | 5363 | set_buffer_internal (buf); |
| @@ -5391,7 +5392,6 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5391 | int extra_line_spacing; | 5392 | int extra_line_spacing; |
| 5392 | int h = window_box_height (w); | 5393 | int h = window_box_height (w); |
| 5393 | 5394 | ||
| 5394 | iarg = XINT (arg); | ||
| 5395 | iarg = - max (-iarg, this_scroll_margin); | 5395 | iarg = - max (-iarg, this_scroll_margin); |
| 5396 | 5396 | ||
| 5397 | SET_TEXT_POS (pt, PT, PT_BYTE); | 5397 | SET_TEXT_POS (pt, PT, PT_BYTE); |
| @@ -5453,7 +5453,6 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5453 | { | 5453 | { |
| 5454 | struct position pos; | 5454 | struct position pos; |
| 5455 | 5455 | ||
| 5456 | iarg = XINT (arg); | ||
| 5457 | iarg = max (iarg, this_scroll_margin); | 5456 | iarg = max (iarg, this_scroll_margin); |
| 5458 | 5457 | ||
| 5459 | pos = *vmotion (PT, -iarg, w); | 5458 | pos = *vmotion (PT, -iarg, w); |
| @@ -5467,11 +5466,9 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5467 | int ht = window_internal_height (w); | 5466 | int ht = window_internal_height (w); |
| 5468 | 5467 | ||
| 5469 | if (center_p) | 5468 | if (center_p) |
| 5470 | iarg = make_number (ht / 2); | 5469 | iarg = ht / 2; |
| 5471 | else if (XINT (arg) < 0) | 5470 | else if (iarg < 0) |
| 5472 | iarg = XINT (arg) + ht; | 5471 | iarg += ht; |
| 5473 | else | ||
| 5474 | iarg = XINT (arg); | ||
| 5475 | 5472 | ||
| 5476 | /* Don't let it get into the margin at either top or bottom. */ | 5473 | /* Don't let it get into the margin at either top or bottom. */ |
| 5477 | iarg = max (iarg, this_scroll_margin); | 5474 | iarg = max (iarg, this_scroll_margin); |
diff --git a/src/xdisp.c b/src/xdisp.c index 122481a5ff0..d1229b3cb9f 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -2411,7 +2411,9 @@ start_display (it, w, pos) | |||
| 2411 | init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID); | 2411 | init_iterator (it, w, CHARPOS (pos), BYTEPOS (pos), row, DEFAULT_FACE_ID); |
| 2412 | it->first_vpos = first_vpos; | 2412 | it->first_vpos = first_vpos; |
| 2413 | 2413 | ||
| 2414 | if (!it->truncate_lines_p) | 2414 | /* Don't reseat to previous visible line start if current start |
| 2415 | position is in a string or image. */ | ||
| 2416 | if (it->method == GET_FROM_BUFFER && !it->truncate_lines_p) | ||
| 2415 | { | 2417 | { |
| 2416 | int start_at_line_beg_p; | 2418 | int start_at_line_beg_p; |
| 2417 | int first_y = it->current_y; | 2419 | int first_y = it->current_y; |
| @@ -6483,8 +6485,12 @@ move_it_vertically_backward (it, dy) | |||
| 6483 | y-distance. */ | 6485 | y-distance. */ |
| 6484 | it2 = *it; | 6486 | it2 = *it; |
| 6485 | it2.max_ascent = it2.max_descent = 0; | 6487 | it2.max_ascent = it2.max_descent = 0; |
| 6486 | move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1, | 6488 | do |
| 6487 | MOVE_TO_POS | MOVE_TO_VPOS); | 6489 | { |
| 6490 | move_it_to (&it2, start_pos, -1, -1, it2.vpos + 1, | ||
| 6491 | MOVE_TO_POS | MOVE_TO_VPOS); | ||
| 6492 | } | ||
| 6493 | while (it2.method != GET_FROM_BUFFER); | ||
| 6488 | xassert (IT_CHARPOS (*it) >= BEGV); | 6494 | xassert (IT_CHARPOS (*it) >= BEGV); |
| 6489 | it3 = it2; | 6495 | it3 = it2; |
| 6490 | 6496 | ||
| @@ -6682,21 +6688,45 @@ move_it_by_lines (it, dvpos, need_y_p) | |||
| 6682 | last_height = 0; | 6688 | last_height = 0; |
| 6683 | } | 6689 | } |
| 6684 | else if (dvpos > 0) | 6690 | else if (dvpos > 0) |
| 6685 | move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS); | 6691 | { |
| 6692 | move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS); | ||
| 6693 | if (it->method != GET_FROM_BUFFER) | ||
| 6694 | move_it_to (it, IT_CHARPOS (*it) + 1, -1, -1, -1, MOVE_TO_POS); | ||
| 6695 | } | ||
| 6686 | else | 6696 | else |
| 6687 | { | 6697 | { |
| 6688 | struct it it2; | 6698 | struct it it2; |
| 6689 | int start_charpos, i; | 6699 | int start_charpos, i; |
| 6690 | 6700 | ||
| 6691 | /* Start at the beginning of the screen line containing IT's | 6701 | /* Start at the beginning of the screen line containing IT's |
| 6692 | position. */ | 6702 | position. This may actually move vertically backwards, |
| 6703 | in case of overlays, so adjust dvpos accordingly. */ | ||
| 6704 | dvpos += it->vpos; | ||
| 6693 | move_it_vertically_backward (it, 0); | 6705 | move_it_vertically_backward (it, 0); |
| 6706 | dvpos -= it->vpos; | ||
| 6694 | 6707 | ||
| 6695 | /* Go back -DVPOS visible lines and reseat the iterator there. */ | 6708 | /* Go back -DVPOS visible lines and reseat the iterator there. */ |
| 6696 | start_charpos = IT_CHARPOS (*it); | 6709 | start_charpos = IT_CHARPOS (*it); |
| 6697 | for (i = -dvpos; i && IT_CHARPOS (*it) > BEGV; --i) | 6710 | for (i = -dvpos; i > 0 && IT_CHARPOS (*it) > BEGV; --i) |
| 6698 | back_to_previous_visible_line_start (it); | 6711 | back_to_previous_visible_line_start (it); |
| 6699 | reseat (it, it->current.pos, 1); | 6712 | reseat (it, it->current.pos, 1); |
| 6713 | |||
| 6714 | /* Move further back if we end up in a string or an image. */ | ||
| 6715 | while (it->method != GET_FROM_BUFFER) | ||
| 6716 | { | ||
| 6717 | /* First try to move to start of display line. */ | ||
| 6718 | dvpos += it->vpos; | ||
| 6719 | move_it_vertically_backward (it, 0); | ||
| 6720 | dvpos -= it->vpos; | ||
| 6721 | if (it->method == GET_FROM_BUFFER) | ||
| 6722 | break; | ||
| 6723 | /* If start of line is still in string or image, | ||
| 6724 | move further back. */ | ||
| 6725 | back_to_previous_visible_line_start (it); | ||
| 6726 | reseat (it, it->current.pos, 1); | ||
| 6727 | dvpos--; | ||
| 6728 | } | ||
| 6729 | |||
| 6700 | it->current_x = it->hpos = 0; | 6730 | it->current_x = it->hpos = 0; |
| 6701 | 6731 | ||
| 6702 | /* Above call may have moved too far if continuation lines | 6732 | /* Above call may have moved too far if continuation lines |
| @@ -11389,7 +11419,7 @@ cursor_row_fully_visible_p (w, force_p, current_matrix_p) | |||
| 11389 | window_height = window_box_height (w); | 11419 | window_height = window_box_height (w); |
| 11390 | if (row->height >= window_height) | 11420 | if (row->height >= window_height) |
| 11391 | { | 11421 | { |
| 11392 | if (!force_p || w->vscroll) | 11422 | if (!force_p || MINI_WINDOW_P (w) || w->vscroll) |
| 11393 | return 1; | 11423 | return 1; |
| 11394 | } | 11424 | } |
| 11395 | return 0; | 11425 | return 0; |
| @@ -11919,7 +11949,10 @@ try_cursor_movement (window, startp, scroll_step) | |||
| 11919 | while (!row->mode_line_p | 11949 | while (!row->mode_line_p |
| 11920 | && (MATRIX_ROW_START_CHARPOS (row) > PT | 11950 | && (MATRIX_ROW_START_CHARPOS (row) > PT |
| 11921 | || (MATRIX_ROW_START_CHARPOS (row) == PT | 11951 | || (MATRIX_ROW_START_CHARPOS (row) == PT |
| 11922 | && MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row))) | 11952 | && (MATRIX_ROW_STARTS_IN_MIDDLE_OF_CHAR_P (row) |
| 11953 | || (/* STARTS_IN_MIDDLE_OF_STRING_P (row) */ | ||
| 11954 | row > w->current_matrix->rows | ||
| 11955 | && (row-1)->ends_in_newline_from_string_p)))) | ||
| 11923 | && (row->y > top_scroll_margin | 11956 | && (row->y > top_scroll_margin |
| 11924 | || CHARPOS (startp) == BEGV)) | 11957 | || CHARPOS (startp) == BEGV)) |
| 11925 | { | 11958 | { |
| @@ -12824,7 +12857,8 @@ try_window (window, pos, check_margins) | |||
| 12824 | } | 12857 | } |
| 12825 | 12858 | ||
| 12826 | /* Don't let the cursor end in the scroll margins. */ | 12859 | /* Don't let the cursor end in the scroll margins. */ |
| 12827 | if (check_margins) | 12860 | if (check_margins |
| 12861 | && !MINI_WINDOW_P (w)) | ||
| 12828 | { | 12862 | { |
| 12829 | int this_scroll_margin, cursor_height; | 12863 | int this_scroll_margin, cursor_height; |
| 12830 | 12864 | ||
| @@ -15089,10 +15123,12 @@ cursor_row_p (w, row) | |||
| 15089 | if (PT == MATRIX_ROW_END_CHARPOS (row)) | 15123 | if (PT == MATRIX_ROW_END_CHARPOS (row)) |
| 15090 | { | 15124 | { |
| 15091 | /* If the row ends with a newline from a string, we don't want | 15125 | /* If the row ends with a newline from a string, we don't want |
| 15092 | the cursor there (if the row is continued it doesn't end in a | 15126 | the cursor there, but we still want it at the start of the |
| 15093 | newline). */ | 15127 | string if the string starts in this row. |
| 15128 | If the row is continued it doesn't end in a newline. */ | ||
| 15094 | if (CHARPOS (row->end.string_pos) >= 0) | 15129 | if (CHARPOS (row->end.string_pos) >= 0) |
| 15095 | cursor_row_p = row->continued_p; | 15130 | cursor_row_p = (row->continued_p |
| 15131 | || PT >= MATRIX_ROW_START_CHARPOS (row)); | ||
| 15096 | else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) | 15132 | else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) |
| 15097 | { | 15133 | { |
| 15098 | /* If the row ends in middle of a real character, | 15134 | /* If the row ends in middle of a real character, |
diff --git a/src/xfaces.c b/src/xfaces.c index 165a86a45fc..1e56955a03a 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -4805,7 +4805,12 @@ x_update_menu_appearance (f) | |||
| 4805 | const char *suffix = "List"; | 4805 | const char *suffix = "List"; |
| 4806 | Bool motif = True; | 4806 | Bool motif = True; |
| 4807 | #else | 4807 | #else |
| 4808 | #if defined HAVE_X_I18N | ||
| 4809 | |||
| 4810 | const char *suffix = "Set"; | ||
| 4811 | #else | ||
| 4808 | const char *suffix = ""; | 4812 | const char *suffix = ""; |
| 4813 | #endif | ||
| 4809 | Bool motif = False; | 4814 | Bool motif = False; |
| 4810 | #endif | 4815 | #endif |
| 4811 | #if defined HAVE_X_I18N | 4816 | #if defined HAVE_X_I18N |
diff --git a/src/xselect.c b/src/xselect.c index 13bc241053f..a424259416b 100644 --- a/src/xselect.c +++ b/src/xselect.c | |||
| @@ -2954,7 +2954,6 @@ A value of 0 means wait as long as necessary. This is initialized from the | |||
| 2954 | QTEXT = intern ("TEXT"); staticpro (&QTEXT); | 2954 | QTEXT = intern ("TEXT"); staticpro (&QTEXT); |
| 2955 | QCOMPOUND_TEXT = intern ("COMPOUND_TEXT"); staticpro (&QCOMPOUND_TEXT); | 2955 | QCOMPOUND_TEXT = intern ("COMPOUND_TEXT"); staticpro (&QCOMPOUND_TEXT); |
| 2956 | QUTF8_STRING = intern ("UTF8_STRING"); staticpro (&QUTF8_STRING); | 2956 | QUTF8_STRING = intern ("UTF8_STRING"); staticpro (&QUTF8_STRING); |
| 2957 | QTIMESTAMP = intern ("TIMESTAMP"); staticpro (&QTIMESTAMP); | ||
| 2958 | QDELETE = intern ("DELETE"); staticpro (&QDELETE); | 2957 | QDELETE = intern ("DELETE"); staticpro (&QDELETE); |
| 2959 | QMULTIPLE = intern ("MULTIPLE"); staticpro (&QMULTIPLE); | 2958 | QMULTIPLE = intern ("MULTIPLE"); staticpro (&QMULTIPLE); |
| 2960 | QINCR = intern ("INCR"); staticpro (&QINCR); | 2959 | QINCR = intern ("INCR"); staticpro (&QINCR); |