aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2006-04-17 08:41:12 +0000
committerMiles Bader2006-04-17 08:41:12 +0000
commitcfc2051d0ed5a268528a647ab0911a2f5cc451de (patch)
treecb622fe0b6c1ba8b97314fb80ba2fd8fad60a5a2 /src
parentca49cf1703cc20d50653c32ca2f438c8819b78bd (diff)
parente4a89ccf738861d7b9c4f611185aa0f204c9c208 (diff)
downloademacs-cfc2051d0ed5a268528a647ab0911a2f5cc451de.tar.gz
emacs-cfc2051d0ed5a268528a647ab0911a2f5cc451de.zip
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-56
Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 204-225) - Update from CVS - Sync from erc--emacs--0 - Merge from gnus--rel--5.10 - Improve tq.el. - Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6. * gnus--rel--5.10 (patch 81-85) - Update from CVS - Merge from emacs--devo--0
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog188
-rw-r--r--src/data.c7
-rw-r--r--src/dispnew.c2
-rw-r--r--src/fns.c6
-rw-r--r--src/image.c25
-rw-r--r--src/keyboard.c3
-rw-r--r--src/lisp.h40
-rw-r--r--src/mac.c54
-rw-r--r--src/macfns.c49
-rw-r--r--src/macmenu.c2
-rw-r--r--src/macselect.c74
-rw-r--r--src/macterm.c440
-rw-r--r--src/macterm.h28
-rw-r--r--src/print.c3
-rw-r--r--src/process.c14
-rw-r--r--src/puresize.h4
-rw-r--r--src/s/ms-w32.h9
-rw-r--r--src/search.c4
-rw-r--r--src/unexmacosx.c9
-rw-r--r--src/window.c20
-rw-r--r--src/xdisp.c35
-rw-r--r--src/xfaces.c10
-rw-r--r--src/xrdb.c2
23 files changed, 590 insertions, 438 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a4db51e7ca1..88492417723 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,191 @@
12006-04-17 Kim F. Storm <storm@cua.dk>
2
3 * window.c (coordinates_in_window): On the vertical border,
4 calculate the row number measured from the top of the window, not
5 the top of the frame.
6
72006-04-16 Eli Zaretskii <eliz@gnu.org>
8
9 * s/ms-w32.h (SYSTEM_PURESIZE_EXTRA): Reduce to 24000.
10
112006-04-16 Romain Francoise <romain@orebokech.com>
12
13 * puresize.h (BASE_PURESIZE): Decrement back to 1200000.
14
152006-04-16 Andreas Schwab <schwab@suse.de>
16
17 * puresize.h (PURESIZE_RATIO): Reduce to 10/6.
18
192006-04-15 Romain Francoise <romain@orebokech.com>
20
21 * puresize.h (BASE_PURESIZE): Increment to 1210000.
22
232006-04-13 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change)
24
25 * print.c (Fprin1_to_string): Mention in the `doc' that the
26 behavior is modified by `print-level' and `print-length'.
27
282006-04-13 Kenichi Handa <handa@m17n.org>
29
30 * coding.c (setup_coding_system): If eol-type is not yet decided
31 and system_eol_type is not LF, set CODING_REQUIRE_ENCODING_MASK.
32 If coding_system is nil, return 0.
33 (code_convert_region1): Even if coding_system is nil, don't skip
34 conversion if system_eol_type is not LF.
35 (code_convert_string1): Likewise.
36 (code_convert_string_norecord): Likewise.
37
382006-04-13 Kenichi Handa <handa@m17n.org>
39
40 * coding.c (setup_coding_system): Fix previous change.
41 (encode_coding): If eol_type is not yet decided, use
42 system_eol_type.
43 (shrink_encoding_region): If eol_type is not yet decided and
44 system_eol_type is not LF, don't shrink.
45
462006-04-13 Nick Roberts <nickrob@snap.net.nz>
47
48 * xdisp.c (note_mouse_highlight): Add help echo for dragging vertical
49 line.
50
512006-04-12 Richard Stallman <rms@gnu.org>
52
53 * keyboard.c (read_key_sequence): Explicitly avoid keybuf[-1].
54
55 * process.c (conv_lisp_to_sockaddr): If FAMILY unknown, just return.
56 (Fprocess_send_eof): Abort if fail to open null device.
57
582006-04-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
59
60 * fns.c [HAVE_MENUS && MAC_OS]: Include macterm.h.
61
62 * image.c [MAC_OS] (xpm_load_image): Add parentheses around
63 assignment used as truth value. Add explicit braces to avoid
64 ambiguous `else'.
65 [MAC_OS] (gif_load): Remove unused variable `gcpro1'.
66
67 * lisp.h (syms_of_fontset, Fset_fontset_font): Put extern and
68 EXFUN in #ifdef HAVE_WINDOW_SYSTEM.
69 (syms_of_xfns, syms_of_xsmfns, syms_of_xselect, syms_of_xterm):
70 Put externs in #ifdef HAVE_X_WINDOWS.
71 (syms_of_macfns, syms_of_macselect, syms_of_macterm)
72 (syms_of_macmenu, syms_of_mac) [MAC_OS]: Add externs.
73 (init_mac_osx_environment) [MAC_OSX]: Add extern.
74
75 * mac.c (init_process): Remove undef.
76 (select) [MAC_OSX]: Undefine before including sysselect.h.
77 (posix_pathname_to_fsspec, fsspec_to_posix_pathname) [MAC_OSX]:
78 Remove functions and prototypes.
79 (parse_value): Add parentheses around + inside shift.
80 (path_from_vol_dir_name): Make static.
81 (get_temp_dir_name): Remove unused variables `cpb' and `dir_name'.
82 [!MAC_OSX] (get_path_to_system_folder): Likewise.
83 (Fmac_get_file_creator, Fmac_get_file_type): Remove unused
84 variable `cCode'.
85 (Fmac_coerce_ae_data): Remove unused variables `fref' and `fs'.
86 (Fmac_get_preference): Add explicit braces to avoid ambiguous `else'.
87
88 * macfns.c (x_to_mac_color): Remove unused variable `tail'.
89 (x_set_mouse_color): Remove unused variable `dpy'.
90 (Fx_create_frame): Remove unused variable `x_frame_count'.
91 (Fx_server_version): Add explicit braces to avoid ambiguous `else'.
92 (x_sync): Move from macterm.c.
93 (Fx_file_dialog): Remove unused variable `default_filter_index'.
94
95 * macmenu.c (min_menu_id): Make element type explicit.
96
97 * macselect.c (get_flavor_type_from_symbol): Remove unused
98 variable `val'.
99 (get_scrap_private_timestamp, x_get_foreign_selection)
100 (copy_scrap_flavor_data): Add explicit braces to avoid ambiguous `else'.
101 (Fmac_process_deferred_apple_events): Remove unused variables
102 `keyword', `reply', `apple_event', `count', and `err'.
103
104 * macterm.c: Don't include gnu.h.
105 (x_io_error_quitter, x_draw_image_foreground_1): Remove prototypes.
106 (x_sync): Move to macfns.c.
107 [USE_CG_DRAWING] (mac_define_fringe_bitmap): Remove unused
108 variable `mask_bits'.
109 (mac_compute_glyph_string_overhangs): Avoid ambiguous `else'.
110 (x_draw_image_glyph_string): Remove unused variable `pixmap'.
111 (x_mac_to_emacs_modifiers): Remove function.
112 (XTset_vertical_scroll_bar, mac_handle_visibility_change)
113 (x_make_frame_visible, xlfdpat_create, mac_handle_command_event):
114 Add explicit braces to avoid ambiguous `else'.
115 (x_make_frame_visible): Remove unused variables `type',
116 `original_top', and `original_left'.
117 (mac_do_list_fonts, XTread_socket): Add parentheses around && within ||.
118 (x_load_font): Remove unused variables `full_name', and `value'.
119 (do_get_menus, do_init_managers, do_check_ram_size) [!MAC_OS8]:
120 Remove functions.
121 (do_zoom_window): Reorganize variables with respect to conditionals.
122 (init_command_handler): Remove unused variable `err'.
123 [MAC_OSX] (mac_check_bundle): Remove unused variable `child'.
124
125 * macterm.h (x_set_mouse_position, x_set_mouse_pixel_position)
126 (x_make_frame_invisible, x_iconify_frame, x_free_frame_resources)
127 (x_destroy_window, x_wm_set_size_hint, x_delete_display, XFreeGC)
128 (do_menu_choice, have_menus_p, x_real_positions)
129 (x_set_menu_bar_lines, x_pixel_width, x_pixel_height, x_char_width)
130 (x_char_height, x_sync, x_set_tool_bar_lines, x_activate_menubar)
131 (free_frame_menubar): Add externs.
132
133 * unexmacosx.c: Include config.h before using HAVE_MALLOC_MALLOC_H.
134 (malloc, realloc, free): Add undefs.
135 (read_load_commands): Remove unused variable `n' and `j'.
136 (copy_data_segment): Remove unused variable `r'.
137
138 * xdisp.c (get_glyph_string_clip_rects): Add parentheses around &&
139 within ||. Add explicit braces to avoid ambiguous `else'.
140 (dump_glyph_row): Remove label for `inverse_p' from legend.
141
142 * xfaces.c (Finternal_merge_in_global_face, try_font_list): Add
143 explicit braces to avoid ambiguous `else'.
144
1452006-04-11 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change)
146
147 * dispnew.c (init_display): Don't init X display if the user asked
148 for a non-X display.
149
1502006-04-12 Kenichi Handa <handa@m17n.org>
151
152 * coding.c (setup_coding_system): Use system_eol_type for default
153 coding->eol_type.
154
1552006-04-11 Dan Nicolaescu <dann@ics.uci.edu>
156
157 * lisp.h (wrong_type_argument): Mark as NO_RETURN.
158
159 * data.c (wrong_type_argument): Try to avoid compiler warnings due
160 to the fact the function is now marked as NO_RETURN.
161
1622006-04-10 Eli Zaretskii <eliz@gnu.org>
163
164 * s/ms-w32.h (pid_t) [_MSC_VER]: New typedef.
165
1662006-04-10 Romain Francoise <romain@orebokech.com>
167
168 * xrdb.c (gethomedir): Use xstrdup.
169
1702006-04-10 Andreas Schwab <schwab@suse.de>
171
172 * xrdb.c (gethomedir): Make sure to always return a pointer that
173 can be passed to free.
174
1752006-04-09 Richard Stallman <rms@gnu.org>
176
177 * lisp.h (Fkill_emacs): Undo previous change.
178
1792006-04-08 Richard Stallman <rms@gnu.org>
180
181 * search.c (boyer_moore): Test ch >= 0400, not >.
182
1832006-04-09 Dan Nicolaescu <dann@ics.uci.edu>
184
185 * puresize.h (pure_write_error): Mark as NO_RETURN.
186
187 * lisp.h (args_out_of_range, args_out_of_range_3)
188
12006-04-08 Eli Zaretskii <eliz@gnu.org> 1892006-04-08 Eli Zaretskii <eliz@gnu.org>
2 190
3 * w32fns.c (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements 191 * w32fns.c (w32_wnd_proc) <WM_MOUSEMOVE>: Ignore mouse movements
diff --git a/src/data.c b/src/data.c
index 8e7f5d20542..ec9a176f078 100644
--- a/src/data.c
+++ b/src/data.c
@@ -125,7 +125,14 @@ wrong_type_argument (predicate, value)
125 tem = call1 (predicate, value); 125 tem = call1 (predicate, value);
126 } 126 }
127 while (NILP (tem)); 127 while (NILP (tem));
128 /* This function is marked as NO_RETURN, gcc would warn if it has a
129 return statement or if falls off the function. Other compilers
130 warn if no return statement is present. */
131#ifndef __GNUC__
128 return value; 132 return value;
133#else
134 abort ();
135#endif
129} 136}
130 137
131void 138void
diff --git a/src/dispnew.c b/src/dispnew.c
index 297125063c7..2884a687e5f 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6640,7 +6640,7 @@ init_display ()
6640 try to use X, and die with an error message if that doesn't work. */ 6640 try to use X, and die with an error message if that doesn't work. */
6641 6641
6642#ifdef HAVE_X_WINDOWS 6642#ifdef HAVE_X_WINDOWS
6643 if (! display_arg) 6643 if (! inhibit_window_system && ! display_arg)
6644 { 6644 {
6645 char *display; 6645 char *display;
6646#ifdef VMS 6646#ifdef VMS
diff --git a/src/fns.c b/src/fns.c
index c6ae96e8383..2d4c49fbaa2 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -48,8 +48,12 @@ Boston, MA 02110-1301, USA. */
48#include "frame.h" 48#include "frame.h"
49#include "window.h" 49#include "window.h"
50#include "blockinput.h" 50#include "blockinput.h"
51#if defined (HAVE_MENUS) && defined (HAVE_X_WINDOWS) 51#ifdef HAVE_MENUS
52#if defined (HAVE_X_WINDOWS)
52#include "xterm.h" 53#include "xterm.h"
54#elif defined (MAC_OS)
55#include "macterm.h"
56#endif
53#endif 57#endif
54 58
55#ifndef NULL 59#ifndef NULL
diff --git a/src/image.c b/src/image.c
index 6f2e93a591a..91aa1198769 100644
--- a/src/image.c
+++ b/src/image.c
@@ -4379,7 +4379,7 @@ xpm_load_image (f, img, contents, end)
4379 if (color == NULL) 4379 if (color == NULL)
4380 goto failure; 4380 goto failure;
4381 4381
4382 while (str = strtok (NULL, " \t")) 4382 while ((str = strtok (NULL, " \t")) != NULL)
4383 { 4383 {
4384 next_key = xpm_str_to_color_key (str); 4384 next_key = xpm_str_to_color_key (str);
4385 if (next_key >= 0) 4385 if (next_key >= 0)
@@ -4407,17 +4407,21 @@ xpm_load_image (f, img, contents, end)
4407 Lisp_Object specified_color = Fassoc (symbol_color, color_symbols); 4407 Lisp_Object specified_color = Fassoc (symbol_color, color_symbols);
4408 4408
4409 if (CONSP (specified_color) && STRINGP (XCDR (specified_color))) 4409 if (CONSP (specified_color) && STRINGP (XCDR (specified_color)))
4410 if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0) 4410 {
4411 color_val = Qt; 4411 if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0)
4412 else if (x_defined_color (f, SDATA (XCDR (specified_color)), 4412 color_val = Qt;
4413 &cdef, 0)) 4413 else if (x_defined_color (f, SDATA (XCDR (specified_color)),
4414 color_val = make_number (cdef.pixel); 4414 &cdef, 0))
4415 color_val = make_number (cdef.pixel);
4416 }
4415 } 4417 }
4416 if (NILP (color_val) && max_key > 0) 4418 if (NILP (color_val) && max_key > 0)
4417 if (xstricmp (max_color, "None") == 0) 4419 {
4418 color_val = Qt; 4420 if (xstricmp (max_color, "None") == 0)
4419 else if (x_defined_color (f, max_color, &cdef, 0)) 4421 color_val = Qt;
4420 color_val = make_number (cdef.pixel); 4422 else if (x_defined_color (f, max_color, &cdef, 0))
4423 color_val = make_number (cdef.pixel);
4424 }
4421 if (!NILP (color_val)) 4425 if (!NILP (color_val))
4422 (*put_color_table) (color_table, beg, chars_per_pixel, color_val); 4426 (*put_color_table) (color_table, beg, chars_per_pixel, color_val);
4423 4427
@@ -7846,7 +7850,6 @@ gif_load (f, img)
7846 int width, height; 7850 int width, height;
7847 XImagePtr ximg; 7851 XImagePtr ximg;
7848 TimeValue time; 7852 TimeValue time;
7849 struct gcpro gcpro1;
7850 int ino; 7853 int ino;
7851 CGrafPtr old_port; 7854 CGrafPtr old_port;
7852 GDHandle old_gdh; 7855 GDHandle old_gdh;
diff --git a/src/keyboard.c b/src/keyboard.c
index 2729ae878a9..e3a77653ed6 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1418,7 +1418,7 @@ command_loop_1 ()
1418 Lisp_Object keybuf[30]; 1418 Lisp_Object keybuf[30];
1419 int i; 1419 int i;
1420 int no_direct; 1420 int no_direct;
1421 int prev_modiff; 1421 int prev_modiff = 0;
1422 struct buffer *prev_buffer = NULL; 1422 struct buffer *prev_buffer = NULL;
1423#ifdef MULTI_KBOARD 1423#ifdef MULTI_KBOARD
1424 int was_locked = single_kboard; 1424 int was_locked = single_kboard;
@@ -9478,6 +9478,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9478 /* Don't downcase the last character if the caller says don't. 9478 /* Don't downcase the last character if the caller says don't.
9479 Don't downcase it if the result is undefined, either. */ 9479 Don't downcase it if the result is undefined, either. */
9480 if ((dont_downcase_last || first_binding >= nmaps) 9480 if ((dont_downcase_last || first_binding >= nmaps)
9481 && t > 0
9481 && t - 1 == original_uppercase_position) 9482 && t - 1 == original_uppercase_position)
9482 keybuf[t - 1] = original_uppercase; 9483 keybuf[t - 1] = original_uppercase;
9483 9484
diff --git a/src/lisp.h b/src/lisp.h
index 2356c40b731..0792bdf89b0 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2253,9 +2253,10 @@ EXFUN (Fmake_variable_buffer_local, 1);
2253extern Lisp_Object indirect_variable P_ ((Lisp_Object)); 2253extern Lisp_Object indirect_variable P_ ((Lisp_Object));
2254extern Lisp_Object long_to_cons P_ ((unsigned long)); 2254extern Lisp_Object long_to_cons P_ ((unsigned long));
2255extern unsigned long cons_to_long P_ ((Lisp_Object)); 2255extern unsigned long cons_to_long P_ ((Lisp_Object));
2256extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)); 2256extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2257extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); 2257extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object,
2258extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)); 2258 Lisp_Object)) NO_RETURN;
2259extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2259extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object, 2260extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object,
2260 Lisp_Object, struct buffer *)); 2261 Lisp_Object, struct buffer *));
2261extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object)); 2262extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object));
@@ -3235,11 +3236,15 @@ extern void syms_of_dired P_ ((void));
3235extern void syms_of_term P_ ((void)); 3236extern void syms_of_term P_ ((void));
3236extern void fatal () NO_RETURN; 3237extern void fatal () NO_RETURN;
3237 3238
3238#ifdef HAVE_X_WINDOWS 3239#ifdef HAVE_WINDOW_SYSTEM
3239/* Defined in fontset.c */ 3240/* Defined in fontset.c */
3240extern void syms_of_fontset P_ ((void)); 3241extern void syms_of_fontset P_ ((void));
3241EXFUN (Fset_fontset_font, 5); 3242EXFUN (Fset_fontset_font, 5);
3242EXFUN (Fnew_fontset, 2); 3243EXFUN (Fnew_fontset, 2);
3244
3245/* Defined in xfns.c, w32fns.c, or macfns.c */
3246EXFUN (Fxw_display_color_p, 1);
3247EXFUN (Fx_file_dialog, 5);
3243#endif 3248#endif
3244 3249
3245/* Defined in xfaces.c */ 3250/* Defined in xfaces.c */
@@ -3253,12 +3258,6 @@ extern int getloadavg P_ ((double *, int));
3253#ifdef HAVE_X_WINDOWS 3258#ifdef HAVE_X_WINDOWS
3254/* Defined in xfns.c */ 3259/* Defined in xfns.c */
3255extern void syms_of_xfns P_ ((void)); 3260extern void syms_of_xfns P_ ((void));
3256#endif /* HAVE_X_WINDOWS */
3257#ifdef HAVE_WINDOW_SYSTEM
3258/* Defined in xfns.c, w32fns.c, or macfns.c */
3259EXFUN (Fxw_display_color_p, 1);
3260EXFUN (Fx_file_dialog, 5);
3261#endif /* HAVE_WINDOW_SYSTEM */
3262 3261
3263/* Defined in xsmfns.c */ 3262/* Defined in xsmfns.c */
3264extern void syms_of_xsmfns P_ ((void)); 3263extern void syms_of_xsmfns P_ ((void));
@@ -3268,11 +3267,32 @@ extern void syms_of_xselect P_ ((void));
3268 3267
3269/* Defined in xterm.c */ 3268/* Defined in xterm.c */
3270extern void syms_of_xterm P_ ((void)); 3269extern void syms_of_xterm P_ ((void));
3270#endif /* HAVE_X_WINDOWS */
3271 3271
3272#ifdef MSDOS 3272#ifdef MSDOS
3273/* Defined in msdos.c */ 3273/* Defined in msdos.c */
3274EXFUN (Fmsdos_downcase_filename, 1); 3274EXFUN (Fmsdos_downcase_filename, 1);
3275#endif 3275#endif
3276
3277#ifdef MAC_OS
3278/* Defined in macfns.c */
3279extern void syms_of_macfns P_ ((void));
3280
3281/* Defined in macselect.c */
3282extern void syms_of_macselect P_ ((void));
3283
3284/* Defined in macterm.c */
3285extern void syms_of_macterm P_ ((void));
3286
3287/* Defined in macmenu.c */
3288extern void syms_of_macmenu P_ ((void));
3289
3290/* Defined in mac.c */
3291extern void syms_of_mac P_ ((void));
3292#ifdef MAC_OSX
3293extern void init_mac_osx_environment P_ ((void));
3294#endif /* MAC_OSX */
3295#endif /* MAC_OS */
3276 3296
3277/* Nonzero means Emacs has already been initialized. 3297/* Nonzero means Emacs has already been initialized.
3278 Used during startup to detect startup of dumped Emacs. */ 3298 Used during startup to detect startup of dumped Emacs. */
diff --git a/src/mac.c b/src/mac.c
index 40bbacf15ce..2b4e8dcbc64 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -28,7 +28,9 @@ Boston, MA 02110-1301, USA. */
28 28
29#include "lisp.h" 29#include "lisp.h"
30#include "process.h" 30#include "process.h"
31#undef init_process 31#ifdef MAC_OSX
32#undef select
33#endif
32#include "systime.h" 34#include "systime.h"
33#include "sysselect.h" 35#include "sysselect.h"
34#include "blockinput.h" 36#include "blockinput.h"
@@ -79,8 +81,10 @@ static ComponentInstance as_scripting_component;
79/* The single script context used for all script executions. */ 81/* The single script context used for all script executions. */
80static OSAID as_script_context; 82static OSAID as_script_context;
81 83
84#ifndef MAC_OSX
82static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *)); 85static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *));
83static OSErr fsspec_to_posix_pathname P_ ((const FSSpec *, char *, int)); 86static OSErr fsspec_to_posix_pathname P_ ((const FSSpec *, char *, int));
87#endif
84 88
85/* When converting from Mac to Unix pathnames, /'s in folder names are 89/* When converting from Mac to Unix pathnames, /'s in folder names are
86 converted to :'s. This function, used in copying folder names, 90 converted to :'s. This function, used in copying folder names,
@@ -1222,7 +1226,7 @@ parse_value (p)
1222 && '0' <= P[1] && P[1] <= '7' 1226 && '0' <= P[1] && P[1] <= '7'
1223 && '0' <= P[2] && P[2] <= '7') 1227 && '0' <= P[2] && P[2] <= '7')
1224 { 1228 {
1225 *q++ = (P[0] - '0' << 6) + (P[1] - '0' << 3) + (P[2] - '0'); 1229 *q++ = ((P[0] - '0') << 6) + ((P[1] - '0') << 3) + (P[2] - '0');
1226 P += 3; 1230 P += 3;
1227 } 1231 }
1228 else 1232 else
@@ -2789,7 +2793,7 @@ link (const char *name1, const char *name2)
2789/* Determine the path name of the file specified by VREFNUM, DIRID, 2793/* Determine the path name of the file specified by VREFNUM, DIRID,
2790 and NAME and place that in the buffer PATH of length 2794 and NAME and place that in the buffer PATH of length
2791 MAXPATHLEN. */ 2795 MAXPATHLEN. */
2792int 2796static int
2793path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num, 2797path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num,
2794 long dir_id, ConstStr255Param name) 2798 long dir_id, ConstStr255Param name)
2795{ 2799{
@@ -2834,6 +2838,8 @@ path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num,
2834} 2838}
2835 2839
2836 2840
2841#ifndef MAC_OSX
2842
2837static OSErr 2843static OSErr
2838posix_pathname_to_fsspec (ufn, fs) 2844posix_pathname_to_fsspec (ufn, fs)
2839 const char *ufn; 2845 const char *ufn;
@@ -2866,8 +2872,6 @@ fsspec_to_posix_pathname (fs, ufn, ufnbuflen)
2866 return fnfErr; 2872 return fnfErr;
2867} 2873}
2868 2874
2869#ifndef MAC_OSX
2870
2871int 2875int
2872readlink (const char *path, char *buf, int bufsiz) 2876readlink (const char *path, char *buf, int bufsiz)
2873{ 2877{
@@ -3124,8 +3128,7 @@ get_temp_dir_name ()
3124 short vol_ref_num; 3128 short vol_ref_num;
3125 long dir_id; 3129 long dir_id;
3126 OSErr err; 3130 OSErr err;
3127 Str255 dir_name, full_path; 3131 Str255 full_path;
3128 CInfoPBRec cpb;
3129 char unix_dir_name[MAXPATHLEN+1]; 3132 char unix_dir_name[MAXPATHLEN+1];
3130 DIR *dir; 3133 DIR *dir;
3131 3134
@@ -3217,8 +3220,7 @@ get_path_to_system_folder ()
3217 short vol_ref_num; 3220 short vol_ref_num;
3218 long dir_id; 3221 long dir_id;
3219 OSErr err; 3222 OSErr err;
3220 Str255 dir_name, full_path; 3223 Str255 full_path;
3221 CInfoPBRec cpb;
3222 static char system_folder_unix_name[MAXPATHLEN+1]; 3224 static char system_folder_unix_name[MAXPATHLEN+1];
3223 DIR *dir; 3225 DIR *dir;
3224 3226
@@ -3947,7 +3949,6 @@ DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1,
3947#else 3949#else
3948 FSSpec fss; 3950 FSSpec fss;
3949#endif 3951#endif
3950 OSType cCode;
3951 Lisp_Object result = Qnil; 3952 Lisp_Object result = Qnil;
3952 CHECK_STRING (filename); 3953 CHECK_STRING (filename);
3953 3954
@@ -4002,7 +4003,6 @@ DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0,
4002#else 4003#else
4003 FSSpec fss; 4004 FSSpec fss;
4004#endif 4005#endif
4005 OSType cCode;
4006 Lisp_Object result = Qnil; 4006 Lisp_Object result = Qnil;
4007 CHECK_STRING (filename); 4007 CHECK_STRING (filename);
4008 4008
@@ -4296,11 +4296,6 @@ Each type should be a string of length 4 or the symbol
4296 Lisp_Object result = Qnil; 4296 Lisp_Object result = Qnil;
4297 DescType src_desc_type, dst_desc_type; 4297 DescType src_desc_type, dst_desc_type;
4298 AEDesc dst_desc; 4298 AEDesc dst_desc;
4299#ifdef MAC_OSX
4300 FSRef fref;
4301#else
4302 FSSpec fs;
4303#endif
4304 4299
4305 CHECK_STRING (src_data); 4300 CHECK_STRING (src_data);
4306 if (EQ (src_type, Qundecoded_file_name)) 4301 if (EQ (src_type, Qundecoded_file_name))
@@ -4422,18 +4417,20 @@ otherwise. */)
4422 } 4417 }
4423 4418
4424 if (NILP (key)) 4419 if (NILP (key))
4425 if (EQ (format, Qxml)) 4420 {
4426 { 4421 if (EQ (format, Qxml))
4427 CFDataRef data = CFPropertyListCreateXMLData (NULL, plist); 4422 {
4428 if (data == NULL) 4423 CFDataRef data = CFPropertyListCreateXMLData (NULL, plist);
4429 goto out; 4424 if (data == NULL)
4430 result = cfdata_to_lisp (data); 4425 goto out;
4431 CFRelease (data); 4426 result = cfdata_to_lisp (data);
4432 } 4427 CFRelease (data);
4433 else 4428 }
4434 result = 4429 else
4435 cfproperty_list_to_lisp (plist, EQ (format, Qt), 4430 result =
4436 NILP (hash_bound) ? -1 : XINT (hash_bound)); 4431 cfproperty_list_to_lisp (plist, EQ (format, Qt),
4432 NILP (hash_bound) ? -1 : XINT (hash_bound));
4433 }
4437 4434
4438 out: 4435 out:
4439 if (app_plist) 4436 if (app_plist)
@@ -4701,7 +4698,6 @@ mac_get_system_locale ()
4701 4698
4702 4699
4703#ifdef MAC_OSX 4700#ifdef MAC_OSX
4704#undef select
4705 4701
4706extern int inhibit_window_system; 4702extern int inhibit_window_system;
4707extern int noninteractive; 4703extern int noninteractive;
diff --git a/src/macfns.c b/src/macfns.c
index a890a67b5a8..f4cfd61acb3 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -1024,7 +1024,7 @@ Lisp_Object
1024x_to_mac_color (colorname) 1024x_to_mac_color (colorname)
1025 char * colorname; 1025 char * colorname;
1026{ 1026{
1027 register Lisp_Object tail, ret = Qnil; 1027 register Lisp_Object ret = Qnil;
1028 1028
1029 BLOCK_INPUT; 1029 BLOCK_INPUT;
1030 1030
@@ -1359,7 +1359,6 @@ x_set_mouse_color (f, arg, oldval)
1359 Lisp_Object arg, oldval; 1359 Lisp_Object arg, oldval;
1360{ 1360{
1361 struct x_output *x = f->output_data.x; 1361 struct x_output *x = f->output_data.x;
1362 Display *dpy = FRAME_MAC_DISPLAY (f);
1363 Cursor cursor, nontext_cursor, mode_cursor, hand_cursor; 1362 Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
1364 Cursor hourglass_cursor, horizontal_drag_cursor; 1363 Cursor hourglass_cursor, horizontal_drag_cursor;
1365 unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f)); 1364 unsigned long pixel = x_decode_color (f, arg, BLACK_PIX_DEFAULT (f));
@@ -2387,7 +2386,6 @@ This function is an internal primitive--use `make-frame' instead. */)
2387 struct mac_display_info *dpyinfo = NULL; 2386 struct mac_display_info *dpyinfo = NULL;
2388 Lisp_Object parent; 2387 Lisp_Object parent;
2389 struct kboard *kb; 2388 struct kboard *kb;
2390 static int x_frame_count = 2; /* begins at 2 because terminal frame is F1 */
2391 2389
2392 check_mac (); 2390 check_mac ();
2393 2391
@@ -2910,23 +2908,25 @@ If omitted or nil, that stands for the selected frame's display. */)
2910 BLOCK_INPUT; 2908 BLOCK_INPUT;
2911 err = Gestalt (gestaltSystemVersion, &response); 2909 err = Gestalt (gestaltSystemVersion, &response);
2912 if (err == noErr) 2910 if (err == noErr)
2913 if (response >= 0x00001040) 2911 {
2914 { 2912 if (response >= 0x00001040)
2915 err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */ 2913 {
2916 if (err == noErr) 2914 err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */
2917 err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */ 2915 if (err == noErr)
2918 if (err == noErr) 2916 err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */
2919 err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */ 2917 if (err == noErr)
2920 } 2918 err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */
2921 else 2919 }
2922 { 2920 else
2923 bugfix = response & 0xf; 2921 {
2924 response >>= 4; 2922 bugfix = response & 0xf;
2925 minor = response & 0xf; 2923 response >>= 4;
2926 response >>= 4; 2924 minor = response & 0xf;
2927 /* convert BCD to int */ 2925 response >>= 4;
2928 major = response - (response >> 4) * 6; 2926 /* convert BCD to int */
2929 } 2927 major = response - (response >> 4) * 6;
2928 }
2929 }
2930 UNBLOCK_INPUT; 2930 UNBLOCK_INPUT;
2931 2931
2932 if (err != noErr) 2932 if (err != noErr)
@@ -3210,6 +3210,14 @@ DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
3210 return Qnil; 3210 return Qnil;
3211} 3211}
3212 3212
3213/* x_sync is a no-op on Mac. */
3214
3215void
3216x_sync (f)
3217 FRAME_PTR f;
3218{
3219}
3220
3213 3221
3214/*********************************************************************** 3222/***********************************************************************
3215 Window properties 3223 Window properties
@@ -4187,7 +4195,6 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4187 int count = SPECPDL_INDEX (); 4195 int count = SPECPDL_INDEX ();
4188 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; 4196 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
4189 char filename[MAXPATHLEN]; 4197 char filename[MAXPATHLEN];
4190 int default_filter_index = 1; /* 1: All Files, 2: Directories only */
4191 static NavEventUPP mac_nav_event_callbackUPP = NULL; 4198 static NavEventUPP mac_nav_event_callbackUPP = NULL;
4192 4199
4193 GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p); 4200 GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p);
diff --git a/src/macmenu.c b/src/macmenu.c
index 8610ecafd94..29233ec0d64 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -72,7 +72,7 @@ enum mac_menu_kind { /* Menu ID range */
72 MAC_MENU_END /* 32768 */ 72 MAC_MENU_END /* 32768 */
73}; 73};
74 74
75static const min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768}; 75static const int min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768};
76 76
77#define DIALOG_WINDOW_RESOURCE 130 77#define DIALOG_WINDOW_RESOURCE 130
78 78
diff --git a/src/macselect.c b/src/macselect.c
index 066892adce0..8312197181f 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -153,7 +153,6 @@ static ScrapFlavorType
153get_flavor_type_from_symbol (sym) 153get_flavor_type_from_symbol (sym)
154 Lisp_Object sym; 154 Lisp_Object sym;
155{ 155{
156 ScrapFlavorType val;
157 Lisp_Object str = Fget (sym, Qmac_ostype); 156 Lisp_Object str = Fget (sym, Qmac_ostype);
158 157
159 if (STRINGP (str) && SBYTES (str) == 4) 158 if (STRINGP (str) && SBYTES (str) == 4)
@@ -322,17 +321,19 @@ get_scrap_private_timestamp (scrap, timestamp)
322 321
323 err = GetScrapFlavorFlags (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &flags); 322 err = GetScrapFlavorFlags (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &flags);
324 if (err == noErr) 323 if (err == noErr)
325 if (!(flags & kScrapFlavorMaskSenderOnly)) 324 {
326 err = noTypeErr; 325 if (!(flags & kScrapFlavorMaskSenderOnly))
327 else 326 err = noTypeErr;
328 { 327 else
329 Size size = sizeof (*timestamp); 328 {
329 Size size = sizeof (*timestamp);
330 330
331 err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, 331 err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP,
332 &size, timestamp); 332 &size, timestamp);
333 if (err == noErr && size != sizeof (*timestamp)) 333 if (err == noErr && size != sizeof (*timestamp))
334 err = noTypeErr; 334 err = noTypeErr;
335 } 335 }
336 }
336#else /* !TARGET_API_MAC_CARBON */ 337#else /* !TARGET_API_MAC_CARBON */
337 Handle handle; 338 Handle handle;
338 SInt32 size, offset; 339 SInt32 size, offset;
@@ -683,18 +684,20 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
683 684
684 err = get_scrap_from_symbol (selection_symbol, 0, &scrap); 685 err = get_scrap_from_symbol (selection_symbol, 0, &scrap);
685 if (err == noErr && scrap) 686 if (err == noErr && scrap)
686 if (EQ (target_type, QTARGETS)) 687 {
687 { 688 if (EQ (target_type, QTARGETS))
688 result = get_scrap_target_type_list (scrap); 689 {
689 result = Fvconcat (1, &result); 690 result = get_scrap_target_type_list (scrap);
690 } 691 result = Fvconcat (1, &result);
691 else 692 }
692 { 693 else
693 result = get_scrap_string (scrap, target_type); 694 {
694 if (STRINGP (result)) 695 result = get_scrap_string (scrap, target_type);
695 Fput_text_property (make_number (0), make_number (SBYTES (result)), 696 if (STRINGP (result))
696 Qforeign_selection, target_type, result); 697 Fput_text_property (make_number (0), make_number (SBYTES (result)),
697 } 698 Qforeign_selection, target_type, result);
699 }
700 }
698 701
699 UNBLOCK_INPUT; 702 UNBLOCK_INPUT;
700 703
@@ -1009,7 +1012,7 @@ defer_apple_events (apple_event, reply)
1009 /* Mac OS 10.3 Xcode manual says AESuspendTheCurrentEvent makes 1012 /* Mac OS 10.3 Xcode manual says AESuspendTheCurrentEvent makes
1010 copies of the Apple event and the reply, but Mac OS 10.4 Xcode 1013 copies of the Apple event and the reply, but Mac OS 10.4 Xcode
1011 manual says it doesn't. Anyway we create copies of them and save 1014 manual says it doesn't. Anyway we create copies of them and save
1012 it in `deferred_apple_events'. */ 1015 them in `deferred_apple_events'. */
1013 if (err == noErr) 1016 if (err == noErr)
1014 { 1017 {
1015 if (deferred_apple_events.buf == NULL) 1018 if (deferred_apple_events.buf == NULL)
@@ -1123,11 +1126,8 @@ DEFUN ("mac-process-deferred-apple-events", Fmac_process_deferred_apple_events,
1123 doc: /* Process Apple events that are deferred at the startup time. */) 1126 doc: /* Process Apple events that are deferred at the startup time. */)
1124 () 1127 ()
1125{ 1128{
1126 OSErr err;
1127 Lisp_Object result = Qnil; 1129 Lisp_Object result = Qnil;
1128 long i, count; 1130 long i;
1129 AppleEvent apple_event, reply;
1130 AEKeyword keyword;
1131 1131
1132 if (mac_ready_for_apple_events) 1132 if (mac_ready_for_apple_events)
1133 return Qnil; 1133 return Qnil;
@@ -1207,14 +1207,16 @@ copy_scrap_flavor_data (from_scrap, to_scrap, flavor_type)
1207 break; 1207 break;
1208 } 1208 }
1209 if (err == noErr) 1209 if (err == noErr)
1210 if (buf == NULL) 1210 {
1211 err = memFullErr; 1211 if (buf == NULL)
1212 else 1212 err = memFullErr;
1213 { 1213 else
1214 err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone, 1214 {
1215 size, buf); 1215 err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone,
1216 xfree (buf); 1216 size, buf);
1217 } 1217 xfree (buf);
1218 }
1219 }
1218 1220
1219 return err; 1221 return err;
1220} 1222}
diff --git a/src/macterm.c b/src/macterm.c
index 472fe3d28c8..5c3787c2a51 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -77,7 +77,6 @@ Boston, MA 02110-1301, USA. */
77#include "termhooks.h" 77#include "termhooks.h"
78#include "termopts.h" 78#include "termopts.h"
79#include "termchar.h" 79#include "termchar.h"
80#include "gnu.h"
81#include "disptab.h" 80#include "disptab.h"
82#include "buffer.h" 81#include "buffer.h"
83#include "window.h" 82#include "window.h"
@@ -217,7 +216,6 @@ QDGlobals qd; /* QuickDraw global information structure. */
217 216
218struct mac_display_info *mac_display_info_for_display (Display *); 217struct mac_display_info *mac_display_info_for_display (Display *);
219static void x_update_window_end P_ ((struct window *, int, int)); 218static void x_update_window_end P_ ((struct window *, int, int));
220static int x_io_error_quitter P_ ((Display *));
221int x_catch_errors P_ ((Display *)); 219int x_catch_errors P_ ((Display *));
222void x_uncatch_errors P_ ((Display *, int)); 220void x_uncatch_errors P_ ((Display *, int));
223void x_lower_frame P_ ((struct frame *)); 221void x_lower_frame P_ ((struct frame *));
@@ -1699,14 +1697,6 @@ XSetWindowBackground (display, w, color)
1699#endif 1697#endif
1700} 1698}
1701 1699
1702/* x_sync is a no-op on Mac. */
1703void
1704x_sync (f)
1705 void *f;
1706{
1707}
1708
1709
1710/* Flush display of frame F, or of all frames if F is null. */ 1700/* Flush display of frame F, or of all frames if F is null. */
1711 1701
1712static void 1702static void
@@ -2082,7 +2072,6 @@ mac_define_fringe_bitmap (which, bits, h, wd)
2082 unsigned short *bits; 2072 unsigned short *bits;
2083 int h, wd; 2073 int h, wd;
2084{ 2074{
2085 unsigned short *mask_bits;
2086 int i; 2075 int i;
2087 CGDataProviderRef provider; 2076 CGDataProviderRef provider;
2088 2077
@@ -2368,7 +2357,6 @@ static void x_setup_relief_colors P_ ((struct glyph_string *));
2368static void x_draw_image_glyph_string P_ ((struct glyph_string *)); 2357static void x_draw_image_glyph_string P_ ((struct glyph_string *));
2369static void x_draw_image_relief P_ ((struct glyph_string *)); 2358static void x_draw_image_relief P_ ((struct glyph_string *));
2370static void x_draw_image_foreground P_ ((struct glyph_string *)); 2359static void x_draw_image_foreground P_ ((struct glyph_string *));
2371static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap));
2372static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int, 2360static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
2373 int, int, int)); 2361 int, int, int));
2374static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int, 2362static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int,
@@ -2569,34 +2557,36 @@ static void
2569mac_compute_glyph_string_overhangs (s) 2557mac_compute_glyph_string_overhangs (s)
2570 struct glyph_string *s; 2558 struct glyph_string *s;
2571{ 2559{
2572 if (s->cmp == NULL 2560 if (!(s->cmp == NULL
2573 && s->first_glyph->type == CHAR_GLYPH) 2561 && s->first_glyph->type == CHAR_GLYPH))
2574 if (!s->two_byte_p 2562 return;
2563
2564 if (!s->two_byte_p
2575#if USE_ATSUI 2565#if USE_ATSUI
2576 || s->font->mac_style 2566 || s->font->mac_style
2577#endif 2567#endif
2578 ) 2568 )
2579 { 2569 {
2580 XCharStruct cs; 2570 XCharStruct cs;
2581 2571
2582 mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs); 2572 mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs);
2583 s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0; 2573 s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0;
2584 s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0; 2574 s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0;
2585 } 2575 }
2586 else 2576 else
2587 { 2577 {
2588 Rect r; 2578 Rect r;
2589 MacFontStruct *font = s->font; 2579 MacFontStruct *font = s->font;
2590 2580
2591 TextFont (font->mac_fontnum); 2581 TextFont (font->mac_fontnum);
2592 TextSize (font->mac_fontsize); 2582 TextSize (font->mac_fontsize);
2593 TextFace (font->mac_fontface); 2583 TextFace (font->mac_fontface);
2594 2584
2595 QDTextBounds (s->nchars * 2, (char *)s->char2b, &r); 2585 QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
2596 2586
2597 s->right_overhang = r.right > s->width ? r.right - s->width : 0; 2587 s->right_overhang = r.right > s->width ? r.right - s->width : 0;
2598 s->left_overhang = r.left < 0 ? -r.left : 0; 2588 s->left_overhang = r.left < 0 ? -r.left : 0;
2599 } 2589 }
2600} 2590}
2601 2591
2602 2592
@@ -3432,7 +3422,6 @@ x_draw_image_glyph_string (s)
3432 int box_line_hwidth = abs (s->face->box_line_width); 3422 int box_line_hwidth = abs (s->face->box_line_width);
3433 int box_line_vwidth = max (s->face->box_line_width, 0); 3423 int box_line_vwidth = max (s->face->box_line_width, 0);
3434 int height; 3424 int height;
3435 Pixmap pixmap = 0;
3436 3425
3437 height = s->height - 2 * box_line_vwidth; 3426 height = s->height - 2 * box_line_vwidth;
3438 3427
@@ -4178,142 +4167,6 @@ x_frame_rehighlight (dpyinfo)
4178 4167
4179 4168
4180 4169
4181/* Keyboard processing - modifier keys, vendor-specific keysyms, etc. */
4182
4183#if 0 /* MAC_TODO */
4184/* Initialize mode_switch_bit and modifier_meaning. */
4185static void
4186x_find_modifier_meanings (dpyinfo)
4187 struct x_display_info *dpyinfo;
4188{
4189 int min_code, max_code;
4190 KeySym *syms;
4191 int syms_per_code;
4192 XModifierKeymap *mods;
4193
4194 dpyinfo->meta_mod_mask = 0;
4195 dpyinfo->shift_lock_mask = 0;
4196 dpyinfo->alt_mod_mask = 0;
4197 dpyinfo->super_mod_mask = 0;
4198 dpyinfo->hyper_mod_mask = 0;
4199
4200#ifdef HAVE_X11R4
4201 XDisplayKeycodes (dpyinfo->display, &min_code, &max_code);
4202#else
4203 min_code = dpyinfo->display->min_keycode;
4204 max_code = dpyinfo->display->max_keycode;
4205#endif
4206
4207 syms = XGetKeyboardMapping (dpyinfo->display,
4208 min_code, max_code - min_code + 1,
4209 &syms_per_code);
4210 mods = XGetModifierMapping (dpyinfo->display);
4211
4212 /* Scan the modifier table to see which modifier bits the Meta and
4213 Alt keysyms are on. */
4214 {
4215 int row, col; /* The row and column in the modifier table. */
4216
4217 for (row = 3; row < 8; row++)
4218 for (col = 0; col < mods->max_keypermod; col++)
4219 {
4220 KeyCode code
4221 = mods->modifiermap[(row * mods->max_keypermod) + col];
4222
4223 /* Zeroes are used for filler. Skip them. */
4224 if (code == 0)
4225 continue;
4226
4227 /* Are any of this keycode's keysyms a meta key? */
4228 {
4229 int code_col;
4230
4231 for (code_col = 0; code_col < syms_per_code; code_col++)
4232 {
4233 int sym = syms[((code - min_code) * syms_per_code) + code_col];
4234
4235 switch (sym)
4236 {
4237 case XK_Meta_L:
4238 case XK_Meta_R:
4239 dpyinfo->meta_mod_mask |= (1 << row);
4240 break;
4241
4242 case XK_Alt_L:
4243 case XK_Alt_R:
4244 dpyinfo->alt_mod_mask |= (1 << row);
4245 break;
4246
4247 case XK_Hyper_L:
4248 case XK_Hyper_R:
4249 dpyinfo->hyper_mod_mask |= (1 << row);
4250 break;
4251
4252 case XK_Super_L:
4253 case XK_Super_R:
4254 dpyinfo->super_mod_mask |= (1 << row);
4255 break;
4256
4257 case XK_Shift_Lock:
4258 /* Ignore this if it's not on the lock modifier. */
4259 if ((1 << row) == LockMask)
4260 dpyinfo->shift_lock_mask = LockMask;
4261 break;
4262 }
4263 }
4264 }
4265 }
4266 }
4267
4268 /* If we couldn't find any meta keys, accept any alt keys as meta keys. */
4269 if (! dpyinfo->meta_mod_mask)
4270 {
4271 dpyinfo->meta_mod_mask = dpyinfo->alt_mod_mask;
4272 dpyinfo->alt_mod_mask = 0;
4273 }
4274
4275 /* If some keys are both alt and meta,
4276 make them just meta, not alt. */
4277 if (dpyinfo->alt_mod_mask & dpyinfo->meta_mod_mask)
4278 {
4279 dpyinfo->alt_mod_mask &= ~dpyinfo->meta_mod_mask;
4280 }
4281
4282 XFree ((char *) syms);
4283 XFreeModifiermap (mods);
4284}
4285
4286#endif /* MAC_TODO */
4287
4288/* Convert between the modifier bits X uses and the modifier bits
4289 Emacs uses. */
4290
4291static unsigned int
4292x_mac_to_emacs_modifiers (dpyinfo, state)
4293 struct x_display_info *dpyinfo;
4294 unsigned short state;
4295{
4296 return (((state & shiftKey) ? shift_modifier : 0)
4297 | ((state & controlKey) ? ctrl_modifier : 0)
4298 | ((state & cmdKey) ? meta_modifier : 0)
4299 | ((state & optionKey) ? alt_modifier : 0));
4300}
4301
4302#if 0 /* MAC_TODO */
4303static unsigned short
4304x_emacs_to_x_modifiers (dpyinfo, state)
4305 struct x_display_info *dpyinfo;
4306 unsigned int state;
4307{
4308 return ( ((state & alt_modifier) ? dpyinfo->alt_mod_mask : 0)
4309 | ((state & super_modifier) ? dpyinfo->super_mod_mask : 0)
4310 | ((state & hyper_modifier) ? dpyinfo->hyper_mod_mask : 0)
4311 | ((state & shift_modifier) ? ShiftMask : 0)
4312 | ((state & ctrl_modifier) ? ControlMask : 0)
4313 | ((state & meta_modifier) ? dpyinfo->meta_mod_mask : 0));
4314}
4315#endif /* MAC_TODO */
4316
4317/* Convert a keysym to its name. */ 4170/* Convert a keysym to its name. */
4318 4171
4319char * 4172char *
@@ -5104,41 +4957,43 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
5104 4957
5105#ifdef USE_TOOLKIT_SCROLL_BARS 4958#ifdef USE_TOOLKIT_SCROLL_BARS
5106 if (NILP (bar->track_top)) 4959 if (NILP (bar->track_top))
5107 if (sb_width >= disp_height) 4960 {
5108 { 4961 if (sb_width >= disp_height)
5109 XSETINT (bar->track_top, 0); 4962 {
5110 XSETINT (bar->track_height, 0); 4963 XSETINT (bar->track_top, 0);
5111 } 4964 XSETINT (bar->track_height, 0);
5112 else 4965 }
5113 { 4966 else
5114 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar); 4967 {
5115 Rect r0, r1; 4968 ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
4969 Rect r0, r1;
5116 4970
5117 BLOCK_INPUT; 4971 BLOCK_INPUT;
5118 4972
5119 SetControl32BitMinimum (ch, 0); 4973 SetControl32BitMinimum (ch, 0);
5120 SetControl32BitMaximum (ch, 1); 4974 SetControl32BitMaximum (ch, 1);
5121 SetControlViewSize (ch, 1); 4975 SetControlViewSize (ch, 1);
5122 4976
5123 /* Move the scroll bar thumb to the top. */ 4977 /* Move the scroll bar thumb to the top. */
5124 SetControl32BitValue (ch, 0); 4978 SetControl32BitValue (ch, 0);
5125 get_control_part_bounds (ch, kControlIndicatorPart, &r0); 4979 get_control_part_bounds (ch, kControlIndicatorPart, &r0);
5126 4980
5127 /* Move the scroll bar thumb to the bottom. */ 4981 /* Move the scroll bar thumb to the bottom. */
5128 SetControl32BitValue (ch, 1); 4982 SetControl32BitValue (ch, 1);
5129 get_control_part_bounds (ch, kControlIndicatorPart, &r1); 4983 get_control_part_bounds (ch, kControlIndicatorPart, &r1);
5130 4984
5131 UnionRect (&r0, &r1, &r0); 4985 UnionRect (&r0, &r1, &r0);
5132 XSETINT (bar->track_top, r0.top); 4986 XSETINT (bar->track_top, r0.top);
5133 XSETINT (bar->track_height, r0.bottom - r0.top); 4987 XSETINT (bar->track_height, r0.bottom - r0.top);
5134 4988
5135 /* Don't show the scroll bar if its height is not enough to 4989 /* Don't show the scroll bar if its height is not enough to
5136 display the scroll bar thumb. */ 4990 display the scroll bar thumb. */
5137 if (r0.bottom - r0.top > 0) 4991 if (r0.bottom - r0.top > 0)
5138 ShowControl (ch); 4992 ShowControl (ch);
5139 4993
5140 UNBLOCK_INPUT; 4994 UNBLOCK_INPUT;
5141 } 4995 }
4996 }
5142 4997
5143 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); 4998 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
5144#else /* not USE_TOOLKIT_SCROLL_BARS */ 4999#else /* not USE_TOOLKIT_SCROLL_BARS */
@@ -6224,10 +6079,12 @@ mac_handle_visibility_change (f)
6224 struct input_event buf; 6079 struct input_event buf;
6225 6080
6226 if (IsWindowVisible (wp)) 6081 if (IsWindowVisible (wp))
6227 if (IsWindowCollapsed (wp)) 6082 {
6228 iconified = 1; 6083 if (IsWindowCollapsed (wp))
6229 else 6084 iconified = 1;
6230 visible = 1; 6085 else
6086 visible = 1;
6087 }
6231 6088
6232 if (!f->async_visible && visible) 6089 if (!f->async_visible && visible)
6233 { 6090 {
@@ -6273,9 +6130,6 @@ void
6273x_make_frame_visible (f) 6130x_make_frame_visible (f)
6274 struct frame *f; 6131 struct frame *f;
6275{ 6132{
6276 Lisp_Object type;
6277 int original_top, original_left;
6278
6279 BLOCK_INPUT; 6133 BLOCK_INPUT;
6280 6134
6281 if (! FRAME_VISIBLE_P (f)) 6135 if (! FRAME_VISIBLE_P (f))
@@ -6286,27 +6140,29 @@ x_make_frame_visible (f)
6286 before the window gets really visible. */ 6140 before the window gets really visible. */
6287 if (! FRAME_ICONIFIED_P (f) 6141 if (! FRAME_ICONIFIED_P (f)
6288 && ! f->output_data.mac->asked_for_visible) 6142 && ! f->output_data.mac->asked_for_visible)
6143 {
6289#if TARGET_API_MAC_CARBON 6144#if TARGET_API_MAC_CARBON
6290 if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition))) 6145 if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition)))
6291 { 6146 {
6292 struct frame *sf = SELECTED_FRAME (); 6147 struct frame *sf = SELECTED_FRAME ();
6293 if (!FRAME_MAC_P (sf)) 6148 if (!FRAME_MAC_P (sf))
6294 RepositionWindow (FRAME_MAC_WINDOW (f), NULL, 6149 RepositionWindow (FRAME_MAC_WINDOW (f), NULL,
6295 kWindowCenterOnMainScreen); 6150 kWindowCenterOnMainScreen);
6296 else 6151 else
6297 RepositionWindow (FRAME_MAC_WINDOW (f), 6152 RepositionWindow (FRAME_MAC_WINDOW (f),
6298 FRAME_MAC_WINDOW (sf), 6153 FRAME_MAC_WINDOW (sf),
6299#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020 6154#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
6300 kWindowCascadeStartAtParentWindowScreen 6155 kWindowCascadeStartAtParentWindowScreen
6301#else 6156#else
6302 kWindowCascadeOnParentWindowScreen 6157 kWindowCascadeOnParentWindowScreen
6303#endif 6158#endif
6304 ); 6159 );
6305 x_real_positions (f, &f->left_pos, &f->top_pos); 6160 x_real_positions (f, &f->left_pos, &f->top_pos);
6306 } 6161 }
6307 else 6162 else
6308#endif 6163#endif
6309 x_set_offset (f, f->left_pos, f->top_pos, 0); 6164 x_set_offset (f, f->left_pos, f->top_pos, 0);
6165 }
6310 6166
6311 f->output_data.mac->asked_for_visible = 1; 6167 f->output_data.mac->asked_for_visible = 1;
6312 6168
@@ -6749,15 +6605,17 @@ xlfdpat_create (pattern)
6749 else 6605 else
6750 { 6606 {
6751 if (last_char == '?') 6607 if (last_char == '?')
6752 if (anychar_head > pat->buf && *(anychar_head - 1) == '*') 6608 {
6753 /* ...*??* -> ...*?? */ 6609 if (anychar_head > pat->buf && *(anychar_head - 1) == '*')
6754 continue; 6610 /* ...*??* -> ...*?? */
6755 else 6611 continue;
6756 /* ...a??* -> ...a*?? */ 6612 else
6757 { 6613 /* ...a??* -> ...a*?? */
6758 *anychar_head++ = '*'; 6614 {
6759 c = '?'; 6615 *anychar_head++ = '*';
6760 } 6616 c = '?';
6617 }
6618 }
6761 nblocks++; 6619 nblocks++;
6762 } 6620 }
6763 else if (c == '?') 6621 else if (c == '?')
@@ -7588,7 +7446,7 @@ mac_do_list_fonts (pattern, maxnames)
7588 if (xlfdpat_match (pat, font_name_table[i])) 7446 if (xlfdpat_match (pat, font_name_table[i]))
7589 { 7447 {
7590 font_list = Fcons (build_string (font_name_table[i]), font_list); 7448 font_list = Fcons (build_string (font_name_table[i]), font_list);
7591 if (exact || maxnames > 0 && ++n_fonts >= maxnames) 7449 if (exact || (maxnames > 0 && ++n_fonts >= maxnames))
7592 break; 7450 break;
7593 } 7451 }
7594 else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0 7452 else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0
@@ -7611,7 +7469,7 @@ mac_do_list_fonts (pattern, maxnames)
7611 { 7469 {
7612 font_list = Fcons (build_string (scaled), font_list); 7470 font_list = Fcons (build_string (scaled), font_list);
7613 xfree (scaled); 7471 xfree (scaled);
7614 if (exact || maxnames > 0 && ++n_fonts >= maxnames) 7472 if (exact || (maxnames > 0 && ++n_fonts >= maxnames))
7615 break; 7473 break;
7616 } 7474 }
7617 else 7475 else
@@ -8260,10 +8118,8 @@ x_load_font (f, fontname, size)
8260 8118
8261 /* Load the font and add it to the table. */ 8119 /* Load the font and add it to the table. */
8262 { 8120 {
8263 char *full_name;
8264 struct MacFontStruct *font; 8121 struct MacFontStruct *font;
8265 struct font_info *fontp; 8122 struct font_info *fontp;
8266 unsigned long value;
8267 int i; 8123 int i;
8268 8124
8269 fontname = (char *) SDATA (XCAR (font_names)); 8125 fontname = (char *) SDATA (XCAR (font_names));
@@ -8777,6 +8633,7 @@ static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec)
8777 8633
8778#endif 8634#endif
8779 8635
8636#ifdef MAC_OS8
8780static void 8637static void
8781do_get_menus (void) 8638do_get_menus (void)
8782{ 8639{
@@ -8838,6 +8695,7 @@ do_check_ram_size (void)
8838 exit (1); 8695 exit (1);
8839 } 8696 }
8840} 8697}
8698#endif /* MAC_OS8 */
8841 8699
8842static void 8700static void
8843do_window_update (WindowPtr win) 8701do_window_update (WindowPtr win)
@@ -9019,42 +8877,41 @@ do_grow_window (WindowPtr w, EventRecord *e)
9019static void 8877static void
9020do_zoom_window (WindowPtr w, int zoom_in_or_out) 8878do_zoom_window (WindowPtr w, int zoom_in_or_out)
9021{ 8879{
9022 GrafPtr save_port;
9023 Rect zoom_rect, port_rect; 8880 Rect zoom_rect, port_rect;
9024 Point top_left; 8881 int columns, rows, width, height;
9025 int w_title_height, columns, rows, width, height;
9026 struct frame *f = mac_window_to_frame (w); 8882 struct frame *f = mac_window_to_frame (w);
9027 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); 8883 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
9028
9029#if TARGET_API_MAC_CARBON 8884#if TARGET_API_MAC_CARBON
9030 { 8885 Point standard_size;
9031 Point standard_size;
9032 8886
9033 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); 8887 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
9034 standard_size.v = dpyinfo->height; 8888 standard_size.v = dpyinfo->height;
9035 8889
9036 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)) 8890 if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
9037 zoom_in_or_out = inZoomIn; 8891 zoom_in_or_out = inZoomIn;
9038 else 8892 else
9039 { 8893 {
9040 /* Adjust the standard size according to character boundaries. */ 8894 /* Adjust the standard size according to character boundaries. */
9041
9042 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
9043 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
9044 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
9045 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
9046 GetWindowBounds (w, kWindowContentRgn, &port_rect);
9047 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
9048 && port_rect.left == zoom_rect.left
9049 && port_rect.top == zoom_rect.top)
9050 zoom_in_or_out = inZoomIn;
9051 else
9052 zoom_in_or_out = inZoomOut;
9053 }
9054 8895
9055 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size); 8896 columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
9056 } 8897 rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
8898 standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
8899 standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
8900 GetWindowBounds (w, kWindowContentRgn, &port_rect);
8901 if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
8902 && port_rect.left == zoom_rect.left
8903 && port_rect.top == zoom_rect.top)
8904 zoom_in_or_out = inZoomIn;
8905 else
8906 zoom_in_or_out = inZoomOut;
8907 }
8908
8909 ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
9057#else /* not TARGET_API_MAC_CARBON */ 8910#else /* not TARGET_API_MAC_CARBON */
8911 GrafPtr save_port;
8912 Point top_left;
8913 int w_title_height;
8914
9058 GetPort (&save_port); 8915 GetPort (&save_port);
9059 8916
9060 SetPortWindowPort (w); 8917 SetPortWindowPort (w);
@@ -9189,26 +9046,27 @@ mac_handle_command_event (next_handler, event, data)
9189 mac_find_apple_event_spec (0, command.commandID, 9046 mac_find_apple_event_spec (0, command.commandID,
9190 &class_key, &id_key, &binding); 9047 &class_key, &id_key, &binding);
9191 if (!NILP (binding) && !EQ (binding, Qundefined)) 9048 if (!NILP (binding) && !EQ (binding, Qundefined))
9192 if (INTEGERP (binding)) 9049 {
9193 return XINT (binding); 9050 if (INTEGERP (binding))
9194 else 9051 return XINT (binding);
9195 { 9052 else
9196 AppleEvent apple_event; 9053 {
9197 UInt32 modifiers; 9054 AppleEvent apple_event;
9198 static EventParamName names[] = {kEventParamDirectObject, 9055 static EventParamName names[] = {kEventParamDirectObject,
9199 kEventParamKeyModifiers}; 9056 kEventParamKeyModifiers};
9200 static EventParamType types[] = {typeHICommand, 9057 static EventParamType types[] = {typeHICommand,
9201 typeUInt32}; 9058 typeUInt32};
9202 err = create_apple_event_from_event_ref (event, 2, names, types, 9059 err = create_apple_event_from_event_ref (event, 2, names, types,
9203 &apple_event); 9060 &apple_event);
9204 if (err == noErr) 9061 if (err == noErr)
9205 { 9062 {
9206 err = mac_store_apple_event (class_key, id_key, &apple_event); 9063 err = mac_store_apple_event (class_key, id_key, &apple_event);
9207 AEDisposeDesc (&apple_event); 9064 AEDisposeDesc (&apple_event);
9208 } 9065 }
9209 if (err == noErr) 9066 if (err == noErr)
9210 return noErr; 9067 return noErr;
9211 } 9068 }
9069 }
9212 9070
9213 return eventNotHandledErr; 9071 return eventNotHandledErr;
9214} 9072}
@@ -9216,7 +9074,6 @@ mac_handle_command_event (next_handler, event, data)
9216static OSErr 9074static OSErr
9217init_command_handler () 9075init_command_handler ()
9218{ 9076{
9219 OSErr err = noErr;
9220 EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}}; 9077 EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}};
9221 static EventHandlerUPP handle_command_eventUPP = NULL; 9078 static EventHandlerUPP handle_command_eventUPP = NULL;
9222 9079
@@ -10092,18 +9949,18 @@ XTread_socket (sd, expected, hold_quit)
10092 XSETINT (inev.x, mouse_loc.h); 9949 XSETINT (inev.x, mouse_loc.h);
10093 XSETINT (inev.y, mouse_loc.v); 9950 XSETINT (inev.y, mouse_loc.v);
10094 9951
10095 if (dpyinfo->grabbed && tracked_scroll_bar 9952 if ((dpyinfo->grabbed && tracked_scroll_bar)
10096 || ch != 0 9953 || (ch != 0
10097#ifndef USE_TOOLKIT_SCROLL_BARS 9954#ifndef USE_TOOLKIT_SCROLL_BARS
10098 /* control_part_code becomes kControlNoPart if 9955 /* control_part_code becomes kControlNoPart if
10099 a progress indicator is clicked. */ 9956 a progress indicator is clicked. */
10100 && control_part_code != kControlNoPart 9957 && control_part_code != kControlNoPart
10101#else /* USE_TOOLKIT_SCROLL_BARS */ 9958#else /* USE_TOOLKIT_SCROLL_BARS */
10102#ifdef MAC_OSX 9959#ifdef MAC_OSX
10103 && control_kind.kind == kControlKindScrollBar 9960 && control_kind.kind == kControlKindScrollBar
10104#endif /* MAC_OSX */ 9961#endif /* MAC_OSX */
10105#endif /* USE_TOOLKIT_SCROLL_BARS */ 9962#endif /* USE_TOOLKIT_SCROLL_BARS */
10106 ) 9963 ))
10107 { 9964 {
10108 struct scroll_bar *bar; 9965 struct scroll_bar *bar;
10109 9966
@@ -10903,7 +10760,6 @@ mac_check_bundle()
10903 extern int inhibit_window_system; 10760 extern int inhibit_window_system;
10904 extern int noninteractive; 10761 extern int noninteractive;
10905 CFBundleRef appsBundle; 10762 CFBundleRef appsBundle;
10906 pid_t child;
10907 10763
10908 /* No need to test if already -nw*/ 10764 /* No need to test if already -nw*/
10909 if (inhibit_window_system || noninteractive) 10765 if (inhibit_window_system || noninteractive)
diff --git a/src/macterm.h b/src/macterm.h
index 872a4b60199..e35f04a6ba6 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -550,7 +550,15 @@ extern int XParseGeometry P_ ((char *, int *, int *, unsigned int *,
550/* Defined in macterm.c. */ 550/* Defined in macterm.c. */
551 551
552extern void x_set_window_size P_ ((struct frame *, int, int, int)); 552extern void x_set_window_size P_ ((struct frame *, int, int, int));
553extern void x_set_mouse_position P_ ((struct frame *, int, int));
554extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));
553extern void x_make_frame_visible P_ ((struct frame *)); 555extern void x_make_frame_visible P_ ((struct frame *));
556extern void x_make_frame_invisible P_ ((struct frame *));
557extern void x_iconify_frame P_ ((struct frame *));
558extern void x_free_frame_resources P_ ((struct frame *));
559extern void x_destroy_window P_ ((struct frame *));
560extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
561extern void x_delete_display P_ ((struct x_display_info *));
554extern void mac_initialize P_ ((void)); 562extern void mac_initialize P_ ((void));
555extern Pixmap XCreatePixmap P_ ((Display *, WindowPtr, unsigned int, 563extern Pixmap XCreatePixmap P_ ((Display *, WindowPtr, unsigned int,
556 unsigned int, unsigned int)); 564 unsigned int, unsigned int));
@@ -560,6 +568,7 @@ extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowPtr, char *,
560 unsigned int)); 568 unsigned int));
561extern void XFreePixmap P_ ((Display *, Pixmap)); 569extern void XFreePixmap P_ ((Display *, Pixmap));
562extern GC XCreateGC P_ ((Display *, Window, unsigned long, XGCValues *)); 570extern GC XCreateGC P_ ((Display *, Window, unsigned long, XGCValues *));
571extern void XFreeGC P_ ((Display *, GC));
563extern void XSetForeground P_ ((Display *, GC, unsigned long)); 572extern void XSetForeground P_ ((Display *, GC, unsigned long));
564extern void XSetBackground P_ ((Display *, GC, unsigned long)); 573extern void XSetBackground P_ ((Display *, GC, unsigned long));
565extern void XSetWindowBackground P_ ((Display *, WindowPtr, unsigned long)); 574extern void XSetWindowBackground P_ ((Display *, WindowPtr, unsigned long));
@@ -571,6 +580,7 @@ extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *));
571extern OSErr install_window_handler P_ ((WindowPtr)); 580extern OSErr install_window_handler P_ ((WindowPtr));
572extern void remove_window_handler P_ ((WindowPtr)); 581extern void remove_window_handler P_ ((WindowPtr));
573extern Lisp_Object mac_make_lispy_event_code P_ ((int)); 582extern Lisp_Object mac_make_lispy_event_code P_ ((int));
583extern void do_menu_choice P_ ((SInt32));
574#if USE_CG_DRAWING 584#if USE_CG_DRAWING
575extern void mac_prepare_for_quickdraw P_ ((struct frame *)); 585extern void mac_prepare_for_quickdraw P_ ((struct frame *));
576#endif 586#endif
@@ -584,6 +594,24 @@ extern void mac_prepare_for_quickdraw P_ ((struct frame *));
584 594
585extern void x_clear_frame_selections P_ ((struct frame *)); 595extern void x_clear_frame_selections P_ ((struct frame *));
586 596
597/* Defined in macfns.c */
598
599extern int have_menus_p P_ ((void));
600
601extern void x_real_positions P_ ((struct frame *, int *, int *));
602extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
603extern int x_pixel_width P_ ((struct frame *));
604extern int x_pixel_height P_ ((struct frame *));
605extern int x_char_width P_ ((struct frame *));
606extern int x_char_height P_ ((struct frame *));
607extern void x_sync P_ ((struct frame *));
608extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
609
610/* Defined in macmenu.c */
611
612extern void x_activate_menubar P_ ((struct frame *));
613extern void free_frame_menubar P_ ((struct frame *));
614
587/* Defined in mac.c. */ 615/* Defined in mac.c. */
588 616
589extern void mac_clear_font_name_table P_ ((void)); 617extern void mac_clear_font_name_table P_ ((void));
diff --git a/src/print.c b/src/print.c
index cb3378dd2b1..0eb82b663d6 100644
--- a/src/print.c
+++ b/src/print.c
@@ -759,7 +759,8 @@ DEFUN ("prin1-to-string", Fprin1_to_string, Sprin1_to_string, 1, 2, 0,
759 doc: /* Return a string containing the printed representation of OBJECT. 759 doc: /* Return a string containing the printed representation of OBJECT.
760OBJECT can be any Lisp object. This function outputs quoting characters 760OBJECT can be any Lisp object. This function outputs quoting characters
761when necessary to make output that `read' can handle, whenever possible, 761when necessary to make output that `read' can handle, whenever possible,
762unless the optional second argument NOESCAPE is non-nil. 762unless the optional second argument NOESCAPE is non-nil. For complex objects,
763the behavior is controlled by `print-level' and `print-length', which see.
763 764
764OBJECT is any of the Lisp data types: a number, a string, a symbol, 765OBJECT is any of the Lisp data types: a number, a string, a symbol,
765a list, a buffer, a window, a frame, etc. 766a list, a buffer, a window, a frame, etc.
diff --git a/src/process.c b/src/process.c
index eab9daa6bdd..8e4a0d22160 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2323,7 +2323,11 @@ get_lisp_to_sockaddr_size (address, familyp)
2323} 2323}
2324 2324
2325/* Convert an address object (vector or string) to an internal sockaddr. 2325/* Convert an address object (vector or string) to an internal sockaddr.
2326 Format of address has already been validated by size_lisp_to_sockaddr. */ 2326
2327 The address format has been basically validated by
2328 get_lisp_to_sockaddr_size, but this does not mean FAMILY is valid;
2329 it could have come from user data. So if FAMILY is not valid,
2330 we return after zeroing *SA. */
2327 2331
2328static void 2332static void
2329conv_lisp_to_sockaddr (family, address, sa, len) 2333conv_lisp_to_sockaddr (family, address, sa, len)
@@ -2337,7 +2341,6 @@ conv_lisp_to_sockaddr (family, address, sa, len)
2337 register int i; 2341 register int i;
2338 2342
2339 bzero (sa, len); 2343 bzero (sa, len);
2340 sa->sa_family = family;
2341 2344
2342 if (VECTORP (address)) 2345 if (VECTORP (address))
2343 { 2346 {
@@ -2349,6 +2352,7 @@ conv_lisp_to_sockaddr (family, address, sa, len)
2349 i = XINT (p->contents[--len]); 2352 i = XINT (p->contents[--len]);
2350 sin->sin_port = htons (i); 2353 sin->sin_port = htons (i);
2351 cp = (unsigned char *)&sin->sin_addr; 2354 cp = (unsigned char *)&sin->sin_addr;
2355 sa->sa_family = family;
2352 } 2356 }
2353#ifdef AF_INET6 2357#ifdef AF_INET6
2354 else if (family == AF_INET6) 2358 else if (family == AF_INET6)
@@ -2364,9 +2368,10 @@ conv_lisp_to_sockaddr (family, address, sa, len)
2364 int j = XFASTINT (p->contents[i]) & 0xffff; 2368 int j = XFASTINT (p->contents[i]) & 0xffff;
2365 ip6[i] = ntohs (j); 2369 ip6[i] = ntohs (j);
2366 } 2370 }
2367 return; 2371 sa->sa_family = family;
2368 } 2372 }
2369#endif 2373#endif
2374 return;
2370 } 2375 }
2371 else if (STRINGP (address)) 2376 else if (STRINGP (address))
2372 { 2377 {
@@ -2377,6 +2382,7 @@ conv_lisp_to_sockaddr (family, address, sa, len)
2377 cp = SDATA (address); 2382 cp = SDATA (address);
2378 for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++) 2383 for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++)
2379 sockun->sun_path[i] = *cp++; 2384 sockun->sun_path[i] = *cp++;
2385 sa->sa_family = family;
2380 } 2386 }
2381#endif 2387#endif
2382 return; 2388 return;
@@ -6229,6 +6235,8 @@ text to PROCESS after you call this function. */)
6229 emacs_close (XINT (XPROCESS (proc)->outfd)); 6235 emacs_close (XINT (XPROCESS (proc)->outfd));
6230#endif /* not HAVE_SHUTDOWN */ 6236#endif /* not HAVE_SHUTDOWN */
6231 new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0); 6237 new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0);
6238 if (new_outfd < 0)
6239 abort ();
6232 old_outfd = XINT (XPROCESS (proc)->outfd); 6240 old_outfd = XINT (XPROCESS (proc)->outfd);
6233 6241
6234 if (!proc_encode_coding_system[new_outfd]) 6242 if (!proc_encode_coding_system[new_outfd])
diff --git a/src/puresize.h b/src/puresize.h
index 93dac70c123..fa73736bc43 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -49,7 +49,7 @@ Boston, MA 02110-1301, USA. */
49/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */ 49/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */
50#ifndef PURESIZE_RATIO 50#ifndef PURESIZE_RATIO
51#if BITS_PER_EMACS_INT > 32 51#if BITS_PER_EMACS_INT > 32
52#define PURESIZE_RATIO 9/5 /* Don't surround with `()'. */ 52#define PURESIZE_RATIO 10/6 /* Don't surround with `()'. */
53#else 53#else
54#define PURESIZE_RATIO 1 54#define PURESIZE_RATIO 1
55#endif 55#endif
@@ -65,7 +65,7 @@ Boston, MA 02110-1301, USA. */
65 { if (PURE_P (obj)) \ 65 { if (PURE_P (obj)) \
66 pure_write_error (); } 66 pure_write_error (); }
67 67
68extern void pure_write_error P_ ((void)); 68extern void pure_write_error P_ ((void)) NO_RETURN;
69 69
70/* Define PURE_P. */ 70/* Define PURE_P. */
71 71
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 5c6d1d07c20..55f62644d04 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -365,6 +365,9 @@ Boston, MA 02110-1301, USA. */
365#define ftruncate _chsize 365#define ftruncate _chsize
366#define getw _getw 366#define getw _getw
367#define getpid _getpid 367#define getpid _getpid
368#ifdef _MSC_VER
369typedef int pid_t;
370#endif
368#define isatty _isatty 371#define isatty _isatty
369#define logb _logb 372#define logb _logb
370#define _longjmp longjmp 373#define _longjmp longjmp
@@ -462,8 +465,10 @@ extern char *get_emacs_configuration_options (void);
462#endif 465#endif
463#include <string.h> 466#include <string.h>
464 467
465/* We need a little extra space, see ../../lisp/loadup.el */ 468/* We need a little extra space, see ../../lisp/loadup.el.
466#define SYSTEM_PURESIZE_EXTRA 137500 469 The number below comes from 22038 bytes worth (as of 2006-04)
470 of w32-specific files loaded by loadup.el, plus 2K spare. */
471#define SYSTEM_PURESIZE_EXTRA 24000
467 472
468/* For unexec to work on Alpha systems, we need to put Emacs' 473/* For unexec to work on Alpha systems, we need to put Emacs'
469 initialized data into a separate section from the CRT initialized 474 initialized data into a separate section from the CRT initialized
diff --git a/src/search.c b/src/search.c
index dfde3280240..f613630eaf9 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1699,7 +1699,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
1699 ch = -1; 1699 ch = -1;
1700 } 1700 }
1701 1701
1702 if (ch > 0400) 1702 if (ch >= 0400)
1703 j = (ch & 0x3F) | 0200; 1703 j = (ch & 0x3F) | 0200;
1704 else 1704 else
1705 j = *ptr; 1705 j = *ptr;
@@ -1718,7 +1718,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt,
1718 while (1) 1718 while (1)
1719 { 1719 {
1720 TRANSLATE (ch, inverse_trt, ch); 1720 TRANSLATE (ch, inverse_trt, ch);
1721 if (ch > 0400) 1721 if (ch >= 0400)
1722 j = (ch & 0x3F) | 0200; 1722 j = (ch & 0x3F) | 0200;
1723 else 1723 else
1724 j = ch; 1724 j = ch;
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index db77a83cee2..4ca0be829a2 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -100,7 +100,11 @@ Boston, MA 02110-1301, USA. */
100#if defined (__ppc__) 100#if defined (__ppc__)
101#include <mach-o/ppc/reloc.h> 101#include <mach-o/ppc/reloc.h>
102#endif 102#endif
103#if defined (HAVE_MALLOC_MALLOC_H) 103#include <config.h>
104#undef malloc
105#undef realloc
106#undef free
107#ifdef HAVE_MALLOC_MALLOC_H
104#include <malloc/malloc.h> 108#include <malloc/malloc.h>
105#else 109#else
106#include <objc/malloc.h> 110#include <objc/malloc.h>
@@ -558,7 +562,7 @@ print_load_command (struct load_command *lc)
558static void 562static void
559read_load_commands () 563read_load_commands ()
560{ 564{
561 int n, i, j; 565 int i;
562 566
563 if (!unexec_read (&mh, sizeof (struct mach_header))) 567 if (!unexec_read (&mh, sizeof (struct mach_header)))
564 unexec_error ("cannot read mach-o header"); 568 unexec_error ("cannot read mach-o header");
@@ -680,7 +684,6 @@ copy_data_segment (struct load_command *lc)
680 struct section *sectp; 684 struct section *sectp;
681 int j; 685 int j;
682 unsigned long header_offset, file_offset, old_file_offset; 686 unsigned long header_offset, file_offset, old_file_offset;
683 struct region_t *r;
684 687
685 printf ("Writing segment %-16.16s at %#8x - %#8x (sz: %#8x)\n", 688 printf ("Writing segment %-16.16s at %#8x - %#8x (sz: %#8x)\n",
686 scp->segname, scp->fileoff, scp->fileoff + scp->filesize, 689 scp->segname, scp->fileoff, scp->fileoff + scp->filesize,
diff --git a/src/window.c b/src/window.c
index 039e955efd0..d4e6ac3569f 100644
--- a/src/window.c
+++ b/src/window.c
@@ -661,12 +661,20 @@ coordinates_in_window (w, x, y)
661 || WINDOW_RIGHTMOST_P (w)) 661 || WINDOW_RIGHTMOST_P (w))
662 { 662 {
663 if (!WINDOW_LEFTMOST_P (w) && abs (*x - x0) < grabbable_width) 663 if (!WINDOW_LEFTMOST_P (w) && abs (*x - x0) < grabbable_width)
664 return ON_VERTICAL_BORDER; 664 {
665 *x = max (0, *x - x0);
666 *y -= top_y;
667 return ON_VERTICAL_BORDER;
668 }
665 } 669 }
666 else 670 else
667 { 671 {
668 if (abs (*x - x1) < grabbable_width) 672 if (abs (*x - x1) < grabbable_width)
669 return ON_VERTICAL_BORDER; 673 {
674 *x = min (x1, *x) - x0;
675 *y -= top_y;
676 return ON_VERTICAL_BORDER;
677 }
670 } 678 }
671 679
672 if (*x < x0 || *x >= x1) 680 if (*x < x0 || *x >= x1)
@@ -708,7 +716,11 @@ coordinates_in_window (w, x, y)
708 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) 716 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
709 && !WINDOW_RIGHTMOST_P (w) 717 && !WINDOW_RIGHTMOST_P (w)
710 && (abs (*x - right_x) < grabbable_width)) 718 && (abs (*x - right_x) < grabbable_width))
711 return ON_VERTICAL_BORDER; 719 {
720 *x = min (right_x, *x) - left_x;
721 *y -= top_y;
722 return ON_VERTICAL_BORDER;
723 }
712 } 724 }
713 else 725 else
714 { 726 {
@@ -720,6 +732,8 @@ coordinates_in_window (w, x, y)
720 { 732 {
721 /* On the border on the right side of the window? Assume that 733 /* On the border on the right side of the window? Assume that
722 this area begins at RIGHT_X minus a canonical char width. */ 734 this area begins at RIGHT_X minus a canonical char width. */
735 *x = min (right_x, *x) - left_x;
736 *y -= top_y;
723 return ON_VERTICAL_BORDER; 737 return ON_VERTICAL_BORDER;
724 } 738 }
725 } 739 }
diff --git a/src/xdisp.c b/src/xdisp.c
index 43673bb6197..ca5137bb4ff 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -1913,7 +1913,7 @@ get_glyph_string_clip_rects (s, rects, n)
1913 } 1913 }
1914 1914
1915 if ((s->for_overlaps & OVERLAPS_BOTH) == 0 1915 if ((s->for_overlaps & OVERLAPS_BOTH) == 0
1916 || (s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1) 1916 || ((s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1))
1917 { 1917 {
1918#ifdef CONVERT_FROM_XRECT 1918#ifdef CONVERT_FROM_XRECT
1919 CONVERT_FROM_XRECT (r, *rects); 1919 CONVERT_FROM_XRECT (r, *rects);
@@ -1939,23 +1939,27 @@ get_glyph_string_clip_rects (s, rects, n)
1939 { 1939 {
1940 rs[i] = r; 1940 rs[i] = r;
1941 if (r.y + r.height > row_y) 1941 if (r.y + r.height > row_y)
1942 if (r.y < row_y) 1942 {
1943 rs[i].height = row_y - r.y; 1943 if (r.y < row_y)
1944 else 1944 rs[i].height = row_y - r.y;
1945 rs[i].height = 0; 1945 else
1946 rs[i].height = 0;
1947 }
1946 i++; 1948 i++;
1947 } 1949 }
1948 if (s->for_overlaps & OVERLAPS_SUCC) 1950 if (s->for_overlaps & OVERLAPS_SUCC)
1949 { 1951 {
1950 rs[i] = r; 1952 rs[i] = r;
1951 if (r.y < row_y + s->row->visible_height) 1953 if (r.y < row_y + s->row->visible_height)
1952 if (r.y + r.height > row_y + s->row->visible_height) 1954 {
1953 { 1955 if (r.y + r.height > row_y + s->row->visible_height)
1954 rs[i].y = row_y + s->row->visible_height; 1956 {
1955 rs[i].height = r.y + r.height - rs[i].y; 1957 rs[i].y = row_y + s->row->visible_height;
1956 } 1958 rs[i].height = r.y + r.height - rs[i].y;
1957 else 1959 }
1958 rs[i].height = 0; 1960 else
1961 rs[i].height = 0;
1962 }
1959 i++; 1963 i++;
1960 } 1964 }
1961 1965
@@ -14959,7 +14963,7 @@ dump_glyph_row (row, vpos, glyphs)
14959{ 14963{
14960 if (glyphs != 1) 14964 if (glyphs != 1)
14961 { 14965 {
14962 fprintf (stderr, "Row Start End Used oEI><\\CTZFesm X Y W H V A P\n"); 14966 fprintf (stderr, "Row Start End Used oE><\\CTZFesm X Y W H V A P\n");
14963 fprintf (stderr, "======================================================================\n"); 14967 fprintf (stderr, "======================================================================\n");
14964 14968
14965 fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d\ 14969 fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d\
@@ -22529,7 +22533,10 @@ note_mouse_highlight (f, x, y)
22529 } 22533 }
22530 22534
22531 if (part == ON_VERTICAL_BORDER) 22535 if (part == ON_VERTICAL_BORDER)
22532 cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; 22536 {
22537 cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
22538 help_echo_string = make_string ("drag-mouse-1: resize", 20);
22539 }
22533 else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE 22540 else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE
22534 || part == ON_SCROLL_BAR) 22541 || part == ON_SCROLL_BAR)
22535 cursor = FRAME_X_OUTPUT (f)->nontext_cursor; 22542 cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
diff --git a/src/xfaces.c b/src/xfaces.c
index 0d91f433fce..3a066ee12c3 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5063,10 +5063,12 @@ Default face attributes override any local face attributes. */)
5063 gvec = XVECTOR (global_lface)->contents; 5063 gvec = XVECTOR (global_lface)->contents;
5064 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 5064 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
5065 if (! UNSPECIFIEDP (gvec[i])) 5065 if (! UNSPECIFIEDP (gvec[i]))
5066 if (IGNORE_DEFFACE_P (gvec[i])) 5066 {
5067 lvec[i] = Qunspecified; 5067 if (IGNORE_DEFFACE_P (gvec[i]))
5068 else 5068 lvec[i] = Qunspecified;
5069 lvec[i] = gvec[i]; 5069 else
5070 lvec[i] = gvec[i];
5071 }
5070 5072
5071 return Qnil; 5073 return Qnil;
5072} 5074}
diff --git a/src/xrdb.c b/src/xrdb.c
index 2b7888ebe84..988db614c41 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -315,7 +315,7 @@ gethomedir ()
315 } 315 }
316 316
317 if (ptr == NULL) 317 if (ptr == NULL)
318 return "/"; 318 return xstrdup ("/");
319 319
320 copy = (char *) malloc (strlen (ptr) + 2); 320 copy = (char *) malloc (strlen (ptr) + 2);
321 strcpy (copy, ptr); 321 strcpy (copy, ptr);