diff options
| author | Jim Blandy | 1992-08-12 13:36:49 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-08-12 13:36:49 +0000 |
| commit | b6a65ac2ae273be2d0c672025354d285fd559e80 (patch) | |
| tree | 92a98b9bf17a2fb9e944c245450c8427c10f1733 | |
| parent | 63639d4409f53b229b9f0a397e42f3515c6d2023 (diff) | |
| download | emacs-b6a65ac2ae273be2d0c672025354d285fd559e80.tar.gz emacs-b6a65ac2ae273be2d0c672025354d285fd559e80.zip | |
* 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.
| -rw-r--r-- | src/dispnew.c | 92 |
1 files changed, 50 insertions, 42 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index c8fc1cec8f8..4a34e141eeb 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -131,8 +131,6 @@ 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 |
| @@ -149,9 +147,9 @@ DEFUN ("redraw-frame", Fredraw_frame, Sredraw_frame, 1, 1, 0, | |||
| 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. */ |
| @@ -226,7 +224,7 @@ make_frame_glyphs (frame, empty) | |||
| 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 |
| @@ -275,7 +273,7 @@ free_frame_glyphs (frame, glyphs) | |||
| 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); |
| @@ -625,7 +623,7 @@ scroll_frame_lines (frame, from, end, 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, |
| @@ -697,7 +695,7 @@ scroll_frame_lines (frame, from, end, 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, |
| @@ -982,7 +980,7 @@ update_frame (f, force, inhibit_hairy_id) | |||
| 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]) |
| @@ -1002,7 +1000,7 @@ update_frame (f, force, inhibit_hairy_id) | |||
| 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 |
| @@ -1031,7 +1029,7 @@ update_frame (f, force, inhibit_hairy_id) | |||
| 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; |
| @@ -1040,7 +1038,7 @@ update_frame (f, force, inhibit_hairy_id) | |||
| 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 | } |
| @@ -1303,7 +1301,7 @@ update_line (frame, 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] |
| @@ -1599,11 +1597,9 @@ window_change_signal () | |||
| 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 | } |
| @@ -1636,23 +1632,28 @@ do_pending_window_change () | |||
| 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; |
| @@ -1660,49 +1661,56 @@ change_frame_size (frame, newlength, newwidth, pretend) | |||
| 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; |
| 1665 | |||
| 1666 | /* If an arguments is zero, set it to the current value. */ | ||
| 1667 | newheight || (newheight = FRAME_HEIGHT (frame)); | ||
| 1668 | newwidth || (newwidth = FRAME_WIDTH (frame)); | ||
| 1664 | 1669 | ||
| 1665 | if ((newlength == 0 || newlength == FRAME_HEIGHT (frame)) | 1670 | /* Round up to the smallest acceptable size. */ |
| 1666 | && (newwidth == 0 || newwidth == FRAME_WIDTH (frame))) | 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; | ||
| 1704 | 1712 | ||
| 1705 | if (FRAME_IS_TERMCAP (frame) && !pretend) | 1713 | if (FRAME_TERMCAP_P (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) |
| @@ -1714,9 +1722,9 @@ change_frame_size (frame, newlength, newwidth, pretend) | |||
| 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 | } |