summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey <lorentey@elte.hu>2006-04-19 16:23:46 +0000
committerKaroly Lorentey <lorentey@elte.hu>2006-04-19 16:23:46 +0000
commit5a439a0020596f3dfba803c139d70cf376314ddd (patch)
treec9ee1119dd4e96efdec7277c2edfed2fe0ceca42 /src
parent99b19b277605313da239890ca525f0103b6c8f74 (diff)
parent4dfcf1afd4253b368549b3fa2e2607dbd0235129 (diff)
downloademacs-5a439a0020596f3dfba803c139d70cf376314ddd.tar.gz
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-216 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-217 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-218 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-219 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-220 Improve tq.el. * emacs@sv.gnu.org/emacs--devo--0--patch-221 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-222 Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6. * emacs@sv.gnu.org/emacs--devo--0--patch-223 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-224 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-225 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-226 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-227 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-228 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-229 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-230 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-231 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-232 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-233 Update from CVS: lisp/progmodes/python.el (python-mode): Fix typo. * emacs@sv.gnu.org/gnus--rel--5.10--patch-84 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-85 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-86 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-550
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog191
-rw-r--r--src/abbrev.c26
-rw-r--r--src/coding.c19
-rw-r--r--src/dispnew.c2
-rw-r--r--src/eval.c1
-rw-r--r--src/fns.c7
-rw-r--r--src/image.c29
-rw-r--r--src/keyboard.c1
-rw-r--r--src/keymap.c2
-rw-r--r--src/lisp.h33
-rw-r--r--src/mac.c125
-rw-r--r--src/macfns.c49
-rw-r--r--src/macmenu.c2
-rw-r--r--src/macselect.c121
-rw-r--r--src/macterm.c516
-rw-r--r--src/macterm.h28
-rw-r--r--src/print.c3
-rw-r--r--src/process.c14
-rw-r--r--src/puresize.h2
-rw-r--r--src/s/ms-w32.h6
-rw-r--r--src/unexmacosx.c9
-rw-r--r--src/window.c63
-rw-r--r--src/xdisp.c7
-rw-r--r--src/xfaces.c40
-rw-r--r--src/xmenu.c66
25 files changed, 759 insertions, 603 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e2fd782ea2f..bd3f250198e 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,194 @@
+2006-04-18 Richard Stallman <rms@gnu.org>
+
+ * xmenu.c (restore_menu_items, save_menu_items): New fns.
+ (set_frame_menubar): Use save_menu_items. Save updated vector in
+ the frame before unwinding it. Don't use unuse_menu_items. Don't
+ use discard_menu_items.
+ (digest_single_submenu): Abort if an item is not in a pane.
+ (init_menu_items): Put the error check at the top.
+
+ * keymap.c (describe_map): Make "shadowed" warning more verbose.
+
+ * window.c (adjust_window_trailing_edge): Correctly distinguish
+ series vs parallel cases, even when window has no parent.
+
+ * abbrev.c (record_symbol): New function.
+ (Finsert_abbrev_table_description): Sort the abbrevs alphabetically.
+
+2006-04-18 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * image.c (x_create_bitmap_from_data) [MAC_OS]: Don't check return
+ value of xmalloc.
+
+ * mac.c (mac_coerce_file_name_ptr, mac_coerce_file_name_desc)
+ (create_apple_event_from_event_ref, xrm_get_preference_database)
+ (cfstring_create_normalized): Don't check return value of xmalloc.
+
+ * macselect.c (get_scrap_target_type_list, defer_apple_events)
+ (copy_scrap_flavor_data, mac_handle_service_event): Don't check
+ return value of xmalloc/xrealloc.
+
+ * macterm.c (XCreateGC, x_per_char_metric, xlfdpat_create)
+ (init_font_name_table, init_font_name_table, mac_do_list_fonts)
+ (XLoadQueryFont, mac_store_apple_event): Don't check
+ return value of xmalloc.
+
+2006-04-17 Kim F. Storm <storm@cua.dk>
+
+ * window.c (coordinates_in_window): On the vertical border,
+ calculate the row number measured from the top of the window, not
+ the top of the frame.
+ (window_loop): Test w->dedicated with !NILP instead of EQ Qt.
+ (window_scroll_pixel_based): Fix off-by-one bug in 2002-12-23 change.
+
+2006-04-16 Eli Zaretskii <eliz@gnu.org>
+
+ * s/ms-w32.h (SYSTEM_PURESIZE_EXTRA): Reduce to 24000.
+
+2006-04-16 Romain Francoise <romain@orebokech.com>
+
+ * puresize.h (BASE_PURESIZE): Decrement back to 1200000.
+
+2006-04-16 Andreas Schwab <schwab@suse.de>
+
+ * puresize.h (PURESIZE_RATIO): Reduce to 10/6.
+
+2006-04-15 Romain Francoise <romain@orebokech.com>
+
+ * puresize.h (BASE_PURESIZE): Increment to 1210000.
+
+2006-04-13 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change)
+
+ * print.c (Fprin1_to_string): Mention in the `doc' that the
+ behavior is modified by `print-level' and `print-length'.
+
+2006-04-13 Kenichi Handa <handa@m17n.org>
+
+ * coding.c (setup_coding_system): If eol-type is not yet decided
+ and system_eol_type is not LF, set CODING_REQUIRE_ENCODING_MASK.
+ If coding_system is nil, return 0.
+ (code_convert_region1): Even if coding_system is nil, don't skip
+ conversion if system_eol_type is not LF.
+ (code_convert_string1): Likewise.
+ (code_convert_string_norecord): Likewise.
+
+2006-04-13 Kenichi Handa <handa@m17n.org>
+
+ * coding.c (setup_coding_system): Fix previous change.
+ (encode_coding): If eol_type is not yet decided, use
+ system_eol_type.
+ (shrink_encoding_region): If eol_type is not yet decided and
+ system_eol_type is not LF, don't shrink.
+
+2006-04-13 Nick Roberts <nickrob@snap.net.nz>
+
+ * xdisp.c (note_mouse_highlight): Add help echo for dragging vertical
+ line.
+
+2006-04-12 Richard Stallman <rms@gnu.org>
+
+ * keyboard.c (read_key_sequence): Explicitly avoid keybuf[-1].
+
+ * process.c (conv_lisp_to_sockaddr): If FAMILY unknown, just return.
+ (Fprocess_send_eof): Abort if fail to open null device.
+
+2006-04-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * fns.c [HAVE_MENUS && MAC_OS]: Include macterm.h.
+
+ * image.c [MAC_OS] (xpm_load_image): Add parentheses around
+ assignment used as truth value. Add explicit braces to avoid
+ ambiguous `else'.
+ [MAC_OS] (gif_load): Remove unused variable `gcpro1'.
+
+ * lisp.h (syms_of_fontset, Fset_fontset_font): Put extern and
+ EXFUN in #ifdef HAVE_WINDOW_SYSTEM.
+ (syms_of_xfns, syms_of_xsmfns, syms_of_xselect, syms_of_xterm):
+ Put externs in #ifdef HAVE_X_WINDOWS.
+ (syms_of_macfns, syms_of_macselect, syms_of_macterm)
+ (syms_of_macmenu, syms_of_mac) [MAC_OS]: Add externs.
+ (init_mac_osx_environment) [MAC_OSX]: Add extern.
+
+ * mac.c (init_process): Remove undef.
+ (select) [MAC_OSX]: Undefine before including sysselect.h.
+ (posix_pathname_to_fsspec, fsspec_to_posix_pathname) [MAC_OSX]:
+ Remove functions and prototypes.
+ (parse_value): Add parentheses around + inside shift.
+ (path_from_vol_dir_name): Make static.
+ (get_temp_dir_name): Remove unused variables `cpb' and `dir_name'.
+ [!MAC_OSX] (get_path_to_system_folder): Likewise.
+ (Fmac_get_file_creator, Fmac_get_file_type): Remove unused
+ variable `cCode'.
+ (Fmac_coerce_ae_data): Remove unused variables `fref' and `fs'.
+ (Fmac_get_preference): Add explicit braces to avoid ambiguous `else'.
+
+ * macfns.c (x_to_mac_color): Remove unused variable `tail'.
+ (x_set_mouse_color): Remove unused variable `dpy'.
+ (Fx_create_frame): Remove unused variable `x_frame_count'.
+ (Fx_server_version): Add explicit braces to avoid ambiguous `else'.
+ (x_sync): Move from macterm.c.
+ (Fx_file_dialog): Remove unused variable `default_filter_index'.
+
+ * macmenu.c (min_menu_id): Make element type explicit.
+
+ * macselect.c (get_flavor_type_from_symbol): Remove unused
+ variable `val'.
+ (get_scrap_private_timestamp, x_get_foreign_selection)
+ (copy_scrap_flavor_data): Add explicit braces to avoid ambiguous `else'.
+ (Fmac_process_deferred_apple_events): Remove unused variables
+ `keyword', `reply', `apple_event', `count', and `err'.
+
+ * macterm.c: Don't include gnu.h.
+ (x_io_error_quitter, x_draw_image_foreground_1): Remove prototypes.
+ (x_sync): Move to macfns.c.
+ [USE_CG_DRAWING] (mac_define_fringe_bitmap): Remove unused
+ variable `mask_bits'.
+ (mac_compute_glyph_string_overhangs): Avoid ambiguous `else'.
+ (x_draw_image_glyph_string): Remove unused variable `pixmap'.
+ (x_mac_to_emacs_modifiers): Remove function.
+ (XTset_vertical_scroll_bar, mac_handle_visibility_change)
+ (x_make_frame_visible, xlfdpat_create, mac_handle_command_event):
+ Add explicit braces to avoid ambiguous `else'.
+ (x_make_frame_visible): Remove unused variables `type',
+ `original_top', and `original_left'.
+ (mac_do_list_fonts, XTread_socket): Add parentheses around && within ||.
+ (x_load_font): Remove unused variables `full_name', and `value'.
+ (do_get_menus, do_init_managers, do_check_ram_size) [!MAC_OS8]:
+ Remove functions.
+ (do_zoom_window): Reorganize variables with respect to conditionals.
+ (init_command_handler): Remove unused variable `err'.
+ [MAC_OSX] (mac_check_bundle): Remove unused variable `child'.
+
+ * macterm.h (x_set_mouse_position, x_set_mouse_pixel_position)
+ (x_make_frame_invisible, x_iconify_frame, x_free_frame_resources)
+ (x_destroy_window, x_wm_set_size_hint, x_delete_display, XFreeGC)
+ (do_menu_choice, have_menus_p, x_real_positions)
+ (x_set_menu_bar_lines, x_pixel_width, x_pixel_height, x_char_width)
+ (x_char_height, x_sync, x_set_tool_bar_lines, x_activate_menubar)
+ (free_frame_menubar): Add externs.
+
+ * unexmacosx.c: Include config.h before using HAVE_MALLOC_MALLOC_H.
+ (malloc, realloc, free): Add undefs.
+ (read_load_commands): Remove unused variable `n' and `j'.
+ (copy_data_segment): Remove unused variable `r'.
+
+ * xdisp.c (get_glyph_string_clip_rects): Add parentheses around &&
+ within ||. Add explicit braces to avoid ambiguous `else'.
+ (dump_glyph_row): Remove label for `inverse_p' from legend.
+
+ * xfaces.c (Finternal_merge_in_global_face, try_font_list): Add
+ explicit braces to avoid ambiguous `else'.
+
+2006-04-11 Micha,Ak(Bl Cadilhac <michael.cadilhac@lrde.org> (tiny change)
+
+ * dispnew.c (init_display): Don't init X display if the user asked
+ for a non-X display.
+
+2006-04-12 Kenichi Handa <handa@m17n.org>
+
+ * coding.c (setup_coding_system): Use system_eol_type for default
+ coding->eol_type.
+
2006-04-11 Dan Nicolaescu <dann@ics.uci.edu>
* lisp.h (wrong_type_argument): Mark as NO_RETURN.
diff --git a/src/abbrev.c b/src/abbrev.c
index e7dcec3a43a..e371797f139 100644
--- a/src/abbrev.c
+++ b/src/abbrev.c
@@ -531,6 +531,13 @@ describe_abbrev (sym, stream)
Fterpri (stream);
}
+static void
+record_symbol (sym, list)
+ Lisp_Object sym, list;
+{
+ XSETCDR (list, Fcons (sym, XCDR (list)));
+}
+
DEFUN ("insert-abbrev-table-description", Finsert_abbrev_table_description,
Sinsert_abbrev_table_description, 1, 2, 0,
doc: /* Insert before point a full description of abbrev table named NAME.
@@ -546,6 +553,7 @@ READABLE is non-nil, they are listed. */)
Lisp_Object name, readable;
{
Lisp_Object table;
+ Lisp_Object symbols;
Lisp_Object stream;
CHECK_SYMBOL (name);
@@ -554,12 +562,22 @@ READABLE is non-nil, they are listed. */)
XSETBUFFER (stream, current_buffer);
+ symbols = Fcons (Qnil, Qnil);
+ map_obarray (table, record_symbol, symbols);
+ symbols = XCDR (symbols);
+ symbols = Fsort (symbols, Qstring_lessp);
+
if (!NILP (readable))
{
insert_string ("(");
Fprin1 (name, stream);
insert_string (")\n\n");
- map_obarray (table, describe_abbrev, stream);
+ while (! NILP (symbols))
+ {
+ describe_abbrev (XCAR (symbols), stream);
+ symbols = XCDR (symbols);
+ }
+
insert_string ("\n\n");
}
else
@@ -567,7 +585,11 @@ READABLE is non-nil, they are listed. */)
insert_string ("(define-abbrev-table '");
Fprin1 (name, stream);
insert_string (" '(\n");
- map_obarray (table, write_abbrev, stream);
+ while (! NILP (symbols))
+ {
+ write_abbrev (XCAR (symbols), stream);
+ symbols = XCDR (symbols);
+ }
insert_string (" ))\n\n");
}
diff --git a/src/coding.c b/src/coding.c
index 26d47da9317..d261418def5 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -3603,6 +3603,8 @@ setup_coding_system (coding_system, coding)
{
coding->eol_type = CODING_EOL_UNDECIDED;
coding->common_flags = CODING_REQUIRE_DETECTION_MASK;
+ if (system_eol_type != CODING_EOL_LF)
+ coding->common_flags |= CODING_REQUIRE_ENCODING_MASK;
}
else if (XFASTINT (eol_type) == 1)
{
@@ -3918,9 +3920,12 @@ setup_coding_system (coding_system, coding)
coding->type = coding_type_no_conversion;
coding->category_idx = CODING_CATEGORY_IDX_BINARY;
coding->common_flags = 0;
- coding->eol_type = CODING_EOL_LF;
+ coding->eol_type = NILP (coding_system) ? system_eol_type : CODING_EOL_LF;
+ if (coding->eol_type != CODING_EOL_LF)
+ coding->common_flags
+ |= CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK;
coding->pre_write_conversion = coding->post_read_conversion = Qnil;
- return -1;
+ return NILP (coding_system) ? 0 : -1;
}
/* Free memory blocks allocated for storing composition information. */
@@ -4994,6 +4999,8 @@ encode_coding (coding, source, destination, src_bytes, dst_bytes)
coding->consumed = coding->consumed_char = 0;
coding->errors = 0;
coding->result = CODING_FINISH_NORMAL;
+ if (coding->eol_type == CODING_EOL_UNDECIDED)
+ coding->eol_type = system_eol_type;
switch (coding->type)
{
@@ -5250,6 +5257,8 @@ shrink_encoding_region (beg, end, coding, str)
if (coding->type == coding_type_ccl
|| coding->eol_type == CODING_EOL_CRLF
|| coding->eol_type == CODING_EOL_CR
+ || (coding->eol_type == CODING_EOL_UNDECIDED
+ && system_eol_type != CODING_EOL_LF)
|| (coding->cmp_data && coding->cmp_data->used > 0))
{
/* We can't skip any data. */
@@ -7105,7 +7114,7 @@ code_convert_region1 (start, end, coding_system, encodep)
from = XFASTINT (start);
to = XFASTINT (end);
- if (NILP (coding_system))
+ if (NILP (coding_system) && system_eol_type == CODING_EOL_LF)
return make_number (to - from);
if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)
@@ -7160,7 +7169,7 @@ code_convert_string1 (string, coding_system, nocopy, encodep)
CHECK_STRING (string);
CHECK_SYMBOL (coding_system);
- if (NILP (coding_system))
+ if (NILP (coding_system) && system_eol_type == CODING_EOL_LF)
return (NILP (nocopy) ? Fcopy_sequence (string) : string);
if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)
@@ -7219,7 +7228,7 @@ code_convert_string_norecord (string, coding_system, encodep)
CHECK_STRING (string);
CHECK_SYMBOL (coding_system);
- if (NILP (coding_system))
+ if (NILP (coding_system) && system_eol_type == CODING_EOL_LF)
return string;
if (setup_coding_system (Fcheck_coding_system (coding_system), &coding) < 0)
diff --git a/src/dispnew.c b/src/dispnew.c
index 296dbece477..9b4dbf1d992 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -6695,7 +6695,7 @@ init_display ()
try to use X, and die with an error message if that doesn't work. */
#ifdef HAVE_X_WINDOWS
- if (! display_arg)
+ if (! inhibit_window_system && ! display_arg)
{
char *display;
#ifdef VMS
diff --git a/src/eval.c b/src/eval.c
index 86ee384896c..20f29b5f06b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -204,6 +204,7 @@ init_eval_once ()
specpdl_size = 50;
specpdl = (struct specbinding *) xmalloc (specpdl_size * sizeof (struct specbinding));
specpdl_ptr = specpdl;
+ /* Don't forget to update docs (lispref node "Local Variables"). */
max_specpdl_size = 1000;
max_lisp_eval_depth = 300;
diff --git a/src/fns.c b/src/fns.c
index 0608fee2df6..f06f39fae04 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -48,9 +48,12 @@ Boston, MA 02110-1301, USA. */
#include "frame.h"
#include "window.h"
#include "blockinput.h"
-#include "termhooks.h" /* For display->kboard reference in terminal-local-value. */
-#if defined (HAVE_MENUS) && defined (HAVE_X_WINDOWS)
+#ifdef HAVE_MENUS
+#if defined (HAVE_X_WINDOWS)
#include "xterm.h"
+#elif defined (MAC_OS)
+#include "macterm.h"
+#endif
#endif
#ifndef NULL
diff --git a/src/image.c b/src/image.c
index 0d52399327e..a6b3c8f19c5 100644
--- a/src/image.c
+++ b/src/image.c
@@ -201,7 +201,7 @@ XPutPixel (ximage, x, y, pixel)
}
else
#endif
- if (depth == 1)
+ if (depth == 1)
{
char *base_addr = GetPixBaseAddr (pixmap);
short row_bytes = GetPixRowBytes (pixmap);
@@ -444,8 +444,6 @@ x_create_bitmap_from_data (f, bits, width, height)
id = x_allocate_bitmap_record (f);
#ifdef MAC_OS
dpyinfo->bitmaps[id - 1].bitmap_data = (char *) xmalloc (height * width);
- if (! dpyinfo->bitmaps[id - 1].bitmap_data)
- return -1;
bcopy (bits, dpyinfo->bitmaps[id - 1].bitmap_data, height * width);
#endif /* MAC_OS */
@@ -4381,7 +4379,7 @@ xpm_load_image (f, img, contents, end)
if (color == NULL)
goto failure;
- while (str = strtok (NULL, " \t"))
+ while ((str = strtok (NULL, " \t")) != NULL)
{
next_key = xpm_str_to_color_key (str);
if (next_key >= 0)
@@ -4409,17 +4407,21 @@ xpm_load_image (f, img, contents, end)
Lisp_Object specified_color = Fassoc (symbol_color, color_symbols);
if (CONSP (specified_color) && STRINGP (XCDR (specified_color)))
- if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0)
- color_val = Qt;
- else if (x_defined_color (f, SDATA (XCDR (specified_color)),
- &cdef, 0))
- color_val = make_number (cdef.pixel);
+ {
+ if (xstricmp (SDATA (XCDR (specified_color)), "None") == 0)
+ color_val = Qt;
+ else if (x_defined_color (f, SDATA (XCDR (specified_color)),
+ &cdef, 0))
+ color_val = make_number (cdef.pixel);
+ }
}
if (NILP (color_val) && max_key > 0)
- if (xstricmp (max_color, "None") == 0)
- color_val = Qt;
- else if (x_defined_color (f, max_color, &cdef, 0))
- color_val = make_number (cdef.pixel);
+ {
+ if (xstricmp (max_color, "None") == 0)
+ color_val = Qt;
+ else if (x_defined_color (f, max_color, &cdef, 0))
+ color_val = make_number (cdef.pixel);
+ }
if (!NILP (color_val))
(*put_color_table) (color_table, beg, chars_per_pixel, color_val);
@@ -7848,7 +7850,6 @@ gif_load (f, img)
int width, height;
XImagePtr ximg;
TimeValue time;
- struct gcpro gcpro1;
int ino;
CGrafPtr old_port;
GDHandle old_gdh;
diff --git a/src/keyboard.c b/src/keyboard.c
index dff14877103..1ad852c819a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -9684,6 +9684,7 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
/* Don't downcase the last character if the caller says don't.
Don't downcase it if the result is undefined, either. */
if ((dont_downcase_last || first_binding >= nmaps)
+ && t > 0
&& t - 1 == original_uppercase_position)
keybuf[t - 1] = original_uppercase;
diff --git a/src/keymap.c b/src/keymap.c
index af881d73ccd..5962dfc2efd 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -3365,7 +3365,7 @@ describe_map (map, prefix, elt_describer, partial, shadow,
if (vect[i].shadowed)
{
SET_PT (PT - 1);
- insert_string (" (shadowed)");
+ insert_string ("\n (that binding is currently shadowed by another mode)");
SET_PT (PT + 1);
}
}
diff --git a/src/lisp.h b/src/lisp.h
index 468b699fb06..0df41a0d1f4 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3209,10 +3209,14 @@ extern void fatal () NO_RETURN;
/* Defined in terminal.c */
extern void syms_of_terminal P_ ((void));
-#ifdef HAVE_X_WINDOWS
+#ifdef HAVE_WINDOW_SYSTEM
/* Defined in fontset.c */
extern void syms_of_fontset P_ ((void));
EXFUN (Fset_fontset_font, 4);
+
+/* Defined in xfns.c, w32fns.c, or macfns.c */
+EXFUN (Fxw_display_color_p, 1);
+EXFUN (Fx_file_dialog, 5);
#endif
/* Defined in xfaces.c */
@@ -3226,12 +3230,6 @@ extern int getloadavg P_ ((double *, int));
#ifdef HAVE_X_WINDOWS
/* Defined in xfns.c */
extern void syms_of_xfns P_ ((void));
-#endif /* HAVE_X_WINDOWS */
-#ifdef HAVE_WINDOW_SYSTEM
-/* Defined in xfns.c, w32fns.c, or macfns.c */
-EXFUN (Fxw_display_color_p, 1);
-EXFUN (Fx_file_dialog, 5);
-#endif /* HAVE_WINDOW_SYSTEM */
/* Defined in xsmfns.c */
extern void syms_of_xsmfns P_ ((void));
@@ -3241,11 +3239,32 @@ extern void syms_of_xselect P_ ((void));
/* Defined in xterm.c */
extern void syms_of_xterm P_ ((void));
+#endif /* HAVE_X_WINDOWS */
#ifdef MSDOS
/* Defined in msdos.c */
EXFUN (Fmsdos_downcase_filename, 1);
#endif
+
+#ifdef MAC_OS
+/* Defined in macfns.c */
+extern void syms_of_macfns P_ ((void));
+
+/* Defined in macselect.c */
+extern void syms_of_macselect P_ ((void));
+
+/* Defined in macterm.c */
+extern void syms_of_macterm P_ ((void));
+
+/* Defined in macmenu.c */
+extern void syms_of_macmenu P_ ((void));
+
+/* Defined in mac.c */
+extern void syms_of_mac P_ ((void));
+#ifdef MAC_OSX
+extern void init_mac_osx_environment P_ ((void));
+#endif /* MAC_OSX */
+#endif /* MAC_OS */
/* Nonzero means Emacs has already been initialized.
Used during startup to detect startup of dumped Emacs. */
diff --git a/src/mac.c b/src/mac.c
index 40bbacf15ce..7172301b6b0 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -28,7 +28,9 @@ Boston, MA 02110-1301, USA. */
#include "lisp.h"
#include "process.h"
-#undef init_process
+#ifdef MAC_OSX
+#undef select
+#endif
#include "systime.h"
#include "sysselect.h"
#include "blockinput.h"
@@ -79,8 +81,10 @@ static ComponentInstance as_scripting_component;
/* The single script context used for all script executions. */
static OSAID as_script_context;
+#ifndef MAC_OSX
static OSErr posix_pathname_to_fsspec P_ ((const char *, FSSpec *));
static OSErr fsspec_to_posix_pathname P_ ((const FSSpec *, char *, int));
+#endif
/* When converting from Mac to Unix pathnames, /'s in folder names are
converted to :'s. This function, used in copying folder names,
@@ -449,15 +453,10 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
char *buf;
buf = xmalloc (data_size + 1);
- if (buf)
- {
- memcpy (buf, data_ptr, data_size);
- buf[data_size] = '\0';
- err = posix_pathname_to_fsspec (buf, &fs);
- xfree (buf);
- }
- else
- err = memFullErr;
+ memcpy (buf, data_ptr, data_size);
+ buf[data_size] = '\0';
+ err = posix_pathname_to_fsspec (buf, &fs);
+ xfree (buf);
if (err == noErr)
err = AECoercePtr (typeFSS, &fs, sizeof (FSSpec), to_type, result);
#endif
@@ -485,14 +484,11 @@ mac_coerce_file_name_ptr (type_code, data_ptr, data_size,
{
size = AEGetDescDataSize (&desc);
buf = xmalloc (size);
- if (buf)
- {
- err = AEGetDescData (&desc, buf, size);
- if (err == noErr)
- url = CFURLCreateWithBytes (NULL, buf, size,
- kCFStringEncodingUTF8, NULL);
- xfree (buf);
- }
+ err = AEGetDescData (&desc, buf, size);
+ if (err == noErr)
+ url = CFURLCreateWithBytes (NULL, buf, size,
+ kCFStringEncodingUTF8, NULL);
+ xfree (buf);
AEDisposeDesc (&desc);
}
}
@@ -577,21 +573,16 @@ mac_coerce_file_name_desc (from_desc, to_type, handler_refcon, result)
data_size = GetHandleSize (from_desc->dataHandle);
#endif
data_ptr = xmalloc (data_size);
- if (data_ptr)
- {
#if TARGET_API_MAC_CARBON
- err = AEGetDescData (from_desc, data_ptr, data_size);
+ err = AEGetDescData (from_desc, data_ptr, data_size);
#else
- memcpy (data_ptr, *(from_desc->dataHandle), data_size);
+ memcpy (data_ptr, *(from_desc->dataHandle), data_size);
#endif
- if (err == noErr)
- err = mac_coerce_file_name_ptr (from_type, data_ptr,
- data_size, to_type,
- handler_refcon, result);
- xfree (data_ptr);
- }
- else
- err = memFullErr;
+ if (err == noErr)
+ err = mac_coerce_file_name_ptr (from_type, data_ptr,
+ data_size, to_type,
+ handler_refcon, result);
+ xfree (data_ptr);
}
if (err != noErr)
@@ -687,8 +678,6 @@ create_apple_event_from_event_ref (event, num_params, names, types, result)
if (err != noErr)
break;
buf = xmalloc (size);
- if (buf == NULL)
- break;
err = GetEventParameter (event, names[i], types[i], NULL,
size, NULL, buf);
if (err == noErr)
@@ -1222,7 +1211,7 @@ parse_value (p)
&& '0' <= P[1] && P[1] <= '7'
&& '0' <= P[2] && P[2] <= '7')
{
- *q++ = (P[0] - '0' << 6) + (P[1] - '0' << 3) + (P[2] - '0');
+ *q++ = ((P[0] - '0') << 6) + ((P[1] - '0') << 3) + (P[2] - '0');
P += 3;
}
else
@@ -1592,8 +1581,6 @@ xrm_get_preference_database (application)
count = CFSetGetCount (key_set);
keys = xmalloc (sizeof (CFStringRef) * count);
- if (keys == NULL)
- goto out;
CFSetGetValues (key_set, (const void **)keys);
for (index = 0; index < count; index++)
{
@@ -2789,7 +2776,7 @@ link (const char *name1, const char *name2)
/* Determine the path name of the file specified by VREFNUM, DIRID,
and NAME and place that in the buffer PATH of length
MAXPATHLEN. */
-int
+static int
path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num,
long dir_id, ConstStr255Param name)
{
@@ -2834,6 +2821,8 @@ path_from_vol_dir_name (char *path, int man_path_len, short vol_ref_num,
}
+#ifndef MAC_OSX
+
static OSErr
posix_pathname_to_fsspec (ufn, fs)
const char *ufn;
@@ -2866,8 +2855,6 @@ fsspec_to_posix_pathname (fs, ufn, ufnbuflen)
return fnfErr;
}
-#ifndef MAC_OSX
-
int
readlink (const char *path, char *buf, int bufsiz)
{
@@ -3124,8 +3111,7 @@ get_temp_dir_name ()
short vol_ref_num;
long dir_id;
OSErr err;
- Str255 dir_name, full_path;
- CInfoPBRec cpb;
+ Str255 full_path;
char unix_dir_name[MAXPATHLEN+1];
DIR *dir;
@@ -3217,8 +3203,7 @@ get_path_to_system_folder ()
short vol_ref_num;
long dir_id;
OSErr err;
- Str255 dir_name, full_path;
- CInfoPBRec cpb;
+ Str255 full_path;
static char system_folder_unix_name[MAXPATHLEN+1];
DIR *dir;
@@ -3947,7 +3932,6 @@ DEFUN ("mac-get-file-creator", Fmac_get_file_creator, Smac_get_file_creator, 1,
#else
FSSpec fss;
#endif
- OSType cCode;
Lisp_Object result = Qnil;
CHECK_STRING (filename);
@@ -4002,7 +3986,6 @@ DEFUN ("mac-get-file-type", Fmac_get_file_type, Smac_get_file_type, 1, 1, 0,
#else
FSSpec fss;
#endif
- OSType cCode;
Lisp_Object result = Qnil;
CHECK_STRING (filename);
@@ -4296,11 +4279,6 @@ Each type should be a string of length 4 or the symbol
Lisp_Object result = Qnil;
DescType src_desc_type, dst_desc_type;
AEDesc dst_desc;
-#ifdef MAC_OSX
- FSRef fref;
-#else
- FSSpec fs;
-#endif
CHECK_STRING (src_data);
if (EQ (src_type, Qundecoded_file_name))
@@ -4422,18 +4400,20 @@ otherwise. */)
}
if (NILP (key))
- if (EQ (format, Qxml))
- {
- CFDataRef data = CFPropertyListCreateXMLData (NULL, plist);
- if (data == NULL)
- goto out;
- result = cfdata_to_lisp (data);
- CFRelease (data);
- }
- else
- result =
- cfproperty_list_to_lisp (plist, EQ (format, Qt),
- NILP (hash_bound) ? -1 : XINT (hash_bound));
+ {
+ if (EQ (format, Qxml))
+ {
+ CFDataRef data = CFPropertyListCreateXMLData (NULL, plist);
+ if (data == NULL)
+ goto out;
+ result = cfdata_to_lisp (data);
+ CFRelease (data);
+ }
+ else
+ result =
+ cfproperty_list_to_lisp (plist, EQ (format, Qt),
+ NILP (hash_bound) ? -1 : XINT (hash_bound));
+ }
out:
if (app_plist)
@@ -4550,11 +4530,8 @@ cfstring_create_normalized (str, symbol)
if (in_text == NULL)
{
buffer = xmalloc (sizeof (UniChar) * length);
- if (buffer)
- {
- CFStringGetCharacters (str, CFRangeMake (0, length), buffer);
- in_text = buffer;
- }
+ CFStringGetCharacters (str, CFRangeMake (0, length), buffer);
+ in_text = buffer;
}
if (in_text)
@@ -4562,15 +4539,12 @@ cfstring_create_normalized (str, symbol)
while (err == noErr)
{
out_buf = xmalloc (out_size);
- if (out_buf == NULL)
- err = mFulErr;
- else
- err = ConvertFromUnicodeToText (uni, length * sizeof (UniChar),
- in_text,
- kUnicodeDefaultDirectionMask,
- 0, NULL, NULL, NULL,
- out_size, &out_read, &out_len,
- out_buf);
+ err = ConvertFromUnicodeToText (uni, length * sizeof (UniChar),
+ in_text,
+ kUnicodeDefaultDirectionMask,
+ 0, NULL, NULL, NULL,
+ out_size, &out_read, &out_len,
+ out_buf);
if (err == noErr && out_read < length * sizeof (UniChar))
{
xfree (out_buf);
@@ -4701,7 +4675,6 @@ mac_get_system_locale ()
#ifdef MAC_OSX
-#undef select
extern int inhibit_window_system;
extern int noninteractive;
diff --git a/src/macfns.c b/src/macfns.c
index a6a5e99727a..3f5151daee9 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -1024,7 +1024,7 @@ Lisp_Object
x_to_mac_color (colorname)
char * colorname;
{
- register Lisp_Object tail, ret = Qnil;
+ register Lisp_Object ret = Qnil;
BLOCK_INPUT;
@@ -1359,7 +1359,6 @@ x_set_mouse_color (f, arg, oldval)
Lisp_Object arg, oldval;
{
struct x_output *x = f->output_data.x;
- Display *dpy = FRAME_MAC_DISPLAY (f);
Cursor cursor, nontext_cursor, mode_cursor, hand_cursor;
Cursor hourglass_cursor, horizontal_drag_cursor;
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. */)
struct mac_display_info *dpyinfo = NULL;
Lisp_Object parent;
struct kboard *kb;
- static int x_frame_count = 2; /* begins at 2 because terminal frame is F1 */
check_mac ();
@@ -2910,23 +2908,25 @@ If omitted or nil, that stands for the selected frame's display. */)
BLOCK_INPUT;
err = Gestalt (gestaltSystemVersion, &response);
if (err == noErr)
- if (response >= 0x00001040)
- {
- err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */
- if (err == noErr)
- err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */
- if (err == noErr)
- err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */
- }
- else
- {
- bugfix = response & 0xf;
- response >>= 4;
- minor = response & 0xf;
- response >>= 4;
- /* convert BCD to int */
- major = response - (response >> 4) * 6;
- }
+ {
+ if (response >= 0x00001040)
+ {
+ err = Gestalt ('sys1', &major); /* gestaltSystemVersionMajor */
+ if (err == noErr)
+ err = Gestalt ('sys2', &minor); /* gestaltSystemVersionMinor */
+ if (err == noErr)
+ err = Gestalt ('sys3', &bugfix); /* gestaltSystemVersionBugFix */
+ }
+ else
+ {
+ bugfix = response & 0xf;
+ response >>= 4;
+ minor = response & 0xf;
+ response >>= 4;
+ /* convert BCD to int */
+ major = response - (response >> 4) * 6;
+ }
+ }
UNBLOCK_INPUT;
if (err != noErr)
@@ -3210,6 +3210,14 @@ DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
return Qnil;
}
+/* x_sync is a no-op on Mac. */
+
+void
+x_sync (f)
+ FRAME_PTR f;
+{
+}
+
/***********************************************************************
Window properties
@@ -4187,7 +4195,6 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
int count = SPECPDL_INDEX ();
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
char filename[MAXPATHLEN];
- int default_filter_index = 1; /* 1: All Files, 2: Directories only */
static NavEventUPP mac_nav_event_callbackUPP = NULL;
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 */
MAC_MENU_END /* 32768 */
};
-static const min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768};
+static const int min_menu_id[] = {0, 1, 235, 236, 256, 16384, 32768};
#define DIALOG_WINDOW_RESOURCE 130
diff --git a/src/macselect.c b/src/macselect.c
index 066892adce0..fe4a7c8eccc 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -153,7 +153,6 @@ static ScrapFlavorType
get_flavor_type_from_symbol (sym)
Lisp_Object sym;
{
- ScrapFlavorType val;
Lisp_Object str = Fget (sym, Qmac_ostype);
if (STRINGP (str) && SBYTES (str) == 4)
@@ -322,17 +321,19 @@ get_scrap_private_timestamp (scrap, timestamp)
err = GetScrapFlavorFlags (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP, &flags);
if (err == noErr)
- if (!(flags & kScrapFlavorMaskSenderOnly))
- err = noTypeErr;
- else
- {
- Size size = sizeof (*timestamp);
+ {
+ if (!(flags & kScrapFlavorMaskSenderOnly))
+ err = noTypeErr;
+ else
+ {
+ Size size = sizeof (*timestamp);
- err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP,
- &size, timestamp);
- if (err == noErr && size != sizeof (*timestamp))
- err = noTypeErr;
- }
+ err = GetScrapFlavorData (scrap, SCRAP_FLAVOR_TYPE_EMACS_TIMESTAMP,
+ &size, timestamp);
+ if (err == noErr && size != sizeof (*timestamp))
+ err = noTypeErr;
+ }
+ }
#else /* !TARGET_API_MAC_CARBON */
Handle handle;
SInt32 size, offset;
@@ -372,14 +373,11 @@ get_scrap_target_type_list (scrap)
err = GetScrapFlavorCount (scrap, &count);
if (err == noErr)
flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count);
- if (flavor_info)
+ err = GetScrapFlavorInfoList (scrap, &count, flavor_info);
+ if (err != noErr)
{
- err = GetScrapFlavorInfoList (scrap, &count, flavor_info);
- if (err != noErr)
- {
- xfree (flavor_info);
- flavor_info = NULL;
- }
+ xfree (flavor_info);
+ flavor_info = NULL;
}
if (flavor_info == NULL)
count = 0;
@@ -683,18 +681,20 @@ x_get_foreign_selection (selection_symbol, target_type, time_stamp)
err = get_scrap_from_symbol (selection_symbol, 0, &scrap);
if (err == noErr && scrap)
- if (EQ (target_type, QTARGETS))
- {
- result = get_scrap_target_type_list (scrap);
- result = Fvconcat (1, &result);
- }
- else
- {
- result = get_scrap_string (scrap, target_type);
- if (STRINGP (result))
- Fput_text_property (make_number (0), make_number (SBYTES (result)),
- Qforeign_selection, target_type, result);
- }
+ {
+ if (EQ (target_type, QTARGETS))
+ {
+ result = get_scrap_target_type_list (scrap);
+ result = Fvconcat (1, &result);
+ }
+ else
+ {
+ result = get_scrap_string (scrap, target_type);
+ if (STRINGP (result))
+ Fput_text_property (make_number (0), make_number (SBYTES (result)),
+ Qforeign_selection, target_type, result);
+ }
+ }
UNBLOCK_INPUT;
@@ -1009,7 +1009,7 @@ defer_apple_events (apple_event, reply)
/* Mac OS 10.3 Xcode manual says AESuspendTheCurrentEvent makes
copies of the Apple event and the reply, but Mac OS 10.4 Xcode
manual says it doesn't. Anyway we create copies of them and save
- it in `deferred_apple_events'. */
+ them in `deferred_apple_events'. */
if (err == noErr)
{
if (deferred_apple_events.buf == NULL)
@@ -1018,20 +1018,13 @@ defer_apple_events (apple_event, reply)
deferred_apple_events.count = 0;
deferred_apple_events.buf =
xmalloc (sizeof (AppleEvent) * deferred_apple_events.size);
- if (deferred_apple_events.buf == NULL)
- err = memFullErr;
}
else if (deferred_apple_events.count == deferred_apple_events.size)
{
- AppleEvent *newbuf;
-
deferred_apple_events.size *= 2;
- newbuf = xrealloc (deferred_apple_events.buf,
- sizeof (AppleEvent) * deferred_apple_events.size);
- if (newbuf)
- deferred_apple_events.buf = newbuf;
- else
- err = memFullErr;
+ deferred_apple_events.buf
+ = xrealloc (deferred_apple_events.buf,
+ sizeof (AppleEvent) * deferred_apple_events.size);
}
}
@@ -1123,11 +1116,8 @@ DEFUN ("mac-process-deferred-apple-events", Fmac_process_deferred_apple_events,
doc: /* Process Apple events that are deferred at the startup time. */)
()
{
- OSErr err;
Lisp_Object result = Qnil;
- long i, count;
- AppleEvent apple_event, reply;
- AEKeyword keyword;
+ long i;
if (mac_ready_for_apple_events)
return Qnil;
@@ -1192,29 +1182,21 @@ copy_scrap_flavor_data (from_scrap, to_scrap, flavor_type)
buf = NULL;
}
else if (size_allocated < size)
- {
- char *newbuf = xrealloc (buf, size);
-
- if (newbuf)
- buf = newbuf;
- else
- {
- xfree (buf);
- buf = NULL;
- }
- }
+ buf = xrealloc (buf, size);
else
break;
}
if (err == noErr)
- if (buf == NULL)
- err = memFullErr;
- else
- {
- err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone,
- size, buf);
- xfree (buf);
- }
+ {
+ if (buf == NULL)
+ err = memFullErr;
+ else
+ {
+ err = PutScrapFlavor (to_scrap, flavor_type, kScrapFlavorMaskNone,
+ size, buf);
+ xfree (buf);
+ }
+ }
return err;
}
@@ -1300,14 +1282,11 @@ mac_handle_service_event (call_ref, event, data)
err = GetScrapFlavorCount (cur_scrap, &count);
if (err == noErr)
flavor_info = xmalloc (sizeof (ScrapFlavorInfo) * count);
- if (flavor_info)
+ err = GetScrapFlavorInfoList (cur_scrap, &count, flavor_info);
+ if (err != noErr)
{
- err = GetScrapFlavorInfoList (cur_scrap, &count, flavor_info);
- if (err != noErr)
- {
- xfree (flavor_info);
- flavor_info = NULL;
- }
+ xfree (flavor_info);
+ flavor_info = NULL;
}
if (flavor_info == NULL)
break;
diff --git a/src/macterm.c b/src/macterm.c
index 7c946a9fd3f..5696f13e5a0 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -77,7 +77,6 @@ Boston, MA 02110-1301, USA. */
#include "termhooks.h"
#include "termopts.h"
#include "termchar.h"
-#include "gnu.h"
#include "disptab.h"
#include "buffer.h"
#include "window.h"
@@ -215,7 +214,6 @@ QDGlobals qd; /* QuickDraw global information structure. */
struct mac_display_info *mac_display_info_for_display (Display *);
static void x_update_window_end P_ ((struct window *, int, int));
-static int x_io_error_quitter P_ ((Display *));
int x_catch_errors P_ ((Display *));
void x_uncatch_errors P_ ((Display *, int));
void x_lower_frame P_ ((struct frame *));
@@ -1510,11 +1508,8 @@ XCreateGC (display, window, mask, xgcv)
{
GC gc = xmalloc (sizeof (*gc));
- if (gc)
- {
- bzero (gc, sizeof (*gc));
- XChangeGC (display, gc, mask, xgcv);
- }
+ bzero (gc, sizeof (*gc));
+ XChangeGC (display, gc, mask, xgcv);
return gc;
}
@@ -1697,14 +1692,6 @@ XSetWindowBackground (display, w, color)
#endif
}
-/* x_sync is a no-op on Mac. */
-void
-x_sync (f)
- void *f;
-{
-}
-
-
/* Flush display of frame F, or of all frames if F is null. */
static void
@@ -2080,7 +2067,6 @@ mac_define_fringe_bitmap (which, bits, h, wd)
unsigned short *bits;
int h, wd;
{
- unsigned short *mask_bits;
int i;
CGDataProviderRef provider;
@@ -2171,21 +2157,17 @@ x_per_char_metric (font, char2b)
if (*row == NULL)
{
*row = xmalloc (sizeof (XCharStructRow));
- if (*row)
- bzero (*row, sizeof (XCharStructRow));
+ bzero (*row, sizeof (XCharStructRow));
}
- if (*row)
+ pcm = (*row)->per_char + char2b->byte2;
+ if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2))
{
- pcm = (*row)->per_char + char2b->byte2;
- if (!XCHARSTRUCTROW_CHAR_VALID_P (*row, char2b->byte2))
- {
- BLOCK_INPUT;
- mac_query_char_extents (font->mac_style,
- (char2b->byte1 << 8) + char2b->byte2,
- NULL, NULL, pcm, NULL);
- UNBLOCK_INPUT;
- XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
- }
+ BLOCK_INPUT;
+ mac_query_char_extents (font->mac_style,
+ (char2b->byte1 << 8) + char2b->byte2,
+ NULL, NULL, pcm, NULL);
+ UNBLOCK_INPUT;
+ XCHARSTRUCTROW_SET_CHAR_VALID (*row, char2b->byte2);
}
}
else
@@ -2366,7 +2348,6 @@ static void x_setup_relief_colors P_ ((struct glyph_string *));
static void x_draw_image_glyph_string P_ ((struct glyph_string *));
static void x_draw_image_relief P_ ((struct glyph_string *));
static void x_draw_image_foreground P_ ((struct glyph_string *));
-static void x_draw_image_foreground_1 P_ ((struct glyph_string *, Pixmap));
static void x_clear_glyph_string_rect P_ ((struct glyph_string *, int,
int, int, int));
static void x_draw_relief_rect P_ ((struct frame *, int, int, int, int,
@@ -2567,34 +2548,36 @@ static void
mac_compute_glyph_string_overhangs (s)
struct glyph_string *s;
{
- if (s->cmp == NULL
- && s->first_glyph->type == CHAR_GLYPH)
- if (!s->two_byte_p
+ if (!(s->cmp == NULL
+ && s->first_glyph->type == CHAR_GLYPH))
+ return;
+
+ if (!s->two_byte_p
#if USE_ATSUI
- || s->font->mac_style
+ || s->font->mac_style
#endif
- )
- {
- XCharStruct cs;
+ )
+ {
+ XCharStruct cs;
- mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs);
- s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0;
- s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0;
- }
- else
- {
- Rect r;
- MacFontStruct *font = s->font;
+ mac_text_extents_16 (s->font, s->char2b, s->nchars, &cs);
+ s->right_overhang = cs.rbearing > cs.width ? cs.rbearing - cs.width : 0;
+ s->left_overhang = cs.lbearing < 0 ? -cs.lbearing : 0;
+ }
+ else
+ {
+ Rect r;
+ MacFontStruct *font = s->font;
- TextFont (font->mac_fontnum);
- TextSize (font->mac_fontsize);
- TextFace (font->mac_fontface);
+ TextFont (font->mac_fontnum);
+ TextSize (font->mac_fontsize);
+ TextFace (font->mac_fontface);
- QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
+ QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
- s->right_overhang = r.right > s->width ? r.right - s->width : 0;
- s->left_overhang = r.left < 0 ? -r.left : 0;
- }
+ s->right_overhang = r.right > s->width ? r.right - s->width : 0;
+ s->left_overhang = r.left < 0 ? -r.left : 0;
+ }
}
@@ -3430,7 +3413,6 @@ x_draw_image_glyph_string (s)
int box_line_hwidth = abs (s->face->box_line_width);
int box_line_vwidth = max (s->face->box_line_width, 0);
int height;
- Pixmap pixmap = 0;
height = s->height - 2 * box_line_vwidth;
@@ -4176,142 +4158,6 @@ x_frame_rehighlight (dpyinfo)
-/* Keyboard processing - modifier keys, vendor-specific keysyms, etc. */
-
-#if 0 /* MAC_TODO */
-/* Initialize mode_switch_bit and modifier_meaning. */
-static void
-x_find_modifier_meanings (dpyinfo)
- struct x_display_info *dpyinfo;
-{
- int min_code, max_code;
- KeySym *syms;
- int syms_per_code;
- XModifierKeymap *mods;
-
- dpyinfo->meta_mod_mask = 0;
- dpyinfo->shift_lock_mask = 0;
- dpyinfo->alt_mod_mask = 0;
- dpyinfo->super_mod_mask = 0;
- dpyinfo->hyper_mod_mask = 0;
-
-#ifdef HAVE_X11R4
- XDisplayKeycodes (dpyinfo->display, &min_code, &max_code);
-#else
- min_code = dpyinfo->display->min_keycode;
- max_code = dpyinfo->display->max_keycode;
-#endif
-
- syms = XGetKeyboardMapping (dpyinfo->display,
- min_code, max_code - min_code + 1,
- &syms_per_code);
- mods = XGetModifierMapping (dpyinfo->display);
-
- /* Scan the modifier table to see which modifier bits the Meta and
- Alt keysyms are on. */
- {
- int row, col; /* The row and column in the modifier table. */
-
- for (row = 3; row < 8; row++)
- for (col = 0; col < mods->max_keypermod; col++)
- {
- KeyCode code
- = mods->modifiermap[(row * mods->max_keypermod) + col];
-
- /* Zeroes are used for filler. Skip them. */
- if (code == 0)
- continue;
-
- /* Are any of this keycode's keysyms a meta key? */
- {
- int code_col;
-
- for (code_col = 0; code_col < syms_per_code; code_col++)
- {
- int sym = syms[((code - min_code) * syms_per_code) + code_col];
-
- switch (sym)
- {
- case XK_Meta_L:
- case XK_Meta_R:
- dpyinfo->meta_mod_mask |= (1 << row);
- break;
-
- case XK_Alt_L:
- case XK_Alt_R:
- dpyinfo->alt_mod_mask |= (1 << row);
- break;
-
- case XK_Hyper_L:
- case XK_Hyper_R:
- dpyinfo->hyper_mod_mask |= (1 << row);
- break;
-
- case XK_Super_L:
- case XK_Super_R:
- dpyinfo->super_mod_mask |= (1 << row);
- break;
-
- case XK_Shift_Lock:
- /* Ignore this if it's not on the lock modifier. */
- if ((1 << row) == LockMask)
- dpyinfo->shift_lock_mask = LockMask;
- break;
- }
- }
- }
- }
- }
-
- /* If we couldn't find any meta keys, accept any alt keys as meta keys. */
- if (! dpyinfo->meta_mod_mask)
- {
- dpyinfo->meta_mod_mask = dpyinfo->alt_mod_mask;
- dpyinfo->alt_mod_mask = 0;
- }
-
- /* If some keys are both alt and meta,
- make them just meta, not alt. */
- if (dpyinfo->alt_mod_mask & dpyinfo->meta_mod_mask)
- {
- dpyinfo->alt_mod_mask &= ~dpyinfo->meta_mod_mask;
- }
-
- XFree ((char *) syms);
- XFreeModifiermap (mods);
-}
-
-#endif /* MAC_TODO */
-
-/* Convert between the modifier bits X uses and the modifier bits
- Emacs uses. */
-
-static unsigned int
-x_mac_to_emacs_modifiers (dpyinfo, state)
- struct x_display_info *dpyinfo;
- unsigned short state;
-{
- return (((state & shiftKey) ? shift_modifier : 0)
- | ((state & controlKey) ? ctrl_modifier : 0)
- | ((state & cmdKey) ? meta_modifier : 0)
- | ((state & optionKey) ? alt_modifier : 0));
-}
-
-#if 0 /* MAC_TODO */
-static unsigned short
-x_emacs_to_x_modifiers (dpyinfo, state)
- struct x_display_info *dpyinfo;
- unsigned int state;
-{
- return ( ((state & alt_modifier) ? dpyinfo->alt_mod_mask : 0)
- | ((state & super_modifier) ? dpyinfo->super_mod_mask : 0)
- | ((state & hyper_modifier) ? dpyinfo->hyper_mod_mask : 0)
- | ((state & shift_modifier) ? ShiftMask : 0)
- | ((state & ctrl_modifier) ? ControlMask : 0)
- | ((state & meta_modifier) ? dpyinfo->meta_mod_mask : 0));
-}
-#endif /* MAC_TODO */
-
/* Convert a keysym to its name. */
char *
@@ -5102,41 +4948,43 @@ XTset_vertical_scroll_bar (w, portion, whole, position)
#ifdef USE_TOOLKIT_SCROLL_BARS
if (NILP (bar->track_top))
- if (sb_width >= disp_height)
- {
- XSETINT (bar->track_top, 0);
- XSETINT (bar->track_height, 0);
- }
- else
- {
- ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
- Rect r0, r1;
+ {
+ if (sb_width >= disp_height)
+ {
+ XSETINT (bar->track_top, 0);
+ XSETINT (bar->track_height, 0);
+ }
+ else
+ {
+ ControlHandle ch = SCROLL_BAR_CONTROL_HANDLE (bar);
+ Rect r0, r1;
- BLOCK_INPUT;
+ BLOCK_INPUT;
- SetControl32BitMinimum (ch, 0);
- SetControl32BitMaximum (ch, 1);
- SetControlViewSize (ch, 1);
+ SetControl32BitMinimum (ch, 0);
+ SetControl32BitMaximum (ch, 1);
+ SetControlViewSize (ch, 1);
- /* Move the scroll bar thumb to the top. */
- SetControl32BitValue (ch, 0);
- get_control_part_bounds (ch, kControlIndicatorPart, &r0);
+ /* Move the scroll bar thumb to the top. */
+ SetControl32BitValue (ch, 0);
+ get_control_part_bounds (ch, kControlIndicatorPart, &r0);
- /* Move the scroll bar thumb to the bottom. */
- SetControl32BitValue (ch, 1);
- get_control_part_bounds (ch, kControlIndicatorPart, &r1);
+ /* Move the scroll bar thumb to the bottom. */
+ SetControl32BitValue (ch, 1);
+ get_control_part_bounds (ch, kControlIndicatorPart, &r1);
- UnionRect (&r0, &r1, &r0);
- XSETINT (bar->track_top, r0.top);
- XSETINT (bar->track_height, r0.bottom - r0.top);
+ UnionRect (&r0, &r1, &r0);
+ XSETINT (bar->track_top, r0.top);
+ XSETINT (bar->track_height, r0.bottom - r0.top);
- /* Don't show the scroll bar if its height is not enough to
- display the scroll bar thumb. */
- if (r0.bottom - r0.top > 0)
- ShowControl (ch);
+ /* Don't show the scroll bar if its height is not enough to
+ display the scroll bar thumb. */
+ if (r0.bottom - r0.top > 0)
+ ShowControl (ch);
- UNBLOCK_INPUT;
- }
+ UNBLOCK_INPUT;
+ }
+ }
x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole);
#else /* not USE_TOOLKIT_SCROLL_BARS */
@@ -6205,10 +6053,12 @@ mac_handle_visibility_change (f)
struct input_event buf;
if (IsWindowVisible (wp))
- if (IsWindowCollapsed (wp))
- iconified = 1;
- else
- visible = 1;
+ {
+ if (IsWindowCollapsed (wp))
+ iconified = 1;
+ else
+ visible = 1;
+ }
if (!f->async_visible && visible)
{
@@ -6254,9 +6104,6 @@ void
x_make_frame_visible (f)
struct frame *f;
{
- Lisp_Object type;
- int original_top, original_left;
-
BLOCK_INPUT;
if (! FRAME_VISIBLE_P (f))
@@ -6267,27 +6114,29 @@ x_make_frame_visible (f)
before the window gets really visible. */
if (! FRAME_ICONIFIED_P (f)
&& ! f->output_data.mac->asked_for_visible)
+ {
#if TARGET_API_MAC_CARBON
- if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition)))
- {
- struct frame *sf = SELECTED_FRAME ();
- if (!FRAME_MAC_P (sf))
- RepositionWindow (FRAME_MAC_WINDOW (f), NULL,
- kWindowCenterOnMainScreen);
- else
- RepositionWindow (FRAME_MAC_WINDOW (f),
- FRAME_MAC_WINDOW (sf),
+ if (!(FRAME_SIZE_HINTS (f)->flags & (USPosition | PPosition)))
+ {
+ struct frame *sf = SELECTED_FRAME ();
+ if (!FRAME_MAC_P (sf))
+ RepositionWindow (FRAME_MAC_WINDOW (f), NULL,
+ kWindowCenterOnMainScreen);
+ else
+ RepositionWindow (FRAME_MAC_WINDOW (f),
+ FRAME_MAC_WINDOW (sf),
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1020
- kWindowCascadeStartAtParentWindowScreen
+ kWindowCascadeStartAtParentWindowScreen
#else
- kWindowCascadeOnParentWindowScreen
+ kWindowCascadeOnParentWindowScreen
#endif
- );
- x_real_positions (f, &f->left_pos, &f->top_pos);
- }
- else
+ );
+ x_real_positions (f, &f->left_pos, &f->top_pos);
+ }
+ else
#endif
- x_set_offset (f, f->left_pos, f->top_pos, 0);
+ x_set_offset (f, f->left_pos, f->top_pos, 0);
+ }
f->output_data.mac->asked_for_visible = 1;
@@ -6707,12 +6556,7 @@ xlfdpat_create (pattern)
struct xlfdpat_block *blk;
pat = xmalloc (sizeof (struct xlfdpat));
- if (pat == NULL)
- goto error;
-
pat->buf = xmalloc (strlen (pattern) + 1);
- if (pat->buf == NULL)
- goto error;
/* Normalize the pattern string and store it to `pat->buf'. */
nblocks = 0;
@@ -6730,15 +6574,17 @@ xlfdpat_create (pattern)
else
{
if (last_char == '?')
- if (anychar_head > pat->buf && *(anychar_head - 1) == '*')
- /* ...*??* -> ...*?? */
- continue;
- else
- /* ...a??* -> ...a*?? */
- {
- *anychar_head++ = '*';
- c = '?';
- }
+ {
+ if (anychar_head > pat->buf && *(anychar_head - 1) == '*')
+ /* ...*??* -> ...*?? */
+ continue;
+ else
+ /* ...a??* -> ...a*?? */
+ {
+ *anychar_head++ = '*';
+ c = '?';
+ }
+ }
nblocks++;
}
else if (c == '?')
@@ -6774,8 +6620,6 @@ xlfdpat_create (pattern)
}
pat->blocks = xmalloc (sizeof (struct xlfdpat_block) * nblocks);
- if (pat->blocks == NULL)
- goto error;
/* Divide the normalized pattern into blocks. */
p = pat->buf;
@@ -7235,9 +7079,10 @@ init_font_name_table ()
Qnil, Qnil, Qnil);;
err = ATSUFontCount (&nfonts);
if (err == noErr)
- font_ids = xmalloc (sizeof (ATSUFontID) * nfonts);
- if (font_ids)
- err = ATSUGetFontIDs (font_ids, nfonts, NULL);
+ {
+ font_ids = xmalloc (sizeof (ATSUFontID) * nfonts);
+ err = ATSUGetFontIDs (font_ids, nfonts, NULL);
+ }
if (err == noErr)
for (i = 0; i < nfonts; i++)
{
@@ -7247,8 +7092,6 @@ init_font_name_table ()
if (err != noErr)
continue;
name = xmalloc (name_len + 1);
- if (name == NULL)
- continue;
name[name_len] = '\0';
err = ATSUFindFontName (font_ids[i], kFontFamilyName,
kFontMacintoshPlatform, kFontNoScript,
@@ -7569,7 +7412,7 @@ mac_do_list_fonts (pattern, maxnames)
if (xlfdpat_match (pat, font_name_table[i]))
{
font_list = Fcons (build_string (font_name_table[i]), font_list);
- if (exact || maxnames > 0 && ++n_fonts >= maxnames)
+ if (exact || (maxnames > 0 && ++n_fonts >= maxnames))
break;
}
else if (scl_val[XLFD_SCL_PIXEL_SIZE] > 0
@@ -7578,8 +7421,6 @@ mac_do_list_fonts (pattern, maxnames)
int former_len = ptr - font_name_table[i];
scaled = xmalloc (strlen (font_name_table[i]) + 20 + 1);
- if (scaled == NULL)
- continue;
memcpy (scaled, font_name_table[i], former_len);
sprintf (scaled + former_len,
"-%d-%d-72-72-m-%d-%s",
@@ -7592,7 +7433,7 @@ mac_do_list_fonts (pattern, maxnames)
{
font_list = Fcons (build_string (scaled), font_list);
xfree (scaled);
- if (exact || maxnames > 0 && ++n_fonts >= maxnames)
+ if (exact || (maxnames > 0 && ++n_fonts >= maxnames))
break;
}
else
@@ -7912,18 +7753,8 @@ XLoadQueryFont (Display *dpy, char *fontname)
font->max_char_or_byte2 = 0xff;
font->bounds.rows = xmalloc (sizeof (XCharStructRow *) * 0x100);
- if (font->bounds.rows == NULL)
- {
- mac_unload_font (&one_mac_display_info, font);
- return NULL;
- }
bzero (font->bounds.rows, sizeof (XCharStructRow *) * 0x100);
font->bounds.rows[0] = xmalloc (sizeof (XCharStructRow));
- if (font->bounds.rows[0] == NULL)
- {
- mac_unload_font (&one_mac_display_info, font);
- return NULL;
- }
bzero (font->bounds.rows[0], sizeof (XCharStructRow));
#if USE_CG_TEXT_DRAWING
@@ -7945,9 +7776,10 @@ XLoadQueryFont (Display *dpy, char *fontname)
}
if (font->cg_font)
- font->cg_glyphs = xmalloc (sizeof (CGGlyph) * 0x100);
- if (font->cg_glyphs)
- bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
+ {
+ font->cg_glyphs = xmalloc (sizeof (CGGlyph) * 0x100);
+ bzero (font->cg_glyphs, sizeof (CGGlyph) * 0x100);
+ }
#endif
space_bounds = font->bounds.rows[0]->per_char + 0x20;
err = mac_query_char_extents (font->mac_style, 0x20,
@@ -8093,11 +7925,6 @@ XLoadQueryFont (Display *dpy, char *fontname)
font->bounds.per_char =
xmalloc (sizeof (XCharStruct) * (0xff - 0x20 + 1));
- if (font->bounds.per_char == NULL)
- {
- mac_unload_font (&one_mac_display_info, font);
- return NULL;
- }
bzero (font->bounds.per_char,
sizeof (XCharStruct) * (0xff - 0x20 + 1));
@@ -8241,10 +8068,8 @@ x_load_font (f, fontname, size)
/* Load the font and add it to the table. */
{
- char *full_name;
struct MacFontStruct *font;
struct font_info *fontp;
- unsigned long value;
int i;
fontname = (char *) SDATA (XCAR (font_names));
@@ -8756,6 +8581,7 @@ static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec)
#endif
+#ifdef MAC_OS8
static void
do_get_menus (void)
{
@@ -8817,6 +8643,7 @@ do_check_ram_size (void)
exit (1);
}
}
+#endif /* MAC_OS8 */
static void
do_window_update (WindowPtr win)
@@ -8998,42 +8825,41 @@ do_grow_window (WindowPtr w, EventRecord *e)
static void
do_zoom_window (WindowPtr w, int zoom_in_or_out)
{
- GrafPtr save_port;
Rect zoom_rect, port_rect;
- Point top_left;
- int w_title_height, columns, rows, width, height;
+ int columns, rows, width, height;
struct frame *f = mac_window_to_frame (w);
struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
-
#if TARGET_API_MAC_CARBON
- {
- Point standard_size;
+ Point standard_size;
- standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
- standard_size.v = dpyinfo->height;
+ standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS);
+ standard_size.v = dpyinfo->height;
- if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
- zoom_in_or_out = inZoomIn;
- else
- {
- /* Adjust the standard size according to character boundaries. */
-
- columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
- rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
- standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
- standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
- GetWindowBounds (w, kWindowContentRgn, &port_rect);
- if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
- && port_rect.left == zoom_rect.left
- && port_rect.top == zoom_rect.top)
- zoom_in_or_out = inZoomIn;
- else
- zoom_in_or_out = inZoomOut;
- }
+ if (IsWindowInStandardState (w, &standard_size, &zoom_rect))
+ zoom_in_or_out = inZoomIn;
+ else
+ {
+ /* Adjust the standard size according to character boundaries. */
- ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
- }
+ columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, zoom_rect.right - zoom_rect.left);
+ rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, zoom_rect.bottom - zoom_rect.top);
+ standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns);
+ standard_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows);
+ GetWindowBounds (w, kWindowContentRgn, &port_rect);
+ if (IsWindowInStandardState (w, &standard_size, &zoom_rect)
+ && port_rect.left == zoom_rect.left
+ && port_rect.top == zoom_rect.top)
+ zoom_in_or_out = inZoomIn;
+ else
+ zoom_in_or_out = inZoomOut;
+ }
+
+ ZoomWindowIdeal (w, zoom_in_or_out, &standard_size);
#else /* not TARGET_API_MAC_CARBON */
+ GrafPtr save_port;
+ Point top_left;
+ int w_title_height;
+
GetPort (&save_port);
SetPortWindowPort (w);
@@ -9101,15 +8927,12 @@ mac_store_apple_event (class, id, desc)
Lisp_Object class, id;
const AEDesc *desc;
{
- OSErr err = noErr;
+ OSErr err;
struct input_event buf;
AEDesc *desc_copy;
desc_copy = xmalloc (sizeof (AEDesc));
- if (desc_copy == NULL)
- err = memFullErr;
- else
- err = AEDuplicateDesc (desc, desc_copy);
+ err = AEDuplicateDesc (desc, desc_copy);
if (err == noErr)
{
EVENT_INIT (buf);
@@ -9168,26 +8991,27 @@ mac_handle_command_event (next_handler, event, data)
mac_find_apple_event_spec (0, command.commandID,
&class_key, &id_key, &binding);
if (!NILP (binding) && !EQ (binding, Qundefined))
- if (INTEGERP (binding))
- return XINT (binding);
- else
- {
- AppleEvent apple_event;
- UInt32 modifiers;
- static EventParamName names[] = {kEventParamDirectObject,
- kEventParamKeyModifiers};
- static EventParamType types[] = {typeHICommand,
- typeUInt32};
- err = create_apple_event_from_event_ref (event, 2, names, types,
- &apple_event);
- if (err == noErr)
- {
- err = mac_store_apple_event (class_key, id_key, &apple_event);
- AEDisposeDesc (&apple_event);
- }
- if (err == noErr)
- return noErr;
- }
+ {
+ if (INTEGERP (binding))
+ return XINT (binding);
+ else
+ {
+ AppleEvent apple_event;
+ static EventParamName names[] = {kEventParamDirectObject,
+ kEventParamKeyModifiers};
+ static EventParamType types[] = {typeHICommand,
+ typeUInt32};
+ err = create_apple_event_from_event_ref (event, 2, names, types,
+ &apple_event);
+ if (err == noErr)
+ {
+ err = mac_store_apple_event (class_key, id_key, &apple_event);
+ AEDisposeDesc (&apple_event);
+ }
+ if (err == noErr)
+ return noErr;
+ }
+ }
return eventNotHandledErr;
}
@@ -9195,7 +9019,6 @@ mac_handle_command_event (next_handler, event, data)
static OSErr
init_command_handler ()
{
- OSErr err = noErr;
EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}};
static EventHandlerUPP handle_command_eventUPP = NULL;
@@ -10071,18 +9894,18 @@ XTread_socket (sd, expected, hold_quit)
XSETINT (inev.x, mouse_loc.h);
XSETINT (inev.y, mouse_loc.v);
- if (dpyinfo->grabbed && tracked_scroll_bar
- || ch != 0
+ if ((dpyinfo->grabbed && tracked_scroll_bar)
+ || (ch != 0
#ifndef USE_TOOLKIT_SCROLL_BARS
- /* control_part_code becomes kControlNoPart if
- a progress indicator is clicked. */
- && control_part_code != kControlNoPart
+ /* control_part_code becomes kControlNoPart if
+ a progress indicator is clicked. */
+ && control_part_code != kControlNoPart
#else /* USE_TOOLKIT_SCROLL_BARS */
#ifdef MAC_OSX
- && control_kind.kind == kControlKindScrollBar
+ && control_kind.kind == kControlKindScrollBar
#endif /* MAC_OSX */
#endif /* USE_TOOLKIT_SCROLL_BARS */
- )
+ ))
{
struct scroll_bar *bar;
@@ -10882,7 +10705,6 @@ mac_check_bundle()
extern int inhibit_window_system;
extern int noninteractive;
CFBundleRef appsBundle;
- pid_t child;
/* No need to test if already -nw*/
if (inhibit_window_system || noninteractive)
diff --git a/src/macterm.h b/src/macterm.h
index f6807d93487..db284fe7788 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -547,7 +547,15 @@ extern int XParseGeometry P_ ((char *, int *, int *, unsigned int *,
/* Defined in macterm.c. */
extern void x_set_window_size P_ ((struct frame *, int, int, int));
+extern void x_set_mouse_position P_ ((struct frame *, int, int));
+extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));
extern void x_make_frame_visible P_ ((struct frame *));
+extern void x_make_frame_invisible P_ ((struct frame *));
+extern void x_iconify_frame P_ ((struct frame *));
+extern void x_free_frame_resources P_ ((struct frame *));
+extern void x_destroy_window P_ ((struct frame *));
+extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
+extern void x_delete_display P_ ((struct x_display_info *));
extern void mac_initialize P_ ((void));
extern Pixmap XCreatePixmap P_ ((Display *, WindowPtr, unsigned int,
unsigned int, unsigned int));
@@ -557,6 +565,7 @@ extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowPtr, char *,
unsigned int));
extern void XFreePixmap P_ ((Display *, Pixmap));
extern GC XCreateGC P_ ((Display *, Window, unsigned long, XGCValues *));
+extern void XFreeGC P_ ((Display *, GC));
extern void XSetForeground P_ ((Display *, GC, unsigned long));
extern void XSetBackground P_ ((Display *, GC, unsigned long));
extern void XSetWindowBackground P_ ((Display *, WindowPtr, unsigned long));
@@ -568,6 +577,7 @@ extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *));
extern OSErr install_window_handler P_ ((WindowPtr));
extern void remove_window_handler P_ ((WindowPtr));
extern Lisp_Object mac_make_lispy_event_code P_ ((int));
+extern void do_menu_choice P_ ((SInt32));
#if USE_CG_DRAWING
extern void mac_prepare_for_quickdraw P_ ((struct frame *));
#endif
@@ -581,6 +591,24 @@ extern void mac_prepare_for_quickdraw P_ ((struct frame *));
extern void x_clear_frame_selections P_ ((struct frame *));
+/* Defined in macfns.c */
+
+extern int have_menus_p P_ ((void));
+
+extern void x_real_positions P_ ((struct frame *, int *, int *));
+extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
+extern int x_pixel_width P_ ((struct frame *));
+extern int x_pixel_height P_ ((struct frame *));
+extern int x_char_width P_ ((struct frame *));
+extern int x_char_height P_ ((struct frame *));
+extern void x_sync P_ ((struct frame *));
+extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
+
+/* Defined in macmenu.c */
+
+extern void x_activate_menubar P_ ((struct frame *));
+extern void free_frame_menubar P_ ((struct frame *));
+
/* Defined in mac.c. */
extern void mac_clear_font_name_table P_ ((void));
diff --git a/src/print.c b/src/print.c
index 7e9ed30c32b..12960ef214d 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,
doc: /* Return a string containing the printed representation of OBJECT.
OBJECT can be any Lisp object. This function outputs quoting characters
when necessary to make output that `read' can handle, whenever possible,
-unless the optional second argument NOESCAPE is non-nil.
+unless the optional second argument NOESCAPE is non-nil. For complex objects,
+the behavior is controlled by `print-level' and `print-length', which see.
OBJECT is any of the Lisp data types: a number, a string, a symbol,
a list, a buffer, a window, a frame, etc.
diff --git a/src/process.c b/src/process.c
index 003f27b77b8..6e633a5825c 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2322,7 +2322,11 @@ get_lisp_to_sockaddr_size (address, familyp)
}
/* Convert an address object (vector or string) to an internal sockaddr.
- Format of address has already been validated by size_lisp_to_sockaddr. */
+
+ The address format has been basically validated by
+ get_lisp_to_sockaddr_size, but this does not mean FAMILY is valid;
+ it could have come from user data. So if FAMILY is not valid,
+ we return after zeroing *SA. */
static void
conv_lisp_to_sockaddr (family, address, sa, len)
@@ -2336,7 +2340,6 @@ conv_lisp_to_sockaddr (family, address, sa, len)
register int i;
bzero (sa, len);
- sa->sa_family = family;
if (VECTORP (address))
{
@@ -2348,6 +2351,7 @@ conv_lisp_to_sockaddr (family, address, sa, len)
i = XINT (p->contents[--len]);
sin->sin_port = htons (i);
cp = (unsigned char *)&sin->sin_addr;
+ sa->sa_family = family;
}
#ifdef AF_INET6
else if (family == AF_INET6)
@@ -2363,9 +2367,10 @@ conv_lisp_to_sockaddr (family, address, sa, len)
int j = XFASTINT (p->contents[i]) & 0xffff;
ip6[i] = ntohs (j);
}
- return;
+ sa->sa_family = family;
}
#endif
+ return;
}
else if (STRINGP (address))
{
@@ -2376,6 +2381,7 @@ conv_lisp_to_sockaddr (family, address, sa, len)
cp = SDATA (address);
for (i = 0; i < sizeof (sockun->sun_path) && *cp; i++)
sockun->sun_path[i] = *cp++;
+ sa->sa_family = family;
}
#endif
return;
@@ -6236,6 +6242,8 @@ text to PROCESS after you call this function. */)
emacs_close (XINT (XPROCESS (proc)->outfd));
#endif /* not HAVE_SHUTDOWN */
new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0);
+ if (new_outfd < 0)
+ abort ();
old_outfd = XINT (XPROCESS (proc)->outfd);
if (!proc_encode_coding_system[new_outfd])
diff --git a/src/puresize.h b/src/puresize.h
index 168e1e7980a..ccbc7a82554 100644
--- a/src/puresize.h
+++ b/src/puresize.h
@@ -49,7 +49,7 @@ Boston, MA 02110-1301, USA. */
/* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */
#ifndef PURESIZE_RATIO
#if BITS_PER_EMACS_INT > 32
-#define PURESIZE_RATIO 9/5 /* Don't surround with `()'. */
+#define PURESIZE_RATIO 10/6 /* Don't surround with `()'. */
#else
#define PURESIZE_RATIO 1
#endif
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 3e5d9c865bb..55f62644d04 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -465,8 +465,10 @@ extern char *get_emacs_configuration_options (void);
#endif
#include <string.h>
-/* We need a little extra space, see ../../lisp/loadup.el */
-#define SYSTEM_PURESIZE_EXTRA 137500
+/* We need a little extra space, see ../../lisp/loadup.el.
+ The number below comes from 22038 bytes worth (as of 2006-04)
+ of w32-specific files loaded by loadup.el, plus 2K spare. */
+#define SYSTEM_PURESIZE_EXTRA 24000
/* For unexec to work on Alpha systems, we need to put Emacs'
initialized data into a separate section from the CRT initialized
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. */
#if defined (__ppc__)
#include <mach-o/ppc/reloc.h>
#endif
-#if defined (HAVE_MALLOC_MALLOC_H)
+#include <config.h>
+#undef malloc
+#undef realloc
+#undef free
+#ifdef HAVE_MALLOC_MALLOC_H
#include <malloc/malloc.h>
#else
#include <objc/malloc.h>
@@ -558,7 +562,7 @@ print_load_command (struct load_command *lc)
static void
read_load_commands ()
{
- int n, i, j;
+ int i;
if (!unexec_read (&mh, sizeof (struct mach_header)))
unexec_error ("cannot read mach-o header");
@@ -680,7 +684,6 @@ copy_data_segment (struct load_command *lc)
struct section *sectp;
int j;
unsigned long header_offset, file_offset, old_file_offset;
- struct region_t *r;
printf ("Writing segment %-16.16s at %#8x - %#8x (sz: %#8x)\n",
scp->segname, scp->fileoff, scp->fileoff + scp->filesize,
diff --git a/src/window.c b/src/window.c
index cbfc7e02401..61b85e5ad22 100644
--- a/src/window.c
+++ b/src/window.c
@@ -663,12 +663,24 @@ coordinates_in_window (w, x, y)
|| WINDOW_RIGHTMOST_P (w))
{
if (!WINDOW_LEFTMOST_P (w) && abs (*x - x0) < grabbable_width)
- return ON_VERTICAL_BORDER;
+ {
+ /* Convert X and Y to window relative coordinates.
+ Vertical border is at the left edge of window. */
+ *x = max (0, *x - x0);
+ *y -= top_y;
+ return ON_VERTICAL_BORDER;
+ }
}
else
{
if (abs (*x - x1) < grabbable_width)
- return ON_VERTICAL_BORDER;
+ {
+ /* Convert X and Y to window relative coordinates.
+ Vertical border is at the right edge of window. */
+ *x = min (x1, *x) - x0;
+ *y -= top_y;
+ return ON_VERTICAL_BORDER;
+ }
}
if (*x < x0 || *x >= x1)
@@ -710,7 +722,13 @@ coordinates_in_window (w, x, y)
&& !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
&& !WINDOW_RIGHTMOST_P (w)
&& (abs (*x - right_x) < grabbable_width))
- return ON_VERTICAL_BORDER;
+ {
+ /* Convert X and Y to window relative coordinates.
+ Vertical border is at the right edge of window. */
+ *x = min (right_x, *x) - left_x;
+ *y -= top_y;
+ return ON_VERTICAL_BORDER;
+ }
}
else
{
@@ -722,6 +740,8 @@ coordinates_in_window (w, x, y)
{
/* On the border on the right side of the window? Assume that
this area begins at RIGHT_X minus a canonical char width. */
+ *x = min (right_x, *x) - left_x;
+ *y -= top_y;
return ON_VERTICAL_BORDER;
}
}
@@ -2015,7 +2035,7 @@ window_loop (type, obj, mini, frames)
`obj & 1' means consider only full-width windows.
`obj & 2' means consider also dedicated windows. */
if (((XINT (obj) & 1) && !WINDOW_FULL_WIDTH_P (w))
- || (!(XINT (obj) & 2) && EQ (w->dedicated, Qt))
+ || (!(XINT (obj) & 2) && !NILP (w->dedicated))
/* Minibuffer windows are always ignored. */
|| MINI_WINDOW_P (w))
break;
@@ -2070,7 +2090,7 @@ window_loop (type, obj, mini, frames)
case GET_LARGEST_WINDOW:
{ /* nil `obj' means to ignore dedicated windows. */
/* Ignore dedicated windows and minibuffers. */
- if (MINI_WINDOW_P (w) || (NILP (obj) && EQ (w->dedicated, Qt)))
+ if (MINI_WINDOW_P (w) || (NILP (obj) && !NILP (w->dedicated)))
break;
if (NILP (best_window))
@@ -4257,18 +4277,30 @@ adjust_window_trailing_edge (window, delta, horiz_flag)
while (1)
{
+ Lisp_Object first_parallel = Qnil;
+
p = XWINDOW (window);
parent = p->parent;
- /* Make sure there is a following window. */
- if (NILP (parent)
- && (horiz_flag ? 1
- : NILP (XWINDOW (window)->next)))
+ if (NILP (XWINDOW (window)->next))
{
Fset_window_configuration (old_config);
error ("No other window following this one");
}
+ /* See if this level has windows in parallel in the specified
+ direction. If so, set FIRST_PARALLEL to the first one. */
+ if (horiz_flag)
+ {
+ if (! NILP (parent) && !NILP (XWINDOW (parent)->vchild))
+ first_parallel = XWINDOW (parent)->vchild;
+ }
+ else
+ {
+ if (! NILP (parent) && !NILP (XWINDOW (parent)->hchild))
+ first_parallel = XWINDOW (parent)->hchild;
+ }
+
/* Don't make this window too small. */
if (XINT (CURSIZE (window)) + delta
< (horiz_flag ? window_min_width : window_min_height))
@@ -4286,12 +4318,11 @@ adjust_window_trailing_edge (window, delta, horiz_flag)
XINT (CURSIZE (window)) + delta);
/* If this window has following siblings in the desired dimension,
- make them smaller.
+ make them smaller, and exit the loop.
+
(If we reach the top of the tree and can never do this,
we will fail and report an error, above.) */
- if (horiz_flag
- ? !NILP (XWINDOW (parent)->hchild)
- : !NILP (XWINDOW (parent)->vchild))
+ if (NILP (first_parallel))
{
if (!NILP (XWINDOW (window)->next))
{
@@ -4313,9 +4344,7 @@ adjust_window_trailing_edge (window, delta, horiz_flag)
else
/* Here we have a chain of parallel siblings, in the other dimension.
Change the size of the other siblings. */
- for (child = (horiz_flag
- ? XWINDOW (parent)->vchild
- : XWINDOW (parent)->hchild);
+ for (child = first_parallel;
! NILP (child);
child = XWINDOW (child)->next)
if (! EQ (child, window))
@@ -4856,7 +4885,7 @@ window_scroll_pixel_based (window, n, whole, noerror)
{
if (it.current_y < it.last_visible_y
&& (it.current_y + it.max_ascent + it.max_descent
- >= it.last_visible_y))
+ > it.last_visible_y))
{
/* The last line was only partially visible, make it fully
visible. */
diff --git a/src/xdisp.c b/src/xdisp.c
index fb80f349967..80b9ff6c8f6 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -14879,7 +14879,7 @@ dump_glyph_row (row, vpos, glyphs)
{
if (glyphs != 1)
{
- fprintf (stderr, "Row Start End Used oEI><\\CTZFesm X Y W H V A P\n");
+ fprintf (stderr, "Row Start End Used oE><\\CTZFesm X Y W H V A P\n");
fprintf (stderr, "======================================================================\n");
fprintf (stderr, "%3d %5d %5d %4d %1.1d%1.1d%1.1d%1.1d\
@@ -22371,7 +22371,10 @@ note_mouse_highlight (f, x, y)
}
if (part == ON_VERTICAL_BORDER)
- cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
+ {
+ cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
+ help_echo_string = make_string ("drag-mouse-1: resize", 20);
+ }
else if (part == ON_LEFT_FRINGE || part == ON_RIGHT_FRINGE
|| part == ON_SCROLL_BAR)
cursor = FRAME_X_OUTPUT (f)->nontext_cursor;
diff --git a/src/xfaces.c b/src/xfaces.c
index 27edd1a45dc..3222a7bdd91 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -4991,10 +4991,12 @@ Default face attributes override any local face attributes. */)
gvec = XVECTOR (global_lface)->contents;
for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
if (! UNSPECIFIEDP (gvec[i]))
- if (IGNORE_DEFFACE_P (gvec[i]))
- lvec[i] = Qunspecified;
- else
- lvec[i] = gvec[i];
+ {
+ if (IGNORE_DEFFACE_P (gvec[i]))
+ lvec[i] = Qunspecified;
+ else
+ lvec[i] = gvec[i];
+ }
return Qnil;
}
@@ -6814,20 +6816,22 @@ try_font_list (f, attrs, family, registry, fonts, prefer_face_family)
#ifdef MAC_OS
if (nfonts == 0 && STRINGP (try_family) && STRINGP (registry))
- if (xstricmp (SDATA (registry), "mac-roman") == 0)
- /* When realizing the default face and a font spec does not
- matched exactly, Emacs looks for ones with the same registry
- as the default font. On the Mac, this is mac-roman, which
- does not work if the family is -etl-fixed, e.g. The
- following widens the choices and fixes that problem. */
- nfonts = try_alternative_families (f, try_family, Qnil, fonts);
- else if (SBYTES (try_family) > 0
- && SREF (try_family, SBYTES (try_family) - 1) != '*')
- /* Some Central European/Cyrillic font family names have the
- Roman counterpart name as their prefix. */
- nfonts = try_alternative_families (f, concat2 (try_family,
- build_string ("*")),
- registry, fonts);
+ {
+ if (xstricmp (SDATA (registry), "mac-roman") == 0)
+ /* When realizing the default face and a font spec does not
+ matched exactly, Emacs looks for ones with the same registry
+ as the default font. On the Mac, this is mac-roman, which
+ does not work if the family is -etl-fixed, e.g. The
+ following widens the choices and fixes that problem. */
+ nfonts = try_alternative_families (f, try_family, Qnil, fonts);
+ else if (SBYTES (try_family) > 0
+ && SREF (try_family, SBYTES (try_family) - 1) != '*')
+ /* Some Central European/Cyrillic font family names have the
+ Roman counterpart name as their prefix. */
+ nfonts = try_alternative_families (f, concat2 (try_family,
+ build_string ("*")),
+ registry, fonts);
+ }
#endif
if (EQ (try_family, family))
diff --git a/src/xmenu.c b/src/xmenu.c
index 3c8c6d81a37..6e5ec6c5058 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -266,14 +266,15 @@ menubar_id_to_frame (id)
static void
init_menu_items ()
{
+ if (!NILP (menu_items_inuse))
+ error ("Trying to use a menu from within a menu-entry");
+
if (NILP (menu_items))
{
menu_items_allocated = 60;
menu_items = Fmake_vector (make_number (menu_items_allocated), Qnil);
}
- if (!NILP (menu_items_inuse))
- error ("Trying to use a menu from within a menu-entry");
menu_items_inuse = Qt;
menu_items_used = 0;
menu_items_n_panes = 0;
@@ -310,6 +311,39 @@ discard_menu_items ()
xassert (NILP (menu_items_inuse));
}
+/* This undoes save_menu_items, and it is called by the specpdl unwind
+ mechanism. */
+
+static Lisp_Object
+restore_menu_items (saved)
+ Lisp_Object saved;
+{
+ menu_items = XCAR (saved);
+ menu_items_inuse = (! NILP (menu_items) ? Qt : Qnil);
+ menu_items_allocated = (VECTORP (menu_items) ? ASIZE (menu_items) : 0);
+ saved = XCDR (saved);
+ menu_items_used = XINT (XCAR (saved));
+ saved = XCDR (saved);
+ menu_items_n_panes = XINT (XCAR (saved));
+ saved = XCDR (saved);
+ menu_items_submenu_depth = XINT (XCAR (saved));
+}
+
+/* Push the whole state of menu_items processing onto the specpdl.
+ It will be restored when the specpdl is unwound. */
+
+static void
+save_menu_items ()
+{
+ Lisp_Object saved = list4 (!NILP (menu_items_inuse) ? menu_items : Qnil,
+ make_number (menu_items_used),
+ make_number (menu_items_n_panes),
+ make_number (menu_items_submenu_depth));
+ record_unwind_protect (restore_menu_items, saved);
+ menu_items_inuse = Qnil;
+ menu_items = Qnil;
+}
+
/* Make the menu_items vector twice as large. */
static void
@@ -320,6 +354,7 @@ grow_menu_items ()
old = menu_items;
menu_items_allocated *= 2;
+
menu_items = Fmake_vector (make_number (menu_items_allocated), Qnil);
bcopy (XVECTOR (old)->contents, XVECTOR (menu_items)->contents,
old_size * sizeof (Lisp_Object));
@@ -1740,6 +1775,7 @@ digest_single_submenu (start, end, top_level_items)
int i;
int submenu_depth = 0;
widget_value **submenu_stack;
+ int panes_seen = 0;
submenu_stack
= (widget_value **) alloca (menu_items_used * sizeof (widget_value *));
@@ -1786,6 +1822,8 @@ digest_single_submenu (start, end, top_level_items)
Lisp_Object pane_name, prefix;
char *pane_string;
+ panes_seen++;
+
pane_name = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_NAME];
prefix = XVECTOR (menu_items)->contents[i + MENU_ITEMS_PANE_PREFIX];
@@ -1833,6 +1871,10 @@ digest_single_submenu (start, end, top_level_items)
Lisp_Object item_name, enable, descrip, def, type, selected;
Lisp_Object help;
+ /* All items should be contained in panes. */
+ if (panes_seen == 0)
+ abort ();
+
item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE);
descrip = AREF (menu_items, i + MENU_ITEMS_ITEM_EQUIV_KEY);
@@ -2067,7 +2109,6 @@ set_frame_menubar (f, first_time, deep_p)
specbind (Qdebug_on_next_call, Qnil);
record_unwind_save_match_data ();
- record_unwind_protect (unuse_menu_items, Qnil);
if (NILP (Voverriding_local_map_menu_flag))
{
specbind (Qoverriding_terminal_local_map, Qnil);
@@ -2095,6 +2136,8 @@ set_frame_menubar (f, first_time, deep_p)
/* Fill in menu_items with the current menu bar contents.
This can evaluate Lisp code. */
+ save_menu_items ();
+
menu_items = f->menu_bar_vector;
menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
submenu_start = (int *) alloca (XVECTOR (items)->size * sizeof (int *));
@@ -2154,23 +2197,33 @@ set_frame_menubar (f, first_time, deep_p)
}
set_buffer_internal_1 (prev);
- unbind_to (specpdl_count, Qnil);
/* If there has been no change in the Lisp-level contents
of the menu bar, skip redisplaying it. Just exit. */
+ /* Compare the new menu items with the ones computed last time. */
for (i = 0; i < previous_menu_items_used; i++)
if (menu_items_used == i
|| (!EQ (previous_items[i], XVECTOR (menu_items)->contents[i])))
break;
if (i == menu_items_used && i == previous_menu_items_used && i != 0)
{
+ /* The menu items have not changed. Don't bother updating
+ the menus in any form, since it would be a no-op. */
free_menubar_widget_value_tree (first_wv);
discard_menu_items ();
-
+ unbind_to (specpdl_count, Qnil);
return;
}
+ /* The menu items are different, so store them in the frame. */
+ f->menu_bar_vector = menu_items;
+ f->menu_bar_items_used = menu_items_used;
+
+ /* This calls restore_menu_items to restore menu_items, etc.,
+ as they were outside. */
+ unbind_to (specpdl_count, Qnil);
+
/* Now GC cannot happen during the lifetime of the widget_value,
so it's safe to store data from a Lisp_String. */
wv = first_wv->contents;
@@ -2185,9 +2238,6 @@ set_frame_menubar (f, first_time, deep_p)
wv = wv->next;
}
- f->menu_bar_vector = menu_items;
- f->menu_bar_items_used = menu_items_used;
- discard_menu_items ();
}
else
{