comparison src/dispnew.c @ 960:17986889d3b6

* dispnew.c (Fredraw_frame): Call clear_frame_records before calling update_end, so that x_display_box_cursor can rely on the contents of f->current_glyphs. * dispnew.c (change_frame_size): Call check_frame_size here, rather than writing out its code. Don't declare newheight and newwidth to be register variables, since we take their address. * dispnew.c (in_display): Variable deleted; it's only ever used as an unofficial parameter to change_frame_size. (change_frame_size): New argument, DELAY, which when non-zero indicates to delay the size change until later. This should be passed as one from signal handlers. (window_change_signal): Call change_frame_size with a DELAY of 1. (do_pending_window_change): Call change_frame_size with DELAY of 0. * dispnew.c, frame.c, frame.h, keyboard.c, scroll.c, term.c, window.c, xdisp.c, xfns.c xterm.c (FRAME_IS_TERMCAP, FRAME_IS_X, FRAME_HAS_MINIBUF): Renamed these to FRAME_TERMCAP_P, FRAME_X_P, and FRAME_HAS_MINIBUF_P, for consistency with the rest of the frame macros.
author Jim Blandy <jimb@redhat.com>
date Wed, 12 Aug 1992 13:36:49 +0000
parents bb24f1180bb6
children 83605f96f58e
comparison
equal deleted inserted replaced
959:c1fc76b79275 960:17986889d3b6
129 129
130 struct cm Wcm; /* Structure for info on cursor positioning */ 130 struct cm Wcm; /* Structure for info on cursor positioning */
131 131
132 extern short ospeed; /* Output speed (from sg_ospeed) */ 132 extern short ospeed; /* Output speed (from sg_ospeed) */
133 133
134 int in_display; /* 1 if in redisplay: can't handle SIGWINCH now. */
135
136 int delayed_size_change; /* 1 means SIGWINCH happened when not safe. */ 134 int delayed_size_change; /* 1 means SIGWINCH happened when not safe. */
137 135
138 #ifdef MULTI_FRAME 136 #ifdef MULTI_FRAME
139 137
140 DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0, 138 DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0,
147 CHECK_LIVE_FRAME (frame, 0); 145 CHECK_LIVE_FRAME (frame, 0);
148 f = XFRAME (frame); 146 f = XFRAME (frame);
149 update_begin (f); 147 update_begin (f);
150 /* set_terminal_modes (); */ 148 /* set_terminal_modes (); */
151 clear_frame (); 149 clear_frame ();
150 clear_frame_records (f);
152 update_end (f); 151 update_end (f);
153 fflush (stdout); 152 fflush (stdout);
154 clear_frame_records (f);
155 windows_or_buffers_changed++; 153 windows_or_buffers_changed++;
156 /* Mark all windows as INaccurate, 154 /* Mark all windows as INaccurate,
157 so that every window will have its redisplay done. */ 155 so that every window will have its redisplay done. */
158 mark_window_display_accurate (FRAME_ROOT_WINDOW (f), 0); 156 mark_window_display_accurate (FRAME_ROOT_WINDOW (f), 0);
159 f->garbaged = 0; 157 f->garbaged = 0;
224 new->enable = (char *) xmalloc (height * sizeof (char)); 222 new->enable = (char *) xmalloc (height * sizeof (char));
225 bzero (new->enable, height * sizeof (char)); 223 bzero (new->enable, height * sizeof (char));
226 new->bufp = (int *) xmalloc (height * sizeof (int)); 224 new->bufp = (int *) xmalloc (height * sizeof (int));
227 225
228 #ifdef HAVE_X_WINDOWS 226 #ifdef HAVE_X_WINDOWS
229 if (FRAME_IS_X (frame)) 227 if (FRAME_X_P (frame))
230 { 228 {
231 new->nruns = (int *) xmalloc (height * sizeof (int)); 229 new->nruns = (int *) xmalloc (height * sizeof (int));
232 new->face_list 230 new->face_list
233 = (struct run **) xmalloc (height * sizeof (struct run *)); 231 = (struct run **) xmalloc (height * sizeof (struct run *));
234 new->top_left_x = (short *) xmalloc (height * sizeof (short)); 232 new->top_left_x = (short *) xmalloc (height * sizeof (short));
273 free (glyphs->highlight); 271 free (glyphs->highlight);
274 free (glyphs->enable); 272 free (glyphs->enable);
275 free (glyphs->bufp); 273 free (glyphs->bufp);
276 274
277 #ifdef HAVE_X_WINDOWS 275 #ifdef HAVE_X_WINDOWS
278 if (FRAME_IS_X (frame)) 276 if (FRAME_X_P (frame))
279 { 277 {
280 free (glyphs->nruns); 278 free (glyphs->nruns);
281 free (glyphs->face_list); 279 free (glyphs->face_list);
282 free (glyphs->top_left_x); 280 free (glyphs->top_left_x);
283 free (glyphs->top_left_y); 281 free (glyphs->top_left_y);
623 safe_bcopy (current_frame->bufp + from, 621 safe_bcopy (current_frame->bufp + from,
624 current_frame->bufp + from + amount, 622 current_frame->bufp + from + amount,
625 (end - from) * sizeof current_frame->bufp[0]); 623 (end - from) * sizeof current_frame->bufp[0]);
626 624
627 #ifdef HAVE_X_WINDOWS 625 #ifdef HAVE_X_WINDOWS
628 if (FRAME_IS_X (frame)) 626 if (FRAME_X_P (frame))
629 { 627 {
630 safe_bcopy (current_frame->nruns + from, 628 safe_bcopy (current_frame->nruns + from,
631 current_frame->nruns + from + amount, 629 current_frame->nruns + from + amount,
632 (end - from) * sizeof current_frame->nruns[0]); 630 (end - from) * sizeof current_frame->nruns[0]);
633 631
695 safe_bcopy (current_frame->bufp + from, 693 safe_bcopy (current_frame->bufp + from,
696 current_frame->bufp + from + amount, 694 current_frame->bufp + from + amount,
697 (end - from) * sizeof current_frame->bufp[0]); 695 (end - from) * sizeof current_frame->bufp[0]);
698 696
699 #ifdef HAVE_X_WINDOWS 697 #ifdef HAVE_X_WINDOWS
700 if (FRAME_IS_X (frame)) 698 if (FRAME_X_P (frame))
701 { 699 {
702 safe_bcopy (current_frame->nruns + from, 700 safe_bcopy (current_frame->nruns + from,
703 current_frame->nruns + from + amount, 701 current_frame->nruns + from + amount,
704 (end - from) * sizeof current_frame->nruns[0]); 702 (end - from) * sizeof current_frame->nruns[0]);
705 703
980 978
981 if (desired_frame->enable[FRAME_HEIGHT (f) - 1]) 979 if (desired_frame->enable[FRAME_HEIGHT (f) - 1])
982 update_line (f, FRAME_HEIGHT (f) - 1); 980 update_line (f, FRAME_HEIGHT (f) - 1);
983 981
984 #ifdef HAVE_X_WINDOWS 982 #ifdef HAVE_X_WINDOWS
985 if (FRAME_IS_X (f)) 983 if (FRAME_X_P (f))
986 { 984 {
987 leftmost = downto = f->display.x->internal_border_width; 985 leftmost = downto = f->display.x->internal_border_width;
988 if (desired_frame->enable[0]) 986 if (desired_frame->enable[0])
989 { 987 {
990 current_frame->top_left_x[FRAME_HEIGHT (f) - 1] = leftmost; 988 current_frame->top_left_x[FRAME_HEIGHT (f) - 1] = leftmost;
1000 /* Now update the rest of the lines. */ 998 /* Now update the rest of the lines. */
1001 for (i = 0; i < FRAME_HEIGHT (f) - 1 && (force || !input_pending); i++) 999 for (i = 0; i < FRAME_HEIGHT (f) - 1 && (force || !input_pending); i++)
1002 { 1000 {
1003 if (desired_frame->enable[i]) 1001 if (desired_frame->enable[i])
1004 { 1002 {
1005 if (FRAME_IS_TERMCAP (f)) 1003 if (FRAME_TERMCAP_P (f))
1006 { 1004 {
1007 /* Flush out every so many lines. 1005 /* Flush out every so many lines.
1008 Also flush out if likely to have more than 1k buffered 1006 Also flush out if likely to have more than 1k buffered
1009 otherwise. I'm told that some telnet connections get 1007 otherwise. I'm told that some telnet connections get
1010 really screwed by more than 1k output at once. */ 1008 really screwed by more than 1k output at once. */
1029 detect_input_pending (); 1027 detect_input_pending ();
1030 } 1028 }
1031 1029
1032 update_line (f, i); 1030 update_line (f, i);
1033 #ifdef HAVE_X_WINDOWS 1031 #ifdef HAVE_X_WINDOWS
1034 if (FRAME_IS_X (f)) 1032 if (FRAME_X_P (f))
1035 { 1033 {
1036 current_frame->top_left_y[i] = downto; 1034 current_frame->top_left_y[i] = downto;
1037 current_frame->top_left_x[i] = leftmost; 1035 current_frame->top_left_x[i] = leftmost;
1038 } 1036 }
1039 #endif /* HAVE_X_WINDOWS */ 1037 #endif /* HAVE_X_WINDOWS */
1040 } 1038 }
1041 1039
1042 #ifdef HAVE_X_WINDOWS 1040 #ifdef HAVE_X_WINDOWS
1043 if (FRAME_IS_X (f)) 1041 if (FRAME_X_P (f))
1044 downto += LINE_HEIGHT(f, i); 1042 downto += LINE_HEIGHT(f, i);
1045 #endif 1043 #endif
1046 } 1044 }
1047 pause = (i < FRAME_HEIGHT (f) - 1) ? i : 0; 1045 pause = (i < FRAME_HEIGHT (f) - 1) ? i : 0;
1048 1046
1301 current_frame->used[vpos] = desired_frame->used[vpos]; 1299 current_frame->used[vpos] = desired_frame->used[vpos];
1302 current_frame->highlight[vpos] = desired_frame->highlight[vpos]; 1300 current_frame->highlight[vpos] = desired_frame->highlight[vpos];
1303 current_frame->bufp[vpos] = desired_frame->bufp[vpos]; 1301 current_frame->bufp[vpos] = desired_frame->bufp[vpos];
1304 1302
1305 #ifdef HAVE_X_WINDOWS 1303 #ifdef HAVE_X_WINDOWS
1306 if (FRAME_IS_X (frame)) 1304 if (FRAME_X_P (frame))
1307 { 1305 {
1308 current_frame->pix_width[vpos] 1306 current_frame->pix_width[vpos]
1309 = current_frame->used[vpos] 1307 = current_frame->used[vpos]
1310 * FONT_WIDTH (frame->display.x->font); 1308 * FONT_WIDTH (frame->display.x->font);
1311 current_frame->pix_height[vpos] 1309 current_frame->pix_height[vpos]
1597 Lisp_Object tail; 1595 Lisp_Object tail;
1598 FRAME_PTR f; 1596 FRAME_PTR f;
1599 1597
1600 FOR_EACH_FRAME (tail, f) 1598 FOR_EACH_FRAME (tail, f)
1601 { 1599 {
1602 if (FRAME_IS_TERMCAP (f)) 1600 if (FRAME_TERMCAP_P (f))
1603 { 1601 {
1604 ++in_display; 1602 change_frame_size (f, height, width, 0, 1);
1605 change_frame_size (f, height, width, 0);
1606 --in_display;
1607 break; 1603 break;
1608 } 1604 }
1609 } 1605 }
1610 } 1606 }
1611 1607
1634 1630
1635 FRAME_NEW_HEIGHT (f) = 0; 1631 FRAME_NEW_HEIGHT (f) = 0;
1636 FRAME_NEW_WIDTH (f) = 0; 1632 FRAME_NEW_WIDTH (f) = 0;
1637 1633
1638 if (height != 0) 1634 if (height != 0)
1639 change_frame_size (f, height, width, 0); 1635 change_frame_size (f, height, width, 0, 0);
1640 } 1636 }
1641 } 1637 }
1642 } 1638 }
1643 1639
1644 1640
1645 /* Change the frame height and/or width. Values may be given as zero to 1641 /* Change the frame height and/or width. Values may be given as zero to
1646 indicate no change is to take place. */ 1642 indicate no change is to take place.
1647 1643
1648 change_frame_size (frame, newlength, newwidth, pretend) 1644 If DELAY is non-zero, then assume we're being called from a signal
1645 handler, and queue the change for later - perhaps the next
1646 redisplay. Since this tries to resize windows, we can't call it
1647 from a signal handler. */
1648
1649 change_frame_size (frame, newheight, newwidth, pretend, delay)
1649 register FRAME_PTR frame; 1650 register FRAME_PTR frame;
1650 register int newlength, newwidth, pretend; 1651 int newheight, newwidth, pretend;
1651 { 1652 {
1652 /* If we can't deal with the change now, queue it for later. */ 1653 /* If we can't deal with the change now, queue it for later. */
1653 if (in_display) 1654 if (delay)
1654 { 1655 {
1655 FRAME_NEW_HEIGHT (frame) = newlength; 1656 FRAME_NEW_HEIGHT (frame) = newheight;
1656 FRAME_NEW_WIDTH (frame) = newwidth; 1657 FRAME_NEW_WIDTH (frame) = newwidth;
1657 delayed_size_change = 1; 1658 delayed_size_change = 1;
1658 return; 1659 return;
1659 } 1660 }
1660 1661
1661 /* This size-change overrides any pending one for this frame. */ 1662 /* This size-change overrides any pending one for this frame. */
1662 FRAME_NEW_HEIGHT (frame) = 0; 1663 FRAME_NEW_HEIGHT (frame) = 0;
1663 FRAME_NEW_WIDTH (frame) = 0; 1664 FRAME_NEW_WIDTH (frame) = 0;
1664 1665
1665 if ((newlength == 0 || newlength == FRAME_HEIGHT (frame)) 1666 /* If an arguments is zero, set it to the current value. */
1666 && (newwidth == 0 || newwidth == FRAME_WIDTH (frame))) 1667 newheight || (newheight = FRAME_HEIGHT (frame));
1668 newwidth || (newwidth = FRAME_WIDTH (frame));
1669
1670 /* Round up to the smallest acceptable size. */
1671 check_frame_size (frame, &newheight, &newwidth);
1672
1673 /* If we're not changing the frame size, quit now. */
1674 if (newheight == FRAME_HEIGHT (frame)
1675 && newwidth == FRAME_WIDTH (frame))
1667 return; 1676 return;
1668 1677
1669 if (newlength && newlength != FRAME_HEIGHT (frame)) 1678 if (newheight != FRAME_HEIGHT (frame))
1670 { 1679 {
1671 if (FRAME_HAS_MINIBUF (frame) 1680 if (FRAME_HAS_MINIBUF_P (frame)
1672 && ! FRAME_MINIBUF_ONLY_P (frame)) 1681 && ! FRAME_MINIBUF_ONLY_P (frame))
1673 { 1682 {
1674 /* Frame has both root and minibuffer. */ 1683 /* Frame has both root and minibuffer. */
1675 set_window_height (FRAME_ROOT_WINDOW (frame), 1684 set_window_height (FRAME_ROOT_WINDOW (frame),
1676 newlength - 1, 0); 1685 newheight - 1, 0);
1677 XFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (frame))->top) 1686 XFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (frame))->top)
1678 = newlength - 1; 1687 = newheight - 1;
1679 set_window_height (FRAME_MINIBUF_WINDOW (frame), 1, 0); 1688 set_window_height (FRAME_MINIBUF_WINDOW (frame), 1, 0);
1680 } 1689 }
1681 else 1690 else
1682 /* Frame has just one top-level window. */ 1691 /* Frame has just one top-level window. */
1683 set_window_height (FRAME_ROOT_WINDOW (frame), newlength, 0); 1692 set_window_height (FRAME_ROOT_WINDOW (frame), newheight, 0);
1684 1693
1685 if (FRAME_IS_TERMCAP (frame) && !pretend) 1694 if (FRAME_TERMCAP_P (frame) && !pretend)
1686 FrameRows = newlength; 1695 FrameRows = newheight;
1687 1696
1688 #if 0 1697 #if 0
1689 if (frame->output_method == output_termcap) 1698 if (frame->output_method == output_termcap)
1690 { 1699 {
1691 frame_height = newlength; 1700 frame_height = newheight;
1692 if (!pretend) 1701 if (!pretend)
1693 FrameRows = newlength; 1702 FrameRows = newheight;
1694 } 1703 }
1695 #endif 1704 #endif
1696 } 1705 }
1697 1706
1698 if (newwidth && newwidth != FRAME_WIDTH (frame)) 1707 if (newwidth != FRAME_WIDTH (frame))
1699 { 1708 {
1700 set_window_width (FRAME_ROOT_WINDOW (frame), newwidth, 0); 1709 set_window_width (FRAME_ROOT_WINDOW (frame), newwidth, 0);
1701 if (FRAME_HAS_MINIBUF (frame)) 1710 if (FRAME_HAS_MINIBUF_P (frame))
1702 set_window_width (FRAME_MINIBUF_WINDOW (frame), newwidth, 0); 1711 set_window_width (FRAME_MINIBUF_WINDOW (frame), newwidth, 0);
1703 FRAME_WIDTH (frame) = newwidth; 1712
1704 1713 if (FRAME_TERMCAP_P (frame) && !pretend)
1705 if (FRAME_IS_TERMCAP (frame) && !pretend)
1706 FrameCols = newwidth; 1714 FrameCols = newwidth;
1707 #if 0 1715 #if 0
1708 if (frame->output_method == output_termcap) 1716 if (frame->output_method == output_termcap)
1709 { 1717 {
1710 frame_width = newwidth; 1718 frame_width = newwidth;
1712 FrameCols = newwidth; 1720 FrameCols = newwidth;
1713 } 1721 }
1714 #endif 1722 #endif
1715 } 1723 }
1716 1724
1717 if (newlength) 1725 FRAME_HEIGHT (frame) = newheight;
1718 FRAME_HEIGHT (frame) = newlength; 1726 FRAME_WIDTH (frame) = newwidth;
1719 1727
1720 remake_frame_glyphs (frame); 1728 remake_frame_glyphs (frame);
1721 calculate_costs (frame); 1729 calculate_costs (frame);
1722 } 1730 }
1723 1731
1724 DEFUN ("send-string-to-terminal", Fsend_string_to_terminal, 1732 DEFUN ("send-string-to-terminal", Fsend_string_to_terminal,