aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorKaroly Lorentey2004-04-16 15:03:58 +0000
committerKaroly Lorentey2004-04-16 15:03:58 +0000
commit385ed61f9d0bffef8a3f037e8cdc85d0de71bf15 (patch)
treef731aec43c0fd28ae4c35f4102d1d2dd21ab735c /src/term.c
parent5ffa0039d41813857b4442d435ad4f65123737c5 (diff)
downloademacs-385ed61f9d0bffef8a3f037e8cdc85d0de71bf15.tar.gz
emacs-385ed61f9d0bffef8a3f037e8cdc85d0de71bf15.zip
Eliminated updating_frame.
src/termhooks.h (cursor_to_hook, raw_cursor_to_hook) (clear_to_end_hook, clear_end_of_line_hook, clear_frame_hook) (ins_del_lines_hook, insert_glyphs_hook, write_glyphs_hook) (delete_glyphs_hook, ring_bell_hook, set_terminal_window_hook): Added frame parameter. src/term.c (ring_bell, tty_ring_bell, set_terminal_window) (tty_set_terminal_window, set_scroll_region, cursor_to) (tty_cursor_to, raw_cursor_to, tty_raw_cursor_to, clear_to_end) (tty_clear_to_end, clear_frame, tty_clear_frame, clear_end_of_line) (tty_clear_end_of_line, write_glyphs, tty_write_glyphs, insert_glyphs) (tty_insert_glyphs, delete_glyphs, tty_delete_glyphs, ins_del_lines) (tty_ins_del_lines): Added frame parameter. src/xterm.c (x_delete_glyphs, x_clear_frame, x_ins_del_lines): Added frame parameter. src/scroll.c (do_direct_scrolling, do_scrolling): Added frame parameter. src/term.c (update_begin, update_end): Don't set updating_frame. src/xfns.c (x_set_tool_bar_lines): Ditto. src/term.c (updating_frame): Removed. src/dispextern.h: Updated prototypes. src/dispnew.c (Fredraw_frame, direct_output_for_insert) (direct_output_forward_char, update_frame_1, update_frame_line) (ding, bitch_at_user): Added frame parameter to calls to redisplay. src/xdisp.c (try_window_id): Ditto. src/scroll.c (do_scrolling, do_direct_scrolling, scrolling_1): Ditto. src/fileio.c (auto_save_error): Ditto. src/term.c (tty_ring_bell): Flush the output stream after beeping. src/dispnew.c (ding, bitch_at_user): Don't fflush CURTTY. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-140
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c146
1 files changed, 54 insertions, 92 deletions
diff --git a/src/term.c b/src/term.c
index aeccdf285cb..13c8e036ea4 100644
--- a/src/term.c
+++ b/src/term.c
@@ -171,11 +171,6 @@ int max_frame_cols;
171 171
172int max_frame_lines; 172int max_frame_lines;
173 173
174/* Frame currently being redisplayed; 0 if not currently redisplaying.
175 (Direct output does not count). */
176
177FRAME_PTR updating_frame;
178
179/* Non-zero if we have dropped our controlling tty and therefore 174/* Non-zero if we have dropped our controlling tty and therefore
180 should not open a frame on stdout. */ 175 should not open a frame on stdout. */
181static int no_controlling_tty; 176static int no_controlling_tty;
@@ -201,10 +196,8 @@ extern char *tgetstr ();
201#endif /* WINDOWSNT */ 196#endif /* WINDOWSNT */
202 197
203void 198void
204ring_bell () 199ring_bell (struct frame *f)
205{ 200{
206 struct frame *f = XFRAME (selected_frame);
207
208 if (!NILP (Vring_bell_function)) 201 if (!NILP (Vring_bell_function))
209 { 202 {
210 Lisp_Object function; 203 Lisp_Object function;
@@ -225,20 +218,20 @@ ring_bell ()
225 Vring_bell_function = function; 218 Vring_bell_function = function;
226 } 219 }
227 else if (FRAME_DISPLAY (f)->ring_bell_hook) 220 else if (FRAME_DISPLAY (f)->ring_bell_hook)
228 (*FRAME_DISPLAY (f)->ring_bell_hook) (); 221 (*FRAME_DISPLAY (f)->ring_bell_hook) (f);
229} 222}
230 223
231/* Ring the bell on a tty. */ 224/* Ring the bell on a tty. */
232 225
233void 226void
234tty_ring_bell () 227tty_ring_bell (struct frame *f)
235{ 228{
236 struct frame *f = XFRAME (selected_frame);
237 struct tty_display_info *tty = FRAME_TTY (f); 229 struct tty_display_info *tty = FRAME_TTY (f);
238 230
239 OUTPUT (tty, (tty->TS_visible_bell && visible_bell 231 OUTPUT (tty, (tty->TS_visible_bell && visible_bell
240 ? tty->TS_visible_bell 232 ? tty->TS_visible_bell
241 : tty->TS_bell)); 233 : tty->TS_bell));
234 fflush (tty->output);
242} 235}
243 236
244/* Set up termcap modes for Emacs. */ 237/* Set up termcap modes for Emacs. */
@@ -282,7 +275,6 @@ void
282update_begin (f) 275update_begin (f)
283 struct frame *f; 276 struct frame *f;
284{ 277{
285 updating_frame = f;
286 if (FRAME_DISPLAY (f)->update_begin_hook) 278 if (FRAME_DISPLAY (f)->update_begin_hook)
287 (*FRAME_DISPLAY (f)->update_begin_hook) (f); 279 (*FRAME_DISPLAY (f)->update_begin_hook) (f);
288} 280}
@@ -293,7 +285,6 @@ update_end (f)
293{ 285{
294 if (FRAME_DISPLAY (f)->update_end_hook) 286 if (FRAME_DISPLAY (f)->update_end_hook)
295 (*FRAME_DISPLAY (f)->update_end_hook) (f); 287 (*FRAME_DISPLAY (f)->update_end_hook) (f);
296 updating_frame = NULL;
297} 288}
298 289
299/* Flag the end of a display update on a termcap display. */ 290/* Flag the end of a display update on a termcap display. */
@@ -315,36 +306,32 @@ tty_update_end (struct frame *f)
315 that is bounded by calls to update_begin and update_end. */ 306 that is bounded by calls to update_begin and update_end. */
316 307
317void 308void
318set_terminal_window (size) 309set_terminal_window (f, size)
310 struct frame *f;
319 int size; 311 int size;
320{ 312{
321 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
322
323 if (FRAME_DISPLAY (f)->set_terminal_window_hook) 313 if (FRAME_DISPLAY (f)->set_terminal_window_hook)
324 (*FRAME_DISPLAY (f)->set_terminal_window_hook) (size); 314 (*FRAME_DISPLAY (f)->set_terminal_window_hook) (f, size);
325} 315}
326 316
327/* The implementation of set_terminal_window for termcap frames. */ 317/* The implementation of set_terminal_window for termcap frames. */
328 318
329void 319void
330tty_set_terminal_window (int size) 320tty_set_terminal_window (struct frame *f, int size)
331{ 321{
332 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
333
334 struct tty_display_info *tty = FRAME_TTY (f); 322 struct tty_display_info *tty = FRAME_TTY (f);
335 323
336 tty->specified_window = size ? size : FRAME_LINES (f); 324 tty->specified_window = size ? size : FRAME_LINES (f);
337 if (FRAME_SCROLL_REGION_OK (f)) 325 if (FRAME_SCROLL_REGION_OK (f))
338 set_scroll_region (0, tty->specified_window); 326 set_scroll_region (f, 0, tty->specified_window);
339} 327}
340 328
341void 329void
342set_scroll_region (start, stop) 330set_scroll_region (f, start, stop)
331 struct frame *f;
343 int start, stop; 332 int start, stop;
344{ 333{
345 char *buf; 334 char *buf;
346 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
347
348 struct tty_display_info *tty = FRAME_TTY (f); 335 struct tty_display_info *tty = FRAME_TTY (f);
349 336
350 if (tty->TS_set_scroll_region) 337 if (tty->TS_set_scroll_region)
@@ -463,20 +450,17 @@ highlight_if_desired (struct tty_display_info *tty)
463 frame-relative coordinates. */ 450 frame-relative coordinates. */
464 451
465void 452void
466cursor_to (vpos, hpos) 453cursor_to (f, vpos, hpos)
454 struct frame *f;
467 int vpos, hpos; 455 int vpos, hpos;
468{ 456{
469 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
470
471 if (FRAME_DISPLAY (f)->cursor_to_hook) 457 if (FRAME_DISPLAY (f)->cursor_to_hook)
472 (*FRAME_DISPLAY (f)->cursor_to_hook) (vpos, hpos); 458 (*FRAME_DISPLAY (f)->cursor_to_hook) (f, vpos, hpos);
473} 459}
474 460
475void 461void
476tty_cursor_to (int vpos, int hpos) 462tty_cursor_to (struct frame *f, int vpos, int hpos)
477{ 463{
478 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
479
480 struct tty_display_info *tty = FRAME_TTY (f); 464 struct tty_display_info *tty = FRAME_TTY (f);
481 465
482 /* Detect the case where we are called from reset_sys_modes 466 /* Detect the case where we are called from reset_sys_modes
@@ -497,20 +481,17 @@ tty_cursor_to (int vpos, int hpos)
497/* Similar but don't take any account of the wasted characters. */ 481/* Similar but don't take any account of the wasted characters. */
498 482
499void 483void
500raw_cursor_to (row, col) 484raw_cursor_to (f, row, col)
485 struct frame *f;
501 int row, col; 486 int row, col;
502{ 487{
503 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
504
505 if (FRAME_DISPLAY (f)->raw_cursor_to_hook) 488 if (FRAME_DISPLAY (f)->raw_cursor_to_hook)
506 (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (row, col); 489 (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (f, row, col);
507} 490}
508 491
509void 492void
510tty_raw_cursor_to (int row, int col) 493tty_raw_cursor_to (struct frame *f, int row, int col)
511{ 494{
512 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
513
514 struct tty_display_info *tty = FRAME_TTY (f); 495 struct tty_display_info *tty = FRAME_TTY (f);
515 496
516 if (curY (tty) == row 497 if (curY (tty) == row
@@ -527,21 +508,18 @@ tty_raw_cursor_to (int row, int col)
527 508
528/* Clear from cursor to end of frame. */ 509/* Clear from cursor to end of frame. */
529void 510void
530clear_to_end () 511clear_to_end (struct frame *f)
531{ 512{
532 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
533
534 if (FRAME_DISPLAY (f)->clear_to_end_hook) 513 if (FRAME_DISPLAY (f)->clear_to_end_hook)
535 (*FRAME_DISPLAY (f)->clear_to_end_hook) (); 514 (*FRAME_DISPLAY (f)->clear_to_end_hook) (f);
536} 515}
537 516
538/* Clear from cursor to end of frame on a termcap device. */ 517/* Clear from cursor to end of frame on a termcap device. */
539 518
540void 519void
541tty_clear_to_end (void) 520tty_clear_to_end (struct frame *f)
542{ 521{
543 register int i; 522 register int i;
544 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
545 struct tty_display_info *tty = FRAME_TTY (f); 523 struct tty_display_info *tty = FRAME_TTY (f);
546 524
547 if (tty->TS_clr_to_bottom) 525 if (tty->TS_clr_to_bottom)
@@ -553,8 +531,8 @@ tty_clear_to_end (void)
553 { 531 {
554 for (i = curY (tty); i < FRAME_LINES (f); i++) 532 for (i = curY (tty); i < FRAME_LINES (f); i++)
555 { 533 {
556 cursor_to (i, 0); 534 cursor_to (f, i, 0);
557 clear_end_of_line (FRAME_COLS (f)); 535 clear_end_of_line (f, FRAME_COLS (f));
558 } 536 }
559 } 537 }
560} 538}
@@ -562,21 +540,17 @@ tty_clear_to_end (void)
562/* Clear entire frame */ 540/* Clear entire frame */
563 541
564void 542void
565clear_frame () 543clear_frame (struct frame *f)
566{ 544{
567 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
568
569 if (FRAME_DISPLAY (f)->clear_frame_hook) 545 if (FRAME_DISPLAY (f)->clear_frame_hook)
570 (*FRAME_DISPLAY (f)->clear_frame_hook) (); 546 (*FRAME_DISPLAY (f)->clear_frame_hook) (f);
571} 547}
572 548
573/* Clear an entire termcap frame. */ 549/* Clear an entire termcap frame. */
574 550
575void 551void
576tty_clear_frame () 552tty_clear_frame (struct frame *f)
577{ 553{
578 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
579
580 struct tty_display_info *tty = FRAME_TTY (f); 554 struct tty_display_info *tty = FRAME_TTY (f);
581 555
582 if (tty->TS_clr_frame) 556 if (tty->TS_clr_frame)
@@ -587,8 +561,8 @@ tty_clear_frame ()
587 } 561 }
588 else 562 else
589 { 563 {
590 cursor_to (0, 0); 564 cursor_to (f, 0, 0);
591 clear_to_end (); 565 clear_to_end (f);
592 } 566 }
593} 567}
594 568
@@ -598,13 +572,12 @@ tty_clear_frame ()
598 Note that the cursor may be moved, on terminals lacking a `ce' string. */ 572 Note that the cursor may be moved, on terminals lacking a `ce' string. */
599 573
600void 574void
601clear_end_of_line (first_unused_hpos) 575clear_end_of_line (f, first_unused_hpos)
576 struct frame *f;
602 int first_unused_hpos; 577 int first_unused_hpos;
603{ 578{
604 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
605
606 if (FRAME_DISPLAY (f)->clear_end_of_line_hook) 579 if (FRAME_DISPLAY (f)->clear_end_of_line_hook)
607 (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (first_unused_hpos); 580 (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (f, first_unused_hpos);
608} 581}
609 582
610/* An implementation of clear_end_of_line for termcap frames. 583/* An implementation of clear_end_of_line for termcap frames.
@@ -612,10 +585,9 @@ clear_end_of_line (first_unused_hpos)
612 Note that the cursor may be moved, on terminals lacking a `ce' string. */ 585 Note that the cursor may be moved, on terminals lacking a `ce' string. */
613 586
614void 587void
615tty_clear_end_of_line (int first_unused_hpos) 588tty_clear_end_of_line (struct frame *f, int first_unused_hpos)
616{ 589{
617 register int i; 590 register int i;
618 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
619 struct tty_display_info *tty = FRAME_TTY (f); 591 struct tty_display_info *tty = FRAME_TTY (f);
620 592
621 /* Detect the case where we are called from reset_sys_modes 593 /* Detect the case where we are called from reset_sys_modes
@@ -763,27 +735,24 @@ encode_terminal_code (src, dst, src_len, dst_len, consumed)
763 Advance the nominal cursor over the text. */ 735 Advance the nominal cursor over the text. */
764 736
765void 737void
766write_glyphs (string, len) 738write_glyphs (f, string, len)
739 struct frame *f;
767 register struct glyph *string; 740 register struct glyph *string;
768 register int len; 741 register int len;
769{ 742{
770 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
771
772 if (FRAME_DISPLAY (f)->write_glyphs_hook) 743 if (FRAME_DISPLAY (f)->write_glyphs_hook)
773 (*FRAME_DISPLAY (f)->write_glyphs_hook) (string, len); 744 (*FRAME_DISPLAY (f)->write_glyphs_hook) (f, string, len);
774} 745}
775 746
776/* An implementation of write_glyphs for termcap frames. */ 747/* An implementation of write_glyphs for termcap frames. */
777 748
778void 749void
779tty_write_glyphs (struct glyph *string, int len) 750tty_write_glyphs (struct frame *f, struct glyph *string, int len)
780{ 751{
781 int produced, consumed; 752 int produced, consumed;
782 unsigned char conversion_buffer[1024]; 753 unsigned char conversion_buffer[1024];
783 int conversion_buffer_size = sizeof conversion_buffer; 754 int conversion_buffer_size = sizeof conversion_buffer;
784 755
785 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
786
787 struct tty_display_info *tty = FRAME_TTY (f); 756 struct tty_display_info *tty = FRAME_TTY (f);
788 757
789 turn_off_insert (tty); 758 turn_off_insert (tty);
@@ -873,27 +842,25 @@ tty_write_glyphs (struct glyph *string, int len)
873 If start is zero, insert blanks instead of a string at start */ 842 If start is zero, insert blanks instead of a string at start */
874 843
875void 844void
876insert_glyphs (start, len) 845insert_glyphs (f, start, len)
846 struct frame *f;
877 register struct glyph *start; 847 register struct glyph *start;
878 register int len; 848 register int len;
879{ 849{
880 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
881
882 if (len <= 0) 850 if (len <= 0)
883 return; 851 return;
884 852
885 if (FRAME_DISPLAY (f)->insert_glyphs_hook) 853 if (FRAME_DISPLAY (f)->insert_glyphs_hook)
886 (*FRAME_DISPLAY (f)->insert_glyphs_hook) (start, len); 854 (*FRAME_DISPLAY (f)->insert_glyphs_hook) (f, start, len);
887} 855}
888 856
889/* An implementation of insert_glyphs for termcap frames. */ 857/* An implementation of insert_glyphs for termcap frames. */
890 858
891void 859void
892tty_insert_glyphs (struct glyph *start, int len) 860tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
893{ 861{
894 char *buf; 862 char *buf;
895 struct glyph *glyph = NULL; 863 struct glyph *glyph = NULL;
896 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
897 864
898 struct tty_display_info *tty = FRAME_TTY (f); 865 struct tty_display_info *tty = FRAME_TTY (f);
899 866
@@ -903,7 +870,7 @@ tty_insert_glyphs (struct glyph *start, int len)
903 OUTPUT1 (tty, buf); 870 OUTPUT1 (tty, buf);
904 xfree (buf); 871 xfree (buf);
905 if (start) 872 if (start)
906 write_glyphs (start, len); 873 write_glyphs (f, start, len);
907 return; 874 return;
908 } 875 }
909 876
@@ -972,23 +939,21 @@ tty_insert_glyphs (struct glyph *start, int len)
972/* Delete N glyphs at the nominal cursor position. */ 939/* Delete N glyphs at the nominal cursor position. */
973 940
974void 941void
975delete_glyphs (n) 942delete_glyphs (f, n)
943 struct frame *f;
976 register int n; 944 register int n;
977{ 945{
978 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
979
980 if (FRAME_DISPLAY (f)->delete_glyphs_hook) 946 if (FRAME_DISPLAY (f)->delete_glyphs_hook)
981 (*FRAME_DISPLAY (f)->delete_glyphs_hook) (n); 947 (*FRAME_DISPLAY (f)->delete_glyphs_hook) (f, n);
982} 948}
983 949
984/* An implementation of delete_glyphs for termcap frames. */ 950/* An implementation of delete_glyphs for termcap frames. */
985 951
986void 952void
987tty_delete_glyphs (int n) 953tty_delete_glyphs (struct frame *f, int n)
988{ 954{
989 char *buf; 955 char *buf;
990 register int i; 956 register int i;
991 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
992 957
993 struct tty_display_info *tty = FRAME_TTY (f); 958 struct tty_display_info *tty = FRAME_TTY (f);
994 959
@@ -1018,22 +983,19 @@ tty_delete_glyphs (int n)
1018/* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */ 983/* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */
1019 984
1020void 985void
1021ins_del_lines (vpos, n) 986ins_del_lines (f, vpos, n)
987 struct frame *f;
1022 int vpos, n; 988 int vpos, n;
1023{ 989{
1024 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
1025
1026 if (FRAME_DISPLAY (f)->ins_del_lines_hook) 990 if (FRAME_DISPLAY (f)->ins_del_lines_hook)
1027 (*FRAME_DISPLAY (f)->ins_del_lines_hook) (vpos, n); 991 (*FRAME_DISPLAY (f)->ins_del_lines_hook) (f, vpos, n);
1028} 992}
1029 993
1030/* An implementation of ins_del_lines for termcap frames. */ 994/* An implementation of ins_del_lines for termcap frames. */
1031 995
1032void 996void
1033tty_ins_del_lines (int vpos, int n) 997tty_ins_del_lines (struct frame *f, int vpos, int n)
1034{ 998{
1035 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
1036
1037 struct tty_display_info *tty = FRAME_TTY (f); 999 struct tty_display_info *tty = FRAME_TTY (f);
1038 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; 1000 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
1039 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; 1001 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
@@ -1075,7 +1037,7 @@ tty_ins_del_lines (int vpos, int n)
1075 } 1037 }
1076 else 1038 else
1077 { 1039 {
1078 set_scroll_region (vpos, tty->specified_window); 1040 set_scroll_region (f, vpos, tty->specified_window);
1079 if (n < 0) 1041 if (n < 0)
1080 raw_cursor_to (tty->specified_window - 1, 0); 1042 raw_cursor_to (tty->specified_window - 1, 0);
1081 else 1043 else
@@ -1083,15 +1045,15 @@ tty_ins_del_lines (int vpos, int n)
1083 background_highlight (tty); 1045 background_highlight (tty);
1084 while (--i >= 0) 1046 while (--i >= 0)
1085 OUTPUTL (tty, scroll, tty->specified_window - vpos); 1047 OUTPUTL (tty, scroll, tty->specified_window - vpos);
1086 set_scroll_region (0, tty->specified_window); 1048 set_scroll_region (f, 0, tty->specified_window);
1087 } 1049 }
1088 1050
1089 if (!FRAME_SCROLL_REGION_OK (f) 1051 if (!FRAME_SCROLL_REGION_OK (f)
1090 && FRAME_MEMORY_BELOW_FRAME (f) 1052 && FRAME_MEMORY_BELOW_FRAME (f)
1091 && n < 0) 1053 && n < 0)
1092 { 1054 {
1093 cursor_to (FRAME_LINES (f) + n, 0); 1055 cursor_to (f, FRAME_LINES (f) + n, 0);
1094 clear_to_end (); 1056 clear_to_end (f);
1095 } 1057 }
1096} 1058}
1097 1059