Mercurial > hg > xemacs-beta
comparison src/frame.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 | 671b65f2b075 |
children | 969b7290edca |
comparison
equal
deleted
inserted
replaced
1317:d9d08dc5e617 | 1318:b531bf8658e9 |
---|---|
1 /* Generic frame functions. | 1 /* Generic frame functions. |
2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. | 2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. |
3 Copyright (C) 1995, 1996, 2002 Ben Wing. | 3 Copyright (C) 1995, 1996, 2002, 2003 Ben Wing. |
4 Copyright (C) 1995 Sun Microsystems, Inc. | 4 Copyright (C) 1995 Sun Microsystems, Inc. |
5 | 5 |
6 This file is part of XEmacs. | 6 This file is part of XEmacs. |
7 | 7 |
8 XEmacs is free software; you can redistribute it and/or modify it | 8 XEmacs is free software; you can redistribute it and/or modify it |
703 { | 703 { |
704 return FRAME_LIVE_P (f); | 704 return FRAME_LIVE_P (f); |
705 } | 705 } |
706 | 706 |
707 | 707 |
708 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS | |
709 | |
710 static Lisp_Object | |
711 commit_ritual_suicide (Lisp_Object ceci_nest_pas_une_pipe) | |
712 { | |
713 assert (!in_display); | |
714 return Qnil; | |
715 } | |
716 | |
717 #endif | |
718 | |
719 /* | |
720 * window size changes are held up during critical regions. Afterwards, | |
721 * we want to deal with any delayed changes. | |
722 */ | |
723 int | |
724 enter_redisplay_critical_section (void) | |
725 { | |
726 int depth = specpdl_depth (); | |
727 | |
728 /* NOTE NOTE NOTE: Inside the redisplay critical section, every place | |
729 that could QUIT or call Lisp code needs to be wrapped, since GC | |
730 or a non-local exit will be fatal. The way to do this is with | |
731 call_trapping_problems(..., INHIBIT_GC), or the like. */ | |
732 | |
733 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS | |
734 /* Force every call to QUIT to check for in_displayness. This will | |
735 verify proper wrapping, as in the previous comment, aborting if not. */ | |
736 something_happened++; | |
737 record_unwind_protect (commit_ritual_suicide, Qnil); | |
738 #endif | |
739 begin_gc_forbidden (); | |
740 in_display = 1; | |
741 | |
742 return depth; | |
743 } | |
744 | |
745 void | |
746 exit_redisplay_critical_section (int depth) | |
747 { | |
748 Lisp_Object frmcons, devcons, concons; | |
749 | |
750 in_display = 0; | |
751 | |
752 unbind_to (depth); | |
753 #ifdef ERROR_CHECK_TRAPPING_PROBLEMS | |
754 something_happened--; | |
755 #endif | |
756 | |
757 /* we used to have a function to do this for only one frame, and | |
758 it was typical to call it at the end of a critical section | |
759 (which occurs once per frame); but what then happens if multiple | |
760 frames have frame changes held up? | |
761 | |
762 this means we are O(N^2) over frames. i seriously doubt it matters. | |
763 --ben */ | |
764 FRAME_LOOP_NO_BREAK (frmcons, devcons, concons) | |
765 { | |
766 struct frame *f = XFRAME (XCAR (frmcons)); | |
767 if (f->size_change_pending) | |
768 change_frame_size (f, f->new_height, f->new_width, 0); | |
769 } | |
770 } | |
771 | |
772 void | 708 void |
773 invalidate_vertical_divider_cache_in_frame (struct frame *f) | 709 invalidate_vertical_divider_cache_in_frame (struct frame *f) |
774 { | 710 { |
775 /* Invalidate cached value of needs_vertical_divider_p in | 711 /* Invalidate cached value of needs_vertical_divider_p in |
776 every and all windows */ | 712 every and all windows */ |
783 * frame. | 719 * frame. |
784 */ | 720 */ |
785 void | 721 void |
786 adjust_frame_size (struct frame *f) | 722 adjust_frame_size (struct frame *f) |
787 { | 723 { |
724 /* This can call Lisp. */ | |
788 int keep_char_size = 0; | 725 int keep_char_size = 0; |
789 Lisp_Object frame = wrap_frame (f); | 726 Lisp_Object frame = wrap_frame (f); |
790 | |
791 | 727 |
792 if (!f->size_slipped) | 728 if (!f->size_slipped) |
793 return; | 729 return; |
794 | 730 |
795 /* Don't adjust tty frames. #### May break when TTY have menubars. | 731 /* Don't adjust tty frames. #### May break when TTY have menubars. |
2314 int pretend); | 2250 int pretend); |
2315 | 2251 |
2316 static void | 2252 static void |
2317 store_minibuf_frame_prop (struct frame *f, Lisp_Object val) | 2253 store_minibuf_frame_prop (struct frame *f, Lisp_Object val) |
2318 { | 2254 { |
2255 /* This can call Lisp. */ | |
2319 Lisp_Object frame = wrap_frame (f); | 2256 Lisp_Object frame = wrap_frame (f); |
2320 | |
2321 | 2257 |
2322 if (WINDOWP (val)) | 2258 if (WINDOWP (val)) |
2323 { | 2259 { |
2324 if (! MINI_WINDOW_P (XWINDOW (val))) | 2260 if (! MINI_WINDOW_P (XWINDOW (val))) |
2325 gui_error | 2261 gui_error |
2503 and `default-mswindows-frame-plist' for a description of the properties | 2439 and `default-mswindows-frame-plist' for a description of the properties |
2504 recognized for particular types of frames. | 2440 recognized for particular types of frames. |
2505 */ | 2441 */ |
2506 (frame, plist)) | 2442 (frame, plist)) |
2507 { | 2443 { |
2444 /* This can call Lisp. */ | |
2508 struct frame *f = decode_frame (frame); | 2445 struct frame *f = decode_frame (frame); |
2509 Lisp_Object tail; | 2446 Lisp_Object tail; |
2510 Lisp_Object *tailp; | 2447 Lisp_Object *tailp; |
2511 struct gcpro gcpro1, gcpro2; | 2448 struct gcpro gcpro1, gcpro2; |
2512 | 2449 |
2814 } | 2751 } |
2815 | 2752 |
2816 static void | 2753 static void |
2817 internal_set_frame_size (struct frame *f, int cols, int rows, int pretend) | 2754 internal_set_frame_size (struct frame *f, int cols, int rows, int pretend) |
2818 { | 2755 { |
2756 /* This can call Lisp. See mswindows_set_frame_size(). */ | |
2819 /* An explicit size change cancels any pending frame size adjustment */ | 2757 /* An explicit size change cancels any pending frame size adjustment */ |
2820 CLEAR_FRAME_SIZE_SLIPPED(f); | 2758 CLEAR_FRAME_SIZE_SLIPPED (f); |
2821 | 2759 |
2822 if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size)) | 2760 if (pretend || !HAS_FRAMEMETH_P (f, set_frame_size)) |
2823 change_frame_size (f, rows, cols, 0); | 2761 change_frame_size (f, rows, cols, 0); |
2824 else | 2762 else |
2825 FRAMEMETH (f, set_frame_size, (f, cols, rows)); | 2763 FRAMEMETH (f, set_frame_size, (f, cols, rows)); |
2830 Optional third arg non-nil means that redisplay should use LINES lines | 2768 Optional third arg non-nil means that redisplay should use LINES lines |
2831 but that the idea of the actual height of the frame should not be changed. | 2769 but that the idea of the actual height of the frame should not be changed. |
2832 */ | 2770 */ |
2833 (frame, lines, pretend)) | 2771 (frame, lines, pretend)) |
2834 { | 2772 { |
2773 /* This can call Lisp. */ | |
2835 struct frame *f = decode_frame (frame); | 2774 struct frame *f = decode_frame (frame); |
2836 int height, width; | 2775 int height, width; |
2837 frame = wrap_frame (f); | 2776 frame = wrap_frame (f); |
2838 CHECK_INT (lines); | 2777 CHECK_INT (lines); |
2839 | 2778 |
2857 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall | 2796 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall |
2858 but that the idea of the actual height of the frame should not be changed. | 2797 but that the idea of the actual height of the frame should not be changed. |
2859 */ | 2798 */ |
2860 (frame, height, pretend)) | 2799 (frame, height, pretend)) |
2861 { | 2800 { |
2801 /* This can call Lisp. */ | |
2862 struct frame *f = decode_frame (frame); | 2802 struct frame *f = decode_frame (frame); |
2863 int pheight, width; | 2803 int pheight, width; |
2864 frame = wrap_frame (f); | 2804 frame = wrap_frame (f); |
2865 CHECK_INT (height); | 2805 CHECK_INT (height); |
2866 | 2806 |
2886 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall | 2826 Optional third arg non-nil means that redisplay should be HEIGHT pixels tall |
2887 but that the idea of the actual height of the frame should not be changed. | 2827 but that the idea of the actual height of the frame should not be changed. |
2888 */ | 2828 */ |
2889 (frame, height, pretend)) | 2829 (frame, height, pretend)) |
2890 { | 2830 { |
2831 /* This can call Lisp. */ | |
2891 struct frame *f = decode_frame (frame); | 2832 struct frame *f = decode_frame (frame); |
2892 int pheight, width; | 2833 int pheight, width; |
2893 frame = wrap_frame (f); | 2834 frame = wrap_frame (f); |
2894 CHECK_INT (height); | 2835 CHECK_INT (height); |
2895 | 2836 |
2915 Optional third arg non-nil means that redisplay should use COLS columns | 2856 Optional third arg non-nil means that redisplay should use COLS columns |
2916 but that the idea of the actual width of the frame should not be changed. | 2857 but that the idea of the actual width of the frame should not be changed. |
2917 */ | 2858 */ |
2918 (frame, cols, pretend)) | 2859 (frame, cols, pretend)) |
2919 { | 2860 { |
2861 /* This can call Lisp. */ | |
2920 struct frame *f = decode_frame (frame); | 2862 struct frame *f = decode_frame (frame); |
2921 int width, height; | 2863 int width, height; |
2922 frame = wrap_frame (f); | 2864 frame = wrap_frame (f); |
2923 CHECK_INT (cols); | 2865 CHECK_INT (cols); |
2924 | 2866 |
2942 Optional third arg non-nil means that redisplay should be WIDTH wide | 2884 Optional third arg non-nil means that redisplay should be WIDTH wide |
2943 but that the idea of the actual height of the frame should not be changed. | 2885 but that the idea of the actual height of the frame should not be changed. |
2944 */ | 2886 */ |
2945 (frame, width, pretend)) | 2887 (frame, width, pretend)) |
2946 { | 2888 { |
2889 /* This can call Lisp. */ | |
2947 struct frame *f = decode_frame (frame); | 2890 struct frame *f = decode_frame (frame); |
2948 int height, pwidth; | 2891 int height, pwidth; |
2949 frame = wrap_frame (f); | 2892 frame = wrap_frame (f); |
2950 CHECK_INT (width); | 2893 CHECK_INT (width); |
2951 | 2894 |
2970 Optional third arg non-nil means that redisplay should be WIDTH wide | 2913 Optional third arg non-nil means that redisplay should be WIDTH wide |
2971 but that the idea of the actual height of the frame should not be changed. | 2914 but that the idea of the actual height of the frame should not be changed. |
2972 */ | 2915 */ |
2973 (frame, width, pretend)) | 2916 (frame, width, pretend)) |
2974 { | 2917 { |
2918 /* This can call Lisp. */ | |
2975 struct frame *f = decode_frame (frame); | 2919 struct frame *f = decode_frame (frame); |
2976 int height, pwidth; | 2920 int height, pwidth; |
2977 frame = wrap_frame (f); | 2921 frame = wrap_frame (f); |
2978 CHECK_INT (width); | 2922 CHECK_INT (width); |
2979 | 2923 |
2998 Optional fourth arg non-nil means that redisplay should use COLS by ROWS | 2942 Optional fourth arg non-nil means that redisplay should use COLS by ROWS |
2999 but that the idea of the actual size of the frame should not be changed. | 2943 but that the idea of the actual size of the frame should not be changed. |
3000 */ | 2944 */ |
3001 (frame, cols, rows, pretend)) | 2945 (frame, cols, rows, pretend)) |
3002 { | 2946 { |
2947 /* This can call Lisp. */ | |
3003 struct frame *f = decode_frame (frame); | 2948 struct frame *f = decode_frame (frame); |
3004 int height, width; | 2949 int height, width; |
3005 frame = wrap_frame (f); | 2950 frame = wrap_frame (f); |
3006 CHECK_INT (cols); | 2951 CHECK_INT (cols); |
3007 CHECK_INT (rows); | 2952 CHECK_INT (rows); |
3023 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT | 2968 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT |
3024 but that the idea of the actual size of the frame should not be changed. | 2969 but that the idea of the actual size of the frame should not be changed. |
3025 */ | 2970 */ |
3026 (frame, width, height, pretend)) | 2971 (frame, width, height, pretend)) |
3027 { | 2972 { |
2973 /* This can call Lisp. */ | |
3028 struct frame *f = decode_frame (frame); | 2974 struct frame *f = decode_frame (frame); |
3029 int pheight, pwidth; | 2975 int pheight, pwidth; |
3030 frame = wrap_frame (f); | 2976 frame = wrap_frame (f); |
3031 CHECK_INT (width); | 2977 CHECK_INT (width); |
3032 CHECK_INT (height); | 2978 CHECK_INT (height); |
3052 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT | 2998 Optional fourth arg non-nil means that redisplay should use WIDTH by HEIGHT |
3053 but that the idea of the actual size of the frame should not be changed. | 2999 but that the idea of the actual size of the frame should not be changed. |
3054 */ | 3000 */ |
3055 (frame, width, height, pretend)) | 3001 (frame, width, height, pretend)) |
3056 { | 3002 { |
3003 /* This can call Lisp. */ | |
3057 struct frame *f = decode_frame (frame); | 3004 struct frame *f = decode_frame (frame); |
3058 int pheight, pwidth; | 3005 int pheight, pwidth; |
3059 frame = wrap_frame (f); | 3006 frame = wrap_frame (f); |
3060 CHECK_INT (width); | 3007 CHECK_INT (width); |
3061 CHECK_INT (height); | 3008 CHECK_INT (height); |
3262 is being "changed" to its existing size, and do nothing if so? */ | 3209 is being "changed" to its existing size, and do nothing if so? */ |
3263 /* No, because it would hose toolbar updates. The toolbar | 3210 /* No, because it would hose toolbar updates. The toolbar |
3264 update code relies on this function to cause window `top' and | 3211 update code relies on this function to cause window `top' and |
3265 `left' coordinates to be recomputed even though no frame size | 3212 `left' coordinates to be recomputed even though no frame size |
3266 change occurs. --kyle */ | 3213 change occurs. --kyle */ |
3267 if (in_display) | 3214 if (in_display || hold_frame_size_changes) |
3268 abort (); | 3215 abort (); |
3269 | 3216 |
3270 frame = wrap_frame (f); | 3217 frame = wrap_frame (f); |
3271 | 3218 |
3272 default_face_height_and_width (frame, &real_font_height, 0); | 3219 default_face_height_and_width (frame, &real_font_height, 0); |
3437 fact. f->size_change_pending will get reset below. The most that | 3384 fact. f->size_change_pending will get reset below. The most that |
3438 can happen is that we will cycle through redisplay once more | 3385 can happen is that we will cycle through redisplay once more |
3439 --andy. */ | 3386 --andy. */ |
3440 MARK_FRAME_SIZE_CHANGED (f); | 3387 MARK_FRAME_SIZE_CHANGED (f); |
3441 | 3388 |
3442 if (delay || in_display || gc_in_progress) | 3389 if (delay || hold_frame_size_changes || gc_in_progress) |
3443 { | 3390 { |
3444 f->new_width = newwidth; | 3391 f->new_width = newwidth; |
3445 f->new_height = newheight; | 3392 f->new_height = newheight; |
3446 return; | 3393 return; |
3447 } | 3394 } |