diff options
author | Karoly Lorentey <lorentey@elte.hu> | 2004-11-13 18:34:40 +0000 |
---|---|---|
committer | Karoly Lorentey <lorentey@elte.hu> | 2004-11-13 18:34:40 +0000 |
commit | e417405015c93c81641f5c4a33ec898b5c353772 (patch) | |
tree | 017a980c35c8a71c372304418d151e3826f88636 /src | |
parent | f590a2a442d19f3a74d7bbd02bbcb4e3239f2327 (diff) | |
parent | 68d1b30d251b4771f739d20f507cd9523ae3919b (diff) | |
download | emacs-e417405015c93c81641f5c4a33ec898b5c353772.tar.gz |
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-673
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-674
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-675
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-676
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-677
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-678
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-679
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-680
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-681
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-682
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-683
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-684
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-685
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-686
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-687
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-688
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-689
Merge from gnus--rel--5.10
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-690
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-691
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-692
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-693
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-69
Merge from emacs--cvs-trunk--0
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-70
Update from CVS
* miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-71
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-267
Diffstat (limited to 'src')
-rw-r--r-- | src/.gitignore | 1 | ||||
-rw-r--r-- | src/ChangeLog | 215 | ||||
-rw-r--r-- | src/Makefile.in | 14 | ||||
-rw-r--r-- | src/callint.c | 15 | ||||
-rw-r--r-- | src/data.c | 4 | ||||
-rw-r--r-- | src/dispextern.h | 42 | ||||
-rw-r--r-- | src/doc.c | 78 | ||||
-rw-r--r-- | src/dosfns.c | 6 | ||||
-rw-r--r-- | src/editfns.c | 12 | ||||
-rw-r--r-- | src/emacs.c | 23 | ||||
-rw-r--r-- | src/fontset.c | 41 | ||||
-rw-r--r-- | src/fringe.c | 6 | ||||
-rw-r--r-- | src/intervals.h | 7 | ||||
-rw-r--r-- | src/keyboard.c | 19 | ||||
-rw-r--r-- | src/keymap.c | 6 | ||||
-rw-r--r-- | src/lisp.h | 7 | ||||
-rw-r--r-- | src/lread.c | 10 | ||||
-rw-r--r-- | src/makefile.w32-in | 3 | ||||
-rw-r--r-- | src/msdos.c | 2 | ||||
-rw-r--r-- | src/print.c | 2 | ||||
-rw-r--r-- | src/process.c | 20 | ||||
-rw-r--r-- | src/window.c | 59 | ||||
-rw-r--r-- | src/xdisp.c | 122 | ||||
-rw-r--r-- | src/xfaces.c | 26 | ||||
-rw-r--r-- | src/xmenu.c | 124 | ||||
-rw-r--r-- | src/xselect.c | 33 |
26 files changed, 684 insertions, 213 deletions
diff --git a/src/.gitignore b/src/.gitignore index 406ff7cd5e2..48c78a4f3a6 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -17,3 +17,4 @@ obj prefix-args stamp-oldxmenu temacs +buildobj.lst diff --git a/src/ChangeLog b/src/ChangeLog index b65bb2d5714..cc9e71290d5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,189 @@ +2004-11-12 Kim F. Storm <storm@cua.dk> + + * dispextern.h (struct glyph_row): New member extra_line_spacing. + (struct it): New member max_extra_line_spacing. + (MR_PARTIALLY_VISIBLE, MR_PARTIALLY_VISIBLE_AT_TOP) + (MR_PARTIALLY_VISIBLE_AT_BOTTOM): New helper macros. + (MATRIX_ROW_PARTIALLY_VISIBLE_P): Fix to return false if invisible + part of last line is only extra line spacing (so the text on the + line is fully visible). Use helper macros. + Add W arg (to use them). All callers changed. + (MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P) + (MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P): Use helper macros. + + * window.c (window_scroll_pixel_based, Frecenter): Use + move_it_vertically_backward directly. + (Frecenter): Fix calculation of new start pos for negative arg. + Before, the new start pos was sometimes chosen too far back, so + the last line became only partially visible, and thus would be + either only semi-visible or automatically scrolled to the middle + of the window by redisplay. + + * xdisp.c (init_iterator): Clear it.max_extra_line_spacing. + (move_it_vertically_backward): Don't recure to move further back. + (move_it_vertically): Remove superfluous condition. + (move_it_by_lines): Clear last_height when moved 0 lines. + (resize_mini_window): use it.max_extra_line_spacing. + (display_tool_bar_line): Clear row->extra_line_spacing. + (try_scrolling): Use move_it_vertically_backward directly. + (redisplay_window): Likewise. + (compute_line_metrics): Set row->extra_line_spacing. + (display_line, display_string): Likewise. + (x_produce_glyphs): Update it->max_extra_line_spacing. + + * xmenu.c (pop_down_menu): Return nil. + +2004-11-12 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * xmenu.c (x_menu_wait_for_event): New function. + (popup_get_selection, popup_widget_loop): Call x_menu_wait_for_event + to handle timers. + (popup_widget_loop): Add argument do_timers. + (create_and_show_popup_menu, create_and_show_dialog): Pass 1 for + do_timers to popup_widget_loop. + (xmenu_show): Call XMenuActivateSetWaitFunction so that + x_menu_wait_for_event is called by XMenuActivate. + (create_and_show_popup_menu): Pass 1 for do_timers to + popup_get_selection. + (pop_down_menu): New function. + (popup_get_selection, popup_widget_loop): Unwind protect to + pop_down_menu. + (popup_widget_loop): Add argument widget. + (create_and_show_popup_menu, create_and_show_dialog): Pass new + argument widget to popup_widget_loop. + +2004-11-10 Stefan Monnier <monnier@iro.umontreal.ca> + + * keymap.c (Fkeymap_prompt): Accept symbol keymaps. + +2004-11-09 Kim F. Storm <storm@cua.dk> + + * xselect.c: Include <sys/types.h> and <unistd.h> (for getpid). + Fix various comments referring to XEvents instead of input events. + (x_queue_event): Fix format strings. + (x_stop_queuing_selection_requests): Likewise. + + * xdisp.c (produce_image_glyph): Remove unused variable 'face_ascent'. + (pint2hrstr): Add extra braces to silence compiler. + + * print.c (print_object): Fix format string. + + * lread.c (read1): Fix next_char matching. + + * lisp.h (Fdelete): Add EXFUN. + (replace_range_2): Add prototype. + + * keyboard.c (read_avail_input): Remove unused variable 'discard'. + + * intervals.h (NULL_INTERVAL_P): Add separate version when + ENABLE_CHECKING is not defined to silence compiler. + (compare_string_intervals): Add prototype. + + * fringe.c (destroy_fringe_bitmap): Fix return type. + (Ffringe_bitmaps_at_pos): Remove unused var 'old_buffer'. + + * emacs.c (Fdump_emacs): Fix format string. + + * doc.c: Include <ctype.h>. + (Fsubstitute_command_keys): Remove unused variable 'firstkey'. + + * data.c (store_symval_forwarding): Remove unused variables. + + * callint.c (Fcall_interactively): Remove unused variable 'funcar'. + +2004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * Makefile.in (stamp-oldxmenu): If HAVE_GTK, don't add dependencies + to ${OLDXMENU}. + +2004-11-09 Kim F. Storm <storm@cua.dk> + + * process.c (Fmake_network_process): Remove kludge for interrupted + connects on BSD. If connect is interrupted, just close socket and + start over rather than sleeping and retry with same socket. + +2004-11-09 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * .cvsignore: Add buildobj.lst. + + * doc.c: New variable Vbuild_files. + (Fsnarf_documentation): If Vbuild_files is nil, populate it with + file names from buildobh.lst. Only attach docstrings from files + that are in Vbuild_files. + (syms_of_doc): Defvar Vbuild_files. + + * Makefile.in (SOME_MACHINE_OBJECTS): Add fringe.o, image.o + and w32*.o. + (temacs${EXEEXT}): Generate buildobj.lst when temacs is linked. + (mostlyclean): rm buildobj.lst + + * makefile.w32-in ($(TEMACS)): Generate buildobj.lst when temacs + is linked. + +2004-11-09 Kim F. Storm <storm@cua.dk> + + * fringe.c (update_window_fringes): Update fringe bitmaps if + cur and row ends_at_zv_p differs. If bitmaps of a row is updated, + also update previous row to get rid of misc. artifacts. + +2004-11-08 Kim F. Storm <storm@cua.dk> + + * xdisp.c (fast_find_position): Fix start pos if header line present. + (note_mouse_highlight): Clear mouse face if we move out of text area. + +2004-11-08 Eli Zaretskii <eliz@gnu.org> + + * editfns.c: Move #include "systime.h" before <sys/resource.h>. + Don't include <sys/time.h> explicitly. + Include <stdio.h> unconditionally, not just on MacOS. + +2004-11-08 Kenichi Handa <handa@m17n.org> + + * fontset.c (fontset_pattern_regexp): Cancel my previous change; + don't pay attention to '\' before '*'. + (fontset_pattern_regexp): Change the meaning of the second arg. + (Fnew_fontset): Call fs_query_fontset, not Fquery_fontset. + (check_fontset_name): Try NAME as literal at first, and if it + failes, try NAME as pattern. + +2004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * emacs.c (Fdump_emacs): Only output warning on GNU/Linux. + +2004-11-07 Andreas Schwab <schwab@suse.de> + + * lisp.h: Declare Fmsdos_downcase_filename. + * dired.c: Don't declare Fmsdos_downcase_filename. + * fileio.c: Likewise. + +2004-11-07 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * dosfns.c (Fdos_memget, Fdos_memput): Use integer variable offs in + comparisons with integers instead of Lisp_Object address. + (Fmsdos_set_keyboard): Declare argument allkeys. + + * msdos.c (IT_set_frame_parameters): Use EQ, not ==, for Lisp_Object:s. + + * dired.c: extern declare Fmsdos_downcase_filename on MSDOS to avoid + int/Lisp_Object mixup. + + * fileio.c: Ditto. + +2004-11-06 Steven Tamm <steventamm@mac.com> + + * editfns.c: Need to include sys/time.h before resource.h on darwin. + +2004-11-06 Richard M. Stallman <rms@gnu.org> + + * callint.c (Fcall_interactively): Avoid reusing EVENT for other data. + + * xfaces.c (merge_named_face): GCPRO the face_name in the + named_merge_point struct that we make. + (merge_face_heights): Eliminate GCPRO arg. All callers changed. + + * keyboard.c (command_loop_1): Change Vtransient_mark_mode + before deciding whether to inactivate mark. + 2004-11-06 Lars Brinkhoff <lars@nocrew.org> * config.in: Regenerate (add HAVE_GETRUSAGE). @@ -16,7 +202,6 @@ * xmenu.c (popup_get_selection, create_and_show_popup_menu) (create_and_show_dialog): Revert change from 2004-10-31. - 2004-11-05 Luc Teirlinck <teirllm@auburn.edu> @@ -37,8 +222,8 @@ (x_stop_queuing_selection_requests): Add new queue for selection input events to replace previous XEvent queue in xterm.c. (queue_selection_requests_unwind): Adapt to new queue. - (x_reply_selection_request): Adapt to new queue. Unexpect - wait_object in case of x errors (memory leak). + (x_reply_selection_request): Adapt to new queue. + Unexpect wait_object in case of x errors (memory leak). (x_handle_selection_request, x_handle_selection_clear): Make static. (x_handle_selection_event): New function. May queue selection events. (wait_for_property_change_unwind): Use save_value instead of cons. @@ -91,7 +276,7 @@ * gtkutil.h: Declare use_old_gtk_file_dialog. * gtkutil.c: Make use_old_gtk_file_dialog non-static. - (xg_initialize): Moved DEFVAR_BOOL for use_old_gtk_file_dialog ... + (xg_initialize): Move DEFVAR_BOOL for use_old_gtk_file_dialog ... * xfns.c (syms_of_xfns): ... to here. * gtkutil.c (xg_get_file_with_chooser): Expand DEFAULT_FILENAME if @@ -166,20 +351,20 @@ * lisp.h: Fx_file_dialog takes 5 parameters. - * xfns.c (Fx_file_dialog): Both Motif and GTK version: Add - parameter only_dir_p. + * xfns.c (Fx_file_dialog): Both Motif and GTK version: + Add parameter only_dir_p. In Motif version, don't put DEFAULT_FILENAME in filter part of the dialog, just text field part. Do not add DEFAULT_FILENAME to list of files if it isn't there. In GTK version, pass only_dir_p parameter to xg_get_file_name. - * macfns.c (Fx_file_dialog): Add parameter only_dir_p. Check - only_dir_p instead of comparing prompt to "Dired". When using + * macfns.c (Fx_file_dialog): Add parameter only_dir_p. + Check only_dir_p instead of comparing prompt to "Dired". When using a save dialog, add option kNavDontConfirmReplacement, change title to "Enter name", change text for save button to "Ok". - * w32fns.c (Fx_file_dialog): Add parameter only_dir_p. Check - only_dir_p instead of comparing prompt to "Dired". + * w32fns.c (Fx_file_dialog): Add parameter only_dir_p. + Check only_dir_p instead of comparing prompt to "Dired". * gtkutil.c (xg_get_file_with_chooser) (xg_get_file_with_selection): New functions, only defined ifdef @@ -196,8 +381,8 @@ 2004-11-01 Kim F. Storm <storm@cua.dk> - * process.c (connect_wait_mask, num_pending_connects): Only - declare and use them if NON_BLOCKING_CONNECT is defined. + * process.c (connect_wait_mask, num_pending_connects): + Only declare and use them if NON_BLOCKING_CONNECT is defined. (init_process): Initialize them if NON_BLOCKING_CONNECT defined. (IF_NON_BLOCKING_CONNECT): New helper macro. (wait_reading_process_output): Only declare and use local vars @@ -212,8 +397,8 @@ * xmenu.c: Add prototypes for forward function declarations. (popup_get_selection): Remove parameter do_timers, remove call to timer_check. - (create_and_show_popup_menu, create_and_show_dialog): Remove - parameter do_timers from call to popup_get_selection. + (create_and_show_popup_menu, create_and_show_dialog): + Remove parameter do_timers from call to popup_get_selection. * xdisp.c (update_tool_bar): Pass a copy of f->tool_bar_items to tool_bar_items and assign the result to f->tool_bar_items if @@ -232,7 +417,7 @@ * macterm.c: allow user to assign key modifiers to the Mac Option key via a 'mac-option-modifier' variable. -2004-10-28 Stefan <monnier@iro.umontreal.ca> +2004-10-28 Stefan Monnier <monnier@iro.umontreal.ca> * xselect.c (Vx_lost_selection_functions, Vx_sent_selection_functions): Rename from Vx_lost_selection_hooks and Vx_sent_selection_hooks. diff --git a/src/Makefile.in b/src/Makefile.in index ebbc4f45d61..820ade11d39 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -596,8 +596,10 @@ obj= dispnew.o frame.o scroll.o xdisp.o $(XMENU_OBJ) window.o \ These go in the DOC file on all machines in case they are needed there. */ SOME_MACHINE_OBJECTS = sunfns.o dosfns.o msdos.o \ - xterm.o xfns.o xmenu.o xselect.o xrdb.o \ - mac.o macterm.o macfns.o macmenu.o fontset.o + xterm.o xfns.o xmenu.o xselect.o xrdb.o xsmfns.o fringe.o image.o \ + mac.o macterm.o macfns.o macmenu.o fontset.o \ + w32.o w32bdf.o w32console.o w32fns.o w32heap.o w32inevt.o \ + w32menu.o w32proc.o w32reg.o w32select.o w32term.o w32xfns.o #ifdef TERMINFO @@ -948,6 +950,7 @@ ${libsrc}make-docfile${EXEEXT}: #endif temacs${EXEEXT}: MAKE_PARALLEL $(LOCALCPP) $(STARTFILES) stamp-oldxmenu ${obj} ${otherobj} OBJECTS_MACHINE prefix-args${EXEEXT} + echo "${obj} ${otherobj} " OBJECTS_MACHINE > buildobj.lst $(LD) YMF_PASS_LDFLAGS (${STARTFLAGS} ${TEMACS_LDFLAGS}) $(LDFLAGS) \ -o temacs ${STARTFILES} ${obj} ${otherobj} \ OBJECTS_MACHINE ${LIBES} @@ -963,7 +966,7 @@ prefix-args${EXEEXT}: prefix-args.c $(config_h) #define OLDXMENU_OPTIONS #endif -#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) +#if defined (HAVE_X_WINDOWS) && defined (HAVE_X11) && defined (HAVE_MENUS) && ! defined (HAVE_GTK) /* We use stamp-xmenu with these two deps to both ensure that lwlib gets remade based on its dependencies @@ -1019,12 +1022,12 @@ really-oldXMenu: @true /* make -t should not create really-oldXMenu. */ .PHONY: really-oldXMenu #endif /* not USE_X_TOOLKIT */ -#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS) */ +#else /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */ /* We don\'t really need this, but satisfy the dependency. */ stamp-oldxmenu: touch stamp-oldxmenu -#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS) */ +#endif /* not (HAVE_X_WINDOWS && HAVE_X11 && HAVE_MENUS && ! HAVE_GTK) */ ../config.status:: epaths.in @echo "The file epaths.h needs to be set up from epaths.in." @@ -1279,6 +1282,7 @@ mostlyclean: rm -f temacs${EXEEXT} prefix-args${EXEEXT} core *.core \#* *.o libXMenu11.a liblw.a rm -f ../etc/DOC rm -f bootstrap-emacs${EXEEXT} + rm -f buildobj.lst clean: mostlyclean rm -f emacs-*${EXEEXT} emacs${EXEEXT} /**/# This is used in making a distribution. diff --git a/src/callint.c b/src/callint.c index da88693cd78..bb71ad50f44 100644 --- a/src/callint.c +++ b/src/callint.c @@ -265,7 +265,6 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */) Lisp_Object *args, *visargs; unsigned char **argstrings; Lisp_Object fun; - Lisp_Object funcar; Lisp_Object specs; Lisp_Object filter_specs; Lisp_Object teml; @@ -451,25 +450,25 @@ If KEYS is omitted or nil, the return value of `this-command-keys' is used. */) string++; else if (*string == '@') { - Lisp_Object event; + Lisp_Object event, tem; event = (next_event < key_count ? XVECTOR (keys)->contents[next_event] : Qnil); if (EVENT_HAS_PARAMETERS (event) - && (event = XCDR (event), CONSP (event)) - && (event = XCAR (event), CONSP (event)) - && (event = XCAR (event), WINDOWP (event))) + && (tem = XCDR (event), CONSP (tem)) + && (tem = XCAR (tem), CONSP (tem)) + && (tem = XCAR (tem), WINDOWP (tem))) { - if (MINI_WINDOW_P (XWINDOW (event)) - && ! (minibuf_level > 0 && EQ (event, minibuf_window))) + if (MINI_WINDOW_P (XWINDOW (tem)) + && ! (minibuf_level > 0 && EQ (tem, minibuf_window))) error ("Attempt to select inactive minibuffer window"); /* If the current buffer wants to clean up, let it. */ if (!NILP (Vmouse_leave_buffer_hook)) call1 (Vrun_hooks, Qmouse_leave_buffer_hook); - Fselect_window (event, Qnil); + Fselect_window (tem, Qnil); } string++; } diff --git a/src/data.c b/src/data.c index 92487f82ddb..2e3378cf319 100644 --- a/src/data.c +++ b/src/data.c @@ -908,8 +908,6 @@ store_symval_forwarding (symbol, valcontents, newval, buf) register Lisp_Object valcontents, newval; struct buffer *buf; { - int offset; - switch (SWITCH_ENUM_CAST (XTYPE (valcontents))) { case Lisp_Misc: @@ -941,7 +939,7 @@ store_symval_forwarding (symbol, valcontents, newval, buf) - (char *) &buffer_defaults); int idx = PER_BUFFER_IDX (offset); - Lisp_Object tail, buf; + Lisp_Object tail; if (idx <= 0) break; diff --git a/src/dispextern.h b/src/dispextern.h index 166d420d857..a179c8488dd 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -694,6 +694,10 @@ struct glyph_row frames. It may be < 0 in case of completely invisible rows. */ int visible_height; + /* Extra line spacing added after this row. Do not consider this + in last row when checking if row is fully visible. */ + int extra_line_spacing; + /* Hash code. This hash code is available as soon as the row is constructed, i.e. after a call to display_line. */ unsigned hash; @@ -916,22 +920,39 @@ struct glyph_row *matrix_row P_ ((struct glyph_matrix *, int)); #define MATRIX_ROW_DISPLAYS_TEXT_P(ROW) ((ROW)->displays_text_p) + +/* Helper macros */ + +#define MR_PARTIALLY_VISIBLE(ROW) \ + ((ROW)->height != (ROW)->visible_height) + +#define MR_PARTIALLY_VISIBLE_AT_TOP(W, ROW) \ + ((ROW)->y < WINDOW_HEADER_LINE_HEIGHT ((W))) + +#define MR_PARTIALLY_VISIBLE_AT_BOTTOM(W, ROW) \ + (((ROW)->y + (ROW)->height - (ROW)->extra_line_spacing) \ + > WINDOW_BOX_HEIGHT_NO_MODE_LINE ((W))) + /* Non-zero if ROW is not completely visible in window W. */ -#define MATRIX_ROW_PARTIALLY_VISIBLE_P(ROW) \ - ((ROW)->height != (ROW)->visible_height) +#define MATRIX_ROW_PARTIALLY_VISIBLE_P(W, ROW) \ + (MR_PARTIALLY_VISIBLE ((ROW)) \ + && (MR_PARTIALLY_VISIBLE_AT_TOP ((W), (ROW)) \ + || MR_PARTIALLY_VISIBLE_AT_BOTTOM ((W), (ROW)))) + + /* Non-zero if ROW is partially visible at the top of window W. */ #define MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P(W, ROW) \ - (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \ - && (ROW)->y < WINDOW_HEADER_LINE_HEIGHT ((W))) + (MR_PARTIALLY_VISIBLE ((ROW)) \ + && MR_PARTIALLY_VISIBLE_AT_TOP ((W), (ROW))) /* Non-zero if ROW is partially visible at the bottom of window W. */ -#define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW) \ - (MATRIX_ROW_PARTIALLY_VISIBLE_P ((ROW)) \ - && (ROW)->y + (ROW)->height > WINDOW_BOX_HEIGHT_NO_MODE_LINE ((W))) +#define MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P(W, ROW) \ + (MR_PARTIALLY_VISIBLE ((ROW)) \ + && MR_PARTIALLY_VISIBLE_AT_BOTTOM ((W), (ROW))) /* Return the bottom Y + 1 of ROW. */ @@ -1986,10 +2007,13 @@ struct it line, if the window has one. */ int last_visible_y; - /* Additional space in pixels between lines (for window systems - only.) */ + /* Default amount of additional space in pixels between lines (for + window systems only.) */ int extra_line_spacing; + /* Max extra line spacing added in this row. */ + int max_extra_line_spacing; + /* Override font height information for this glyph. Used if override_ascent >= 0. Cleared after this glyph. */ int override_ascent, override_descent, override_boff; diff --git a/src/doc.c b/src/doc.c index 82df9134f61..f306caed36a 100644 --- a/src/doc.c +++ b/src/doc.c @@ -24,6 +24,7 @@ Boston, MA 02111-1307, USA. */ #include <sys/types.h> #include <sys/file.h> /* Must be after sys/types.h for USG and BSD4_1*/ +#include <ctype.h> #ifdef HAVE_FCNTL_H #include <fcntl.h> @@ -51,6 +52,9 @@ Lisp_Object Vdoc_file_name; Lisp_Object Qfunction_documentation; +/* A list of files used to build this Emacs binary. */ +static Lisp_Object Vbuild_files; + extern Lisp_Object Voverriding_local_map; /* For VMS versions with limited file name syntax, @@ -581,6 +585,7 @@ the same file name is found in the `doc-directory'. */) register char *p, *end; Lisp_Object sym; char *name; + int skip_file = 0; CHECK_STRING (filename); @@ -618,6 +623,54 @@ the same file name is found in the `doc-directory'. */) #endif /* VMS4_4 */ #endif /* VMS */ + /* Vbuild_files is nil when temacs is run, and non-nil after that. */ + if (NILP (Vbuild_files)) + { + size_t cp_size = 0; + size_t to_read; + int nr_read; + char *cp = NULL; + char *beg, *end; + + fd = emacs_open ("buildobj.lst", O_RDONLY, 0); + if (fd < 0) + report_file_error ("Opening file buildobj.lst", Qnil); + + filled = 0; + for (;;) + { + cp_size += 1024; + to_read = cp_size - 1 - filled; + cp = xrealloc (cp, cp_size); + nr_read = emacs_read (fd, &cp[filled], to_read); + filled += nr_read; + if (nr_read < to_read) + break; + } + + emacs_close (fd); + cp[filled] = 0; + + for (beg = cp; *beg; beg = end) + { + int len; + + while (*beg && isspace (*beg)) ++beg; + + for (end = beg; *end && ! isspace (*end); ++end) + if (*end == '/') beg = end+1; /* skip directory part */ + + len = end - beg; + if (len > 4 && end[-4] == '.' && end[-3] == 'o') + len -= 2; /* Just take .o if it ends in .obj */ + + if (len > 0) + Vbuild_files = Fcons (make_string (beg, len), Vbuild_files); + } + + xfree (cp); + } + fd = emacs_open (name, O_RDONLY, 0); if (fd < 0) report_file_error ("Opening doc string file", @@ -640,10 +693,28 @@ the same file name is found in the `doc-directory'. */) if (p != end) { end = (char *) index (p, '\n'); + + /* See if this is a file name, and if it is a file in build-files. */ + if (p[1] == 'S' && end - p > 4 && end[-2] == '.' + && (end[-1] == 'o' || end[-1] == 'c')) + { + int len = end - p - 2; + char *fromfile = alloca (len + 1); + strncpy (fromfile, &p[2], len); + fromfile[len] = 0; + if (fromfile[len-1] == 'c') + fromfile[len-1] = 'o'; + + if (EQ (Fmember (build_string (fromfile), Vbuild_files), Qnil)) + skip_file = 1; + else + skip_file = 0; + } + sym = oblookup (Vobarray, p + 2, multibyte_chars_in_text (p + 2, end - p - 2), end - p - 2); - if (SYMBOLP (sym)) + if (! skip_file && SYMBOLP (sym)) { /* Attach a docstring to a variable? */ if (p[1] == 'V') @@ -756,7 +827,6 @@ thus, \\=\\=\\=\\= puts \\=\\= into the output, and \\=\\=\\=\\[ puts \\=\\[ int } else if (strp[0] == '\\' && strp[1] == '[') { - Lisp_Object firstkey; int start_idx; changed = 1; @@ -919,6 +989,10 @@ syms_of_doc () doc: /* Name of file containing documentation strings of built-in symbols. */); Vdoc_file_name = Qnil; + DEFVAR_LISP ("build-files", &Vbuild_files, + doc: /* A list of files used to build this Emacs binary. */); + Vbuild_files = Qnil; + defsubr (&Sdocumentation); defsubr (&Sdocumentation_property); defsubr (&Ssnarf_documentation); diff --git a/src/dosfns.c b/src/dosfns.c index d9714693507..bd62147ad48 100644 --- a/src/dosfns.c +++ b/src/dosfns.c @@ -110,7 +110,7 @@ Return the updated VECTOR. */) offs = (unsigned long) XINT (address); CHECK_VECTOR (vector); len = XVECTOR (vector)-> size; - if (len < 1 || len > 2048 || address < 0 || address > 0xfffff - len) + if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len) return Qnil; buf = alloca (len); dosmemget (offs, len, buf); @@ -135,7 +135,7 @@ DEFUN ("msdos-memput", Fdos_memput, Sdos_memput, 2, 2, 0, offs = (unsigned long) XINT (address); CHECK_VECTOR (vector); len = XVECTOR (vector)-> size; - if (len < 1 || len > 2048 || address < 0 || address > 0xfffff - len) + if (len < 1 || len > 2048 || offs < 0 || offs > 0xfffff - len) return Qnil; buf = alloca (len); @@ -155,7 +155,7 @@ If the optional argument ALLKEYS is non-nil, the keyboard is mapped for all keys; otherwise it is only used when the ALT key is pressed. The current keyboard layout is available in dos-keyboard-code. */) (country_code, allkeys) - Lisp_Object country_code; + Lisp_Object country_code, allkeys; { CHECK_NUMBER (country_code); if (!dos_set_keyboard (XINT (country_code), !NILP (allkeys))) diff --git a/src/editfns.c b/src/editfns.c index 2e8134d4495..45b7caa280b 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -22,6 +22,7 @@ Boston, MA 02111-1307, USA. */ #include <config.h> #include <sys/types.h> +#include <stdio.h> #ifdef VMS #include "vms-pwd.h" @@ -33,11 +34,10 @@ Boston, MA 02111-1307, USA. */ #include <unistd.h> #endif -/* Without this, sprintf on Mac OS Classic will produce wrong - result. */ -#ifdef MAC_OS8 -#include <stdio.h> -#endif +/* systime.h includes <sys/time.h> which, on some systems, is required + for <sys/resource.h>; thus systime.h must be included before + <sys/resource.h> */ +#include "systime.h" #if defined HAVE_SYS_RESOURCE_H #include <sys/resource.h> @@ -53,8 +53,6 @@ Boston, MA 02111-1307, USA. */ #include "frame.h" #include "window.h" -#include "systime.h" - #ifdef STDC_HEADERS #include <float.h> #define MAX_10_EXP DBL_MAX_10_EXP diff --git a/src/emacs.c b/src/emacs.c index ab60df39e27..356f74204bf 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1621,16 +1621,14 @@ main (argc, argv keys_of_minibuf (); keys_of_window (); } - else + else { - /* - Initialization that must be done even if the global variable - initialized is non zero - */ + /* Initialization that must be done even if the global variable + initialized is non zero. */ #ifdef HAVE_NTGUI globals_of_w32fns (); globals_of_w32menu (); -#endif /* end #ifdef HAVE_NTGUI */ +#endif /* HAVE_NTGUI */ } init_process (); /* init_display uses add_keyboard_wait_descriptor. */ @@ -2180,16 +2178,19 @@ You must run Emacs in batch mode in order to dump it. */) if (! noninteractive) error ("Dumping Emacs works only in batch mode"); +#ifdef __linux__ if (heap_bss_diff > MAX_HEAP_BSS_DIFF) { fprintf (stderr, "**************************************************\n"); fprintf (stderr, "Warning: Your system has a gap between BSS and the\n"); - fprintf (stderr, "heap. This usually means that exec-shield or\n"); - fprintf (stderr, "something similar is in effect. The dump may fail\n"); - fprintf (stderr, "because of this. See the section about exec-shield\n"); - fprintf (stderr, "in etc/PROBLEMS for more information.\n"); + fprintf (stderr, "heap (%lu byte). This usually means that exec-shield\n", + heap_bss_diff); + fprintf (stderr, "or something similar is in effect. The dump may\n"); + fprintf (stderr, "fail because of this. See the section about \n"); + fprintf (stderr, "exec-shield in etc/PROBLEMS for more information.\n"); fprintf (stderr, "**************************************************\n"); } +#endif /* __linux__ */ /* Bind `command-line-processed' to nil before dumping, so that the dumped Emacs will process its command line @@ -2278,7 +2279,7 @@ synchronize_locale (category, plocale, desired_locale) { *plocale = desired_locale; setlocale (category, (STRINGP (desired_locale) - ? (char *)(SDATA (desired_locale)) + ? (char *) SDATA (desired_locale) : "")); } } diff --git a/src/fontset.c b/src/fontset.c index f370f2ae981..7dff29f3ed8 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -797,7 +797,7 @@ fontset_pattern_regexp (pattern) { if (*p0 == '-') ndashes++; - else if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') + else if (*p0 == '*') nstars++; } @@ -812,7 +812,7 @@ fontset_pattern_regexp (pattern) *p1++ = '^'; for (p0 = SDATA (pattern); *p0; p0++) { - if (*p0 == '*' && p0 > SDATA (pattern) && p0[-1] != '\\') + if (*p0 == '*') { if (ndashes < 14) *p1++ = '.'; @@ -836,29 +836,33 @@ fontset_pattern_regexp (pattern) } /* Return ID of the base fontset named NAME. If there's no such - fontset, return -1. */ + fontset, return -1. NAME_PATTERN specifies how to treat NAME as this: + 0: pattern containing '*' and '?' as wildcards + 1: regular expression + 2: literal fontset name +*/ int -fs_query_fontset (name, regexpp) +fs_query_fontset (name, name_pattern) Lisp_Object name; - int regexpp; + int name_pattern; { Lisp_Object tem; int i; name = Fdowncase (name); - if (!regexpp) + if (name_pattern != 1) { tem = Frassoc (name, Vfontset_alias_alist); if (CONSP (tem) && STRINGP (XCAR (tem))) name = XCAR (tem); - else + else if (name_pattern == 0) { tem = fontset_pattern_regexp (name); if (STRINGP (tem)) { name = tem; - regexpp = 1; + name_pattern = 1; } } } @@ -873,7 +877,7 @@ fs_query_fontset (name, regexpp) continue; this_name = FONTSET_NAME (fontset); - if (regexpp + if (name_pattern == 1 ? fast_string_match (name, this_name) >= 0 : !strcmp (SDATA (name), SDATA (this_name))) return i; @@ -964,6 +968,7 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */) { Lisp_Object fontset, elements, ascii_font; Lisp_Object tem, tail, elt; + int id; (*check_window_system_func) (); @@ -971,10 +976,14 @@ FONTLIST is an alist of charsets vs corresponding font name patterns. */) CHECK_LIST (fontlist); name = Fdowncase (name); - tem = Fquery_fontset (name, Qnil); - if (!NILP (tem)) - error ("Fontset `%s' matches the existing fontset `%s'", - SDATA (name), SDATA (tem)); + id = fs_query_fontset (name, 2); + if (id >= 0) + { + fontset = FONTSET_FROM_ID (id); + tem = FONTSET_NAME (fontset); + error ("Fontset `%s' matches the existing fontset `%s'", + SDATA (name), SDATA (tem)); + } /* Check the validity of FONTLIST while creating a template for fontset elements. */ @@ -1049,7 +1058,11 @@ check_fontset_name (name) return Vdefault_fontset; CHECK_STRING (name); - id = fs_query_fontset (name, 0); + /* First try NAME as literal. */ + id = fs_query_fontset (name, 2); + if (id < 0) + /* For backward compatibility, try again NAME as pattern. */ + id = fs_query_fontset (name, 0); if (id < 0) error ("Fontset `%s' does not exist", SDATA (name)); return FONTSET_FROM_ID (id); diff --git a/src/fringe.c b/src/fringe.c index e66fa4adecc..03abffab5c8 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -931,6 +931,7 @@ update_window_fringes (w, force_p) if (force_p || row->y != cur->y || row->visible_height != cur->visible_height + || row->ends_at_zv_p != cur->ends_at_zv_p || left != cur->left_fringe_bitmap || right != cur->right_fringe_bitmap || left_face_id != cur->left_fringe_face_id @@ -954,6 +955,9 @@ update_window_fringes (w, force_p) row->right_fringe_bitmap = right; row->left_fringe_face_id = left_face_id; row->right_fringe_face_id = right_face_id; + + if (rn > 0 && row->redraw_fringe_bitmaps_p) + row[-1].redraw_fringe_bitmaps_p = cur[-1].redraw_fringe_bitmaps_p = 1; } return redraw_p; @@ -1057,7 +1061,7 @@ compute_fringe_widths (f, redraw) /* Free resources used by a user-defined bitmap. */ -int +void destroy_fringe_bitmap (n) int n; { diff --git a/src/intervals.h b/src/intervals.h index 15e59537377..f3b281f4184 100644 --- a/src/intervals.h +++ b/src/intervals.h @@ -84,9 +84,14 @@ struct interval #define INT_LISPLIKE(i) (BUFFERP ((Lisp_Object){(EMACS_INT)(i)}) \ || STRINGP ((Lisp_Object){(EMACS_INT)(i)})) #endif + +#ifdef ENABLE_CHECKING #define NULL_INTERVAL_P(i) \ ((void)CHECK (!INT_LISPLIKE (i), "non-interval"), (i) == NULL_INTERVAL) /* old #define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL || INT_LISPLIKE (i)) */ +#else +#define NULL_INTERVAL_P(i) ((i) == NULL_INTERVAL) +#endif /* True if this interval has no right child. */ #define NULL_RIGHT_CHILD(i) ((i)->right == NULL_INTERVAL) @@ -289,7 +294,7 @@ extern INTERVAL balance_intervals P_ ((INTERVAL)); extern INLINE void copy_intervals_to_string P_ ((Lisp_Object, struct buffer *, int, int)); extern INTERVAL copy_intervals P_ ((INTERVAL, int, int)); -extern int compare_string_intervals P_ ((Lisp_Object s1, Lisp_Object s2)); +extern int compare_string_intervals P_ ((Lisp_Object, Lisp_Object)); extern Lisp_Object textget P_ ((Lisp_Object, Lisp_Object)); extern Lisp_Object lookup_char_property P_ ((Lisp_Object, Lisp_Object, int)); extern void move_if_not_intangible P_ ((int)); diff --git a/src/keyboard.c b/src/keyboard.c index 35bfd1402c9..b520d655fb9 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1827,6 +1827,14 @@ command_loop_1 () if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) { + /* Setting transient-mark-mode to `only' is a way of + turning it on for just one command. */ + + if (EQ (Vtransient_mark_mode, Qidentity)) + Vtransient_mark_mode = Qnil; + if (EQ (Vtransient_mark_mode, Qonly)) + Vtransient_mark_mode = Qidentity; + if (!NILP (Vdeactivate_mark) && !NILP (Vtransient_mark_mode)) { /* We could also call `deactivate'mark'. */ @@ -1842,16 +1850,6 @@ command_loop_1 () call1 (Vrun_hooks, intern ("activate-mark-hook")); } - /* Setting transient-mark-mode to `only' is a way of - turning it on for just one command. */ - if (!NILP (current_buffer->mark_active) && !NILP (Vrun_hooks)) - { - if (EQ (Vtransient_mark_mode, Qidentity)) - Vtransient_mark_mode = Qnil; - if (EQ (Vtransient_mark_mode, Qonly)) - Vtransient_mark_mode = Qidentity; - } - finalize: if (current_buffer == prev_buffer @@ -6640,7 +6638,6 @@ read_avail_input (expected) if (d->read_socket_hook) { int nr; - struct input_event hold_quit; EVENT_INIT (hold_quit); diff --git a/src/keymap.c b/src/keymap.c index 256485079c1..891e41f0b58 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -214,13 +214,13 @@ when reading a key-sequence to be looked-up in this keymap. */) (map) Lisp_Object map; { + map = get_keymap (map, 0, 0); while (CONSP (map)) { - register Lisp_Object tem; - tem = Fcar (map); + Lisp_Object tem = XCAR (map); if (STRINGP (tem)) return tem; - map = Fcdr (map); + map = XCDR (map); } return Qnil; } diff --git a/src/lisp.h b/src/lisp.h index 7b9b0427da6..2c3141733bc 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -2278,6 +2278,7 @@ EXFUN (Felt, 2); EXFUN (Fmember, 2); EXFUN (Frassq, 2); EXFUN (Fdelq, 2); +EXFUN (Fdelete, 2); EXFUN (Fsort, 2); EXFUN (Freverse, 1); EXFUN (Fnreverse, 1); @@ -2369,6 +2370,7 @@ extern void adjust_after_replace P_ ((int, int, Lisp_Object, int, int)); extern void adjust_after_replace_noundo P_ ((int, int, int, int, int, int)); extern void adjust_after_insert P_ ((int, int, int, int, int)); extern void replace_range P_ ((int, int, Lisp_Object, int, int, int)); +extern void replace_range_2 P_ ((int, int, int, int, char *, int, int, int)); extern void syms_of_insdel P_ ((void)); /* Defined in dispnew.c */ @@ -3137,6 +3139,11 @@ extern void syms_of_xterm P_ ((void)); /* Defined in getloadavg.c */ extern int getloadavg P_ ((double [], int)); + +#ifdef MSDOS +/* Defined in msdos.c */ +EXFUN (Fmsdos_downcase_filename, 1); +#endif /* Nonzero means Emacs has already been initialized. Used during startup to detect startup of dumped Emacs. */ diff --git a/src/lread.c b/src/lread.c index 46fe6cd3e51..77750eea4fa 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2375,7 +2375,7 @@ read1 (readcharfun, pch, first_in_list) c = 0; else if (c == (CHAR_CTL | '?')) c = 127; - + if (c & CHAR_SHIFT) { /* Shift modifier is valid only with [A-Za-z]. */ @@ -2460,9 +2460,9 @@ read1 (readcharfun, pch, first_in_list) if (next_char <= 040 || (next_char < 0200 - && index ("\"';([#?", next_char) - || (!first_in_list && next_char == '`') - || (new_backquote_flag && next_char == ','))) + && (index ("\"';([#?", next_char) + || (!first_in_list && next_char == '`') + || (new_backquote_flag && next_char == ',')))) { *pch = c; return Qnil; @@ -3682,7 +3682,7 @@ init_lread () /* When Emacs is invoked over network shares on NT, PATH_LOADSEARCH is almost never correct, thereby causing a warning to be printed out that confuses users. Since PATH_LOADSEARCH is always overridden by the - EMACSLOADPATH environment variable below, disable the warning on NT. + EMACSLOADPATH environment variable below, disable the warning on NT. Also, when using the "self-contained" option for Carbon Emacs for MacOSX, the "standard" paths may not exist and would be overridden by EMACSLOADPATH as on NT. Since this depends on how the executable diff --git a/src/makefile.w32-in b/src/makefile.w32-in index a7efcc4cae5..5a232e28362 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -168,6 +168,9 @@ temacs: $(BLD) $(TEMACS) $(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS) "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 16 + echo $(OBJ0) > $(BLD)/buildobj.lst + echo $(OBJ1) >> $(BLD)/buildobj.lst + echo $(WIN32OBJ) >> $(BLD)/buildobj.lst bootstrap: bootstrap-emacs diff --git a/src/msdos.c b/src/msdos.c index 712eb05b959..ab71b642e80 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -2320,7 +2320,7 @@ IT_set_frame_parameters (f, alist) /* If we are creating a new frame, begin with the original screen colors used for the initial frame. */ - if (alist == Vdefault_frame_alist + if (EQ (alist, Vdefault_frame_alist) && initial_screen_colors[0] != -1 && initial_screen_colors[1] != -1) { FRAME_FOREGROUND_PIXEL (f) = initial_screen_colors[0]; diff --git a/src/print.c b/src/print.c index 76c648b9a2e..8bb55f21248 100644 --- a/src/print.c +++ b/src/print.c @@ -2087,7 +2087,7 @@ print_object (obj, printcharfun, escapeflag) case Lisp_Misc_Save_Value: strout ("#<save_value ", -1, -1, printcharfun, 0); - sprintf(buf, "ptr=0x%08x int=%d", + sprintf(buf, "ptr=0x%08lx int=%d", (unsigned long) XSAVE_VALUE (obj)->pointer, XSAVE_VALUE (obj)->integer); strout (buf, -1, -1, printcharfun, 0); diff --git a/src/process.c b/src/process.c index db6e85c0fb3..65dec1457b0 100644 --- a/src/process.c +++ b/src/process.c @@ -2722,7 +2722,6 @@ usage: (make-network-process &rest ARGS) */) int xerrno = 0; int s = -1, outch, inch; struct gcpro gcpro1; - int retry = 0; int count = SPECPDL_INDEX (); int count1; Lisp_Object QCaddress; /* one of QClocal or QCremote */ @@ -3023,6 +3022,8 @@ usage: (make-network-process &rest ARGS) */) { int optn, optbits; + retry_connect: + s = socket (lres->ai_family, lres->ai_socktype, lres->ai_protocol); if (s < 0) { @@ -3101,8 +3102,6 @@ usage: (make-network-process &rest ARGS) */) break; } - retry_connect: - immediate_quit = 1; QUIT; @@ -3144,22 +3143,13 @@ usage: (make-network-process &rest ARGS) */) immediate_quit = 0; - if (xerrno == EINTR) - goto retry_connect; - if (xerrno == EADDRINUSE && retry < 20) - { - /* A delay here is needed on some FreeBSD systems, - and it is harmless, since this retrying takes time anyway - and should be infrequent. */ - Fsleep_for (make_number (1), Qnil); - retry++; - goto retry_connect; - } - /* Discard the unwind protect closing S. */ specpdl_ptr = specpdl + count1; emacs_close (s); s = -1; + + if (xerrno == EINTR) + goto retry_connect; } if (s >= 0) diff --git a/src/window.c b/src/window.c index d9ac2eb62bd..be5e9167d67 100644 --- a/src/window.c +++ b/src/window.c @@ -206,7 +206,7 @@ static int window_initialized; Lisp_Object Qwindow_configuration_change_hook; Lisp_Object Vwindow_configuration_change_hook; -/* Nonzero means scroll commands try to put point +/* Non-nil means scroll commands try to put point at the same screen height as previously. */ Lisp_Object Vscroll_preserve_screen_position; @@ -4508,7 +4508,7 @@ window_scroll_pixel_based (window, n, whole, noerror) results for variable height lines. */ init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); it.current_y = it.last_visible_y; - move_it_vertically (&it, - window_box_height (w) / 2); + move_it_vertically_backward (&it, window_box_height (w) / 2); /* The function move_iterator_vertically may move over more than the specified y-distance. If it->w is small, e.g. a @@ -4518,14 +4518,14 @@ window_scroll_pixel_based (window, n, whole, noerror) if (it.current_y <= 0) { init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); - move_it_vertically (&it, 0); + move_it_vertically_backward (&it, 0); it.current_y = 0; } start = it.current.pos; } - /* If scroll_preserve_screen_position is non-zero, we try to set + /* If scroll_preserve_screen_position is non-nil, we try to set point in the same window line as it is now, so get that line. */ if (!NILP (Vscroll_preserve_screen_position)) { @@ -5187,7 +5187,7 @@ and redisplay normally--don't erase and redraw the frame. */) SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); - move_it_vertically (&it, - window_box_height (w) / 2); + move_it_vertically_backward (&it, window_box_height (w) / 2); charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); } @@ -5195,29 +5195,62 @@ and redisplay normally--don't erase and redraw the frame. */) { struct it it; struct text_pos pt; - int y0, y1, h, nlines; + int nlines = - XINT (arg); + int extra_line_spacing; + int h = window_box_height (w); SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); - y0 = it.current_y; + + /* Be sure we have the exact height of the full line containing PT. */ + move_it_by_lines (&it, 0, 1); /* The amount of pixels we have to move back is the window height minus what's displayed in the line containing PT, and the lines below. */ - nlines = - XINT (arg) - 1; + it.current_y = 0; + it.vpos = 0; move_it_by_lines (&it, nlines, 1); - y1 = line_bottom_y (&it); + if (it.vpos == nlines) + h -= it.current_y; + else + { + /* Last line has no newline */ + h -= line_bottom_y (&it); + it.vpos++; + } + + /* Don't reserve space for extra line spacing of last line. */ + extra_line_spacing = it.max_extra_line_spacing; /* If we can't move down NLINES lines because we hit the end of the buffer, count in some empty lines. */ if (it.vpos < nlines) - y1 += (nlines - it.vpos) * FRAME_LINE_HEIGHT (it.f); - - h = window_box_height (w) - (y1 - y0); + { + nlines -= it.vpos; + extra_line_spacing = it.extra_line_spacing; + h -= nlines * (FRAME_LINE_HEIGHT (it.f) + extra_line_spacing); + } + if (h <= 0) + return Qnil; + /* Now find the new top line (starting position) of the window. */ start_display (&it, w, pt); - move_it_vertically (&it, - h); + it.current_y = 0; + move_it_vertically_backward (&it, h); + + /* If extra line spacing is present, we may move too far + back. This causes the last line to be only partially + visible (which triggers redisplay to recenter that line + in the middle), so move forward. + But ignore extra line spacing on last line, as it is not + considered to be part of the visible height of the line. + */ + h += extra_line_spacing; + while (-it.current_y > h) + move_it_by_lines (&it, 1, 1); + charpos = IT_CHARPOS (it); bytepos = IT_BYTEPOS (it); } diff --git a/src/xdisp.c b/src/xdisp.c index 4b0865aa4f0..c3f659a85e6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2071,6 +2071,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id) * FRAME_LINE_HEIGHT (it->f)); else if (it->f->extra_line_spacing > 0) it->extra_line_spacing = it->f->extra_line_spacing; + it->max_extra_line_spacing = 0; } /* If realized faces have been removed, e.g. because of face @@ -6066,10 +6067,13 @@ move_it_vertically_backward (it, dy) { int nlines, h; struct it it2, it3; - int start_pos = IT_CHARPOS (*it); + int start_pos; + move_further_back: xassert (dy >= 0); + start_pos = IT_CHARPOS (*it); + /* Estimate how many newlines we must move back. */ nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f)); @@ -6135,13 +6139,13 @@ move_it_vertically_backward (it, dy) a line height of 13 pixels each, recentering with point on the bottom line will try to move -39/2 = 19 pixels backward. Try to avoid moving into the first line. */ - && it->current_y - target_y > line_height / 3 * 2 + && it->current_y - target_y > line_height * 2 / 3 && IT_CHARPOS (*it) > BEGV) { TRACE_MOVE ((stderr, " not far enough -> move_vert %d\n", target_y - it->current_y)); - move_it_vertically (it, target_y - it->current_y); - xassert (IT_CHARPOS (*it) >= BEGV); + dy = it->current_y - target_y; + goto move_further_back; } else if (target_y >= it->current_y + line_height && IT_CHARPOS (*it) < ZV) @@ -6182,7 +6186,7 @@ move_it_vertically (it, dy) { if (dy <= 0) move_it_vertically_backward (it, -dy); - else if (dy > 0) + else { TRACE_MOVE ((stderr, "move_it_v: from %d, %d\n", IT_CHARPOS (*it), dy)); move_it_to (it, ZV, -1, it->current_y + dy, -1, @@ -6279,6 +6283,8 @@ move_it_by_lines (it, dvpos, need_y_p) /* DVPOS == 0 means move to the start of the screen line. */ move_it_vertically_backward (it, 0); xassert (it->current_x == 0 && it->hpos == 0); + /* Let next call to line_bottom_y calculate real line height */ + last_height = 0; } else if (dvpos > 0) move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS); @@ -7422,7 +7428,7 @@ resize_mini_window (w, exact_p) height = it.current_y + last_height; else height = it.current_y + it.max_ascent + it.max_descent; - height -= it.extra_line_spacing; + height -= min (it.extra_line_spacing, it.max_extra_line_spacing); height = (height + unit - 1) / unit; } @@ -8699,6 +8705,7 @@ display_tool_bar_line (it) { row->height = row->phys_height = it->last_visible_y - row->y; row->ascent = row->phys_ascent = 0; + row->extra_line_spacing = 0; } row->full_width_p = 1; @@ -10888,7 +10895,7 @@ make_cursor_line_fully_visible (w, force_p) row = MATRIX_ROW (matrix, w->cursor.vpos); /* If the cursor row is not partially visible, there's nothing to do. */ - if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) + if (!MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)) return 1; /* If the row the cursor is in is taller than the window's height, @@ -11042,7 +11049,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, { start_display (&it, w, scroll_margin_pos); if (this_scroll_margin) - move_it_vertically (&it, - this_scroll_margin); + move_it_vertically_backward (&it, this_scroll_margin); if (extra_scroll_margin_lines) move_it_by_lines (&it, - extra_scroll_margin_lines, 0); scroll_margin_pos = it.current.pos; @@ -11162,7 +11169,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively, if (amount_to_scroll <= 0) return SCROLLING_FAILED; - move_it_vertically (&it, - amount_to_scroll); + move_it_vertically_backward (&it, amount_to_scroll); startp = it.current.pos; } } @@ -11466,7 +11473,7 @@ try_cursor_movement (window, startp, scroll_step) /* if PT is not in the glyph row, give up. */ rc = CURSOR_MOVEMENT_MUST_SCROLL; } - else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (row)) + else if (MATRIX_ROW_PARTIALLY_VISIBLE_P (w, row)) { if (PT == MATRIX_ROW_END_CHARPOS (row) && !row->ends_at_zv_p @@ -12043,7 +12050,7 @@ redisplay_window (window, just_this_one_p) if (it.current_y <= 0) { init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); - move_it_vertically (&it, 0); + move_it_vertically_backward (&it, 0); xassert (IT_CHARPOS (it) <= PT); it.current_y = 0; } @@ -12395,7 +12402,7 @@ try_window_reusing_current_matrix (w) /* Give up if old or new display is scrolled vertically. We could make this function handle this, but right now it doesn't. */ start_row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); - if (w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (start_row)) + if (w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (w, start_row)) return 0; /* The variable new_start now holds the new window start. The old @@ -12443,7 +12450,7 @@ try_window_reusing_current_matrix (w) start = start_row->start.pos; /* If there are no more rows to try, or just one, give up. */ if (start_row == MATRIX_MODE_LINE_ROW (w->current_matrix) - 1 - || w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (start_row) + || w->vscroll || MATRIX_ROW_PARTIALLY_VISIBLE_P (w, start_row) || CHARPOS (start) == ZV) { clear_glyph_matrix (w->desired_matrix); @@ -14237,6 +14244,7 @@ compute_line_metrics (it) row->height = it->max_ascent + it->max_descent; row->phys_ascent = it->max_phys_ascent; row->phys_height = it->max_phys_ascent + it->max_phys_descent; + row->extra_line_spacing = it->max_extra_line_spacing; } /* Compute the width of this line. */ @@ -14280,6 +14288,7 @@ compute_line_metrics (it) row->pixel_width -= it->truncation_pixel_width; row->ascent = row->phys_ascent = 0; row->height = row->phys_height = row->visible_height = 1; + row->extra_line_spacing = 0; } /* Compute a hash code for this row. */ @@ -14616,6 +14625,7 @@ display_line (it) row->height = it->max_ascent + it->max_descent; row->phys_ascent = it->max_phys_ascent; row->phys_height = it->max_phys_ascent + it->max_phys_descent; + row->extra_line_spacing = it->max_extra_line_spacing; /* Loop generating characters. The loop is left with IT on the next character to display. */ @@ -14681,6 +14691,8 @@ display_line (it) row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent); row->phys_height = max (row->phys_height, it->max_phys_ascent + it->max_phys_descent); + row->extra_line_spacing = max (row->extra_line_spacing, + it->max_extra_line_spacing); set_iterator_to_next (it, 1); continue; } @@ -14709,6 +14721,8 @@ display_line (it) row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent); row->phys_height = max (row->phys_height, it->max_phys_ascent + it->max_phys_descent); + row->extra_line_spacing = max (row->extra_line_spacing, + it->max_extra_line_spacing); if (it->current_x - it->pixel_width < it->first_visible_x) row->x = x - it->first_visible_x; } @@ -14860,6 +14874,8 @@ display_line (it) row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent); row->phys_height = max (row->phys_height, it->max_phys_ascent + it->max_phys_descent); + row->extra_line_spacing = max (row->extra_line_spacing, + it->max_extra_line_spacing); /* End of this display line if row is continued. */ if (row->continued_p || row->ends_at_zv_p) @@ -16043,27 +16059,31 @@ pint2hrstr (buf, width, d) { tenths = remainder / 100; if (50 <= remainder % 100) - if (tenths < 9) - tenths++; - else - { - quotient++; - if (quotient == 10) - tenths = -1; - else - tenths = 0; - } + { + if (tenths < 9) + tenths++; + else + { + quotient++; + if (quotient == 10) + tenths = -1; + else + tenths = 0; + } + } } else if (500 <= remainder) - if (quotient < 999) - quotient++; - else - { - quotient = 1; - exponent++; - tenths = 0; - } + { + if (quotient < 999) + quotient++; + else + { + quotient = 1; + exponent++; + tenths = 0; + } + } } /* Calculate the LENGTH of QUOTIENT.TENTHS as a string. */ @@ -16765,6 +16785,7 @@ display_string (string, lisp_string, face_string, face_string_pos, row->height = it->max_ascent + it->max_descent; row->phys_ascent = it->max_phys_ascent; row->phys_height = it->max_phys_ascent + it->max_phys_descent; + row->extra_line_spacing = it->max_extra_line_spacing; /* This condition is for the case that we are called with current_x past last_visible_x. */ @@ -16824,6 +16845,8 @@ display_string (string, lisp_string, face_string, face_string_pos, row->phys_ascent = max (row->phys_ascent, it->max_phys_ascent); row->phys_height = max (row->phys_height, it->max_phys_ascent + it->max_phys_descent); + row->extra_line_spacing = max (row->extra_line_spacing, + it->max_extra_line_spacing); x += glyph->pixel_width; ++i; } @@ -18350,7 +18373,7 @@ produce_image_glyph (it) { struct image *img; struct face *face; - int face_ascent, glyph_ascent; + int glyph_ascent; struct glyph_slice slice; xassert (it->what == IT_IMAGE); @@ -18433,7 +18456,7 @@ produce_image_glyph (it) #if 0 /* this breaks image tiling */ /* If this glyph is alone on the last line, adjust it.ascent to minimum row ascent. */ - face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f); + int face_ascent = face->font ? FONT_BASE (face->font) : FRAME_BASELINE_OFFSET (it->f); if (face_ascent > it->ascent) it->ascent = it->phys_ascent = face_ascent; #endif @@ -19446,7 +19469,11 @@ x_produce_glyphs (it) it->current_x += it->pixel_width; if (extra_line_spacing > 0) - it->descent += extra_line_spacing; + { + it->descent += extra_line_spacing; + if (extra_line_spacing > it->max_extra_line_spacing) + it->max_extra_line_spacing = extra_line_spacing; + } it->max_ascent = max (it->max_ascent, it->ascent); it->max_descent = max (it->max_descent, it->descent); @@ -20413,19 +20440,20 @@ fast_find_position (w, charpos, hpos, vpos, x, y, stop) int past_end = 0; first = MATRIX_FIRST_TEXT_ROW (w->current_matrix); + if (charpos < MATRIX_ROW_START_CHARPOS (first)) + { + *x = first->x; + *y = first->y; + *hpos = 0; + *vpos = MATRIX_ROW_VPOS (first, w->current_matrix); + return 1; + } + row = row_containing_pos (w, charpos, first, NULL, 0); if (row == NULL) { - if (charpos < MATRIX_ROW_START_CHARPOS (first)) - { - *x = *y = *hpos = *vpos = 0; - return 1; - } - else - { - row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); - past_end = 1; - } + row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + past_end = 1; } *x = row->x; @@ -20970,8 +20998,10 @@ note_mouse_highlight (f, x, y) /* Which window is that in? */ window = window_from_coordinates (f, x, y, &part, 0, 0, 1); - /* If we were displaying active text in another window, clear that. */ - if (! EQ (window, dpyinfo->mouse_face_window)) + /* If we were displaying active text in another window, clear that. + Also clear if we move out of text area in same window. */ + if (! EQ (window, dpyinfo->mouse_face_window) + || (part != ON_TEXT && !NILP (dpyinfo->mouse_face_window))) clear_mouse_face (dpyinfo); /* Not on a window -> return. */ diff --git a/src/xfaces.c b/src/xfaces.c index 5137ab7e721..b8b946bea47 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -3435,8 +3435,8 @@ set_lface_from_font_name (f, lface, fontname, force_p, may_fail_p) call into lisp. */ Lisp_Object -merge_face_heights (from, to, invalid, gcpro) - Lisp_Object from, to, invalid, gcpro; +merge_face_heights (from, to, invalid) + Lisp_Object from, to, invalid; { Lisp_Object result = invalid; @@ -3461,16 +3461,11 @@ merge_face_heights (from, to, invalid, gcpro) /* Call function with current height as argument. From is the new height. */ Lisp_Object args[2]; - struct gcpro gcpro1; - - GCPRO1 (gcpro); args[0] = from; args[1] = to; result = safe_call (2, args); - UNGCPRO; - /* Ensure that if TO was absolute, so is the result. */ if (INTEGERP (to) && !INTEGERP (result)) result = invalid; @@ -3523,8 +3518,7 @@ merge_face_vectors (f, from, to, named_merge_points) if (!UNSPECIFIEDP (from[i])) { if (i == LFACE_HEIGHT_INDEX && !INTEGERP (from[i])) - to[i] = merge_face_heights (from[i], to[i], to[i], - named_merge_points); + to[i] = merge_face_heights (from[i], to[i], to[i]); else to[i] = from[i]; } @@ -3551,11 +3545,16 @@ merge_named_face (f, face_name, to, named_merge_points) if (push_named_merge_point (&named_merge_point, face_name, &named_merge_points)) { + struct gcpro gcpro1; Lisp_Object from[LFACE_VECTOR_SIZE]; int ok = get_lface_attributes (f, face_name, from, 0); if (ok) - merge_face_vectors (f, from, to, named_merge_points); + { + GCPRO1 (named_merge_point.face_name); + merge_face_vectors (f, from, to, named_merge_points); + UNGCPRO; + } return ok; } @@ -3646,8 +3645,7 @@ merge_face_ref (f, face_ref, to, err_msgs, named_merge_points) else if (EQ (keyword, QCheight)) { Lisp_Object new_height = - merge_face_heights (value, to[LFACE_HEIGHT_INDEX], - Qnil, Qnil); + merge_face_heights (value, to[LFACE_HEIGHT_INDEX], Qnil); if (! NILP (new_height)) to[LFACE_HEIGHT_INDEX] = new_height; @@ -4034,7 +4032,7 @@ FRAME 0 means change the face on all frames, and change the default /* The default face must have an absolute size, otherwise, we do a test merge with a random height to see if VALUE's ok. */ - : merge_face_heights (value, make_number (10), Qnil, Qnil)); + : merge_face_heights (value, make_number (10), Qnil)); if (!INTEGERP (test) || XINT (test) <= 0) signal_error ("Invalid face height", value); @@ -4740,7 +4738,7 @@ the result will be absolute, otherwise it will be relative. */) if (EQ (value1, Qunspecified)) return value2; else if (EQ (attribute, QCheight)) - return merge_face_heights (value1, value2, value1, Qnil); + return merge_face_heights (value1, value2, value1); else return value1; } diff --git a/src/xmenu.c b/src/xmenu.c index a08f4610101..0a83266a482 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -48,6 +48,7 @@ Boston, MA 02111-1307, USA. */ #include "buffer.h" #include "charset.h" #include "coding.h" +#include "sysselect.h" #ifdef MSDOS #include "msdos.h" @@ -157,8 +158,6 @@ static void single_keymap_panes P_ ((Lisp_Object, Lisp_Object, Lisp_Object, static void list_of_panes P_ ((Lisp_Object)); static void list_of_items P_ ((Lisp_Object)); -extern EMACS_TIME timer_check P_ ((int)); - /* This holds a Lisp vector that holds the results of decoding the keymaps or alist-of-alists that specify a menu. @@ -525,7 +524,7 @@ single_menu_item (key, item, dummy, skp_v) return; /* Not a menu item. */ map = XVECTOR (item_properties)->contents[ITEM_PROPERTY_MAP]; - + if (skp->notreal) { /* We don't want to make a menu, just traverse the keymaps to @@ -1099,7 +1098,7 @@ on the left of the dialog box and all following items on the right. the dialog. Also, the lesstif/motif version crashes if there are no buttons. */ contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil)); - + list_of_panes (Fcons (contents, Qnil)); /* Display them in a dialog box. */ @@ -1115,9 +1114,73 @@ on the left of the dialog box and all following items on the right. } #endif } + + +#ifndef MSDOS + +/* Wait for an X event to arrive or for a timer to expire. */ + +static void +x_menu_wait_for_event (void *data) +{ + extern EMACS_TIME timer_check P_ ((int)); + + /* Another way to do this is to register a timer callback, that can be + done in GTK and Xt. But we have to do it like this when using only X + anyway, and with callbacks we would have three variants for timer handling + instead of the small ifdefs below. */ + + while ( +#ifdef USE_X_TOOLKIT + ! XtAppPending (Xt_app_con) +#elif defined USE_GTK + ! gtk_events_pending () +#else + ! XPending ((Display*) data) +#endif + ) + { + EMACS_TIME next_time = timer_check (1); + long secs = EMACS_SECS (next_time); + long usecs = EMACS_USECS (next_time); + SELECT_TYPE read_fds; + struct x_display_info *dpyinfo; + int n = 0; + + FD_ZERO (&read_fds); + for (dpyinfo = x_display_list; dpyinfo; dpyinfo = dpyinfo->next) + { + int fd = ConnectionNumber (dpyinfo->display); + FD_SET (fd, &read_fds); + if (fd > n) n = fd; + } + + if (secs < 0 || (secs == 0 && usecs == 0)) + { + /* Sometimes timer_check returns -1 (no timers) even if there are + timers. So do a timeout anyway. */ + EMACS_SET_SECS (next_time, 1); + EMACS_SET_USECS (next_time, 0); + } + + select (n + 1, &read_fds, (SELECT_TYPE *)0, (SELECT_TYPE *)0, &next_time); + } +} +#endif /* ! MSDOS */ + #if defined (USE_X_TOOLKIT) || defined (USE_GTK) +#ifdef USE_X_TOOLKIT + +static Lisp_Object +pop_down_menu (dummy) + int dummy; +{ + popup_activated_flag = 0; + return Qnil; +} + /* Loop in Xt until the menu pulldown or dialog popup has been popped down (deactivated). This is used for x-popup-menu and x-popup-dialog; it is not used for the menu bar. @@ -1127,7 +1190,6 @@ on the left of the dialog box and all following items on the right. NOTE: All calls to popup_get_selection should be protected with BLOCK_INPUT, UNBLOCK_INPUT wrappers. */ -#ifdef USE_X_TOOLKIT static void popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) XEvent *initial_event; @@ -1138,19 +1200,21 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) { XEvent event; + int specpdl_count = SPECPDL_INDEX (); + record_unwind_protect (pop_down_menu, Qnil); + while (popup_activated_flag) { - /* If we have no events to run, consider timers. */ - if (do_timers && !XtAppPending (Xt_app_con)) - timer_check (1); - if (initial_event) { event = *initial_event; initial_event = 0; } else - XtAppNextEvent (Xt_app_con, &event); + { + if (do_timers) x_menu_wait_for_event (0); + XtAppNextEvent (Xt_app_con, &event); + } /* Make sure we don't consider buttons grabbed after menu goes. And make sure to deactivate for any ButtonRelease, @@ -1188,6 +1252,8 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) x_dispatch_event (&event, event.xany.display); } + + unbind_to (specpdl_count, Qnil); } #endif /* USE_X_TOOLKIT */ @@ -1195,16 +1261,40 @@ popup_get_selection (initial_event, dpyinfo, id, do_timers, down_on_keypress) #ifdef USE_GTK /* Loop util popup_activated_flag is set to zero in a callback. Used for popup menus and dialogs. */ +static GtkWidget *current_menu; + +static Lisp_Object +pop_down_menu (dummy) + int dummy; +{ + if (current_menu) + { + gtk_widget_unmap (current_menu); + current_menu = 0; + popup_activated_flag = 0; + } + return Qnil; +} + static void -popup_widget_loop () +popup_widget_loop (do_timers, widget) + int do_timers; + GtkWidget *widget; { + int specpdl_count = SPECPDL_INDEX (); + current_menu = widget; + record_unwind_protect (pop_down_menu, Qnil); + ++popup_activated_flag; /* Process events in the Gtk event loop until done. */ while (popup_activated_flag) { + if (do_timers) x_menu_wait_for_event (0); gtk_main_iteration (); } + + unbind_to (specpdl_count, Qnil); } #endif @@ -2329,7 +2419,7 @@ menu_position_func (menu, x, y, push_in, user_data) GtkRequisition req; int disp_width = FRAME_X_DISPLAY_INFO (data->f)->width; int disp_height = FRAME_X_DISPLAY_INFO (data->f)->height; - + *x = data->x; *y = data->y; @@ -2402,7 +2492,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) two. show_help_echo uses this to detect popup menus. */ popup_activated_flag = 1; /* Process events that apply to the menu. */ - popup_widget_loop (); + popup_widget_loop (1, 0); gtk_widget_destroy (menu); @@ -2490,7 +2580,7 @@ create_and_show_popup_menu (f, first_wv, x, y, for_click) popup_activated_flag = 1; /* Process events that apply to the menu. */ - popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 0, 0); + popup_get_selection ((XEvent *) 0, FRAME_X_DISPLAY_INFO (f), menu_id, 1, 0); /* fp turned off the following statement and wrote a comment that it is unnecessary--that the menu has already disappeared. @@ -2811,7 +2901,7 @@ create_and_show_dialog (f, first_wv) gtk_widget_show_all (menu); /* Process events that apply to the menu. */ - popup_widget_loop (); + popup_widget_loop (1, menu); gtk_widget_destroy (menu); } @@ -3323,6 +3413,10 @@ xmenu_show (f, x, y, for_click, keymaps, title, error) XMenuSetFreeze (menu, TRUE); pane = selidx = 0; +#ifndef MSDOS + XMenuActivateSetWaitFunction (x_menu_wait_for_event, FRAME_X_DISPLAY (f)); +#endif + /* Help display under X won't work because XMenuActivate contains a loop that doesn't give Emacs a chance to process it. */ menu_help_frame = f; diff --git a/src/xselect.c b/src/xselect.c index 06f4bfbd2a1..cd059e81979 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -24,6 +24,14 @@ Boston, MA 02111-1307, USA. */ #include <config.h> #include <stdio.h> /* termhooks.h needs this */ + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + #include "lisp.h" #include "xterm.h" /* for all of the X includes */ #include "dispextern.h" /* frame.h seems to want this */ @@ -174,7 +182,8 @@ static Lisp_Object x_get_window_property_as_lisp_data (); -/* Define a queue to save up SelectionRequest events for later handling. */ +/* Define a queue to save up SELECTION_REQUEST_EVENT events for later + handling. */ struct selection_event_queue { @@ -184,11 +193,11 @@ struct selection_event_queue static struct selection_event_queue *selection_queue; -/* Nonzero means queue up certain events--don't process them yet. */ +/* Nonzero means queue up SELECTION_REQUEST_EVENT events. */ static int x_queue_selection_requests; -/* Queue up an X event *EVENT, to be processed later. */ +/* Queue up an SELECTION_REQUEST_EVENT *EVENT, to be processed later. */ static void x_queue_event (event) @@ -196,12 +205,14 @@ x_queue_event (event) { struct selection_event_queue *queue_tmp; - /* Don't queue repeated requests */ + /* Don't queue repeated requests. + This only happens for large requests which uses the incremental protocol. */ for (queue_tmp = selection_queue; queue_tmp; queue_tmp = queue_tmp->next) { if (!bcmp (&queue_tmp->event, event, sizeof (*event))) { - TRACE1 ("IGNORE DUP SELECTION EVENT %08x", (unsigned long)queue_tmp); + TRACE1 ("DECLINE DUP SELECTION EVENT %08lx", (unsigned long)queue_tmp); + x_decline_selection_request (event); return; } } @@ -211,14 +222,14 @@ x_queue_event (event) if (queue_tmp != NULL) { - TRACE1 ("QUEUE SELECTION EVENT %08x", (unsigned long)queue_tmp); + TRACE1 ("QUEUE SELECTION EVENT %08lx", (unsigned long)queue_tmp); queue_tmp->event = *event; queue_tmp->next = selection_queue; selection_queue = queue_tmp; } } -/* Start queuing SelectionRequest events. */ +/* Start queuing SELECTION_REQUEST_EVENT events. */ static void x_start_queuing_selection_requests () @@ -230,7 +241,7 @@ x_start_queuing_selection_requests () TRACE1 ("x_start_queuing_selection_requests %d", x_queue_selection_requests); } -/* Stop queuing SelectionRequest events. */ +/* Stop queuing SELECTION_REQUEST_EVENT events. */ static void x_stop_queuing_selection_requests () @@ -244,7 +255,7 @@ x_stop_queuing_selection_requests () while (selection_queue != NULL) { struct selection_event_queue *queue_tmp = selection_queue; - TRACE1 ("RESTORE SELECTION EVENT %08x", (unsigned long)queue_tmp); + TRACE1 ("RESTORE SELECTION EVENT %08lx", (unsigned long)queue_tmp); kbd_buffer_unget_event (&queue_tmp->event); selection_queue = queue_tmp->next; xfree ((char *)queue_tmp); @@ -877,7 +888,9 @@ x_handle_selection_request (event) struct x_display_info *dpyinfo = x_display_info_for_display (SELECTION_EVENT_DISPLAY (event)); - TRACE0 ("x_handle_selection_request"); + TRACE2 ("x_handle_selection_request, from=0x%08lx time=%lu", + (unsigned long) SELECTION_EVENT_REQUESTOR (event), + (unsigned long) SELECTION_EVENT_TIME (event)); local_selection_data = Qnil; target_symbol = Qnil; |