diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 147 | ||||
| -rw-r--r-- | src/Makefile.in | 4 | ||||
| -rw-r--r-- | src/alloc.c | 2 | ||||
| -rw-r--r-- | src/buffer.c | 48 | ||||
| -rw-r--r-- | src/buffer.h | 6 | ||||
| -rw-r--r-- | src/fringe.c | 435 | ||||
| -rw-r--r-- | src/gtkutil.c | 2 | ||||
| -rw-r--r-- | src/macmenu.c | 243 | ||||
| -rw-r--r-- | src/macterm.c | 324 | ||||
| -rw-r--r-- | src/puresize.h | 2 | ||||
| -rw-r--r-- | src/regex.c | 45 | ||||
| -rw-r--r-- | src/vm-limit.c | 19 | ||||
| -rw-r--r-- | src/window.c | 10 | ||||
| -rw-r--r-- | src/xdisp.c | 22 | ||||
| -rw-r--r-- | src/xfns.c | 10 | ||||
| -rw-r--r-- | src/xmenu.c | 5 | ||||
| -rw-r--r-- | src/xterm.c | 2 |
17 files changed, 911 insertions, 415 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 1276e2498ef..2547e146e46 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,150 @@ | |||
| 1 | 2006-02-22 Kim F. Storm <storm@cua.dk> | ||
| 2 | |||
| 3 | * fringe.c (draw_fringe_bitmap): Fix overlay-arrow display. | ||
| 4 | |||
| 5 | 2006-02-21 Kim F. Storm <storm@cua.dk> | ||
| 6 | |||
| 7 | * fringe.c (syms_of_fringe) <fringe-bitmaps>: Doc fix. | ||
| 8 | |||
| 9 | 2006-02-21 Zhang Wei <brep@newsmth.org> | ||
| 10 | |||
| 11 | * xfns.c (Fx_file_dialog, Motif and GTK): DECODE_FILE before | ||
| 12 | returning it. | ||
| 13 | |||
| 14 | 2006-02-21 Giorgos Keramidas <keramida@ceid.upatras.gr> (tiny change) | ||
| 15 | |||
| 16 | * fringe.c (horizontal_bar_bits): Rename from `horisontal_bar_bits'. | ||
| 17 | (standard_bitmaps): Use it. | ||
| 18 | |||
| 19 | 2006-02-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 20 | |||
| 21 | * macterm.c (mac_draw_string_common): Remove arg MODE. New arg | ||
| 22 | BG_WIDTH. All uses changed. Draw background if BG_WIDTH is not zero. | ||
| 23 | (mac_draw_image_string, mac_draw_image_string_16): New arg BG_WIDTH. | ||
| 24 | [USE_CG_TEXT_DRAWING] (mac_draw_image_string_cg): Rename from | ||
| 25 | mac_draw_string_cg. New arg BG_WIDTH. All uses changed. Draw | ||
| 26 | background if BG_WIDTH is not zero. Use float constants as | ||
| 27 | divisors instead of double. Use alloca instead of xmalloc/xfree. | ||
| 28 | (x_draw_glyph_string_background, x_draw_glyph_string_foreground) | ||
| 29 | [!MAC_OS8 || USE_ATSUI]: Background may be drawn using | ||
| 30 | mac_draw_image_string* functions. | ||
| 31 | (XLoadQueryFont) [MAC_OS8 && USE_ATSUI]: Don't adjust heights of | ||
| 32 | some fonts when srcCopy text transfer mode might be used. | ||
| 33 | (mac_begin_clip, mac_end_clip): Check if region is empty. | ||
| 34 | (mac_set_clip_rectangles): When resetting clip region, make it | ||
| 35 | empty instead of disposing of it. | ||
| 36 | |||
| 37 | 2006-02-20 Kim F. Storm <storm@cua.dk> | ||
| 38 | |||
| 39 | * Makefile.in: Add fringe.elc to WINDOW_SUPPORT. | ||
| 40 | |||
| 41 | * buffer.h (struct buffer): New members fringe_indicator_alist and | ||
| 42 | fringe_cursor_alist. | ||
| 43 | |||
| 44 | * buffer.c (init_buffer_once): Set dummy default values for | ||
| 45 | fringe-indicator-alist and fringe-cursor-alist. The proper | ||
| 46 | default values are set by pre-loading fringe.el. | ||
| 47 | (syms_of_buffer): defvar_per_buffer new fringe-indicator-alist and | ||
| 48 | fringe-cursor-alist buffer-local variables and defvar_lisp_nopro | ||
| 49 | corresponding default- variables. | ||
| 50 | |||
| 51 | * fringe.c (enum fringe_bitmap_type): Remove. Change all uses | ||
| 52 | to use `int'. | ||
| 53 | (NO_FRINGE_BITMAP, UNDEF_FRINGE_BITMAP, MAX_STANDARD_FRINGE_BITMAPS): | ||
| 54 | Define explicitly. | ||
| 55 | (Qtruncation, Qcontinuation, Qempty_line, Qtop_bottom) | ||
| 56 | (Qhollow_small): New variables. | ||
| 57 | (syms_of_fringe): Intern and staticpro them. | ||
| 58 | (question_mark_bits): Rename from unknown_bits. | ||
| 59 | (left_curly_arrow_bits): Rename from continuation_bits. | ||
| 60 | (right_curly_arrow_bits): Rename from continued_bits. | ||
| 61 | (left_triangle_bits): Rename from ov_bits. | ||
| 62 | (right_triangle_bits): Added. | ||
| 63 | (filled_rectangle_bits): Rename from filled_box_cursor_bits. | ||
| 64 | (hollow_rectangle_bits): Rename from hollow_box_cursor_bits. | ||
| 65 | (filled_square_bits): Added. | ||
| 66 | (vertical_bar_bits): Rename from bar_cursor_bits. | ||
| 67 | (horizontal_bar_bits): Rename from hbar_cursor_bits. | ||
| 68 | (empty_line_bits): Rename from zv_bits. | ||
| 69 | (standard_bitmaps): Update to use new names. | ||
| 70 | (draw_fringe_bitmap_1): Make static. | ||
| 71 | (get_logical_cursor_bitmap, get_logical_fringe_bitmap): New functions | ||
| 72 | to map from logical cursors and indicators to physical bitmaps. | ||
| 73 | (draw_fringe_bitmap): Resolve fringe cursor and overlay-arrow | ||
| 74 | bitmaps using symbol names instead of bitmap numbers. | ||
| 75 | (update_window_fringes): Use logical indicator symbol names | ||
| 76 | instead of bitmap numbers for logical. Add bitmap cache. | ||
| 77 | (LEFT_FRINGE, RIGHT_FRINGE): New helper macros. | ||
| 78 | |||
| 79 | 2006-02-20 Chong Yidong <cyd@stupidchicken.com> | ||
| 80 | |||
| 81 | * regex.c: Revert 2006-02-19 change. | ||
| 82 | (xmalloc, xrealloc): Define these when not linked to Emacs. | ||
| 83 | Redefine malloc -> xmalloc, realloc -> xrealloc as in Emacs case. | ||
| 84 | |||
| 85 | 2006-02-19 Luc Teirlinck <teirllm@auburn.edu> | ||
| 86 | |||
| 87 | * regex.c (extend_range_table_work_area): Fix typo. | ||
| 88 | |||
| 89 | 2006-02-19 Richard M. Stallman <rms@gnu.org> | ||
| 90 | |||
| 91 | * xterm.c (x_catch_errors): Use xmalloc. | ||
| 92 | |||
| 93 | * regex.c (extend_range_table_work_area): Call xmalloc and xrealloc. | ||
| 94 | (regex_compile): Likewise. | ||
| 95 | (regcomp): Use xmalloc. | ||
| 96 | |||
| 97 | * gtkutil.c (malloc_widget_value): Use xmalloc. | ||
| 98 | |||
| 99 | * vm-limit.c [HAVE_GETRLIMIT]: Include sys/resource.h. | ||
| 100 | (check_memory_limits) [HAVE_GETRLIMIT]: Use getrlimit. | ||
| 101 | |||
| 102 | * xmenu.c (digest_single_submenu): When pane_string is empty, | ||
| 103 | do initialize save_wv. | ||
| 104 | |||
| 105 | 2006-02-19 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | ||
| 106 | |||
| 107 | * xdisp.c (update_menu_bar) [MAC_OS]: Don't set | ||
| 108 | w->update_mode_line if arg F is not the selected frame. | ||
| 109 | |||
| 110 | * macmenu.c (popup_activated_flag, submenu_id) | ||
| 111 | (next_menubar_widget_id): Remove variables. | ||
| 112 | (initialize_frame_menubar): Remove function. | ||
| 113 | (pop_down_menu, mac_menu_show): Simplify save value. | ||
| 114 | (dispose_menus): New function. | ||
| 115 | (pop_down_menu, fill_menubar): Use it. | ||
| 116 | (fill_submenu): Remove function. All uses changed to fill_menu. | ||
| 117 | (add_menu_item): Remove args SUBMENU and FORCE_DISABLE. New arg | ||
| 118 | POS. Don't call SetMenuItemHierarchicalID here. | ||
| 119 | (fill_menu): Add arg SUBMENU_ID. Return submenu_id that is to be | ||
| 120 | used next. Call SetMenuItemHierarchicalID here. | ||
| 121 | (fill_menubar): Add arg DEEP_P. All uses changed. Clean up menu | ||
| 122 | objects if needed. Reuse existing menu bar titles if possible. | ||
| 123 | (set_frame_menubar): Don't clean up menu objects here. | ||
| 124 | |||
| 125 | 2006-02-18 Chong Yidong <cyd@stupidchicken.com> | ||
| 126 | |||
| 127 | * window.c (window_min_size_1): Ensure room for the scroll bar and | ||
| 128 | fringes. | ||
| 129 | |||
| 130 | 2006-02-17 Romain Francoise <romain@orebokech.com> | ||
| 131 | |||
| 132 | * puresize.h (BASE_PURESIZE): Increment to 1200000. | ||
| 133 | |||
| 134 | 2006-02-17 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 135 | |||
| 136 | * alloc.c (Fmake_symbol): Comment-out left-over assert from before the | ||
| 137 | addition of the BLOCK_INPUTs. | ||
| 138 | |||
| 139 | 2006-02-17 Juanma Barranquero <lekktu@gmail.com> | ||
| 140 | |||
| 141 | * window.c (Fset_window_scroll_bars): Doc fix. | ||
| 142 | |||
| 143 | 2006-02-17 Kenichi Handa <handa@m17n.org> | ||
| 144 | |||
| 145 | * xdisp.c (display_mode_element): Call display_string with correct | ||
| 146 | PREC arg (which must be a number of characters, not column width). | ||
| 147 | |||
| 1 | 2006-02-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> | 148 | 2006-02-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> |
| 2 | 149 | ||
| 3 | * frame.c (x_get_arg): Clear out PARAM in ALIST also on Mac. | 150 | * frame.c (x_get_arg): Clear out PARAM in ALIST also on Mac. |
diff --git a/src/Makefile.in b/src/Makefile.in index 3be09cac3ea..16a85dfe191 100644 --- a/src/Makefile.in +++ b/src/Makefile.in | |||
| @@ -679,11 +679,11 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(allocaobj) $(widgetobj) $(LIBO | |||
| 679 | 679 | ||
| 680 | #ifdef HAVE_WINDOW_SYSTEM | 680 | #ifdef HAVE_WINDOW_SYSTEM |
| 681 | #ifdef HAVE_X_WINDOWS | 681 | #ifdef HAVE_X_WINDOWS |
| 682 | #define WINDOW_SUPPORT ${lispsource}image.elc \ | 682 | #define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \ |
| 683 | ${lispsource}international/fontset.elc ${lispsource}dnd.elc \ | 683 | ${lispsource}international/fontset.elc ${lispsource}dnd.elc \ |
| 684 | ${lispsource}tool-bar.elc ${lispsource}mwheel.elc ${lispsource}x-dnd.elc | 684 | ${lispsource}tool-bar.elc ${lispsource}mwheel.elc ${lispsource}x-dnd.elc |
| 685 | #else | 685 | #else |
| 686 | #define WINDOW_SUPPORT ${lispsource}image.elc \ | 686 | #define WINDOW_SUPPORT ${lispsource}fringe.elc ${lispsource}image.elc \ |
| 687 | ${lispsource}international/fontset.elc ${lispsource}dnd.elc \ | 687 | ${lispsource}international/fontset.elc ${lispsource}dnd.elc \ |
| 688 | ${lispsource}tool-bar.elc ${lispsource}mwheel.elc | 688 | ${lispsource}tool-bar.elc ${lispsource}mwheel.elc |
| 689 | #endif | 689 | #endif |
diff --git a/src/alloc.c b/src/alloc.c index 04efb708665..ea52c98fd24 100644 --- a/src/alloc.c +++ b/src/alloc.c | |||
| @@ -3166,7 +3166,7 @@ Its value and function definition are void, and its property list is nil. */) | |||
| 3166 | 3166 | ||
| 3167 | CHECK_STRING (name); | 3167 | CHECK_STRING (name); |
| 3168 | 3168 | ||
| 3169 | eassert (!handling_signal); | 3169 | /* eassert (!handling_signal); */ |
| 3170 | 3170 | ||
| 3171 | #ifndef SYNC_INPUT | 3171 | #ifndef SYNC_INPUT |
| 3172 | BLOCK_INPUT; | 3172 | BLOCK_INPUT; |
diff --git a/src/buffer.c b/src/buffer.c index 4dce7c40686..e6f93726f5a 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -5009,6 +5009,8 @@ init_buffer_once () | |||
| 5009 | buffer_defaults.vertical_scroll_bar_type = Qt; | 5009 | buffer_defaults.vertical_scroll_bar_type = Qt; |
| 5010 | buffer_defaults.indicate_empty_lines = Qnil; | 5010 | buffer_defaults.indicate_empty_lines = Qnil; |
| 5011 | buffer_defaults.indicate_buffer_boundaries = Qnil; | 5011 | buffer_defaults.indicate_buffer_boundaries = Qnil; |
| 5012 | buffer_defaults.fringe_indicator_alist = Qnil; | ||
| 5013 | buffer_defaults.fringe_cursor_alist = Qnil; | ||
| 5012 | buffer_defaults.scroll_up_aggressively = Qnil; | 5014 | buffer_defaults.scroll_up_aggressively = Qnil; |
| 5013 | buffer_defaults.scroll_down_aggressively = Qnil; | 5015 | buffer_defaults.scroll_down_aggressively = Qnil; |
| 5014 | buffer_defaults.display_time = Qnil; | 5016 | buffer_defaults.display_time = Qnil; |
| @@ -5080,6 +5082,8 @@ init_buffer_once () | |||
| 5080 | XSETFASTINT (buffer_local_flags.vertical_scroll_bar_type, idx); ++idx; | 5082 | XSETFASTINT (buffer_local_flags.vertical_scroll_bar_type, idx); ++idx; |
| 5081 | XSETFASTINT (buffer_local_flags.indicate_empty_lines, idx); ++idx; | 5083 | XSETFASTINT (buffer_local_flags.indicate_empty_lines, idx); ++idx; |
| 5082 | XSETFASTINT (buffer_local_flags.indicate_buffer_boundaries, idx); ++idx; | 5084 | XSETFASTINT (buffer_local_flags.indicate_buffer_boundaries, idx); ++idx; |
| 5085 | XSETFASTINT (buffer_local_flags.fringe_indicator_alist, idx); ++idx; | ||
| 5086 | XSETFASTINT (buffer_local_flags.fringe_cursor_alist, idx); ++idx; | ||
| 5083 | XSETFASTINT (buffer_local_flags.scroll_up_aggressively, idx); ++idx; | 5087 | XSETFASTINT (buffer_local_flags.scroll_up_aggressively, idx); ++idx; |
| 5084 | XSETFASTINT (buffer_local_flags.scroll_down_aggressively, idx); ++idx; | 5088 | XSETFASTINT (buffer_local_flags.scroll_down_aggressively, idx); ++idx; |
| 5085 | XSETFASTINT (buffer_local_flags.header_line_format, idx); ++idx; | 5089 | XSETFASTINT (buffer_local_flags.header_line_format, idx); ++idx; |
| @@ -5373,6 +5377,16 @@ This is the same as (default-value 'indicate-empty-lines). */); | |||
| 5373 | doc: /* Default value of `indicate-buffer-boundaries' for buffers that don't override it. | 5377 | doc: /* Default value of `indicate-buffer-boundaries' for buffers that don't override it. |
| 5374 | This is the same as (default-value 'indicate-buffer-boundaries). */); | 5378 | This is the same as (default-value 'indicate-buffer-boundaries). */); |
| 5375 | 5379 | ||
| 5380 | DEFVAR_LISP_NOPRO ("default-fringe-indicator-alist", | ||
| 5381 | &buffer_defaults.fringe_indicator_alist, | ||
| 5382 | doc: /* Default value of `fringe-indicator-alist' for buffers that don't override it. | ||
| 5383 | This is the same as (default-value 'fringe-indicator-alist'). */); | ||
| 5384 | |||
| 5385 | DEFVAR_LISP_NOPRO ("default-fringe-cursor-alist", | ||
| 5386 | &buffer_defaults.fringe_cursor_alist, | ||
| 5387 | doc: /* Default value of `fringe-cursor-alist' for buffers that don't override it. | ||
| 5388 | This is the same as (default-value 'fringe-cursor-alist'). */); | ||
| 5389 | |||
| 5376 | DEFVAR_LISP_NOPRO ("default-scroll-up-aggressively", | 5390 | DEFVAR_LISP_NOPRO ("default-scroll-up-aggressively", |
| 5377 | &buffer_defaults.scroll_up_aggressively, | 5391 | &buffer_defaults.scroll_up_aggressively, |
| 5378 | doc: /* Default value of `scroll-up-aggressively'. | 5392 | doc: /* Default value of `scroll-up-aggressively'. |
| @@ -5718,6 +5732,40 @@ left fringe, the bottom angle bitmap in right fringe, and both arrow | |||
| 5718 | bitmaps in right fringe. To show just the angle bitmaps in the left | 5732 | bitmaps in right fringe. To show just the angle bitmaps in the left |
| 5719 | fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); | 5733 | fringe, but no arrow bitmaps, use ((top . left) (bottom . left)). */); |
| 5720 | 5734 | ||
| 5735 | DEFVAR_PER_BUFFER ("fringe-indicator-alist", | ||
| 5736 | ¤t_buffer->fringe_indicator_alist, Qnil, | ||
| 5737 | doc: /* *Mapping from logical to physical fringe indicator bitmaps. | ||
| 5738 | The value is an alist where each element (INDICATOR . BITMAPS) | ||
| 5739 | specifies the fringe bitmaps used to display a specific logical | ||
| 5740 | fringe indicator. | ||
| 5741 | |||
| 5742 | INDICATOR specifies the logical indicator type which is one of the | ||
| 5743 | following symbols: `truncation' , `continuation', `overlay-arrow', | ||
| 5744 | `top', `bottom', `up', `down', `one-line', `empty-line', or `unknown'. | ||
| 5745 | |||
| 5746 | BITMAPS is list of symbols (LEFT RIGHT [LEFT1 RIGHT1]) which specifies | ||
| 5747 | the actual bitmap shown in the left or right fringe for the logical | ||
| 5748 | indicator. LEFT and RIGHT are the bitmaps shown in the left and/or | ||
| 5749 | right fringe for the specific indicator. The LEFT1 or RIGHT1 bitmaps | ||
| 5750 | are used only for the `bottom' and `one-line' indicators when the last | ||
| 5751 | (only) line in has no final newline. BITMAPS may also be a single | ||
| 5752 | symbol which is used in both left and right fringes. */); | ||
| 5753 | |||
| 5754 | DEFVAR_PER_BUFFER ("fringe-cursor-alist", | ||
| 5755 | ¤t_buffer->fringe_cursor_alist, Qnil, | ||
| 5756 | doc: /* *Mapping from logical to physical fringe cursor bitmaps. | ||
| 5757 | The value is an alist where each element (CURSOR . BITMAP) | ||
| 5758 | specifies the fringe bitmaps used to display a specific logical | ||
| 5759 | cursor type in the fringe. | ||
| 5760 | |||
| 5761 | CURSOR specifies the logical cursor type which is one of the following | ||
| 5762 | symbols: `box' , `hollow', `bar', `hbar', or `hollow-small'. The last | ||
| 5763 | one is used to show a hollow cursor on narrow lines display lines | ||
| 5764 | where the normal hollow cursor will not fit. | ||
| 5765 | |||
| 5766 | BITMAP is the corresponding fringe bitmap shown for the logical | ||
| 5767 | cursor type. */); | ||
| 5768 | |||
| 5721 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", | 5769 | DEFVAR_PER_BUFFER ("scroll-up-aggressively", |
| 5722 | ¤t_buffer->scroll_up_aggressively, Qnil, | 5770 | ¤t_buffer->scroll_up_aggressively, Qnil, |
| 5723 | doc: /* How far to scroll windows upward. | 5771 | doc: /* How far to scroll windows upward. |
diff --git a/src/buffer.h b/src/buffer.h index a82f9578ff9..8015b2be15c 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -743,6 +743,12 @@ struct buffer | |||
| 743 | /* Non-nil means indicate buffer boundaries and scrolling. */ | 743 | /* Non-nil means indicate buffer boundaries and scrolling. */ |
| 744 | Lisp_Object indicate_buffer_boundaries; | 744 | Lisp_Object indicate_buffer_boundaries; |
| 745 | 745 | ||
| 746 | /* Logical to physical fringe bitmap mappings. */ | ||
| 747 | Lisp_Object fringe_indicator_alist; | ||
| 748 | |||
| 749 | /* Logical to physical cursor bitmap mappings. */ | ||
| 750 | Lisp_Object fringe_cursor_alist; | ||
| 751 | |||
| 746 | /* Time stamp updated each time this buffer is displayed in a window. */ | 752 | /* Time stamp updated each time this buffer is displayed in a window. */ |
| 747 | Lisp_Object display_time; | 753 | Lisp_Object display_time; |
| 748 | 754 | ||
diff --git a/src/fringe.c b/src/fringe.c index bbb35b305ca..1a045d7034e 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -49,31 +49,45 @@ Lisp_Object Voverflow_newline_into_fringe; | |||
| 49 | 49 | ||
| 50 | Lisp_Object Vfringe_bitmaps; | 50 | Lisp_Object Vfringe_bitmaps; |
| 51 | 51 | ||
| 52 | enum fringe_bitmap_type | 52 | /* Fringe bitmaps are represented in three different ways: |
| 53 | { | 53 | |
| 54 | NO_FRINGE_BITMAP = 0, | 54 | Logical bitmaps are used internally to denote things like |
| 55 | UNDEF_FRINGE_BITMAP, | 55 | 'end-of-buffer', 'left-truncation', 'overlay-arrow', etc. |
| 56 | LEFT_TRUNCATION_BITMAP, | 56 | |
| 57 | RIGHT_TRUNCATION_BITMAP, | 57 | Physical bitmaps specify the visual appearence of the bitmap, |
| 58 | UP_ARROW_BITMAP, | 58 | e.g. 'bottom-left-angle', 'left-arrow', 'left-triangle', etc. |
| 59 | DOWN_ARROW_BITMAP, | 59 | User defined bitmaps are physical bitmaps. |
| 60 | CONTINUED_LINE_BITMAP, | 60 | |
| 61 | CONTINUATION_LINE_BITMAP, | 61 | Internally, fringe bitmaps for a specific display row are |
| 62 | OVERLAY_ARROW_BITMAP, | 62 | represented as a simple integer that is used as an index |
| 63 | TOP_LEFT_ANGLE_BITMAP, | 63 | into the table of all defined bitmaps. This index is stored |
| 64 | TOP_RIGHT_ANGLE_BITMAP, | 64 | in the `fringe' property of the physical bitmap symbol. |
| 65 | BOTTOM_LEFT_ANGLE_BITMAP, | 65 | |
| 66 | BOTTOM_RIGHT_ANGLE_BITMAP, | 66 | Logical bitmaps are mapped to physical bitmaps through the |
| 67 | LEFT_BRACKET_BITMAP, | 67 | buffer-local `fringe-indicator-alist' variable. |
| 68 | RIGHT_BRACKET_BITMAP, | 68 | |
| 69 | FILLED_BOX_CURSOR_BITMAP, | 69 | Each element of this alist is a cons (LOGICAL . PHYSICAL) |
| 70 | HOLLOW_BOX_CURSOR_BITMAP, | 70 | mapping a logical bitmap to a physical bitmap. |
| 71 | HOLLOW_SQUARE_BITMAP, | 71 | PHYSICAL is either a symbol to use in both left and right fringe, |
| 72 | BAR_CURSOR_BITMAP, | 72 | or a cons of two symbols (LEFT . RIGHT) denoting different |
| 73 | HBAR_CURSOR_BITMAP, | 73 | bitmaps to use in left and right fringe. |
| 74 | ZV_LINE_BITMAP, | 74 | |
| 75 | MAX_STANDARD_FRINGE_BITMAPS | 75 | LOGICAL is first looked up in the window's buffer's buffer-local |
| 76 | }; | 76 | value of the fringe-indicator-alist variable, and if not present, |
| 77 | in the global value of fringe-indicator-alist. | ||
| 78 | |||
| 79 | If LOGICAL is not present in either alist, or the PHYSICAL value | ||
| 80 | found is nil, no bitmap is shown for the logical bitmap. | ||
| 81 | |||
| 82 | The `left-fringe' and `right-fringe' display properties | ||
| 83 | must specify physical bitmap symbols. | ||
| 84 | */ | ||
| 85 | |||
| 86 | extern Lisp_Object Qunknown; | ||
| 87 | Lisp_Object Qtruncation, Qcontinuation, Qoverlay_arrow; | ||
| 88 | Lisp_Object Qempty_line, Qtop_bottom; | ||
| 89 | extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow; | ||
| 90 | Lisp_Object Qhollow_small; | ||
| 77 | 91 | ||
| 78 | enum fringe_bitmap_align | 92 | enum fringe_bitmap_align |
| 79 | { | 93 | { |
| @@ -110,7 +124,7 @@ struct fringe_bitmap | |||
| 110 | ...xx... | 124 | ...xx... |
| 111 | ...xx... | 125 | ...xx... |
| 112 | */ | 126 | */ |
| 113 | static unsigned short unknown_bits[] = { | 127 | static unsigned short question_mark_bits[] = { |
| 114 | 0x3c, 0x7e, 0x7e, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18}; | 128 | 0x3c, 0x7e, 0x7e, 0x0c, 0x18, 0x18, 0x00, 0x18, 0x18}; |
| 115 | 129 | ||
| 116 | /* An arrow like this: `<-'. */ | 130 | /* An arrow like this: `<-'. */ |
| @@ -172,20 +186,6 @@ static unsigned short up_arrow_bits[] = { | |||
| 172 | static unsigned short down_arrow_bits[] = { | 186 | static unsigned short down_arrow_bits[] = { |
| 173 | 0x18, 0x18, 0x18, 0x18, 0xff, 0x7e, 0x3c, 0x18}; | 187 | 0x18, 0x18, 0x18, 0x18, 0xff, 0x7e, 0x3c, 0x18}; |
| 174 | 188 | ||
| 175 | /* Marker for continued lines. */ | ||
| 176 | /* | ||
| 177 | ..xxxx.. | ||
| 178 | ..xxxxx. | ||
| 179 | ......xx | ||
| 180 | ..x..xxx | ||
| 181 | ..xxxxxx | ||
| 182 | ..xxxxx. | ||
| 183 | ..xxxx.. | ||
| 184 | ..xxxxx. | ||
| 185 | */ | ||
| 186 | static unsigned short continued_bits[] = { | ||
| 187 | 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e}; | ||
| 188 | |||
| 189 | /* Marker for continuation lines. */ | 189 | /* Marker for continuation lines. */ |
| 190 | /* | 190 | /* |
| 191 | ..xxxx.. | 191 | ..xxxx.. |
| @@ -197,24 +197,23 @@ static unsigned short continued_bits[] = { | |||
| 197 | ..xxxx.. | 197 | ..xxxx.. |
| 198 | .xxxxx.. | 198 | .xxxxx.. |
| 199 | */ | 199 | */ |
| 200 | static unsigned short continuation_bits[] = { | 200 | static unsigned short left_curly_arrow_bits[] = { |
| 201 | 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c}; | 201 | 0x3c, 0x7c, 0xc0, 0xe4, 0xfc, 0x7c, 0x3c, 0x7c}; |
| 202 | 202 | ||
| 203 | /* Overlay arrow bitmap. A triangular arrow. */ | 203 | /* Marker for continued lines. */ |
| 204 | /* | 204 | /* |
| 205 | xx...... | 205 | ..xxxx.. |
| 206 | xxxx.... | 206 | ..xxxxx. |
| 207 | xxxxx... | 207 | ......xx |
| 208 | xxxxxx.. | 208 | ..x..xxx |
| 209 | xxxxxx.. | 209 | ..xxxxxx |
| 210 | xxxxx... | 210 | ..xxxxx. |
| 211 | xxxx.... | 211 | ..xxxx.. |
| 212 | xx...... | 212 | ..xxxxx. |
| 213 | */ | 213 | */ |
| 214 | static unsigned short ov_bits[] = { | 214 | static unsigned short right_curly_arrow_bits[] = { |
| 215 | 0xc0, 0xf0, 0xf8, 0xfc, 0xfc, 0xf8, 0xf0, 0xc0}; | 215 | 0x3c, 0x3e, 0x03, 0x27, 0x3f, 0x3e, 0x3c, 0x3e}; |
| 216 | 216 | ||
| 217 | #if 0 | ||
| 218 | /* Reverse Overlay arrow bitmap. A triangular arrow. */ | 217 | /* Reverse Overlay arrow bitmap. A triangular arrow. */ |
| 219 | /* | 218 | /* |
| 220 | ......xx | 219 | ......xx |
| @@ -226,9 +225,22 @@ static unsigned short ov_bits[] = { | |||
| 226 | ....xxxx | 225 | ....xxxx |
| 227 | ......xx | 226 | ......xx |
| 228 | */ | 227 | */ |
| 229 | static unsigned short rev_ov_bits[] = { | 228 | static unsigned short left_triangle_bits[] = { |
| 230 | 0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03}; | 229 | 0x03, 0x0f, 0x1f, 0x3f, 0x3f, 0x1f, 0x0f, 0x03}; |
| 231 | #endif | 230 | |
| 231 | /* Overlay arrow bitmap. A triangular arrow. */ | ||
| 232 | /* | ||
| 233 | xx...... | ||
| 234 | xxxx.... | ||
| 235 | xxxxx... | ||
| 236 | xxxxxx.. | ||
| 237 | xxxxxx.. | ||
| 238 | xxxxx... | ||
| 239 | xxxx.... | ||
| 240 | xx...... | ||
| 241 | */ | ||
| 242 | static unsigned short right_triangle_bits[] = { | ||
| 243 | 0xc0, 0xf0, 0xf8, 0xfc, 0xfc, 0xf8, 0xf0, 0xc0}; | ||
| 232 | 244 | ||
| 233 | /* First line bitmap. An top-left angle. */ | 245 | /* First line bitmap. An top-left angle. */ |
| 234 | /* | 246 | /* |
| @@ -334,7 +346,7 @@ static unsigned short right_bracket_bits[] = { | |||
| 334 | xxxxxxx. | 346 | xxxxxxx. |
| 335 | xxxxxxx. | 347 | xxxxxxx. |
| 336 | */ | 348 | */ |
| 337 | static unsigned short filled_box_cursor_bits[] = { | 349 | static unsigned short filled_rectangle_bits[] = { |
| 338 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; | 350 | 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe, 0xfe}; |
| 339 | 351 | ||
| 340 | /* Hollow box cursor bitmap. A hollow box; max 13 pixels high. */ | 352 | /* Hollow box cursor bitmap. A hollow box; max 13 pixels high. */ |
| @@ -353,9 +365,33 @@ static unsigned short filled_box_cursor_bits[] = { | |||
| 353 | x.....x. | 365 | x.....x. |
| 354 | xxxxxxx. | 366 | xxxxxxx. |
| 355 | */ | 367 | */ |
| 356 | static unsigned short hollow_box_cursor_bits[] = { | 368 | static unsigned short hollow_rectangle_bits[] = { |
| 357 | 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe}; | 369 | 0xfe, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0xfe}; |
| 358 | 370 | ||
| 371 | /* Hollow square bitmap. */ | ||
| 372 | /* | ||
| 373 | .xxxxxx. | ||
| 374 | .x....x. | ||
| 375 | .x....x. | ||
| 376 | .x....x. | ||
| 377 | .x....x. | ||
| 378 | .xxxxxx. | ||
| 379 | */ | ||
| 380 | static unsigned short hollow_square_bits[] = { | ||
| 381 | 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e}; | ||
| 382 | |||
| 383 | /* Filled square bitmap. */ | ||
| 384 | /* | ||
| 385 | .xxxxxx. | ||
| 386 | .xxxxxx. | ||
| 387 | .xxxxxx. | ||
| 388 | .xxxxxx. | ||
| 389 | .xxxxxx. | ||
| 390 | .xxxxxx. | ||
| 391 | */ | ||
| 392 | static unsigned short filled_square_bits[] = { | ||
| 393 | 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e}; | ||
| 394 | |||
| 359 | /* Bar cursor bitmap. A vertical bar; max 13 pixels high. */ | 395 | /* Bar cursor bitmap. A vertical bar; max 13 pixels high. */ |
| 360 | /* | 396 | /* |
| 361 | xx...... | 397 | xx...... |
| @@ -372,15 +408,15 @@ static unsigned short hollow_box_cursor_bits[] = { | |||
| 372 | xx...... | 408 | xx...... |
| 373 | xx...... | 409 | xx...... |
| 374 | */ | 410 | */ |
| 375 | static unsigned short bar_cursor_bits[] = { | 411 | static unsigned short vertical_bar_bits[] = { |
| 376 | 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0}; | 412 | 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0, 0xc0}; |
| 377 | 413 | ||
| 378 | /* HBar cursor bitmap. A horisontal bar; 2 pixels high. */ | 414 | /* HBar cursor bitmap. A horizontal bar; 2 pixels high. */ |
| 379 | /* | 415 | /* |
| 380 | xxxxxxx. | 416 | xxxxxxx. |
| 381 | xxxxxxx. | 417 | xxxxxxx. |
| 382 | */ | 418 | */ |
| 383 | static unsigned short hbar_cursor_bits[] = { | 419 | static unsigned short horizontal_bar_bits[] = { |
| 384 | 0xfe, 0xfe}; | 420 | 0xfe, 0xfe}; |
| 385 | 421 | ||
| 386 | 422 | ||
| @@ -394,7 +430,7 @@ static unsigned short hbar_cursor_bits[] = { | |||
| 394 | ..xxxx.. | 430 | ..xxxx.. |
| 395 | ........ | 431 | ........ |
| 396 | */ | 432 | */ |
| 397 | static unsigned short zv_bits[] = { | 433 | static unsigned short empty_line_bits[] = { |
| 398 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | 434 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, |
| 399 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | 435 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, |
| 400 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | 436 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, |
| @@ -404,48 +440,45 @@ static unsigned short zv_bits[] = { | |||
| 404 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, | 440 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, |
| 405 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00}; | 441 | 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x3c, 0x00}; |
| 406 | 442 | ||
| 407 | /* Hollow square bitmap. */ | ||
| 408 | /* | ||
| 409 | .xxxxxx. | ||
| 410 | .x....x. | ||
| 411 | .x....x. | ||
| 412 | .x....x. | ||
| 413 | .x....x. | ||
| 414 | .xxxxxx. | ||
| 415 | */ | ||
| 416 | static unsigned short hollow_square_bits[] = { | ||
| 417 | 0x7e, 0x42, 0x42, 0x42, 0x42, 0x7e}; | ||
| 418 | |||
| 419 | 443 | ||
| 420 | #define BYTES_PER_BITMAP_ROW (sizeof (unsigned short)) | 444 | #define BYTES_PER_BITMAP_ROW (sizeof (unsigned short)) |
| 421 | #define STANDARD_BITMAP_HEIGHT(bits) (sizeof (bits)/BYTES_PER_BITMAP_ROW) | 445 | #define STANDARD_BITMAP_HEIGHT(bits) (sizeof (bits)/BYTES_PER_BITMAP_ROW) |
| 422 | #define FRBITS(bits) bits, STANDARD_BITMAP_HEIGHT (bits) | 446 | #define FRBITS(bits) bits, STANDARD_BITMAP_HEIGHT (bits) |
| 423 | 447 | ||
| 424 | struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] = | 448 | /* NOTE: The order of these bitmaps must match the sequence |
| 449 | used in fringe.el to define the corresponding symbols. */ | ||
| 450 | |||
| 451 | struct fringe_bitmap standard_bitmaps[] = | ||
| 425 | { | 452 | { |
| 426 | { NULL, 0, 0, 0, 0, 0 }, /* NO_FRINGE_BITMAP */ | 453 | { NULL, 0, 0, 0, 0, 0 }, /* NO_FRINGE_BITMAP */ |
| 427 | { FRBITS (unknown_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 454 | { FRBITS (question_mark_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 428 | { FRBITS (left_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 455 | { FRBITS (left_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 429 | { FRBITS (right_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 456 | { FRBITS (right_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 430 | { FRBITS (up_arrow_bits), 8, 0, ALIGN_BITMAP_TOP, 0 }, | 457 | { FRBITS (up_arrow_bits), 8, 0, ALIGN_BITMAP_TOP, 0 }, |
| 431 | { FRBITS (down_arrow_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, | 458 | { FRBITS (down_arrow_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, |
| 432 | { FRBITS (continued_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 459 | { FRBITS (left_curly_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 433 | { FRBITS (continuation_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 460 | { FRBITS (right_curly_arrow_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 434 | { FRBITS (ov_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 461 | { FRBITS (left_triangle_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 462 | { FRBITS (right_triangle_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 435 | { FRBITS (top_left_angle_bits), 8, 0, ALIGN_BITMAP_TOP, 0 }, | 463 | { FRBITS (top_left_angle_bits), 8, 0, ALIGN_BITMAP_TOP, 0 }, |
| 436 | { FRBITS (top_right_angle_bits), 8, 0, ALIGN_BITMAP_TOP, 0 }, | 464 | { FRBITS (top_right_angle_bits), 8, 0, ALIGN_BITMAP_TOP, 0 }, |
| 437 | { FRBITS (bottom_left_angle_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, | 465 | { FRBITS (bottom_left_angle_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, |
| 438 | { FRBITS (bottom_right_angle_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, | 466 | { FRBITS (bottom_right_angle_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, |
| 439 | { FRBITS (left_bracket_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 467 | { FRBITS (left_bracket_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 440 | { FRBITS (right_bracket_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 468 | { FRBITS (right_bracket_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 441 | { FRBITS (filled_box_cursor_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 469 | { FRBITS (filled_rectangle_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 442 | { FRBITS (hollow_box_cursor_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 470 | { FRBITS (hollow_rectangle_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 471 | { FRBITS (filled_square_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | ||
| 443 | { FRBITS (hollow_square_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 472 | { FRBITS (hollow_square_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 444 | { FRBITS (bar_cursor_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, | 473 | { FRBITS (vertical_bar_bits), 8, 0, ALIGN_BITMAP_CENTER, 0 }, |
| 445 | { FRBITS (hbar_cursor_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, | 474 | { FRBITS (horizontal_bar_bits), 8, 0, ALIGN_BITMAP_BOTTOM, 0 }, |
| 446 | { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 }, | 475 | { FRBITS (empty_line_bits), 8, 3, ALIGN_BITMAP_TOP, 0 }, |
| 447 | }; | 476 | }; |
| 448 | 477 | ||
| 478 | #define NO_FRINGE_BITMAP 0 | ||
| 479 | #define UNDEF_FRINGE_BITMAP 1 | ||
| 480 | #define MAX_STANDARD_FRINGE_BITMAPS (sizeof(standard_bitmaps)/sizeof(standard_bitmaps[0])) | ||
| 481 | |||
| 449 | static struct fringe_bitmap **fringe_bitmaps; | 482 | static struct fringe_bitmap **fringe_bitmaps; |
| 450 | static Lisp_Object *fringe_faces; | 483 | static Lisp_Object *fringe_faces; |
| 451 | static int max_fringe_bitmaps; | 484 | static int max_fringe_bitmaps; |
| @@ -516,12 +549,12 @@ get_fringe_bitmap_name (bn) | |||
| 516 | LEFT_P is 1 for left fringe, 0 for right fringe. | 549 | LEFT_P is 1 for left fringe, 0 for right fringe. |
| 517 | */ | 550 | */ |
| 518 | 551 | ||
| 519 | void | 552 | static void |
| 520 | draw_fringe_bitmap_1 (w, row, left_p, overlay, which) | 553 | draw_fringe_bitmap_1 (w, row, left_p, overlay, which) |
| 521 | struct window *w; | 554 | struct window *w; |
| 522 | struct glyph_row *row; | 555 | struct glyph_row *row; |
| 523 | int left_p, overlay; | 556 | int left_p, overlay; |
| 524 | enum fringe_bitmap_type which; | 557 | int which; |
| 525 | { | 558 | { |
| 526 | struct frame *f = XFRAME (WINDOW_FRAME (w)); | 559 | struct frame *f = XFRAME (WINDOW_FRAME (w)); |
| 527 | struct draw_fringe_bitmap_params p; | 560 | struct draw_fringe_bitmap_params p; |
| @@ -656,6 +689,134 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) | |||
| 656 | rif->draw_fringe_bitmap (w, row, &p); | 689 | rif->draw_fringe_bitmap (w, row, &p); |
| 657 | } | 690 | } |
| 658 | 691 | ||
| 692 | static int | ||
| 693 | get_logical_cursor_bitmap (w, cursor) | ||
| 694 | struct window *w; | ||
| 695 | Lisp_Object cursor; | ||
| 696 | { | ||
| 697 | Lisp_Object cmap, bm = Qnil; | ||
| 698 | |||
| 699 | if ((cmap = XBUFFER (w->buffer)->fringe_cursor_alist), !NILP (cmap)) | ||
| 700 | { | ||
| 701 | bm = Fassq (cursor, cmap); | ||
| 702 | if (CONSP (bm)) | ||
| 703 | { | ||
| 704 | if ((bm = XCDR (bm)), NILP (bm)) | ||
| 705 | return NO_FRINGE_BITMAP; | ||
| 706 | return lookup_fringe_bitmap (bm); | ||
| 707 | } | ||
| 708 | } | ||
| 709 | if (EQ (cmap, buffer_defaults.fringe_cursor_alist)) | ||
| 710 | return NO_FRINGE_BITMAP; | ||
| 711 | bm = Fassq (cursor, buffer_defaults.fringe_cursor_alist); | ||
| 712 | if (!CONSP (bm) || ((bm = XCDR (bm)), NILP (bm))) | ||
| 713 | return NO_FRINGE_BITMAP; | ||
| 714 | return lookup_fringe_bitmap (bm); | ||
| 715 | } | ||
| 716 | |||
| 717 | static int | ||
| 718 | get_logical_fringe_bitmap (w, bitmap, right_p, partial_p) | ||
| 719 | struct window *w; | ||
| 720 | Lisp_Object bitmap; | ||
| 721 | int right_p, partial_p; | ||
| 722 | { | ||
| 723 | Lisp_Object cmap, bm1 = Qnil, bm2 = Qnil, bm; | ||
| 724 | int ln1 = 0, ln2 = 0; | ||
| 725 | int ix1 = right_p; | ||
| 726 | int ix2 = ix1 + (partial_p ? 2 : 0); | ||
| 727 | |||
| 728 | /* Lookup in buffer-local fringe-indicator-alist before global alist. | ||
| 729 | |||
| 730 | Elements are: | ||
| 731 | BITMAP -- use for all | ||
| 732 | (L R) -- use for left right (whether partial or not) | ||
| 733 | (L R PL PR) -- use for left rigth partial-left partial-right | ||
| 734 | If any value in local binding is not present or t, use global value. | ||
| 735 | |||
| 736 | If partial, lookup partial bitmap in default value if not found here. | ||
| 737 | If not partial, or no partial spec is present, use non-partial bitmap. */ | ||
| 738 | |||
| 739 | if ((cmap = XBUFFER (w->buffer)->fringe_indicator_alist), !NILP (cmap)) | ||
| 740 | { | ||
| 741 | bm1 = Fassq (bitmap, cmap); | ||
| 742 | if (CONSP (bm1)) | ||
| 743 | { | ||
| 744 | if ((bm1 = XCDR (bm1)), NILP (bm1)) | ||
| 745 | return NO_FRINGE_BITMAP; | ||
| 746 | if (CONSP (bm1)) | ||
| 747 | { | ||
| 748 | ln1 = XINT (Flength (bm1)); | ||
| 749 | if (partial_p) | ||
| 750 | { | ||
| 751 | if (ln1 > ix2) | ||
| 752 | { | ||
| 753 | bm = Fnth (make_number (ix2), bm1); | ||
| 754 | if (!EQ (bm, Qt)) | ||
| 755 | goto found; | ||
| 756 | } | ||
| 757 | } | ||
| 758 | else | ||
| 759 | { | ||
| 760 | if (ln1 > ix1) | ||
| 761 | { | ||
| 762 | bm = Fnth (make_number (ix1), bm1); | ||
| 763 | if (!EQ (bm, Qt)) | ||
| 764 | goto found; | ||
| 765 | } | ||
| 766 | } | ||
| 767 | } | ||
| 768 | else if ((bm = bm1, !EQ (bm, Qt))) | ||
| 769 | goto found; | ||
| 770 | } | ||
| 771 | } | ||
| 772 | |||
| 773 | if (!EQ (cmap, buffer_defaults.fringe_indicator_alist) | ||
| 774 | && !NILP (buffer_defaults.fringe_indicator_alist)) | ||
| 775 | { | ||
| 776 | bm2 = Fassq (bitmap, buffer_defaults.fringe_indicator_alist); | ||
| 777 | if (CONSP (bm2)) | ||
| 778 | { | ||
| 779 | if ((bm2 = XCDR (bm2)), !NILP (bm2)) | ||
| 780 | { | ||
| 781 | if (CONSP (bm2)) | ||
| 782 | { | ||
| 783 | ln2 = XINT (Flength (bm2)); | ||
| 784 | if (partial_p) | ||
| 785 | { | ||
| 786 | if (ln2 > ix2) | ||
| 787 | { | ||
| 788 | bm = Fnth (make_number (ix2), bm2); | ||
| 789 | if (!EQ (bm, Qt)) | ||
| 790 | goto found; | ||
| 791 | } | ||
| 792 | } | ||
| 793 | } | ||
| 794 | } | ||
| 795 | } | ||
| 796 | } | ||
| 797 | |||
| 798 | if (ln1 > ix1) | ||
| 799 | { | ||
| 800 | bm = Fnth (make_number (ix1), bm1); | ||
| 801 | if (!EQ (bm, Qt)) | ||
| 802 | goto found; | ||
| 803 | } | ||
| 804 | |||
| 805 | if (ln2 > ix1) | ||
| 806 | { | ||
| 807 | bm = Fnth (make_number (ix1), bm2); | ||
| 808 | if (!EQ (bm, Qt)) | ||
| 809 | goto found; | ||
| 810 | return NO_FRINGE_BITMAP; | ||
| 811 | } | ||
| 812 | else if ((bm = bm2, NILP (bm))) | ||
| 813 | return NO_FRINGE_BITMAP; | ||
| 814 | |||
| 815 | found: | ||
| 816 | return lookup_fringe_bitmap (bm); | ||
| 817 | } | ||
| 818 | |||
| 819 | |||
| 659 | void | 820 | void |
| 660 | draw_fringe_bitmap (w, row, left_p) | 821 | draw_fringe_bitmap (w, row, left_p) |
| 661 | struct window *w; | 822 | struct window *w; |
| @@ -666,24 +827,24 @@ draw_fringe_bitmap (w, row, left_p) | |||
| 666 | 827 | ||
| 667 | if (!left_p && row->cursor_in_fringe_p) | 828 | if (!left_p && row->cursor_in_fringe_p) |
| 668 | { | 829 | { |
| 669 | int cursor = NO_FRINGE_BITMAP; | 830 | Lisp_Object cursor = Qnil; |
| 670 | 831 | ||
| 671 | switch (w->phys_cursor_type) | 832 | switch (w->phys_cursor_type) |
| 672 | { | 833 | { |
| 673 | case HOLLOW_BOX_CURSOR: | 834 | case HOLLOW_BOX_CURSOR: |
| 674 | if (row->visible_height >= STANDARD_BITMAP_HEIGHT (hollow_box_cursor_bits)) | 835 | if (row->visible_height >= STANDARD_BITMAP_HEIGHT (hollow_rectangle_bits)) |
| 675 | cursor = HOLLOW_BOX_CURSOR_BITMAP; | 836 | cursor = Qhollow; |
| 676 | else | 837 | else |
| 677 | cursor = HOLLOW_SQUARE_BITMAP; | 838 | cursor = Qhollow_small; |
| 678 | break; | 839 | break; |
| 679 | case FILLED_BOX_CURSOR: | 840 | case FILLED_BOX_CURSOR: |
| 680 | cursor = FILLED_BOX_CURSOR_BITMAP; | 841 | cursor = Qbox; |
| 681 | break; | 842 | break; |
| 682 | case BAR_CURSOR: | 843 | case BAR_CURSOR: |
| 683 | cursor = BAR_CURSOR_BITMAP; | 844 | cursor = Qbar; |
| 684 | break; | 845 | break; |
| 685 | case HBAR_CURSOR: | 846 | case HBAR_CURSOR: |
| 686 | cursor = HBAR_CURSOR_BITMAP; | 847 | cursor = Qhbar; |
| 687 | break; | 848 | break; |
| 688 | case NO_CURSOR: | 849 | case NO_CURSOR: |
| 689 | default: | 850 | default: |
| @@ -691,10 +852,14 @@ draw_fringe_bitmap (w, row, left_p) | |||
| 691 | row->cursor_in_fringe_p = 0; | 852 | row->cursor_in_fringe_p = 0; |
| 692 | break; | 853 | break; |
| 693 | } | 854 | } |
| 694 | if (cursor != NO_FRINGE_BITMAP) | 855 | if (!NILP (cursor)) |
| 695 | { | 856 | { |
| 696 | draw_fringe_bitmap_1 (w, row, 0, 2, cursor); | 857 | int bm = get_logical_cursor_bitmap (w, cursor); |
| 697 | overlay = cursor == FILLED_BOX_CURSOR_BITMAP ? 3 : 1; | 858 | if (bm != NO_FRINGE_BITMAP) |
| 859 | { | ||
| 860 | draw_fringe_bitmap_1 (w, row, 0, 2, bm); | ||
| 861 | overlay = EQ (cursor, Qbox) ? 3 : 1; | ||
| 862 | } | ||
| 698 | } | 863 | } |
| 699 | } | 864 | } |
| 700 | 865 | ||
| @@ -703,7 +868,7 @@ draw_fringe_bitmap (w, row, left_p) | |||
| 703 | if (left_p && row->overlay_arrow_bitmap != NO_FRINGE_BITMAP) | 868 | if (left_p && row->overlay_arrow_bitmap != NO_FRINGE_BITMAP) |
| 704 | draw_fringe_bitmap_1 (w, row, 1, 1, | 869 | draw_fringe_bitmap_1 (w, row, 1, 1, |
| 705 | (row->overlay_arrow_bitmap < 0 | 870 | (row->overlay_arrow_bitmap < 0 |
| 706 | ? OVERLAY_ARROW_BITMAP | 871 | ? get_logical_fringe_bitmap (w, Qoverlay_arrow, 0, 0) |
| 707 | : row->overlay_arrow_bitmap)); | 872 | : row->overlay_arrow_bitmap)); |
| 708 | } | 873 | } |
| 709 | 874 | ||
| @@ -795,6 +960,8 @@ update_window_fringes (w, keep_current_p) | |||
| 795 | Lisp_Object arrow_top = Qnil, arrow_bot = Qnil; | 960 | Lisp_Object arrow_top = Qnil, arrow_bot = Qnil; |
| 796 | Lisp_Object empty_pos; | 961 | Lisp_Object empty_pos; |
| 797 | Lisp_Object ind = Qnil; | 962 | Lisp_Object ind = Qnil; |
| 963 | #define MAX_BITMAP_CACHE (8*4) | ||
| 964 | int bitmap_cache[MAX_BITMAP_CACHE]; | ||
| 798 | 965 | ||
| 799 | if (w->pseudo_window_p) | 966 | if (w->pseudo_window_p) |
| 800 | return 0; | 967 | return 0; |
| @@ -880,11 +1047,27 @@ update_window_fringes (w, keep_current_p) | |||
| 880 | if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) | 1047 | if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) |
| 881 | empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; | 1048 | empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; |
| 882 | 1049 | ||
| 1050 | for (y = 0; y < MAX_BITMAP_CACHE; y++) | ||
| 1051 | bitmap_cache[y] = -1; | ||
| 1052 | |||
| 1053 | #define LEFT_FRINGE(cache, which, partial_p) \ | ||
| 1054 | (bitmap_cache[cache*4+partial_p] >= 0 \ | ||
| 1055 | ? bitmap_cache[cache*4+partial_p] \ | ||
| 1056 | : (bitmap_cache[cache*4+partial_p] = \ | ||
| 1057 | get_logical_fringe_bitmap (w, which, 0, partial_p))) | ||
| 1058 | |||
| 1059 | #define RIGHT_FRINGE(cache, which, partial_p) \ | ||
| 1060 | (bitmap_cache[cache*4+2+partial_p] >= 0 \ | ||
| 1061 | ? bitmap_cache[cache*4+2+partial_p] \ | ||
| 1062 | : (bitmap_cache[cache*4+2+partial_p] = \ | ||
| 1063 | get_logical_fringe_bitmap (w, which, 1, partial_p))) | ||
| 1064 | |||
| 1065 | |||
| 883 | for (y = 0, rn = 0; | 1066 | for (y = 0, rn = 0; |
| 884 | y < yb && rn < nrows; | 1067 | y < yb && rn < nrows; |
| 885 | y += row->height, rn++) | 1068 | y += row->height, rn++) |
| 886 | { | 1069 | { |
| 887 | enum fringe_bitmap_type left, right; | 1070 | int left, right; |
| 888 | unsigned left_face_id, right_face_id; | 1071 | unsigned left_face_id, right_face_id; |
| 889 | 1072 | ||
| 890 | row = w->desired_matrix->rows + rn; | 1073 | row = w->desired_matrix->rows + rn; |
| @@ -903,23 +1086,21 @@ update_window_fringes (w, keep_current_p) | |||
| 903 | left_face_id = row->left_user_fringe_face_id; | 1086 | left_face_id = row->left_user_fringe_face_id; |
| 904 | } | 1087 | } |
| 905 | else if (row->truncated_on_left_p) | 1088 | else if (row->truncated_on_left_p) |
| 906 | left = LEFT_TRUNCATION_BITMAP; | 1089 | left = LEFT_FRINGE(0, Qtruncation, 0); |
| 907 | else if (row->indicate_bob_p && EQ (boundary_top, Qleft)) | 1090 | else if (row->indicate_bob_p && EQ (boundary_top, Qleft)) |
| 908 | left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft)) | 1091 | left = ((row->indicate_eob_p && EQ (boundary_bot, Qleft)) |
| 909 | ? (row->ends_at_zv_p | 1092 | ? LEFT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p) |
| 910 | ? TOP_RIGHT_ANGLE_BITMAP : LEFT_BRACKET_BITMAP) | 1093 | : LEFT_FRINGE (2, Qtop, 0)); |
| 911 | : TOP_LEFT_ANGLE_BITMAP); | ||
| 912 | else if (row->indicate_eob_p && EQ (boundary_bot, Qleft)) | 1094 | else if (row->indicate_eob_p && EQ (boundary_bot, Qleft)) |
| 913 | left = (row->ends_at_zv_p | 1095 | left = LEFT_FRINGE (3, Qbottom, row->ends_at_zv_p); |
| 914 | ? TOP_RIGHT_ANGLE_BITMAP : BOTTOM_LEFT_ANGLE_BITMAP); | ||
| 915 | else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) | 1096 | else if (MATRIX_ROW_CONTINUATION_LINE_P (row)) |
| 916 | left = CONTINUATION_LINE_BITMAP; | 1097 | left = LEFT_FRINGE (4, Qcontinuation, 0); |
| 917 | else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft)) | 1098 | else if (row->indicate_empty_line_p && EQ (empty_pos, Qleft)) |
| 918 | left = ZV_LINE_BITMAP; | 1099 | left = LEFT_FRINGE (5, Qempty_line, 0); |
| 919 | else if (row->indicate_top_line_p && EQ (arrow_top, Qleft)) | 1100 | else if (row->indicate_top_line_p && EQ (arrow_top, Qleft)) |
| 920 | left = UP_ARROW_BITMAP; | 1101 | left = LEFT_FRINGE (6, Qup, 0); |
| 921 | else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qleft)) | 1102 | else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qleft)) |
| 922 | left = DOWN_ARROW_BITMAP; | 1103 | left = LEFT_FRINGE (7, Qdown, 0); |
| 923 | else | 1104 | else |
| 924 | left = NO_FRINGE_BITMAP; | 1105 | left = NO_FRINGE_BITMAP; |
| 925 | 1106 | ||
| @@ -932,23 +1113,21 @@ update_window_fringes (w, keep_current_p) | |||
| 932 | right_face_id = row->right_user_fringe_face_id; | 1113 | right_face_id = row->right_user_fringe_face_id; |
| 933 | } | 1114 | } |
| 934 | else if (row->truncated_on_right_p) | 1115 | else if (row->truncated_on_right_p) |
| 935 | right = RIGHT_TRUNCATION_BITMAP; | 1116 | right = RIGHT_FRINGE (0, Qtruncation, 0); |
| 936 | else if (row->indicate_bob_p && EQ (boundary_top, Qright)) | 1117 | else if (row->indicate_bob_p && EQ (boundary_top, Qright)) |
| 937 | right = ((row->indicate_eob_p && EQ (boundary_bot, Qright)) | 1118 | right = ((row->indicate_eob_p && EQ (boundary_bot, Qright)) |
| 938 | ? (row->ends_at_zv_p | 1119 | ? RIGHT_FRINGE (1, Qtop_bottom, row->ends_at_zv_p) |
| 939 | ? TOP_LEFT_ANGLE_BITMAP : RIGHT_BRACKET_BITMAP) | 1120 | : RIGHT_FRINGE (2, Qtop, 0)); |
| 940 | : TOP_RIGHT_ANGLE_BITMAP); | ||
| 941 | else if (row->indicate_eob_p && EQ (boundary_bot, Qright)) | 1121 | else if (row->indicate_eob_p && EQ (boundary_bot, Qright)) |
| 942 | right = (row->ends_at_zv_p | 1122 | right = RIGHT_FRINGE (3, Qbottom, row->ends_at_zv_p); |
| 943 | ? TOP_LEFT_ANGLE_BITMAP : BOTTOM_RIGHT_ANGLE_BITMAP); | ||
| 944 | else if (row->continued_p) | 1123 | else if (row->continued_p) |
| 945 | right = CONTINUED_LINE_BITMAP; | 1124 | right = RIGHT_FRINGE (4, Qcontinuation, 0); |
| 946 | else if (row->indicate_top_line_p && EQ (arrow_top, Qright)) | 1125 | else if (row->indicate_top_line_p && EQ (arrow_top, Qright)) |
| 947 | right = UP_ARROW_BITMAP; | 1126 | right = RIGHT_FRINGE (6, Qup, 0); |
| 948 | else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qright)) | 1127 | else if (row->indicate_bottom_line_p && EQ (arrow_bot, Qright)) |
| 949 | right = DOWN_ARROW_BITMAP; | 1128 | right = RIGHT_FRINGE (7, Qdown, 0); |
| 950 | else if (row->indicate_empty_line_p && EQ (empty_pos, Qright)) | 1129 | else if (row->indicate_empty_line_p && EQ (empty_pos, Qright)) |
| 951 | right = ZV_LINE_BITMAP; | 1130 | right = RIGHT_FRINGE (5, Qempty_line, 0); |
| 952 | else | 1131 | else |
| 953 | right = NO_FRINGE_BITMAP; | 1132 | right = NO_FRINGE_BITMAP; |
| 954 | 1133 | ||
| @@ -1150,7 +1329,7 @@ If BITMAP overrides a standard fringe bitmap, the original bitmap is restored. | |||
| 1150 | 1329 | ||
| 1151 | void | 1330 | void |
| 1152 | init_fringe_bitmap (which, fb, once_p) | 1331 | init_fringe_bitmap (which, fb, once_p) |
| 1153 | enum fringe_bitmap_type which; | 1332 | int which; |
| 1154 | struct fringe_bitmap *fb; | 1333 | struct fringe_bitmap *fb; |
| 1155 | int once_p; | 1334 | int once_p; |
| 1156 | { | 1335 | { |
| @@ -1436,6 +1615,19 @@ Return nil if POS is not visible in WINDOW. */) | |||
| 1436 | void | 1615 | void |
| 1437 | syms_of_fringe () | 1616 | syms_of_fringe () |
| 1438 | { | 1617 | { |
| 1618 | Qtruncation = intern ("truncation"); | ||
| 1619 | staticpro (&Qtruncation); | ||
| 1620 | Qcontinuation = intern ("continuation"); | ||
| 1621 | staticpro (&Qcontinuation); | ||
| 1622 | Qoverlay_arrow = intern ("overlay-arrow"); | ||
| 1623 | staticpro (&Qoverlay_arrow); | ||
| 1624 | Qempty_line = intern ("empty-line"); | ||
| 1625 | staticpro (&Qempty_line); | ||
| 1626 | Qtop_bottom = intern ("top-bottom"); | ||
| 1627 | staticpro (&Qtop_bottom); | ||
| 1628 | Qhollow_small = intern ("hollow-small"); | ||
| 1629 | staticpro (&Qhollow_small); | ||
| 1630 | |||
| 1439 | defsubr (&Sdestroy_fringe_bitmap); | 1631 | defsubr (&Sdestroy_fringe_bitmap); |
| 1440 | defsubr (&Sdefine_fringe_bitmap); | 1632 | defsubr (&Sdefine_fringe_bitmap); |
| 1441 | defsubr (&Sfringe_bitmaps_at_pos); | 1633 | defsubr (&Sfringe_bitmaps_at_pos); |
| @@ -1451,8 +1643,7 @@ If nil, also continue lines which are exactly as wide as the window. */); | |||
| 1451 | Voverflow_newline_into_fringe = Qt; | 1643 | Voverflow_newline_into_fringe = Qt; |
| 1452 | 1644 | ||
| 1453 | DEFVAR_LISP ("fringe-bitmaps", &Vfringe_bitmaps, | 1645 | DEFVAR_LISP ("fringe-bitmaps", &Vfringe_bitmaps, |
| 1454 | doc: /* List of fringe bitmap symbols. | 1646 | doc: /* List of fringe bitmap symbols. */); |
| 1455 | You must (require 'fringe) to use fringe bitmap symbols in your programs." */); | ||
| 1456 | Vfringe_bitmaps = Qnil; | 1647 | Vfringe_bitmaps = Qnil; |
| 1457 | } | 1648 | } |
| 1458 | 1649 | ||
| @@ -1473,7 +1664,7 @@ mark_fringe_data () | |||
| 1473 | void | 1664 | void |
| 1474 | init_fringe_once () | 1665 | init_fringe_once () |
| 1475 | { | 1666 | { |
| 1476 | enum fringe_bitmap_type bt; | 1667 | int bt; |
| 1477 | 1668 | ||
| 1478 | for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++) | 1669 | for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++) |
| 1479 | init_fringe_bitmap(bt, &standard_bitmaps[bt], 1); | 1670 | init_fringe_bitmap(bt, &standard_bitmaps[bt], 1); |
| @@ -1503,7 +1694,7 @@ init_fringe () | |||
| 1503 | void | 1694 | void |
| 1504 | w32_init_fringe () | 1695 | w32_init_fringe () |
| 1505 | { | 1696 | { |
| 1506 | enum fringe_bitmap_type bt; | 1697 | int bt; |
| 1507 | 1698 | ||
| 1508 | if (!rif) | 1699 | if (!rif) |
| 1509 | return; | 1700 | return; |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 5b7a5166888..203eab257f3 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -199,7 +199,7 @@ malloc_widget_value () | |||
| 199 | } | 199 | } |
| 200 | else | 200 | else |
| 201 | { | 201 | { |
| 202 | wv = (widget_value *) malloc (sizeof (widget_value)); | 202 | wv = (widget_value *) xmalloc (sizeof (widget_value)); |
| 203 | malloc_cpt++; | 203 | malloc_cpt++; |
| 204 | } | 204 | } |
| 205 | memset (wv, 0, sizeof (widget_value)); | 205 | memset (wv, 0, sizeof (widget_value)); |
diff --git a/src/macmenu.c b/src/macmenu.c index bd4ad6291cf..fccbbe6402c 100644 --- a/src/macmenu.c +++ b/src/macmenu.c | |||
| @@ -189,8 +189,9 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object, | |||
| 189 | static void list_of_panes P_ ((Lisp_Object)); | 189 | static void list_of_panes P_ ((Lisp_Object)); |
| 190 | static void list_of_items P_ ((Lisp_Object)); | 190 | static void list_of_items P_ ((Lisp_Object)); |
| 191 | 191 | ||
| 192 | static void fill_submenu (MenuHandle, widget_value *); | 192 | static int fill_menu P_ ((MenuHandle, widget_value *, int)); |
| 193 | static void fill_menubar (widget_value *); | 193 | static void fill_menubar P_ ((widget_value *, int)); |
| 194 | static void dispose_menus P_ ((int)); | ||
| 194 | 195 | ||
| 195 | 196 | ||
| 196 | /* This holds a Lisp vector that holds the results of decoding | 197 | /* This holds a Lisp vector that holds the results of decoding |
| @@ -247,15 +248,6 @@ static int menu_items_n_panes; | |||
| 247 | /* Current depth within submenus. */ | 248 | /* Current depth within submenus. */ |
| 248 | static int menu_items_submenu_depth; | 249 | static int menu_items_submenu_depth; |
| 249 | 250 | ||
| 250 | /* Flag which when set indicates a dialog or menu has been posted by | ||
| 251 | Xt on behalf of one of the widget sets. */ | ||
| 252 | static int popup_activated_flag; | ||
| 253 | |||
| 254 | /* Index of the next submenu */ | ||
| 255 | static int submenu_id; | ||
| 256 | |||
| 257 | static int next_menubar_widget_id; | ||
| 258 | |||
| 259 | /* This is set nonzero after the user activates the menu bar, and set | 251 | /* This is set nonzero after the user activates the menu bar, and set |
| 260 | to zero again after the menu bars are redisplayed by prepare_menu_bar. | 252 | to zero again after the menu bars are redisplayed by prepare_menu_bar. |
| 261 | While it is nonzero, all calls to set_frame_menubar go deep. | 253 | While it is nonzero, all calls to set_frame_menubar go deep. |
| @@ -1440,7 +1432,7 @@ install_menu_quit_handler (MenuHandle menu_handle) | |||
| 1440 | menu = GetMenuHandle (++i); | 1432 | menu = GetMenuHandle (++i); |
| 1441 | } | 1433 | } |
| 1442 | 1434 | ||
| 1443 | i = menu_handle ? MIN_POPUP_SUBMENU_ID : MIN_SUBMENU_ID; | 1435 | i = menu_handle ? MIN_POPUP_SUBMENU_ID : MIN_SUBMENU_ID; |
| 1444 | menu = GetMenuHandle (i); | 1436 | menu = GetMenuHandle (i); |
| 1445 | while (menu != NULL) | 1437 | while (menu != NULL) |
| 1446 | { | 1438 | { |
| @@ -1679,27 +1671,7 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 1679 | /* Non-null value to indicate menubar has already been "created". */ | 1671 | /* Non-null value to indicate menubar has already been "created". */ |
| 1680 | f->output_data.mac->menubar_widget = 1; | 1672 | f->output_data.mac->menubar_widget = 1; |
| 1681 | 1673 | ||
| 1682 | { | 1674 | fill_menubar (first_wv->contents, deep_p); |
| 1683 | int i = MIN_MENU_ID; | ||
| 1684 | MenuHandle menu = GetMenuHandle (i); | ||
| 1685 | while (menu != NULL) | ||
| 1686 | { | ||
| 1687 | DeleteMenu (i); | ||
| 1688 | DisposeMenu (menu); | ||
| 1689 | menu = GetMenuHandle (++i); | ||
| 1690 | } | ||
| 1691 | |||
| 1692 | i = MIN_SUBMENU_ID; | ||
| 1693 | menu = GetMenuHandle (i); | ||
| 1694 | while (menu != NULL) | ||
| 1695 | { | ||
| 1696 | DeleteMenu (i); | ||
| 1697 | DisposeMenu (menu); | ||
| 1698 | menu = GetMenuHandle (++i); | ||
| 1699 | } | ||
| 1700 | } | ||
| 1701 | |||
| 1702 | fill_menubar (first_wv->contents); | ||
| 1703 | 1675 | ||
| 1704 | /* Add event handler so we can detect C-g. */ | 1676 | /* Add event handler so we can detect C-g. */ |
| 1705 | install_menu_quit_handler (NULL); | 1677 | install_menu_quit_handler (NULL); |
| @@ -1708,22 +1680,6 @@ set_frame_menubar (f, first_time, deep_p) | |||
| 1708 | UNBLOCK_INPUT; | 1680 | UNBLOCK_INPUT; |
| 1709 | } | 1681 | } |
| 1710 | 1682 | ||
| 1711 | /* Called from Fx_create_frame to create the initial menubar of a frame | ||
| 1712 | before it is mapped, so that the window is mapped with the menubar already | ||
| 1713 | there instead of us tacking it on later and thrashing the window after it | ||
| 1714 | is visible. */ | ||
| 1715 | |||
| 1716 | void | ||
| 1717 | initialize_frame_menubar (f) | ||
| 1718 | FRAME_PTR f; | ||
| 1719 | { | ||
| 1720 | /* This function is called before the first chance to redisplay | ||
| 1721 | the frame. It has to be, so the frame will have the right size. */ | ||
| 1722 | FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); | ||
| 1723 | set_frame_menubar (f, 1, 1); | ||
| 1724 | } | ||
| 1725 | |||
| 1726 | |||
| 1727 | /* Get rid of the menu bar of frame F, and free its storage. | 1683 | /* Get rid of the menu bar of frame F, and free its storage. |
| 1728 | This is used when deleting a frame, and when turning off the menu bar. */ | 1684 | This is used when deleting a frame, and when turning off the menu bar. */ |
| 1729 | 1685 | ||
| @@ -1739,11 +1695,9 @@ static Lisp_Object | |||
| 1739 | pop_down_menu (arg) | 1695 | pop_down_menu (arg) |
| 1740 | Lisp_Object arg; | 1696 | Lisp_Object arg; |
| 1741 | { | 1697 | { |
| 1742 | struct Lisp_Save_Value *p1 = XSAVE_VALUE (Fcar (arg)); | 1698 | struct Lisp_Save_Value *p = XSAVE_VALUE (arg); |
| 1743 | struct Lisp_Save_Value *p2 = XSAVE_VALUE (Fcdr (arg)); | 1699 | FRAME_PTR f = p->pointer; |
| 1744 | 1700 | MenuHandle menu = GetMenuHandle (POPUP_SUBMENU_ID); | |
| 1745 | FRAME_PTR f = p1->pointer; | ||
| 1746 | MenuHandle *menu = p2->pointer; | ||
| 1747 | 1701 | ||
| 1748 | BLOCK_INPUT; | 1702 | BLOCK_INPUT; |
| 1749 | 1703 | ||
| @@ -1752,19 +1706,9 @@ pop_down_menu (arg) | |||
| 1752 | FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0; | 1706 | FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0; |
| 1753 | 1707 | ||
| 1754 | /* delete all menus */ | 1708 | /* delete all menus */ |
| 1755 | { | 1709 | dispose_menus (MIN_POPUP_SUBMENU_ID); |
| 1756 | int i = MIN_POPUP_SUBMENU_ID; | ||
| 1757 | MenuHandle submenu = GetMenuHandle (i); | ||
| 1758 | while (submenu != NULL) | ||
| 1759 | { | ||
| 1760 | DeleteMenu (i); | ||
| 1761 | DisposeMenu (submenu); | ||
| 1762 | submenu = GetMenuHandle (++i); | ||
| 1763 | } | ||
| 1764 | } | ||
| 1765 | |||
| 1766 | DeleteMenu (POPUP_SUBMENU_ID); | 1710 | DeleteMenu (POPUP_SUBMENU_ID); |
| 1767 | DisposeMenu (*menu); | 1711 | DisposeMenu (menu); |
| 1768 | 1712 | ||
| 1769 | UNBLOCK_INPUT; | 1713 | UNBLOCK_INPUT; |
| 1770 | 1714 | ||
| @@ -1998,8 +1942,8 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 1998 | 1942 | ||
| 1999 | /* Actually create the menu. */ | 1943 | /* Actually create the menu. */ |
| 2000 | menu = NewMenu (POPUP_SUBMENU_ID, "\p"); | 1944 | menu = NewMenu (POPUP_SUBMENU_ID, "\p"); |
| 2001 | submenu_id = MIN_POPUP_SUBMENU_ID; | 1945 | InsertMenu (menu, -1); |
| 2002 | fill_submenu (menu, first_wv->contents); | 1946 | fill_menu (menu, first_wv->contents, MIN_POPUP_SUBMENU_ID); |
| 2003 | 1947 | ||
| 2004 | /* Free the widget_value objects we used to specify the | 1948 | /* Free the widget_value objects we used to specify the |
| 2005 | contents. */ | 1949 | contents. */ |
| @@ -2016,11 +1960,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error) | |||
| 2016 | menu_item_choice = 0; | 1960 | menu_item_choice = 0; |
| 2017 | menu_item_selection = 0; | 1961 | menu_item_selection = 0; |
| 2018 | 1962 | ||
| 2019 | InsertMenu (menu, -1); | 1963 | record_unwind_protect (pop_down_menu, make_save_value (f, 0)); |
| 2020 | |||
| 2021 | record_unwind_protect (pop_down_menu, | ||
| 2022 | Fcons (make_save_value (f, 0), | ||
| 2023 | make_save_value (&menu, 0))); | ||
| 2024 | 1964 | ||
| 2025 | /* Add event handler so we can detect C-g. */ | 1965 | /* Add event handler so we can detect C-g. */ |
| 2026 | install_menu_quit_handler (menu); | 1966 | install_menu_quit_handler (menu); |
| @@ -2421,15 +2361,16 @@ name_is_separator (name) | |||
| 2421 | } | 2361 | } |
| 2422 | 2362 | ||
| 2423 | static void | 2363 | static void |
| 2424 | add_menu_item (MenuHandle menu, widget_value *wv, int submenu, | 2364 | add_menu_item (menu, pos, wv) |
| 2425 | int force_disable) | 2365 | MenuHandle menu; |
| 2366 | int pos; | ||
| 2367 | widget_value *wv; | ||
| 2426 | { | 2368 | { |
| 2427 | #if TARGET_API_MAC_CARBON | 2369 | #if TARGET_API_MAC_CARBON |
| 2428 | CFStringRef item_name; | 2370 | CFStringRef item_name; |
| 2429 | #else | 2371 | #else |
| 2430 | Str255 item_name; | 2372 | Str255 item_name; |
| 2431 | #endif | 2373 | #endif |
| 2432 | int pos; | ||
| 2433 | 2374 | ||
| 2434 | if (name_is_separator (wv->name)) | 2375 | if (name_is_separator (wv->name)) |
| 2435 | AppendMenu (menu, "\p-"); | 2376 | AppendMenu (menu, "\p-"); |
| @@ -2438,8 +2379,6 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu, | |||
| 2438 | AppendMenu (menu, "\pX"); | 2379 | AppendMenu (menu, "\pX"); |
| 2439 | 2380 | ||
| 2440 | #if TARGET_API_MAC_CARBON | 2381 | #if TARGET_API_MAC_CARBON |
| 2441 | pos = CountMenuItems (menu); | ||
| 2442 | |||
| 2443 | item_name = cfstring_create_with_utf8_cstring (wv->name); | 2382 | item_name = cfstring_create_with_utf8_cstring (wv->name); |
| 2444 | 2383 | ||
| 2445 | if (wv->key != NULL) | 2384 | if (wv->key != NULL) |
| @@ -2457,13 +2396,11 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu, | |||
| 2457 | SetMenuItemTextWithCFString (menu, pos, item_name); | 2396 | SetMenuItemTextWithCFString (menu, pos, item_name); |
| 2458 | CFRelease (item_name); | 2397 | CFRelease (item_name); |
| 2459 | 2398 | ||
| 2460 | if (wv->enabled && !force_disable) | 2399 | if (wv->enabled) |
| 2461 | EnableMenuItem (menu, pos); | 2400 | EnableMenuItem (menu, pos); |
| 2462 | else | 2401 | else |
| 2463 | DisableMenuItem (menu, pos); | 2402 | DisableMenuItem (menu, pos); |
| 2464 | #else /* ! TARGET_API_MAC_CARBON */ | 2403 | #else /* ! TARGET_API_MAC_CARBON */ |
| 2465 | pos = CountMItems (menu); | ||
| 2466 | |||
| 2467 | item_name[sizeof (item_name) - 1] = '\0'; | 2404 | item_name[sizeof (item_name) - 1] = '\0'; |
| 2468 | strncpy (item_name, wv->name, sizeof (item_name) - 1); | 2405 | strncpy (item_name, wv->name, sizeof (item_name) - 1); |
| 2469 | if (wv->key != NULL) | 2406 | if (wv->key != NULL) |
| @@ -2477,88 +2414,140 @@ add_menu_item (MenuHandle menu, widget_value *wv, int submenu, | |||
| 2477 | c2pstr (item_name); | 2414 | c2pstr (item_name); |
| 2478 | SetMenuItemText (menu, pos, item_name); | 2415 | SetMenuItemText (menu, pos, item_name); |
| 2479 | 2416 | ||
| 2480 | if (wv->enabled && !force_disable) | 2417 | if (wv->enabled) |
| 2481 | EnableItem (menu, pos); | 2418 | EnableItem (menu, pos); |
| 2482 | else | 2419 | else |
| 2483 | DisableItem (menu, pos); | 2420 | DisableItem (menu, pos); |
| 2484 | #endif /* ! TARGET_API_MAC_CARBON */ | 2421 | #endif /* ! TARGET_API_MAC_CARBON */ |
| 2485 | 2422 | ||
| 2486 | /* Draw radio buttons and tickboxes. */ | 2423 | /* Draw radio buttons and tickboxes. */ |
| 2487 | { | ||
| 2488 | if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || | 2424 | if (wv->selected && (wv->button_type == BUTTON_TYPE_TOGGLE || |
| 2489 | wv->button_type == BUTTON_TYPE_RADIO)) | 2425 | wv->button_type == BUTTON_TYPE_RADIO)) |
| 2490 | SetItemMark (menu, pos, checkMark); | 2426 | SetItemMark (menu, pos, checkMark); |
| 2491 | else | 2427 | else |
| 2492 | SetItemMark (menu, pos, noMark); | 2428 | SetItemMark (menu, pos, noMark); |
| 2493 | } | ||
| 2494 | 2429 | ||
| 2495 | SetMenuItemRefCon (menu, pos, (UInt32) wv->call_data); | 2430 | SetMenuItemRefCon (menu, pos, (UInt32) wv->call_data); |
| 2496 | } | 2431 | } |
| 2497 | |||
| 2498 | if (submenu != 0) | ||
| 2499 | SetMenuItemHierarchicalID (menu, pos, submenu); | ||
| 2500 | } | 2432 | } |
| 2501 | 2433 | ||
| 2502 | /* Construct native Mac OS menubar based on widget_value tree. */ | 2434 | /* Construct native Mac OS menu based on widget_value tree. */ |
| 2503 | 2435 | ||
| 2504 | static void | 2436 | static int |
| 2505 | fill_submenu (MenuHandle menu, widget_value *wv) | 2437 | fill_menu (menu, wv, submenu_id) |
| 2438 | MenuHandle menu; | ||
| 2439 | widget_value *wv; | ||
| 2440 | int submenu_id; | ||
| 2506 | { | 2441 | { |
| 2507 | for ( ; wv != NULL; wv = wv->next) | 2442 | int pos; |
| 2508 | if (wv->contents) | ||
| 2509 | { | ||
| 2510 | int cur_submenu = submenu_id++; | ||
| 2511 | MenuHandle submenu = NewMenu (cur_submenu, "\pX"); | ||
| 2512 | fill_submenu (submenu, wv->contents); | ||
| 2513 | InsertMenu (submenu, -1); | ||
| 2514 | add_menu_item (menu, wv, cur_submenu, 0); | ||
| 2515 | } | ||
| 2516 | else | ||
| 2517 | add_menu_item (menu, wv, 0, 0); | ||
| 2518 | } | ||
| 2519 | 2443 | ||
| 2444 | for (pos = 1; wv != NULL; wv = wv->next, pos++) | ||
| 2445 | { | ||
| 2446 | add_menu_item (menu, pos, wv); | ||
| 2447 | if (wv->contents) | ||
| 2448 | { | ||
| 2449 | MenuHandle submenu = NewMenu (submenu_id, "\pX"); | ||
| 2520 | 2450 | ||
| 2521 | /* Construct native Mac OS menu based on widget_value tree. */ | 2451 | InsertMenu (submenu, -1); |
| 2452 | SetMenuItemHierarchicalID (menu, pos, submenu_id); | ||
| 2453 | submenu_id = fill_menu (submenu, wv->contents, submenu_id + 1); | ||
| 2454 | } | ||
| 2455 | } | ||
| 2522 | 2456 | ||
| 2523 | static void | 2457 | return submenu_id; |
| 2524 | fill_menu (MenuHandle menu, widget_value *wv) | ||
| 2525 | { | ||
| 2526 | for ( ; wv != NULL; wv = wv->next) | ||
| 2527 | if (wv->contents) | ||
| 2528 | { | ||
| 2529 | int cur_submenu = submenu_id++; | ||
| 2530 | MenuHandle submenu = NewMenu (cur_submenu, "\pX"); | ||
| 2531 | fill_submenu (submenu, wv->contents); | ||
| 2532 | InsertMenu (submenu, -1); | ||
| 2533 | add_menu_item (menu, wv, cur_submenu, 0); | ||
| 2534 | } | ||
| 2535 | else | ||
| 2536 | add_menu_item (menu, wv, 0, 0); | ||
| 2537 | } | 2458 | } |
| 2538 | 2459 | ||
| 2539 | /* Construct native Mac OS menubar based on widget_value tree. */ | 2460 | /* Construct native Mac OS menubar based on widget_value tree. */ |
| 2540 | 2461 | ||
| 2541 | static void | 2462 | static void |
| 2542 | fill_menubar (widget_value *wv) | 2463 | fill_menubar (wv, deep_p) |
| 2464 | widget_value *wv; | ||
| 2465 | int deep_p; | ||
| 2543 | { | 2466 | { |
| 2544 | int id; | 2467 | int id, submenu_id; |
| 2468 | MenuHandle menu; | ||
| 2469 | Str255 title; | ||
| 2470 | #if !TARGET_API_MAC_CARBON | ||
| 2471 | int title_changed_p = 0; | ||
| 2472 | #endif | ||
| 2545 | 2473 | ||
| 2546 | submenu_id = MIN_SUBMENU_ID; | 2474 | /* Clean up the menu bar when filled by the entire menu trees. */ |
| 2475 | if (deep_p) | ||
| 2476 | { | ||
| 2477 | dispose_menus (MIN_MENU_ID); | ||
| 2478 | dispose_menus (MIN_SUBMENU_ID); | ||
| 2479 | #if !TARGET_API_MAC_CARBON | ||
| 2480 | title_changed_p = 1; | ||
| 2481 | #endif | ||
| 2482 | } | ||
| 2547 | 2483 | ||
| 2484 | /* Fill menu bar titles and submenus. Reuse the existing menu bar | ||
| 2485 | titles as much as possible to minimize redraw (if !deep_p). */ | ||
| 2486 | submenu_id = MIN_SUBMENU_ID; | ||
| 2548 | for (id = MIN_MENU_ID; wv != NULL; wv = wv->next, id++) | 2487 | for (id = MIN_MENU_ID; wv != NULL; wv = wv->next, id++) |
| 2549 | { | 2488 | { |
| 2550 | MenuHandle menu; | ||
| 2551 | Str255 title; | ||
| 2552 | |||
| 2553 | strncpy (title, wv->name, 255); | 2489 | strncpy (title, wv->name, 255); |
| 2554 | title[255] = 0; | 2490 | title[255] = '\0'; |
| 2555 | c2pstr (title); | 2491 | c2pstr (title); |
| 2556 | menu = NewMenu (id, title); | 2492 | |
| 2493 | menu = GetMenuHandle (id); | ||
| 2494 | if (menu) | ||
| 2495 | { | ||
| 2496 | #if TARGET_API_MAC_CARBON | ||
| 2497 | Str255 old_title; | ||
| 2498 | |||
| 2499 | GetMenuTitle (menu, old_title); | ||
| 2500 | if (!EqualString (title, old_title, false, false)) | ||
| 2501 | SetMenuTitle (menu, title); | ||
| 2502 | #else /* !TARGET_API_MAC_CARBON */ | ||
| 2503 | if (!EqualString (title, (*menu)->menuData, false, false)) | ||
| 2504 | { | ||
| 2505 | DeleteMenu (id); | ||
| 2506 | DisposeMenu (menu); | ||
| 2507 | menu = NewMenu (id, title); | ||
| 2508 | InsertMenu (menu, GetMenuHandle (id + 1) ? id + 1 : 0); | ||
| 2509 | title_changed_p = 1; | ||
| 2510 | } | ||
| 2511 | #endif /* !TARGET_API_MAC_CARBON */ | ||
| 2512 | } | ||
| 2513 | else | ||
| 2514 | { | ||
| 2515 | menu = NewMenu (id, title); | ||
| 2516 | InsertMenu (menu, 0); | ||
| 2517 | #if !TARGET_API_MAC_CARBON | ||
| 2518 | title_changed_p = 1; | ||
| 2519 | #endif | ||
| 2520 | } | ||
| 2557 | 2521 | ||
| 2558 | if (wv->contents) | 2522 | if (wv->contents) |
| 2559 | fill_menu (menu, wv->contents); | 2523 | submenu_id = fill_menu (menu, wv->contents, submenu_id); |
| 2524 | } | ||
| 2560 | 2525 | ||
| 2561 | InsertMenu (menu, 0); | 2526 | if (GetMenuHandle (id)) |
| 2527 | { | ||
| 2528 | dispose_menus (id); | ||
| 2529 | #if !TARGET_API_MAC_CARBON | ||
| 2530 | title_changed_p = 1; | ||
| 2531 | #endif | ||
| 2532 | } | ||
| 2533 | |||
| 2534 | #if !TARGET_API_MAC_CARBON | ||
| 2535 | if (title_changed_p) | ||
| 2536 | InvalMenuBar (); | ||
| 2537 | #endif | ||
| 2538 | } | ||
| 2539 | |||
| 2540 | static void | ||
| 2541 | dispose_menus (id) | ||
| 2542 | int id; | ||
| 2543 | { | ||
| 2544 | MenuHandle menu; | ||
| 2545 | |||
| 2546 | while ((menu = GetMenuHandle (id)) != NULL) | ||
| 2547 | { | ||
| 2548 | DeleteMenu (id); | ||
| 2549 | DisposeMenu (menu); | ||
| 2550 | id++; | ||
| 2562 | } | 2551 | } |
| 2563 | } | 2552 | } |
| 2564 | 2553 | ||
diff --git a/src/macterm.c b/src/macterm.c index 8439a79d65c..78ea90bfc8b 100644 --- a/src/macterm.c +++ b/src/macterm.c | |||
| @@ -285,7 +285,7 @@ mac_begin_clip (region) | |||
| 285 | if (new_region == NULL) | 285 | if (new_region == NULL) |
| 286 | new_region = NewRgn (); | 286 | new_region = NewRgn (); |
| 287 | 287 | ||
| 288 | if (region) | 288 | if (region && !EmptyRgn (region)) |
| 289 | { | 289 | { |
| 290 | GetClip (saved_port_clip_region); | 290 | GetClip (saved_port_clip_region); |
| 291 | SectRgn (saved_port_clip_region, region, new_region); | 291 | SectRgn (saved_port_clip_region, region, new_region); |
| @@ -297,7 +297,7 @@ static void | |||
| 297 | mac_end_clip (region) | 297 | mac_end_clip (region) |
| 298 | RgnHandle region; | 298 | RgnHandle region; |
| 299 | { | 299 | { |
| 300 | if (region) | 300 | if (region && !EmptyRgn (region)) |
| 301 | SetClip (saved_port_clip_region); | 301 | SetClip (saved_port_clip_region); |
| 302 | } | 302 | } |
| 303 | 303 | ||
| @@ -684,27 +684,15 @@ mac_invert_rectangle (f, x, y, width, height) | |||
| 684 | 684 | ||
| 685 | 685 | ||
| 686 | static void | 686 | static void |
| 687 | mac_draw_string_common (f, gc, x, y, buf, nchars, mode, bytes_per_char) | 687 | mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, bytes_per_char) |
| 688 | struct frame *f; | 688 | struct frame *f; |
| 689 | GC gc; | 689 | GC gc; |
| 690 | int x, y; | 690 | int x, y; |
| 691 | char *buf; | 691 | char *buf; |
| 692 | int nchars, mode, bytes_per_char; | 692 | int nchars, bg_width, bytes_per_char; |
| 693 | { | 693 | { |
| 694 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | ||
| 695 | UInt32 textFlags, savedFlags; | ||
| 696 | if (mac_use_core_graphics) { | ||
| 697 | textFlags = kQDUseCGTextRendering; | ||
| 698 | savedFlags = SwapQDTextFlags(textFlags); | ||
| 699 | } | ||
| 700 | #endif | ||
| 701 | |||
| 702 | SetPortWindowPort (FRAME_MAC_WINDOW (f)); | 694 | SetPortWindowPort (FRAME_MAC_WINDOW (f)); |
| 703 | 695 | ||
| 704 | RGBForeColor (GC_FORE_COLOR (gc)); | ||
| 705 | if (mode != srcOr) | ||
| 706 | RGBBackColor (GC_BACK_COLOR (gc)); | ||
| 707 | |||
| 708 | #if USE_ATSUI | 696 | #if USE_ATSUI |
| 709 | if (GC_FONT (gc)->mac_style) | 697 | if (GC_FONT (gc)->mac_style) |
| 710 | { | 698 | { |
| @@ -726,91 +714,144 @@ mac_draw_string_common (f, gc, x, y, buf, nchars, mode, bytes_per_char) | |||
| 726 | nchars, | 714 | nchars, |
| 727 | GC_FONT (gc)->mac_style, | 715 | GC_FONT (gc)->mac_style, |
| 728 | &text_layout); | 716 | &text_layout); |
| 729 | if (err == noErr) | 717 | if (err != noErr) |
| 730 | { | 718 | return; |
| 731 | #ifdef MAC_OSX | 719 | #ifdef MAC_OSX |
| 732 | if (!mac_use_core_graphics) | 720 | if (!mac_use_core_graphics) |
| 733 | { | 721 | { |
| 734 | #endif | 722 | #endif |
| 735 | mac_begin_clip (GC_CLIP_REGION (gc)); | 723 | mac_begin_clip (GC_CLIP_REGION (gc)); |
| 736 | MoveTo (x, y); | 724 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 737 | ATSUDrawText (text_layout, | 725 | if (bg_width) |
| 738 | kATSUFromTextBeginning, kATSUToTextEnd, | 726 | { |
| 739 | kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); | 727 | Rect r; |
| 740 | mac_end_clip (GC_CLIP_REGION (gc)); | 728 | |
| 741 | #ifdef MAC_OSX | 729 | SetRect (&r, x, y - FONT_BASE (GC_FONT (gc)), |
| 730 | x + bg_width, y + FONT_DESCENT (GC_FONT (gc))); | ||
| 731 | RGBBackColor (GC_BACK_COLOR (gc)); | ||
| 732 | EraseRect (&r); | ||
| 733 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); | ||
| 742 | } | 734 | } |
| 743 | else | 735 | MoveTo (x, y); |
| 736 | ATSUDrawText (text_layout, | ||
| 737 | kATSUFromTextBeginning, kATSUToTextEnd, | ||
| 738 | kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc); | ||
| 739 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 740 | #ifdef MAC_OSX | ||
| 741 | } | ||
| 742 | else | ||
| 743 | { | ||
| 744 | CGrafPtr port; | ||
| 745 | CGContextRef context; | ||
| 746 | float port_height = FRAME_PIXEL_HEIGHT (f); | ||
| 747 | ATSUAttributeTag tags[] = {kATSUCGContextTag}; | ||
| 748 | ByteCount sizes[] = {sizeof (CGContextRef)}; | ||
| 749 | ATSUAttributeValuePtr values[] = {&context}; | ||
| 750 | |||
| 751 | GetPort (&port); | ||
| 752 | QDBeginCGContext (port, &context); | ||
| 753 | if (gc->n_clip_rects || bg_width) | ||
| 744 | { | 754 | { |
| 745 | CGrafPtr port; | 755 | CGContextTranslateCTM (context, 0, port_height); |
| 746 | CGContextRef context; | 756 | CGContextScaleCTM (context, 1, -1); |
| 747 | float port_height = FRAME_PIXEL_HEIGHT (f); | ||
| 748 | ATSUAttributeTag tags[] = {kATSUCGContextTag}; | ||
| 749 | ByteCount sizes[] = {sizeof (CGContextRef)}; | ||
| 750 | ATSUAttributeValuePtr values[] = {&context}; | ||
| 751 | |||
| 752 | GetPort (&port); | ||
| 753 | QDBeginCGContext (port, &context); | ||
| 754 | if (gc->n_clip_rects) | 757 | if (gc->n_clip_rects) |
| 758 | CGContextClipToRects (context, gc->clip_rects, | ||
| 759 | gc->n_clip_rects); | ||
| 760 | if (bg_width) | ||
| 755 | { | 761 | { |
| 756 | CGContextTranslateCTM (context, 0, port_height); | 762 | CGContextSetRGBFillColor |
| 757 | CGContextScaleCTM (context, 1, -1); | 763 | (context, |
| 758 | CGContextClipToRects (context, gc->clip_rects, | 764 | RED_FROM_ULONG (gc->xgcv.background) / 255.0f, |
| 759 | gc->n_clip_rects); | 765 | GREEN_FROM_ULONG (gc->xgcv.background) / 255.0f, |
| 760 | CGContextScaleCTM (context, 1, -1); | 766 | BLUE_FROM_ULONG (gc->xgcv.background) / 255.0f, |
| 761 | CGContextTranslateCTM (context, 0, -port_height); | 767 | 1.0); |
| 768 | CGContextFillRect | ||
| 769 | (context, | ||
| 770 | CGRectMake (x, y - FONT_BASE (GC_FONT (gc)), | ||
| 771 | bg_width, FONT_HEIGHT (GC_FONT (gc)))); | ||
| 762 | } | 772 | } |
| 763 | CGContextSetRGBFillColor | 773 | CGContextScaleCTM (context, 1, -1); |
| 764 | (context, | 774 | CGContextTranslateCTM (context, 0, -port_height); |
| 765 | RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, | 775 | } |
| 766 | GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0, | 776 | CGContextSetRGBFillColor |
| 767 | BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0, | 777 | (context, |
| 768 | 1.0); | 778 | RED_FROM_ULONG (gc->xgcv.foreground) / 255.0f, |
| 769 | err = ATSUSetLayoutControls (text_layout, | 779 | GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0f, |
| 770 | sizeof (tags) / sizeof (tags[0]), | 780 | BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0f, |
| 771 | tags, sizes, values); | 781 | 1.0); |
| 772 | if (err == noErr) | 782 | err = ATSUSetLayoutControls (text_layout, |
| 773 | ATSUDrawText (text_layout, | ||
| 774 | kATSUFromTextBeginning, kATSUToTextEnd, | ||
| 775 | Long2Fix (x), Long2Fix (port_height - y)); | ||
| 776 | CGContextSynchronize (context); | ||
| 777 | QDEndCGContext (port, &context); | ||
| 778 | #if 0 | ||
| 779 | /* This doesn't work on Mac OS X 10.1. */ | ||
| 780 | ATSUClearLayoutControls (text_layout, | ||
| 781 | sizeof (tags) / sizeof (tags[0]), | 783 | sizeof (tags) / sizeof (tags[0]), |
| 782 | tags); | 784 | tags, sizes, values); |
| 785 | if (err == noErr) | ||
| 786 | ATSUDrawText (text_layout, | ||
| 787 | kATSUFromTextBeginning, kATSUToTextEnd, | ||
| 788 | Long2Fix (x), Long2Fix (port_height - y)); | ||
| 789 | CGContextSynchronize (context); | ||
| 790 | QDEndCGContext (port, &context); | ||
| 791 | #if 0 | ||
| 792 | /* This doesn't work on Mac OS X 10.1. */ | ||
| 793 | ATSUClearLayoutControls (text_layout, | ||
| 794 | sizeof (tags) / sizeof (tags[0]), tags); | ||
| 783 | #else | 795 | #else |
| 784 | ATSUSetLayoutControls (text_layout, | 796 | ATSUSetLayoutControls (text_layout, |
| 785 | sizeof (tags) / sizeof (tags[0]), | 797 | sizeof (tags) / sizeof (tags[0]), |
| 786 | tags, sizes, values); | 798 | tags, sizes, values); |
| 787 | #endif | ||
| 788 | } | ||
| 789 | #endif | 799 | #endif |
| 790 | } | 800 | } |
| 801 | #endif /* MAC_OSX */ | ||
| 791 | } | 802 | } |
| 792 | else | 803 | else |
| 804 | #endif /* USE_ATSUI */ | ||
| 793 | { | 805 | { |
| 806 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | ||
| 807 | UInt32 savedFlags; | ||
| 808 | |||
| 809 | if (mac_use_core_graphics) | ||
| 810 | savedFlags = SwapQDTextFlags (kQDUseCGTextRendering); | ||
| 794 | #endif | 811 | #endif |
| 795 | TextFont (GC_FONT (gc)->mac_fontnum); | 812 | mac_begin_clip (GC_CLIP_REGION (gc)); |
| 796 | TextSize (GC_FONT (gc)->mac_fontsize); | 813 | RGBForeColor (GC_FORE_COLOR (gc)); |
| 797 | TextFace (GC_FONT (gc)->mac_fontface); | 814 | #ifdef MAC_OS8 |
| 798 | TextMode (mode); | 815 | if (bg_width) |
| 816 | { | ||
| 817 | RGBBackColor (GC_BACK_COLOR (gc)); | ||
| 818 | TextMode (srcCopy); | ||
| 819 | } | ||
| 820 | else | ||
| 821 | TextMode (srcOr); | ||
| 822 | #else | ||
| 823 | /* We prefer not to use srcCopy text transfer mode on Mac OS X | ||
| 824 | because: | ||
| 825 | - Screen is double-buffered. (In srcCopy mode, a text is | ||
| 826 | drawn into an offscreen graphics world first. So | ||
| 827 | performance gain cannot be expected.) | ||
| 828 | - It lowers rendering quality. | ||
| 829 | - Some fonts leave garbage on cursor movement. */ | ||
| 830 | if (bg_width) | ||
| 831 | { | ||
| 832 | Rect r; | ||
| 799 | 833 | ||
| 800 | mac_begin_clip (GC_CLIP_REGION (gc)); | 834 | RGBBackColor (GC_BACK_COLOR (gc)); |
| 801 | MoveTo (x, y); | 835 | SetRect (&r, x, y - FONT_BASE (GC_FONT (gc)), |
| 802 | DrawText (buf, 0, nchars * bytes_per_char); | 836 | x + bg_width, y + FONT_DESCENT (GC_FONT (gc))); |
| 803 | mac_end_clip (GC_CLIP_REGION (gc)); | 837 | EraseRect (&r); |
| 804 | #if USE_ATSUI | 838 | } |
| 805 | } | 839 | TextMode (srcOr); |
| 806 | #endif | 840 | #endif |
| 841 | TextFont (GC_FONT (gc)->mac_fontnum); | ||
| 842 | TextSize (GC_FONT (gc)->mac_fontsize); | ||
| 843 | TextFace (GC_FONT (gc)->mac_fontface); | ||
| 844 | MoveTo (x, y); | ||
| 845 | DrawText (buf, 0, nchars * bytes_per_char); | ||
| 846 | if (bg_width) | ||
| 847 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); | ||
| 848 | mac_end_clip (GC_CLIP_REGION (gc)); | ||
| 807 | 849 | ||
| 808 | if (mode != srcOr) | ||
| 809 | RGBBackColor (GC_BACK_COLOR (FRAME_NORMAL_GC (f))); | ||
| 810 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 | 850 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 |
| 811 | if (mac_use_core_graphics) | 851 | if (mac_use_core_graphics) |
| 812 | SwapQDTextFlags(savedFlags); | 852 | SwapQDTextFlags(savedFlags); |
| 813 | #endif | 853 | #endif |
| 854 | } | ||
| 814 | } | 855 | } |
| 815 | 856 | ||
| 816 | 857 | ||
| @@ -824,7 +865,7 @@ mac_draw_string (f, gc, x, y, buf, nchars) | |||
| 824 | char *buf; | 865 | char *buf; |
| 825 | int nchars; | 866 | int nchars; |
| 826 | { | 867 | { |
| 827 | mac_draw_string_common (f, gc, x, y, buf, nchars, srcOr, 1); | 868 | mac_draw_string_common (f, gc, x, y, buf, nchars, 0, 1); |
| 828 | } | 869 | } |
| 829 | 870 | ||
| 830 | 871 | ||
| @@ -838,35 +879,35 @@ mac_draw_string_16 (f, gc, x, y, buf, nchars) | |||
| 838 | XChar2b *buf; | 879 | XChar2b *buf; |
| 839 | int nchars; | 880 | int nchars; |
| 840 | { | 881 | { |
| 841 | mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, srcOr, 2); | 882 | mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, 0, 2); |
| 842 | } | 883 | } |
| 843 | 884 | ||
| 844 | 885 | ||
| 845 | /* Mac replacement for XDrawImageString. */ | 886 | /* Mac replacement for XDrawImageString. */ |
| 846 | 887 | ||
| 847 | static void | 888 | static void |
| 848 | mac_draw_image_string (f, gc, x, y, buf, nchars) | 889 | mac_draw_image_string (f, gc, x, y, buf, nchars, bg_width) |
| 849 | struct frame *f; | 890 | struct frame *f; |
| 850 | GC gc; | 891 | GC gc; |
| 851 | int x, y; | 892 | int x, y; |
| 852 | char *buf; | 893 | char *buf; |
| 853 | int nchars; | 894 | int nchars, bg_width; |
| 854 | { | 895 | { |
| 855 | mac_draw_string_common (f, gc, x, y, buf, nchars, srcCopy, 1); | 896 | mac_draw_string_common (f, gc, x, y, buf, nchars, bg_width, 1); |
| 856 | } | 897 | } |
| 857 | 898 | ||
| 858 | 899 | ||
| 859 | /* Mac replacement for XDrawString16. */ | 900 | /* Mac replacement for XDrawString16. */ |
| 860 | 901 | ||
| 861 | static void | 902 | static void |
| 862 | mac_draw_image_string_16 (f, gc, x, y, buf, nchars) | 903 | mac_draw_image_string_16 (f, gc, x, y, buf, nchars, bg_width) |
| 863 | struct frame *f; | 904 | struct frame *f; |
| 864 | GC gc; | 905 | GC gc; |
| 865 | int x, y; | 906 | int x, y; |
| 866 | XChar2b *buf; | 907 | XChar2b *buf; |
| 867 | int nchars; | 908 | int nchars, bg_width; |
| 868 | { | 909 | { |
| 869 | mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, srcCopy, 2); | 910 | mac_draw_string_common (f, gc, x, y, (char *) buf, nchars, bg_width, 2); |
| 870 | } | 911 | } |
| 871 | 912 | ||
| 872 | 913 | ||
| @@ -1040,12 +1081,12 @@ init_cg_text_anti_aliasing_threshold () | |||
| 1040 | } | 1081 | } |
| 1041 | 1082 | ||
| 1042 | static int | 1083 | static int |
| 1043 | mac_draw_string_cg (f, gc, x, y, buf, nchars) | 1084 | mac_draw_image_string_cg (f, gc, x, y, buf, nchars, bg_width) |
| 1044 | struct frame *f; | 1085 | struct frame *f; |
| 1045 | GC gc; | 1086 | GC gc; |
| 1046 | int x, y; | 1087 | int x, y; |
| 1047 | XChar2b *buf; | 1088 | XChar2b *buf; |
| 1048 | int nchars; | 1089 | int nchars, bg_width; |
| 1049 | { | 1090 | { |
| 1050 | CGrafPtr port; | 1091 | CGrafPtr port; |
| 1051 | float port_height, gx, gy; | 1092 | float port_height, gx, gy; |
| @@ -1062,7 +1103,9 @@ mac_draw_string_cg (f, gc, x, y, buf, nchars) | |||
| 1062 | gx = x; | 1103 | gx = x; |
| 1063 | gy = port_height - y; | 1104 | gy = port_height - y; |
| 1064 | glyphs = (CGGlyph *)buf; | 1105 | glyphs = (CGGlyph *)buf; |
| 1065 | advances = xmalloc (sizeof (CGSize) * nchars); | 1106 | advances = alloca (sizeof (CGSize) * nchars); |
| 1107 | if (advances == NULL) | ||
| 1108 | return 0; | ||
| 1066 | for (i = 0; i < nchars; i++) | 1109 | for (i = 0; i < nchars; i++) |
| 1067 | { | 1110 | { |
| 1068 | XCharStruct *pcm = mac_per_char_metric (GC_FONT (gc), buf, 0); | 1111 | XCharStruct *pcm = mac_per_char_metric (GC_FONT (gc), buf, 0); |
| @@ -1074,18 +1117,32 @@ mac_draw_string_cg (f, gc, x, y, buf, nchars) | |||
| 1074 | } | 1117 | } |
| 1075 | 1118 | ||
| 1076 | QDBeginCGContext (port, &context); | 1119 | QDBeginCGContext (port, &context); |
| 1077 | if (gc->n_clip_rects) | 1120 | if (gc->n_clip_rects || bg_width) |
| 1078 | { | 1121 | { |
| 1079 | CGContextTranslateCTM (context, 0, port_height); | 1122 | CGContextTranslateCTM (context, 0, port_height); |
| 1080 | CGContextScaleCTM (context, 1, -1); | 1123 | CGContextScaleCTM (context, 1, -1); |
| 1081 | CGContextClipToRects (context, gc->clip_rects, gc->n_clip_rects); | 1124 | if (gc->n_clip_rects) |
| 1125 | CGContextClipToRects (context, gc->clip_rects, gc->n_clip_rects); | ||
| 1126 | if (bg_width) | ||
| 1127 | { | ||
| 1128 | CGContextSetRGBFillColor | ||
| 1129 | (context, | ||
| 1130 | RED_FROM_ULONG (gc->xgcv.background) / 255.0f, | ||
| 1131 | GREEN_FROM_ULONG (gc->xgcv.background) / 255.0f, | ||
| 1132 | BLUE_FROM_ULONG (gc->xgcv.background) / 255.0f, | ||
| 1133 | 1.0); | ||
| 1134 | CGContextFillRect | ||
| 1135 | (context, | ||
| 1136 | CGRectMake (gx, y - FONT_BASE (GC_FONT (gc)), | ||
| 1137 | bg_width, FONT_HEIGHT (GC_FONT (gc)))); | ||
| 1138 | } | ||
| 1082 | CGContextScaleCTM (context, 1, -1); | 1139 | CGContextScaleCTM (context, 1, -1); |
| 1083 | CGContextTranslateCTM (context, 0, -port_height); | 1140 | CGContextTranslateCTM (context, 0, -port_height); |
| 1084 | } | 1141 | } |
| 1085 | CGContextSetRGBFillColor (context, | 1142 | CGContextSetRGBFillColor (context, |
| 1086 | RED_FROM_ULONG (gc->xgcv.foreground) / 255.0, | 1143 | RED_FROM_ULONG (gc->xgcv.foreground) / 255.0f, |
| 1087 | GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0, | 1144 | GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0f, |
| 1088 | BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0, | 1145 | BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0f, |
| 1089 | 1.0); | 1146 | 1.0); |
| 1090 | CGContextSetFont (context, GC_FONT (gc)->cg_font); | 1147 | CGContextSetFont (context, GC_FONT (gc)->cg_font); |
| 1091 | CGContextSetFontSize (context, GC_FONT (gc)->mac_fontsize); | 1148 | CGContextSetFontSize (context, GC_FONT (gc)->mac_fontsize); |
| @@ -1104,8 +1161,6 @@ mac_draw_string_cg (f, gc, x, y, buf, nchars) | |||
| 1104 | CGContextSynchronize (context); | 1161 | CGContextSynchronize (context); |
| 1105 | QDEndCGContext (port, &context); | 1162 | QDEndCGContext (port, &context); |
| 1106 | 1163 | ||
| 1107 | xfree (advances); | ||
| 1108 | |||
| 1109 | return 1; | 1164 | return 1; |
| 1110 | } | 1165 | } |
| 1111 | #endif | 1166 | #endif |
| @@ -1377,10 +1432,7 @@ mac_set_clip_rectangles (display, gc, rectangles, n) | |||
| 1377 | if (n == 0) | 1432 | if (n == 0) |
| 1378 | { | 1433 | { |
| 1379 | if (gc->clip_region) | 1434 | if (gc->clip_region) |
| 1380 | { | 1435 | SetEmptyRgn (gc->clip_region); |
| 1381 | DisposeRgn (gc->clip_region); | ||
| 1382 | gc->clip_region = NULL; | ||
| 1383 | } | ||
| 1384 | } | 1436 | } |
| 1385 | else | 1437 | else |
| 1386 | { | 1438 | { |
| @@ -2324,14 +2376,6 @@ x_clear_glyph_string_rect (s, x, y, w, h) | |||
| 2324 | } | 2376 | } |
| 2325 | 2377 | ||
| 2326 | 2378 | ||
| 2327 | /* We prefer not to use XDrawImageString (srcCopy text transfer mode) | ||
| 2328 | on Mac OS X because: | ||
| 2329 | - Screen is double-buffered. (In srcCopy mode, a text is drawn | ||
| 2330 | into an offscreen graphics world first. So performance gain | ||
| 2331 | cannot be expected.) | ||
| 2332 | - It lowers rendering quality. | ||
| 2333 | - Some fonts leave garbage on cursor movement. */ | ||
| 2334 | |||
| 2335 | /* Draw the background of glyph_string S. If S->background_filled_p | 2379 | /* Draw the background of glyph_string S. If S->background_filled_p |
| 2336 | is non-zero don't draw it. FORCE_P non-zero means draw the | 2380 | is non-zero don't draw it. FORCE_P non-zero means draw the |
| 2337 | background even if it wouldn't be drawn normally. This is used | 2381 | background even if it wouldn't be drawn normally. This is used |
| @@ -2363,12 +2407,10 @@ x_draw_glyph_string_background (s, force_p) | |||
| 2363 | } | 2407 | } |
| 2364 | else | 2408 | else |
| 2365 | #endif | 2409 | #endif |
| 2366 | #if defined (MAC_OS8) && !USE_ATSUI | ||
| 2367 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width | 2410 | if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width |
| 2368 | || s->font_not_found_p | 2411 | || s->font_not_found_p |
| 2369 | || s->extends_to_end_of_line_p | 2412 | || s->extends_to_end_of_line_p |
| 2370 | || force_p) | 2413 | || force_p) |
| 2371 | #endif | ||
| 2372 | { | 2414 | { |
| 2373 | x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, | 2415 | x_clear_glyph_string_rect (s, s->x, s->y + box_line_width, |
| 2374 | s->background_width, | 2416 | s->background_width, |
| @@ -2385,7 +2427,7 @@ static void | |||
| 2385 | x_draw_glyph_string_foreground (s) | 2427 | x_draw_glyph_string_foreground (s) |
| 2386 | struct glyph_string *s; | 2428 | struct glyph_string *s; |
| 2387 | { | 2429 | { |
| 2388 | int i, x; | 2430 | int i, x, bg_width; |
| 2389 | 2431 | ||
| 2390 | /* If first glyph of S has a left box line, start drawing the text | 2432 | /* If first glyph of S has a left box line, start drawing the text |
| 2391 | of S to the right of that box line. */ | 2433 | of S to the right of that box line. */ |
| @@ -2424,7 +2466,6 @@ x_draw_glyph_string_foreground (s) | |||
| 2424 | for (i = 0; i < s->nchars; ++i) | 2466 | for (i = 0; i < s->nchars; ++i) |
| 2425 | char1b[i] = s->char2b[i].byte2; | 2467 | char1b[i] = s->char2b[i].byte2; |
| 2426 | 2468 | ||
| 2427 | #if defined (MAC_OS8) && !USE_ATSUI | ||
| 2428 | /* Draw text with XDrawString if background has already been | 2469 | /* Draw text with XDrawString if background has already been |
| 2429 | filled. Otherwise, use XDrawImageString. (Note that | 2470 | filled. Otherwise, use XDrawImageString. (Note that |
| 2430 | XDrawImageString is usually faster than XDrawString.) Always | 2471 | XDrawImageString is usually faster than XDrawString.) Always |
| @@ -2432,38 +2473,27 @@ x_draw_glyph_string_foreground (s) | |||
| 2432 | no chance that characters under a box cursor are invisible. */ | 2473 | no chance that characters under a box cursor are invisible. */ |
| 2433 | if (s->for_overlaps | 2474 | if (s->for_overlaps |
| 2434 | || (s->background_filled_p && s->hl != DRAW_CURSOR)) | 2475 | || (s->background_filled_p && s->hl != DRAW_CURSOR)) |
| 2435 | #endif | 2476 | bg_width = 0; /* Corresponds to XDrawString. */ |
| 2436 | { | 2477 | else |
| 2437 | /* Draw characters with 16-bit or 8-bit functions. */ | 2478 | bg_width = s->background_width; /* Corresponds to XDrawImageString. */ |
| 2438 | if (s->two_byte_p | 2479 | |
| 2480 | if (s->two_byte_p | ||
| 2439 | #if USE_ATSUI | 2481 | #if USE_ATSUI |
| 2440 | || GC_FONT (s->gc)->mac_style | 2482 | || GC_FONT (s->gc)->mac_style |
| 2441 | #endif | 2483 | #endif |
| 2442 | ) | 2484 | ) |
| 2443 | #if USE_CG_TEXT_DRAWING | 2485 | #if USE_CG_TEXT_DRAWING |
| 2444 | if (!s->two_byte_p | 2486 | if (!s->two_byte_p |
| 2445 | && mac_draw_string_cg (s->f, s->gc, x, s->ybase - boff, | 2487 | && mac_draw_image_string_cg (s->f, s->gc, x, s->ybase - boff, |
| 2446 | s->char2b, s->nchars)) | 2488 | s->char2b, s->nchars, bg_width)) |
| 2447 | ; | 2489 | ; |
| 2448 | else | 2490 | else |
| 2449 | #endif | 2491 | #endif |
| 2450 | mac_draw_string_16 (s->f, s->gc, x, s->ybase - boff, | 2492 | mac_draw_image_string_16 (s->f, s->gc, x, s->ybase - boff, |
| 2451 | s->char2b, s->nchars); | 2493 | s->char2b, s->nchars, bg_width); |
| 2452 | else | ||
| 2453 | mac_draw_string (s->f, s->gc, x, s->ybase - boff, | ||
| 2454 | char1b, s->nchars); | ||
| 2455 | } | ||
| 2456 | #if defined (MAC_OS8) && !USE_ATSUI | ||
| 2457 | else | 2494 | else |
| 2458 | { | 2495 | mac_draw_image_string (s->f, s->gc, x, s->ybase - boff, |
| 2459 | if (s->two_byte_p) | 2496 | char1b, s->nchars, bg_width); |
| 2460 | mac_draw_image_string_16 (s->f, s->gc, x, s->ybase - boff, | ||
| 2461 | s->char2b, s->nchars); | ||
| 2462 | else | ||
| 2463 | mac_draw_image_string (s->f, s->gc, x, s->ybase - boff, | ||
| 2464 | char1b, s->nchars); | ||
| 2465 | } | ||
| 2466 | #endif | ||
| 2467 | } | 2497 | } |
| 2468 | } | 2498 | } |
| 2469 | 2499 | ||
| @@ -7856,9 +7886,13 @@ XLoadQueryFont (Display *dpy, char *fontname) | |||
| 7856 | #if !defined (MAC_OS8) || USE_ATSUI | 7886 | #if !defined (MAC_OS8) || USE_ATSUI |
| 7857 | /* AppKit and WebKit do some adjustment to the heights of Courier, | 7887 | /* AppKit and WebKit do some adjustment to the heights of Courier, |
| 7858 | Helvetica, and Times. This only works on the environments where | 7888 | Helvetica, and Times. This only works on the environments where |
| 7859 | the XDrawImageString counterpart is never used. */ | 7889 | srcCopy text transfer mode is never used. */ |
| 7860 | if (strcmp (family, "courier") == 0 || strcmp (family, "helvetica") == 0 | 7890 | if ( |
| 7861 | || strcmp (family, "times") == 0) | 7891 | #ifdef MAC_OS8 /* implies USE_ATSUI */ |
| 7892 | font->mac_style && | ||
| 7893 | #endif | ||
| 7894 | (strcmp (family, "courier") == 0 || strcmp (family, "helvetica") == 0 | ||
| 7895 | || strcmp (family, "times") == 0)) | ||
| 7862 | font->ascent += (font->ascent + font->descent) * .15 + 0.5; | 7896 | font->ascent += (font->ascent + font->descent) * .15 + 0.5; |
| 7863 | #endif | 7897 | #endif |
| 7864 | 7898 | ||
diff --git a/src/puresize.h b/src/puresize.h index da81e09a345..93dac70c123 100644 --- a/src/puresize.h +++ b/src/puresize.h | |||
| @@ -43,7 +43,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 43 | #endif | 43 | #endif |
| 44 | 44 | ||
| 45 | #ifndef BASE_PURESIZE | 45 | #ifndef BASE_PURESIZE |
| 46 | #define BASE_PURESIZE (1190000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) | 46 | #define BASE_PURESIZE (1200000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ | 49 | /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ |
diff --git a/src/regex.c b/src/regex.c index 3548ad3c048..48baacd81e2 100644 --- a/src/regex.c +++ b/src/regex.c | |||
| @@ -197,6 +197,51 @@ char *malloc (); | |||
| 197 | char *realloc (); | 197 | char *realloc (); |
| 198 | # endif | 198 | # endif |
| 199 | 199 | ||
| 200 | /* When used in Emacs's lib-src, we need xmalloc and xrealloc. */ | ||
| 201 | |||
| 202 | void * | ||
| 203 | xmalloc (size) | ||
| 204 | size_t size; | ||
| 205 | { | ||
| 206 | register void *val; | ||
| 207 | val = (void *) malloc (size); | ||
| 208 | if (!val && size) | ||
| 209 | { | ||
| 210 | write (2, "virtual memory exhausted\n", 25); | ||
| 211 | exit (1); | ||
| 212 | } | ||
| 213 | return val; | ||
| 214 | } | ||
| 215 | |||
| 216 | void * | ||
| 217 | xrealloc (block, size) | ||
| 218 | void *block; | ||
| 219 | size_t size; | ||
| 220 | { | ||
| 221 | register void *val; | ||
| 222 | /* We must call malloc explicitly when BLOCK is 0, since some | ||
| 223 | reallocs don't do this. */ | ||
| 224 | if (! block) | ||
| 225 | val = (void *) malloc (size); | ||
| 226 | else | ||
| 227 | val = (void *) realloc (block, size); | ||
| 228 | if (!val && size) | ||
| 229 | { | ||
| 230 | write (2, "virtual memory exhausted\n", 25); | ||
| 231 | exit (1); | ||
| 232 | } | ||
| 233 | return val; | ||
| 234 | } | ||
| 235 | |||
| 236 | # ifdef malloc | ||
| 237 | # undef malloc | ||
| 238 | # endif | ||
| 239 | # define malloc xmalloc | ||
| 240 | # ifdef realloc | ||
| 241 | # undef realloc | ||
| 242 | # endif | ||
| 243 | # define realloc xrealloc | ||
| 244 | |||
| 200 | /* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. | 245 | /* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. |
| 201 | If nothing else has been done, use the method below. */ | 246 | If nothing else has been done, use the method below. */ |
| 202 | # ifdef INHIBIT_STRING_HEADER | 247 | # ifdef INHIBIT_STRING_HEADER |
diff --git a/src/vm-limit.c b/src/vm-limit.c index fb127b27b74..48d13c323ae 100644 --- a/src/vm-limit.c +++ b/src/vm-limit.c | |||
| @@ -33,6 +33,10 @@ typedef void *POINTER; | |||
| 33 | 33 | ||
| 34 | #include "mem-limits.h" | 34 | #include "mem-limits.h" |
| 35 | 35 | ||
| 36 | #ifdef HAVE_GETRLIMIT | ||
| 37 | #include <sys/resource.h> | ||
| 38 | #endif | ||
| 39 | |||
| 36 | /* | 40 | /* |
| 37 | Level number of warnings already issued. | 41 | Level number of warnings already issued. |
| 38 | 0 -- no warnings issued. | 42 | 0 -- no warnings issued. |
| @@ -61,6 +65,19 @@ check_memory_limits () | |||
| 61 | unsigned long five_percent; | 65 | unsigned long five_percent; |
| 62 | unsigned long data_size; | 66 | unsigned long data_size; |
| 63 | 67 | ||
| 68 | #ifdef HAVE_GETRLIMIT | ||
| 69 | struct rlimit { | ||
| 70 | rlim_t rlim_cur; | ||
| 71 | rlim_t rlim_max; | ||
| 72 | } rlimit; | ||
| 73 | |||
| 74 | getrlimit (RLIMIT_DATA, &rlimit); | ||
| 75 | |||
| 76 | five_percent = rlimit.rlim_max / 20; | ||
| 77 | data_size = rlimit.rlim_cur; | ||
| 78 | |||
| 79 | #else /* not HAVE_GETRLIMIT */ | ||
| 80 | |||
| 64 | if (lim_data == 0) | 81 | if (lim_data == 0) |
| 65 | get_lim_data (); | 82 | get_lim_data (); |
| 66 | five_percent = lim_data / 20; | 83 | five_percent = lim_data / 20; |
| @@ -74,6 +91,8 @@ check_memory_limits () | |||
| 74 | cp = (char *) (*__morecore) (0); | 91 | cp = (char *) (*__morecore) (0); |
| 75 | data_size = (char *) cp - (char *) data_space_start; | 92 | data_size = (char *) cp - (char *) data_space_start; |
| 76 | 93 | ||
| 94 | #endif /* not HAVE_GETRLIMIT */ | ||
| 95 | |||
| 77 | if (warn_function) | 96 | if (warn_function) |
| 78 | switch (warnlevel) | 97 | switch (warnlevel) |
| 79 | { | 98 | { |
diff --git a/src/window.c b/src/window.c index c21e95cbef0..bd5a393b599 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -2568,7 +2568,10 @@ window_min_size_1 (w, width_p) | |||
| 2568 | else | 2568 | else |
| 2569 | { | 2569 | { |
| 2570 | if (width_p) | 2570 | if (width_p) |
| 2571 | size = window_min_width; | 2571 | size = max (window_min_width, |
| 2572 | (MIN_SAFE_WINDOW_WIDTH | ||
| 2573 | + WINDOW_FRINGE_COLS (w) | ||
| 2574 | + WINDOW_SCROLL_BAR_COLS (w))); | ||
| 2572 | else | 2575 | else |
| 2573 | { | 2576 | { |
| 2574 | if (MINI_WINDOW_P (w) | 2577 | if (MINI_WINDOW_P (w) |
| @@ -4286,7 +4289,7 @@ adjust_window_trailing_edge (window, delta, horiz_flag) | |||
| 4286 | { | 4289 | { |
| 4287 | /* This may happen for the minibuffer. In that case | 4290 | /* This may happen for the minibuffer. In that case |
| 4288 | the window_deletion_count check below does not work. */ | 4291 | the window_deletion_count check below does not work. */ |
| 4289 | if (XINT (CURSIZE (p->next)) - delta <= 0) | 4292 | if (XINT (CURSIZE (p->next)) - delta <= 0) |
| 4290 | { | 4293 | { |
| 4291 | Fset_window_configuration (old_config); | 4294 | Fset_window_configuration (old_config); |
| 4292 | error ("Cannot adjust window size as specified"); | 4295 | error ("Cannot adjust window size as specified"); |
| @@ -6600,7 +6603,8 @@ this is automatically adjusted to a multiple of the frame column width. | |||
| 6600 | Third parameter VERTICAL-TYPE specifies the type of the vertical scroll | 6603 | Third parameter VERTICAL-TYPE specifies the type of the vertical scroll |
| 6601 | bar: left, right, or nil. | 6604 | bar: left, right, or nil. |
| 6602 | If WIDTH is nil, use the frame's scroll-bar width. | 6605 | If WIDTH is nil, use the frame's scroll-bar width. |
| 6603 | If TYPE is t, use the frame's scroll-bar type. */) | 6606 | If VERTICAL-TYPE is t, use the frame's scroll-bar type. |
| 6607 | Fourth parameter HORIZONTAL-TYPE is currently unused. */) | ||
| 6604 | (window, width, vertical_type, horizontal_type) | 6608 | (window, width, vertical_type, horizontal_type) |
| 6605 | Lisp_Object window, width, vertical_type, horizontal_type; | 6609 | Lisp_Object window, width, vertical_type, horizontal_type; |
| 6606 | { | 6610 | { |
diff --git a/src/xdisp.c b/src/xdisp.c index ff2c7d299e5..8c19b0976c8 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -9158,14 +9158,15 @@ update_menu_bar (f, save_match_data) | |||
| 9158 | /* Redisplay the menu bar in case we changed it. */ | 9158 | /* Redisplay the menu bar in case we changed it. */ |
| 9159 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ | 9159 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) || defined (MAC_OS) \ |
| 9160 | || defined (USE_GTK) | 9160 | || defined (USE_GTK) |
| 9161 | if (FRAME_WINDOW_P (f) | 9161 | if (FRAME_WINDOW_P (f)) |
| 9162 | #if defined (MAC_OS) | 9162 | { |
| 9163 | /* All frames on Mac OS share the same menubar. So only the | 9163 | #ifdef MAC_OS |
| 9164 | selected frame should be allowed to set it. */ | 9164 | /* All frames on Mac OS share the same menubar. So only |
| 9165 | && f == SELECTED_FRAME () | 9165 | the selected frame should be allowed to set it. */ |
| 9166 | if (f == SELECTED_FRAME ()) | ||
| 9166 | #endif | 9167 | #endif |
| 9167 | ) | 9168 | set_frame_menubar (f, 0, 0); |
| 9168 | set_frame_menubar (f, 0, 0); | 9169 | } |
| 9169 | else | 9170 | else |
| 9170 | /* On a terminal screen, the menu bar is an ordinary screen | 9171 | /* On a terminal screen, the menu bar is an ordinary screen |
| 9171 | line, and this makes it get updated. */ | 9172 | line, and this makes it get updated. */ |
| @@ -16572,8 +16573,11 @@ display_mode_element (it, depth, field_width, precision, elt, props, risky) | |||
| 16572 | { | 16573 | { |
| 16573 | int bytepos = last_offset; | 16574 | int bytepos = last_offset; |
| 16574 | int charpos = string_byte_to_char (elt, bytepos); | 16575 | int charpos = string_byte_to_char (elt, bytepos); |
| 16576 | |||
| 16577 | if (precision <= 0) | ||
| 16578 | nchars = string_byte_to_char (elt, offset) - charpos; | ||
| 16575 | n += display_string (NULL, elt, Qnil, 0, charpos, | 16579 | n += display_string (NULL, elt, Qnil, 0, charpos, |
| 16576 | it, 0, prec, 0, | 16580 | it, 0, nchars, 0, |
| 16577 | STRING_MULTIBYTE (elt)); | 16581 | STRING_MULTIBYTE (elt)); |
| 16578 | } | 16582 | } |
| 16579 | break; | 16583 | break; |
| @@ -17825,7 +17829,7 @@ display_count_lines (start, start_byte, limit_byte, count, byte_pos_ptr) | |||
| 17825 | display them, and < 0 means obey the current buffer's value of | 17829 | display them, and < 0 means obey the current buffer's value of |
| 17826 | enable_multibyte_characters. | 17830 | enable_multibyte_characters. |
| 17827 | 17831 | ||
| 17828 | Value is the number of glyphs produced. */ | 17832 | Value is the number of columns displayed. */ |
| 17829 | 17833 | ||
| 17830 | static int | 17834 | static int |
| 17831 | display_string (string, lisp_string, face_string, face_string_pos, | 17835 | display_string (string, lisp_string, face_string, face_string_pos, |
diff --git a/src/xfns.c b/src/xfns.c index 2577272c122..cbdfa56dec4 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -5313,6 +5313,7 @@ or directory must exist. ONLY-DIR-P is ignored." */) | |||
| 5313 | int result; | 5313 | int result; |
| 5314 | struct frame *f = SELECTED_FRAME (); | 5314 | struct frame *f = SELECTED_FRAME (); |
| 5315 | Lisp_Object file = Qnil; | 5315 | Lisp_Object file = Qnil; |
| 5316 | Lisp_Object decoded_file; | ||
| 5316 | Widget dialog, text, help; | 5317 | Widget dialog, text, help; |
| 5317 | Arg al[10]; | 5318 | Arg al[10]; |
| 5318 | int ac = 0; | 5319 | int ac = 0; |
| @@ -5453,7 +5454,9 @@ or directory must exist. ONLY-DIR-P is ignored." */) | |||
| 5453 | if (NILP (file)) | 5454 | if (NILP (file)) |
| 5454 | Fsignal (Qquit, Qnil); | 5455 | Fsignal (Qquit, Qnil); |
| 5455 | 5456 | ||
| 5456 | return unbind_to (count, file); | 5457 | decoded_file = DECODE_FILE (file); |
| 5458 | |||
| 5459 | return unbind_to (count, decoded_file); | ||
| 5457 | } | 5460 | } |
| 5458 | 5461 | ||
| 5459 | #endif /* USE_MOTIF */ | 5462 | #endif /* USE_MOTIF */ |
| @@ -5481,6 +5484,7 @@ directories. */) | |||
| 5481 | FRAME_PTR f = SELECTED_FRAME (); | 5484 | FRAME_PTR f = SELECTED_FRAME (); |
| 5482 | char *fn; | 5485 | char *fn; |
| 5483 | Lisp_Object file = Qnil; | 5486 | Lisp_Object file = Qnil; |
| 5487 | Lisp_Object decoded_file; | ||
| 5484 | int count = SPECPDL_INDEX (); | 5488 | int count = SPECPDL_INDEX (); |
| 5485 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; | 5489 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; |
| 5486 | char *cdef_file; | 5490 | char *cdef_file; |
| @@ -5521,7 +5525,9 @@ directories. */) | |||
| 5521 | if (NILP (file)) | 5525 | if (NILP (file)) |
| 5522 | Fsignal (Qquit, Qnil); | 5526 | Fsignal (Qquit, Qnil); |
| 5523 | 5527 | ||
| 5524 | return unbind_to (count, file); | 5528 | decoded_file = DECODE_FILE (file); |
| 5529 | |||
| 5530 | return unbind_to (count, decoded_file); | ||
| 5525 | } | 5531 | } |
| 5526 | 5532 | ||
| 5527 | #endif /* USE_GTK */ | 5533 | #endif /* USE_GTK */ |
diff --git a/src/xmenu.c b/src/xmenu.c index a311a1cfa6a..156c44c9bb0 100644 --- a/src/xmenu.c +++ b/src/xmenu.c | |||
| @@ -1807,8 +1807,11 @@ digest_single_submenu (start, end, top_level_items) | |||
| 1807 | wv->enabled = 1; | 1807 | wv->enabled = 1; |
| 1808 | wv->button_type = BUTTON_TYPE_NONE; | 1808 | wv->button_type = BUTTON_TYPE_NONE; |
| 1809 | wv->help = Qnil; | 1809 | wv->help = Qnil; |
| 1810 | save_wv = wv; | ||
| 1810 | } | 1811 | } |
| 1811 | save_wv = wv; | 1812 | else |
| 1813 | save_wv = first_wv; | ||
| 1814 | |||
| 1812 | prev_wv = 0; | 1815 | prev_wv = 0; |
| 1813 | i += MENU_ITEMS_PANE_LENGTH; | 1816 | i += MENU_ITEMS_PANE_LENGTH; |
| 1814 | } | 1817 | } |
diff --git a/src/xterm.c b/src/xterm.c index f839e222a47..640d7c553da 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -7567,7 +7567,7 @@ x_catch_errors (dpy) | |||
| 7567 | Display *dpy; | 7567 | Display *dpy; |
| 7568 | { | 7568 | { |
| 7569 | int count = SPECPDL_INDEX (); | 7569 | int count = SPECPDL_INDEX (); |
| 7570 | struct x_error_message_stack *data = malloc (sizeof (*data)); | 7570 | struct x_error_message_stack *data = xmalloc (sizeof (*data)); |
| 7571 | Lisp_Object dummy; | 7571 | Lisp_Object dummy; |
| 7572 | #ifdef ENABLE_CHECKING | 7572 | #ifdef ENABLE_CHECKING |
| 7573 | dummy = make_number ((EMACS_INT)dpy + (EMACS_INT)x_error_message); | 7573 | dummy = make_number ((EMACS_INT)dpy + (EMACS_INT)x_error_message); |