aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-10-09 20:00:17 +0000
committerKaroly Lorentey2005-10-09 20:00:17 +0000
commit0ff21b4e57b1dc7c714c21c9eea1a4906630ecf2 (patch)
tree3e8596405b243531128cd0f1d8f59d2ab9e7f7c7 /src
parenta3c07f683d1f9fbf7c7af0120dfebc5fc34b61fa (diff)
parent20ef86730cca82a1a2e212a665c0b119ed2d70b2 (diff)
downloademacs-0ff21b4e57b1dc7c714c21c9eea1a4906630ecf2.tar.gz
emacs-0ff21b4e57b1dc7c714c21c9eea1a4906630ecf2.zip
Merged from miles@gnu.org--gnu-2005 (patch 118-132, 551-577)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-551 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-552 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-553 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-554 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-555 Remove CVS keywords from newsticker files * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-556 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-557 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-558 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-559 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-560 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-561 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-562 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-563 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-564 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-565 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-566 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-567 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-568 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-569 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-570 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-571 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-572 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-573 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-574 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-575 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-576 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-577 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-118 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-119 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-120 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-121 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-122 Update from CVS: lisp/mm-url.el (mm-url-decode-entities): Fix regexp. * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-123 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-124 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-125 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-126 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-127 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-128 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-129 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-130 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-131 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-132 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-423
Diffstat (limited to 'src')
-rw-r--r--src/.gitignore1
-rw-r--r--src/ChangeLog222
-rw-r--r--src/Makefile.in9
-rw-r--r--src/alloc.c50
-rw-r--r--src/data.c1
-rw-r--r--src/dired.c2
-rw-r--r--src/dispextern.h1
-rw-r--r--src/editfns.c18
-rw-r--r--src/emacs.c4
-rw-r--r--src/fileio.c5
-rw-r--r--src/fns.c6
-rw-r--r--src/gtkutil.c3
-rw-r--r--src/image.c22
-rw-r--r--src/keyboard.c37
-rw-r--r--src/m/ibmrs6000.h2
-rw-r--r--src/macfns.c20
-rw-r--r--src/macgui.h33
-rw-r--r--src/macterm.c818
-rw-r--r--src/marker.c1
-rw-r--r--src/minibuf.c26
-rw-r--r--src/process.c11
-rw-r--r--src/regex.c4
-rw-r--r--src/regex.h5
-rw-r--r--src/s/aix4-2.h18
-rw-r--r--src/sysdep.c7
-rw-r--r--src/systime.h11
-rw-r--r--src/unexelf.c2
-rw-r--r--src/window.c112
-rw-r--r--src/window.h5
-rw-r--r--src/xdisp.c20
-rw-r--r--src/xfaces.c20
-rw-r--r--src/xsmfns.c2
-rw-r--r--src/xterm.c10
-rw-r--r--src/xterm.h1
34 files changed, 1192 insertions, 317 deletions
diff --git a/src/.gitignore b/src/.gitignore
index 48c78a4f3a6..8dbbc9f86b6 100644
--- a/src/.gitignore
+++ b/src/.gitignore
@@ -3,6 +3,7 @@
3*.pdb 3*.pdb
4.gdb_history 4.gdb_history
5Makefile 5Makefile
6makefile
6Makefile.c 7Makefile.c
7TAGS-LISP 8TAGS-LISP
8_gdbinit 9_gdbinit
diff --git a/src/ChangeLog b/src/ChangeLog
index c0f1ceee87e..adb5b204953 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,225 @@
12005-10-04 Kim F. Storm <storm@cua.dk>
2
3 * window.c (window_split_tree): New function.
4 (Fwindow_split_tree): New defun.
5 (syms_of_window): Defsubr it.
6
72005-10-04 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
8
9 * macterm.c (mac_invert_rectangle): New function.
10 (XTflash): Use it.
11
122005-10-04 Stefan Monnier <monnier@iro.umontreal.ca>
13
14 * regex.h (re_char): Don't expose it in the interface.
15 (re_set_whitespace_regexp): Adjust the arg's type to not use it.
16
17 * regex.c (re_char): Move it back here.
18 (re_set_whitespace_regexp): Change the arg's type to not use it.
19
20 * keyboard.c (make_lispy_event): If point has moved between down and up
21 event, make it a drag, not a click, to mirror what
22 mouse-drag-region expects.
23
242005-10-02 Dan Nicolaescu <dann@ics.uci.edu>
25
26 * lisp.h (fatal): Undo previous change.
27 * term.c (fatal): Undo previous change.
28
292005-10-01 Richard M. Stallman <rms@gnu.org>
30
31 * xfaces.c (face_color_gray_p): Colors close to black count as gray.
32
332005-10-01 Kim F. Storm <storm@cua.dk>
34
35 * xdisp.c (try_window): Skip scroll-margin check if ZV is visible.
36
372005-10-01 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
38
39 * keyboard.c (init_keyboard) [MAC_OSX]: Don't install SIGINT handler.
40
41 * macfns.c (start_hourglass): Apply 2005-05-07 change for xfns.c.
42 (x_create_tip_frame) [GLYPH_DEBUG]: Uncomment debug code.
43 (Fx_create_frame, x_create_tip_frame) [USE_ATSUI]:
44 Try ATSUI-compatible 12pt Monaco font first.
45
46 * macgui.h (struct _XCharStruct): New member valid_p.
47 (STORE_XCHARSTRUCT): Set valid_p.
48 (struct MacFontStruct) [USE_ATSUI]: New member mac_style.
49
50 * macterm.c (mac_draw_string_common, x_per_char_metric)
51 (mac_compute_glyph_string_overhangs, init_font_name_table)
52 (XLoadQueryFont, mac_unload_font) [USE_ATSUI]: Add ATSUI support.
53 (atsu_get_text_layout_with_text_ptr) [USE_ATSUI]: New function.
54 (x_draw_glyph_string_background)
55 (x_draw_glyph_string_foreground) [MAC_OS8 && USE_ATSUI]: Don't use
56 XDrawImageString. Always draw background and foreground separately.
57 (x_draw_glyph_string_foreground) [USE_ATSUI]: Don't use 8-bit
58 functions for one-byte chars when using ATSUI-compatible fonts.
59 (atsu_font_id_hash) [USE_ATSUI]: New variable.
60 (syms_of_macterm) [USE_ATSUI]: Initialize and staticpro it.
61 (XLoadQueryFont): Set min_byte1, max_byte1, min_char_or_byte2, and
62 max_char_or_byte2 more in detail.
63 (quit_char_comp, mac_check_for_quit_char) [MAC_OSX]: Remove functions.
64
652005-09-30 Dan Nicolaescu <dann@ics.uci.edu>
66
67 * image.c (slurp_file, xbm_read_bitmap_data): Cast to the correct type.
68 * xterm.c (handle_one_xevent, handle_one_xevent): Likewise.
69
70 * unexelf.c (fatal): Fix prototype.
71
72 * term.c (fatal): Implement using varargs.
73
74 * regex.c (re_char): Move typedef ...
75 * regex.h (re_char): ... here.
76 (re_iswctype, re_wctype, re_set_whitespace_regexp): New prototypes.
77
78 * emacs.c (malloc_set_state): Fix return type.
79 (endif): Fix type.
80
81 * lisp.h (fatal): Add argument types.
82
83 * dispextern.h (fatal): Delete prototype.
84
85 * systime.h: (make_time): Prototype moved from ...
86 * editfns.c (make_time): ... here.
87
88 * editfns.c: Move systime.h include after lisp.h.
89 * dired.c:
90 * xsmfns.c:
91 * process.c: Likewise.
92
93 * alloc.c (old_malloc_hook, old_realloc_hook, old_realloc_hook):
94 Add parameter types.
95 (__malloc_hook, __realloc_hook, __free_hook): Fix prototypes.
96 (emacs_blocked_free): Change definition to match __free_hook.
97 (emacs_blocked_malloc): Change definition to match __malloc_hook.
98 (emacs_blocked_realloc): Change definition to match __realloc_hook.
99
1002005-09-30 Romain Francoise <romain@orebokech.com>
101
102 * minibuf.c (Fread_buffer): Follow convention for reading from the
103 minibuffer with a default value. Doc fix.
104
1052005-09-29 Juri Linkov <juri@jurta.org>
106
107 * editfns.c (Fmessage, Fmessage_box, Fmessage_or_box):
108 Rename argument name `string' to `format-string'.
109 (Fformat): Doc fix.
110
1112005-09-28 Kim F. Storm <storm@cua.dk>
112
113 * image.c (gif_load): Fix size of allocated image buffer
114 for images where a sub-image may be larger than the image's
115 total height/width specifications.
116
1172005-09-28 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
118
119 * macgui.h (struct _XCharStruct): Each member now takes short value.
120
1212005-09-27 Dan Nicolaescu <dann@ics.uci.edu>
122
123 * xfaces.c (lookup_derived_face): Add parameter type.
124
125 * xdisp.c (cursor_row_fully_visible_p): Add parameter type.
126
127 * marker.c (verify_bytepos): Add parameter type.
128
129 * process.c (get_operating_system_release): Move prototype ...
130
131 * systime.h (get_operating_system_release): ... here.
132
133 * xterm.c (set_vertical_scroll_bar): Move prototype ...
134 (handle_one_xevent): Refer to union field to match the type
135 required by the function definition.
136
137 * xterm.h: ... here.
138
139 * fns.c (internal_equal, seed_random): Fix prototypes.
140 (internal_equal): Add missing parameter.
141
1422005-09-25 Richard M. Stallman <rms@gnu.org>
143
144 * keyboard.c (update_menu_bindings): Variable deleted.
145 (syms_of_keyboard): Don't defvar it.
146 (parse_menu_item): Don't test it.
147
1482005-09-23 Richard M. Stallman <rms@gnu.org>
149
150 * editfns.c (Fformat): Explicitly test for end of format string
151 and don't use `index'.
152
1532005-09-23 Dan Nicolaescu <dann@ics.uci.edu>
154
155 * s/aix4-2.h (BROKEN_GET_CURRENT_DIR_NAME):
156 Define BROKEN_GET_CURRENT_DIR_NAME.
157
158 * sysdep.c (get_current_dir_name): Also define if
159 BROKEN_GET_CURRENT_DIR_NAME.
160
161 * m/ibmrs6000.h: Test for USG5, not USG5_4.
162
1632005-09-22 Kim F. Storm <storm@cua.dk>
164
165 * xdisp.c (message_dolog): Add warning about GC and Lisp strings.
166 (message2): Fix commentary. Ok to use alloca'ed memory.
167 Still not ok to use Lisp string data (because of GC).
168 (set_message): Add comment why GC cannot happen.
169
1702005-09-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
171
172 * macterm.c (xlfdpat_block_match_1): Fix assertion.
173 (init_font_name_table) [TARGET_API_MAC_CARBON]: Don't add style
174 variants for a scalable font multiple times.
175
1762005-09-21 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
177
178 * process.c (create_process) [RTU || UNIPLUS || DONT_REOPEN_PTY]:
179 Setup slave tty options before forking.
180
1812005-09-20 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
182
183 * gtkutil.c (xg_set_geometry): Do a gtk_window_move if program
184 positions have been set for the frame (as is done for frames in
185 special-display-buffer-names).
186
1872005-09-19 Kim F. Storm <storm@cua.dk>
188
189 * editfns.c (Fformat): Don't scan past end of format string that
190 ends in %. Reported by: Johan Bockg,Ae(Brd.
191
1922005-09-18 Andreas Schwab <schwab@suse.de>
193
194 * window.h (struct window): Remove height_fixed_p, no longer set.
195
196 * window.c (make_window): Don't initialize height_fixed_p.
197 (window_fixed_size_p): Don't use it.
198
1992005-09-18 John Paul Wallington <jpw@pobox.com>
200
201 * data.c (Fdefalias): Signal an error if SYMBOL is not a symbol.
202
2032005-09-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
204
205 * Makefile.in (SOME_MACHINE_OBJECTS): Undo previous change.
206
207 * macfns.c (image_cache_refcount, dpyinfo_refcount) [GLYPH_DEBUG]:
208 New variables.
209 [TARGET_API_MAC_CARBON] (Fx_file_dialog): Don't allow multiple
210 file selection.
211
212 * sysdep.c [MAC_OS8]: Don't include stdlib.h. Include sys/param.h.
213
2142005-09-17 Eli Zaretskii <eliz@gnu.org>
215
216 * Makefile.in (XMENU_OBJ) [!HAVE_CARBON]: Reinstate variable.
217 (obj): Use XMENU_OBJ, not a literal xmenu.o.
218
2192005-09-16 Romain Francoise <romain@orebokech.com>
220
221 * fileio.c (syms_of_fileio) <write-region-inhibit-fsync>: Doc fix.
222
12005-09-15 Richard M. Stallman <rms@gnu.org> 2232005-09-15 Richard M. Stallman <rms@gnu.org>
2 224
3 * xdisp.c (overlay_arrow_at_row): Add HAVE_WINDOW_SYSTEM conditional. 225 * xdisp.c (overlay_arrow_at_row): Add HAVE_WINDOW_SYSTEM conditional.
diff --git a/src/Makefile.in b/src/Makefile.in
index b3dedd5453a..e386db3a0e8 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -304,6 +304,11 @@ ALL_CFLAGS=-Demacs -DHAVE_CONFIG_H $(TOOLKIT_DEFINES) $(MYCPPFLAGS) -I. -I${srcd
304#define LIB_X11_LIB -lX11 304#define LIB_X11_LIB -lX11
305#endif 305#endif
306 306
307/* xmenu.c should not be compiled on OSX. */
308#ifndef HAVE_CARBON
309XMENU_OBJ = xmenu.o
310#endif
311
307#ifdef HAVE_X_WINDOWS 312#ifdef HAVE_X_WINDOWS
308 313
309XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o 314XOBJ= xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o
@@ -570,7 +575,7 @@ emacsappsrc = ${srcdir}/../mac/Emacs.app/
570 575
571/* lastfile must follow all files 576/* lastfile must follow all files
572 whose initialized data areas should be dumped as pure by dump-emacs. */ 577 whose initialized data areas should be dumped as pure by dump-emacs. */
573obj= dispnew.o frame.o scroll.o xdisp.o xmenu.o window.o \ 578obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \
574 charset.o coding.o category.o ccl.o \ 579 charset.o coding.o category.o ccl.o \
575 cm.o term.o xfaces.o $(XOBJ) $(GTK_OBJ)\ 580 cm.o term.o xfaces.o $(XOBJ) $(GTK_OBJ)\
576 emacs.o keyboard.o macros.o keymap.o sysdep.o \ 581 emacs.o keyboard.o macros.o keymap.o sysdep.o \
@@ -589,7 +594,7 @@ obj= dispnew.o frame.o scroll.o xdisp.o xmenu.o window.o \
589 These go in the DOC file on all machines 594 These go in the DOC file on all machines
590 in case they are needed there. */ 595 in case they are needed there. */
591SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \ 596SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \
592 xterm.o xfns.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ 597 xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \
593 mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o \ 598 mac.o macterm.o macfns.o macmenu.o macselect.o fontset.o \
594 w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \ 599 w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \
595 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o 600 w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o
diff --git a/src/alloc.c b/src/alloc.c
index 3861d87c3d8..ff0c3d46d44 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -548,6 +548,21 @@ DEFUN ("memory-full-p", Fmemory_full_p, Smemory_full_p, 0, 0, 0,
548 return (spare_memory ? Qnil : Qt); 548 return (spare_memory ? Qnil : Qt);
549} 549}
550 550
551/* If we released our reserve (due to running out of memory),
552 and we have a fair amount free once again,
553 try to set aside another reserve in case we run out once more.
554
555 This is called when a relocatable block is freed in ralloc.c. */
556
557void
558refill_memory_reserve ()
559{
560#ifndef SYSTEM_MALLOC
561 if (spare_memory == 0)
562 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
563#endif
564}
565
551/* Called if we can't allocate relocatable space for a buffer. */ 566/* Called if we can't allocate relocatable space for a buffer. */
552 567
553void 568void
@@ -1135,20 +1150,6 @@ allocate_buffer ()
1135 1150
1136#ifndef SYSTEM_MALLOC 1151#ifndef SYSTEM_MALLOC
1137 1152
1138/* If we released our reserve (due to running out of memory),
1139 and we have a fair amount free once again,
1140 try to set aside another reserve in case we run out once more.
1141
1142 This is called when a relocatable block is freed in ralloc.c. */
1143
1144void
1145refill_memory_reserve ()
1146{
1147 if (spare_memory == 0)
1148 spare_memory = (char *) malloc ((size_t) SPARE_MEMORY);
1149}
1150
1151
1152/* Arranging to disable input signals while we're in malloc. 1153/* Arranging to disable input signals while we're in malloc.
1153 1154
1154 This only works with GNU malloc. To help out systems which can't 1155 This only works with GNU malloc. To help out systems which can't
@@ -1162,20 +1163,21 @@ refill_memory_reserve ()
1162#ifndef SYNC_INPUT 1163#ifndef SYNC_INPUT
1163 1164
1164#ifndef DOUG_LEA_MALLOC 1165#ifndef DOUG_LEA_MALLOC
1165extern void * (*__malloc_hook) P_ ((size_t)); 1166extern void * (*__malloc_hook) P_ ((size_t, const void *));
1166extern void * (*__realloc_hook) P_ ((void *, size_t)); 1167extern void * (*__realloc_hook) P_ ((void *, size_t, const void *));
1167extern void (*__free_hook) P_ ((void *)); 1168extern void (*__free_hook) P_ ((void *, const void *));
1168/* Else declared in malloc.h, perhaps with an extra arg. */ 1169/* Else declared in malloc.h, perhaps with an extra arg. */
1169#endif /* DOUG_LEA_MALLOC */ 1170#endif /* DOUG_LEA_MALLOC */
1170static void * (*old_malloc_hook) (); 1171static void * (*old_malloc_hook) P_ ((size_t, const void *));
1171static void * (*old_realloc_hook) (); 1172static void * (*old_realloc_hook) P_ ((void *, size_t, const void*));
1172static void (*old_free_hook) (); 1173static void (*old_free_hook) P_ ((void*, const void*));
1173 1174
1174/* This function is used as the hook for free to call. */ 1175/* This function is used as the hook for free to call. */
1175 1176
1176static void 1177static void
1177emacs_blocked_free (ptr) 1178emacs_blocked_free (ptr, ptr2)
1178 void *ptr; 1179 void *ptr;
1180 const void *ptr2;
1179{ 1181{
1180 BLOCK_INPUT_ALLOC; 1182 BLOCK_INPUT_ALLOC;
1181 1183
@@ -1222,8 +1224,9 @@ emacs_blocked_free (ptr)
1222/* This function is the malloc hook that Emacs uses. */ 1224/* This function is the malloc hook that Emacs uses. */
1223 1225
1224static void * 1226static void *
1225emacs_blocked_malloc (size) 1227emacs_blocked_malloc (size, ptr)
1226 size_t size; 1228 size_t size;
1229 const void *ptr;
1227{ 1230{
1228 void *value; 1231 void *value;
1229 1232
@@ -1269,9 +1272,10 @@ emacs_blocked_malloc (size)
1269/* This function is the realloc hook that Emacs uses. */ 1272/* This function is the realloc hook that Emacs uses. */
1270 1273
1271static void * 1274static void *
1272emacs_blocked_realloc (ptr, size) 1275emacs_blocked_realloc (ptr, size, ptr2)
1273 void *ptr; 1276 void *ptr;
1274 size_t size; 1277 size_t size;
1278 const void *ptr2;
1275{ 1279{
1276 void *value; 1280 void *value;
1277 1281
diff --git a/src/data.c b/src/data.c
index b024511d779..e5e77885da4 100644
--- a/src/data.c
+++ b/src/data.c
@@ -720,6 +720,7 @@ determined by DEFINITION. */)
720 (symbol, definition, docstring) 720 (symbol, definition, docstring)
721 register Lisp_Object symbol, definition, docstring; 721 register Lisp_Object symbol, definition, docstring;
722{ 722{
723 CHECK_SYMBOL (symbol);
723 if (CONSP (XSYMBOL (symbol)->function) 724 if (CONSP (XSYMBOL (symbol)->function)
724 && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload)) 725 && EQ (XCAR (XSYMBOL (symbol)->function), Qautoload))
725 LOADHIST_ATTACH (Fcons (Qt, symbol)); 726 LOADHIST_ATTACH (Fcons (Qt, symbol));
diff --git a/src/dired.c b/src/dired.c
index 927276e15c0..1f20ef8d10a 100644
--- a/src/dired.c
+++ b/src/dired.c
@@ -33,7 +33,6 @@ Boston, MA 02110-1301, USA. */
33#include <grp.h> 33#include <grp.h>
34#endif 34#endif
35 35
36#include "systime.h"
37#include <errno.h> 36#include <errno.h>
38 37
39#ifdef VMS 38#ifdef VMS
@@ -93,6 +92,7 @@ extern struct direct *readdir ();
93#endif 92#endif
94 93
95#include "lisp.h" 94#include "lisp.h"
95#include "systime.h"
96#include "buffer.h" 96#include "buffer.h"
97#include "commands.h" 97#include "commands.h"
98#include "charset.h" 98#include "charset.h"
diff --git a/src/dispextern.h b/src/dispextern.h
index a7ce3a8e75b..dda23310ffa 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2936,7 +2936,6 @@ EXFUN (Fdisplay_tty_type, 1);
2936extern struct device *init_initial_device P_ ((void)); 2936extern struct device *init_initial_device P_ ((void));
2937extern struct device *init_tty P_ ((char *, char *, int)); 2937extern struct device *init_tty P_ ((char *, char *, int));
2938extern void delete_tty P_ ((struct device *)); 2938extern void delete_tty P_ ((struct device *));
2939extern void fatal P_ ((/* char *, ... */));
2940extern void cursor_to P_ ((struct frame *, int, int)); 2939extern void cursor_to P_ ((struct frame *, int, int));
2941extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long)); 2940extern int tty_capable_p P_ ((struct tty_display_info *, unsigned, unsigned long, unsigned long));
2942extern void tty_set_terminal_modes P_ ((struct device *)); 2941extern void tty_set_terminal_modes P_ ((struct device *));
diff --git a/src/editfns.c b/src/editfns.c
index e67e56d2efa..c3982b10cea 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -37,6 +37,8 @@ Boston, MA 02110-1301, USA. */
37#include <sys/utsname.h> 37#include <sys/utsname.h>
38#endif 38#endif
39 39
40#include "lisp.h"
41
40/* systime.h includes <sys/time.h> which, on some systems, is required 42/* systime.h includes <sys/time.h> which, on some systems, is required
41 for <sys/resource.h>; thus systime.h must be included before 43 for <sys/resource.h>; thus systime.h must be included before
42 <sys/resource.h> */ 44 <sys/resource.h> */
@@ -48,7 +50,6 @@ Boston, MA 02110-1301, USA. */
48 50
49#include <ctype.h> 51#include <ctype.h>
50 52
51#include "lisp.h"
52#include "intervals.h" 53#include "intervals.h"
53#include "buffer.h" 54#include "buffer.h"
54#include "charset.h" 55#include "charset.h"
@@ -71,7 +72,6 @@ Boston, MA 02110-1301, USA. */
71extern char **environ; 72extern char **environ;
72#endif 73#endif
73 74
74extern Lisp_Object make_time P_ ((time_t));
75extern size_t emacs_strftimeu P_ ((char *, size_t, const char *, 75extern size_t emacs_strftimeu P_ ((char *, size_t, const char *,
76 const struct tm *, int)); 76 const struct tm *, int));
77static int tm_diff P_ ((struct tm *, struct tm *)); 77static int tm_diff P_ ((struct tm *, struct tm *));
@@ -3124,7 +3124,7 @@ If the first argument is nil or the empty string, the function clears
3124any existing message; this lets the minibuffer contents show. See 3124any existing message; this lets the minibuffer contents show. See
3125also `current-message'. 3125also `current-message'.
3126 3126
3127usage: (message STRING &rest ARGS) */) 3127usage: (message FORMAT-STRING &rest ARGS) */)
3128 (nargs, args) 3128 (nargs, args)
3129 int nargs; 3129 int nargs;
3130 Lisp_Object *args; 3130 Lisp_Object *args;
@@ -3154,7 +3154,7 @@ to be formatted under control of the string. See `format' for details.
3154If the first argument is nil or the empty string, clear any existing 3154If the first argument is nil or the empty string, clear any existing
3155message; let the minibuffer contents show. 3155message; let the minibuffer contents show.
3156 3156
3157usage: (message-box STRING &rest ARGS) */) 3157usage: (message-box FORMAT-STRING &rest ARGS) */)
3158 (nargs, args) 3158 (nargs, args)
3159 int nargs; 3159 int nargs;
3160 Lisp_Object *args; 3160 Lisp_Object *args;
@@ -3216,7 +3216,7 @@ to be formatted under control of the string. See `format' for details.
3216If the first argument is nil or the empty string, clear any existing 3216If the first argument is nil or the empty string, clear any existing
3217message; let the minibuffer contents show. 3217message; let the minibuffer contents show.
3218 3218
3219usage: (message-or-box STRING &rest ARGS) */) 3219usage: (message-or-box FORMAT-STRING &rest ARGS) */)
3220 (nargs, args) 3220 (nargs, args)
3221 int nargs; 3221 int nargs;
3222 Lisp_Object *args; 3222 Lisp_Object *args;
@@ -3281,8 +3281,8 @@ usage: (propertize STRING &rest PROPERTIES) */)
3281 : SBYTES (STRING)) 3281 : SBYTES (STRING))
3282 3282
3283DEFUN ("format", Fformat, Sformat, 1, MANY, 0, 3283DEFUN ("format", Fformat, Sformat, 1, MANY, 0,
3284 doc: /* Format a string out of a control-string and arguments. 3284 doc: /* Format a string out of a format-string and arguments.
3285The first argument is a control string. 3285The first argument is a format control string.
3286The other arguments are substituted into it to make the result, a string. 3286The other arguments are substituted into it to make the result, a string.
3287It may contain %-sequences meaning to substitute the next argument. 3287It may contain %-sequences meaning to substitute the next argument.
3288%s means print a string argument. Actually, prints any object, with `princ'. 3288%s means print a string argument. Actually, prints any object, with `princ'.
@@ -3424,7 +3424,9 @@ usage: (format STRING &rest OBJECTS) */)
3424 digits to print after the '.' for floats, or the max. 3424 digits to print after the '.' for floats, or the max.
3425 number of chars to print from a string. */ 3425 number of chars to print from a string. */
3426 3426
3427 while (index ("-0# ", *format)) 3427 while (format != end
3428 && (*format == '-' || *format == '0' || *format == '#'
3429 || * format == ' '))
3428 ++format; 3430 ++format;
3429 3431
3430 if (*format >= '0' && *format <= '9') 3432 if (*format >= '0' && *format <= '9')
diff --git a/src/emacs.c b/src/emacs.c
index 71b17a064c4..278c9e78ef2 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -149,7 +149,7 @@ void *malloc_state_ptr;
149/* From glibc, a routine that returns a copy of the malloc internal state. */ 149/* From glibc, a routine that returns a copy of the malloc internal state. */
150extern void *malloc_get_state (); 150extern void *malloc_get_state ();
151/* From glibc, a routine that overwrites the malloc internal state. */ 151/* From glibc, a routine that overwrites the malloc internal state. */
152extern void malloc_set_state (); 152extern int malloc_set_state ();
153/* Non-zero if the MALLOC_CHECK_ enviroment variable was set while 153/* Non-zero if the MALLOC_CHECK_ enviroment variable was set while
154 dumping. Used to work around a bug in glibc's malloc. */ 154 dumping. Used to work around a bug in glibc's malloc. */
155int malloc_using_checking; 155int malloc_using_checking;
@@ -1002,7 +1002,7 @@ main (argc, argv
1002 && !getrlimit (RLIMIT_STACK, &rlim)) 1002 && !getrlimit (RLIMIT_STACK, &rlim))
1003 { 1003 {
1004 long newlim; 1004 long newlim;
1005 extern int re_max_failures; 1005 extern size_t re_max_failures;
1006 /* Approximate the amount regex.c needs per unit of re_max_failures. */ 1006 /* Approximate the amount regex.c needs per unit of re_max_failures. */
1007 int ratio = 20 * sizeof (char *); 1007 int ratio = 20 * sizeof (char *);
1008 /* Then add 33% to cover the size of the smaller stacks that regex.c 1008 /* Then add 33% to cover the size of the smaller stacks that regex.c
diff --git a/src/fileio.c b/src/fileio.c
index 906c42d9126..1cd996d2a4f 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -6751,8 +6751,9 @@ a non-nil value. */);
6751 6751
6752#ifdef HAVE_FSYNC 6752#ifdef HAVE_FSYNC
6753 DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync, 6753 DEFVAR_BOOL ("write-region-inhibit-fsync", &write_region_inhibit_fsync,
6754 doc: /* *Non-nil means don't call fsync after saving files. 6754 doc: /* *Non-nil means don't call fsync in `write-region'.
6755Enabling this variable may result in data loss! */); 6755This variable affects calls to `write-region' as well as save commands.
6756A non-nil value may result in data loss! */);
6756 write_region_inhibit_fsync = 0; 6757 write_region_inhibit_fsync = 0;
6757#endif 6758#endif
6758 6759
diff --git a/src/fns.c b/src/fns.c
index 2e2e5759113..73ed21d0fbe 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -78,10 +78,10 @@ Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
78 78
79extern Lisp_Object Qinput_method_function; 79extern Lisp_Object Qinput_method_function;
80 80
81static int internal_equal (); 81static int internal_equal P_ ((Lisp_Object , Lisp_Object, int, int));
82 82
83extern long get_random (); 83extern long get_random ();
84extern void seed_random (); 84extern void seed_random P_ ((long));
85 85
86#ifndef HAVE_UNISTD_H 86#ifndef HAVE_UNISTD_H
87extern long time (); 87extern long time ();
@@ -2251,7 +2251,7 @@ internal_equal (o1, o2, depth, props)
2251 if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o2), 2251 if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o2),
2252 depth + 1, props) 2252 depth + 1, props)
2253 || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2), 2253 || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2),
2254 depth + 1)) 2254 depth + 1, props))
2255 return 0; 2255 return 0;
2256 o1 = XOVERLAY (o1)->plist; 2256 o1 = XOVERLAY (o1)->plist;
2257 o2 = XOVERLAY (o2)->plist; 2257 o2 = XOVERLAY (o2)->plist;
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 3b590e0faed..84ce64beb56 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -554,6 +554,9 @@ xg_set_geometry (f)
554 if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), 554 if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
555 geom_str)) 555 geom_str))
556 fprintf (stderr, "Failed to parse: '%s'\n", geom_str); 556 fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
557 } else if (f->size_hint_flags & PPosition) {
558 gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
559 f->left_pos, f->top_pos);
557 } 560 }
558} 561}
559 562
diff --git a/src/image.c b/src/image.c
index 6ec0734e785..3b6969b0c28 100644
--- a/src/image.c
+++ b/src/image.c
@@ -2178,7 +2178,7 @@ slurp_file (file, size)
2178 2178
2179 if (stat (file, &st) == 0 2179 if (stat (file, &st) == 0
2180 && (fp = fopen (file, "rb")) != NULL 2180 && (fp = fopen (file, "rb")) != NULL
2181 && (buf = (char *) xmalloc (st.st_size), 2181 && (buf = (unsigned char *) xmalloc (st.st_size),
2182 fread (buf, 1, st.st_size, fp) == st.st_size)) 2182 fread (buf, 1, st.st_size, fp) == st.st_size))
2183 { 2183 {
2184 *size = st.st_size; 2184 *size = st.st_size;
@@ -3029,7 +3029,7 @@ xbm_read_bitmap_data (contents, end, width, height, data)
3029 3029
3030 bytes_per_line = (*width + 7) / 8 + padding_p; 3030 bytes_per_line = (*width + 7) / 8 + padding_p;
3031 nbytes = bytes_per_line * *height; 3031 nbytes = bytes_per_line * *height;
3032 p = *data = (char *) xmalloc (nbytes); 3032 p = *data = (unsigned char *) xmalloc (nbytes);
3033 3033
3034 if (v10) 3034 if (v10)
3035 { 3035 {
@@ -7369,8 +7369,17 @@ gif_load (f, img)
7369 return 0; 7369 return 0;
7370 } 7370 }
7371 7371
7372 width = img->width = max (gif->SWidth, gif->Image.Left + gif->Image.Width); 7372 image_top = gif->SavedImages[ino].ImageDesc.Top;
7373 height = img->height = max (gif->SHeight, gif->Image.Top + gif->Image.Height); 7373 image_left = gif->SavedImages[ino].ImageDesc.Left;
7374 image_width = gif->SavedImages[ino].ImageDesc.Width;
7375 image_height = gif->SavedImages[ino].ImageDesc.Height;
7376
7377 width = img->width = max (gif->SWidth,
7378 max (gif->Image.Left + gif->Image.Width,
7379 image_left + image_width));
7380 height = img->height = max (gif->SHeight,
7381 max (gif->Image.Top + gif->Image.Height,
7382 image_top + image_height));
7374 7383
7375 /* Create the X image and pixmap. */ 7384 /* Create the X image and pixmap. */
7376 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) 7385 if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap))
@@ -7405,11 +7414,6 @@ gif_load (f, img)
7405 requires more than can be done here (see the gif89 spec, 7414 requires more than can be done here (see the gif89 spec,
7406 disposal methods). Let's simply assume that the part 7415 disposal methods). Let's simply assume that the part
7407 not covered by a sub-image is in the frame's background color. */ 7416 not covered by a sub-image is in the frame's background color. */
7408 image_top = gif->SavedImages[ino].ImageDesc.Top;
7409 image_left = gif->SavedImages[ino].ImageDesc.Left;
7410 image_width = gif->SavedImages[ino].ImageDesc.Width;
7411 image_height = gif->SavedImages[ino].ImageDesc.Height;
7412
7413 for (y = 0; y < image_top; ++y) 7417 for (y = 0; y < image_top; ++y)
7414 for (x = 0; x < width; ++x) 7418 for (x = 0; x < width; ++x)
7415 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f)); 7419 XPutPixel (ximg, x, y, FRAME_BACKGROUND_PIXEL (f));
diff --git a/src/keyboard.c b/src/keyboard.c
index 522cfc3ccf2..786e97d7d89 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -464,10 +464,6 @@ FILE *dribble;
464/* Nonzero if input is available. */ 464/* Nonzero if input is available. */
465int input_pending; 465int input_pending;
466 466
467/* Non-zero means force key bindings update in parse_menu_item. */
468
469int update_menu_bindings;
470
471extern char *pending_malloc_warning; 467extern char *pending_malloc_warning;
472 468
473/* Circular buffer for pre-read keyboard input. */ 469/* Circular buffer for pre-read keyboard input. */
@@ -5565,13 +5561,23 @@ make_lispy_event (event)
5565 if (CONSP (down) 5561 if (CONSP (down)
5566 && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down))) 5562 && INTEGERP (XCAR (down)) && INTEGERP (XCDR (down)))
5567 { 5563 {
5568 xdiff = XFASTINT (event->x) - XFASTINT (XCAR (down)); 5564 xdiff = XINT (event->x) - XINT (XCAR (down));
5569 ydiff = XFASTINT (event->y) - XFASTINT (XCDR (down)); 5565 ydiff = XINT (event->y) - XINT (XCDR (down));
5570 } 5566 }
5571 5567
5572 if (xdiff < double_click_fuzz && xdiff > - double_click_fuzz 5568 if (xdiff < double_click_fuzz && xdiff > - double_click_fuzz
5573 && ydiff < double_click_fuzz 5569 && ydiff < double_click_fuzz && ydiff > - double_click_fuzz
5574 && ydiff > - double_click_fuzz) 5570 /* Maybe the mouse has moved a lot, caused scrolling, and
5571 eventually ended up at the same screen position (but
5572 not buffer position) in which case it is a drag, not
5573 a click. */
5574 /* FIXME: OTOH if the buffer position has changed
5575 because of a timer or process filter rather than
5576 because of mouse movement, it should be considered as
5577 a click. But mouse-drag-region completely ignores
5578 this case and it hasn't caused any real problem, so
5579 it's probably OK to ignore it as well. */
5580 && EQ (Fcar (Fcdr (start_pos)), Fcar (Fcdr (position))))
5575 /* Mouse hasn't moved (much). */ 5581 /* Mouse hasn't moved (much). */
5576 event->modifiers |= click_modifier; 5582 event->modifiers |= click_modifier;
5577 else 5583 else
@@ -7528,9 +7534,7 @@ parse_menu_item (item, notreal, inmenubar)
7528 else 7534 else
7529 def = AREF (item_properties, ITEM_PROPERTY_DEF); 7535 def = AREF (item_properties, ITEM_PROPERTY_DEF);
7530 7536
7531 if (!update_menu_bindings) 7537 if (NILP (XCAR (cachelist))) /* Have no saved key. */
7532 chkcache = 0;
7533 else if (NILP (XCAR (cachelist))) /* Have no saved key. */
7534 { 7538 {
7535 if (newcache /* Always check first time. */ 7539 if (newcache /* Always check first time. */
7536 /* Should we check everything when precomputing key 7540 /* Should we check everything when precomputing key
@@ -10946,11 +10950,6 @@ init_keyboard ()
10946 poll_suppress_count = 1; 10950 poll_suppress_count = 1;
10947 start_polling (); 10951 start_polling ();
10948#endif 10952#endif
10949
10950#ifdef MAC_OSX
10951 /* At least provide an escape route since C-g doesn't work. */
10952 signal (SIGINT, interrupt_signal);
10953#endif
10954} 10953}
10955 10954
10956/* This type's only use is in syms_of_keyboard, to initialize the 10955/* This type's only use is in syms_of_keyboard, to initialize the
@@ -11675,12 +11674,6 @@ suppressed only after special commands that set
11675`disable-point-adjustment' (which see) to non-nil. */); 11674`disable-point-adjustment' (which see) to non-nil. */);
11676 Vglobal_disable_point_adjustment = Qnil; 11675 Vglobal_disable_point_adjustment = Qnil;
11677 11676
11678 DEFVAR_BOOL ("update-menu-bindings", &update_menu_bindings,
11679 doc: /* Non-nil means updating menu bindings is allowed.
11680A value of nil means menu bindings should not be updated.
11681Used during Emacs' startup. */);
11682 update_menu_bindings = 1;
11683
11684 DEFVAR_LISP ("minibuffer-message-timeout", &Vminibuffer_message_timeout, 11677 DEFVAR_LISP ("minibuffer-message-timeout", &Vminibuffer_message_timeout,
11685 doc: /* *How long to display an echo-area message when the minibuffer is active. 11678 doc: /* *How long to display an echo-area message when the minibuffer is active.
11686If the value is not a number, such messages don't time out. */); 11679If the value is not a number, such messages don't time out. */);
diff --git a/src/m/ibmrs6000.h b/src/m/ibmrs6000.h
index 9559f1ae62a..0ff702d090d 100644
--- a/src/m/ibmrs6000.h
+++ b/src/m/ibmrs6000.h
@@ -112,7 +112,7 @@ Boston, MA 02110-1301, USA. */
112#define OBJECTS_MACHINE hftctl.o 112#define OBJECTS_MACHINE hftctl.o
113#endif 113#endif
114 114
115#ifndef USG5_4 115#ifndef USG5
116#define C_SWITCH_MACHINE -D_BSD 116#define C_SWITCH_MACHINE -D_BSD
117#endif 117#endif
118 118
diff --git a/src/macfns.c b/src/macfns.c
index 160eb1f7774..f0d07a9fe55 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -94,6 +94,11 @@ Lisp_Object Qcancel_timer;
94 94
95extern Lisp_Object Vwindow_system_version; 95extern Lisp_Object Vwindow_system_version;
96 96
97#if GLYPH_DEBUG
98int image_cache_refcount, dpyinfo_refcount;
99#endif
100
101
97#if 0 /* Use xstricmp instead. */ 102#if 0 /* Use xstricmp instead. */
98/* compare two strings ignoring case */ 103/* compare two strings ignoring case */
99 104
@@ -2527,6 +2532,10 @@ This function is an internal primitive--use `make-frame' instead. */)
2527 } 2532 }
2528 2533
2529 /* Try out a font which we hope has bold and italic variations. */ 2534 /* Try out a font which we hope has bold and italic variations. */
2535#if USE_ATSUI
2536 if (! STRINGP (font))
2537 font = x_new_font (f, "-*-monaco-medium-r-normal--12-*-*-*-*-*-iso10646-1");
2538#endif
2530 if (! STRINGP (font)) 2539 if (! STRINGP (font))
2531 font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1"); 2540 font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1");
2532 /* If those didn't work, look for something which will at least work. */ 2541 /* If those didn't work, look for something which will at least work. */
@@ -3335,6 +3344,10 @@ start_hourglass ()
3335 EMACS_TIME delay; 3344 EMACS_TIME delay;
3336 int secs, usecs = 0; 3345 int secs, usecs = 0;
3337 3346
3347 /* Don't bother for ttys. */
3348 if (NILP (Vwindow_system))
3349 return;
3350
3338 cancel_hourglass (); 3351 cancel_hourglass ();
3339 3352
3340 if (INTEGERP (Vhourglass_delay) 3353 if (INTEGERP (Vhourglass_delay)
@@ -3581,7 +3594,7 @@ x_create_tip_frame (dpyinfo, parms, text)
3581 FRAME_FONTSET (f) = -1; 3594 FRAME_FONTSET (f) = -1;
3582 f->icon_name = Qnil; 3595 f->icon_name = Qnil;
3583 3596
3584#if 0 /* GLYPH_DEBUG TODO: image support. */ 3597#if GLYPH_DEBUG
3585 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount; 3598 image_cache_refcount = FRAME_X_IMAGE_CACHE (f)->refcount;
3586 dpyinfo_refcount = dpyinfo->reference_count; 3599 dpyinfo_refcount = dpyinfo->reference_count;
3587#endif /* GLYPH_DEBUG */ 3600#endif /* GLYPH_DEBUG */
@@ -3625,6 +3638,10 @@ x_create_tip_frame (dpyinfo, parms, text)
3625 } 3638 }
3626 3639
3627 /* Try out a font which we hope has bold and italic variations. */ 3640 /* Try out a font which we hope has bold and italic variations. */
3641#if USE_ATSUI
3642 if (! STRINGP (font))
3643 font = x_new_font (f, "-*-monaco-medium-r-normal--12-*-*-*-*-*-iso10646-1");
3644#endif
3628 if (! STRINGP (font)) 3645 if (! STRINGP (font))
3629 font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1"); 3646 font = x_new_font (f, "-ETL-fixed-medium-r-*--*-160-*-*-*-*-iso8859-1");
3630 /* If those didn't work, look for something which will at least work. */ 3647 /* If those didn't work, look for something which will at least work. */
@@ -4145,6 +4162,7 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4145 options.optionFlags = kNavDefaultNavDlogOptions; 4162 options.optionFlags = kNavDefaultNavDlogOptions;
4146 options.optionFlags |= kNavAllFilesInPopup; /* All files allowed */ 4163 options.optionFlags |= kNavAllFilesInPopup; /* All files allowed */
4147 options.optionFlags |= kNavSelectAllReadableItem; 4164 options.optionFlags |= kNavSelectAllReadableItem;
4165 options.optionFlags &= ~kNavAllowMultipleFiles;
4148 if (!NILP(prompt)) 4166 if (!NILP(prompt))
4149 { 4167 {
4150 message = cfstring_create_with_string (prompt); 4168 message = cfstring_create_with_string (prompt);
diff --git a/src/macgui.h b/src/macgui.h
index 607890317e1..378dbcd9e5c 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -95,11 +95,15 @@ typedef GWorldPtr Pixmap;
95/* Emulate XCharStruct. */ 95/* Emulate XCharStruct. */
96typedef struct _XCharStruct 96typedef struct _XCharStruct
97{ 97{
98 int rbearing; 98 short lbearing; /* origin to left edge of raster */
99 int lbearing; 99 short rbearing; /* origin to right edge of raster */
100 int width; 100 short width; /* advance to next char's origin */
101 int ascent; 101 short ascent; /* baseline to top edge of raster */
102 int descent; 102 short descent; /* baseline to bottom edge of raster */
103#if 0
104 unsigned short attributes; /* per char flags (not predefined) */
105#endif
106 unsigned valid_p : 1;
103} XCharStruct; 107} XCharStruct;
104 108
105#define STORE_XCHARSTRUCT(xcs, w, bds) \ 109#define STORE_XCHARSTRUCT(xcs, w, bds) \
@@ -107,7 +111,8 @@ typedef struct _XCharStruct
107 (xcs).lbearing = (bds).left, \ 111 (xcs).lbearing = (bds).left, \
108 (xcs).rbearing = (bds).right, \ 112 (xcs).rbearing = (bds).right, \
109 (xcs).ascent = -(bds).top, \ 113 (xcs).ascent = -(bds).top, \
110 (xcs).descent = (bds).bottom) 114 (xcs).descent = (bds).bottom, \
115 (xcs).valid_p = 1)
111 116
112struct MacFontStruct { 117struct MacFontStruct {
113 char *full_name; 118 char *full_name;
@@ -120,19 +125,9 @@ struct MacFontStruct {
120#else 125#else
121 short mac_scriptcode; /* Mac OS script code for font used */ 126 short mac_scriptcode; /* Mac OS script code for font used */
122#endif 127#endif
123 128#if USE_ATSUI
124#if 0 129 ATSUStyle mac_style; /* NULL if QuickDraw Text is used */
125 SInt16 mFontNum; /* font number of font used in this window */ 130#endif
126 short mScriptCode; /* Mac OS script code for font used */
127 int mFontSize; /* size of font */
128 Style mFontFace; /* plain, bold, italics, etc. */
129 int mHeight; /* height of one line of text in pixels */
130 int mWidth; /* width of one character in pixels */
131 int mAscent;
132 int mDescent;
133 int mLeading;
134 char mTwoByte; /* true for two-byte font */
135#endif /* 0 */
136 131
137/* from Xlib.h */ 132/* from Xlib.h */
138#if 0 133#if 0
diff --git a/src/macterm.c b/src/macterm.c
index f727c013809..c9d91607573 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -658,6 +658,79 @@ mac_draw_rectangle_to_pixmap (display, p, gc, x, y, width, height)
658#endif 658#endif
659 659
660 660
661#if USE_ATSUI
662static OSStatus
663atsu_get_text_layout_with_text_ptr (text, text_length, style, text_layout)
664 ConstUniCharArrayPtr text;
665 UniCharCount text_length;
666 ATSUStyle style;
667 ATSUTextLayout *text_layout;
668{
669 OSStatus err;
670 static ATSUTextLayout saved_text_layout = NULL; /* not reentrant */
671
672 if (saved_text_layout == NULL)
673 {
674 UniCharCount lengths[] = {kATSUToTextEnd};
675 ATSUAttributeTag tags[] = {kATSULineLayoutOptionsTag};
676 ByteCount sizes[] = {sizeof (ATSLineLayoutOptions)};
677 static ATSLineLayoutOptions line_layout =
678#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
679 kATSLineDisableAllLayoutOperations | kATSLineUseDeviceMetrics
680#else
681 kATSLineIsDisplayOnly
682#endif
683 ;
684 ATSUAttributeValuePtr values[] = {&line_layout};
685
686 err = ATSUCreateTextLayoutWithTextPtr (text,
687 kATSUFromTextBeginning,
688 kATSUToTextEnd,
689 text_length,
690 1, lengths, &style,
691 &saved_text_layout);
692 if (err == noErr)
693 err = ATSUSetLayoutControls (saved_text_layout,
694 sizeof (tags) / sizeof (tags[0]),
695 tags, sizes, values);
696 /* XXX: Should we do this? */
697 if (err == noErr)
698 err = ATSUSetTransientFontMatching (saved_text_layout, true);
699 }
700 else
701 {
702 err = ATSUSetRunStyle (saved_text_layout, style,
703 kATSUFromTextBeginning, kATSUToTextEnd);
704 if (err == noErr)
705 err = ATSUSetTextPointerLocation (saved_text_layout, text,
706 kATSUFromTextBeginning,
707 kATSUToTextEnd,
708 text_length);
709 }
710
711 if (err == noErr)
712 *text_layout = saved_text_layout;
713 return err;
714}
715#endif
716
717static void
718mac_invert_rectangle (display, w, x, y, width, height)
719 Display *display;
720 WindowPtr w;
721 int x, y;
722 unsigned int width, height;
723{
724 Rect r;
725
726 SetPortWindowPort (w);
727
728 SetRect (&r, x, y, x + width, y + height);
729
730 InvertRect (&r);
731}
732
733
661static void 734static void
662mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode, 735mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode,
663 bytes_per_char) 736 bytes_per_char)
@@ -682,6 +755,89 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode,
682 if (mode != srcOr) 755 if (mode != srcOr)
683 RGBBackColor (GC_BACK_COLOR (gc)); 756 RGBBackColor (GC_BACK_COLOR (gc));
684 757
758#if USE_ATSUI
759 if (GC_FONT (gc)->mac_style)
760 {
761 OSErr err;
762 ATSUTextLayout text_layout;
763
764 xassert (bytes_per_char == 2);
765
766#ifndef WORDS_BIG_ENDIAN
767 {
768 int i;
769 Unichar *text = (Unichar *)buf;
770
771 for (i = 0; i < nchars; i++)
772 text[i] = buf[2*i] << 8 | buf[2*i+1];
773 }
774#endif
775 err = atsu_get_text_layout_with_text_ptr ((ConstUniCharArrayPtr)buf,
776 nchars,
777 GC_FONT (gc)->mac_style,
778 &text_layout);
779 if (err == noErr)
780 {
781#ifdef MAC_OSX
782 if (NILP (Vmac_use_core_graphics))
783 {
784#endif
785 MoveTo (x, y);
786 ATSUDrawText (text_layout,
787 kATSUFromTextBeginning, kATSUToTextEnd,
788 kATSUUseGrafPortPenLoc, kATSUUseGrafPortPenLoc);
789#ifdef MAC_OSX
790 }
791 else
792 {
793 CGrafPtr port;
794 CGContextRef context;
795 Rect rect;
796 RgnHandle region = NewRgn ();
797 float port_height;
798 ATSUAttributeTag tags[] = {kATSUCGContextTag};
799 ByteCount sizes[] = {sizeof (CGContextRef)};
800 ATSUAttributeValuePtr values[] = {&context};
801
802 GetPort (&port);
803 QDBeginCGContext (port, &context);
804 GetPortBounds (port, &rect);
805 port_height = rect.bottom - rect.top;
806 GetClip (region);
807 GetRegionBounds (region, &rect);
808 /* XXX: This is not correct if the clip region is not a
809 simple rectangle. */
810 CGContextClipToRect (context,
811 CGRectMake (rect.left,
812 port_height - rect.bottom,
813 rect.right - rect.left,
814 rect.bottom - rect.top));
815 DisposeRgn (region);
816 CGContextSetRGBFillColor
817 (context,
818 RED_FROM_ULONG (gc->xgcv.foreground) / 255.0,
819 GREEN_FROM_ULONG (gc->xgcv.foreground) / 255.0,
820 BLUE_FROM_ULONG (gc->xgcv.foreground) / 255.0,
821 1.0);
822 err = ATSUSetLayoutControls (text_layout,
823 sizeof (tags) / sizeof (tags[0]),
824 tags, sizes, values);
825 if (err == noErr)
826 ATSUDrawText (text_layout,
827 kATSUFromTextBeginning, kATSUToTextEnd,
828 Long2Fix (x), Long2Fix (port_height - y));
829 ATSUClearLayoutControls (text_layout,
830 sizeof (tags) / sizeof (tags[0]),
831 tags);
832 CGContextSynchronize (context);
833 QDEndCGContext (port, &context);
834 }
835#endif
836 }
837 }
838 else
839 {
840#endif
685 TextFont (GC_FONT (gc)->mac_fontnum); 841 TextFont (GC_FONT (gc)->mac_fontnum);
686 TextSize (GC_FONT (gc)->mac_fontsize); 842 TextSize (GC_FONT (gc)->mac_fontsize);
687 TextFace (GC_FONT (gc)->mac_fontface); 843 TextFace (GC_FONT (gc)->mac_fontface);
@@ -689,6 +845,9 @@ mac_draw_string_common (display, w, gc, x, y, buf, nchars, mode,
689 845
690 MoveTo (x, y); 846 MoveTo (x, y);
691 DrawText (buf, 0, nchars * bytes_per_char); 847 DrawText (buf, 0, nchars * bytes_per_char);
848#if USE_ATSUI
849 }
850#endif
692 851
693 if (mode != srcOr) 852 if (mode != srcOr)
694 RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w))); 853 RGBBackColor (GC_BACK_COLOR (MAC_WINDOW_NORMAL_GC (w)));
@@ -1549,6 +1708,61 @@ x_per_char_metric (font, char2b)
1549 1708
1550 xassert (font && char2b); 1709 xassert (font && char2b);
1551 1710
1711#if USE_ATSUI
1712 if (font->mac_style)
1713 {
1714 if (char2b->byte1 >= font->min_byte1
1715 && char2b->byte1 <= font->max_byte1
1716 && char2b->byte2 >= font->min_char_or_byte2
1717 && char2b->byte2 <= font->max_char_or_byte2)
1718 {
1719 pcm = (font->per_char
1720 + ((font->max_char_or_byte2 - font->min_char_or_byte2 + 1)
1721 * (char2b->byte1 - font->min_byte1))
1722 + (char2b->byte2 - font->min_char_or_byte2));
1723 }
1724
1725 if (pcm && !pcm->valid_p)
1726 {
1727 OSErr err;
1728 ATSUTextLayout text_layout;
1729 UniChar c;
1730 int char_width;
1731 ATSTrapezoid glyph_bounds;
1732 Rect char_bounds;
1733
1734 c = (char2b->byte1 << 8) + char2b->byte2;
1735 BLOCK_INPUT;
1736 err = atsu_get_text_layout_with_text_ptr (&c, 1,
1737 font->mac_style,
1738 &text_layout);
1739 if (err == noErr)
1740 err = ATSUMeasureTextImage (text_layout,
1741 kATSUFromTextBeginning, kATSUToTextEnd,
1742 0, 0, &char_bounds);
1743
1744 if (err == noErr)
1745 err = ATSUGetGlyphBounds (text_layout, 0, 0,
1746 kATSUFromTextBeginning, kATSUToTextEnd,
1747 kATSUseFractionalOrigins, 1,
1748 &glyph_bounds, NULL);
1749 UNBLOCK_INPUT;
1750 if (err != noErr)
1751 pcm = NULL;
1752 else
1753 {
1754 xassert (glyph_bounds.lowerRight.x - glyph_bounds.lowerLeft.x
1755 == glyph_bounds.upperRight.x - glyph_bounds.upperLeft.x);
1756
1757 char_width = Fix2Long (glyph_bounds.upperRight.x
1758 - glyph_bounds.upperLeft.x);
1759 STORE_XCHARSTRUCT (*pcm, char_width, char_bounds);
1760 }
1761 }
1762 }
1763 else
1764 {
1765#endif
1552 if (font->per_char != NULL) 1766 if (font->per_char != NULL)
1553 { 1767 {
1554 if (font->min_byte1 == 0 && font->max_byte1 == 0) 1768 if (font->min_byte1 == 0 && font->max_byte1 == 0)
@@ -1600,6 +1814,9 @@ x_per_char_metric (font, char2b)
1600 && char2b->byte2 <= font->max_char_or_byte2) 1814 && char2b->byte2 <= font->max_char_or_byte2)
1601 pcm = &font->max_bounds; 1815 pcm = &font->max_bounds;
1602 } 1816 }
1817#if USE_ATSUI
1818 }
1819#endif
1603 1820
1604 return ((pcm == NULL 1821 return ((pcm == NULL
1605 || (pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0)) 1822 || (pcm->width == 0 && (pcm->rbearing - pcm->lbearing) == 0))
@@ -1925,6 +2142,35 @@ mac_compute_glyph_string_overhangs (s)
1925 Rect r; 2142 Rect r;
1926 MacFontStruct *font = s->font; 2143 MacFontStruct *font = s->font;
1927 2144
2145#if USE_ATSUI
2146 if (font->mac_style)
2147 {
2148 OSErr err;
2149 ATSUTextLayout text_layout;
2150 UniChar *buf;
2151 int i;
2152
2153 SetRect (&r, 0, 0, 0, 0);
2154 buf = xmalloc (sizeof (UniChar) * s->nchars);
2155 if (buf)
2156 {
2157 for (i = 0; i < s->nchars; i++)
2158 buf[i] = (s->char2b[i].byte1 << 8) + s->char2b[i].byte2;
2159
2160 err = atsu_get_text_layout_with_text_ptr (buf, s->nchars,
2161 font->mac_style,
2162 &text_layout);
2163 if (err == noErr)
2164 err = ATSUMeasureTextImage (text_layout,
2165 kATSUFromTextBeginning,
2166 kATSUToTextEnd,
2167 0, 0, &r);
2168 xfree (buf);
2169 }
2170 }
2171 else
2172 {
2173#endif
1928 TextFont (font->mac_fontnum); 2174 TextFont (font->mac_fontnum);
1929 TextSize (font->mac_fontsize); 2175 TextSize (font->mac_fontsize);
1930 TextFace (font->mac_fontface); 2176 TextFace (font->mac_fontface);
@@ -1946,6 +2192,9 @@ mac_compute_glyph_string_overhangs (s)
1946 xfree (buf); 2192 xfree (buf);
1947 } 2193 }
1948 } 2194 }
2195#if USE_ATSUI
2196 }
2197#endif
1949 2198
1950 s->right_overhang = r.right > s->width ? r.right - s->width : 0; 2199 s->right_overhang = r.right > s->width ? r.right - s->width : 0;
1951 s->left_overhang = r.left < 0 ? -r.left : 0; 2200 s->left_overhang = r.left < 0 ? -r.left : 0;
@@ -2003,7 +2252,7 @@ x_draw_glyph_string_background (s, force_p)
2003 } 2252 }
2004 else 2253 else
2005#endif 2254#endif
2006#ifdef MAC_OS8 2255#if defined (MAC_OS8) && !USE_ATSUI
2007 if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width 2256 if (FONT_HEIGHT (s->font) < s->height - 2 * box_line_width
2008 || s->font_not_found_p 2257 || s->font_not_found_p
2009 || s->extends_to_end_of_line_p 2258 || s->extends_to_end_of_line_p
@@ -2057,11 +2306,15 @@ x_draw_glyph_string_foreground (s)
2057 boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff; 2306 boff = VCENTER_BASELINE_OFFSET (s->font, s->f) - boff;
2058 2307
2059 /* If we can use 8-bit functions, condense S->char2b. */ 2308 /* If we can use 8-bit functions, condense S->char2b. */
2060 if (!s->two_byte_p) 2309 if (!s->two_byte_p
2310#if USE_ATSUI
2311 && GC_FONT (s->gc)->mac_style == NULL
2312#endif
2313 )
2061 for (i = 0; i < s->nchars; ++i) 2314 for (i = 0; i < s->nchars; ++i)
2062 char1b[i] = s->char2b[i].byte2; 2315 char1b[i] = s->char2b[i].byte2;
2063 2316
2064#ifdef MAC_OS8 2317#if defined (MAC_OS8) && !USE_ATSUI
2065 /* Draw text with XDrawString if background has already been 2318 /* Draw text with XDrawString if background has already been
2066 filled. Otherwise, use XDrawImageString. (Note that 2319 filled. Otherwise, use XDrawImageString. (Note that
2067 XDrawImageString is usually faster than XDrawString.) Always 2320 XDrawImageString is usually faster than XDrawString.) Always
@@ -2072,14 +2325,18 @@ x_draw_glyph_string_foreground (s)
2072#endif 2325#endif
2073 { 2326 {
2074 /* Draw characters with 16-bit or 8-bit functions. */ 2327 /* Draw characters with 16-bit or 8-bit functions. */
2075 if (s->two_byte_p) 2328 if (s->two_byte_p
2329#if USE_ATSUI
2330 || GC_FONT (s->gc)->mac_style
2331#endif
2332 )
2076 XDrawString16 (s->display, s->window, s->gc, x, 2333 XDrawString16 (s->display, s->window, s->gc, x,
2077 s->ybase - boff, s->char2b, s->nchars); 2334 s->ybase - boff, s->char2b, s->nchars);
2078 else 2335 else
2079 XDrawString (s->display, s->window, s->gc, x, 2336 XDrawString (s->display, s->window, s->gc, x,
2080 s->ybase - boff, char1b, s->nchars); 2337 s->ybase - boff, char1b, s->nchars);
2081 } 2338 }
2082#ifdef MAC_OS8 2339#if defined (MAC_OS8) && !USE_ATSUI
2083 else 2340 else
2084 { 2341 {
2085 if (s->two_byte_p) 2342 if (s->two_byte_p)
@@ -3246,9 +3503,57 @@ void
3246XTflash (f) 3503XTflash (f)
3247 struct frame *f; 3504 struct frame *f;
3248{ 3505{
3506 /* Get the height not including a menu bar widget. */
3507 int height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, FRAME_LINES (f));
3508 /* Height of each line to flash. */
3509 int flash_height = FRAME_LINE_HEIGHT (f);
3510 /* These will be the left and right margins of the rectangles. */
3511 int flash_left = FRAME_INTERNAL_BORDER_WIDTH (f);
3512 int flash_right = FRAME_PIXEL_WIDTH (f) - FRAME_INTERNAL_BORDER_WIDTH (f);
3513
3514 int width;
3515
3516 /* Don't flash the area between a scroll bar and the frame
3517 edge it is next to. */
3518 switch (FRAME_VERTICAL_SCROLL_BAR_TYPE (f))
3519 {
3520 case vertical_scroll_bar_left:
3521 flash_left += VERTICAL_SCROLL_BAR_WIDTH_TRIM;
3522 break;
3523
3524 case vertical_scroll_bar_right:
3525 flash_right -= VERTICAL_SCROLL_BAR_WIDTH_TRIM;
3526 break;
3527
3528 default:
3529 break;
3530 }
3531
3532 width = flash_right - flash_left;
3533
3249 BLOCK_INPUT; 3534 BLOCK_INPUT;
3250 3535
3251 FlashMenuBar (0); 3536 /* If window is tall, flash top and bottom line. */
3537 if (height > 3 * FRAME_LINE_HEIGHT (f))
3538 {
3539 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3540 flash_left,
3541 (FRAME_INTERNAL_BORDER_WIDTH (f)
3542 + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)),
3543 width, flash_height);
3544 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3545 flash_left,
3546 (height - flash_height
3547 - FRAME_INTERNAL_BORDER_WIDTH (f)),
3548 width, flash_height);
3549 }
3550 else
3551 /* If it is short, flash it all. */
3552 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3553 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
3554 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
3555
3556 x_flush (f);
3252 3557
3253 { 3558 {
3254 struct timeval wakeup; 3559 struct timeval wakeup;
@@ -3260,24 +3565,49 @@ XTflash (f)
3260 wakeup.tv_sec += (wakeup.tv_usec / 1000000); 3565 wakeup.tv_sec += (wakeup.tv_usec / 1000000);
3261 wakeup.tv_usec %= 1000000; 3566 wakeup.tv_usec %= 1000000;
3262 3567
3263 /* Keep waiting until past the time wakeup. */ 3568 /* Keep waiting until past the time wakeup or any input gets
3264 while (1) 3569 available. */
3570 while (! detect_input_pending ())
3265 { 3571 {
3266 struct timeval timeout; 3572 struct timeval current;
3573 struct timeval timeout;
3267 3574
3268 EMACS_GET_TIME (timeout); 3575 EMACS_GET_TIME (current);
3269 3576
3270 /* In effect, timeout = wakeup - timeout. 3577 /* Break if result would be negative. */
3271 Break if result would be negative. */ 3578 if (timeval_subtract (&current, wakeup, current))
3272 if (timeval_subtract (&timeout, wakeup, timeout)) 3579 break;
3273 break;
3274 3580
3275 /* Try to wait that long--but we might wake up sooner. */ 3581 /* How long `select' should wait. */
3276 select (0, NULL, NULL, NULL, &timeout); 3582 timeout.tv_sec = 0;
3583 timeout.tv_usec = 10000;
3584
3585 /* Try to wait that long--but we might wake up sooner. */
3586 select (0, NULL, NULL, NULL, &timeout);
3277 } 3587 }
3278 } 3588 }
3279 3589
3280 FlashMenuBar (0); 3590 /* If window is tall, flash top and bottom line. */
3591 if (height > 3 * FRAME_LINE_HEIGHT (f))
3592 {
3593 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3594 flash_left,
3595 (FRAME_INTERNAL_BORDER_WIDTH (f)
3596 + FRAME_TOOL_BAR_LINES (f) * FRAME_LINE_HEIGHT (f)),
3597 width, flash_height);
3598 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3599 flash_left,
3600 (height - flash_height
3601 - FRAME_INTERNAL_BORDER_WIDTH (f)),
3602 width, flash_height);
3603 }
3604 else
3605 /* If it is short, flash it all. */
3606 mac_invert_rectangle (FRAME_MAC_DISPLAY (f), FRAME_MAC_WINDOW (f),
3607 flash_left, FRAME_INTERNAL_BORDER_WIDTH (f),
3608 width, height - 2 * FRAME_INTERNAL_BORDER_WIDTH (f));
3609
3610 x_flush (f);
3281 3611
3282 UNBLOCK_INPUT; 3612 UNBLOCK_INPUT;
3283} 3613}
@@ -6277,7 +6607,7 @@ static INLINE int
6277xlfdpat_exact_p (pat) 6607xlfdpat_exact_p (pat)
6278 struct xlfdpat *pat; 6608 struct xlfdpat *pat;
6279{ 6609{
6280 return (pat)->blocks == NULL; 6610 return pat->blocks == NULL;
6281} 6611}
6282 6612
6283/* Return the first string in STRING + 0, ..., STRING + START_MAX such 6613/* Return the first string in STRING + 0, ..., STRING + START_MAX such
@@ -6295,7 +6625,7 @@ xlfdpat_block_match_1 (blk, string, start_max)
6295 6625
6296 xassert (blk->len > 0); 6626 xassert (blk->len > 0);
6297 xassert (start_max + blk->len <= strlen (string)); 6627 xassert (start_max + blk->len <= strlen (string));
6298 xassert (blk->pattern[blk->len - 1] != '?'); 6628 xassert (blk->last_char != '?');
6299 6629
6300 /* See the comments in the function `boyer_moore' (search.c) for the 6630 /* See the comments in the function `boyer_moore' (search.c) for the
6301 use of `infinity'. */ 6631 use of `infinity'. */
@@ -6431,6 +6761,10 @@ static char **font_name_table = NULL;
6431static int font_name_table_size = 0; 6761static int font_name_table_size = 0;
6432static int font_name_count = 0; 6762static int font_name_count = 0;
6433 6763
6764#if USE_ATSUI
6765static Lisp_Object atsu_font_id_hash;
6766#endif
6767
6434/* Alist linking character set strings to Mac text encoding and Emacs 6768/* Alist linking character set strings to Mac text encoding and Emacs
6435 coding system. */ 6769 coding system. */
6436static Lisp_Object Vmac_charset_info_alist; 6770static Lisp_Object Vmac_charset_info_alist;
@@ -6630,6 +6964,74 @@ init_font_name_table ()
6630 Lisp_Object text_encoding_info_alist; 6964 Lisp_Object text_encoding_info_alist;
6631 struct gcpro gcpro1; 6965 struct gcpro gcpro1;
6632 6966
6967 text_encoding_info_alist = create_text_encoding_info_alist ();
6968
6969#if USE_ATSUI
6970 if (!NILP (assq_no_quit (make_number (kTextEncodingMacUnicode),
6971 text_encoding_info_alist)))
6972 {
6973 OSErr err;
6974 ItemCount nfonts, i;
6975 ATSUFontID *font_ids = NULL;
6976 Ptr name, prev_name = NULL;
6977 ByteCount name_len;
6978
6979 atsu_font_id_hash =
6980 make_hash_table (Qequal, make_number (DEFAULT_HASH_SIZE),
6981 make_float (DEFAULT_REHASH_SIZE),
6982 make_float (DEFAULT_REHASH_THRESHOLD),
6983 Qnil, Qnil, Qnil);;
6984 err = ATSUFontCount (&nfonts);
6985 if (err == noErr)
6986 font_ids = xmalloc (sizeof (ATSUFontID) * nfonts);
6987 if (font_ids)
6988 err = ATSUGetFontIDs (font_ids, nfonts, NULL);
6989 if (err == noErr)
6990 for (i = 0; i < nfonts; i++)
6991 {
6992 err = ATSUFindFontName (font_ids[i], kFontFamilyName,
6993 kFontMacintoshPlatform, kFontNoScript,
6994 kFontNoLanguage, 0, NULL, &name_len, NULL);
6995 if (err != noErr)
6996 continue;
6997 name = xmalloc (name_len + 1);
6998 if (name == NULL)
6999 continue;
7000 name[name_len] = '\0';
7001 err = ATSUFindFontName (font_ids[i], kFontFamilyName,
7002 kFontMacintoshPlatform, kFontNoScript,
7003 kFontNoLanguage, name_len, name,
7004 NULL, NULL);
7005 if (err == noErr
7006 && *name != '.'
7007 && (prev_name == NULL
7008 || strcmp (name, prev_name) != 0))
7009 {
7010 static char *cs = "iso10646-1";
7011
7012 add_font_name_table_entry (mac_to_x_fontname (name, 0,
7013 normal, cs));
7014 add_font_name_table_entry (mac_to_x_fontname (name, 0,
7015 italic, cs));
7016 add_font_name_table_entry (mac_to_x_fontname (name, 0,
7017 bold, cs));
7018 add_font_name_table_entry (mac_to_x_fontname (name, 0,
7019 italic | bold, cs));
7020 Fputhash (Fdowncase (make_unibyte_string (name, name_len)),
7021 long_to_cons (font_ids[i]), atsu_font_id_hash);
7022 xfree (prev_name);
7023 prev_name = name;
7024 }
7025 else
7026 xfree (name);
7027 }
7028 if (prev_name)
7029 xfree (prev_name);
7030 if (font_ids)
7031 xfree (font_ids);
7032 }
7033#endif
7034
6633 /* Create a dummy instance iterator here to avoid creating and 7035 /* Create a dummy instance iterator here to avoid creating and
6634 destroying it in the loop. */ 7036 destroying it in the loop. */
6635 if (FMCreateFontFamilyInstanceIterator (0, &ffii) != noErr) 7037 if (FMCreateFontFamilyInstanceIterator (0, &ffii) != noErr)
@@ -6642,8 +7044,6 @@ init_font_name_table ()
6642 return; 7044 return;
6643 } 7045 }
6644 7046
6645 text_encoding_info_alist = create_text_encoding_info_alist ();
6646
6647 GCPRO1 (text_encoding_info_alist); 7047 GCPRO1 (text_encoding_info_alist);
6648 7048
6649 while (FMGetNextFontFamily (&ffi, &ff) == noErr) 7049 while (FMGetNextFontFamily (&ffi, &ff) == noErr)
@@ -6683,28 +7083,29 @@ init_font_name_table ()
6683 { 7083 {
6684 Lisp_Object rest = XCDR (XCDR (text_encoding_info)); 7084 Lisp_Object rest = XCDR (XCDR (text_encoding_info));
6685 7085
6686 for (; !NILP (rest); rest = XCDR (rest)) 7086 if (size > 0 || style == normal)
6687 { 7087 for (; !NILP (rest); rest = XCDR (rest))
6688 char *cs = SDATA (XCAR (rest)); 7088 {
7089 char *cs = SDATA (XCAR (rest));
6689 7090
6690 if (size == 0) 7091 if (size == 0)
6691 { 7092 {
6692 add_font_name_table_entry (mac_to_x_fontname (name, size, 7093 add_font_name_table_entry (mac_to_x_fontname (name, size,
6693 style, cs)); 7094 style, cs));
6694 add_font_name_table_entry (mac_to_x_fontname (name, size, 7095 add_font_name_table_entry (mac_to_x_fontname (name, size,
6695 italic, cs)); 7096 italic, cs));
6696 add_font_name_table_entry (mac_to_x_fontname (name, size, 7097 add_font_name_table_entry (mac_to_x_fontname (name, size,
6697 bold, cs)); 7098 bold, cs));
6698 add_font_name_table_entry (mac_to_x_fontname (name, size, 7099 add_font_name_table_entry (mac_to_x_fontname (name, size,
6699 italic | bold, 7100 italic | bold,
6700 cs)); 7101 cs));
6701 } 7102 }
6702 else 7103 else
6703 { 7104 {
6704 add_font_name_table_entry (mac_to_x_fontname (name, size, 7105 add_font_name_table_entry (mac_to_x_fontname (name, size,
6705 style, cs)); 7106 style, cs));
6706 } 7107 }
6707 } 7108 }
6708 } 7109 }
6709 } 7110 }
6710 7111
@@ -7139,6 +7540,9 @@ XLoadQueryFont (Display *dpy, char *fontname)
7139 Str255 mfontname, mfontname_decoded; 7540 Str255 mfontname, mfontname_decoded;
7140 Str31 charset; 7541 Str31 charset;
7141 SInt16 fontnum; 7542 SInt16 fontnum;
7543#if USE_ATSUI
7544 ATSUStyle mac_style = NULL;
7545#endif
7142 Style fontface; 7546 Style fontface;
7143#if TARGET_API_MAC_CARBON 7547#if TARGET_API_MAC_CARBON
7144 TextEncoding encoding; 7548 TextEncoding encoding;
@@ -7190,6 +7594,48 @@ XLoadQueryFont (Display *dpy, char *fontname)
7190 7594
7191 x_font_name_to_mac_font_name (name, mfontname, mfontname_decoded, 7595 x_font_name_to_mac_font_name (name, mfontname, mfontname_decoded,
7192 &fontface, charset); 7596 &fontface, charset);
7597#if USE_ATSUI
7598 if (strcmp (charset, "iso10646-1") == 0) /* XXX */
7599 {
7600 OSErr err;
7601 ATSUAttributeTag tags[] = {kATSUFontTag, kATSUSizeTag,
7602 kATSUQDBoldfaceTag, kATSUQDItalicTag};
7603 ByteCount sizes[] = {sizeof (ATSUFontID), sizeof (Fixed),
7604 sizeof (Boolean), sizeof (Boolean)};
7605 static ATSUFontID font_id;
7606 static Fixed size_fixed;
7607 static Boolean bold_p, italic_p;
7608 ATSUAttributeValuePtr values[] = {&font_id, &size_fixed,
7609 &bold_p, &italic_p};
7610 ATSUFontFeatureType types[] = {kAllTypographicFeaturesType};
7611 ATSUFontFeatureSelector selectors[] = {kAllTypeFeaturesOffSelector};
7612 Lisp_Object font_id_cons;
7613
7614 font_id_cons = Fgethash (Fdowncase
7615 (make_unibyte_string (mfontname,
7616 strlen (mfontname))),
7617 atsu_font_id_hash, Qnil);
7618 if (NILP (font_id_cons))
7619 return NULL;
7620 font_id = cons_to_long (font_id_cons);
7621 size_fixed = Long2Fix (size);
7622 bold_p = (fontface & bold) != 0;
7623 italic_p = (fontface & italic) != 0;
7624 err = ATSUCreateStyle (&mac_style);
7625 if (err != noErr)
7626 return NULL;
7627 err = ATSUSetFontFeatures (mac_style, sizeof (types) / sizeof (types[0]),
7628 types, selectors);
7629 if (err != noErr)
7630 return NULL;
7631 err = ATSUSetAttributes (mac_style, sizeof (tags) / sizeof (tags[0]),
7632 tags, sizes, values);
7633 fontnum = -1;
7634 scriptcode = kTextEncodingMacUnicode;
7635 }
7636 else
7637 {
7638#endif
7193 c2pstr (mfontname); 7639 c2pstr (mfontname);
7194#if TARGET_API_MAC_CARBON 7640#if TARGET_API_MAC_CARBON
7195 fontnum = FMGetFontFamilyFromName (mfontname); 7641 fontnum = FMGetFontFamilyFromName (mfontname);
@@ -7203,6 +7649,9 @@ XLoadQueryFont (Display *dpy, char *fontname)
7203 return NULL; 7649 return NULL;
7204 scriptcode = FontToScript (fontnum); 7650 scriptcode = FontToScript (fontnum);
7205#endif 7651#endif
7652#if USE_ATSUI
7653 }
7654#endif
7206 7655
7207 font = (MacFontStruct *) xmalloc (sizeof (struct MacFontStruct)); 7656 font = (MacFontStruct *) xmalloc (sizeof (struct MacFontStruct));
7208 7657
@@ -7210,6 +7659,9 @@ XLoadQueryFont (Display *dpy, char *fontname)
7210 font->mac_fontsize = size; 7659 font->mac_fontsize = size;
7211 font->mac_fontface = fontface; 7660 font->mac_fontface = fontface;
7212 font->mac_scriptcode = scriptcode; 7661 font->mac_scriptcode = scriptcode;
7662#if USE_ATSUI
7663 font->mac_style = mac_style;
7664#endif
7213 7665
7214 /* Apple Japanese (SJIS) font is listed as both 7666 /* Apple Japanese (SJIS) font is listed as both
7215 "*-jisx0208.1983-sjis" (Japanese script) and "*-jisx0201.1976-0" 7667 "*-jisx0208.1983-sjis" (Japanese script) and "*-jisx0201.1976-0"
@@ -7220,6 +7672,91 @@ XLoadQueryFont (Display *dpy, char *fontname)
7220 7672
7221 font->full_name = mac_to_x_fontname (mfontname_decoded, size, fontface, charset); 7673 font->full_name = mac_to_x_fontname (mfontname_decoded, size, fontface, charset);
7222 7674
7675#if USE_ATSUI
7676 if (font->mac_style)
7677 {
7678 OSErr err;
7679 ATSUTextLayout text_layout;
7680 UniChar c = 0x20;
7681 Rect char_bounds, min_bounds, max_bounds;
7682 int min_width, max_width;
7683 ATSTrapezoid glyph_bounds;
7684
7685 font->per_char = xmalloc (sizeof (XCharStruct) * 0x10000);
7686 if (font->per_char == NULL)
7687 {
7688 mac_unload_font (&one_mac_display_info, font);
7689 return NULL;
7690 }
7691 bzero (font->per_char, sizeof (XCharStruct) * 0x10000);
7692
7693 err = atsu_get_text_layout_with_text_ptr (&c, 1,
7694 font->mac_style,
7695 &text_layout);
7696 if (err != noErr)
7697 {
7698 mac_unload_font (&one_mac_display_info, font);
7699 return NULL;
7700 }
7701
7702 for (c = 0x20; c <= 0x7e; c++)
7703 {
7704 err = ATSUClearLayoutCache (text_layout, kATSUFromTextBeginning);
7705 if (err == noErr)
7706 err = ATSUMeasureTextImage (text_layout,
7707 kATSUFromTextBeginning, kATSUToTextEnd,
7708 0, 0, &char_bounds);
7709 if (err == noErr)
7710 err = ATSUGetGlyphBounds (text_layout, 0, 0,
7711 kATSUFromTextBeginning, kATSUToTextEnd,
7712 kATSUseFractionalOrigins, 1,
7713 &glyph_bounds, NULL);
7714 if (err == noErr)
7715 {
7716 xassert (glyph_bounds.lowerRight.x - glyph_bounds.lowerLeft.x
7717 == glyph_bounds.upperRight.x - glyph_bounds.upperLeft.x);
7718
7719 char_width = Fix2Long (glyph_bounds.upperRight.x
7720 - glyph_bounds.upperLeft.x);
7721 STORE_XCHARSTRUCT (font->per_char[c],
7722 char_width, char_bounds);
7723 if (c == 0x20)
7724 {
7725 min_width = max_width = char_width;
7726 min_bounds = max_bounds = char_bounds;
7727 font->ascent = -Fix2Long (glyph_bounds.upperLeft.y);
7728 font->descent = Fix2Long (glyph_bounds.lowerLeft.y);
7729 }
7730 else
7731 {
7732 if (char_width > 0)
7733 {
7734 min_width = min (min_width, char_width);
7735 max_width = max (max_width, char_width);
7736 }
7737 if (!EmptyRect (&char_bounds))
7738 {
7739 SetRect (&min_bounds,
7740 max (min_bounds.left, char_bounds.left),
7741 max (min_bounds.top, char_bounds.top),
7742 min (min_bounds.right, char_bounds.right),
7743 min (min_bounds.bottom, char_bounds.bottom));
7744 UnionRect (&max_bounds, &char_bounds, &max_bounds);
7745 }
7746 }
7747 }
7748 }
7749 STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds);
7750 STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds);
7751
7752 font->min_byte1 = 0;
7753 font->max_byte1 = 0xff;
7754 font->min_char_or_byte2 = 0;
7755 font->max_char_or_byte2 = 0xff;
7756 }
7757 else
7758 {
7759#endif
7223 is_two_byte_font = font->mac_scriptcode == smJapanese || 7760 is_two_byte_font = font->mac_scriptcode == smJapanese ||
7224 font->mac_scriptcode == smTradChinese || 7761 font->mac_scriptcode == smTradChinese ||
7225 font->mac_scriptcode == smSimpChinese || 7762 font->mac_scriptcode == smSimpChinese ||
@@ -7234,24 +7771,26 @@ XLoadQueryFont (Display *dpy, char *fontname)
7234 font->ascent = the_fontinfo.ascent; 7771 font->ascent = the_fontinfo.ascent;
7235 font->descent = the_fontinfo.descent; 7772 font->descent = the_fontinfo.descent;
7236 7773
7237 font->min_byte1 = 0;
7238 if (is_two_byte_font)
7239 font->max_byte1 = 1;
7240 else
7241 font->max_byte1 = 0;
7242 font->min_char_or_byte2 = 0x20;
7243 font->max_char_or_byte2 = 0xff;
7244
7245 if (is_two_byte_font) 7774 if (is_two_byte_font)
7246 { 7775 {
7776 font->min_byte1 = 0xa1;
7777 font->max_byte1 = 0xfe;
7778 font->min_char_or_byte2 = 0xa1;
7779 font->max_char_or_byte2 = 0xfe;
7780
7247 /* Use the width of an "ideographic space" of that font because 7781 /* Use the width of an "ideographic space" of that font because
7248 the_fontinfo.widMax returns the wrong width for some fonts. */ 7782 the_fontinfo.widMax returns the wrong width for some fonts. */
7249 switch (font->mac_scriptcode) 7783 switch (font->mac_scriptcode)
7250 { 7784 {
7251 case smJapanese: 7785 case smJapanese:
7786 font->min_byte1 = 0x81;
7787 font->max_byte1 = 0xfc;
7788 font->min_char_or_byte2 = 0x40;
7789 font->max_char_or_byte2 = 0xfc;
7252 char_width = StringWidth("\p\x81\x40"); 7790 char_width = StringWidth("\p\x81\x40");
7253 break; 7791 break;
7254 case smTradChinese: 7792 case smTradChinese:
7793 font->min_char_or_byte2 = 0x40;
7255 char_width = StringWidth("\p\xa1\x40"); 7794 char_width = StringWidth("\p\xa1\x40");
7256 break; 7795 break;
7257 case smSimpChinese: 7796 case smSimpChinese:
@@ -7263,9 +7802,15 @@ XLoadQueryFont (Display *dpy, char *fontname)
7263 } 7802 }
7264 } 7803 }
7265 else 7804 else
7266 /* Do this instead of use the_fontinfo.widMax, which incorrectly 7805 {
7267 returns 15 for 12-point Monaco! */ 7806 font->min_byte1 = font->max_byte1 = 0;
7268 char_width = CharWidth ('m'); 7807 font->min_char_or_byte2 = 0x20;
7808 font->max_char_or_byte2 = 0xff;
7809
7810 /* Do this instead of use the_fontinfo.widMax, which incorrectly
7811 returns 15 for 12-point Monaco! */
7812 char_width = CharWidth ('m');
7813 }
7269 7814
7270 if (is_two_byte_font) 7815 if (is_two_byte_font)
7271 { 7816 {
@@ -7284,55 +7829,56 @@ XLoadQueryFont (Display *dpy, char *fontname)
7284 } 7829 }
7285 else 7830 else
7286 { 7831 {
7287 font->per_char = (XCharStruct *) 7832 int c, min_width, max_width;
7288 xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1)); 7833 Rect char_bounds, min_bounds, max_bounds;
7289 { 7834 char ch;
7290 int c, min_width, max_width; 7835
7291 Rect char_bounds, min_bounds, max_bounds; 7836 font->per_char = xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
7292 char ch; 7837
7293 7838 min_width = max_width = char_width;
7294 min_width = max_width = char_width; 7839 SetRect (&min_bounds, -32767, -32767, 32767, 32767);
7295 SetRect (&min_bounds, -32767, -32767, 32767, 32767); 7840 SetRect (&max_bounds, 0, 0, 0, 0);
7296 SetRect (&max_bounds, 0, 0, 0, 0); 7841 for (c = 0x20; c <= 0xff; c++)
7297 for (c = 0x20; c <= 0xff; c++) 7842 {
7298 { 7843 ch = c;
7299 ch = c; 7844 char_width = CharWidth (ch);
7300 char_width = CharWidth (ch); 7845 QDTextBounds (1, &ch, &char_bounds);
7301 QDTextBounds (1, &ch, &char_bounds); 7846 STORE_XCHARSTRUCT (font->per_char[c - 0x20],
7302 STORE_XCHARSTRUCT (font->per_char[c - 0x20], 7847 char_width, char_bounds);
7303 char_width, char_bounds); 7848 /* Some Japanese fonts (in SJIS encoding) return 0 as the
7304 /* Some Japanese fonts (in SJIS encoding) return 0 as the 7849 character width of 0x7f. */
7305 character width of 0x7f. */ 7850 if (char_width > 0)
7306 if (char_width > 0) 7851 {
7307 { 7852 min_width = min (min_width, char_width);
7308 min_width = min (min_width, char_width); 7853 max_width = max (max_width, char_width);
7309 max_width = max (max_width, char_width); 7854 }
7310 } 7855 if (!EmptyRect (&char_bounds))
7311 if (!EmptyRect (&char_bounds)) 7856 {
7312 { 7857 SetRect (&min_bounds,
7313 SetRect (&min_bounds, 7858 max (min_bounds.left, char_bounds.left),
7314 max (min_bounds.left, char_bounds.left), 7859 max (min_bounds.top, char_bounds.top),
7315 max (min_bounds.top, char_bounds.top), 7860 min (min_bounds.right, char_bounds.right),
7316 min (min_bounds.right, char_bounds.right), 7861 min (min_bounds.bottom, char_bounds.bottom));
7317 min (min_bounds.bottom, char_bounds.bottom)); 7862 UnionRect (&max_bounds, &char_bounds, &max_bounds);
7318 UnionRect (&max_bounds, &char_bounds, &max_bounds); 7863 }
7319 } 7864 }
7320 } 7865 STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds);
7321 STORE_XCHARSTRUCT (font->min_bounds, min_width, min_bounds); 7866 STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds);
7322 STORE_XCHARSTRUCT (font->max_bounds, max_width, max_bounds); 7867 if (min_width == max_width
7323 if (min_width == max_width 7868 && max_bounds.left >= 0 && max_bounds.right <= max_width)
7324 && max_bounds.left >= 0 && max_bounds.right <= max_width) 7869 {
7325 { 7870 /* Fixed width and no overhangs. */
7326 /* Fixed width and no overhangs. */ 7871 xfree (font->per_char);
7327 xfree (font->per_char); 7872 font->per_char = NULL;
7328 font->per_char = NULL; 7873 }
7329 }
7330 }
7331 } 7874 }
7332 7875
7333 TextFont (old_fontnum); /* restore previous font number, size and face */ 7876 TextFont (old_fontnum); /* restore previous font number, size and face */
7334 TextSize (old_fontsize); 7877 TextSize (old_fontsize);
7335 TextFace (old_fontface); 7878 TextFace (old_fontface);
7879#if USE_ATSUI
7880 }
7881#endif
7336 7882
7337 return font; 7883 return font;
7338} 7884}
@@ -7346,6 +7892,10 @@ mac_unload_font (dpyinfo, font)
7346 xfree (font->full_name); 7892 xfree (font->full_name);
7347 if (font->per_char) 7893 if (font->per_char)
7348 xfree (font->per_char); 7894 xfree (font->per_char);
7895#if USE_ATSUI
7896 if (font->mac_style)
7897 ATSUDisposeStyle (font->mac_style);
7898#endif
7349 xfree (font); 7899 xfree (font);
7350} 7900}
7351 7901
@@ -10188,75 +10738,6 @@ init_quit_char_handler ()
10188 10738
10189 mac_determine_quit_char_modifiers(); 10739 mac_determine_quit_char_modifiers();
10190} 10740}
10191
10192static Boolean
10193quit_char_comp (EventRef inEvent, void *inCompData)
10194{
10195 if (GetEventClass(inEvent) != kEventClassKeyboard)
10196 return false;
10197 if (GetEventKind(inEvent) != kEventRawKeyDown)
10198 return false;
10199 {
10200 UInt32 keyCode;
10201 UInt32 keyModifiers;
10202 GetEventParameter(inEvent, kEventParamKeyCode,
10203 typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode);
10204 if (keyCode != mac_quit_char_keycode)
10205 return false;
10206 GetEventParameter(inEvent, kEventParamKeyModifiers,
10207 typeUInt32, NULL, sizeof(UInt32), NULL, &keyModifiers);
10208 if (keyModifiers != mac_quit_char_modifiers)
10209 return false;
10210 }
10211 return true;
10212}
10213
10214void
10215mac_check_for_quit_char ()
10216{
10217 EventRef event;
10218 static EMACS_TIME last_check_time = { 0, 0 };
10219 static EMACS_TIME one_second = { 1, 0 };
10220 EMACS_TIME now, t;
10221
10222 /* If windows are not initialized, return immediately (keep it bouncin'). */
10223 if (!mac_quit_char_modifiers)
10224 return;
10225
10226 /* Don't check if last check is less than a second ago. */
10227 EMACS_GET_TIME (now);
10228 EMACS_SUB_TIME (t, now, last_check_time);
10229 if (EMACS_TIME_LT (t, one_second))
10230 return;
10231 last_check_time = now;
10232
10233 /* Redetermine modifiers because they are based on lisp variables */
10234 mac_determine_quit_char_modifiers ();
10235
10236 /* Fill the queue with events */
10237 BLOCK_INPUT;
10238 ReceiveNextEvent (0, NULL, kEventDurationNoWait, false, &event);
10239 event = FindSpecificEventInQueue (GetMainEventQueue (), quit_char_comp,
10240 NULL);
10241 UNBLOCK_INPUT;
10242 if (event)
10243 {
10244 struct input_event e;
10245
10246 /* Use an input_event to emulate what the interrupt handler does. */
10247 EVENT_INIT (e);
10248 e.kind = ASCII_KEYSTROKE_EVENT;
10249 e.code = quit_char;
10250 e.arg = Qnil;
10251 e.modifiers = NULL;
10252 e.timestamp = EventTimeToTicks (GetEventTime (event)) * (1000/60);
10253 XSETFRAME (e.frame_or_window, mac_focus_frame (&one_mac_display_info));
10254 /* Remove event from queue to prevent looping. */
10255 RemoveEventFromQueue (GetMainEventQueue (), event);
10256 ReleaseEvent (event);
10257 kbd_buffer_store_event (&e);
10258 }
10259}
10260#endif /* MAC_OSX */ 10741#endif /* MAC_OSX */
10261 10742
10262static void 10743static void
@@ -10435,6 +10916,11 @@ syms_of_macterm ()
10435 Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop"); 10916 Qmac_ready_for_drag_n_drop = intern ("mac-ready-for-drag-n-drop");
10436 staticpro (&Qmac_ready_for_drag_n_drop); 10917 staticpro (&Qmac_ready_for_drag_n_drop);
10437 10918
10919#if USE_ATSUI
10920 staticpro (&atsu_font_id_hash);
10921 atsu_font_id_hash = Qnil;
10922#endif
10923
10438 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 10924 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
10439 doc: /* If not nil, Emacs uses toolkit scroll bars. */); 10925 doc: /* If not nil, Emacs uses toolkit scroll bars. */);
10440#ifdef USE_TOOLKIT_SCROLL_BARS 10926#ifdef USE_TOOLKIT_SCROLL_BARS
diff --git a/src/marker.c b/src/marker.c
index 11b077761e5..36a048537f7 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -256,6 +256,7 @@ buf_charpos_to_bytepos (b, charpos)
256 256
257int 257int
258verify_bytepos (charpos) 258verify_bytepos (charpos)
259 int charpos;
259{ 260{
260 int below = 1; 261 int below = 1;
261 int below_byte = 1; 262 int below_byte = 1;
diff --git a/src/minibuf.c b/src/minibuf.c
index 34cadfc3e24..a84f37cad21 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -1138,11 +1138,14 @@ DEFUN ("read-buffer", Fread_buffer, Sread_buffer, 1, 3, 0,
1138Prompt with PROMPT. 1138Prompt with PROMPT.
1139Optional second arg DEF is value to return if user enters an empty line. 1139Optional second arg DEF is value to return if user enters an empty line.
1140If optional third arg REQUIRE-MATCH is non-nil, 1140If optional third arg REQUIRE-MATCH is non-nil,
1141 only existing buffer names are allowed. */) 1141 only existing buffer names are allowed.
1142The argument PROMPT should be a string ending with a colon and a space. */)
1142 (prompt, def, require_match) 1143 (prompt, def, require_match)
1143 Lisp_Object prompt, def, require_match; 1144 Lisp_Object prompt, def, require_match;
1144{ 1145{
1145 Lisp_Object args[4]; 1146 Lisp_Object args[4];
1147 unsigned char *s;
1148 int len;
1146 1149
1147 if (BUFFERP (def)) 1150 if (BUFFERP (def))
1148 def = XBUFFER (def)->name; 1151 def = XBUFFER (def)->name;
@@ -1151,7 +1154,26 @@ If optional third arg REQUIRE-MATCH is non-nil,
1151 { 1154 {
1152 if (!NILP (def)) 1155 if (!NILP (def))
1153 { 1156 {
1154 args[0] = build_string ("%s(default %s) "); 1157 /* A default value was provided: we must change PROMPT,
1158 editing the default value in before the colon. To achieve
1159 this, we replace PROMPT with a substring that doesn't
1160 contain the terminal space and colon (if present). They
1161 are then added back using Fformat. */
1162
1163 if (STRINGP (prompt))
1164 {
1165 s = SDATA (prompt);
1166 len = strlen (s);
1167 if (len >= 2 && s[len - 2] == ':' && s[len - 1] == ' ')
1168 len = len - 2;
1169 else if (len >= 1 && (s[len - 1] == ':' || s[len - 1] == ' '))
1170 len--;
1171
1172 prompt = make_specified_string (s, -1, len,
1173 STRING_MULTIBYTE (prompt));
1174 }
1175
1176 args[0] = build_string ("%s (default %s): ");
1155 args[1] = prompt; 1177 args[1] = prompt;
1156 args[2] = def; 1178 args[2] = def;
1157 prompt = Fformat (3, args); 1179 prompt = Fformat (3, args);
diff --git a/src/process.c b/src/process.c
index f23b8368f6d..dd892637726 100644
--- a/src/process.c
+++ b/src/process.c
@@ -118,10 +118,10 @@ Boston, MA 02110-1301, USA. */
118#include <sys/wait.h> 118#include <sys/wait.h>
119#endif 119#endif
120 120
121#include "lisp.h"
121#include "systime.h" 122#include "systime.h"
122#include "systty.h" 123#include "systty.h"
123 124
124#include "lisp.h"
125#include "window.h" 125#include "window.h"
126#include "buffer.h" 126#include "buffer.h"
127#include "charset.h" 127#include "charset.h"
@@ -187,7 +187,6 @@ extern Lisp_Object QCfilter;
187 187
188#include "syswait.h" 188#include "syswait.h"
189 189
190extern void set_waiting_for_input P_ ((EMACS_TIME *));
191extern char *get_operating_system_release (); 190extern char *get_operating_system_release ();
192 191
193#ifndef USE_CRT_DLL 192#ifndef USE_CRT_DLL
@@ -1793,6 +1792,12 @@ create_process (process, new_argv, current_dir)
1793#endif 1792#endif
1794 if (forkin < 0) 1793 if (forkin < 0)
1795 report_file_error ("Opening pty", Qnil); 1794 report_file_error ("Opening pty", Qnil);
1795#if defined (RTU) || defined (UNIPLUS) || defined (DONT_REOPEN_PTY)
1796 /* In the case that vfork is defined as fork, the parent process
1797 (Emacs) may send some data before the child process completes
1798 tty options setup. So we setup tty before forking. */
1799 child_setup_tty (forkout);
1800#endif /* RTU or UNIPLUS or DONT_REOPEN_PTY */
1796#else 1801#else
1797 forkin = forkout = -1; 1802 forkin = forkout = -1;
1798#endif /* not USG, or USG_SUBTTY_WORKS */ 1803#endif /* not USG, or USG_SUBTTY_WORKS */
@@ -2077,8 +2082,10 @@ create_process (process, new_argv, current_dir)
2077#endif /* SIGCHLD */ 2082#endif /* SIGCHLD */
2078#endif /* !POSIX_SIGNALS */ 2083#endif /* !POSIX_SIGNALS */
2079 2084
2085#if !defined (RTU) && !defined (UNIPLUS) && !defined (DONT_REOPEN_PTY)
2080 if (pty_flag) 2086 if (pty_flag)
2081 child_setup_tty (xforkout); 2087 child_setup_tty (xforkout);
2088#endif /* not RTU and not UNIPLUS and not DONT_REOPEN_PTY */
2082#ifdef WINDOWSNT 2089#ifdef WINDOWSNT
2083 pid = child_setup (xforkin, xforkout, xforkout, 2090 pid = child_setup (xforkin, xforkout, xforkout,
2084 new_argv, 1, current_dir); 2091 new_argv, 1, current_dir);
diff --git a/src/regex.c b/src/regex.c
index fd18864110b..4f2683adfb9 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1265,9 +1265,9 @@ static re_char *whitespace_regexp;
1265 1265
1266void 1266void
1267re_set_whitespace_regexp (regexp) 1267re_set_whitespace_regexp (regexp)
1268 re_char *regexp; 1268 const char *regexp;
1269{ 1269{
1270 whitespace_regexp = regexp; 1270 whitespace_regexp = (re_char *) regexp;
1271} 1271}
1272WEAK_ALIAS (__re_set_syntax, re_set_syntax) 1272WEAK_ALIAS (__re_set_syntax, re_set_syntax)
1273 1273
diff --git a/src/regex.h b/src/regex.h
index 557700dc93d..da0ab3e78d1 100644
--- a/src/regex.h
+++ b/src/regex.h
@@ -603,8 +603,13 @@ typedef enum { RECC_ERROR = 0,
603 RECC_ASCII, RECC_UNIBYTE 603 RECC_ASCII, RECC_UNIBYTE
604} re_wctype_t; 604} re_wctype_t;
605 605
606extern char re_iswctype (int ch, re_wctype_t cc);
607extern re_wctype_t re_wctype (const unsigned char* str);
608
606typedef int re_wchar_t; 609typedef int re_wchar_t;
607 610
611extern void re_set_whitespace_regexp (const char *regexp);
612
608#endif /* not WIDE_CHAR_SUPPORT */ 613#endif /* not WIDE_CHAR_SUPPORT */
609 614
610#endif /* regex.h */ 615#endif /* regex.h */
diff --git a/src/s/aix4-2.h b/src/s/aix4-2.h
index 66b7d322b56..02225a9226f 100644
--- a/src/s/aix4-2.h
+++ b/src/s/aix4-2.h
@@ -2,5 +2,23 @@
2 2
3#undef ALIGN_DATA_RELOC 3#undef ALIGN_DATA_RELOC
4 4
5/* On AIX Emacs uses the gmalloc.c malloc implementation. But given
6 the way this system works, libc functions that return malloced
7 memory use the libc malloc implementation. Calling xfree or
8 xrealloc on the results of such functions results in a crash.
9
10 One solution for this could be to define SYSTEM_MALLOC here, but
11 that does not currently work on this system.
12
13 It is possible to completely override the malloc implementation on
14 AIX, but that involves putting the malloc functions in a shared
15 library and setting the MALLOCTYPE environment variable to point to
16 tha shared library.
17
18 Emacs currently calls xrealloc on the results of get_current_dir name,
19 to avoid a crash just use the Emacs implementation for that function.
20*/
21#define BROKEN_GET_CURRENT_DIR_NAME 1
22
5/* arch-tag: 38fe75ea-6aef-42bd-8449-bc34d921a562 23/* arch-tag: 38fe75ea-6aef-42bd-8449-bc34d921a562
6 (do not change this comment) */ 24 (do not change this comment) */
diff --git a/src/sysdep.c b/src/sysdep.c
index 114300b6784..c9464cd111f 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -51,10 +51,7 @@ extern void srandom P_ ((unsigned int));
51#include "blockinput.h" 51#include "blockinput.h"
52 52
53#ifdef MAC_OS8 53#ifdef MAC_OS8
54/* It is essential to include stdlib.h so that this file picks up 54#include <sys/param.h>
55 the correct definitions of rand, srand, and RAND_MAX.
56 Otherwise random numbers will not work correctly. */
57#include <stdlib.h>
58 55
59#ifndef subprocesses 56#ifndef subprocesses
60/* Nonzero means delete a process right away if it exits (process.c). */ 57/* Nonzero means delete a process right away if it exits (process.c). */
@@ -257,7 +254,7 @@ void hft_reset P_ ((struct tty_display_info *));
257SIGMASKTYPE sigprocmask_set; 254SIGMASKTYPE sigprocmask_set;
258 255
259 256
260#ifndef HAVE_GET_CURRENT_DIR_NAME 257#if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME)
261 258
262/* Return the current working directory. Returns NULL on errors. 259/* Return the current working directory. Returns NULL on errors.
263 Any other returned value must be freed with free. This is used 260 Any other returned value must be freed with free. This is used
diff --git a/src/systime.h b/src/systime.h
index 12d8d406d8e..9851db4cf33 100644
--- a/src/systime.h
+++ b/src/systime.h
@@ -154,6 +154,17 @@ extern time_t timezone;
154 154
155extern int set_file_times __P ((const char *, EMACS_TIME, EMACS_TIME)); 155extern int set_file_times __P ((const char *, EMACS_TIME, EMACS_TIME));
156 156
157/* defined in keyboard.c */
158extern void set_waiting_for_input __P ((EMACS_TIME *));
159
160/* When lisp.h is not included Lisp_Object is not defined (this can
161 happen when this files is used outside the src directory).
162 Use GCPRO1 to determine if lisp.h was included. */
163#ifdef GCPRO1
164/* defined in dired.c */
165extern Lisp_Object make_time __P ((time_t));
166#endif
167
157/* Compare times T1 and T2. Value is 0 if T1 and T2 are the same. 168/* Compare times T1 and T2. Value is 0 if T1 and T2 are the same.
158 Value is < 0 if T1 is less than T2. Value is > 0 otherwise. */ 169 Value is < 0 if T1 is less than T2. Value is > 0 otherwise. */
159 170
diff --git a/src/unexelf.c b/src/unexelf.c
index ee563b36a97..e33a9a1aeb3 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -412,7 +412,7 @@ temacs:
412#include <string.h> 412#include <string.h>
413#else 413#else
414#include <config.h> 414#include <config.h>
415extern void fatal (char *, ...); 415extern void fatal (const char *msgid, ...);
416#endif 416#endif
417 417
418#include <sys/types.h> 418#include <sys/types.h>
diff --git a/src/window.c b/src/window.c
index 3140bbaf001..9a78ef1ed36 100644
--- a/src/window.c
+++ b/src/window.c
@@ -275,7 +275,6 @@ make_window ()
275 XSETWINDOW (val, p); 275 XSETWINDOW (val, p);
276 XSETFASTINT (p->last_point, 0); 276 XSETFASTINT (p->last_point, 0);
277 p->frozen_window_start_p = 0; 277 p->frozen_window_start_p = 0;
278 p->height_fixed_p = 0;
279 p->last_cursor_off_p = p->cursor_off_p = 0; 278 p->last_cursor_off_p = p->cursor_off_p = 0;
280 p->left_margin_cols = Qnil; 279 p->left_margin_cols = Qnil;
281 p->right_margin_cols = Qnil; 280 p->right_margin_cols = Qnil;
@@ -2440,27 +2439,22 @@ window_fixed_size_p (w, width_p, check_siblings_p)
2440 } 2439 }
2441 else if (BUFFERP (w->buffer)) 2440 else if (BUFFERP (w->buffer))
2442 { 2441 {
2443 if (w->height_fixed_p && !width_p) 2442 struct buffer *old = current_buffer;
2444 fixed_p = 1; 2443 Lisp_Object val;
2445 else
2446 {
2447 struct buffer *old = current_buffer;
2448 Lisp_Object val;
2449 2444
2450 current_buffer = XBUFFER (w->buffer); 2445 current_buffer = XBUFFER (w->buffer);
2451 val = find_symbol_value (Qwindow_size_fixed); 2446 val = find_symbol_value (Qwindow_size_fixed);
2452 current_buffer = old; 2447 current_buffer = old;
2453 2448
2454 fixed_p = 0; 2449 fixed_p = 0;
2455 if (!EQ (val, Qunbound)) 2450 if (!EQ (val, Qunbound))
2456 { 2451 {
2457 fixed_p = !NILP (val); 2452 fixed_p = !NILP (val);
2458 2453
2459 if (fixed_p 2454 if (fixed_p
2460 && ((EQ (val, Qheight) && width_p) 2455 && ((EQ (val, Qheight) && width_p)
2461 || (EQ (val, Qwidth) && !width_p))) 2456 || (EQ (val, Qwidth) && !width_p)))
2462 fixed_p = 0; 2457 fixed_p = 0;
2463 }
2464 } 2458 }
2465 2459
2466 /* Can't tell if this one is resizable without looking at 2460 /* Can't tell if this one is resizable without looking at
@@ -6233,6 +6227,85 @@ usage: (save-window-excursion BODY ...) */)
6233 return unbind_to (count, val); 6227 return unbind_to (count, val);
6234} 6228}
6235 6229
6230
6231
6232/***********************************************************************
6233 Window Split Tree
6234 ***********************************************************************/
6235
6236static Lisp_Object
6237window_split_tree (w)
6238 struct window *w;
6239{
6240 Lisp_Object tail = Qnil;
6241 Lisp_Object result = Qnil;
6242
6243 while (w)
6244 {
6245 Lisp_Object wn;
6246
6247 XSETWINDOW (wn, w);
6248 if (!NILP (w->hchild))
6249 wn = Fcons (Qnil, Fcons (Fwindow_edges (wn),
6250 window_split_tree (XWINDOW (w->hchild))));
6251 else if (!NILP (w->vchild))
6252 wn = Fcons (Qt, Fcons (Fwindow_edges (wn),
6253 window_split_tree (XWINDOW (w->vchild))));
6254
6255 if (NILP (result))
6256 {
6257 result = tail = Fcons (wn, Qnil);
6258 }
6259 else
6260 {
6261 XSETCDR (tail, Fcons (wn, Qnil));
6262 tail = XCDR (tail);
6263 }
6264
6265 w = NILP (w->next) ? 0 : XWINDOW (w->next);
6266 }
6267
6268 return result;
6269}
6270
6271
6272
6273DEFUN ("window-split-tree", Fwindow_split_tree, Swindow_split_tree,
6274 0, 1, 0,
6275 doc: /* Return the window split tree for frame FRAME.
6276
6277The return value is a list of the form (ROOT MINI), where ROOT
6278represents the window split tree of the frame's root window, and MINI
6279is the frame's minibuffer window.
6280
6281If the root window is not split, ROOT is the root window itself.
6282Otherwise, ROOT is a list (DIR EDGES W1 W2 ...) where DIR is nil for a
6283horisontal split, and t for a vertical split, EDGES gives the combined
6284size and position of the subwindows in the split, and the rest of the
6285elements are the subwindows in the split. Each of the subwindows may
6286again be a window or a list representing a window split, and so on.
6287EDGES is a list \(LEFT TOP RIGHT BOTTOM) as returned by `window-edges'.
6288
6289If FRAME is nil or omitted, return information on the currently
6290selected frame. */)
6291 (frame)
6292 Lisp_Object frame;
6293{
6294 Lisp_Object alist;
6295 FRAME_PTR f;
6296
6297 if (NILP (frame))
6298 frame = selected_frame;
6299
6300 CHECK_FRAME (frame);
6301 f = XFRAME (frame);
6302
6303 if (!FRAME_LIVE_P (f))
6304 return Qnil;
6305
6306 return window_split_tree (XWINDOW (FRAME_ROOT_WINDOW (f)));
6307}
6308
6236 6309
6237/*********************************************************************** 6310/***********************************************************************
6238 Marginal Areas 6311 Marginal Areas
@@ -7039,6 +7112,7 @@ The selected frame is the one whose configuration has changed. */);
7039 defsubr (&Sset_window_configuration); 7112 defsubr (&Sset_window_configuration);
7040 defsubr (&Scurrent_window_configuration); 7113 defsubr (&Scurrent_window_configuration);
7041 defsubr (&Ssave_window_excursion); 7114 defsubr (&Ssave_window_excursion);
7115 defsubr (&Swindow_split_tree);
7042 defsubr (&Sset_window_margins); 7116 defsubr (&Sset_window_margins);
7043 defsubr (&Swindow_margins); 7117 defsubr (&Swindow_margins);
7044 defsubr (&Sset_window_fringes); 7118 defsubr (&Sset_window_fringes);
diff --git a/src/window.h b/src/window.h
index 4ca46b20af5..cb819990258 100644
--- a/src/window.h
+++ b/src/window.h
@@ -290,11 +290,6 @@ struct window
290 be changed during redisplay. If point is not in the window, 290 be changed during redisplay. If point is not in the window,
291 accept that. */ 291 accept that. */
292 unsigned frozen_window_start_p : 1; 292 unsigned frozen_window_start_p : 1;
293
294 /* 1 means that this window's height is temporarily fixed. Used
295 in resize_mini_window to precent resizing selected_window, if
296 possible. */
297 unsigned height_fixed_p : 1;
298}; 293};
299 294
300/* 1 if W is a minibuffer window. */ 295/* 1 if W is a minibuffer window. */
diff --git a/src/xdisp.c b/src/xdisp.c
index c5c05408e3c..2c66481a8c3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -6739,7 +6739,10 @@ message_log_maybe_newline ()
6739 terminated with a newline when NLFLAG is non-zero. MULTIBYTE, if 6739 terminated with a newline when NLFLAG is non-zero. MULTIBYTE, if
6740 nonzero, means interpret the contents of M as multibyte. This 6740 nonzero, means interpret the contents of M as multibyte. This
6741 function calls low-level routines in order to bypass text property 6741 function calls low-level routines in order to bypass text property
6742 hooks, etc. which might not be safe to run. */ 6742 hooks, etc. which might not be safe to run.
6743
6744 This may GC (insert may run before/after change hooks),
6745 so the buffer M must NOT point to a Lisp string. */
6743 6746
6744void 6747void
6745message_dolog (m, nbytes, nlflag, multibyte) 6748message_dolog (m, nbytes, nlflag, multibyte)
@@ -6950,10 +6953,7 @@ message_log_check_duplicate (prev_bol, prev_bol_byte, this_bol, this_bol_byte)
6950 out any existing message, and let the mini-buffer text show 6953 out any existing message, and let the mini-buffer text show
6951 through. 6954 through.
6952 6955
6953 The buffer M must continue to exist until after the echo area gets 6956 This may GC, so the buffer M must NOT point to a Lisp string. */
6954 cleared or some other message gets displayed there. This means do
6955 not pass text that is stored in a Lisp string; do not pass text in
6956 a buffer that was alloca'd. */
6957 6957
6958void 6958void
6959message2 (m, nbytes, multibyte) 6959message2 (m, nbytes, multibyte)
@@ -8025,7 +8025,11 @@ truncate_message_1 (nchars, a2, a3, a4)
8025 8025
8026 If S is not null, set the message to the first LEN bytes of S. LEN 8026 If S is not null, set the message to the first LEN bytes of S. LEN
8027 zero means use the whole string. MULTIBYTE_P non-zero means S is 8027 zero means use the whole string. MULTIBYTE_P non-zero means S is
8028 multibyte. Display the message multibyte in that case. */ 8028 multibyte. Display the message multibyte in that case.
8029
8030 Doesn't GC, as with_echo_area_buffer binds Qinhibit_modification_hooks
8031 to t before calling set_message_1 (which calls insert).
8032 */
8029 8033
8030void 8034void
8031set_message (s, string, nbytes, multibyte_p) 8035set_message (s, string, nbytes, multibyte_p)
@@ -11378,6 +11382,7 @@ static int
11378cursor_row_fully_visible_p (w, force_p, current_matrix_p) 11382cursor_row_fully_visible_p (w, force_p, current_matrix_p)
11379 struct window *w; 11383 struct window *w;
11380 int force_p; 11384 int force_p;
11385 int current_matrix_p;
11381{ 11386{
11382 struct glyph_matrix *matrix; 11387 struct glyph_matrix *matrix;
11383 struct glyph_row *row; 11388 struct glyph_row *row;
@@ -12855,7 +12860,8 @@ try_window (window, pos, check_margins)
12855 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); 12860 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
12856 12861
12857 if ((w->cursor.y < this_scroll_margin 12862 if ((w->cursor.y < this_scroll_margin
12858 && CHARPOS (pos) > BEGV) 12863 && CHARPOS (pos) > BEGV
12864 && IT_CHARPOS (it) < ZV)
12859 /* rms: considering make_cursor_line_fully_visible_p here 12865 /* rms: considering make_cursor_line_fully_visible_p here
12860 seems to give wrong results. We don't want to recenter 12866 seems to give wrong results. We don't want to recenter
12861 when the last line is partly visible, we want to allow 12867 when the last line is partly visible, we want to allow
diff --git a/src/xfaces.c b/src/xfaces.c
index d9fd4d2f989..729d43ccd5f 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -1480,7 +1480,9 @@ tty_color_name (f, idx)
1480 1480
1481 1481
1482/* Return non-zero if COLOR_NAME is a shade of gray (or white or 1482/* Return non-zero if COLOR_NAME is a shade of gray (or white or
1483 black) on frame F. The algorithm is taken from 20.2 faces.el. */ 1483 black) on frame F.
1484
1485 The criterion implemented here is not a terribly sophisticated one. */
1484 1486
1485static int 1487static int
1486face_color_gray_p (f, color_name) 1488face_color_gray_p (f, color_name)
@@ -1491,12 +1493,15 @@ face_color_gray_p (f, color_name)
1491 int gray_p; 1493 int gray_p;
1492 1494
1493 if (defined_color (f, color_name, &color, 0)) 1495 if (defined_color (f, color_name, &color, 0))
1494 gray_p = ((abs (color.red - color.green) 1496 gray_p = (/* Any color sufficiently close to black counts as grey. */
1495 < max (color.red, color.green) / 20) 1497 (color.red < 5000 && color.green < 5000 && color.blue < 5000)
1496 && (abs (color.green - color.blue) 1498 ||
1497 < max (color.green, color.blue) / 20) 1499 ((abs (color.red - color.green)
1498 && (abs (color.blue - color.red) 1500 < max (color.red, color.green) / 20)
1499 < max (color.blue, color.red) / 20)); 1501 && (abs (color.green - color.blue)
1502 < max (color.green, color.blue) / 20)
1503 && (abs (color.blue - color.red)
1504 < max (color.blue, color.red) / 20)));
1500 else 1505 else
1501 gray_p = 0; 1506 gray_p = 0;
1502 1507
@@ -5827,6 +5832,7 @@ lookup_derived_face (f, symbol, c, face_id, signal_p)
5827 Lisp_Object symbol; 5832 Lisp_Object symbol;
5828 int c; 5833 int c;
5829 int face_id; 5834 int face_id;
5835 int signal_p;
5830{ 5836{
5831 Lisp_Object attrs[LFACE_VECTOR_SIZE]; 5837 Lisp_Object attrs[LFACE_VECTOR_SIZE];
5832 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE]; 5838 Lisp_Object symbol_attrs[LFACE_VECTOR_SIZE];
diff --git a/src/xsmfns.c b/src/xsmfns.c
index dc5ebdf1ebd..008b50fc489 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -45,9 +45,9 @@ Boston, MA 02110-1301, USA. */
45#include <sys/param.h> 45#include <sys/param.h>
46#include <stdio.h> 46#include <stdio.h>
47 47
48#include "lisp.h"
48#include "systime.h" 49#include "systime.h"
49#include "sysselect.h" 50#include "sysselect.h"
50#include "lisp.h"
51#include "frame.h" 51#include "frame.h"
52#include "termhooks.h" 52#include "termhooks.h"
53#include "termopts.h" 53#include "termopts.h"
diff --git a/src/xterm.c b/src/xterm.c
index 04f9b895742..26f297f1024 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4037,8 +4037,6 @@ static Boolean xaw3d_arrow_scroll;
4037 4037
4038static Boolean xaw3d_pick_top; 4038static Boolean xaw3d_pick_top;
4039 4039
4040extern void set_vertical_scroll_bar P_ ((struct window *));
4041
4042/* Action hook installed via XtAppAddActionHook when toolkit scroll 4040/* Action hook installed via XtAppAddActionHook when toolkit scroll
4043 bars are used.. The hook is responsible for detecting when 4041 bars are used.. The hook is responsible for detecting when
4044 the user ends an interaction with the scroll bar, and generates 4042 the user ends an interaction with the scroll bar, and generates
@@ -6246,7 +6244,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6246 if (status_return == XBufferOverflow) 6244 if (status_return == XBufferOverflow)
6247 { 6245 {
6248 copy_bufsiz = nbytes + 1; 6246 copy_bufsiz = nbytes + 1;
6249 copy_bufptr = (char *) alloca (copy_bufsiz); 6247 copy_bufptr = (unsigned char *) alloca (copy_bufsiz);
6250 nbytes = XmbLookupString (FRAME_XIC (f), 6248 nbytes = XmbLookupString (FRAME_XIC (f),
6251 &event.xkey, copy_bufptr, 6249 &event.xkey, copy_bufptr,
6252 copy_bufsiz, &keysym, 6250 copy_bufsiz, &keysym,
@@ -6264,7 +6262,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6264 if (status_return == XBufferOverflow) 6262 if (status_return == XBufferOverflow)
6265 { 6263 {
6266 copy_bufsiz = nbytes + 1; 6264 copy_bufsiz = nbytes + 1;
6267 copy_bufptr = (char *) alloca (copy_bufsiz); 6265 copy_bufptr = (unsigned char *) alloca (copy_bufsiz);
6268 nbytes = Xutf8LookupString (FRAME_XIC (f), 6266 nbytes = Xutf8LookupString (FRAME_XIC (f),
6269 &event.xkey, 6267 &event.xkey,
6270 copy_bufptr, 6268 copy_bufptr,
@@ -6765,13 +6763,13 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6765 && (int)(event.xbutton.time - ignore_next_mouse_click_timeout) > 0) 6763 && (int)(event.xbutton.time - ignore_next_mouse_click_timeout) > 0)
6766 { 6764 {
6767 ignore_next_mouse_click_timeout = 0; 6765 ignore_next_mouse_click_timeout = 0;
6768 construct_mouse_click (&inev.ie, &event, f); 6766 construct_mouse_click (&inev.ie, &event.xbutton, f);
6769 } 6767 }
6770 if (event.type == ButtonRelease) 6768 if (event.type == ButtonRelease)
6771 ignore_next_mouse_click_timeout = 0; 6769 ignore_next_mouse_click_timeout = 0;
6772 } 6770 }
6773 else 6771 else
6774 construct_mouse_click (&inev.ie, &event, f); 6772 construct_mouse_click (&inev.ie, &event.xbutton, f);
6775 } 6773 }
6776 } 6774 }
6777 } 6775 }
diff --git a/src/xterm.h b/src/xterm.h
index e2db932a0be..3a8c3d79d61 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -1003,6 +1003,7 @@ extern XtAppContext Xt_app_con;
1003extern void x_query_colors P_ ((struct frame *f, XColor *, int)); 1003extern void x_query_colors P_ ((struct frame *f, XColor *, int));
1004extern void x_query_color P_ ((struct frame *f, XColor *)); 1004extern void x_query_color P_ ((struct frame *f, XColor *));
1005extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int)); 1005extern void x_clear_area P_ ((Display *, Window, int, int, int, int, int));
1006extern void set_vertical_scroll_bar P_ ((struct window *));
1006 1007
1007extern int x_dispatch_event P_ ((XEvent *, Display *)); 1008extern int x_dispatch_event P_ ((XEvent *, Display *));
1008 1009