diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 286 | ||||
-rw-r--r-- | src/Makefile.in | 34 | ||||
-rw-r--r-- | src/casetab.c | 3 | ||||
-rw-r--r-- | src/config.in | 6 | ||||
-rw-r--r-- | src/dispextern.h | 2 | ||||
-rw-r--r-- | src/dispnew.c | 3 | ||||
-rw-r--r-- | src/editfns.c | 7 | ||||
-rw-r--r-- | src/emacs.c | 1 | ||||
-rw-r--r-- | src/eval.c | 3 | ||||
-rw-r--r-- | src/gtkutil.c | 16 | ||||
-rw-r--r-- | src/keyboard.c | 29 | ||||
-rw-r--r-- | src/keymap.c | 31 | ||||
-rw-r--r-- | src/m/ibms390x.h | 6 | ||||
-rw-r--r-- | src/mac.c | 457 | ||||
-rw-r--r-- | src/macfns.c | 3 | ||||
-rw-r--r-- | src/macmenu.c | 9 | ||||
-rw-r--r-- | src/macterm.c | 249 | ||||
-rw-r--r-- | src/msdos.c | 2 | ||||
-rw-r--r-- | src/print.c | 34 | ||||
-rw-r--r-- | src/process.c | 21 | ||||
-rw-r--r-- | src/process.h | 4 | ||||
-rw-r--r-- | src/search.c | 15 | ||||
-rw-r--r-- | src/textprop.c | 67 | ||||
-rw-r--r-- | src/w32menu.c | 9 | ||||
-rw-r--r-- | src/w32term.c | 2 | ||||
-rw-r--r-- | src/xdisp.c | 58 | ||||
-rw-r--r-- | src/xfns.c | 8 | ||||
-rw-r--r-- | src/xmenu.c | 18 | ||||
-rw-r--r-- | src/xterm.c | 100 | ||||
-rw-r--r-- | src/xterm.h | 1 |
30 files changed, 979 insertions, 505 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index a1194906fbb..51c496b773b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,186 @@ +2006-09-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * xterm.c (x_initialize): Don't install Xt event timer here. + (x_timeout_atimer_activated_flag): New var. + (x_activate_timeout_atimer): New function to install Xt timer. + (x_send_scroll_bar_event, x_process_timeouts): Use it. + + * xmenu.c (x_menu_set_in_use, popup_activate_callback) + (create_and_show_popup_menu, create_and_show_dialog): Use it. + + * xterm.h (x_activate_timeout_atimer): Add prototype. + +2006-09-13 Richard Stallman <rms@gnu.org> + + * print.c (print_string): When printcharfun is t, + copy string contents and call strout on the copy. + + * keyboard.c (read_char): If end_time specified, don't put the + event into this_command_keys. + (read_key_sequence): If Voverriding_terminal_local_map is specified, + don't check Voverriding_local_map at all. + +2006-09-12 Stefan Monnier <monnier@iro.umontreal.ca> + + * textprop.c (Fnext_property_change, Fnext_single_property_change) + (Fprevious_property_change, Fprevious_single_property_change): + Avoid changing limit, so we can correctly catch the case where the + property is constant up to limit. + +2006-09-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macfns.c (mac_window) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: + * macterm.c (XTread_socket) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: + Undo 2006-09-08 change. + +2006-09-11 Chong Yidong <cyd@stupidchicken.com> + + * keymap.c (Fkey_binding): Use string position for string objects. + +2006-09-11 Kim F. Storm <storm@cua.dk> + + * keymap.c (Fkey_binding): Fix last change. + + * editfns.c (Fmessage): Recommend using (message "%s" ...). + +2006-09-10 Chong Yidong <cyd@stupidchicken.com> + + * keymap.c (Fkey_binding): Check for local keymap for mouse click + events. + +2006-09-10 Kim F. Storm <storm@cua.dk> + + * keyboard.c (Finput_pending_p): Check Vunread_input_method_events + and Vunread_post_input_method_events. + + * dispnew.c (Fredisplay): Document return value. + +2006-09-10 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * xfns.c (Fx_close_connection): Call xg_display_close when USE_GTK. + + * gtkutil.c (xg_display_close): Always change default display if needed, + check for < Gtk+ version 2.10 before calling gdk_display_close. + +2006-09-10 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * mac.c [MAC_OSX] (sys_select): Check argument `nfds' more rigidly. + Make variable `ofds' static. Remove variable `maxfd'. + + * macfns.c (Fx_file_dialog): Remove unused variable `f'. Call + check_mac. + + * macmenu.c (Vmenu_updating_frame, syms_of_macmenu): + * w32menu.c (Vmenu_updating_frame, syms_of_w32menu): Apply + 2006-09-08 change for xmenu.c. + + * xfns.c (Fx_file_dialog): Call check_x. + +2006-09-10 Kim F. Storm <storm@cua.dk> + + * xdisp.c (get_window_cursor_type): Use hollow cursor on + non-transparent images. + +2006-09-09 Eli Zaretskii <eliz@gnu.org> + + * editfns.c (Fsystem_name): Mention "host" in the doc string. + (syms_of_editfns) <system-name>: Likewise. + +2006-08-27 Martin Rudalics <rudalics@gmx.at> + + * xdisp.c (mouse_autoselect_window): Removed. + (Vmouse_autoselect_window): New variable. DEFVAR_LISP it. + + * dispextern.h (mouse_autoselect_window): Remove extern. + (Vmouse_autoselect_window): Add extern. + + * macterm.c (XTread_socket): Test Vmouse_autoselect_window + instead of mouse_autoselect_window. + + * msdos.c (dos_rawgetc): Likewise. + + * w32term.c (w32_read_socket): Likewise. + + * xterm.c (handle_one_xevent): Likewise. + +2006-09-08 Richard Stallman <rms@gnu.org> + + * xdisp.c (Vmenu_updating_frame): Define here. + (syms_of_xdisp): DEFVAR it here. + (update_menu_bar): Always return hooks_run. + Set Vmenu_updating_frame. + + * xdisp.c (redisplay_internal): Test Vinhibit_redisplay + before calculating SELECTED_FRAME. + + * xmenu.c (Vmenu_updating_frame): Don't define here. + (syms_of_xmenu): Don't DEFVAR it here. + + * xterm.c (x_error_quitter): For BadName error, just return. + + * eval.c (find_handler_clause): Give up on debugger if INPUT_BLOCKED_P. + + * casetab.c (init_casetab_once): Call set_case_table. + + * emacs.c (shut_down_emacs): Set inhibit_sentinels. + + * process.c (inhibit_sentinels): New variable. + (exec_sentinel): Test inhibit_sentinels. + (init_process): Initialize it. + + * process.h (inhibit_sentinels): Add decl. + + * search.c (looking_at_1, string_match_1, search_command): + Make syntax table's canon table point to eqv table. + +2006-09-08 Andreas Schwab <schwab@suse.de> + + * print.c (strout): Fix whitespace. + +2006-09-08 Kim F. Storm <storm@cua.dk> + + * xterm.c (x_draw_glyph_string): Fix 2006-08-24 change. + +2006-09-08 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * mac.c [!MAC_OSX]: Don't include keyboard.h. + [!MAC_OSX] (select): Try detect_input_pending before ReceiveNextEvent + in the same BLOCK_INPUT block, in case that some input has already + been read asynchronously. Pretend to be interrupted by a signal + if some input is available. + [MAC_OSX] (select_and_poll_event, sys_select): Likewise. + (SELECT_POLLING_PERIOD_USEC) [SELECT_USE_CFSOCKET]: Change to 100000. + Now used for ReceiveNextEvent timeout instead of select timeout. + (EVENT_CLASS_SOCK) [SELECT_USE_CFSOCKET]: Remove macro. + [SELECT_USE_CFSOCKET] (socket_callback): Add non-blocking connect + support. Quit event loop. + [MAC_OSX] (sys_select) [SELECT_USE_CFSOCKET]: Add non-blocking + connect support. Reuse previously allocated CFRunLoopSource. + (Fmac_process_hi_command) [TARGET_API_MAC_CARBON]: New function. + (syms_of_mac) [TARGET_API_MAC_CARBON]: Defsubr it. + + * macfns.c (mac_window) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: + Specify kWindowAsyncDragAttribute. + + * macterm.c (mac_handle_origin_change, mac_handle_size_change) + (mac_get_ideal_size): New functions. + (x_set_offset, x_set_window_size, x_make_frame_visible) + (do_zoom_window, mac_handle_window_event, XTread_socket): Use them. + (install_window_handler, mac_handle_window_event) + [USE_CARBON_EVENTS]: Handle kEventWindowGetIdealSize and + kEventWindowBoundsChanged. + (XTread_socket) [MAC_OS_X_VERSION_MAX_ALLOWED >= 1030]: Don't call + DragWindow. + +2006-09-07 Andreas Schwab <schwab@suse.de> + + * m/ibms390x.h (START_FILES, LIB_STANDARD): Override to + use lib64 instead of lib. + +2006-09-06 Stefan Monnier <monnier@iro.umontreal.ca> + + * Makefile.in: Avoid double quotes when possible. + 2006-09-06 Kenichi Handa <handa@m17n.org> * editfns.c (Fformat_time_string): Use make_unibyte_string to make @@ -6,8 +189,8 @@ 2006-09-06 Kim F. Storm <storm@cua.dk> * xdisp.c (pos_visible_p): Remove exact_mode_line_heights_p arg; - so always calculate heights even when pos-visible-in-window-p is - called with partially = t. Don't overshoot last_visible_y in move_it_to. + so calculate heights even when pos-visible-in-window-p is called + with partially = t. Don't overshoot last_visible_y in move_it_to. Return row height and row number in new rowh and vpos args. (cursor_row_fully_visible_p): First line is always "fully visible". (try_window): Don't clear matrix if vscrolled. @@ -16,13 +199,14 @@ * window.c (Fpos_visible_in_window_p): Adapt to new pos_visible_p. Return row height and row number for partially visible rows. - Modify return value to a 2 element list for fully visible rows - and 6 for partially visible row. + Modify return value to a 2 element list for fully visible rows and + 6 for partially visible row. (window_scroll_pixel_based): Use pos_visible_p directly instead of - Fpos_visible_in_window_p. Fix auto vscrolling for partially visible lines. - Only vscroll backwards if already vscrolled forwards. Unconditionally - vscroll forwards if PT is first (and only) line. Set new window start - instead of scrolling at start/end of tall line. + Fpos_visible_in_window_p. Fix auto vscrolling for partially + visible lines. Only vscroll backwards if already vscrolled + forwards. Unconditionally vscroll forwards if PT is first (and + only) line. Set new window start instead of scrolling at + start/end of tall line. 2006-09-05 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> @@ -1557,13 +1741,13 @@ 2006-05-18 Kim F. Storm <storm@cua.dk> - * xdisp.c (display_tool_bar_line): Restore entire tool-bar geometry when - backtracking in case last image doesn't fit on line. + * xdisp.c (display_tool_bar_line): Restore entire tool-bar + geometry when backtracking in case last image doesn't fit on line. 2006-05-18 MIYOSHI Masanori <miyoshi@meadowy.org> (tiny change) - * xdisp.c (display_tool_bar_line): Don't adjust tool-bar height by more than - height of one frame default line. + * xdisp.c (display_tool_bar_line): Don't adjust tool-bar height by + more than height of one frame default line. 2006-05-17 Richard Stallman <rms@gnu.org> @@ -2363,10 +2547,11 @@ * term.c: Define aliases for append_glyph and produce_stretch_glyph when `static' is defined to avoid name clash with those in xdisp.c. - * process.c (Faccept_process_output): Fix to comply with lisp reference. - Change arg "timeout" to "seconds" and allow both integer and float value. - Change arg "timeout-msec" to "millisec" and interpret" as milliseconds - rather than microseconds. Fix doc string accordingly. + * process.c (Faccept_process_output): Fix to comply with lisp + reference. Change arg "timeout" to "seconds" and allow both + integer and float value. Change arg "timeout-msec" to "millisec" + and interpret" as milliseconds rather than microseconds. Fix doc + string accordingly. 2006-03-21 Ken Raeburn <raeburn@raeburn.org> @@ -4576,7 +4761,8 @@ * xdisp.c (pos_visible_p): Convert w->hscroll to pixels before use. (remember_mouse_glyph): Clear RECT if mouse is over an image glyph. - * keyboard.c (make_lispy_position): Adjust wx for left margin if ON_TEXT. + * keyboard.c (make_lispy_position): Adjust wx for left margin if + ON_TEXT. (Fposn_at_x_y): Fix calculation of x coordinate. (Fposn_at_point): Return nil if point is hscrolled out of view. @@ -11069,7 +11255,8 @@ * search.c (match_limit, Fmatch_data, Fset_match_data): YAILOM. - * fontset.c (Fset_fontset_font): Remove unused vars `family' and `registry'. + * fontset.c (Fset_fontset_font): Remove unused vars `family' and + `registry'. * Makefile.in (${etc}DOC): Fix file name of make-docfile. @@ -14043,11 +14230,11 @@ pointer types. (Qrelative_width, Qalign_to): Remove unused variables. (Vvoid_text_area_pointer): Replace Vshow_text_cursor_in_void. - (QCmap, QCpointer, Qrect, Qcircle, Qpoly): New variables for - image maps. - (x_y_to_hpos_vpos): Return glyph relative coordinates through - new dx and dy args. - Remove buffer_only_p arg (always 0). Simplify code accordingly. + (QCmap, QCpointer, Qrect, Qcircle, Qpoly): New variables for image + maps. + (x_y_to_hpos_vpos): Return glyph relative coordinates through new + dx and dy args. Remove buffer_only_p arg (always 0). Simplify + code accordingly. (get_glyph_string_clip_rect): Draw cursor using glyph's rather than row's ascent and height, to get sensible height on tall rows. (build_desired_tool_bar_string): Remove Qimage extern. @@ -14060,14 +14247,16 @@ rectangular, circular, or polygon-shaped image hot-spot, (find_hot_spot): New function to search for image hot-spot. (Flookup_image_map): New defun to search for image hot-spot. - (define_frame_cursor1): New aux function to determine frame pointer. - (note_mode_line_or_margin_highlight, note_mouse_highlight): - Handle `pointer' text property and :pointer image property to - control frame pointer shape. Detect image hot-spots for pointer - and help_echo properties. Use define_frame_cursor1. - (note_mouse_highlight): Use Vvoid_text_area_pointer. - (syms_of_xdisp): Defsubr new defun. Intern and staticpro new variables. - DEFVAR_LISP Vvoid_text_area_pointer instead of Vshow_text_cursor_in_void. + (define_frame_cursor1): New aux function to determine frame + pointer. + (note_mode_line_or_margin_highlight, note_mouse_highlight): Handle + `pointer' text property and :pointer image property to control + frame pointer shape. Detect image hot-spots for pointer and + help_echo properties. Use define_frame_cursor1. + (note_mouse_highlight): Use Vvoid_text_area_pointer. + (syms_of_xdisp): Defsubr new defun. Intern and staticpro new + variables. DEFVAR_LISP Vvoid_text_area_pointer instead of + Vshow_text_cursor_in_void. * xfaces.c (cache_face): Abort if c->size exceeds MAX_FACE_ID. @@ -14551,8 +14740,8 @@ * alloc.c (lisp_align_malloc): If BASE is 0, call memory_full. * window.c (Fset_window_margins): Allow only integers as args. - (syms_of_window) <special-display-buffer-names, special-display-regexps>: - Doc fixes. + (syms_of_window) <special-display-buffer-names, + special-display-regexps>: Doc fixes. 2003-10-13 Lute Kamstra <lute@gnu.org> @@ -22355,15 +22544,15 @@ * process.c (Qlocal, QCname, QCbuffer, QChost, QCservice, QCfamily) (QClocal, QCremote, QCserver, QCdatagram, QCnowait, QCnoquery, QCstop) - (QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature): - New variables. + (QCcoding, QCoptions, QCfilter, QCsentinel, QClog, QCfeature): New + variables. (NETCONN1_P): New macro. (DATAGRAM_SOCKETS): New conditional symbol. (datagram_address): New array. (DATAGRAM_CONN_P, DATAGRAM_CHAN_P): New macros. (status_message): Use concat3. - (Fprocess_status): Add `listen' status to doc string. Return `stop' - for a stopped network process. + (Fprocess_status): Add `listen' status to doc string. Return + `stop' for a stopped network process. (Fset_process_buffer): Update contact plist for network process. (Fset_process_filter): Ditto. Don't enable input for stopped network processes. Server must listen, even if filter is t. @@ -22373,26 +22562,29 @@ (Fprocess_contact): Added KEY argument. Handle datagrams. (list_processes_1): Optionally show only processes with the query on exit flag set. Dynamically adjust column widths. Omit tty - column if not needed. Report stopped network processes. - Identify server and datagram network processes. + column if not needed. Report stopped network processes. Identify + server and datagram network processes. (Flist_processes): New optional arg `query-only'. (conv_sockaddr_to_lisp, get_lisp_to_sockaddr_size) (conv_lisp_to_sockaddr, set_socket_options) - (network_process_featurep, unwind_request_sigio): New helper functions. + (network_process_featurep, unwind_request_sigio): New helper + functions. (Fprocess_datagram_address, Fset_process_datagram_address): (Fset_network_process_options): New lisp functions. (Fopen_network_stream): Removed. Now defined in simple.el. - (Fmake_network_process): New lisp function. Code is based on previous - Fopen_network_stream, but heavily reworked with new property list based - argument list, support for datagrams, server processes, and local - sockets in addition to old client-only functionality. + (Fmake_network_process): New lisp function. Code is based on + previous Fopen_network_stream, but heavily reworked with new + property list based argument list, support for datagrams, server + processes, and local sockets in addition to old client-only + functionality. (server_accept_connection): New function. (wait_reading_process_input): Use it to handle incoming connects. Do not enable input on a new connection if process is stopped. - (read_process_output): Handle datagram sockets. Use 2k buffer for them. + (read_process_output): Handle datagram sockets. Use 2k buffer for + them. (send_process): Handle datagram sockets. - (Fstop_process, Fcontinue_process): Apply to network processes. A stopped - network process is indicated by setting command field to t . + (Fstop_process, Fcontinue_process): Apply to network processes. A + stopped network process is indicated by setting command field to t. (Fprocess_send_eof): No-op if datagram connection. (Fstatus_notify): Don't read input for a stream server socket or a stopped network process. diff --git a/src/Makefile.in b/src/Makefile.in index 88879645ceb..3bb6cece33d 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -75,13 +75,13 @@ SHELL=/bin/sh #define NOT_C_CODE #include "config.h" -/* We won''t really call alloca; - don''t let the file name alloca.c get messed up. */ +/* We will not really call alloca; + do not let the file name alloca.c get messed up. */ #ifdef alloca #undef alloca #endif -/* Don''t let the file name mktime.c get messed up. */ +/* Do not let the file name mktime.c get messed up. */ #ifdef mktime #undef mktime #endif @@ -96,7 +96,7 @@ SHELL=/bin/sh #endif /* On some machines #define register is done in config; - don''t let it interfere with this file. */ + do not let it interfere with this file. */ #undef register /* On some systems we may not be able to use the system make command. */ @@ -116,7 +116,7 @@ CC = C_COMPILER #endif #endif -/* Some machines don''t find the standard C libraries in the usual place. */ +/* Some machines do not find the standard C libraries in the usual place. */ #ifndef ORDINARY_LINK #ifndef LIB_STANDARD #define LIB_STANDARD -lc @@ -337,7 +337,7 @@ LIBXMENU= -lXMenu #else /* not HAVE_MENUS */ -/* Otherwise, don''t worry about the menu library at all. */ +/* Otherwise, do not worry about the menu library at all. */ LIBXMENU= #endif /* not HAVE_MENUS */ @@ -381,7 +381,7 @@ LIBXTR6 = -lSM -lICE #ifdef LIBXT_STATIC /* We assume the config files have defined STATIC_OPTION since that might depend on the operating system. - (Don''t forget you need different definitions with and without __GNUC__.) */ + (Do not forget you need different definitions with and without __GNUC__.) */ LIBXT= STATIC_OPTION $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext DYNAMIC_OPTION #else /* not LIBXT_STATIC */ LIBXT= $(LIBW) LIBXMU -lXt $(LIBXTR6) -lXext @@ -474,9 +474,9 @@ CFLAGS_SOUND= @CFLAGS_SOUND@ /* Versions of GCC >= 2.0 put their library, libgcc.a, in obscure places that are difficult to figure out at make time. Fortunately, these same versions allow you to pass arbitrary flags on to the - linker, so there''s no reason not to use it as a linker. + linker, so there is no reason not to use it as a linker. - Well, it''s not quite perfect. The ``-nostdlib'' keeps GCC from + Well, it is not quite perfect. The "-nostdlib" keeps GCC from searching for libraries in its internal directories, so we have to ask GCC explicitly where to find libgcc.a. */ @@ -493,9 +493,9 @@ GNULIB_VAR = LIB_GCC #ifndef LINKER_WAS_SPECIFIED /* GCC passes any argument prefixed with -Xlinker directly to the - linker. See prefix-args.c for an explanation of why we don''t do + linker. See prefix-args.c for an explanation of why we do not do this with the shell''s ``for'' construct. - Note that some people don''t have '.' in their paths, so we must + Note that some people do not have '.' in their paths, so we must use ./prefix-args. */ #define YMF_PASS_LDFLAGS(flags) `./prefix-args -Xlinker flags` #else @@ -536,12 +536,12 @@ LD=ld #endif /* not ORDINARY_LINK */ /* Flags to pass to LD only for temacs. */ -/* Don''t split this line with a backslash. That can cause trouble with +/* Do not split this line with a backslash. That can cause trouble with some cpps. */ TEMACS_LDFLAGS = LD_SWITCH_SYSTEM LD_SWITCH_SYSTEM_TEMACS LD_SWITCH_MACHINE LD_SWITCH_MACHINE_TEMACS LD_SWITCH_SITE /* A macro which other sections of Makefile can redefine to munge the - flags before they''re passed to LD. This is helpful if you have + flags before they are passed to LD. This is helpful if you have redefined LD to something odd, like "gcc". (The YMF prefix is a holdover from the old name "ymakefile".) */ @@ -728,8 +728,8 @@ otherobj= $(termcapobj) lastfile.o $(mallocobj) $(allocaobj) $(widgetobj) $(LIBO #define TOOLTIP_SUPPORT #endif -/* List of Lisp files loaded into the dumped Emacs. It''s arranged - like this because it''s easier to generate it semi-mechanically from +/* List of Lisp files loaded into the dumped Emacs. It is arranged + like this because it is easier to generate it semi-mechanically from loadup.el this way. Note that this list should not include lisp files which might not @@ -1003,13 +1003,13 @@ temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} $ -o temacs ${STARTFILES} ${obj} ${otherobj} \ OBJECTS_MACHINE ${LIBES} -/* We don''t use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE +/* We do not use ALL_LDFLAGS because LD_SWITCH_SYSTEM and LD_SWITCH_MACHINE often contain options that have to do with using Emacs''s crt0, which are only good with temacs. */ prefix-args${EXEEXT}: prefix-args.c $(config_h) $(CC) $(ALL_CFLAGS) $(LDFLAGS) ${srcdir}/prefix-args.c -o prefix-args -/* Don''t lose if this was not defined. */ +/* Do not lose if this was not defined. */ #ifndef OLDXMENU_OPTIONS #define OLDXMENU_OPTIONS #endif diff --git a/src/casetab.c b/src/casetab.c index 15bf133a869..517f24de014 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -292,6 +292,9 @@ init_casetab_once () } XCHAR_TABLE (down)->extras[2] = Fcopy_sequence (up); + + /* Fill in what isn't filled in. */ + set_case_table (down, 1); } void diff --git a/src/config.in b/src/config.in index 106aeea920c..44a56e36dd3 100644 --- a/src/config.in +++ b/src/config.in @@ -124,6 +124,10 @@ Boston, MA 02110-1301, USA. */ don't. */ #undef HAVE_DECL_SYS_SIGLIST +/* Define to 1 if you have the declaration of `tzname', and to 0 if you don't. + */ +#undef HAVE_DECL_TZNAME + /* Define to 1 if you have the declaration of `__sys_siglist', and to 0 if you don't. */ #undef HAVE_DECL___SYS_SIGLIST @@ -805,7 +809,7 @@ Boston, MA 02110-1301, USA. */ /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. + automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ diff --git a/src/dispextern.h b/src/dispextern.h index 3cd9eb6052a..1f768dd323c 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -2700,7 +2700,7 @@ extern Lisp_Object help_echo_object, previous_help_echo_string; extern int help_echo_pos; extern struct frame *last_mouse_frame; extern int last_tool_bar_item; -extern int mouse_autoselect_window; +extern Lisp_Object Vmouse_autoselect_window; extern int unibyte_display_via_language_environment; extern void reseat_at_previous_visible_line_start P_ ((struct it *)); diff --git a/src/dispnew.c b/src/dispnew.c index f621aef273a..4880ef7779f 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -6536,7 +6536,8 @@ sit_for (timeout, reading, do_display) DEFUN ("redisplay", Fredisplay, Sredisplay, 0, 1, 0, doc: /* Perform redisplay if no input is available. If optional arg FORCE is non-nil or `redisplay-dont-pause' is non-nil, -perform a full redisplay even if input is available. */) +perform a full redisplay even if input is available. +Return t if redisplay was performed, nil otherwise. */) (force) Lisp_Object force; { diff --git a/src/editfns.c b/src/editfns.c index 10c5cbe1153..0206cd1b913 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -1388,7 +1388,7 @@ name, or nil if there is no such user. */) } DEFUN ("system-name", Fsystem_name, Ssystem_name, 0, 0, 0, - doc: /* Return the name of the machine you are running on, as a string. */) + doc: /* Return the host name of the machine you are running on, as a string. */) () { return Vsystem_name; @@ -3310,6 +3310,9 @@ The message also goes into the `*Messages*' buffer. The first argument is a format control string, and the rest are data to be formatted under control of the string. See `format' for details. +Note: Use (message "%s" VALUE) to print the value of expressions and +variables to avoid accidentally interpreting `%' as format specifiers. + If the first argument is nil or the empty string, the function clears any existing message; this lets the minibuffer contents show. See also `current-message'. @@ -4514,7 +4517,7 @@ functions if all the text being accessed has this property. */); Vbuffer_access_fontified_property = Qnil; DEFVAR_LISP ("system-name", &Vsystem_name, - doc: /* The name of the machine Emacs is running on. */); + doc: /* The host name of the machine Emacs is running on. */); DEFVAR_LISP ("user-full-name", &Vuser_full_name, doc: /* The full name of the user logged in. */); diff --git a/src/emacs.c b/src/emacs.c index 2bacb1abbed..74cef49926f 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -2156,6 +2156,7 @@ shut_down_emacs (sig, no_x, stuff) stuff_buffered_input (stuff); + inhibit_sentinels = 1; kill_buffer_processes (Qnil); Fdo_auto_save (Qt, Qnil); diff --git a/src/eval.c b/src/eval.c index 5f3bd46c4dc..dbd30eac201 100644 --- a/src/eval.c +++ b/src/eval.c @@ -1904,6 +1904,9 @@ find_handler_clause (handlers, conditions, sig, data, debugger_value_ptr) max_specpdl_size--; } if (! no_debugger + /* Don't try to run the debugger with interrupts blocked. + The editing loop would return anyway. */ + && ! INPUT_BLOCKED_P && (EQ (sig_symbol, Qquit) ? debug_on_quit : wants_debugger (Vdebug_on_error, conditions)) diff --git a/src/gtkutil.c b/src/gtkutil.c index 89b0f8b11c6..cf6caafa942 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -131,14 +131,8 @@ xg_display_close (Display *dpy) #ifdef HAVE_GTK_MULTIDISPLAY GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (dpy); - /* GTK 2.2 has a bug that makes gdk_display_close crash (bug - http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way - we can continue running, but there will be memory leaks. */ - -#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 4 - /* If this is the default display, we must change it before calling - dispose, otherwise it will crash. */ + dispose, otherwise it will crash on some Gtk+ versions. */ if (gdk_display_get_default () == gdpy) { struct x_display_info *dpyinfo; @@ -160,10 +154,14 @@ xg_display_close (Display *dpy) gdpy_new); } - g_object_run_dispose (G_OBJECT (gdpy)); + /* GTK 2.2-2.8 has a bug that makes gdk_display_close crash (bug + http://bugzilla.gnome.org/show_bug.cgi?id=85715). This way + we can continue running, but there will be memory leaks. */ +#if GTK_MAJOR_VERSION == 2 && GTK_MINOR_VERSION < 10 + g_object_run_dispose (G_OBJECT (gdpy)); #else - /* I hope this will be fixed in GTK 2.4. It is what bug 85715 says. */ + /* This seems to be fixed in GTK 2.10. */ gdk_display_close (gdpy); #endif #endif /* HAVE_GTK_MULTIDISPLAY */ diff --git a/src/keyboard.c b/src/keyboard.c index d843b8fb348..6a1d6e608d2 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -3257,8 +3257,9 @@ read_char (commandflag, nmaps, maps, prev_event, used_mouse_menu, end_time) goto retry; } - if (! reread || this_command_key_count == 0 - || this_command_key_count_reset) + if ((! reread || this_command_key_count == 0 + || this_command_key_count_reset) + && !end_time) { /* Don't echo mouse motion events. */ @@ -8765,17 +8766,25 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, the initial keymaps from the current buffer. */ nmaps = 0; - if (!NILP (current_kboard->Voverriding_terminal_local_map) - || !NILP (Voverriding_local_map)) + if (!NILP (current_kboard->Voverriding_terminal_local_map)) { - if (3 > nmaps_allocated) + if (2 > nmaps_allocated) { - submaps = (Lisp_Object *) alloca (3 * sizeof (submaps[0])); - defs = (Lisp_Object *) alloca (3 * sizeof (defs[0])); - nmaps_allocated = 3; + submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0])); + defs = (Lisp_Object *) alloca (2 * sizeof (defs[0])); + nmaps_allocated = 2; } if (!NILP (current_kboard->Voverriding_terminal_local_map)) submaps[nmaps++] = current_kboard->Voverriding_terminal_local_map; + } + else if (!NILP (Voverriding_local_map)) + { + if (2 > nmaps_allocated) + { + submaps = (Lisp_Object *) alloca (2 * sizeof (submaps[0])); + defs = (Lisp_Object *) alloca (2 * sizeof (defs[0])); + nmaps_allocated = 2; + } if (!NILP (Voverriding_local_map)) submaps[nmaps++] = Voverriding_local_map; } @@ -10087,7 +10096,9 @@ Actually, the value is nil only if we can be sure that no input is available; if there is a doubt, the value is t. */) () { - if (!NILP (Vunread_command_events) || unread_command_char != -1) + if (!NILP (Vunread_command_events) || unread_command_char != -1 + || !NILP (Vunread_post_input_method_events) + || !NILP (Vunread_input_method_events)) return (Qt); get_input_pending (&input_pending, diff --git a/src/keymap.c b/src/keymap.c index cdc45485e0a..99d49c000e9 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1609,6 +1609,37 @@ is non-nil, `key-binding' returns the unmapped command. */) GCPRO1 (key); +#ifdef HAVE_MOUSE + if (VECTORP (key) && ASIZE (key) > 0) + { + Lisp_Object ev, pos; + if ((ev = AREF (key, 0), CONSP (ev)) + && SYMBOLP (XCAR (ev)) + && CONSP (XCDR (ev)) + && (pos = XCAR (XCDR (ev)), CONSP (pos)) + && XINT (Flength (pos)) == 10 + && INTEGERP (XCAR (XCDR (pos)))) + { + Lisp_Object map, object; + + object = Fnth (make_number(4), pos); + + if (CONSP (object)) + map = Fget_char_property (XCDR (object), Qkeymap, XCAR (object)); + else + map = Fget_char_property (XCAR (XCDR (pos)), Qkeymap, + Fwindow_buffer (XCAR (pos))); + + if (!NILP (Fkeymapp (map))) + { + value = Flookup_key (map, key, accept_default); + if (! NILP (value) && !INTEGERP (value)) + goto done; + } + } + } +#endif /* HAVE_MOUSE */ + if (!NILP (current_kboard->Voverriding_terminal_local_map)) { value = Flookup_key (current_kboard->Voverriding_terminal_local_map, diff --git a/src/m/ibms390x.h b/src/m/ibms390x.h index 0d3acd34d97..716dd44c727 100644 --- a/src/m/ibms390x.h +++ b/src/m/ibms390x.h @@ -159,5 +159,11 @@ NOTE-END */ #define XPNTR(a) XUINT (a) +#undef START_FILES +#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o + +#undef LIB_STANDARD +#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o + /* arch-tag: 4b87653c-6add-4663-8691-7d9dc17b5519 (do not change this comment) */ diff --git a/src/mac.c b/src/mac.c index 67fd5e4f5e0..51b821dcd95 100644 --- a/src/mac.c +++ b/src/mac.c @@ -2413,75 +2413,69 @@ sys_fopen (const char *name, const char *mode) } -#include "keyboard.h" -extern Boolean mac_wait_next_event (EventRecord *, UInt32, Boolean); +extern Boolean mac_wait_next_event P_ ((EventRecord *, UInt32, Boolean)); int select (n, rfds, wfds, efds, timeout) - int n; - SELECT_TYPE *rfds; - SELECT_TYPE *wfds; - SELECT_TYPE *efds; - struct timeval *timeout; + int nfds; + SELECT_TYPE *rfds, *wfds, *efds; + EMACS_TIME *timeout; { - OSStatus err; -#if TARGET_API_MAC_CARBON - EventTimeout timeout_sec = - (timeout - ? (EMACS_SECS (*timeout) * kEventDurationSecond - + EMACS_USECS (*timeout) * kEventDurationMicrosecond) - : kEventDurationForever); - - BLOCK_INPUT; - err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL); - UNBLOCK_INPUT; -#else /* not TARGET_API_MAC_CARBON */ - EventRecord e; - UInt32 sleep_time = EMACS_SECS (*timeout) * 60 + - ((EMACS_USECS (*timeout) * 60) / 1000000); + OSStatus err = noErr; /* Can only handle wait for keyboard input. */ - if (n > 1 || wfds || efds) + if (nfds > 1 || wfds || efds) return -1; - /* Also return true if an event other than a keyDown has occurred. - This causes kbd_buffer_get_event in keyboard.c to call - read_avail_input which in turn calls XTread_socket to poll for - these events. Otherwise these never get processed except but a - very slow poll timer. */ - if (mac_wait_next_event (&e, sleep_time, false)) - err = noErr; - else - err = -9875; /* eventLoopTimedOutErr */ + /* Try detect_input_pending before ReceiveNextEvent in the same + BLOCK_INPUT block, in case that some input has already been read + asynchronously. */ + BLOCK_INPUT; + if (!detect_input_pending ()) + { +#if TARGET_API_MAC_CARBON + EventTimeout timeoutval = + (timeout + ? (EMACS_SECS (*timeout) * kEventDurationSecond + + EMACS_USECS (*timeout) * kEventDurationMicrosecond) + : kEventDurationForever); + + if (timeoutval == 0.0) + err = eventLoopTimedOutErr; + else + err = ReceiveNextEvent (0, NULL, timeoutval, + kEventLeaveInQueue, NULL); +#else /* not TARGET_API_MAC_CARBON */ + EventRecord e; + UInt32 sleep_time = EMACS_SECS (*timeout) * 60 + + ((EMACS_USECS (*timeout) * 60) / 1000000); + + if (sleep_time == 0) + err = -9875; /* eventLoopTimedOutErr */ + else + { + if (mac_wait_next_event (&e, sleep_time, false)) + err = noErr; + else + err = -9875; /* eventLoopTimedOutErr */ + } #endif /* not TARGET_API_MAC_CARBON */ + } + UNBLOCK_INPUT; - if (FD_ISSET (0, rfds)) - if (err == noErr) - return 1; - else - { - FD_ZERO (rfds); - return 0; - } + if (err == noErr) + { + /* Pretend that `select' is interrupted by a signal. */ + detect_input_pending (); + errno = EINTR; + return -1; + } else - if (err == noErr) - { - if (input_polling_used ()) - { - /* It could be confusing if a real alarm arrives while - processing the fake one. Turn it off and let the - handler reset it. */ - extern void poll_for_input_1 P_ ((void)); - int old_poll_suppress_count = poll_suppress_count; - poll_suppress_count = 1; - poll_for_input_1 (); - poll_suppress_count = old_poll_suppress_count; - } - errno = EINTR; - return -1; - } - else + { + if (rfds) + FD_ZERO (rfds); return 0; + } } @@ -4904,6 +4898,30 @@ On successful conversion, return the result string, else return nil. */) return result; } + +DEFUN ("mac-process-hi-command", Fmac_process_hi_command, Smac_process_hi_command, 1, 1, 0, + doc: /* Send a HI command whose ID is COMMAND-ID to the command chain. +COMMAND-ID must be a 4-character string. Some common command IDs are +defined in the Carbon Event Manager. */) + (command_id) + Lisp_Object command_id; +{ + OSStatus err; + HICommand command; + + bzero (&command, sizeof (HICommand)); + command.commandID = mac_get_code_from_arg (command_id, 0); + + BLOCK_INPUT; + err = ProcessHICommand (&command); + UNBLOCK_INPUT; + + if (err != noErr) + error ("HI command (command ID: '%s') not handled.", SDATA (command_id)); + + return Qnil; +} + #endif /* TARGET_API_MAC_CARBON */ @@ -4944,23 +4962,22 @@ extern int noninteractive; -> Use `select'. 2. Sockets are not involved. -> Use ReceiveNextEvent. - 3. [If SELECT_USE_CFSOCKET is defined] - Only the window event channel and socket read channels are + 3. [If SELECT_USE_CFSOCKET is set] + Only the window event channel and socket read/write channels are involved, and timeout is not too short (greater than SELECT_TIMEOUT_THRESHHOLD_RUNLOOP seconds). -> Create CFSocket for each socket and add it into the current - event RunLoop so that a `ready-to-read' event can be posted - to the event queue that is also used for window events. Then - ReceiveNextEvent can wait for both kinds of inputs. + event RunLoop so that the current event loop gets quit when + the socket becomes ready. Then ReceiveNextEvent can wait for + both kinds of inputs. 4. Otherwise. -> Periodically poll the window input channel while repeatedly executing `select' with a short timeout (SELECT_POLLING_PERIOD_USEC microseconds). */ -#define SELECT_POLLING_PERIOD_USEC 20000 -#ifdef SELECT_USE_CFSOCKET +#define SELECT_POLLING_PERIOD_USEC 100000 +#if SELECT_USE_CFSOCKET #define SELECT_TIMEOUT_THRESHOLD_RUNLOOP 0.2 -#define EVENT_CLASS_SOCK 'Sock' static void socket_callback (s, type, address, data, info) @@ -4970,196 +4987,211 @@ socket_callback (s, type, address, data, info) const void *data; void *info; { - EventRef event; + int fd = CFSocketGetNative (s); + SELECT_TYPE *ofds = (SELECT_TYPE *)info; - CreateEvent (NULL, EVENT_CLASS_SOCK, 0, 0, kEventAttributeNone, &event); - PostEventToQueue (GetCurrentEventQueue (), event, kEventPriorityStandard); - ReleaseEvent (event); + if ((type == kCFSocketReadCallBack && FD_ISSET (fd, &ofds[0])) + || (type == kCFSocketConnectCallBack && FD_ISSET (fd, &ofds[1]))) + QuitEventLoop (GetCurrentEventLoop ()); } #endif /* SELECT_USE_CFSOCKET */ static int -select_and_poll_event (n, rfds, wfds, efds, timeout) - int n; - SELECT_TYPE *rfds; - SELECT_TYPE *wfds; - SELECT_TYPE *efds; - struct timeval *timeout; +select_and_poll_event (nfds, rfds, wfds, efds, timeout) + int nfds; + SELECT_TYPE *rfds, *wfds, *efds; + EMACS_TIME *timeout; { - int r; - OSStatus err; + OSStatus err = noErr; + int r = 0; - r = select (n, rfds, wfds, efds, timeout); - if (r != -1) + /* Try detect_input_pending before ReceiveNextEvent in the same + BLOCK_INPUT block, in case that some input has already been read + asynchronously. */ + BLOCK_INPUT; + if (!detect_input_pending ()) { - BLOCK_INPUT; - err = ReceiveNextEvent (0, NULL, kEventDurationNoWait, - kEventLeaveInQueue, NULL); - UNBLOCK_INPUT; - if (err == noErr) + EMACS_TIME select_timeout; + EventTimeout timeoutval = + (timeout + ? (EMACS_SECS (*timeout) * kEventDurationSecond + + EMACS_USECS (*timeout) * kEventDurationMicrosecond) + : kEventDurationForever); + + EMACS_SET_SECS_USECS (select_timeout, 0, 0); + r = select (nfds, rfds, wfds, efds, &select_timeout); + if (timeoutval == 0.0) + err = eventLoopTimedOutErr; + else if (r == 0) { - FD_SET (0, rfds); - r++; +#if USE_CG_DRAWING + mac_prepare_for_quickdraw (NULL); +#endif + err = ReceiveNextEvent (0, NULL, timeoutval, + kEventLeaveInQueue, NULL); } } - return r; -} + UNBLOCK_INPUT; -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1020 -#undef SELECT_INVALIDATE_CFSOCKET -#endif + if (r != 0) + return r; + else if (err == noErr) + { + /* Pretend that `select' is interrupted by a signal. */ + detect_input_pending (); + errno = EINTR; + return -1; + } + else + return 0; +} int -sys_select (n, rfds, wfds, efds, timeout) - int n; - SELECT_TYPE *rfds; - SELECT_TYPE *wfds; - SELECT_TYPE *efds; - struct timeval *timeout; +sys_select (nfds, rfds, wfds, efds, timeout) + int nfds; + SELECT_TYPE *rfds, *wfds, *efds; + EMACS_TIME *timeout; { - OSStatus err; - int i, r; + OSStatus err = noErr; + int r; EMACS_TIME select_timeout; + static SELECT_TYPE ofds[3]; if (inhibit_window_system || noninteractive - || rfds == NULL || !FD_ISSET (0, rfds)) - return select (n, rfds, wfds, efds, timeout); + || nfds < 1 || rfds == NULL || !FD_ISSET (0, rfds)) + return select (nfds, rfds, wfds, efds, timeout); FD_CLR (0, rfds); + ofds[0] = *rfds; - if (wfds == NULL && efds == NULL) - { - int nsocks = 0; - SELECT_TYPE orfds = *rfds; + if (wfds) + ofds[1] = *wfds; + else + FD_ZERO (&ofds[1]); - EventTimeout timeout_sec = + if (efds) + ofds[2] = *efds; + else + { + EventTimeout timeoutval = (timeout ? (EMACS_SECS (*timeout) * kEventDurationSecond + EMACS_USECS (*timeout) * kEventDurationMicrosecond) : kEventDurationForever); - for (i = 1; i < n; i++) - if (FD_ISSET (i, rfds)) - nsocks++; - - if (nsocks == 0) + FD_SET (0, rfds); /* sentinel */ + do { - BLOCK_INPUT; - err = ReceiveNextEvent (0, NULL, timeout_sec, - kEventLeaveInQueue, NULL); - UNBLOCK_INPUT; - if (err == noErr) - { - FD_SET (0, rfds); - return 1; - } - else - return 0; + nfds--; } + while (!(FD_ISSET (nfds, rfds) || (wfds && FD_ISSET (nfds, wfds)))); + nfds++; + FD_CLR (0, rfds); + + if (nfds == 1) + return select_and_poll_event (nfds, rfds, wfds, efds, timeout); -#if USE_CG_DRAWING - mac_prepare_for_quickdraw (NULL); -#endif /* Avoid initial overhead of RunLoop setup for the case that some input is already available. */ EMACS_SET_SECS_USECS (select_timeout, 0, 0); - r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); - if (r != 0 || timeout_sec == 0.0) + r = select_and_poll_event (nfds, rfds, wfds, efds, &select_timeout); + if (r != 0 || timeoutval == 0.0) return r; - *rfds = orfds; + *rfds = ofds[0]; + if (wfds) + *wfds = ofds[1]; -#ifdef SELECT_USE_CFSOCKET - if (timeout_sec > 0 && timeout_sec <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) +#if SELECT_USE_CFSOCKET + if (timeoutval > 0 && timeoutval <= SELECT_TIMEOUT_THRESHOLD_RUNLOOP) goto poll_periodically; - { - CFRunLoopRef runloop = - (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); - EventTypeSpec specs[] = {{EVENT_CLASS_SOCK, 0}}; -#ifdef SELECT_INVALIDATE_CFSOCKET - CFSocketRef *shead, *s; -#else - CFRunLoopSourceRef *shead, *s; -#endif - - BLOCK_INPUT; - -#ifdef SELECT_INVALIDATE_CFSOCKET - shead = xmalloc (sizeof (CFSocketRef) * nsocks); -#else - shead = xmalloc (sizeof (CFRunLoopSourceRef) * nsocks); -#endif - s = shead; - for (i = 1; i < n; i++) - if (FD_ISSET (i, rfds)) - { - CFSocketRef socket = - CFSocketCreateWithNative (NULL, i, kCFSocketReadCallBack, - socket_callback, NULL); - CFRunLoopSourceRef source = - CFSocketCreateRunLoopSource (NULL, socket, 0); - -#ifdef SELECT_INVALIDATE_CFSOCKET - CFSocketSetSocketFlags (socket, 0); -#endif - CFRunLoopAddSource (runloop, source, kCFRunLoopDefaultMode); -#ifdef SELECT_INVALIDATE_CFSOCKET - CFRelease (source); - *s = socket; -#else - CFRelease (socket); - *s = source; -#endif - s++; - } + /* Try detect_input_pending before ReceiveNextEvent in the same + BLOCK_INPUT block, in case that some input has already been + read asynchronously. */ + BLOCK_INPUT; + if (!detect_input_pending ()) + { + int minfd, fd; + CFRunLoopRef runloop = + (CFRunLoopRef) GetCFRunLoopFromEventLoop (GetCurrentEventLoop ()); + static CFSocketContext context = {0, &ofds, NULL, NULL, NULL}; + static CFMutableDictionaryRef sources; + + if (sources == NULL) + sources = + CFDictionaryCreateMutable (NULL, 0, NULL, + &kCFTypeDictionaryValueCallBacks); + + for (minfd = 1; ; minfd++) /* nfds-1 works as a sentinel. */ + if (FD_ISSET (minfd, rfds) || (wfds && FD_ISSET (minfd, wfds))) + break; - err = ReceiveNextEvent (0, NULL, timeout_sec, kEventLeaveInQueue, NULL); + for (fd = minfd; fd < nfds; fd++) + if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds))) + { + void *key = (void *) fd; + CFRunLoopSourceRef source = + (CFRunLoopSourceRef) CFDictionaryGetValue (sources, key); + + if (source == NULL) + { + CFSocketRef socket = + CFSocketCreateWithNative (NULL, fd, + (kCFSocketReadCallBack + | kCFSocketConnectCallBack), + socket_callback, &context); + + if (socket == NULL) + continue; + source = CFSocketCreateRunLoopSource (NULL, socket, 0); + CFRelease (socket); + if (source == NULL) + continue; + CFDictionaryAddValue (sources, key, source); + CFRelease (source); + } + CFRunLoopAddSource (runloop, source, kCFRunLoopDefaultMode); + } - do - { - --s; -#ifdef SELECT_INVALIDATE_CFSOCKET - CFSocketInvalidate (*s); -#else - CFRunLoopRemoveSource (runloop, *s, kCFRunLoopDefaultMode); +#if USE_CG_DRAWING + mac_prepare_for_quickdraw (NULL); #endif - CFRelease (*s); - } - while (s != shead); - - xfree (shead); + err = ReceiveNextEvent (0, NULL, timeoutval, + kEventLeaveInQueue, NULL); - if (err) - { - FD_ZERO (rfds); - r = 0; - } - else - { - FlushEventsMatchingListFromQueue (GetCurrentEventQueue (), - GetEventTypeCount (specs), - specs); - EMACS_SET_SECS_USECS (select_timeout, 0, 0); - r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); - } + for (fd = minfd; fd < nfds; fd++) + if (FD_ISSET (fd, rfds) || (wfds && FD_ISSET (fd, wfds))) + { + void *key = (void *) fd; + CFRunLoopSourceRef source = + (CFRunLoopSourceRef) CFDictionaryGetValue (sources, key); - UNBLOCK_INPUT; + CFRunLoopRemoveSource (runloop, source, kCFRunLoopDefaultMode); + } + } + UNBLOCK_INPUT; - return r; - } + if (err == noErr || err == eventLoopQuitErr) + { + EMACS_SET_SECS_USECS (select_timeout, 0, 0); + return select_and_poll_event (nfds, rfds, wfds, efds, + &select_timeout); + } + else + { + FD_ZERO (rfds); + if (wfds) + FD_ZERO (wfds); + return 0; + } #endif /* SELECT_USE_CFSOCKET */ } poll_periodically: { EMACS_TIME end_time, now, remaining_time; - SELECT_TYPE orfds = *rfds, owfds, oefds; - if (wfds) - owfds = *wfds; - if (efds) - oefds = *efds; if (timeout) { remaining_time = *timeout; @@ -5172,15 +5204,15 @@ sys_select (n, rfds, wfds, efds, timeout) EMACS_SET_SECS_USECS (select_timeout, 0, SELECT_POLLING_PERIOD_USEC); if (timeout && EMACS_TIME_LT (remaining_time, select_timeout)) select_timeout = remaining_time; - r = select_and_poll_event (n, rfds, wfds, efds, &select_timeout); + r = select_and_poll_event (nfds, rfds, wfds, efds, &select_timeout); if (r != 0) return r; - *rfds = orfds; + *rfds = ofds[0]; if (wfds) - *wfds = owfds; + *wfds = ofds[1]; if (efds) - *efds = oefds; + *efds = ofds[2]; if (timeout) { @@ -5190,12 +5222,8 @@ sys_select (n, rfds, wfds, efds, timeout) } while (!timeout || EMACS_TIME_LT (now, end_time)); - FD_ZERO (rfds); - if (wfds) - FD_ZERO (wfds); - if (efds) - FD_ZERO (efds); - return 0; + EMACS_SET_SECS_USECS (select_timeout, 0, 0); + return select_and_poll_event (nfds, rfds, wfds, efds, &select_timeout); } } @@ -5387,6 +5415,7 @@ syms_of_mac () #if TARGET_API_MAC_CARBON defsubr (&Smac_get_preference); defsubr (&Smac_code_convert_string); + defsubr (&Smac_process_hi_command); #endif defsubr (&Smac_set_file_creator); diff --git a/src/macfns.c b/src/macfns.c index 334ac87cdce..a250cdd0c7f 100644 --- a/src/macfns.c +++ b/src/macfns.c @@ -4342,13 +4342,14 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */) (prompt, dir, default_filename, mustmatch, only_dir_p) Lisp_Object prompt, dir, default_filename, mustmatch, only_dir_p; { - struct frame *f = SELECTED_FRAME (); Lisp_Object file = Qnil; int count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; char filename[MAXPATHLEN]; static NavEventUPP mac_nav_event_callbackUPP = NULL; + check_mac (); + GCPRO6 (prompt, dir, default_filename, mustmatch, file, only_dir_p); CHECK_STRING (prompt); CHECK_STRING (dir); diff --git a/src/macmenu.c b/src/macmenu.c index e7d69d5657c..72ab9f90667 100644 --- a/src/macmenu.c +++ b/src/macmenu.c @@ -158,10 +158,10 @@ typedef struct _widget_value #define FALSE 0 #endif /* no TRUE */ -Lisp_Object Vmenu_updating_frame; - Lisp_Object Qdebug_on_next_call; +extern Lisp_Object Vmenu_updating_frame; + extern Lisp_Object Qmenu_bar, Qmac_apple_event; extern Lisp_Object QCtoggle, QCradio; @@ -2630,11 +2630,6 @@ syms_of_macmenu () Qdebug_on_next_call = intern ("debug-on-next-call"); staticpro (&Qdebug_on_next_call); - DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame, - doc: /* Frame for which we are updating a menu. -The enable predicate for a menu command should check this variable. */); - Vmenu_updating_frame = Qnil; - defsubr (&Sx_popup_menu); #ifdef HAVE_MENUS defsubr (&Sx_popup_dialog); diff --git a/src/macterm.c b/src/macterm.c index 4156000478e..7e8d13fb9f9 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -5824,6 +5824,57 @@ mac_get_window_bounds (f, inner, outer) #endif /* not TARGET_API_MAC_CARBON */ } +static void +mac_handle_origin_change (f) + struct frame *f; +{ + x_real_positions (f, &f->left_pos, &f->top_pos); +} + +static void +mac_handle_size_change (f, pixelwidth, pixelheight) + struct frame *f; + int pixelwidth, pixelheight; +{ + int cols, rows; + + cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, pixelwidth); + rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, pixelheight); + + if (cols != FRAME_COLS (f) + || rows != FRAME_LINES (f) + || pixelwidth != FRAME_PIXEL_WIDTH (f) + || pixelheight != FRAME_PIXEL_HEIGHT (f)) + { + /* We pass 1 for DELAY since we can't run Lisp code inside of + a BLOCK_INPUT. */ + change_frame_size (f, rows, cols, 0, 1, 0); + FRAME_PIXEL_WIDTH (f) = pixelwidth; + FRAME_PIXEL_HEIGHT (f) = pixelheight; + SET_FRAME_GARBAGED (f); + + /* If cursor was outside the new size, mark it as off. */ + mark_window_cursors_off (XWINDOW (f->root_window)); + + /* Clear out any recollection of where the mouse highlighting + was, since it might be in a place that's outside the new + frame size. Actually checking whether it is outside is a + pain in the neck, so don't try--just let the highlighting be + done afresh with new size. */ + cancel_mouse_face (f); + +#if TARGET_API_MAC_CARBON + if (f->output_data.mac->hourglass_control) + { +#if USE_CG_DRAWING + mac_prepare_for_quickdraw (f); +#endif + MoveControl (f->output_data.mac->hourglass_control, + pixelwidth - HOURGLASS_WIDTH, 0); + } +#endif + } +} /* Calculate the absolute position in frame F @@ -5904,7 +5955,10 @@ x_set_offset (f, xoff, yoff, change_gravity) ConstrainWindowToScreen (FRAME_MAC_WINDOW (f), kWindowTitleBarRgn, kWindowConstrainMoveRegardlessOfFit | kWindowConstrainAllowPartial, NULL, NULL); - x_real_positions (f, &f->left_pos, &f->top_pos); +#if USE_CARBON_EVENTS + if (!NILP (tip_frame) && XFRAME (tip_frame) == f) +#endif + mac_handle_origin_change (f); #else { Rect inner, outer, screen_rect, dummy; @@ -5978,50 +6032,11 @@ x_set_window_size (f, change_gravity, cols, rows) x_wm_set_size_hint (f, (long) 0, 0); SizeWindow (FRAME_MAC_WINDOW (f), pixelwidth, pixelheight, 0); -#if TARGET_API_MAC_CARBON - if (f->output_data.mac->hourglass_control) - { -#if USE_CG_DRAWING - mac_prepare_for_quickdraw (f); -#endif - MoveControl (f->output_data.mac->hourglass_control, - pixelwidth - HOURGLASS_WIDTH, 0); - } -#endif - - /* Now, strictly speaking, we can't be sure that this is accurate, - but the window manager will get around to dealing with the size - change request eventually, and we'll hear how it went when the - ConfigureNotify event gets here. - - We could just not bother storing any of this information here, - and let the ConfigureNotify event set everything up, but that - might be kind of confusing to the Lisp code, since size changes - wouldn't be reported in the frame parameters until some random - point in the future when the ConfigureNotify event arrives. - We pass 1 for DELAY since we can't run Lisp code inside of - a BLOCK_INPUT. */ - change_frame_size (f, rows, cols, 0, 1, 0); - FRAME_PIXEL_WIDTH (f) = pixelwidth; - FRAME_PIXEL_HEIGHT (f) = pixelheight; - - /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to - receive in the ConfigureNotify event; if we get what we asked - for, then the event won't cause the screen to become garbaged, so - we have to make sure to do it here. */ - SET_FRAME_GARBAGED (f); - - XFlush (FRAME_X_DISPLAY (f)); - - /* If cursor was outside the new size, mark it as off. */ - mark_window_cursors_off (XWINDOW (f->root_window)); - - /* Clear out any recollection of where the mouse highlighting was, - since it might be in a place that's outside the new frame size. - Actually checking whether it is outside is a pain in the neck, - so don't try--just let the highlighting be done afresh with new size. */ - cancel_mouse_face (f); +#if USE_CARBON_EVENTS + if (!NILP (tip_frame) && f == XFRAME (tip_frame)) +#endif + mac_handle_size_change (f, pixelwidth, pixelheight); UNBLOCK_INPUT; } @@ -6232,7 +6247,10 @@ x_make_frame_visible (f) kWindowCascadeOnParentWindowScreen #endif ); - x_real_positions (f, &f->left_pos, &f->top_pos); +#if USE_CARBON_EVENTS + if (!NILP (tip_frame) && f == XFRAME (tip_frame)) +#endif + mac_handle_origin_change (f); } else #endif @@ -9186,6 +9204,32 @@ do_grow_window (WindowPtr w, EventRecord *e) } +#if TARGET_API_MAC_CARBON +static Point +mac_get_ideal_size (f) + struct frame *f; +{ + struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); + WindowPtr w = FRAME_MAC_WINDOW (f); + Point ideal_size; + Rect standard_rect; + int height, width, columns, rows; + + ideal_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); + ideal_size.v = dpyinfo->height; + IsWindowInStandardState (w, &ideal_size, &standard_rect); + /* Adjust the standard size according to character boundaries. */ + width = standard_rect.right - standard_rect.left; + height = standard_rect.bottom - standard_rect.top; + columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); + rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); + ideal_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, columns); + ideal_size.v = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, rows); + + return ideal_size; +} +#endif + /* Handle clicks in zoom box. Calculation of "standard state" based on code in IM - Window Manager A and code contributed by Ben Mesander. The standard state of an Emacs window is 80-characters @@ -9195,39 +9239,28 @@ static void do_zoom_window (WindowPtr w, int zoom_in_or_out) { Rect zoom_rect, port_rect; - int columns, rows, width, height; + int 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; - - standard_size.h = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, DEFAULT_NUM_COLS); - standard_size.v = dpyinfo->height; + Point ideal_size = mac_get_ideal_size (f); - if (IsWindowInStandardState (w, &standard_size, &zoom_rect)) + GetWindowBounds (w, kWindowContentRgn, &port_rect); + if (IsWindowInStandardState (w, &ideal_size, &zoom_rect) + && port_rect.left == zoom_rect.left + && port_rect.top == zoom_rect.top) 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; - } + zoom_in_or_out = inZoomOut; - ZoomWindowIdeal (w, zoom_in_or_out, &standard_size); +#ifdef MAC_OS8 + mac_clear_window (f); +#endif + ZoomWindowIdeal (w, zoom_in_or_out, &ideal_size); #else /* not TARGET_API_MAC_CARBON */ GrafPtr save_port; Point top_left; - int w_title_height; + int w_title_height, rows; + struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f); GetPort (&save_port); @@ -9266,6 +9299,7 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) SetPort (save_port); #endif /* not TARGET_API_MAC_CARBON */ +#if !USE_CARBON_EVENTS /* retrieve window size and update application values */ #if TARGET_API_MAC_CARBON GetWindowPortBounds (w, &port_rect); @@ -9275,20 +9309,9 @@ do_zoom_window (WindowPtr w, int zoom_in_or_out) height = port_rect.bottom - port_rect.top; width = port_rect.right - port_rect.left; - if (width != FRAME_PIXEL_WIDTH (f) - || height != FRAME_PIXEL_HEIGHT (f)) - { - rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES (f, height); - columns = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (f, width); - - change_frame_size (f, rows, columns, 0, 1, 0); - SET_FRAME_GARBAGED (f); - cancel_mouse_face (f); - - FRAME_PIXEL_WIDTH (f) = width; - FRAME_PIXEL_HEIGHT (f) = height; - } - x_real_positions (f, &f->left_pos, &f->top_pos); + mac_handle_size_change (f, width, height); + mac_handle_origin_change (f); +#endif } void @@ -9427,6 +9450,7 @@ mac_handle_window_event (next_handler, event, data) { WindowPtr wp; OSStatus result, err; + struct frame *f; UInt32 attributes; XSizeHints *size_hints; @@ -9435,6 +9459,7 @@ mac_handle_window_event (next_handler, event, data) if (err != noErr) return eventNotHandledErr; + f = mac_window_to_frame (wp); switch (GetEventKind (event)) { case kEventWindowUpdate: @@ -9445,6 +9470,21 @@ mac_handle_window_event (next_handler, event, data) do_window_update (wp); return noErr; + case kEventWindowGetIdealSize: + result = CallNextEventHandler (next_handler, event); + if (result != eventNotHandledErr) + return result; + + { + Point ideal_size = mac_get_ideal_size (f); + + err = SetEventParameter (event, kEventParamDimensions, + typeQDPoint, sizeof (Point), &ideal_size); + if (err == noErr) + return noErr; + } + break; + case kEventWindowBoundsChanging: result = CallNextEventHandler (next_handler, event); if (result != eventNotHandledErr) @@ -9455,7 +9495,7 @@ mac_handle_window_event (next_handler, event, data) if (err != noErr) break; - size_hints = FRAME_SIZE_HINTS (mac_window_to_frame (wp)); + size_hints = FRAME_SIZE_HINTS (f); if ((attributes & kWindowBoundsChangeUserResize) && ((size_hints->flags & (PResizeInc | PBaseSize | PMinSize)) == (PResizeInc | PBaseSize | PMinSize))) @@ -9496,24 +9536,53 @@ mac_handle_window_event (next_handler, event, data) } break; + case kEventWindowBoundsChanged: + err = GetEventParameter (event, kEventParamAttributes, typeUInt32, + NULL, sizeof (UInt32), NULL, &attributes); + if (err != noErr) + break; + + if (attributes & kWindowBoundsChangeSizeChanged) + { + Rect bounds; + + err = GetEventParameter (event, kEventParamCurrentBounds, + typeQDRectangle, NULL, sizeof (Rect), + NULL, &bounds); + if (err == noErr) + { + int width, height; + + width = bounds.right - bounds.left; + height = bounds.bottom - bounds.top; + mac_handle_size_change (f, width, height); + } + } + + if (attributes & kWindowBoundsChangeOriginChanged) + mac_handle_origin_change (f); + + return noErr; + case kEventWindowShown: case kEventWindowHidden: case kEventWindowExpanded: case kEventWindowCollapsed: result = CallNextEventHandler (next_handler, event); - mac_handle_visibility_change (mac_window_to_frame (wp)); + mac_handle_visibility_change (f); return noErr; break; case kEventWindowClose: + result = CallNextEventHandler (next_handler, event); { struct input_event buf; EVENT_INIT (buf); buf.kind = DELETE_WINDOW_EVENT; - XSETFRAME (buf.frame_or_window, mac_window_to_frame (wp)); + XSETFRAME (buf.frame_or_window, f); buf.arg = Qnil; kbd_buffer_store_event (&buf); } @@ -9929,7 +9998,9 @@ install_window_handler (window) #if USE_CARBON_EVENTS EventTypeSpec specs_window[] = {{kEventClassWindow, kEventWindowUpdate}, + {kEventClassWindow, kEventWindowGetIdealSize}, {kEventClassWindow, kEventWindowBoundsChanging}, + {kEventClassWindow, kEventWindowBoundsChanged}, {kEventClassWindow, kEventWindowShown}, {kEventClassWindow, kEventWindowHidden}, {kEventClassWindow, kEventWindowExpanded}, @@ -10469,12 +10540,14 @@ XTread_socket (sd, expected, hold_quit) DragWindow (window_ptr, er.where, &qd.screenBits.bounds); #endif /* not TARGET_API_MAC_CARBON */ /* Update the frame parameters. */ +#if !USE_CARBON_EVENTS { struct frame *f = mac_window_to_frame (window_ptr); if (f && !f->async_iconified) - x_real_positions (f, &f->left_pos, &f->top_pos); + mac_handle_origin_change (f); } +#endif break; case inGoAway: @@ -10573,7 +10646,7 @@ XTread_socket (sd, expected, hold_quit) else { /* Generate SELECT_WINDOW_EVENTs when needed. */ - if (mouse_autoselect_window) + if (!NILP (Vmouse_autoselect_window)) { Lisp_Object window; diff --git a/src/msdos.c b/src/msdos.c index 581b2ea38e8..d42e81d9d20 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -3381,7 +3381,7 @@ dos_rawgetc () } /* Generate SELECT_WINDOW_EVENTs when needed. */ - if (mouse_autoselect_window) + if (!NILP (Vmouse_autoselect_window)) { mouse_window = window_from_coordinates (SELECTED_FRAME(), mouse_last_x, diff --git a/src/print.c b/src/print.c index 80fe22c7149..1cc85270bc6 100644 --- a/src/print.c +++ b/src/print.c @@ -365,7 +365,10 @@ printchar (ch, fun) print_buffer. PRINTCHARFUN t means output to the echo area or to stdout if non-interactive. If neither nil nor t, call Lisp function PRINTCHARFUN for each character printed. MULTIBYTE - non-zero means PTR contains multibyte characters. */ + non-zero means PTR contains multibyte characters. + + In the case where PRINTCHARFUN is nil, it is safe for PTR to point + to data in a Lisp string. Otherwise that is not safe. */ static void strout (ptr, size, size_byte, printcharfun, multibyte) @@ -414,7 +417,7 @@ strout (ptr, size, size_byte, printcharfun, multibyte) if (size == size_byte) { for (i = 0; i < size; ++i) - insert_char ((unsigned char )*ptr++); + insert_char ((unsigned char) *ptr++); } else { @@ -502,10 +505,29 @@ print_string (string, printcharfun) else chars = SBYTES (string); - /* strout is safe for output to a frame (echo area) or to print_buffer. */ - strout (SDATA (string), - chars, SBYTES (string), - printcharfun, STRING_MULTIBYTE (string)); + if (EQ (printcharfun, Qt)) + { + /* Output to echo area. */ + int nbytes = SBYTES (string); + char *buffer; + + /* Copy the string contents so that relocation of STRING by + GC does not cause trouble. */ + USE_SAFE_ALLOCA; + + SAFE_ALLOCA (buffer, char *, nbytes); + bcopy (SDATA (string), buffer, nbytes); + + strout (buffer, chars, SBYTES (string), + printcharfun, STRING_MULTIBYTE (string)); + + SAFE_FREE (); + } + else + /* No need to copy, since output to print_buffer can't GC. */ + strout (SDATA (string), + chars, SBYTES (string), + printcharfun, STRING_MULTIBYTE (string)); } else { diff --git a/src/process.c b/src/process.c index b218a952e5f..c3bbb33509d 100644 --- a/src/process.c +++ b/src/process.c @@ -318,6 +318,12 @@ static int read_process_output P_ ((Lisp_Object, int)); #define POLL_FOR_INPUT #endif +static Lisp_Object get_process (); +static void exec_sentinel (); + +extern EMACS_TIME timer_check (); +extern int timers_run; + /* Mask of bits indicating the descriptors that we wait for input on. */ static SELECT_TYPE input_wait_mask; @@ -386,15 +392,13 @@ struct sockaddr_and_len { #define DATAGRAM_CONN_P(proc) (0) #endif -static Lisp_Object get_process (); -static void exec_sentinel (); - -extern EMACS_TIME timer_check (); -extern int timers_run; - /* Maximum number of bytes to send to a pty without an eof. */ static int pty_max_bytes; +/* Nonzero means don't run process sentinels. This is used + when exiting. */ +int inhibit_sentinels; + #ifdef HAVE_PTYS #ifdef HAVE_PTY_H #include <pty.h> @@ -6547,6 +6551,9 @@ exec_sentinel (proc, reason) int outer_running_asynch_code = running_asynch_code; int waiting = waiting_for_user_input_p; + if (inhibit_sentinels) + return; + /* No need to gcpro these, because all we do with them later is test them for EQness, and none of them should be a string. */ odeactivate = Vdeactivate_mark; @@ -6876,6 +6883,8 @@ init_process () { register int i; + inhibit_sentinels = 0; + #ifdef SIGCHLD #ifndef CANNOT_DUMP if (! noninteractive || initialized) diff --git a/src/process.h b/src/process.h index b585515d6b1..fcf8d9b6c1f 100644 --- a/src/process.h +++ b/src/process.h @@ -161,5 +161,9 @@ extern int synch_process_retcode; #define NULL_DEVICE "/dev/null" #endif +/* Nonzero means don't run process sentinels. This is used + when exiting. */ +extern int inhibit_sentinels; + /* arch-tag: dffedfc4-d7bc-4b58-a26f-c16155449c72 (do not change this comment) */ diff --git a/src/search.c b/src/search.c index d826e2e1b05..ce9fa958910 100644 --- a/src/search.c +++ b/src/search.c @@ -134,6 +134,9 @@ compile_pattern_1 (cp, pattern, translate, regp, posix, multibyte) cp->buf.multibyte = STRING_MULTIBYTE (pattern); cp->buf.target_multibyte = multibyte; cp->whitespace_regexp = Vsearch_spaces_regexp; + /* Doing BLOCK_INPUT here has the effect that + the debugger won't run if an error occurs. + Why is BLOCK_INPUT needed here? */ BLOCK_INPUT; old = re_set_syntax (RE_SYNTAX_EMACS | (posix ? 0 : RE_NO_POSIX_BACKTRACKING)); @@ -250,6 +253,10 @@ looking_at_1 (string, posix) if (running_asynch_code) save_search_regs (); + /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] + = current_buffer->case_eqv_table; + CHECK_STRING (string); bufp = compile_pattern (string, &search_regs, (!NILP (current_buffer->case_fold_search) @@ -357,6 +364,10 @@ string_match_1 (regexp, string, start, posix) pos_byte = string_char_to_byte (string, pos); } + /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] + = current_buffer->case_eqv_table; + bufp = compile_pattern (regexp, &search_regs, (!NILP (current_buffer->case_fold_search) ? current_buffer->case_canon_table : Qnil), @@ -896,6 +907,10 @@ search_command (string, bound, noerror, count, direction, RE, posix) lim_byte = CHAR_TO_BYTE (lim); } + /* This is so set_image_of_range_1 in regex.c can find the EQV table. */ + XCHAR_TABLE (current_buffer->case_canon_table)->extras[2] + = current_buffer->case_eqv_table; + np = search_buffer (string, PT, PT_BYTE, lim, lim_byte, n, RE, (!NILP (current_buffer->case_fold_search) ? current_buffer->case_canon_table diff --git a/src/textprop.c b/src/textprop.c index 785ed19b566..a039c17ae64 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -1001,17 +1001,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) && (NILP (limit) || next->position < XFASTINT (limit))) next = next_interval (next); - if (NULL_INTERVAL_P (next)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) - ? SCHARS (object) - : BUF_ZV (XBUFFER (object)))); - if (!(next->position < XFASTINT (limit))) + if (NULL_INTERVAL_P (next) + || (next->position + >= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) + ? SCHARS (object) + : BUF_ZV (XBUFFER (object)))))) return limit; - - XSETFASTINT (position, next->position); - return position; + else + return make_number (next->position); } /* Return 1 if there's a change in some property between BEG and END. */ @@ -1083,16 +1082,16 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT. */) && (NILP (limit) || next->position < XFASTINT (limit))) next = next_interval (next); - if (NULL_INTERVAL_P (next)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) - ? SCHARS (object) - : BUF_ZV (XBUFFER (object)))); - if (!(next->position < XFASTINT (limit))) + if (NULL_INTERVAL_P (next) + || (next->position + >= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) + ? SCHARS (object) + : BUF_ZV (XBUFFER (object)))))) return limit; - - return make_number (next->position); + else + return make_number (next->position); } DEFUN ("previous-property-change", Fprevious_property_change, @@ -1132,14 +1131,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) && (NILP (limit) || (previous->position + LENGTH (previous) > XFASTINT (limit)))) previous = previous_interval (previous); - if (NULL_INTERVAL_P (previous)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))); - if (!(previous->position + LENGTH (previous) > XFASTINT (limit))) - return limit; - return make_number (previous->position + LENGTH (previous)); + if (NULL_INTERVAL_P (previous) + || (previous->position + LENGTH (previous) + <= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))))) + return limit; + else + return make_number (previous->position + LENGTH (previous)); } DEFUN ("previous-single-property-change", Fprevious_single_property_change, @@ -1184,14 +1184,15 @@ back past position LIMIT; return LIMIT if nothing is found until LIMIT. */) && (NILP (limit) || (previous->position + LENGTH (previous) > XFASTINT (limit)))) previous = previous_interval (previous); - if (NULL_INTERVAL_P (previous)) - return limit; - if (NILP (limit)) - XSETFASTINT (limit, (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))); - if (!(previous->position + LENGTH (previous) > XFASTINT (limit))) - return limit; - return make_number (previous->position + LENGTH (previous)); + if (NULL_INTERVAL_P (previous) + || (previous->position + LENGTH (previous) + <= (INTEGERP (limit) + ? XFASTINT (limit) + : (STRINGP (object) ? 0 : BUF_BEGV (XBUFFER (object)))))) + return limit; + else + return make_number (previous->position + LENGTH (previous)); } /* Callers note, this can GC when OBJECT is a buffer (or nil). */ diff --git a/src/w32menu.c b/src/w32menu.c index 11af1d66b6f..3a4dc20fc15 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -149,10 +149,10 @@ GetMenuItemInfoA_Proc get_menu_item_info = NULL; SetMenuItemInfoA_Proc set_menu_item_info = NULL; AppendMenuW_Proc unicode_append_menu = NULL; -Lisp_Object Vmenu_updating_frame; - Lisp_Object Qdebug_on_next_call; +extern Lisp_Object Vmenu_updating_frame; + extern Lisp_Object Qmenu_bar; extern Lisp_Object QCtoggle, QCradio; @@ -2548,11 +2548,6 @@ void syms_of_w32menu () Qdebug_on_next_call = intern ("debug-on-next-call"); staticpro (&Qdebug_on_next_call); - DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame, - doc: /* Frame for which we are updating a menu. -The enable predicate for a menu command should check this variable. */); - Vmenu_updating_frame = Qnil; - defsubr (&Sx_popup_menu); #ifdef HAVE_MENUS defsubr (&Sx_popup_dialog); diff --git a/src/w32term.c b/src/w32term.c index d77b7049c4b..9353e62c274 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -4449,7 +4449,7 @@ w32_read_socket (sd, expected, hold_quit) if (f) { /* Generate SELECT_WINDOW_EVENTs when needed. */ - if (mouse_autoselect_window) + if (!NILP (Vmouse_autoselect_window)) { Lisp_Object window; int x = LOWORD (msg.msg.lParam); diff --git a/src/xdisp.c b/src/xdisp.c index f26a4231e9d..cf241a4159a 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -263,9 +263,9 @@ Lisp_Object list_of_error; Lisp_Object Vfontification_functions; Lisp_Object Qfontification_functions; -/* Non-zero means automatically select any window when the mouse +/* Non-nil means automatically select any window when the mouse cursor moves into it. */ -int mouse_autoselect_window; +Lisp_Object Vmouse_autoselect_window; /* Non-zero means draw tool bar buttons raised when the mouse moves over them. */ @@ -622,6 +622,11 @@ int message_buf_print; Lisp_Object Qinhibit_menubar_update; int inhibit_menubar_update; +/* When evaluating expressions from menu bar items (enable conditions, + for instance), this is the frame they are being processed for. */ + +Lisp_Object Vmenu_updating_frame; + /* Maximum height for resizing mini-windows. Either a float specifying a fraction of the available height, or an integer specifying a number of lines. */ @@ -9297,7 +9302,7 @@ update_menu_bar (f, save_match_data, hooks_run) happen when, for instance, an activate-menubar-hook causes a redisplay. */ if (inhibit_menubar_update) - return; + return hooks_run; window = FRAME_SELECTED_WINDOW (f); w = XWINDOW (window); @@ -9368,6 +9373,7 @@ update_menu_bar (f, save_match_data, hooks_run) hooks_run = 1; } + XSETFRAME (Vmenu_updating_frame, f); FRAME_MENU_BAR_ITEMS (f) = menu_bar_items (FRAME_MENU_BAR_ITEMS (f)); /* Redisplay the menu bar in case we changed it. */ @@ -10949,13 +10955,13 @@ redisplay_internal (preserve_echo_area) int preserve_echo_area; { struct window *w = XWINDOW (selected_window); - struct frame *f = XFRAME (w->frame); + struct frame *f; int pause; int must_finish = 0; struct text_pos tlbufpos, tlendpos; int number_of_visible_frames; int count; - struct frame *sf = SELECTED_FRAME (); + struct frame *sf; int polling_stopped_here = 0; /* Non-zero means redisplay has to consider all windows on all @@ -10968,8 +10974,16 @@ redisplay_internal (preserve_echo_area) initialized, or redisplay is explicitly turned off by setting Vinhibit_redisplay. */ if (noninteractive - || !NILP (Vinhibit_redisplay) - || !f->glyphs_initialized_p) + || !NILP (Vinhibit_redisplay)) + return; + + /* Don't examine these until after testing Vinhibit_redisplay. + When Emacs is shutting down, perhaps because its connection to + X has dropped, we should not look at them at all. */ + f = XFRAME (w->frame); + sf = SELECTED_FRAME (); + + if (!f->glyphs_initialized_p) return; /* The flag redisplay_performed_directly_p is set by @@ -21568,14 +21582,16 @@ get_window_cursor_type (w, glyph, width, active_cursor) if (cursor_type == FILLED_BOX_CURSOR) { /* Using a block cursor on large images can be very annoying. - So use a hollow cursor for "large" images. */ + So use a hollow cursor for "large" images. + If image is not transparent (no mask), also use hollow cursor. */ struct image *img = IMAGE_FROM_ID (f, glyph->u.img_id); if (img != NULL && IMAGEP (img->spec)) { /* Arbitrarily, interpret "Large" as >32x32 and >NxN where N = size of default frame font size. This should cover most of the "tiny" icons people may use. */ - if (img->width > max (32, WINDOW_FRAME_COLUMN_WIDTH (w)) + if (!img->mask + || img->width > max (32, WINDOW_FRAME_COLUMN_WIDTH (w)) || img->height > max (32, WINDOW_FRAME_LINE_HEIGHT (w))) cursor_type = HOLLOW_BOX_CURSOR; } @@ -24339,9 +24355,22 @@ Each function is called with two arguments, the window and the end trigger value See `set-window-redisplay-end-trigger'. */); Vredisplay_end_trigger_functions = Qnil; - DEFVAR_BOOL ("mouse-autoselect-window", &mouse_autoselect_window, - doc: /* *Non-nil means autoselect window with mouse pointer. */); - mouse_autoselect_window = 0; + DEFVAR_LISP ("mouse-autoselect-window", &Vmouse_autoselect_window, + doc: /* *Non-nil means autoselect window with mouse pointer. +If nil, do not autoselect windows. +A positive number means delay autoselection by that many seconds: a +window is autoselected only after the mouse has remained in that +window for the duration of the delay. +A negative number has a similar effect, but causes windows to be +autoselected only after the mouse has stopped moving. \(Because of +the way Emacs compares mouse events, you will occasionally wait twice +that time before the window gets selected.\) +Any other value means to autoselect window instantaneously when the +mouse pointer enters it. + +Autoselection selects the minibuffer only if it is active, and never +unselects the minibuffer if it is active. */); + Vmouse_autoselect_window = Qnil; DEFVAR_BOOL ("auto-resize-tool-bars", &auto_resize_tool_bars_p, doc: /* *Non-nil means automatically resize tool-bars. @@ -24461,6 +24490,11 @@ This is used to update submenus such as Buffers, whose contents depend on various data. */); Vmenu_bar_update_hook = Qnil; + DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame, + doc: /* Frame for which we are updating a menu. +The enable predicate for a menu binding should check this variable. */); + Vmenu_updating_frame = Qnil; + DEFVAR_BOOL ("inhibit-menubar-update", &inhibit_menubar_update, doc: /* Non-nil means don't update menu bars. Internal use only. */); inhibit_menubar_update = 0; diff --git a/src/xfns.c b/src/xfns.c index b0e04d76439..8e35c30c5e6 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -4123,11 +4123,15 @@ If DISPLAY is nil, that stands for the selected frame's display. */) x_destroy_all_bitmaps (dpyinfo); XSetCloseDownMode (dpyinfo->display, DestroyAll); +#ifdef USE_GTK + xg_display_close (dpyinfo->display); +#else #ifdef USE_X_TOOLKIT XtCloseDisplay (dpyinfo->display); #else XCloseDisplay (dpyinfo->display); #endif +#endif /* ! USE_GTK */ x_delete_display (dpyinfo); UNBLOCK_INPUT; @@ -5410,6 +5414,8 @@ or directory must exist. ONLY-DIR-P is ignored." */) int count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; + check_x (); + GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); if (popup_activated ()) @@ -5577,6 +5583,8 @@ directories. */) struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; char *cdef_file; + check_x (); + GCPRO6 (prompt, dir, default_filename, mustmatch, only_dir_p, file); if (popup_activated ()) diff --git a/src/xmenu.c b/src/xmenu.c index 8e994ac5efb..080f9e819a2 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -97,10 +97,10 @@ Boston, MA 02110-1301, USA. */ #define FALSE 0 #endif /* no TRUE */ -Lisp_Object Vmenu_updating_frame; - Lisp_Object Qdebug_on_next_call; +extern Lisp_Object Vmenu_updating_frame; + extern Lisp_Object Qmenu_bar; extern Lisp_Object QCtoggle, QCradio; @@ -1182,6 +1182,10 @@ x_menu_set_in_use (in_use) { menu_items_inuse = in_use ? Qt : Qnil; popup_activated_flag = in_use; +#ifdef USE_X_TOOLKIT + if (popup_activated_flag) + x_activate_timeout_atimer (); +#endif } /* Wait for an X event to arrive or for a timer to expire. */ @@ -1498,6 +1502,9 @@ popup_activate_callback (widget, id, client_data) XtPointer client_data; { popup_activated_flag = 1; +#ifdef USE_X_TOOLKIT + x_activate_timeout_atimer (); +#endif } #endif @@ -2798,6 +2805,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) /* Display the menu. */ lw_popup_menu (menu, (XEvent *) &dummy); popup_activated_flag = 1; + x_activate_timeout_atimer (); { int fact = 4 * sizeof (LWLIB_ID); @@ -3175,6 +3183,7 @@ create_and_show_dialog (f, first_wv) /* Display the dialog box. */ lw_pop_up_all_widgets (dialog_id); popup_activated_flag = 1; + x_activate_timeout_atimer (); /* Process events that apply to the dialog box. Also handle timers. */ @@ -3758,11 +3767,6 @@ syms_of_xmenu () Qdebug_on_next_call = intern ("debug-on-next-call"); staticpro (&Qdebug_on_next_call); - DEFVAR_LISP ("menu-updating-frame", &Vmenu_updating_frame, - doc: /* Frame for which we are updating a menu. -The enable predicate for a menu command should check this variable. */); - Vmenu_updating_frame = Qnil; - #ifdef USE_X_TOOLKIT widget_id_tick = (1<<16); next_menubar_widget_id = 1; diff --git a/src/xterm.c b/src/xterm.c index bb87b377d22..a75140fb9e3 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -2875,24 +2875,25 @@ x_draw_glyph_string (s) } else #endif - if (x_underline_at_descent_line) - y = s->y + s->height - h; - else - { - /* Get the underline position. This is the recommended - vertical offset in pixels from the baseline to the top of - the underline. This is a signed value according to the - specs, and its default is - - ROUND ((maximum descent) / 2), with - ROUND(x) = floor (x + 0.5) */ - - if (x_use_underline_position_properties - && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem)) - y = s->ybase + (long) tem; - else if (s->face->font) - y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; - } + { + y = s->y + s->height - h; + if (!x_underline_at_descent_line) + { + /* Get the underline position. This is the recommended + vertical offset in pixels from the baseline to the top of + the underline. This is a signed value according to the + specs, and its default is + + ROUND ((maximum descent) / 2), with + ROUND(x) = floor (x + 0.5) */ + + if (x_use_underline_position_properties + && XGetFontProperty (s->font, XA_UNDERLINE_POSITION, &tem)) + y = s->ybase + (long) tem; + else if (s->face->font) + y = s->ybase + (s->face->font->max_bounds.descent + 1) / 2; + } + } if (s->face->underline_defaulted_p) XFillRectangle (s->display, s->window, s->gc, @@ -4335,6 +4336,9 @@ x_send_scroll_bar_event (window, part, portion, whole) /* Make Xt timeouts work while the scroll bar is active. */ toolkit_scroll_bar_interaction = 1; +#ifdef USE_X_TOOLKIT + x_activate_timeout_atimer (); +#endif /* Setting the event mask to zero means that the message will be sent to the client that created the window, and if that @@ -6801,7 +6805,7 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) { /* Generate SELECT_WINDOW_EVENTs when needed. */ - if (mouse_autoselect_window) + if (!NILP (Vmouse_autoselect_window)) { Lisp_Object window; @@ -7718,7 +7722,7 @@ struct x_error_message_stack { static struct x_error_message_stack *x_error_message; /* An X error handler which stores the error message in - x_error_message_string. This is called from x_error_handler if + *x_error_message. This is called from x_error_handler if x_catch_errors is in effect. */ static void @@ -7737,7 +7741,7 @@ x_error_catcher (display, error) After calling this function, X protocol errors no longer cause Emacs to exit; instead, they are recorded in the string - stored in x_error_message_string. + stored in *x_error_message. Calling x_check_errors signals an Emacs error if an X error has occurred since the last call to x_catch_errors or x_check_errors. @@ -7997,7 +8001,7 @@ x_connection_closed (dpy, error_message) /* We specifically use it before defining it, so that gcc doesn't inline it, otherwise gdb doesn't know how to properly put a breakpoint on it. */ -static void x_error_quitter P_ ((Display *, XErrorEvent *)) NO_RETURN; +static void x_error_quitter P_ ((Display *, XErrorEvent *)); /* This is the first-level handler for X protocol errors. It calls x_error_quitter or x_error_catcher. */ @@ -8042,6 +8046,12 @@ x_error_quitter (display, error) { char buf[256], buf1[356]; + /* Ignore BadName errors. They can happen because of fonts + or colors that are not defined. */ + + if (error->error_code == BadName) + return; + /* Note that there is no real way portable across R3/R4 to get the original error handler. */ @@ -10589,6 +10599,11 @@ static XrmOptionDescRec emacs_options[] = { {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} }; + +/* Whether atimer for Xt timeouts is activated or not. */ + +static int x_timeout_atimer_activated_flag; + #endif /* USE_X_TOOLKIT */ static int x_initialized; @@ -11270,13 +11285,39 @@ static void x_process_timeouts (timer) struct atimer *timer; { + BLOCK_INPUT; + x_timeout_atimer_activated_flag = 0; if (toolkit_scroll_bar_interaction || popup_activated ()) { - BLOCK_INPUT; while (XtAppPending (Xt_app_con) & XtIMTimer) XtAppProcessEvent (Xt_app_con, XtIMTimer); - UNBLOCK_INPUT; + /* Reactivate the atimer for next time. */ + x_activate_timeout_atimer (); + } + UNBLOCK_INPUT; +} + +/* Install an asynchronous timer that processes Xt timeout events + every 0.1s as long as either `toolkit_scroll_bar_interaction' or + `popup_activated_flag' (in xmenu.c) is set. Make sure to call this + function whenever these variables are set. This is necessary + because some widget sets use timeouts internally, for example the + LessTif menu bar, or the Xaw3d scroll bar. When Xt timeouts aren't + processed, these widgets don't behave normally. */ + +void +x_activate_timeout_atimer () +{ + BLOCK_INPUT; + if (!x_timeout_atimer_activated_flag) + { + EMACS_TIME interval; + + EMACS_SET_SECS_USECS (interval, 0, 100000); + start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); + x_timeout_atimer_activated_flag = 1; } + UNBLOCK_INPUT; } #endif /* USE_X_TOOLKIT */ @@ -11382,17 +11423,6 @@ x_initialize () XtCacheByDisplay, cvt_pixel_dtor); XtAppSetFallbackResources (Xt_app_con, Xt_default_resources); - - /* Install an asynchronous timer that processes Xt timeout events - every 0.1s. This is necessary because some widget sets use - timeouts internally, for example the LessTif menu bar, or the - Xaw3d scroll bar. When Xt timouts aren't processed, these - widgets don't behave normally. */ - { - EMACS_TIME interval; - EMACS_SET_SECS_USECS (interval, 0, 100000); - start_atimer (ATIMER_CONTINUOUS, interval, x_process_timeouts, 0); - } #endif #ifdef USE_TOOLKIT_SCROLL_BARS diff --git a/src/xterm.h b/src/xterm.h index 1c5d215f864..7f8f0945aef 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -1012,6 +1012,7 @@ extern XtAppContext Xt_app_con; extern int x_alloc_lighter_color_for_widget __P ((Widget, Display*, Colormap, unsigned long *, double, int)); +extern void x_activate_timeout_atimer P_ ((void)); #endif extern void x_query_colors P_ ((struct frame *f, XColor *, int)); extern void x_query_color P_ ((struct frame *f, XColor *)); |