diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 188 | ||||
-rw-r--r-- | src/data.c | 7 | ||||
-rw-r--r-- | src/dispnew.c | 2 | ||||
-rw-r--r-- | src/fns.c | 6 | ||||
-rw-r--r-- | src/image.c | 25 | ||||
-rw-r--r-- | src/keyboard.c | 3 | ||||
-rw-r--r-- | src/lisp.h | 40 | ||||
-rw-r--r-- | src/mac.c | 54 | ||||
-rw-r--r-- | src/macfns.c | 49 | ||||
-rw-r--r-- | src/macmenu.c | 2 | ||||
-rw-r--r-- | src/macselect.c | 74 | ||||
-rw-r--r-- | src/macterm.c | 440 | ||||
-rw-r--r-- | src/macterm.h | 28 | ||||
-rw-r--r-- | src/print.c | 3 | ||||
-rw-r--r-- | src/process.c | 14 | ||||
-rw-r--r-- | src/puresize.h | 4 | ||||
-rw-r--r-- | src/s/ms-w32.h | 9 | ||||
-rw-r--r-- | src/search.c | 4 | ||||
-rw-r--r-- | src/unexmacosx.c | 9 | ||||
-rw-r--r-- | src/window.c | 20 | ||||
-rw-r--r-- | src/xdisp.c | 35 | ||||
-rw-r--r-- | src/xfaces.c | 10 | ||||
-rw-r--r-- | src/xrdb.c | 2 |
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 @@ +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. + +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. + + * data.c (wrong_type_argument): Try to avoid compiler warnings due + to the fact the function is now marked as NO_RETURN. + +2006-04-10 Eli Zaretskii <eliz@gnu.org> + + * s/ms-w32.h (pid_t) [_MSC_VER]: New typedef. + +2006-04-10 Romain Francoise <romain@orebokech.com> + + * xrdb.c (gethomedir): Use xstrdup. + +2006-04-10 Andreas Schwab <schwab@suse.de> + + * xrdb.c (gethomedir): Make sure to always return a pointer that + can be passed to free. + +2006-04-09 Richard Stallman <rms@gnu.org> + + * lisp.h (Fkill_emacs): Undo previous change. + +2006-04-08 Richard Stallman <rms@gnu.org> + + * search.c (boyer_moore): Test ch >= 0400, not >. + +2006-04-09 Dan Nicolaescu <dann@ics.uci.edu> + + * puresize.h (pure_write_error): Mark as NO_RETURN. + + * lisp.h (args_out_of_range, args_out_of_range_3) + 2006-04-08 Eli Zaretskii <eliz@gnu.org> * 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) tem = call1 (predicate, value); } while (NILP (tem)); + /* This function is marked as NO_RETURN, gcc would warn if it has a + return statement or if falls off the function. Other compilers + warn if no return statement is present. */ +#ifndef __GNUC__ return value; +#else + abort (); +#endif } void 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 () 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/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. */ #include "frame.h" #include "window.h" #include "blockinput.h" -#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 6f2e93a591a..91aa1198769 100644 --- a/src/image.c +++ b/src/image.c @@ -4379,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) @@ -4407,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); @@ -7846,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 2729ae878a9..e3a77653ed6 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1418,7 +1418,7 @@ command_loop_1 () Lisp_Object keybuf[30]; int i; int no_direct; - int prev_modiff; + int prev_modiff = 0; struct buffer *prev_buffer = NULL; #ifdef MULTI_KBOARD int was_locked = single_kboard; @@ -9478,6 +9478,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/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); extern Lisp_Object indirect_variable P_ ((Lisp_Object)); extern Lisp_Object long_to_cons P_ ((unsigned long)); extern unsigned long cons_to_long P_ ((Lisp_Object)); -extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)); -extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, Lisp_Object)); -extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)); +extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; +extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, + Lisp_Object)) NO_RETURN; +extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object, Lisp_Object, struct buffer *)); extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object)); @@ -3235,11 +3236,15 @@ extern void syms_of_dired P_ ((void)); extern void syms_of_term P_ ((void)); extern void fatal () NO_RETURN; -#ifdef HAVE_X_WINDOWS +#ifdef HAVE_WINDOW_SYSTEM /* Defined in fontset.c */ extern void syms_of_fontset P_ ((void)); EXFUN (Fset_fontset_font, 5); EXFUN (Fnew_fontset, 2); + +/* 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 */ @@ -3253,12 +3258,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)); @@ -3268,11 +3267,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..2b4e8dcbc64 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, @@ -1222,7 +1226,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 @@ -2789,7 +2793,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 +2838,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 +2872,6 @@ fsspec_to_posix_pathname (fs, ufn, ufnbuflen) return fnfErr; } -#ifndef MAC_OSX - int readlink (const char *path, char *buf, int bufsiz) { @@ -3124,8 +3128,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 +3220,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 +3949,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 +4003,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 +4296,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 +4417,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) @@ -4701,7 +4698,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 a890a67b5a8..f4cfd61acb3 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..8312197181f 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; @@ -683,18 +684,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 +1012,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) @@ -1123,11 +1126,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; @@ -1207,14 +1207,16 @@ copy_scrap_flavor_data (from_scrap, to_scrap, flavor_type) 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; } 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. */ #include "termhooks.h" #include "termopts.h" #include "termchar.h" -#include "gnu.h" #include "disptab.h" #include "buffer.h" #include "window.h" @@ -217,7 +216,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 *)); @@ -1699,14 +1697,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 @@ -2082,7 +2072,6 @@ mac_define_fringe_bitmap (which, bits, h, wd) unsigned short *bits; int h, wd; { - unsigned short *mask_bits; int i; CGDataProviderRef provider; @@ -2368,7 +2357,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, @@ -2569,34 +2557,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; + } } @@ -3432,7 +3422,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; @@ -4178,142 +4167,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 * @@ -5104,41 +4957,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 */ @@ -6224,10 +6079,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) { @@ -6273,9 +6130,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)) @@ -6286,27 +6140,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; @@ -6749,15 +6605,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 == '?') @@ -7588,7 +7446,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 @@ -7611,7 +7469,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 @@ -8260,10 +8118,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)); @@ -8777,6 +8633,7 @@ static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec) #endif +#ifdef MAC_OS8 static void do_get_menus (void) { @@ -8838,6 +8695,7 @@ do_check_ram_size (void) exit (1); } } +#endif /* MAC_OS8 */ static void do_window_update (WindowPtr win) @@ -9019,42 +8877,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); @@ -9189,26 +9046,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; } @@ -9216,7 +9074,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; @@ -10092,18 +9949,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; @@ -10903,7 +10760,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 872a4b60199..e35f04a6ba6 100644 --- a/src/macterm.h +++ b/src/macterm.h @@ -550,7 +550,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)); @@ -560,6 +568,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)); @@ -571,6 +580,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 @@ -584,6 +594,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 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, 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 eab9daa6bdd..8e4a0d22160 100644 --- a/src/process.c +++ b/src/process.c @@ -2323,7 +2323,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) @@ -2337,7 +2341,6 @@ conv_lisp_to_sockaddr (family, address, sa, len) register int i; bzero (sa, len); - sa->sa_family = family; if (VECTORP (address)) { @@ -2349,6 +2352,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) @@ -2364,9 +2368,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)) { @@ -2377,6 +2382,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; @@ -6229,6 +6235,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 93dac70c123..fa73736bc43 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 @@ -65,7 +65,7 @@ Boston, MA 02110-1301, USA. */ { if (PURE_P (obj)) \ pure_write_error (); } -extern void pure_write_error P_ ((void)); +extern void pure_write_error P_ ((void)) NO_RETURN; /* Define PURE_P. */ 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. */ #define ftruncate _chsize #define getw _getw #define getpid _getpid +#ifdef _MSC_VER +typedef int pid_t; +#endif #define isatty _isatty #define logb _logb #define _longjmp longjmp @@ -462,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/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, ch = -1; } - if (ch > 0400) + if (ch >= 0400) j = (ch & 0x3F) | 0200; else j = *ptr; @@ -1718,7 +1718,7 @@ boyer_moore (n, base_pat, len, len_byte, trt, inverse_trt, while (1) { TRANSLATE (ch, inverse_trt, ch); - if (ch > 0400) + if (ch >= 0400) j = (ch & 0x3F) | 0200; else 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. */ #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 039e955efd0..d4e6ac3569f 100644 --- a/src/window.c +++ b/src/window.c @@ -661,12 +661,20 @@ coordinates_in_window (w, x, y) || WINDOW_RIGHTMOST_P (w)) { if (!WINDOW_LEFTMOST_P (w) && abs (*x - x0) < grabbable_width) - return ON_VERTICAL_BORDER; + { + *x = max (0, *x - x0); + *y -= top_y; + return ON_VERTICAL_BORDER; + } } else { if (abs (*x - x1) < grabbable_width) - return ON_VERTICAL_BORDER; + { + *x = min (x1, *x) - x0; + *y -= top_y; + return ON_VERTICAL_BORDER; + } } if (*x < x0 || *x >= x1) @@ -708,7 +716,11 @@ 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; + { + *x = min (right_x, *x) - left_x; + *y -= top_y; + return ON_VERTICAL_BORDER; + } } else { @@ -720,6 +732,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; } } 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) } if ((s->for_overlaps & OVERLAPS_BOTH) == 0 - || (s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1) + || ((s->for_overlaps & OVERLAPS_BOTH) == OVERLAPS_BOTH && n == 1)) { #ifdef CONVERT_FROM_XRECT CONVERT_FROM_XRECT (r, *rects); @@ -1939,23 +1939,27 @@ get_glyph_string_clip_rects (s, rects, n) { rs[i] = r; if (r.y + r.height > row_y) - if (r.y < row_y) - rs[i].height = row_y - r.y; - else - rs[i].height = 0; + { + if (r.y < row_y) + rs[i].height = row_y - r.y; + else + rs[i].height = 0; + } i++; } if (s->for_overlaps & OVERLAPS_SUCC) { rs[i] = r; if (r.y < row_y + s->row->visible_height) - if (r.y + r.height > row_y + s->row->visible_height) - { - rs[i].y = row_y + s->row->visible_height; - rs[i].height = r.y + r.height - rs[i].y; - } - else - rs[i].height = 0; + { + if (r.y + r.height > row_y + s->row->visible_height) + { + rs[i].y = row_y + s->row->visible_height; + rs[i].height = r.y + r.height - rs[i].y; + } + else + rs[i].height = 0; + } i++; } @@ -14959,7 +14963,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\ @@ -22529,7 +22533,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 0d91f433fce..3a066ee12c3 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -5063,10 +5063,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; } 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 () } if (ptr == NULL) - return "/"; + return xstrdup ("/"); copy = (char *) malloc (strlen (ptr) + 2); strcpy (copy, ptr); |