comparison src/redisplay.c @ 1279:cd0abfdb9e9d

[xemacs-hg @ 2003-02-09 09:33:42 by ben] walk-windows, redisplay fixes console-stream.c: Abort when any attempts to output a stream console are made. Should be caught sooner. event-msw.c: Don't redisplay() during sizing when the frame has not yet been initialized completely. event-stream.c, menubar-msw.c, menubar-x.c, menubar.c, menubar.h: Restore in_menu_callback. Bind it in menubar-{msw,x}.c when calling filter functions and the like. Conditionalize on it, not in_modal_loop, when issuing error in `next-event', otherwise we bite the dust immediately -- event-msw.c purposely calls Fnext_event() in a modal loop, and knows what it's doing. redisplay-output.c: Formatting fixes. redisplay.c, window.c, winslots.h: Delete lots of carcasses of attempts to add redisplay support for font-lock -- `pre/post-redisplay-hook', unimplemented junk from FSF (redisplay-end-trigger, `window-scroll-functions', `window-size-change-functions'). If we want to port some redisplay support from FSF, port the `fontified' property. redisplay.c: Put in a check here (as well as redisplay_device()) for a stream frame. We can get here directly through Lisp fun `redisplay-frame'. Abort if frame not initialized. redisplay.c: Check for stream frames/devices. window.el: walk-windows was broken when a frame was given to WHICH-FRAMES. it would loop forever. The FSF version fixes this but i didn't sync to them because (a) it conses (bad for lazy-lock), (b) it calls select-window.
author ben
date Sun, 09 Feb 2003 09:33:48 +0000
parents fffe735e63ee
children f3437b56874d
comparison
equal deleted inserted replaced
1278:1706fd7322af 1279:cd0abfdb9e9d
486 /* Marker for where to display an arrow on top of the buffer text. */ 486 /* Marker for where to display an arrow on top of the buffer text. */
487 Lisp_Object Voverlay_arrow_position; 487 Lisp_Object Voverlay_arrow_position;
488 /* String to display for the arrow. */ 488 /* String to display for the arrow. */
489 Lisp_Object Voverlay_arrow_string; 489 Lisp_Object Voverlay_arrow_string;
490 490
491 Lisp_Object Vwindow_size_change_functions;
492 Lisp_Object Vwindow_scroll_functions;
493 Lisp_Object Qredisplay_end_trigger_functions, Vredisplay_end_trigger_functions;
494
495 Lisp_Object Qbuffer_list_changed_hook, Vbuffer_list_changed_hook; 491 Lisp_Object Qbuffer_list_changed_hook, Vbuffer_list_changed_hook;
496
497
498 #define INHIBIT_REDISPLAY_HOOKS /* #### Until we've thought about
499 this more. */
500 #ifndef INHIBIT_REDISPLAY_HOOKS
501 /* #### Chuck says: I think this needs more thought.
502 Think about this for 19.14. */
503 Lisp_Object Vpre_redisplay_hook, Vpost_redisplay_hook;
504 Lisp_Object Qpre_redisplay_hook, Qpost_redisplay_hook;
505 #endif /* INHIBIT_REDISPLAY_HOOKS */
506 492
507 static Fixnum last_display_warning_tick; 493 static Fixnum last_display_warning_tick;
508 static Fixnum display_warning_tick; 494 static Fixnum display_warning_tick;
509 Lisp_Object Qdisplay_warning_buffer; 495 Lisp_Object Qdisplay_warning_buffer;
510 int inhibit_warning_display; 496 int inhibit_warning_display;
6589 { 6575 {
6590 redisplay_window (window, skip_selected); 6576 redisplay_window (window, skip_selected);
6591 } 6577 }
6592 } 6578 }
6593 6579
6594 static int 6580 /* Ensure that all windows on the given frame are correctly displayed.
6595 call_redisplay_end_triggers (struct window *w, void *closure) 6581 Return non-zero if pre-empted. */
6596 {
6597 Charbpos lrpos = w->last_redisplay_pos;
6598 w->last_redisplay_pos = 0;
6599 if (!NILP (w->buffer)
6600 && !NILP (w->redisplay_end_trigger)
6601 && lrpos > 0)
6602 {
6603 Charbpos pos;
6604
6605 if (MARKERP (w->redisplay_end_trigger)
6606 && XMARKER (w->redisplay_end_trigger)->buffer != 0)
6607 pos = marker_position (w->redisplay_end_trigger);
6608 else if (INTP (w->redisplay_end_trigger))
6609 pos = XINT (w->redisplay_end_trigger);
6610 else
6611 {
6612 w->redisplay_end_trigger = Qnil;
6613 return 0;
6614 }
6615
6616 if (lrpos >= pos)
6617 {
6618 Lisp_Object window = wrap_window (w);
6619
6620 va_run_hook_with_args_in_buffer_trapping_problems
6621 ("Error in redisplay end trigger",
6622 XBUFFER (w->buffer),
6623 Qredisplay_end_trigger_functions,
6624 2, window,
6625 w->redisplay_end_trigger,
6626 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION);
6627 w->redisplay_end_trigger = Qnil;
6628 }
6629 }
6630
6631 return 0;
6632 }
6633
6634 /* Ensure that all windows on the given frame are correctly displayed. */
6635 6582
6636 int 6583 int
6637 redisplay_frame (struct frame *f, int preemption_check) 6584 redisplay_frame (struct frame *f, int preemption_check)
6638 { 6585 {
6639 struct device *d = XDEVICE (f->device); 6586 struct device *d = XDEVICE (f->device);
6640 int depth; 6587 int depth;
6588
6589 assert (f->init_finished);
6590
6591 if (FRAME_STREAM_P (f)) /* nothing to do */
6592 return 0;
6641 6593
6642 if (preemption_check 6594 if (preemption_check
6643 && !DEVICE_IMPL_FLAG (d, XDEVIMPF_DONT_PREEMPT_REDISPLAY)) 6595 && !DEVICE_IMPL_FLAG (d, XDEVIMPF_DONT_PREEMPT_REDISPLAY))
6644 { 6596 {
6645 /* The preemption check itself takes a lot of time, 6597 /* The preemption check itself takes a lot of time,
6798 /* ----------------- END CRITICAL REDISPLAY SECTION ---------------- */ 6750 /* ----------------- END CRITICAL REDISPLAY SECTION ---------------- */
6799 6751
6800 /* Allow frame size changes to occur again. */ 6752 /* Allow frame size changes to occur again. */
6801 exit_redisplay_critical_section (depth); 6753 exit_redisplay_critical_section (depth);
6802 6754
6803 map_windows (f, call_redisplay_end_triggers, 0);
6804 return 0; 6755 return 0;
6805 } 6756 }
6806 6757
6807 /* Ensure that all frames on the given device are correctly displayed. 6758 /* Ensure that all frames on the given device are correctly displayed.
6808 If AUTOMATIC is non-zero, and the device implementation indicates 6759 If AUTOMATIC is non-zero, and the device implementation indicates
7001 call0_trapping_problems 6952 call0_trapping_problems
7002 (0, Qdisplay_warning_buffer, 6953 (0, Qdisplay_warning_buffer,
7003 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION); 6954 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION);
7004 last_display_warning_tick = display_warning_tick; 6955 last_display_warning_tick = display_warning_tick;
7005 } 6956 }
7006 /* The run_hook_trapping_problems functions are smart enough not
7007 to do any evalling if the hook function is empty, so there
7008 should not be any significant time loss. */
7009 #ifndef INHIBIT_REDISPLAY_HOOKS
7010 run_hook_trapping_problems
7011 ("Error in pre-redisplay-hook",
7012 Qpre_redisplay_hook,
7013 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION);
7014 #endif /* INHIBIT_REDISPLAY_HOOKS */
7015 6957
7016 redisplay_without_hooks (); 6958 redisplay_without_hooks ();
7017
7018 #ifndef INHIBIT_REDISPLAY_HOOKS
7019 run_hook_trapping_problems
7020 ("Error in post-redisplay-hook",
7021 Qpost_redisplay_hook,
7022 INHIBIT_EXISTING_PERMANENT_DISPLAY_OBJECT_DELETION);
7023 #endif /* INHIBIT_REDISPLAY_HOOKS */
7024 } 6959 }
7025 6960
7026 Lisp_Object 6961 Lisp_Object
7027 eval_within_redisplay (Lisp_Object dont_trust_this_damn_sucker) 6962 eval_within_redisplay (Lisp_Object dont_trust_this_damn_sucker)
7028 { 6963 {
9185 DEVICE_LOOP_NO_BREAK (devcons, concons) 9120 DEVICE_LOOP_NO_BREAK (devcons, concons)
9186 { 9121 {
9187 struct device *d = XDEVICE (XCAR (devcons)); 9122 struct device *d = XDEVICE (XCAR (devcons));
9188 Lisp_Object frmcons; 9123 Lisp_Object frmcons;
9189 9124
9125 if (DEVICE_STREAM_P (d))
9126 continue;
9127
9190 DEVICE_FRAME_LOOP (frmcons, d) 9128 DEVICE_FRAME_LOOP (frmcons, d)
9191 { 9129 {
9192 struct frame *f = XFRAME (XCAR (frmcons)); 9130 struct frame *f = XFRAME (XCAR (frmcons));
9193 int depth; 9131 int depth;
9194 9132
9211 } 9149 }
9212 depth = enter_redisplay_critical_section (); 9150 depth = enter_redisplay_critical_section ();
9213 redisplay_window (window, 0); 9151 redisplay_window (window, 0);
9214 exit_redisplay_critical_section (depth); 9152 exit_redisplay_critical_section (depth);
9215 MAYBE_DEVMETH (d, frame_output_end, (f)); 9153 MAYBE_DEVMETH (d, frame_output_end, (f));
9216
9217 call_redisplay_end_triggers (XWINDOW (window), 0);
9218 } 9154 }
9219 } 9155 }
9220 } 9156 }
9221 9157
9222 return Qnil; 9158 return Qnil;
9352 Force an immediate update of the cursor on FRAME. 9288 Force an immediate update of the cursor on FRAME.
9353 FRAME defaults to the selected frame if omitted. 9289 FRAME defaults to the selected frame if omitted.
9354 */ 9290 */
9355 (frame)) 9291 (frame))
9356 { 9292 {
9357 redisplay_redraw_cursor (decode_frame (frame), 1); 9293 struct frame *f = decode_frame (frame);
9294
9295 if (!FRAME_STREAM_P (f))
9296 redisplay_redraw_cursor (f, 1);
9358 return Qnil; 9297 return Qnil;
9359 } 9298 }
9360 9299
9361 9300
9362 /***************************************************************************/ 9301 /***************************************************************************/
9697 9636
9698 void 9637 void
9699 syms_of_redisplay (void) 9638 syms_of_redisplay (void)
9700 { 9639 {
9701 DEFSYMBOL (Qcursor_in_echo_area); 9640 DEFSYMBOL (Qcursor_in_echo_area);
9702 #ifndef INHIBIT_REDISPLAY_HOOKS
9703 DEFSYMBOL (Qpre_redisplay_hook);
9704 DEFSYMBOL (Qpost_redisplay_hook);
9705 #endif /* INHIBIT_REDISPLAY_HOOKS */
9706 DEFSYMBOL (Qdisplay_warning_buffer); 9641 DEFSYMBOL (Qdisplay_warning_buffer);
9707 DEFSYMBOL (Qbar_cursor); 9642 DEFSYMBOL (Qbar_cursor);
9708 DEFSYMBOL (Qredisplay_end_trigger_functions);
9709 DEFSYMBOL (Qtop_bottom); 9643 DEFSYMBOL (Qtop_bottom);
9710 DEFSYMBOL (Qbuffer_list_changed_hook); 9644 DEFSYMBOL (Qbuffer_list_changed_hook);
9711 9645
9712 DEFSUBR (Fredisplay_echo_area); 9646 DEFSUBR (Fredisplay_echo_area);
9713 DEFSUBR (Fredraw_frame); 9647 DEFSUBR (Fredraw_frame);
9853 9787
9854 DEFVAR_LISP ("bar-cursor", &Vbar_cursor /* 9788 DEFVAR_LISP ("bar-cursor", &Vbar_cursor /*
9855 *Use vertical bar cursor if non-nil. If t width is 1 pixel, otherwise 2. 9789 *Use vertical bar cursor if non-nil. If t width is 1 pixel, otherwise 2.
9856 */ ); 9790 */ );
9857 Vbar_cursor = Qnil; 9791 Vbar_cursor = Qnil;
9858
9859 #ifndef INHIBIT_REDISPLAY_HOOKS
9860 xxDEFVAR_LISP ("pre-redisplay-hook", &Vpre_redisplay_hook /*
9861 Function or functions to run before every redisplay.
9862 */ );
9863 Vpre_redisplay_hook = Qnil;
9864
9865 xxDEFVAR_LISP ("post-redisplay-hook", &Vpost_redisplay_hook /*
9866 Function or functions to run after every redisplay.
9867 */ );
9868 Vpost_redisplay_hook = Qnil;
9869 #endif /* INHIBIT_REDISPLAY_HOOKS */
9870 9792
9871 DEFVAR_LISP ("buffer-list-changed-hook", &Vbuffer_list_changed_hook /* 9793 DEFVAR_LISP ("buffer-list-changed-hook", &Vbuffer_list_changed_hook /*
9872 Function or functions to call when a frame's buffer list has changed. 9794 Function or functions to call when a frame's buffer list has changed.
9873 This is called during redisplay, before redisplaying each frame. 9795 This is called during redisplay, before redisplaying each frame.
9874 Functions on this hook are called with one argument, the frame. 9796 Functions on this hook are called with one argument, the frame.
9888 will be displayed when the binding no longer applies. 9810 will be displayed when the binding no longer applies.
9889 */ ); 9811 */ );
9890 /* reset to 0 by startup.el after the splash screen has displayed. 9812 /* reset to 0 by startup.el after the splash screen has displayed.
9891 This way, the warnings don't obliterate the splash screen. */ 9813 This way, the warnings don't obliterate the splash screen. */
9892 inhibit_warning_display = 1; 9814 inhibit_warning_display = 1;
9893
9894 DEFVAR_LISP ("window-size-change-functions",
9895 &Vwindow_size_change_functions /*
9896 Not currently implemented.
9897 Functions called before redisplay, if window sizes have changed.
9898 The value should be a list of functions that take one argument.
9899 Just before redisplay, for each frame, if any of its windows have changed
9900 size since the last redisplay, or have been split or deleted,
9901 all the functions in the list are called, with the frame as argument.
9902 */ );
9903 Vwindow_size_change_functions = Qnil;
9904
9905 DEFVAR_LISP ("window-scroll-functions", &Vwindow_scroll_functions /*
9906 Not currently implemented.
9907 Functions to call before redisplaying a window with scrolling.
9908 Each function is called with two arguments, the window
9909 and its new display-start position. Note that the value of `window-end'
9910 is not valid when these functions are called.
9911 */ );
9912 Vwindow_scroll_functions = Qnil;
9913
9914 DEFVAR_LISP ("redisplay-end-trigger-functions",
9915 &Vredisplay_end_trigger_functions /*
9916 See `set-window-redisplay-end-trigger'.
9917 */ );
9918 Vredisplay_end_trigger_functions = Qnil;
9919 9815
9920 DEFVAR_BOOL ("column-number-start-at-one", &column_number_start_at_one /* 9816 DEFVAR_BOOL ("column-number-start-at-one", &column_number_start_at_one /*
9921 *Non-nil means column display number starts at 1. 9817 *Non-nil means column display number starts at 1.
9922 */ ); 9818 */ );
9923 column_number_start_at_one = 0; 9819 column_number_start_at_one = 0;