Mercurial > hg > xemacs-beta
comparison src/gutter.c @ 1318:b531bf8658e9
[xemacs-hg @ 2003-02-21 06:56:46 by ben]
redisplay fixes et al.
PROBLEMS: Add comment about Cygwin, unexec and sysmalloc.
Move some non-general stuff out of general.
Make a section for x86.
configure.in: Add check for broken alloca in funcalls.
mule/mule-cmds.el: Alias file-name to native not vice-versa.
Do set EOL of native but not of process output to fix various
problems and be consistent with code-init.el.
code-cmds.el: Return a name not a coding system.
code-init.el: Reindent. Remove `file-name' since it should always be the same
as native.
unicode.el: Rename to load-unicode-mapping-table as suggested by the anonymous
(but rather Turnbullian) comment in unicode.c.
xemacs.dsp: Add /k to default build.
alloc.c: Make gc_currently_forbidden static.
config.h.in, lisp.h: Move some stuff to lisp.h.
console-gtk.h, console-impl.h, console-msw.h, console-x.h, event-Xt.c, event-msw.c, redisplay-gtk.c, redisplay-msw.c, redisplay-output.c, redisplay-x.c, gtk-xemacs.c: Remove duplicated code to redraw exposed area. Add deadbox
method needed by the generalized redraw code. Defer redrawing
if already in redisplay.
frame-msw.c, event-stream.c, frame.c: Add comments about calling Lisp.
debug.c, general-slots.h: Move generalish symbols to general-slots.h.
doprnt.c: reindent.
lisp.h, dynarr.c: Add debug code for locking a dynarr to catch invalid mods.
Use in redisplay.c.
eval.c:
file-coding.c: Define file-name as alias for native not vice-versa.
frame-gtk.c, frame-x.c: Move Qwindow_id to general-slots.
dialog-msw.c, glyphs-gtk.c, glyphs-msw.c, glyphs-widget.c, glyphs-x.c, gui.c, gui.h, menubar-msw.c, menubar.c: Ensure that various glyph functions that eval within redisplay
protect the evals. Same for calls to internal_equal().
Modify various functions, e.g. gui_item_*(), to protect evals
within redisplay, taking an in_redisplay parameter if it's
possible for them to be called both inside and outside of
redisplay.
gutter.c: Defer specifier-changed updating till after redisplay, if
necessary, since we need to enter redisplay to do it.
gutter.c: Do nothing if in redisplay.
lisp.h: Add version of alloca() for use in function calls.
lisp.h: Add XCAD[D+]R up to 6 D's, and aliases X1ST, X2ND, etc.
frame.c, frame.h, redisplay.c, redisplay.h, signal.c, toolbar.c: Redo critical-section code and move from frame.c to redisplay.c.
Require that every place inside of redisplay catch errors itself,
not at the edge of the critical section (thereby bypassing the
rest of redisplay and leaving things in an inconsistent state).
Introduce separate means of holding frame-size changes without
entering a complete critical section. Introduce "post-redisplay"
methods for deferring things till after redisplay. Abort if
we enter redisplay reentrantly. Disable all quit checking in
redisplay since it's too dangerous. Ensure that all calls to
QUIT trigger an abort if unprotected.
redisplay.c, scrollbar-gtk.c, scrollbar-x.c, scrollbar.c: Create enter/exit_redisplay_critical_section_maybe() for code
that needs to ensure it's in a critical section but doesn't
interfere with an existing critical section.
sysdep.c: Use _wexecve() when under Windows NT for Unicode correctness.
text.c, text.h: Add new_dfc() functions, which return an alloca()ed value rather
than requiring an lvalue. (Not really used yet; used in another
workspace, to come.) Add some macros for SIZED_EXTERNAL.
Update the encoding aliases after involved scrutinization of the
X manual.
unicode.c: Answer the anonymous but suspiciously Turnbullian questions.
Rename parse-unicode-translation-table to
load-unicode-mapping-table, as suggested.
author | ben |
---|---|
date | Fri, 21 Feb 2003 06:57:21 +0000 |
parents | e22b0213b713 |
children | e809f7e2883c |
comparison
equal
deleted
inserted
replaced
1317:d9d08dc5e617 | 1318:b531bf8658e9 |
---|---|
333 | 333 |
334 static Lisp_Object | 334 static Lisp_Object |
335 calculate_gutter_size (struct window *w, enum gutter_pos pos) | 335 calculate_gutter_size (struct window *w, enum gutter_pos pos) |
336 { | 336 { |
337 struct frame* f = XFRAME (WINDOW_FRAME (w)); | 337 struct frame* f = XFRAME (WINDOW_FRAME (w)); |
338 int count; | 338 display_line_dynarr *ddla; |
339 display_line_dynarr* ddla; | |
340 Lisp_Object ret = Qnil; | 339 Lisp_Object ret = Qnil; |
341 | 340 |
341 /* Callers need to handle this. */ | |
342 assert (!in_display); | |
342 /* degenerate case */ | 343 /* degenerate case */ |
343 if (NILP (RAW_WINDOW_GUTTER (w, pos)) | 344 if (NILP (RAW_WINDOW_GUTTER (w, pos)) |
344 || | 345 || |
345 !FRAME_VISIBLE_P (f) | 346 !FRAME_VISIBLE_P (f) |
346 || | 347 || |
347 NILP (w->buffer)) | 348 NILP (w->buffer)) |
348 return Qnil; | 349 return Qnil; |
349 | 350 |
350 /* Redisplay code that we use relies on GC not happening. Make it | 351 if (!in_display) |
351 so. */ | 352 { |
352 count = begin_gc_forbidden (); | 353 int count; |
353 | 354 |
354 ddla = Dynarr_new (display_line); | 355 /* We are calling directly into redisplay from the outside, so turn on |
355 /* generate some display lines */ | 356 critical section protection. */ |
356 generate_displayable_area (w, WINDOW_GUTTER (w, pos), | 357 count = enter_redisplay_critical_section (); |
357 FRAME_LEFT_BORDER_END (f), | 358 |
358 FRAME_TOP_BORDER_END (f), | 359 ddla = Dynarr_new (display_line); |
359 FRAME_RIGHT_BORDER_START (f) | 360 /* generate some display lines */ |
360 - FRAME_LEFT_BORDER_END (f), | 361 generate_displayable_area (w, WINDOW_GUTTER (w, pos), |
361 FRAME_BOTTOM_BORDER_START (f) | 362 FRAME_LEFT_BORDER_END (f), |
362 - FRAME_TOP_BORDER_END (f), | 363 FRAME_TOP_BORDER_END (f), |
363 ddla, 0, 0); | 364 FRAME_RIGHT_BORDER_START (f) |
364 | 365 - FRAME_LEFT_BORDER_END (f), |
365 /* Let GC happen again. */ | 366 FRAME_BOTTOM_BORDER_START (f) |
366 unbind_to (count); | 367 - FRAME_TOP_BORDER_END (f), |
367 | 368 ddla, 0, 0); |
368 ret = make_int (calculate_gutter_size_from_display_lines (pos, ddla)); | 369 |
369 free_display_lines (ddla); | 370 /* Let GC happen again. */ |
371 exit_redisplay_critical_section (count); | |
372 | |
373 ret = make_int (calculate_gutter_size_from_display_lines (pos, ddla)); | |
374 free_display_lines (ddla); | |
375 } | |
370 | 376 |
371 return ret; | 377 return ret; |
372 } | 378 } |
373 | 379 |
374 static void | 380 static void |
691 void | 697 void |
692 redraw_exposed_gutters (struct frame *f, int x, int y, int width, | 698 redraw_exposed_gutters (struct frame *f, int x, int y, int width, |
693 int height) | 699 int height) |
694 { | 700 { |
695 enum gutter_pos pos; | 701 enum gutter_pos pos; |
696 int depth; | 702 |
697 | 703 /* We are already inside the critical section -- our caller did that. */ |
698 /* We have to be "in display" when we output the gutter - make it | |
699 so. */ | |
700 depth = enter_redisplay_critical_section (); | |
701 GUTTER_POS_LOOP (pos) | 704 GUTTER_POS_LOOP (pos) |
702 { | 705 { |
703 if (FRAME_GUTTER_VISIBLE (f, pos)) | 706 if (FRAME_GUTTER_VISIBLE (f, pos)) |
704 redraw_exposed_gutter (f, pos, x, y, width, height); | 707 redraw_exposed_gutter (f, pos, x, y, width, height); |
705 } | 708 } |
706 exit_redisplay_critical_section (depth); | |
707 } | 709 } |
708 | 710 |
709 void | 711 void |
710 free_frame_gutters (struct frame *f) | 712 free_frame_gutters (struct frame *f) |
711 { | 713 { |
747 enum gutter_pos cur = decode_gutter_position (Vdefault_gutter_position); | 749 enum gutter_pos cur = decode_gutter_position (Vdefault_gutter_position); |
748 enum gutter_pos new = decode_gutter_position (position); | 750 enum gutter_pos new = decode_gutter_position (position); |
749 | 751 |
750 if (cur != new) | 752 if (cur != new) |
751 { | 753 { |
752 int depth; | |
753 | |
754 /* The following calls will automatically cause the dirty | 754 /* The following calls will automatically cause the dirty |
755 flags to be set; we delay frame size changes to avoid | 755 flags to be set; we delay frame size changes to avoid |
756 lots of frame flickering. */ | 756 lots of frame flickering. */ |
757 /* #### I think this should be GC protected. -sb */ | 757 /* #### I think this should be GC protected. -sb */ |
758 depth = enter_redisplay_critical_section (); | 758 int depth = begin_hold_frame_size_changes (); |
759 | |
759 set_specifier_fallback (Vgutter[cur], list1 (Fcons (Qnil, Qnil))); | 760 set_specifier_fallback (Vgutter[cur], list1 (Fcons (Qnil, Qnil))); |
760 set_specifier_fallback (Vgutter[new], Vdefault_gutter); | 761 set_specifier_fallback (Vgutter[new], Vdefault_gutter); |
761 set_specifier_fallback (Vgutter_size[cur], list1 (Fcons (Qnil, Qzero))); | 762 set_specifier_fallback (Vgutter_size[cur], list1 (Fcons (Qnil, Qzero))); |
762 set_specifier_fallback (Vgutter_size[new], | 763 set_specifier_fallback (Vgutter_size[new], |
763 new == TOP_GUTTER || new == BOTTOM_GUTTER | 764 new == TOP_GUTTER || new == BOTTOM_GUTTER |
767 list1 (Fcons (Qnil, Qzero))); | 768 list1 (Fcons (Qnil, Qzero))); |
768 set_specifier_fallback (Vgutter_border_width[new], | 769 set_specifier_fallback (Vgutter_border_width[new], |
769 Vdefault_gutter_border_width); | 770 Vdefault_gutter_border_width); |
770 set_specifier_fallback (Vgutter_visible_p[cur], list1 (Fcons (Qnil, Qt))); | 771 set_specifier_fallback (Vgutter_visible_p[cur], list1 (Fcons (Qnil, Qt))); |
771 set_specifier_fallback (Vgutter_visible_p[new], Vdefault_gutter_visible_p); | 772 set_specifier_fallback (Vgutter_visible_p[new], Vdefault_gutter_visible_p); |
772 | |
773 Vdefault_gutter_position = position; | 773 Vdefault_gutter_position = position; |
774 exit_redisplay_critical_section (depth); | 774 |
775 unbind_to (depth); | |
775 } | 776 } |
776 | 777 |
777 run_hook (Qdefault_gutter_position_changed_hook); | 778 run_hook (Qdefault_gutter_position_changed_hook); |
778 | 779 |
779 return position; | 780 return position; |
883 { | 884 { |
884 enum gutter_pos pos = decode_gutter_position (Vdefault_gutter_position); | 885 enum gutter_pos pos = decode_gutter_position (Vdefault_gutter_position); |
885 Fset_specifier_dirty_flag (real_one[pos]); | 886 Fset_specifier_dirty_flag (real_one[pos]); |
886 } | 887 } |
887 | 888 |
889 static void gutter_specs_changed (Lisp_Object specifier, struct window *w, | |
890 Lisp_Object oldval, enum gutter_pos pos); | |
891 | |
892 static void | |
893 gutter_specs_changed_1 (Lisp_Object arg) | |
894 { | |
895 gutter_specs_changed (X1ST (arg), XWINDOW (X2ND (arg)), | |
896 X3RD (arg), (enum gutter_pos) XINT (X4TH (arg))); | |
897 free_list (arg); | |
898 } | |
899 | |
888 static void | 900 static void |
889 gutter_specs_changed (Lisp_Object specifier, struct window *w, | 901 gutter_specs_changed (Lisp_Object specifier, struct window *w, |
890 Lisp_Object oldval, enum gutter_pos pos) | 902 Lisp_Object oldval, enum gutter_pos pos) |
891 { | 903 { |
892 w->real_gutter[pos] = construct_window_gutter_spec (w, pos); | 904 if (in_display) |
893 w->real_gutter_size[pos] = w->gutter_size[pos]; | 905 register_post_redisplay_action (gutter_specs_changed_1, |
894 | 906 list4 (specifier, wrap_window (w), |
895 if (EQ (w->real_gutter_size[pos], Qautodetect) | 907 oldval, make_int (pos))); |
896 && !NILP (w->gutter_visible_p[pos])) | 908 else |
897 { | 909 { |
898 w->real_gutter_size [pos] = calculate_gutter_size (w, pos); | 910 w->real_gutter[pos] = construct_window_gutter_spec (w, pos); |
899 } | 911 w->real_gutter_size[pos] = w->gutter_size[pos]; |
900 MARK_GUTTER_CHANGED; | 912 |
901 MARK_MODELINE_CHANGED; | 913 if (EQ (w->real_gutter_size[pos], Qautodetect) |
902 MARK_WINDOWS_CHANGED (w); | 914 && !NILP (w->gutter_visible_p[pos])) |
915 { | |
916 w->real_gutter_size [pos] = calculate_gutter_size (w, pos); | |
917 } | |
918 MARK_GUTTER_CHANGED; | |
919 MARK_MODELINE_CHANGED; | |
920 MARK_WINDOWS_CHANGED (w); | |
921 } | |
903 } | 922 } |
904 | 923 |
905 /* We define all of these so we can access which actual gutter changed. */ | 924 /* We define all of these so we can access which actual gutter changed. */ |
906 static void | 925 static void |
907 top_gutter_specs_changed (Lisp_Object specifier, struct window *w, | 926 top_gutter_specs_changed (Lisp_Object specifier, struct window *w, |
936 Lisp_Object oldval) | 955 Lisp_Object oldval) |
937 { | 956 { |
938 recompute_overlaying_specifier (Vgutter); | 957 recompute_overlaying_specifier (Vgutter); |
939 } | 958 } |
940 | 959 |
960 static void gutter_geometry_changed_in_window (Lisp_Object specifier, | |
961 struct window *w, | |
962 Lisp_Object oldval); | |
963 | |
964 static void | |
965 gutter_geometry_changed_in_window_1 (Lisp_Object arg) | |
966 { | |
967 gutter_geometry_changed_in_window (X1ST (arg), XWINDOW (X2ND (arg)), | |
968 X3RD (arg)); | |
969 free_list (arg); | |
970 } | |
971 | |
941 static void | 972 static void |
942 gutter_geometry_changed_in_window (Lisp_Object specifier, struct window *w, | 973 gutter_geometry_changed_in_window (Lisp_Object specifier, struct window *w, |
943 Lisp_Object oldval) | 974 Lisp_Object oldval) |
944 { | 975 { |
945 enum gutter_pos pos; | 976 if (in_display) |
946 GUTTER_POS_LOOP (pos) | 977 register_post_redisplay_action (gutter_geometry_changed_in_window_1, |
947 { | 978 list3 (specifier, wrap_window (w), |
948 w->real_gutter_size[pos] = w->gutter_size[pos]; | 979 oldval)); |
949 if (EQ (w->real_gutter_size[pos], Qautodetect) | 980 else |
950 && !NILP (w->gutter_visible_p[pos])) | 981 { |
951 { | 982 enum gutter_pos pos; |
952 w->real_gutter_size [pos] = calculate_gutter_size (w, pos); | 983 GUTTER_POS_LOOP (pos) |
953 } | 984 { |
954 } | 985 w->real_gutter_size[pos] = w->gutter_size[pos]; |
955 | 986 if (EQ (w->real_gutter_size[pos], Qautodetect) |
956 MARK_GUTTER_CHANGED; | 987 && !NILP (w->gutter_visible_p[pos])) |
957 MARK_MODELINE_CHANGED; | 988 { |
958 MARK_WINDOWS_CHANGED (w); | 989 w->real_gutter_size [pos] = calculate_gutter_size (w, pos); |
990 } | |
991 } | |
992 | |
993 MARK_GUTTER_CHANGED; | |
994 MARK_MODELINE_CHANGED; | |
995 MARK_WINDOWS_CHANGED (w); | |
996 } | |
959 } | 997 } |
960 | 998 |
961 static void | 999 static void |
962 default_gutter_size_changed_in_window (Lisp_Object specifier, struct window *w, | 1000 default_gutter_size_changed_in_window (Lisp_Object specifier, struct window *w, |
963 Lisp_Object oldval) | 1001 Lisp_Object oldval) |
1052 Ensure that all gutters are correctly showing their gutter specifier. | 1090 Ensure that all gutters are correctly showing their gutter specifier. |
1053 */ | 1091 */ |
1054 ()) | 1092 ()) |
1055 { | 1093 { |
1056 Lisp_Object devcons, concons; | 1094 Lisp_Object devcons, concons; |
1095 | |
1096 /* Can't reentrantly enter redisplay */ | |
1097 if (in_display) | |
1098 return Qnil; | |
1057 | 1099 |
1058 DEVICE_LOOP_NO_BREAK (devcons, concons) | 1100 DEVICE_LOOP_NO_BREAK (devcons, concons) |
1059 { | 1101 { |
1060 struct device *d = XDEVICE (XCAR (devcons)); | 1102 struct device *d = XDEVICE (XCAR (devcons)); |
1061 Lisp_Object frmcons; | 1103 Lisp_Object frmcons; |