aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/.gdbinit11
-rw-r--r--src/ChangeLog187
-rw-r--r--src/dispextern.h9
-rw-r--r--src/dispnew.c2
-rw-r--r--src/editfns.c2
-rw-r--r--src/frame.c8
-rw-r--r--src/image.c136
-rw-r--r--src/keymap.c9
-rw-r--r--src/mac.c50
-rw-r--r--src/macfns.c104
-rw-r--r--src/macgui.h38
-rw-r--r--src/macmenu.c58
-rw-r--r--src/macterm.c241
-rw-r--r--src/macterm.h8
-rw-r--r--src/process.h6
-rw-r--r--src/puresize.h2
-rw-r--r--src/s/ms-w32.h6
-rw-r--r--src/syntax.c7
-rw-r--r--src/unexmacosx.c3
-rw-r--r--src/w32fns.c2
-rw-r--r--src/w32term.c6
-rw-r--r--src/window.c2
-rw-r--r--src/xdisp.c61
-rw-r--r--src/xmenu.c1
24 files changed, 757 insertions, 202 deletions
diff --git a/src/.gdbinit b/src/.gdbinit
index af2114ebd18..881a11dc8c0 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -88,15 +88,13 @@ end
88# Print out s-expressions from tool bar 88# Print out s-expressions from tool bar
89define pp1 89define pp1
90 set $tmp = $arg0 90 set $tmp = $arg0
91 echo $arg0
92 printf " = "
93 set $output_debug = print_output_debug_flag 91 set $output_debug = print_output_debug_flag
94 set print_output_debug_flag = 0 92 set print_output_debug_flag = 0
95 set safe_debug_print ($tmp) 93 set safe_debug_print ($tmp)
96 set print_output_debug_flag = $output_debug 94 set print_output_debug_flag = $output_debug
97end 95end
98document pp1 96document pp1
99Print the argument as an emacs s-expression 97Print the argument as an emacs s-expression.
100Works only when an inferior emacs is executing. 98Works only when an inferior emacs is executing.
101For use on tool bar when debugging in Emacs 99For use on tool bar when debugging in Emacs
102where the variable name would not otherwise 100where the variable name would not otherwise
@@ -119,8 +117,6 @@ end
119# Print value of lisp variable 117# Print value of lisp variable
120define pv1 118define pv1
121 set $tmp = "$arg0" 119 set $tmp = "$arg0"
122 echo $arg0
123 printf " = "
124 set $output_debug = print_output_debug_flag 120 set $output_debug = print_output_debug_flag
125 set print_output_debug_flag = 0 121 set print_output_debug_flag = 0
126 set safe_debug_print (find_symbol_value (intern ($tmp))) 122 set safe_debug_print (find_symbol_value (intern ($tmp)))
@@ -129,9 +125,8 @@ end
129document pv1 125document pv1
130Print the value of the lisp variable given as argument. 126Print the value of the lisp variable given as argument.
131Works only when an inferior emacs is executing. 127Works only when an inferior emacs is executing.
132For use on tool bar when debugging in Emacs 128For use when debugging in Emacs where the variable
133where the variable name would not otherwise 129name would not otherwise be recorded in the GUD buffer.
134be recorded in the GUD buffer.
135end 130end
136 131
137# Print out current buffer point and boundaries 132# Print out current buffer point and boundaries
diff --git a/src/ChangeLog b/src/ChangeLog
index 5c66a6b5c7d..f68510f2fb4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,11 +1,172 @@
12006-05-02 Andreas Schwab <schwab@suse.de>
2
3 * xmenu.c (restore_menu_items): Return a value.
4
52006-05-01 Martin Rudalics <rudalics@gmx.at>
6
7 * syntax.c (Fforward_comment): Detect generic comment at beginning of
8 buffer when moving backwards.
9
102006-05-01 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
11
12 * dispnew.c (update_window): Don't set changed_p when mode/header
13 line is updated.
14
15 * xdisp.c (prepare_menu_bars) [MAC_OS]: Call mac_update_title_bar.
16 (get_glyph_face_and_encoding, get_char_face_and_encoding):
17 Don't distinguish known faces from others.
18
19 * mac.c (mac_coerce_file_name_ptr): Try typeFSRef if coercion
20 through typeFileURL failed.
21
22 * macfns.c (mac_update_title_bar): New function.
23 [TARGET_API_MAC_CARBON] (mac_update_proxy_icon): New function.
24 (show_hourglass, hide_hourglass) [USE_CG_DRAWING]:
25 Call mac_prepare_for_quickdraw.
26
27 * macgui.h (USE_ATSUI): Set default to 1 if MAC_OSX is defined.
28 (USE_CG_DRAWING): Don't define if compiled on Mac OS X 10.1.
29 (enum pcm_status): New enum.
30 (XCHARSTRUCTROW_CHAR_VALID_P, XCHARSTRUCTROW_SET_CHAR_VALID)
31 (XCharStructRow): Remove. Now validity is represented by
32 non-negativeness of sum of ascent and descent.
33 (struct MacFontStruct): Change type of member `rows'.
34 (struct _XGC) [USE_CG_DRAWING]: Add member `clip_rects'.
35
36 * macterm.c (mac_draw_line, mac_draw_line_to_pixmap):
37 Adjust endpoints of strictly horizontal/vertical lines.
38 (mac_set_clip_rectangles) [USE_CG_DRAWING]: Set clip_rects.
39 (pcm_init, pcm_get_status): New functions.
40 (x_per_char_metric, XLoadQueryFont): Use them instead of
41 XCharStructRow and related macros.
42 (x_draw_relief_rect): Don't adjust arguments of mac_draw_line.
43 (x_free_frame_resources) [TARGET_API_MAC_CARBON]: Free FRAME_FILE_NAME.
44 (XTread_socket) [TARGET_API_MAC_CARBON]: Handle proxy icon drag
45 and window path pop-up menu on title bar.
46 (mac_use_core_graphics) [USE_CG_DRAWING]: Set default to 1.
47
48 * macterm.h (mac_update_title_bar): Add extern.
49 (struct mac_output) [TARGET_API_MAC_CARBON]: New member `file_name'.
50 (FRAME_FILE_NAME): New macro.
51
52 * unexmacosx.c (unexec): Error if trying unexec from dumped executable.
53
542006-04-30 Richard Stallman <rms@gnu.org>
55
56 * keymap.c (Fdefine_key): Improve error message
57 when KEY begins with a non-prefix key.
58
592006-04-30 Martin Rudalics <rudalics@gmx.at>
60
61 * syntax.c (Fforward_comment): Don't forget to break out of the loop
62 when we skipped backward over a generic comment.
63
642006-04-27 Nick Roberts <nickrob@snap.net.nz>
65
66 * .gdbinit (pp1, pv1): Only print value as expression is now
67 printed out by gud-print.
68 (pv1): Correct doc string.
69
702006-04-26 Stefan Monnier <monnier@iro.umontreal.ca>
71
72 * keymap.c (store_in_keymap): Change `def' arg to not be `register'.
73 Seems to trigger a bug in gcc-amd64 4.0.2 20051125 (Red Hat 4.0.2-8):
74 keymap.c:895: error: address of register variable `def' requested.
75
762006-04-26 Jason Rumney <jasonr@gnu.org>
77
78 * w32term.c (construct_mouse_wheel): Handle negative coordinates.
79
80 * w32fns.c (w32_wnd_proc) <WM_LBUTTONDOWN, WM_RBUTTONDOWN>:
81 <WM_LBUTTONUP, WM_RBUTTONUP>: Call signal_user_input in the cases
82 where we preempt mouse_button_timer.
83
842006-04-25 Miles Bader <miles@gnu.org>
85
86 * editfns.c (Ffield_beginning, find_field): Undo change of 2006-04-23.
87
882006-04-24 Stefan Monnier <monnier@iro.umontreal.ca>
89
90 * process.h: Include headers for pid_t.
91
922006-04-24 Kim F. Storm <storm@cua.dk>
93
94 * xdisp.c (fill_stretch_glyph_string): Set s->nchars = 1 for code which
95 does last_glyph=s->first_glyph+s->nchars-1, e.g. if stretch has relief.
96 (produce_stretch_glyph): Assume that face box height and width is
97 already included in stretch glyph size so caller doesn't have to
98 consider the extra space otherwise added (fixes problem in ses.el).
99
100 * frame.c (x_set_font): Clear f->n_tool_bar_rows and current frame
101 matrices to force recalculation of tool-bar height after font change.
102
103 * xdisp.c (tool_bar_lines_needed): New local `temp_row' for clarity.
104 Clear it when done, so we don't accidentally draw a second copy of
105 the tool-bar after resetting f->n_tool_bar_rows.
106 (redisplay_tool_bar): Update tool-bar-lines frame parameter whenever
107 we recalculate f->n_tool_bar_rows.
108
1092006-04-23 Lars Hansen <larsh@soem.dk>
110
111 * editfns.c (find_field): Fix comment.
112 (Ffield_beginning): Fix bug when POS is at field beginning.
113
1142006-04-22 Eli Zaretskii <eliz@gnu.org>
115
116 * puresize.h (BASE_PURESIZE): Increase to 1205000.
117
1182006-04-21 Kim F. Storm <storm@cua.dk>
119
120 * xdisp.c (redisplay_window): Fix last change. Don't recenter if
121 window start is at BEGV.
122
123 * dispextern.h (struct image): New member `corners'.
124 (TOP_CORNER, LEFT_CORNER, BOT_CORNER, RIGHT_CORNER): New macros.
125
126 * image.c (four_corners_best): New arg CORNERS specifies what pixels
127 to look at in case image has margin.
128 (x_create_bitmap_mask): Pass NULL for CORNERS to four_corners_best.
129 (image_background, image_background_transparent)
130 (x_build_heuristic_mask): Pass img->corners to four_corners_best.
131 (gif_load): Set img->corners according to image's margin spec.
132 Use img->corners values directly where applicable.
133 Save image extension data in img->data.lisp_val.
134 (gif_clear_image): New function to free img->data.lisp_val.
135 (gif_type): Use it instead of generic x_clear_image.
136 (Fimage_extension_data): New defun.
137 (syms_of_image): Defsubr it.
138
1392006-04-21 John Sullivan <john@wjsullivan.net> (tiny change)
140
141 * window.c (Fdisplay_buffer): Doc fix.
142
1432006-04-21 Eli Zaretskii <eliz@gnu.org>
144
145 * s/ms-w32.h (SYSTEM_PURESIZE_EXTRA): Increase to 25000.
146
1472006-04-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
148
149 * image.c [MAC_OS] (xpm_load_image): Fill in background field
150 while we have ximg handy.
151
152 * macmenu.c (restore_menu_items, save_menu_items): New functions
153 from xmenu.c.
154 (set_frame_menubar, digest_single_submenu): Apply 2006-04-18
155 changes for xmenu.c.
156
157 * macterm.c (x_per_char_metric): Return NULL if glyph width is 0.
158 (add_mac_font_name): New function.
159 (init_font_name_table): Use it. Adopt the first found font from
160 those having the same family name.
161
12006-04-21 Nick Roberts <nickrob@snap.net.nz> 1622006-04-21 Nick Roberts <nickrob@snap.net.nz>
2 163
3 * xdisp.c (note_mouse_highlight): Use build_string. 164 * xdisp.c (note_mouse_highlight): Use build_string.
4 165
52006-04-20 Lars Hansen <larsh@soem.dk> 1662006-04-20 Lars Hansen <larsh@soem.dk>
6 167
7 * textprop.c (Fremove_list_of_text_properties): Ensure 168 * textprop.c (Fremove_list_of_text_properties):
8 modify_region is called only when buffer is modified and that 169 Ensure modify_region is called only when buffer is modified and that
9 signal_after_change is allways called in that case. 170 signal_after_change is allways called in that case.
10 171
11 * print.c (PRINTFINISH): Call signal_after_change. 172 * print.c (PRINTFINISH): Call signal_after_change.
@@ -23,8 +184,8 @@
23 184
24 * xmenu.c (restore_menu_items, save_menu_items): New fns. 185 * xmenu.c (restore_menu_items, save_menu_items): New fns.
25 (set_frame_menubar): Use save_menu_items. Save updated vector in 186 (set_frame_menubar): Use save_menu_items. Save updated vector in
26 the frame before unwinding it. Don't use unuse_menu_items. Don't 187 the frame before unwinding it. Don't use unuse_menu_items.
27 use discard_menu_items. 188 Don't use discard_menu_items.
28 (digest_single_submenu): Abort if an item is not in a pane. 189 (digest_single_submenu): Abort if an item is not in a pane.
29 (init_menu_items): Put the error check at the top. 190 (init_menu_items): Put the error check at the top.
30 191
@@ -51,8 +212,8 @@
51 212
52 * macterm.c (XCreateGC, x_per_char_metric, xlfdpat_create) 213 * macterm.c (XCreateGC, x_per_char_metric, xlfdpat_create)
53 (init_font_name_table, init_font_name_table, mac_do_list_fonts) 214 (init_font_name_table, init_font_name_table, mac_do_list_fonts)
54 (XLoadQueryFont, mac_store_apple_event): Don't check 215 (XLoadQueryFont, mac_store_apple_event): Don't check return value
55 return value of xmalloc. 216 of xmalloc.
56 217
572006-04-17 Kim F. Storm <storm@cua.dk> 2182006-04-17 Kim F. Storm <storm@cua.dk>
58 219
@@ -96,8 +257,7 @@
962006-04-13 Kenichi Handa <handa@m17n.org> 2572006-04-13 Kenichi Handa <handa@m17n.org>
97 258
98 * coding.c (setup_coding_system): Fix previous change. 259 * coding.c (setup_coding_system): Fix previous change.
99 (encode_coding): If eol_type is not yet decided, use 260 (encode_coding): If eol_type is not yet decided, use system_eol_type.
100 system_eol_type.
101 (shrink_encoding_region): If eol_type is not yet decided and 261 (shrink_encoding_region): If eol_type is not yet decided and
102 system_eol_type is not LF, don't shrink. 262 system_eol_type is not LF, don't shrink.
103 263
@@ -197,8 +357,8 @@
197 within ||. Add explicit braces to avoid ambiguous `else'. 357 within ||. Add explicit braces to avoid ambiguous `else'.
198 (dump_glyph_row): Remove label for `inverse_p' from legend. 358 (dump_glyph_row): Remove label for `inverse_p' from legend.
199 359
200 * xfaces.c (Finternal_merge_in_global_face, try_font_list): Add 360 * xfaces.c (Finternal_merge_in_global_face, try_font_list):
201 explicit braces to avoid ambiguous `else'. 361 Add explicit braces to avoid ambiguous `else'.
202 362
2032006-04-11 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change) 3632006-04-11 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change)
204 364
@@ -907,11 +1067,6 @@
907 (mac_set_clip_rectangles): When resetting clip region, make it 1067 (mac_set_clip_rectangles): When resetting clip region, make it
908 empty instead of disposing of it. 1068 empty instead of disposing of it.
909 1069
9102006-02-20 Stefan Monnier <monnier@iro.umontreal.ca>
911
912 * keymap.c (store_in_keymap): Change `def' arg to not be `register'.
913 Seems to trigger a bug in gcc-amd64 4.0.2 20051125 (Red Hat 4.0.2-8).
914
9152006-02-20 Kim F. Storm <storm@cua.dk> 10702006-02-20 Kim F. Storm <storm@cua.dk>
916 1071
917 * Makefile.in: Add fringe.elc to WINDOW_SUPPORT. 1072 * Makefile.in: Add fringe.elc to WINDOW_SUPPORT.
@@ -1586,7 +1741,7 @@
1586 1741
1587 * image.c [MAC_OS] (find_image_fsspec): Likewise. 1742 * image.c [MAC_OS] (find_image_fsspec): Likewise.
1588 1743
15892005-12-23 Martin Rudalics <rudalics@gmx.at> (tiny change) 17442005-12-23 Martin Rudalics <rudalics@gmx.at>
1590 1745
1591 * insdel.c (insert, insert_and_inherit, insert_before_markers) 1746 * insdel.c (insert, insert_and_inherit, insert_before_markers)
1592 (insert_before_markers_and_inherit): Make sure FROM is correct 1747 (insert_before_markers_and_inherit): Make sure FROM is correct
diff --git a/src/dispextern.h b/src/dispextern.h
index f6b0fbbbf15..b1e71315086 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2417,6 +2417,15 @@ struct image
2417#define DEFAULT_IMAGE_WIDTH 30 2417#define DEFAULT_IMAGE_WIDTH 30
2418#define DEFAULT_IMAGE_HEIGHT 30 2418#define DEFAULT_IMAGE_HEIGHT 30
2419 2419
2420 /* Top/left and bottom/right corner pixel of actual image data.
2421 Used by four_corners_best to consider the real image data,
2422 rather than looking at the optional image margin. */
2423 int corners[4];
2424#define TOP_CORNER 0
2425#define LEFT_CORNER 1
2426#define BOT_CORNER 2
2427#define RIGHT_CORNER 3
2428
2420 /* Percent of image height used as ascent. A value of 2429 /* Percent of image height used as ascent. A value of
2421 CENTERED_IMAGE_ASCENT means draw the image centered on the 2430 CENTERED_IMAGE_ASCENT means draw the image centered on the
2422 line. */ 2431 line. */
diff --git a/src/dispnew.c b/src/dispnew.c
index 2884a687e5f..e8833376701 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4142,7 +4142,6 @@ update_window (w, force_p)
4142 update_window_line (w, MATRIX_ROW_VPOS (mode_line_row, 4142 update_window_line (w, MATRIX_ROW_VPOS (mode_line_row,
4143 desired_matrix), 4143 desired_matrix),
4144 &mouse_face_overwritten_p); 4144 &mouse_face_overwritten_p);
4145 changed_p = 1;
4146 } 4145 }
4147 4146
4148 /* Find first enabled row. Optimizations in redisplay_internal 4147 /* Find first enabled row. Optimizations in redisplay_internal
@@ -4212,7 +4211,6 @@ update_window (w, force_p)
4212 { 4211 {
4213 header_line_row->y = 0; 4212 header_line_row->y = 0;
4214 update_window_line (w, 0, &mouse_face_overwritten_p); 4213 update_window_line (w, 0, &mouse_face_overwritten_p);
4215 changed_p = 1;
4216 } 4214 }
4217 4215
4218 /* Fix the appearance of overlapping/overlapped rows. */ 4216 /* Fix the appearance of overlapping/overlapped rows. */
diff --git a/src/editfns.c b/src/editfns.c
index b0e79057988..4f8b349b749 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -489,7 +489,7 @@ get_pos_property (position, prop, object)
489} 489}
490 490
491/* Find the field surrounding POS in *BEG and *END. If POS is nil, 491/* Find the field surrounding POS in *BEG and *END. If POS is nil,
492 the value of point is used instead. If BEG or END null, 492 the value of point is used instead. If BEG or END is null,
493 means don't store the beginning or end of the field. 493 means don't store the beginning or end of the field.
494 494
495 BEG_LIMIT and END_LIMIT serve to limit the ranged of the returned 495 BEG_LIMIT and END_LIMIT serve to limit the ranged of the returned
diff --git a/src/frame.c b/src/frame.c
index 914bc5abf65..3efd04bf110 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -1,5 +1,5 @@
1/* Generic frame functions. 1/* Generic frame functions.
2 Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2 Copyright (C) 1993, 1994, 1995, 1997, 1999, 2000, 2001, 2002, 2003, 2006,
3 2004, 2005, 2006 Free Software Foundation, Inc. 3 2004, 2005, 2006 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -3093,9 +3093,15 @@ x_set_font (f, arg, oldval)
3093 return; 3093 return;
3094 } 3094 }
3095 store_frame_param (f, Qfont, result); 3095 store_frame_param (f, Qfont, result);
3096
3096 if (!NILP (Fequal (result, oldval))) 3097 if (!NILP (Fequal (result, oldval)))
3097 return; 3098 return;
3098 3099
3100 /* Recalculate toolbar height. */
3101 f->n_tool_bar_rows = 0;
3102 /* Ensure we redraw it. */
3103 clear_current_matrices (f);
3104
3099 recompute_basic_faces (f); 3105 recompute_basic_faces (f);
3100 } 3106 }
3101 else 3107 else
diff --git a/src/image.c b/src/image.c
index 10c402be119..688ff200055 100644
--- a/src/image.c
+++ b/src/image.c
@@ -603,7 +603,9 @@ x_destroy_all_bitmaps (dpyinfo)
603/* Useful functions defined in the section 603/* Useful functions defined in the section
604 `Image type independent image structures' below. */ 604 `Image type independent image structures' below. */
605 605
606static unsigned long four_corners_best P_ ((XImagePtr ximg, unsigned long width, 606static unsigned long four_corners_best P_ ((XImagePtr ximg,
607 int *corners,
608 unsigned long width,
607 unsigned long height)); 609 unsigned long height));
608 610
609static int x_create_x_image_and_pixmap P_ ((struct frame *f, int width, int height, 611static int x_create_x_image_and_pixmap P_ ((struct frame *f, int width, int height,
@@ -657,7 +659,7 @@ x_create_bitmap_mask (f, id)
657 return -1; 659 return -1;
658 } 660 }
659 661
660 bg = four_corners_best (ximg, width, height); 662 bg = four_corners_best (ximg, NULL, width, height);
661 663
662 for (y = 0; y < ximg->height; ++y) 664 for (y = 0; y < ximg->height; ++y)
663 { 665 {
@@ -732,7 +734,7 @@ Lisp_Object Qxbm;
732/* Keywords. */ 734/* Keywords. */
733 735
734extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile; 736extern Lisp_Object QCwidth, QCheight, QCforeground, QCbackground, QCfile;
735extern Lisp_Object QCdata, QCtype; 737extern Lisp_Object QCdata, QCtype, Qcount;
736extern Lisp_Object Qcenter; 738extern Lisp_Object Qcenter;
737Lisp_Object QCascent, QCmargin, QCrelief; 739Lisp_Object QCascent, QCmargin, QCrelief;
738Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask; 740Lisp_Object QCconversion, QCcolor_symbols, QCheuristic_mask;
@@ -1141,6 +1143,27 @@ or omitted means use the selected frame. */)
1141 return mask; 1143 return mask;
1142} 1144}
1143 1145
1146DEFUN ("image-extension-data", Fimage_extension_data, Simage_extension_data, 1, 2, 0,
1147 doc: /* Return extension data for image SPEC.
1148FRAME is the frame on which the image will be displayed. FRAME nil
1149or omitted means use the selected frame. */)
1150 (spec, frame)
1151 Lisp_Object spec, frame;
1152{
1153 Lisp_Object ext;
1154
1155 ext = Qnil;
1156 if (valid_image_p (spec))
1157 {
1158 struct frame *f = check_x_frame (frame);
1159 int id = lookup_image (f, spec);
1160 struct image *img = IMAGE_FROM_ID (f, id);
1161 ext = img->data.lisp_val;
1162 }
1163
1164 return ext;
1165}
1166
1144 1167
1145/*********************************************************************** 1168/***********************************************************************
1146 Image type independent image structures 1169 Image type independent image structures
@@ -1171,6 +1194,7 @@ make_image (spec, hash)
1171 img->data.lisp_val = Qnil; 1194 img->data.lisp_val = Qnil;
1172 img->ascent = DEFAULT_IMAGE_ASCENT; 1195 img->ascent = DEFAULT_IMAGE_ASCENT;
1173 img->hash = hash; 1196 img->hash = hash;
1197 img->corners[BOT_CORNER] = -1; /* Full image */
1174 return img; 1198 return img;
1175} 1199}
1176 1200
@@ -1322,30 +1346,41 @@ image_ascent (img, face, slice)
1322 On W32, XIMG is assumed to a device context with the bitmap selected. */ 1346 On W32, XIMG is assumed to a device context with the bitmap selected. */
1323 1347
1324static RGB_PIXEL_COLOR 1348static RGB_PIXEL_COLOR
1325four_corners_best (ximg, width, height) 1349four_corners_best (ximg, corners, width, height)
1326 XImagePtr_or_DC ximg; 1350 XImagePtr_or_DC ximg;
1351 int *corners;
1327 unsigned long width, height; 1352 unsigned long width, height;
1328{ 1353{
1329 RGB_PIXEL_COLOR corners[4], best; 1354 RGB_PIXEL_COLOR corner_pixels[4], best;
1330 int i, best_count; 1355 int i, best_count;
1331 1356
1332 /* Get the colors at the corners of ximg. */ 1357 if (corners && corners[BOT_CORNER] >= 0)
1333 corners[0] = GET_PIXEL (ximg, 0, 0); 1358 {
1334 corners[1] = GET_PIXEL (ximg, width - 1, 0); 1359 /* Get the colors at the corner_pixels of ximg. */
1335 corners[2] = GET_PIXEL (ximg, width - 1, height - 1); 1360 corner_pixels[0] = GET_PIXEL (ximg, corners[LEFT_CORNER], corners[TOP_CORNER]);
1336 corners[3] = GET_PIXEL (ximg, 0, height - 1); 1361 corner_pixels[1] = GET_PIXEL (ximg, corners[RIGHT_CORNER] - 1, corners[TOP_CORNER]);
1337 1362 corner_pixels[2] = GET_PIXEL (ximg, corners[RIGHT_CORNER] - 1, corners[BOT_CORNER] - 1);
1363 corner_pixels[3] = GET_PIXEL (ximg, corners[LEFT_CORNER], corners[BOT_CORNER] - 1);
1364 }
1365 else
1366 {
1367 /* Get the colors at the corner_pixels of ximg. */
1368 corner_pixels[0] = GET_PIXEL (ximg, 0, 0);
1369 corner_pixels[1] = GET_PIXEL (ximg, width - 1, 0);
1370 corner_pixels[2] = GET_PIXEL (ximg, width - 1, height - 1);
1371 corner_pixels[3] = GET_PIXEL (ximg, 0, height - 1);
1372 }
1338 /* Choose the most frequently found color as background. */ 1373 /* Choose the most frequently found color as background. */
1339 for (i = best_count = 0; i < 4; ++i) 1374 for (i = best_count = 0; i < 4; ++i)
1340 { 1375 {
1341 int j, n; 1376 int j, n;
1342 1377
1343 for (j = n = 0; j < 4; ++j) 1378 for (j = n = 0; j < 4; ++j)
1344 if (corners[i] == corners[j]) 1379 if (corner_pixels[i] == corner_pixels[j])
1345 ++n; 1380 ++n;
1346 1381
1347 if (n > best_count) 1382 if (n > best_count)
1348 best = corners[i], best_count = n; 1383 best = corner_pixels[i], best_count = n;
1349 } 1384 }
1350 1385
1351 return best; 1386 return best;
@@ -1404,7 +1439,7 @@ image_background (img, f, ximg)
1404#endif /* !HAVE_NTGUI */ 1439#endif /* !HAVE_NTGUI */
1405 } 1440 }
1406 1441
1407 img->background = four_corners_best (ximg, img->width, img->height); 1442 img->background = four_corners_best (ximg, img->corners, img->width, img->height);
1408 1443
1409 if (free_ximg) 1444 if (free_ximg)
1410 Destroy_Image (ximg, prev); 1445 Destroy_Image (ximg, prev);
@@ -1449,7 +1484,7 @@ image_background_transparent (img, f, mask)
1449 } 1484 }
1450 1485
1451 img->background_transparent 1486 img->background_transparent
1452 = (four_corners_best (mask, img->width, img->height) == PIX_MASK_RETAIN); 1487 = (four_corners_best (mask, img->corners, img->width, img->height) == PIX_MASK_RETAIN);
1453 1488
1454 if (free_mask) 1489 if (free_mask)
1455 Destroy_Image (mask, prev); 1490 Destroy_Image (mask, prev);
@@ -4460,6 +4495,10 @@ xpm_load_image (f, img, contents, end)
4460 img->width = width; 4495 img->width = width;
4461 img->height = height; 4496 img->height = height;
4462 4497
4498 /* Maybe fill in the background field while we have ximg handy. */
4499 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
4500 IMAGE_BACKGROUND (img, f, ximg);
4501
4463 x_put_x_image (f, ximg, img->pixmap, width, height); 4502 x_put_x_image (f, ximg, img->pixmap, width, height);
4464 x_destroy_x_image (ximg); 4503 x_destroy_x_image (ximg);
4465 if (have_mask) 4504 if (have_mask)
@@ -5354,7 +5393,7 @@ x_build_heuristic_mask (f, img, how)
5354 } 5393 }
5355 5394
5356 if (use_img_background) 5395 if (use_img_background)
5357 bg = four_corners_best (ximg, img->width, img->height); 5396 bg = four_corners_best (ximg, img->corners, img->width, img->height);
5358 5397
5359 /* Set all bits in mask_img to 1 whose color in ximg is different 5398 /* Set all bits in mask_img to 1 whose color in ximg is different
5360 from the background color bg. */ 5399 from the background color bg. */
@@ -7447,6 +7486,7 @@ tiff_load (f, img)
7447 7486
7448static int gif_image_p P_ ((Lisp_Object object)); 7487static int gif_image_p P_ ((Lisp_Object object));
7449static int gif_load P_ ((struct frame *f, struct image *img)); 7488static int gif_load P_ ((struct frame *f, struct image *img));
7489static void gif_clear_image P_ ((struct frame *f, struct image *img));
7450 7490
7451/* The symbol `gif' identifying images of this type. */ 7491/* The symbol `gif' identifying images of this type. */
7452 7492
@@ -7495,10 +7535,22 @@ static struct image_type gif_type =
7495 &Qgif, 7535 &Qgif,
7496 gif_image_p, 7536 gif_image_p,
7497 gif_load, 7537 gif_load,
7498 x_clear_image, 7538 gif_clear_image,
7499 NULL 7539 NULL
7500}; 7540};
7501 7541
7542/* Free X resources of GIF image IMG which is used on frame F. */
7543
7544static void
7545gif_clear_image (f, img)
7546 struct frame *f;
7547 struct image *img;
7548{
7549 /* IMG->data.ptr_val may contain extension data. */
7550 img->data.lisp_val = Qnil;
7551 x_clear_image (f, img);
7552}
7553
7502/* Return non-zero if OBJECT is a valid GIF image specification. */ 7554/* Return non-zero if OBJECT is a valid GIF image specification. */
7503 7555
7504static int 7556static int
@@ -7619,7 +7671,7 @@ gif_load (f, img)
7619 GifFileType *gif; 7671 GifFileType *gif;
7620 struct gcpro gcpro1; 7672 struct gcpro gcpro1;
7621 Lisp_Object image; 7673 Lisp_Object image;
7622 int ino, image_left, image_top, image_width, image_height; 7674 int ino, image_height, image_width;
7623 gif_memory_source memsrc; 7675 gif_memory_source memsrc;
7624 unsigned char *raster; 7676 unsigned char *raster;
7625 7677
@@ -7696,17 +7748,19 @@ gif_load (f, img)
7696 return 0; 7748 return 0;
7697 } 7749 }
7698 7750
7699 image_top = gif->SavedImages[ino].ImageDesc.Top; 7751 img->corners[TOP_CORNER] = gif->SavedImages[ino].ImageDesc.Top;
7700 image_left = gif->SavedImages[ino].ImageDesc.Left; 7752 img->corners[LEFT_CORNER] = gif->SavedImages[ino].ImageDesc.Left;
7701 image_width = gif->SavedImages[ino].ImageDesc.Width;
7702 image_height = gif->SavedImages[ino].ImageDesc.Height; 7753 image_height = gif->SavedImages[ino].ImageDesc.Height;
7754 img->corners[BOT_CORNER] = img->corners[TOP_CORNER] + image_height;
7755 image_width = gif->SavedImages[ino].ImageDesc.Width;
7756 img->corners[RIGHT_CORNER] = img->corners[LEFT_CORNER] + image_width;
7703 7757
7704 width = img->width = max (gif->SWidth, 7758 width = img->width = max (gif->SWidth,
7705 max (gif->Image.Left + gif->Image.Width, 7759 max (gif->Image.Left + gif->Image.Width,
7706 image_left + image_width)); 7760 img->corners[RIGHT_CORNER]));
7707 height = img->height = max (gif->SHeight, 7761 height = img->height = max (gif->SHeight,
7708 max (gif->Image.Top + gif->Image.Height, 7762 max (gif->Image.Top + gif->Image.Height,
7709 image_top + image_height)); 7763 img->corners[BOT_CORNER]));
7710 7764
7711 if (!check_image_size (f, width, height)) 7765 if (!check_image_size (f, width, height))
7712 { 7766 {
@@ -7749,19 +7803,19 @@ gif_load (f, img)
7749 requires more than can be done here (see the gif89 spec, 7803 requires more than can be done here (see the gif89 spec,
7750 disposal methods). Let's simply assume that the part 7804 disposal methods). Let's simply assume that the part
7751 not covered by a sub-image is in the frame's background color. */ 7805 not covered by a sub-image is in the frame's background color. */
7752 for (y = 0; y < image_top; ++y) 7806 for (y = 0; y < img->corners[TOP_CORNER]; ++y)
7753 for (x = 0; x < width; ++x) 7807 for (x = 0; x < width; ++x)
7754 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); 7808 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
7755 7809
7756 for (y = image_top + image_height; y < height; ++y) 7810 for (y = img->corners[BOT_CORNER]; y < height; ++y)
7757 for (x = 0; x < width; ++x) 7811 for (x = 0; x < width; ++x)
7758 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); 7812 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
7759 7813
7760 for (y = image_top; y < image_top + image_height; ++y) 7814 for (y = img->corners[TOP_CORNER]; y < img->corners[BOT_CORNER]; ++y)
7761 { 7815 {
7762 for (x = 0; x < image_left; ++x) 7816 for (x = 0; x < img->corners[LEFT_CORNER]; ++x)
7763 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); 7817 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
7764 for (x = image_left + image_width; x < width; ++x) 7818 for (x = img->corners[RIGHT_CORNER]; x < width; ++x)
7765 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); 7819 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
7766 } 7820 }
7767 7821
@@ -7791,8 +7845,8 @@ gif_load (f, img)
7791 for (x = 0; x < image_width; x++) 7845 for (x = 0; x < image_width; x++)
7792 { 7846 {
7793 int i = raster[(y * image_width) + x]; 7847 int i = raster[(y * image_width) + x];
7794 XPutPixel (ximg, x + image_left, row + image_top, 7848 XPutPixel (ximg, x + img->corners[LEFT_CORNER],
7795 pixel_colors[i]); 7849 row + img->corners[TOP_CORNER], pixel_colors[i]);
7796 } 7850 }
7797 7851
7798 row += interlace_increment[pass]; 7852 row += interlace_increment[pass];
@@ -7804,10 +7858,29 @@ gif_load (f, img)
7804 for (x = 0; x < image_width; ++x) 7858 for (x = 0; x < image_width; ++x)
7805 { 7859 {
7806 int i = raster[y * image_width + x]; 7860 int i = raster[y * image_width + x];
7807 XPutPixel (ximg, x + image_left, y + image_top, pixel_colors[i]); 7861 XPutPixel (ximg, x + img->corners[LEFT_CORNER],
7862 y + img->corners[TOP_CORNER], pixel_colors[i]);
7808 } 7863 }
7809 } 7864 }
7810 7865
7866 /* Save GIF image extension data for `image-extension-data'.
7867 Format is (count IMAGES FUNCTION "BYTES" ...). */
7868 img->data.lisp_val = Qnil;
7869 if (gif->SavedImages[ino].ExtensionBlockCount > 0)
7870 {
7871 ExtensionBlock *ext = gif->SavedImages[ino].ExtensionBlocks;
7872 for (i = 0; i < gif->SavedImages[ino].ExtensionBlockCount; i++, ext++)
7873 /* Append (... FUNCTION "BYTES") */
7874 img->data.lisp_val = Fcons (make_unibyte_string (ext->Bytes, ext->ByteCount),
7875 Fcons (make_number (ext->Function),
7876 img->data.lisp_val));
7877 img->data.lisp_val = Fnreverse (img->data.lisp_val);
7878 }
7879 if (gif->ImageCount > 1)
7880 img->data.lisp_val = Fcons (Qcount,
7881 Fcons (make_number (gif->ImageCount),
7882 img->data.lisp_val));
7883
7811 fn_DGifCloseFile (gif); 7884 fn_DGifCloseFile (gif);
7812 7885
7813 /* Maybe fill in the background field while we have ximg handy. */ 7886 /* Maybe fill in the background field while we have ximg handy. */
@@ -8553,6 +8626,7 @@ non-numeric, there is no explicit limit on the size of images. */);
8553 defsubr (&Sclear_image_cache); 8626 defsubr (&Sclear_image_cache);
8554 defsubr (&Simage_size); 8627 defsubr (&Simage_size);
8555 defsubr (&Simage_mask_p); 8628 defsubr (&Simage_mask_p);
8629 defsubr (&Simage_extension_data);
8556 8630
8557#if GLYPH_DEBUG 8631#if GLYPH_DEBUG
8558 defsubr (&Simagep); 8632 defsubr (&Simagep);
diff --git a/src/keymap.c b/src/keymap.c
index 6930ed08d8c..f5aea3b3902 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -841,7 +841,7 @@ static Lisp_Object
841store_in_keymap (keymap, idx, def) 841store_in_keymap (keymap, idx, def)
842 Lisp_Object keymap; 842 Lisp_Object keymap;
843 register Lisp_Object idx; 843 register Lisp_Object idx;
844 register Lisp_Object def; 844 Lisp_Object def;
845{ 845{
846 /* Flush any reverse-map cache. */ 846 /* Flush any reverse-map cache. */
847 where_is_cache = Qnil; 847 where_is_cache = Qnil;
@@ -1226,8 +1226,11 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1226 if (!CONSP (keymap)) 1226 if (!CONSP (keymap))
1227 /* We must use Fkey_description rather than just passing key to 1227 /* We must use Fkey_description rather than just passing key to
1228 error; key might be a vector, not a string. */ 1228 error; key might be a vector, not a string. */
1229 error ("Key sequence %s uses invalid prefix characters", 1229 error ("Key sequence %s starts with non-prefix key %s",
1230 SDATA (Fkey_description (key, Qnil))); 1230 SDATA (Fkey_description (key, Qnil)),
1231 SDATA (Fkey_description (Fsubstring (key, make_number (0),
1232 make_number (idx)),
1233 Qnil)));
1231 } 1234 }
1232} 1235}
1233 1236
diff --git a/src/mac.c b/src/mac.c
index 7172301b6b0..444320322c3 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -448,6 +448,22 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
448 } 448 }
449 else 449 else
450 err = memFullErr; 450 err = memFullErr;
451
452 if (err != noErr)
453 {
454 /* Just to be paranoid ... */
455 FSRef fref;
456 char *buf;
457
458 buf = xmalloc (data_size + 1);
459 memcpy (buf, data_ptr, data_size);
460 buf[data_size] = '\0';
461 err = FSPathMakeRef (buf, &fref, NULL);
462 xfree (buf);
463 if (err == noErr)
464 err = AECoercePtr (typeFSRef, &fref, sizeof (FSRef),
465 to_type, result);
466 }
451#else 467#else
452 FSSpec fs; 468 FSSpec fs;
453 char *buf; 469 char *buf;
@@ -510,6 +526,34 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
510 CFDataGetLength (data), result); 526 CFDataGetLength (data), result);
511 CFRelease (data); 527 CFRelease (data);
512 } 528 }
529
530 if (err != noErr)
531 {
532 /* Coercion from typeAlias to typeFileURL fails on Mac OS X
533 10.2. In such cases, try typeFSRef as a target type. */
534 char file_name[MAXPATHLEN];
535
536 if (type_code == typeFSRef && data_size == sizeof (FSRef))
537 err = FSRefMakePath (data_ptr, file_name, sizeof (file_name));
538 else
539 {
540 AEDesc desc;
541 FSRef fref;
542
543 err = AECoercePtr (type_code, data_ptr, data_size,
544 typeFSRef, &desc);
545 if (err == noErr)
546 {
547 err = AEGetDescData (&desc, &fref, sizeof (FSRef));
548 AEDisposeDesc (&desc);
549 }
550 if (err == noErr)
551 err = FSRefMakePath (&fref, file_name, sizeof (file_name));
552 }
553 if (err == noErr)
554 err = AECreateDesc (TYPE_FILE_NAME, file_name,
555 strlen (file_name), result);
556 }
513#else 557#else
514 char file_name[MAXPATHLEN]; 558 char file_name[MAXPATHLEN];
515 559
@@ -529,11 +573,11 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
529#else 573#else
530 fs = *(FSSpec *)(*(desc.dataHandle)); 574 fs = *(FSSpec *)(*(desc.dataHandle));
531#endif 575#endif
532 if (err == noErr)
533 err = fsspec_to_posix_pathname (&fs, file_name,
534 sizeof (file_name) - 1);
535 AEDisposeDesc (&desc); 576 AEDisposeDesc (&desc);
536 } 577 }
578 if (err == noErr)
579 err = fsspec_to_posix_pathname (&fs, file_name,
580 sizeof (file_name) - 1);
537 } 581 }
538 if (err == noErr) 582 if (err == noErr)
539 err = AECreateDesc (TYPE_FILE_NAME, file_name, 583 err = AECreateDesc (TYPE_FILE_NAME, file_name,
diff --git a/src/macfns.c b/src/macfns.c
index f4cfd61acb3..74b5288e781 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -1919,6 +1919,100 @@ mac_set_scroll_bar_width (f, arg, oldval)
1919 x_set_scroll_bar_width (f, arg, oldval); 1919 x_set_scroll_bar_width (f, arg, oldval);
1920} 1920}
1921 1921
1922#if TARGET_API_MAC_CARBON
1923static void
1924mac_update_proxy_icon (f)
1925 struct frame *f;
1926{
1927 Lisp_Object file_name =
1928 XBUFFER (XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer)->filename;
1929 Window w = FRAME_MAC_WINDOW (f);
1930
1931 if (FRAME_FILE_NAME (f) == NULL && !STRINGP (file_name))
1932 return;
1933 if (FRAME_FILE_NAME (f) && STRINGP (file_name)
1934 && strcmp (FRAME_FILE_NAME (f), SDATA (file_name)) == 0)
1935 return;
1936
1937 if (FRAME_FILE_NAME (f))
1938 {
1939 xfree (FRAME_FILE_NAME (f));
1940 FRAME_FILE_NAME (f) = NULL;
1941 }
1942
1943 BLOCK_INPUT;
1944
1945 if (STRINGP (file_name))
1946 {
1947 OSStatus err;
1948 AEDesc desc;
1949 Lisp_Object encoded_file_name = ENCODE_FILE (file_name);
1950
1951#ifdef MAC_OS8
1952 SetPortWindowPort (w);
1953#endif
1954 err = AECoercePtr (TYPE_FILE_NAME, SDATA (encoded_file_name),
1955 SBYTES (encoded_file_name), typeAlias, &desc);
1956 if (err == noErr)
1957 {
1958 Size size = AEGetDescDataSize (&desc);
1959 AliasHandle alias = (AliasHandle) NewHandle (size);
1960
1961 if (alias == NULL)
1962 err = memFullErr;
1963 else
1964 {
1965 HLock ((Handle) alias);
1966 err = AEGetDescData (&desc, *alias, size);
1967 HUnlock ((Handle) alias);
1968 if (err == noErr)
1969 err = SetWindowProxyAlias (w, alias);
1970 DisposeHandle ((Handle) alias);
1971 }
1972 AEDisposeDesc (&desc);
1973 }
1974 if (err == noErr)
1975 {
1976 FRAME_FILE_NAME (f) = xmalloc (SBYTES (file_name) + 1);
1977 strcpy (FRAME_FILE_NAME (f), SDATA (file_name));
1978 }
1979 }
1980
1981 if (FRAME_FILE_NAME (f) == NULL)
1982 RemoveWindowProxy (w);
1983
1984 UNBLOCK_INPUT;
1985}
1986#endif
1987
1988void
1989mac_update_title_bar (f, save_match_data)
1990 struct frame *f;
1991 int save_match_data;
1992{
1993#if TARGET_API_MAC_CARBON
1994 struct window *w;
1995 int modified_p;
1996
1997 if (!FRAME_MAC_P (f))
1998 return;
1999
2000 w = XWINDOW (FRAME_SELECTED_WINDOW (f));
2001 modified_p = (BUF_SAVE_MODIFF (XBUFFER (w->buffer))
2002 < BUF_MODIFF (XBUFFER (w->buffer)));
2003 if (windows_or_buffers_changed
2004 /* Minibuffer modification status shown in the close button is
2005 confusing. */
2006 || (!MINI_WINDOW_P (w)
2007 && (modified_p != !NILP (w->last_had_star))))
2008 SetWindowModified (FRAME_MAC_WINDOW (f),
2009 !MINI_WINDOW_P (w) && modified_p);
2010
2011 if (windows_or_buffers_changed)
2012 mac_update_proxy_icon (f);
2013#endif
2014}
2015
1922 2016
1923/* Subroutines of creating a frame. */ 2017/* Subroutines of creating a frame. */
1924 2018
@@ -3470,6 +3564,9 @@ show_hourglass (timer)
3470 if (FRAME_LIVE_P (f) && FRAME_MAC_P (f) 3564 if (FRAME_LIVE_P (f) && FRAME_MAC_P (f)
3471 && FRAME_MAC_WINDOW (f) != tip_window) 3565 && FRAME_MAC_WINDOW (f) != tip_window)
3472 { 3566 {
3567#if USE_CG_DRAWING
3568 mac_prepare_for_quickdraw (f);
3569#endif
3473 if (!f->output_data.mac->hourglass_control) 3570 if (!f->output_data.mac->hourglass_control)
3474 { 3571 {
3475 Window w = FRAME_MAC_WINDOW (f); 3572 Window w = FRAME_MAC_WINDOW (f);
@@ -3514,7 +3611,12 @@ hide_hourglass ()
3514 if (FRAME_MAC_P (f) 3611 if (FRAME_MAC_P (f)
3515 /* Watch out for newly created frames. */ 3612 /* Watch out for newly created frames. */
3516 && f->output_data.mac->hourglass_control) 3613 && f->output_data.mac->hourglass_control)
3517 HideControl (f->output_data.mac->hourglass_control); 3614 {
3615#if USE_CG_DRAWING
3616 mac_prepare_for_quickdraw (f);
3617#endif
3618 HideControl (f->output_data.mac->hourglass_control);
3619 }
3518 } 3620 }
3519 3621
3520 hourglass_shown_p = 0; 3622 hourglass_shown_p = 0;
diff --git a/src/macgui.h b/src/macgui.h
index 7eb6c9942ab..579ae2b7663 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -79,14 +79,26 @@ typedef unsigned long Time;
79#include <Gestalt.h> 79#include <Gestalt.h>
80#endif /* not HAVE_CARBON */ 80#endif /* not HAVE_CARBON */
81 81
82/* Whether to use ATSUI (Apple Type Services for Unicode Imaging) for
83 text drawing. */
84#ifndef USE_ATSUI
85#ifdef MAC_OSX
86#define USE_ATSUI 1
87#endif
88#endif
89
90/* Whether to use low-level Quartz 2D (aka Core Graphics) text drawing
91 in preference to ATSUI for ASCII and Latin-1 characters. */
82#ifndef USE_CG_TEXT_DRAWING 92#ifndef USE_CG_TEXT_DRAWING
83#if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 93#if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
84#define USE_CG_TEXT_DRAWING 1 94#define USE_CG_TEXT_DRAWING 1
85#endif 95#endif
86#endif 96#endif
87 97
98/* Whether to use Quartz 2D routines for drawing operations other than
99 texts. */
88#ifndef USE_CG_DRAWING 100#ifndef USE_CG_DRAWING
89#if USE_ATSUI && defined (MAC_OSX) 101#if USE_ATSUI && MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
90#define USE_CG_DRAWING 1 102#define USE_CG_DRAWING 1
91#endif 103#endif
92#endif 104#endif
@@ -105,6 +117,8 @@ typedef GWorldPtr Pixmap;
105 117
106 118
107/* Emulate XCharStruct. */ 119/* Emulate XCharStruct. */
120/* If the sum of ascent and descent is negative, that means some
121 special status specified by enum pcm_status. */
108typedef struct _XCharStruct 122typedef struct _XCharStruct
109{ 123{
110 short lbearing; /* origin to left edge of raster */ 124 short lbearing; /* origin to left edge of raster */
@@ -117,6 +131,12 @@ typedef struct _XCharStruct
117#endif 131#endif
118} XCharStruct; 132} XCharStruct;
119 133
134enum pcm_status
135 {
136 PCM_VALID = 0, /* pcm data is valid */
137 PCM_INVALID = -1, /* pcm data is invalid */
138 };
139
120#define STORE_XCHARSTRUCT(xcs, w, bds) \ 140#define STORE_XCHARSTRUCT(xcs, w, bds) \
121 ((xcs).width = (w), \ 141 ((xcs).width = (w), \
122 (xcs).lbearing = (bds).left, \ 142 (xcs).lbearing = (bds).left, \
@@ -124,18 +144,6 @@ typedef struct _XCharStruct
124 (xcs).ascent = -(bds).top, \ 144 (xcs).ascent = -(bds).top, \
125 (xcs).descent = (bds).bottom) 145 (xcs).descent = (bds).bottom)
126 146
127typedef struct
128{
129 char valid_bits[0x100 / 8];
130 XCharStruct per_char[0x100];
131} XCharStructRow;
132
133#define XCHARSTRUCTROW_CHAR_VALID_P(row, byte2) \
134 ((row)->valid_bits[(byte2) / 8] & (1 << (byte2) % 8))
135
136#define XCHARSTRUCTROW_SET_CHAR_VALID(row, byte2) \
137 ((row)->valid_bits[(byte2) / 8] |= (1 << (byte2) % 8))
138
139struct MacFontStruct { 147struct MacFontStruct {
140 char *full_name; 148 char *full_name;
141 149
@@ -175,7 +183,7 @@ struct MacFontStruct {
175 XCharStruct max_bounds; /* maximum bounds over all existing char */ 183 XCharStruct max_bounds; /* maximum bounds over all existing char */
176 union { 184 union {
177 XCharStruct *per_char; /* first_char to last_char information */ 185 XCharStruct *per_char; /* first_char to last_char information */
178 XCharStructRow **rows; /* first row to last row information */ 186 XCharStruct **rows; /* first row to last row information */
179 } bounds; 187 } bounds;
180 int ascent; /* logical extent above baseline for spacing */ 188 int ascent; /* logical extent above baseline for spacing */
181 int descent; /* logical decent below baseline for spacing */ 189 int descent; /* logical decent below baseline for spacing */
@@ -229,7 +237,7 @@ typedef struct _XGC
229 /* QuickDraw clipping region. Ignored if n_clip_rects == 0. */ 237 /* QuickDraw clipping region. Ignored if n_clip_rects == 0. */
230 RgnHandle clip_region; 238 RgnHandle clip_region;
231 239
232#if defined (MAC_OSX) && USE_ATSUI 240#if defined (MAC_OSX) && (USE_ATSUI || USE_CG_DRAWING)
233 /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate 241 /* Clipping rectangles used in Quartz 2D drawing. The y-coordinate
234 is in QuickDraw's. */ 242 is in QuickDraw's. */
235 CGRect clip_rects[MAX_CLIP_RECTS]; 243 CGRect clip_rects[MAX_CLIP_RECTS];
diff --git a/src/macmenu.c b/src/macmenu.c
index 29233ec0d64..be565f89259 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -303,6 +303,37 @@ discard_menu_items ()
303 } 303 }
304} 304}
305 305
306/* This undoes save_menu_items, and it is called by the specpdl unwind
307 mechanism. */
308
309static Lisp_Object
310restore_menu_items (saved)
311 Lisp_Object saved;
312{
313 menu_items = XCAR (saved);
314 menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0);
315 saved = XCDR (saved);
316 menu_items_used = XINT (XCAR (saved));
317 saved = XCDR (saved);
318 menu_items_n_panes = XINT (XCAR (saved));
319 saved = XCDR (saved);
320 menu_items_submenu_depth = XINT (XCAR (saved));
321}
322
323/* Push the whole state of menu_items processing onto the specpdl.
324 It will be restored when the specpdl is unwound. */
325
326static void
327save_menu_items ()
328{
329 Lisp_Object saved = list4 (menu_items,
330 make_number (menu_items_used),
331 make_number (menu_items_n_panes),
332 make_number (menu_items_submenu_depth));
333 record_unwind_protect (restore_menu_items, saved);
334 menu_items = Qnil;
335}
336
306/* Make the menu_items vector twice as large. */ 337/* Make the menu_items vector twice as large. */
307 338
308static void 339static void
@@ -313,6 +344,7 @@ grow_menu_items ()
313 old = menu_items; 344 old = menu_items;
314 345
315 menu_items_allocated *= 2; 346 menu_items_allocated *= 2;
347
316 menu_items = Fmake_vector (make_number (menu_items_allocated), Qnil); 348 menu_items = Fmake_vector (make_number (menu_items_allocated), Qnil);
317 bcopy (XVECTOR (old)->contents, XVECTOR (menu_items)->contents, 349 bcopy (XVECTOR (old)->contents, XVECTOR (menu_items)->contents,
318 old_size * sizeof (Lisp_Object)); 350 old_size * sizeof (Lisp_Object));
@@ -1185,6 +1217,7 @@ digest_single_submenu (start, end, top_level_items)
1185 int i; 1217 int i;
1186 int submenu_depth = 0; 1218 int submenu_depth = 0;
1187 widget_value **submenu_stack; 1219 widget_value **submenu_stack;
1220 int panes_seen = 0;
1188 1221
1189 submenu_stack 1222 submenu_stack
1190 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *)); 1223 = (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
@@ -1231,6 +1264,8 @@ digest_single_submenu (start, end, top_level_items)
1231 Lisp_Object pane_name, prefix; 1264 Lisp_Object pane_name, prefix;
1232 char *pane_string; 1265 char *pane_string;
1233 1266
1267 panes_seen++;
1268
1234 pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME]; 1269 pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
1235 prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX]; 1270 prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
1236 1271
@@ -1278,6 +1313,10 @@ digest_single_submenu (start, end, top_level_items)
1278 Lisp_Object item_name, enable, descrip, def, type, selected; 1313 Lisp_Object item_name, enable, descrip, def, type, selected;
1279 Lisp_Object help; 1314 Lisp_Object help;
1280 1315
1316 /* All items should be contained in panes. */
1317 if (panes_seen == 0)
1318 abort ();
1319
1281 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); 1320 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
1282 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); 1321 enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
1283 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY); 1322 descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
@@ -1529,6 +1568,8 @@ set_frame_menubar (f, first_time, deep_p)
1529 1568
1530 /* Fill in menu_items with the current menu bar contents. 1569 /* Fill in menu_items with the current menu bar contents.
1531 This can evaluate Lisp code. */ 1570 This can evaluate Lisp code. */
1571 save_menu_items ();
1572
1532 menu_items = f->menu_bar_vector; 1573 menu_items = f->menu_bar_vector;
1533 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; 1574 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
1534 submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *)); 1575 submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
@@ -1588,23 +1629,33 @@ set_frame_menubar (f, first_time, deep_p)
1588 } 1629 }
1589 1630
1590 set_buffer_internal_1 (prev); 1631 set_buffer_internal_1 (prev);
1591 unbind_to (specpdl_count, Qnil);
1592 1632
1593 /* If there has been no change in the Lisp-level contents 1633 /* If there has been no change in the Lisp-level contents
1594 of the menu bar, skip redisplaying it. Just exit. */ 1634 of the menu bar, skip redisplaying it. Just exit. */
1595 1635
1636 /* Compare the new menu items with the ones computed last time. */
1596 for (i = 0; i < previous_menu_items_used; i++) 1637 for (i = 0; i < previous_menu_items_used; i++)
1597 if (menu_items_used == i 1638 if (menu_items_used == i
1598 || (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i]))) 1639 || (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i])))
1599 break; 1640 break;
1600 if (i == menu_items_used && i == previous_menu_items_used && i != 0) 1641 if (i == menu_items_used && i == previous_menu_items_used && i != 0)
1601 { 1642 {
1643 /* The menu items have not changed. Don't bother updating
1644 the menus in any form, since it would be a no-op. */
1602 free_menubar_widget_value_tree (first_wv); 1645 free_menubar_widget_value_tree (first_wv);
1603 discard_menu_items (); 1646 discard_menu_items ();
1604 1647 unbind_to (specpdl_count, Qnil);
1605 return; 1648 return;
1606 } 1649 }
1607 1650
1651 /* The menu items are different, so store them in the frame. */
1652 f->menu_bar_vector = menu_items;
1653 f->menu_bar_items_used = menu_items_used;
1654
1655 /* This calls restore_menu_items to restore menu_items, etc.,
1656 as they were outside. */
1657 unbind_to (specpdl_count, Qnil);
1658
1608 /* Now GC cannot happen during the lifetime of the widget_value, 1659 /* Now GC cannot happen during the lifetime of the widget_value,
1609 so it's safe to store data from a Lisp_String. */ 1660 so it's safe to store data from a Lisp_String. */
1610 wv = first_wv->contents; 1661 wv = first_wv->contents;
@@ -1619,9 +1670,6 @@ set_frame_menubar (f, first_time, deep_p)
1619 wv = wv->next; 1670 wv = wv->next;
1620 } 1671 }
1621 1672
1622 f->menu_bar_vector = menu_items;
1623 f->menu_bar_items_used = menu_items_used;
1624 discard_menu_items ();
1625 } 1673 }
1626 else 1674 else
1627 { 1675 {
diff --git a/src/macterm.c b/src/macterm.c
index b7a7fadeab2..8ddd8febd69 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -391,16 +391,37 @@ mac_draw_line (f, gc, x1, y1, x2, y2)
391{ 391{
392#if USE_CG_DRAWING 392#if USE_CG_DRAWING
393 CGContextRef context; 393 CGContextRef context;
394 float gx1 = x1, gy1 = y1, gx2 = x2, gy2 = y2;
395
396 if (y1 != y2)
397 gx1 += 0.5f, gx2 += 0.5f;
398 if (x1 != x2)
399 gy1 += 0.5f, gy2 += 0.5f;
394 400
395 context = mac_begin_cg_clip (f, gc); 401 context = mac_begin_cg_clip (f, gc);
396 CG_SET_STROKE_COLOR (context, gc->xgcv.foreground); 402 CG_SET_STROKE_COLOR (context, gc->xgcv.foreground);
397 CGContextBeginPath (context); 403 CGContextBeginPath (context);
398 CGContextMoveToPoint (context, x1 + 0.5f, y1 + 0.5f); 404 CGContextMoveToPoint (context, gx1, gy1);
399 CGContextAddLineToPoint (context, x2 + 0.5f, y2 + 0.5f); 405 CGContextAddLineToPoint (context, gx2, gy2);
400 CGContextClosePath (context); 406 CGContextClosePath (context);
401 CGContextStrokePath (context); 407 CGContextStrokePath (context);
402 mac_end_cg_clip (f); 408 mac_end_cg_clip (f);
403#else 409#else
410 if (x1 == x2)
411 {
412 if (y1 > y2)
413 y1--;
414 else if (y2 > y1)
415 y2--;
416 }
417 else if (y1 == y2)
418 {
419 if (x1 > x2)
420 x1--;
421 else
422 x2--;
423 }
424
404 SetPortWindowPort (FRAME_MAC_WINDOW (f)); 425 SetPortWindowPort (FRAME_MAC_WINDOW (f));
405 426
406 RGBForeColor (GC_FORE_COLOR (gc)); 427 RGBForeColor (GC_FORE_COLOR (gc));
@@ -422,6 +443,21 @@ mac_draw_line_to_pixmap (display, p, gc, x1, y1, x2, y2)
422 CGrafPtr old_port; 443 CGrafPtr old_port;
423 GDHandle old_gdh; 444 GDHandle old_gdh;
424 445
446 if (x1 == x2)
447 {
448 if (y1 > y2)
449 y1--;
450 else if (y2 > y1)
451 y2--;
452 }
453 else if (y1 == y2)
454 {
455 if (x1 > x2)
456 x1--;
457 else
458 x2--;
459 }
460
425 GetGWorld (&old_port, &old_gdh); 461 GetGWorld (&old_port, &old_gdh);
426 SetGWorld (p, NULL); 462 SetGWorld (p, NULL);
427 463
@@ -1627,7 +1663,7 @@ mac_set_clip_rectangles (display, gc, rectangles, n)
1627 DisposeRgn (region); 1663 DisposeRgn (region);
1628 } 1664 }
1629 } 1665 }
1630#if defined (MAC_OSX) && USE_ATSUI 1666#if defined (MAC_OSX) && (USE_ATSUI || USE_CG_DRAWING)
1631 for (i = 0; i < n; i++) 1667 for (i = 0; i < n; i++)
1632 { 1668 {
1633 Rect *rect = rectangles + i; 1669 Rect *rect = rectangles + i;
@@ -2139,6 +2175,29 @@ static int mac_encode_char P_ ((int, XChar2b *, struct font_info *,
2139 struct charset *, int *)); 2175 struct charset *, int *));
2140 2176
2141 2177
2178static void
2179pcm_init (pcm, count)
2180 XCharStruct *pcm;
2181 int count;
2182{
2183 bzero (pcm, sizeof (XCharStruct) * count);
2184 while (--count >= 0)
2185 {
2186 pcm->descent = PCM_INVALID;
2187 pcm++;
2188 }
2189}
2190
2191static enum pcm_status
2192pcm_get_status (pcm)
2193 XCharStruct *pcm;
2194{
2195 int height = pcm->ascent + pcm->descent;
2196
2197 /* Negative height means some special status. */
2198 return height >= 0 ? PCM_VALID : height;
2199}
2200
2142/* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B 2201/* Get metrics of character CHAR2B in FONT. Value is null if CHAR2B
2143 is not contained in the font. */ 2202 is not contained in the font. */
2144 2203
@@ -2155,22 +2214,21 @@ x_per_char_metric (font, char2b)
2155#if USE_ATSUI 2214#if USE_ATSUI
2156 if (font->mac_style) 2215 if (font->mac_style)
2157 { 2216 {
2158 XCharStructRow **row = font->bounds.rows + char2b->byte1; 2217 XCharStruct **row = font->bounds.rows + char2b->byte1;
2159 2218
2160 if (*row == NULL) 2219 if (*row == NULL)
2161 { 2220 {
2162 *row = xmalloc (sizeof (XCharStructRow)); 2221 *row = xmalloc (sizeof (XCharStruct) * 0x100);
2163 bzero (*row, sizeof (XCharStructRow)); 2222 pcm_init (*row, 0x100);
2164 } 2223 }
2165 pcm = (*row)->per_char + char2b->byte2; 2224 pcm = *row + char2b->byte2;
2166 if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2)) 2225 if (pcm_get_status (pcm) != PCM_VALID)
2167 { 2226 {
2168 BLOCK_INPUT; 2227 BLOCK_INPUT;
2169 mac_query_char_extents (font->mac_style, 2228 mac_query_char_extents (font->mac_style,
2170 (char2b->byte1 << 8) + char2b->byte2, 2229 (char2b->byte1 << 8) + char2b->byte2,
2171 NULL, NULL, pcm, NULL); 2230 NULL, NULL, pcm, NULL);
2172 UNBLOCK_INPUT; 2231 UNBLOCK_INPUT;
2173 XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
2174 } 2232 }
2175 } 2233 }
2176 else 2234 else
@@ -2233,7 +2291,11 @@ x_per_char_metric (font, char2b)
2233#endif 2291#endif
2234 2292
2235 return ((pcm == NULL 2293 return ((pcm == NULL
2236 || (pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0)) 2294 || (pcm->width == 0
2295#if 0 /* Show hollow boxes for zero-width glyphs such as combining diacritics. */
2296 && (pcm->rbearing - pcm->lbearing) == 0
2297#endif
2298 ))
2237 ? NULL : pcm); 2299 ? NULL : pcm);
2238} 2300}
2239 2301
@@ -3120,13 +3182,13 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3120 for (i = 0; i < width; ++i) 3182 for (i = 0; i < width; ++i)
3121 mac_draw_line (f, gc, 3183 mac_draw_line (f, gc,
3122 left_x + i * left_p, top_y + i, 3184 left_x + i * left_p, top_y + i,
3123 right_x - i * right_p, top_y + i); 3185 right_x + 1 - i * right_p, top_y + i);
3124 3186
3125 /* Left. */ 3187 /* Left. */
3126 if (left_p) 3188 if (left_p)
3127 for (i = 0; i < width; ++i) 3189 for (i = 0; i < width; ++i)
3128 mac_draw_line (f, gc, 3190 mac_draw_line (f, gc,
3129 left_x + i, top_y + i, left_x + i, bottom_y - i); 3191 left_x + i, top_y + i, left_x + i, bottom_y - i + 1);
3130 3192
3131 mac_reset_clip_rectangles (dpy, gc); 3193 mac_reset_clip_rectangles (dpy, gc);
3132 if (raised_p) 3194 if (raised_p)
@@ -3140,13 +3202,13 @@ x_draw_relief_rect (f, left_x, top_y, right_x, bottom_y, width,
3140 for (i = 0; i < width; ++i) 3202 for (i = 0; i < width; ++i)
3141 mac_draw_line (f, gc, 3203 mac_draw_line (f, gc,
3142 left_x + i * left_p, bottom_y - i, 3204 left_x + i * left_p, bottom_y - i,
3143 right_x - i * right_p, bottom_y - i); 3205 right_x + 1 - i * right_p, bottom_y - i);
3144 3206
3145 /* Right. */ 3207 /* Right. */
3146 if (right_p) 3208 if (right_p)
3147 for (i = 0; i < width; ++i) 3209 for (i = 0; i < width; ++i)
3148 mac_draw_line (f, gc, 3210 mac_draw_line (f, gc,
3149 right_x - i, top_y + i + 1, right_x - i, bottom_y - i - 1); 3211 right_x - i, top_y + i + 1, right_x - i, bottom_y - i);
3150 3212
3151 mac_reset_clip_rectangles (dpy, gc); 3213 mac_reset_clip_rectangles (dpy, gc);
3152} 3214}
@@ -6315,6 +6377,11 @@ x_free_frame_resources (f)
6315 if (FRAME_SIZE_HINTS (f)) 6377 if (FRAME_SIZE_HINTS (f))
6316 xfree (FRAME_SIZE_HINTS (f)); 6378 xfree (FRAME_SIZE_HINTS (f));
6317 6379
6380#if TARGET_API_MAC_CARBON
6381 if (FRAME_FILE_NAME (f))
6382 xfree (FRAME_FILE_NAME (f));
6383#endif
6384
6318 xfree (f->output_data.mac); 6385 xfree (f->output_data.mac);
6319 f->output_data.mac = NULL; 6386 f->output_data.mac = NULL;
6320 6387
@@ -7061,6 +7128,25 @@ add_font_name_table_entry (char *font_name)
7061 font_name_table[font_name_count++] = font_name; 7128 font_name_table[font_name_count++] = font_name;
7062} 7129}
7063 7130
7131static void
7132add_mac_font_name (name, size, style, charset)
7133 char *name;
7134 int size;
7135 Style style;
7136 char *charset;
7137{
7138 if (size > 0)
7139 add_font_name_table_entry (mac_to_x_fontname (name, size, style, charset));
7140 else
7141 {
7142 add_font_name_table_entry (mac_to_x_fontname (name, 0, style, charset));
7143 add_font_name_table_entry (mac_to_x_fontname (name, 0, italic, charset));
7144 add_font_name_table_entry (mac_to_x_fontname (name, 0, bold, charset));
7145 add_font_name_table_entry (mac_to_x_fontname (name, 0, italic | bold,
7146 charset));
7147 }
7148}
7149
7064/* Sets up the table font_name_table to contain the list of all fonts 7150/* Sets up the table font_name_table to contain the list of all fonts
7065 in the system the first time the table is used so that the Resource 7151 in the system the first time the table is used so that the Resource
7066 Manager need not be accessed every time this information is 7152 Manager need not be accessed every time this information is
@@ -7086,16 +7172,21 @@ init_font_name_table ()
7086 text_encoding_info_alist))) 7172 text_encoding_info_alist)))
7087 { 7173 {
7088 OSErr err; 7174 OSErr err;
7175 struct Lisp_Hash_Table *h;
7176 unsigned hash_code;
7089 ItemCount nfonts, i; 7177 ItemCount nfonts, i;
7090 ATSUFontID *font_ids = NULL; 7178 ATSUFontID *font_ids = NULL;
7091 Ptr name, prev_name = NULL; 7179 Ptr name;
7092 ByteCount name_len; 7180 ByteCount name_len;
7181 Lisp_Object family;
7093 7182
7094 atsu_font_id_hash = 7183 atsu_font_id_hash =
7095 make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE), 7184 make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
7096 make_float (DEFAULT_REHASH_SIZE), 7185 make_float (DEFAULT_REHASH_SIZE),
7097 make_float (DEFAULT_REHASH_THRESHOLD), 7186 make_float (DEFAULT_REHASH_THRESHOLD),
7098 Qnil, Qnil, Qnil);; 7187 Qnil, Qnil, Qnil);;
7188 h = XHASH_TABLE (atsu_font_id_hash);
7189
7099 err = ATSUFontCount (&nfonts); 7190 err = ATSUFontCount (&nfonts);
7100 if (err == noErr) 7191 if (err == noErr)
7101 { 7192 {
@@ -7117,32 +7208,19 @@ init_font_name_table ()
7117 kFontNoLanguage, name_len, name, 7208 kFontNoLanguage, name_len, name,
7118 NULL, NULL); 7209 NULL, NULL);
7119 if (err == noErr) 7210 if (err == noErr)
7120 decode_mac_font_name (name, name_len + 1, Qnil);
7121 if (err == noErr
7122 && *name != '.'
7123 && (prev_name == NULL
7124 || strcmp (name, prev_name) != 0))
7125 { 7211 {
7126 static char *cs = "iso10646-1"; 7212 decode_mac_font_name (name, name_len + 1, Qnil);
7127 7213 family = make_unibyte_string (name, name_len);
7128 add_font_name_table_entry (mac_to_x_fontname (name, 0, 7214 if (*name != '.'
7129 normal, cs)); 7215 && hash_lookup (h, family, &hash_code) < 0)
7130 add_font_name_table_entry (mac_to_x_fontname (name, 0, 7216 {
7131 italic, cs)); 7217 add_mac_font_name (name, 0, normal, "iso10646-1");
7132 add_font_name_table_entry (mac_to_x_fontname (name, 0, 7218 hash_put (h, family, long_to_cons (font_ids[i]),
7133 bold, cs)); 7219 hash_code);
7134 add_font_name_table_entry (mac_to_x_fontname (name, 0, 7220 }
7135 italic | bold, cs));
7136 Fputhash (make_unibyte_string (name, name_len),
7137 long_to_cons (font_ids[i]), atsu_font_id_hash);
7138 xfree (prev_name);
7139 prev_name = name;
7140 } 7221 }
7141 else 7222 xfree (name);
7142 xfree (name);
7143 } 7223 }
7144 if (prev_name)
7145 xfree (prev_name);
7146 if (font_ids) 7224 if (font_ids)
7147 xfree (font_ids); 7225 xfree (font_ids);
7148 } 7226 }
@@ -7170,16 +7248,16 @@ init_font_name_table ()
7170 FMFontSize size; 7248 FMFontSize size;
7171 TextEncoding encoding; 7249 TextEncoding encoding;
7172 TextEncodingBase sc; 7250 TextEncodingBase sc;
7173 Lisp_Object text_encoding_info; 7251 Lisp_Object text_encoding_info, family;
7174 7252
7175 if (FMGetFontFamilyName (ff, name) != noErr) 7253 if (FMGetFontFamilyName (ff, name) != noErr)
7176 break; 7254 continue;
7177 p2cstr (name); 7255 p2cstr (name);
7178 if (*name == '.') 7256 if (*name == '.')
7179 continue; 7257 continue;
7180 7258
7181 if (FMGetFontFamilyTextEncoding (ff, &encoding) != noErr) 7259 if (FMGetFontFamilyTextEncoding (ff, &encoding) != noErr)
7182 break; 7260 continue;
7183 sc = GetTextEncodingBase (encoding); 7261 sc = GetTextEncodingBase (encoding);
7184 text_encoding_info = assq_no_quit (make_number (sc), 7262 text_encoding_info = assq_no_quit (make_number (sc),
7185 text_encoding_info_alist); 7263 text_encoding_info_alist);
@@ -7188,13 +7266,15 @@ init_font_name_table ()
7188 text_encoding_info_alist); 7266 text_encoding_info_alist);
7189 decode_mac_font_name (name, sizeof (name), 7267 decode_mac_font_name (name, sizeof (name),
7190 XCAR (XCDR (text_encoding_info))); 7268 XCAR (XCDR (text_encoding_info)));
7191 fm_font_family_alist = Fcons (Fcons (build_string (name), 7269 family = build_string (name);
7192 make_number (ff)), 7270 if (!NILP (Fassoc (family, fm_font_family_alist)))
7271 continue;
7272 fm_font_family_alist = Fcons (Fcons (family, make_number (ff)),
7193 fm_font_family_alist); 7273 fm_font_family_alist);
7194 7274
7195 /* Point the instance iterator at the current font family. */ 7275 /* Point the instance iterator at the current font family. */
7196 if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr) 7276 if (FMResetFontFamilyInstanceIterator (ff, &ffii) != noErr)
7197 break; 7277 continue;
7198 7278
7199 while (FMGetNextFontFamilyInstance (&ffii, &font, &style, &size) 7279 while (FMGetNextFontFamilyInstance (&ffii, &font, &style, &size)
7200 == noErr) 7280 == noErr)
@@ -7203,27 +7283,7 @@ init_font_name_table ()
7203 7283
7204 if (size > 0 || style == normal) 7284 if (size > 0 || style == normal)
7205 for (; !NILP (rest); rest = XCDR (rest)) 7285 for (; !NILP (rest); rest = XCDR (rest))
7206 { 7286 add_mac_font_name (name, size, style, SDATA (XCAR (rest)));
7207 char *cs = SDATA (XCAR (rest));
7208
7209 if (size == 0)
7210 {
7211 add_font_name_table_entry (mac_to_x_fontname (name, size,
7212 style, cs));
7213 add_font_name_table_entry (mac_to_x_fontname (name, size,
7214 italic, cs));
7215 add_font_name_table_entry (mac_to_x_fontname (name, size,
7216 bold, cs));
7217 add_font_name_table_entry (mac_to_x_fontname (name, size,
7218 italic | bold,
7219 cs));
7220 }
7221 else
7222 {
7223 add_font_name_table_entry (mac_to_x_fontname (name, size,
7224 style, cs));
7225 }
7226 }
7227 } 7287 }
7228 } 7288 }
7229 7289
@@ -7243,7 +7303,7 @@ init_font_name_table ()
7243 Str255 name; 7303 Str255 name;
7244 struct FontAssoc *fat; 7304 struct FontAssoc *fat;
7245 struct AsscEntry *assc_entry; 7305 struct AsscEntry *assc_entry;
7246 Lisp_Object text_encoding_info_alist, text_encoding_info; 7306 Lisp_Object text_encoding_info_alist, text_encoding_info, family;
7247 struct gcpro gcpro1; 7307 struct gcpro gcpro1;
7248 7308
7249 GetPort (&port); /* save the current font number used */ 7309 GetPort (&port); /* save the current font number used */
@@ -7262,7 +7322,7 @@ init_font_name_table ()
7262 GetResInfo (font_handle, &id, &type, name); 7322 GetResInfo (font_handle, &id, &type, name);
7263 GetFNum (name, &fontnum); 7323 GetFNum (name, &fontnum);
7264 p2cstr (name); 7324 p2cstr (name);
7265 if (fontnum == 0) 7325 if (fontnum == 0 || *name == '.')
7266 continue; 7326 continue;
7267 7327
7268 TextFont (fontnum); 7328 TextFont (fontnum);
@@ -7274,8 +7334,10 @@ init_font_name_table ()
7274 text_encoding_info_alist); 7334 text_encoding_info_alist);
7275 decode_mac_font_name (name, sizeof (name), 7335 decode_mac_font_name (name, sizeof (name),
7276 XCAR (XCDR (text_encoding_info))); 7336 XCAR (XCDR (text_encoding_info)));
7277 fm_font_family_alist = Fcons (Fcons (build_string (name), 7337 family = build_string (name);
7278 make_number (fontnum)), 7338 if (!NILP (Fassoc (family, fm_font_family_alist)))
7339 continue;
7340 fm_font_family_alist = Fcons (Fcons (family, make_number (fontnum)),
7279 fm_font_family_alist); 7341 fm_font_family_alist);
7280 do 7342 do
7281 { 7343 {
@@ -7296,14 +7358,9 @@ init_font_name_table ()
7296 Lisp_Object rest = XCDR (XCDR (text_encoding_info)); 7358 Lisp_Object rest = XCDR (XCDR (text_encoding_info));
7297 7359
7298 for (; !NILP (rest); rest = XCDR (rest)) 7360 for (; !NILP (rest); rest = XCDR (rest))
7299 { 7361 add_mac_font_name (name, assc_entry->fontSize,
7300 char *cs = SDATA (XCAR (rest)); 7362 assc_entry->fontStyle,
7301 7363 SDATA (XCAR (rest)));
7302 add_font_name_table_entry (mac_to_x_fontname (name,
7303 assc_entry->fontSize,
7304 assc_entry->fontStyle,
7305 cs));
7306 }
7307 } 7364 }
7308 } 7365 }
7309 7366
@@ -7771,10 +7828,10 @@ XLoadQueryFont (Display *dpy, char *fontname)
7771 font->min_char_or_byte2 = 0; 7828 font->min_char_or_byte2 = 0;
7772 font->max_char_or_byte2 = 0xff; 7829 font->max_char_or_byte2 = 0xff;
7773 7830
7774 font->bounds.rows = xmalloc (sizeof (XCharStructRow *) * 0x100); 7831 font->bounds.rows = xmalloc (sizeof (XCharStruct *) * 0x100);
7775 bzero (font->bounds.rows, sizeof (XCharStructRow *) * 0x100); 7832 bzero (font->bounds.rows, sizeof (XCharStruct *) * 0x100);
7776 font->bounds.rows[0] = xmalloc (sizeof (XCharStructRow)); 7833 font->bounds.rows[0] = xmalloc (sizeof (XCharStruct) * 0x100);
7777 bzero (font->bounds.rows[0], sizeof (XCharStructRow)); 7834 pcm_init (font->bounds.rows[0], 0x100);
7778 7835
7779#if USE_CG_TEXT_DRAWING 7836#if USE_CG_TEXT_DRAWING
7780 { 7837 {
@@ -7800,7 +7857,7 @@ XLoadQueryFont (Display *dpy, char *fontname)
7800 bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100); 7857 bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
7801 } 7858 }
7802#endif 7859#endif
7803 space_bounds = font->bounds.rows[0]->per_char + 0x20; 7860 space_bounds = font->bounds.rows[0] + 0x20;
7804 err = mac_query_char_extents (font->mac_style, 0x20, 7861 err = mac_query_char_extents (font->mac_style, 0x20,
7805 &font->ascent, &font->descent, 7862 &font->ascent, &font->descent,
7806 space_bounds, 7863 space_bounds,
@@ -7816,9 +7873,8 @@ XLoadQueryFont (Display *dpy, char *fontname)
7816 mac_unload_font (&one_mac_display_info, font); 7873 mac_unload_font (&one_mac_display_info, font);
7817 return NULL; 7874 return NULL;
7818 } 7875 }
7819 XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], 0x20);
7820 7876
7821 pcm = font->bounds.rows[0]->per_char; 7877 pcm = font->bounds.rows[0];
7822 for (c = 0x21; c <= 0xff; c++) 7878 for (c = 0x21; c <= 0xff; c++)
7823 { 7879 {
7824 if (c == 0xad) 7880 if (c == 0xad)
@@ -7838,7 +7894,6 @@ XLoadQueryFont (Display *dpy, char *fontname)
7838 NULL 7894 NULL
7839#endif 7895#endif
7840 ); 7896 );
7841 XCHARSTRUCTROW_SET_CHAR_VALID (font->bounds.rows[0], c);
7842 7897
7843#if USE_CG_TEXT_DRAWING 7898#if USE_CG_TEXT_DRAWING
7844 if (font->cg_glyphs && font->cg_glyphs[c] == 0) 7899 if (font->cg_glyphs && font->cg_glyphs[c] == 0)
@@ -10024,8 +10079,20 @@ XTread_socket (sd, expected, hold_quit)
10024 } 10079 }
10025 break; 10080 break;
10026 10081
10082#if TARGET_API_MAC_CARBON
10083 case inProxyIcon:
10084 if (TrackWindowProxyDrag (window_ptr, er.where)
10085 != errUserWantsToDragWindow)
10086 break;
10087 /* fall through */
10088#endif
10027 case inDrag: 10089 case inDrag:
10028#if TARGET_API_MAC_CARBON 10090#if TARGET_API_MAC_CARBON
10091 if (IsWindowPathSelectClick (window_ptr, &er))
10092 {
10093 WindowPathSelect (window_ptr, NULL, NULL);
10094 break;
10095 }
10029 DragWindow (window_ptr, er.where, NULL); 10096 DragWindow (window_ptr, er.where, NULL);
10030#else /* not TARGET_API_MAC_CARBON */ 10097#else /* not TARGET_API_MAC_CARBON */
10031 DragWindow (window_ptr, er.where, &qd.screenBits.bounds); 10098 DragWindow (window_ptr, er.where, &qd.screenBits.bounds);
@@ -11076,7 +11143,11 @@ button will be mouse-3. */);
11076 doc: /* *If non-nil, allow anti-aliasing. 11143 doc: /* *If non-nil, allow anti-aliasing.
11077The text will be rendered using Core Graphics text rendering which 11144The text will be rendered using Core Graphics text rendering which
11078may anti-alias the text. */); 11145may anti-alias the text. */);
11146#if USE_CG_DRAWING
11147 mac_use_core_graphics = 1;
11148#else
11079 mac_use_core_graphics = 0; 11149 mac_use_core_graphics = 0;
11150#endif
11080 11151
11081 /* Register an entry for `mac-roman' so that it can be used when 11152 /* Register an entry for `mac-roman' so that it can be used when
11082 creating the terminal frame on Mac OS 9 before loading 11153 creating the terminal frame on Mac OS 9 before loading
diff --git a/src/macterm.h b/src/macterm.h
index e35f04a6ba6..f23554f01c6 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -335,6 +335,11 @@ struct mac_output {
335 /* Hints for the size and the position of a window. */ 335 /* Hints for the size and the position of a window. */
336 XSizeHints *size_hints; 336 XSizeHints *size_hints;
337 337
338#if TARGET_API_MAC_CARBON
339 /* File name for the proxy icon of this frame. Might be NULL. */
340 char *file_name;
341#endif
342
338#if USE_CG_DRAWING 343#if USE_CG_DRAWING
339 /* Quartz 2D graphics context. */ 344 /* Quartz 2D graphics context. */
340 CGContextRef cg_context; 345 CGContextRef cg_context;
@@ -360,6 +365,8 @@ typedef struct mac_output mac_output;
360 365
361#define FRAME_SIZE_HINTS(f) ((f)->output_data.mac->size_hints) 366#define FRAME_SIZE_HINTS(f) ((f)->output_data.mac->size_hints)
362 367
368#define FRAME_FILE_NAME(f) ((f)->output_data.mac->file_name)
369
363/* This gives the mac_display_info structure for the display F is on. */ 370/* This gives the mac_display_info structure for the display F is on. */
364#define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info) 371#define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info)
365#define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info) 372#define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info)
@@ -606,6 +613,7 @@ extern int x_char_width P_ ((struct frame *));
606extern int x_char_height P_ ((struct frame *)); 613extern int x_char_height P_ ((struct frame *));
607extern void x_sync P_ ((struct frame *)); 614extern void x_sync P_ ((struct frame *));
608extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); 615extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
616extern void mac_update_title_bar P_ ((struct frame *, int));
609 617
610/* Defined in macmenu.c */ 618/* Defined in macmenu.c */
611 619
diff --git a/src/process.h b/src/process.h
index c4b4281fedf..b585515d6b1 100644
--- a/src/process.h
+++ b/src/process.h
@@ -19,6 +19,12 @@ along with GNU Emacs; see the file COPYING. If not, write to
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */ 20Boston, MA 02110-1301, USA. */
21 21
22#ifdef HAVE_SYS_TYPES_H
23#include <sys/types.h>
24#endif
25#ifdef HAVE_UNISTD_H
26#include <unistd.h>
27#endif
22 28
23/* This structure records information about a subprocess 29/* This structure records information about a subprocess
24 or network connection. 30 or network connection.
diff --git a/src/puresize.h b/src/puresize.h
index fa73736bc43..1288feff151 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 (1200000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) 46#define BASE_PURESIZE (1205000 + 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/s/ms-w32.h b/src/s/ms-w32.h
index 55f62644d04..fa4ca565171 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -466,9 +466,9 @@ extern char *get_emacs_configuration_options (void);
466#include <string.h> 466#include <string.h>
467 467
468/* We need a little extra space, see ../../lisp/loadup.el. 468/* We need a little extra space, see ../../lisp/loadup.el.
469 The number below comes from 22038 bytes worth (as of 2006-04) 469 The number below comes from 23923 bytes worth (as of 2006-04)
470 of w32-specific files loaded by loadup.el, plus 2K spare. */ 470 of w32-specific files loaded by loadup.el, plus 1K spare. */
471#define SYSTEM_PURESIZE_EXTRA 24000 471#define SYSTEM_PURESIZE_EXTRA 25000
472 472
473/* For unexec to work on Alpha systems, we need to put Emacs' 473/* For unexec to work on Alpha systems, we need to put Emacs'
474 initialized data into a separate section from the CRT initialized 474 initialized data into a separate section from the CRT initialized
diff --git a/src/syntax.c b/src/syntax.c
index f8d50d1e5b4..3f6058e3b1a 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -2344,8 +2344,6 @@ between them, return t; otherwise return nil. */)
2344 while (1) 2344 while (1)
2345 { 2345 {
2346 DEC_BOTH (from, from_byte); 2346 DEC_BOTH (from, from_byte);
2347 if (from == stop)
2348 break;
2349 UPDATE_SYNTAX_TABLE_BACKWARD (from); 2347 UPDATE_SYNTAX_TABLE_BACKWARD (from);
2350 c = FETCH_CHAR_AS_MULTIBYTE (from_byte); 2348 c = FETCH_CHAR_AS_MULTIBYTE (from_byte);
2351 if (SYNTAX (c) == Scomment_fence 2349 if (SYNTAX (c) == Scomment_fence
@@ -2354,6 +2352,8 @@ between them, return t; otherwise return nil. */)
2354 found = 1; 2352 found = 1;
2355 break; 2353 break;
2356 } 2354 }
2355 else if (from == stop)
2356 break;
2357 } 2357 }
2358 if (found == 0) 2358 if (found == 0)
2359 { 2359 {
@@ -2361,6 +2361,9 @@ between them, return t; otherwise return nil. */)
2361 from_byte = ini_byte; 2361 from_byte = ini_byte;
2362 goto leave; 2362 goto leave;
2363 } 2363 }
2364 else
2365 /* We have skipped one comment. */
2366 break;
2364 } 2367 }
2365 else if (code == Sendcomment) 2368 else if (code == Sendcomment)
2366 { 2369 {
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index 4ca0be829a2..f65fd9cbc22 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -1021,6 +1021,9 @@ void
1021unexec (char *outfile, char *infile, void *start_data, void *start_bss, 1021unexec (char *outfile, char *infile, void *start_data, void *start_bss,
1022 void *entry_address) 1022 void *entry_address)
1023{ 1023{
1024 if (in_dumped_exec)
1025 unexec_error ("Unexec from a dumped executable is not supported.");
1026
1024 infd = open (infile, O_RDONLY, 0); 1027 infd = open (infile, O_RDONLY, 0);
1025 if (infd < 0) 1028 if (infd < 0)
1026 { 1029 {
diff --git a/src/w32fns.c b/src/w32fns.c
index 95ba34fc1e4..4da5271c870 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -3191,6 +3191,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3191 } 3191 }
3192 wmsg.dwModifiers = w32_get_modifiers (); 3192 wmsg.dwModifiers = w32_get_modifiers ();
3193 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); 3193 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
3194 signal_user_input ();
3194 3195
3195 /* Clear message buffer. */ 3196 /* Clear message buffer. */
3196 saved_mouse_button_msg.msg.hwnd = 0; 3197 saved_mouse_button_msg.msg.hwnd = 0;
@@ -3248,6 +3249,7 @@ w32_wnd_proc (hwnd, msg, wParam, lParam)
3248 } 3249 }
3249 wmsg.dwModifiers = w32_get_modifiers (); 3250 wmsg.dwModifiers = w32_get_modifiers ();
3250 my_post_msg (&wmsg, hwnd, msg, wParam, lParam); 3251 my_post_msg (&wmsg, hwnd, msg, wParam, lParam);
3252 signal_user_input ();
3251 3253
3252 /* Always clear message buffer and cancel timer. */ 3254 /* Always clear message buffer and cancel timer. */
3253 saved_mouse_button_msg.msg.hwnd = 0; 3255 saved_mouse_button_msg.msg.hwnd = 0;
diff --git a/src/w32term.c b/src/w32term.c
index 5681b6ee62f..305527946fb 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -3282,8 +3282,10 @@ construct_mouse_wheel (result, msg, f)
3282 result->modifiers = (msg->dwModifiers 3282 result->modifiers = (msg->dwModifiers
3283 | ((delta < 0 ) ? down_modifier : up_modifier)); 3283 | ((delta < 0 ) ? down_modifier : up_modifier));
3284 3284
3285 p.x = LOWORD (msg->msg.lParam); 3285 /* With multiple monitors, we can legitimately get negative
3286 p.y = HIWORD (msg->msg.lParam); 3286 coordinates, so cast to short to interpret them correctly. */
3287 p.x = (short) LOWORD (msg->msg.lParam);
3288 p.y = (short) HIWORD (msg->msg.lParam);
3287 ScreenToClient (msg->msg.hwnd, &p); 3289 ScreenToClient (msg->msg.hwnd, &p);
3288 XSETINT (result->x, p.x); 3290 XSETINT (result->x, p.x);
3289 XSETINT (result->y, p.y); 3291 XSETINT (result->y, p.y);
diff --git a/src/window.c b/src/window.c
index 1bd8c3924a1..1abeec92367 100644
--- a/src/window.c
+++ b/src/window.c
@@ -3437,7 +3437,7 @@ displaying BUFFER, then simply raise that frame.
3437The variables `special-display-buffer-names', 3437The variables `special-display-buffer-names',
3438`special-display-regexps', `same-window-buffer-names', and 3438`special-display-regexps', `same-window-buffer-names', and
3439`same-window-regexps' customize how certain buffer names are handled. 3439`same-window-regexps' customize how certain buffer names are handled.
3440The latter two take effect only if NOT-THIS-WINDOW is t. 3440The latter two take effect only if NOT-THIS-WINDOW is nil.
3441 3441
3442If optional argument FRAME is `visible', search all visible frames. 3442If optional argument FRAME is `visible', search all visible frames.
3443If FRAME is 0, search all visible and iconified frames. 3443If FRAME is 0, search all visible and iconified frames.
diff --git a/src/xdisp.c b/src/xdisp.c
index 1689ec88be5..63a1338b2cb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -9060,6 +9060,9 @@ prepare_menu_bars ()
9060 update_menu_bar (f, 0); 9060 update_menu_bar (f, 0);
9061#ifdef HAVE_WINDOW_SYSTEM 9061#ifdef HAVE_WINDOW_SYSTEM
9062 update_tool_bar (f, 0); 9062 update_tool_bar (f, 0);
9063#ifdef MAC_OS
9064 mac_update_title_bar (f, 0);
9065#endif
9063#endif 9066#endif
9064 UNGCPRO; 9067 UNGCPRO;
9065 } 9068 }
@@ -9072,6 +9075,9 @@ prepare_menu_bars ()
9072 update_menu_bar (sf, 1); 9075 update_menu_bar (sf, 1);
9073#ifdef HAVE_WINDOW_SYSTEM 9076#ifdef HAVE_WINDOW_SYSTEM
9074 update_tool_bar (sf, 1); 9077 update_tool_bar (sf, 1);
9078#ifdef MAC_OS
9079 mac_update_title_bar (sf, 1);
9080#endif
9075#endif 9081#endif
9076 } 9082 }
9077 9083
@@ -9668,20 +9674,22 @@ tool_bar_lines_needed (f, n_rows)
9668{ 9674{
9669 struct window *w = XWINDOW (f->tool_bar_window); 9675 struct window *w = XWINDOW (f->tool_bar_window);
9670 struct it it; 9676 struct it it;
9677 struct glyph_row *temp_row = w->desired_matrix->rows;
9671 9678
9672 /* Initialize an iterator for iteration over 9679 /* Initialize an iterator for iteration over
9673 F->desired_tool_bar_string in the tool-bar window of frame F. */ 9680 F->desired_tool_bar_string in the tool-bar window of frame F. */
9674 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); 9681 init_iterator (&it, w, -1, -1, temp_row, TOOL_BAR_FACE_ID);
9675 it.first_visible_x = 0; 9682 it.first_visible_x = 0;
9676 it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); 9683 it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
9677 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); 9684 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
9678 9685
9679 while (!ITERATOR_AT_END_P (&it)) 9686 while (!ITERATOR_AT_END_P (&it))
9680 { 9687 {
9681 it.glyph_row = w->desired_matrix->rows; 9688 clear_glyph_row (temp_row);
9682 clear_glyph_row (it.glyph_row); 9689 it.glyph_row = temp_row;
9683 display_tool_bar_line (&it, -1); 9690 display_tool_bar_line (&it, -1);
9684 } 9691 }
9692 clear_glyph_row (temp_row);
9685 9693
9686 /* f->n_tool_bar_rows == 0 means "unknown"; -1 means no tool-bar. */ 9694 /* f->n_tool_bar_rows == 0 means "unknown"; -1 means no tool-bar. */
9687 if (n_rows) 9695 if (n_rows)
@@ -9761,7 +9769,29 @@ redisplay_tool_bar (f)
9761 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); 9769 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
9762 9770
9763 if (f->n_tool_bar_rows == 0) 9771 if (f->n_tool_bar_rows == 0)
9764 (void)tool_bar_lines_needed (f, &f->n_tool_bar_rows); 9772 {
9773 int nlines;
9774
9775 if ((nlines = tool_bar_lines_needed (f, &f->n_tool_bar_rows),
9776 nlines != WINDOW_TOTAL_LINES (w)))
9777 {
9778 extern Lisp_Object Qtool_bar_lines;
9779 Lisp_Object frame;
9780 int old_height = WINDOW_TOTAL_LINES (w);
9781
9782 XSETFRAME (frame, f);
9783 clear_glyph_matrix (w->desired_matrix);
9784 Fmodify_frame_parameters (frame,
9785 Fcons (Fcons (Qtool_bar_lines,
9786 make_number (nlines)),
9787 Qnil));
9788 if (WINDOW_TOTAL_LINES (w) != old_height)
9789 {
9790 fonts_changed_p = 1;
9791 return 1;
9792 }
9793 }
9794 }
9765 9795
9766 /* Display as many lines as needed to display all tool-bar items. */ 9796 /* Display as many lines as needed to display all tool-bar items. */
9767 9797
@@ -12957,7 +12987,8 @@ redisplay_window (window, just_this_one_p)
12957 /* If first window line is a continuation line, and window start 12987 /* If first window line is a continuation line, and window start
12958 is inside the modified region, but the first change is before 12988 is inside the modified region, but the first change is before
12959 current window start, we must select a new window start.*/ 12989 current window start, we must select a new window start.*/
12960 if (NILP (w->start_at_line_beg)) 12990 if (NILP (w->start_at_line_beg)
12991 && CHARPOS (startp) > BEGV)
12961 { 12992 {
12962 /* Make sure beg_unchanged and end_unchanged are up to date. 12993 /* Make sure beg_unchanged and end_unchanged are up to date.
12963 Do it only if buffer has really changed. This may or may 12994 Do it only if buffer has really changed. This may or may
@@ -18593,8 +18624,7 @@ get_glyph_face_and_encoding (f, glyph, char2b, two_byte_p)
18593 sure to use a face suitable for unibyte. */ 18624 sure to use a face suitable for unibyte. */
18594 STORE_XCHAR2B (char2b, 0, glyph->u.ch); 18625 STORE_XCHAR2B (char2b, 0, glyph->u.ch);
18595 } 18626 }
18596 else if (glyph->u.ch < 128 18627 else if (glyph->u.ch < 128)
18597 && glyph->face_id < BASIC_FACE_ID_SENTINEL)
18598 { 18628 {
18599 /* Case of ASCII in a face known to fit ASCII. */ 18629 /* Case of ASCII in a face known to fit ASCII. */
18600 STORE_XCHAR2B (char2b, 0, glyph->u.ch); 18630 STORE_XCHAR2B (char2b, 0, glyph->u.ch);
@@ -18814,6 +18844,7 @@ fill_stretch_glyph_string (s, row, area, start, end)
18814 s->font = s->face->font; 18844 s->font = s->face->font;
18815 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id); 18845 s->font_info = FONT_INFO_FROM_ID (s->f, s->face->font_info_id);
18816 s->width = glyph->pixel_width; 18846 s->width = glyph->pixel_width;
18847 s->nchars = 1;
18817 voffset = glyph->voffset; 18848 voffset = glyph->voffset;
18818 18849
18819 for (++glyph; 18850 for (++glyph;
@@ -19011,7 +19042,7 @@ get_char_face_and_encoding (f, c, face_id, char2b, multibyte_p, display_p)
19011 face_id = FACE_FOR_CHAR (f, face, c, -1, Qnil); 19042 face_id = FACE_FOR_CHAR (f, face, c, -1, Qnil);
19012 face = FACE_FROM_ID (f, face_id); 19043 face = FACE_FROM_ID (f, face_id);
19013 } 19044 }
19014 else if (c < 128 && face_id < BASIC_FACE_ID_SENTINEL) 19045 else if (c < 128)
19015 { 19046 {
19016 /* Case of ASCII in a face known to fit ASCII. */ 19047 /* Case of ASCII in a face known to fit ASCII. */
19017 STORE_XCHAR2B (char2b, 0, c); 19048 STORE_XCHAR2B (char2b, 0, c);
@@ -19968,20 +19999,6 @@ produce_stretch_glyph (it)
19968 it->descent = it->phys_descent = height - it->ascent; 19999 it->descent = it->phys_descent = height - it->ascent;
19969 it->nglyphs = width > 0 && height > 0 ? 1 : 0; 20000 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
19970 20001
19971 if (width > 0 && height > 0 && face->box != FACE_NO_BOX)
19972 {
19973 if (face->box_line_width > 0)
19974 {
19975 it->ascent += face->box_line_width;
19976 it->descent += face->box_line_width;
19977 }
19978
19979 if (it->start_of_box_run_p)
19980 it->pixel_width += abs (face->box_line_width);
19981 if (it->end_of_box_run_p)
19982 it->pixel_width += abs (face->box_line_width);
19983 }
19984
19985 take_vertical_position_into_account (it); 20002 take_vertical_position_into_account (it);
19986} 20003}
19987 20004
diff --git a/src/xmenu.c b/src/xmenu.c
index 8558e113863..2abf0a48319 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -327,6 +327,7 @@ restore_menu_items (saved)
327 menu_items_n_panes = XINT (XCAR (saved)); 327 menu_items_n_panes = XINT (XCAR (saved));
328 saved = XCDR (saved); 328 saved = XCDR (saved);
329 menu_items_submenu_depth = XINT (XCAR (saved)); 329 menu_items_submenu_depth = XINT (XCAR (saved));
330 return Qnil;
330} 331}
331 332
332/* Push the whole state of menu_items processing onto the specpdl. 333/* Push the whole state of menu_items processing onto the specpdl.