diff options
| author | Jan D | 2015-04-26 13:55:01 +0200 |
|---|---|---|
| committer | Jan D | 2015-04-26 13:55:01 +0200 |
| commit | f92ac2e82ed199d6f25d2a59508e08addb1150ac (patch) | |
| tree | d7d7756e3dbce10d8f73c27815d815499f78c2bd /src/window.c | |
| parent | 5a094119ce79723108abd90a1fcc33721e964823 (diff) | |
| parent | a40869789fc5502e3d4e393b7c31d78cb7f29aa1 (diff) | |
| download | emacs-f92ac2e82ed199d6f25d2a59508e08addb1150ac.tar.gz emacs-f92ac2e82ed199d6f25d2a59508e08addb1150ac.zip | |
Merge branch 'master' into cairo
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 636 |
1 files changed, 322 insertions, 314 deletions
diff --git a/src/window.c b/src/window.c index d59616d0545..0fcf82d43f4 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -45,28 +45,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 45 | #include "msdos.h" | 45 | #include "msdos.h" |
| 46 | #endif | 46 | #endif |
| 47 | 47 | ||
| 48 | static int displayed_window_lines (struct window *); | 48 | static ptrdiff_t count_windows (struct window *); |
| 49 | static int count_windows (struct window *); | 49 | static ptrdiff_t get_leaf_windows (struct window *, struct window **, |
| 50 | static int get_leaf_windows (struct window *, struct window **, int); | 50 | ptrdiff_t); |
| 51 | static void window_scroll (Lisp_Object, EMACS_INT, bool, int); | 51 | static void window_scroll_pixel_based (Lisp_Object, int, bool, bool); |
| 52 | static void window_scroll_pixel_based (Lisp_Object, int, bool, int); | 52 | static void window_scroll_line_based (Lisp_Object, int, bool, bool); |
| 53 | static void window_scroll_line_based (Lisp_Object, int, bool, int); | ||
| 54 | static int add_window_to_list (struct window *, void *); | ||
| 55 | static Lisp_Object next_window (Lisp_Object, Lisp_Object, | ||
| 56 | Lisp_Object, int); | ||
| 57 | static void decode_next_window_args (Lisp_Object *, Lisp_Object *, | ||
| 58 | Lisp_Object *); | ||
| 59 | static void foreach_window (struct frame *, | 53 | static void foreach_window (struct frame *, |
| 60 | int (* fn) (struct window *, void *), | 54 | bool (* fn) (struct window *, void *), |
| 61 | void *); | 55 | void *); |
| 62 | static int foreach_window_1 (struct window *, | 56 | static bool foreach_window_1 (struct window *, |
| 63 | int (* fn) (struct window *, void *), | 57 | bool (* fn) (struct window *, void *), |
| 64 | void *); | 58 | void *); |
| 65 | static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object); | 59 | static bool window_resize_check (struct window *, bool); |
| 66 | static int window_resize_check (struct window *, bool); | ||
| 67 | static void window_resize_apply (struct window *, bool); | 60 | static void window_resize_apply (struct window *, bool); |
| 68 | static void window_resize_apply_total (struct window *, bool); | ||
| 69 | static Lisp_Object select_window (Lisp_Object, Lisp_Object, int); | ||
| 70 | static void select_window_1 (Lisp_Object, bool); | 61 | static void select_window_1 (Lisp_Object, bool); |
| 71 | 62 | ||
| 72 | static struct window *set_window_fringes (struct window *, Lisp_Object, | 63 | static struct window *set_window_fringes (struct window *, Lisp_Object, |
| @@ -74,7 +65,8 @@ static struct window *set_window_fringes (struct window *, Lisp_Object, | |||
| 74 | static struct window *set_window_margins (struct window *, Lisp_Object, | 65 | static struct window *set_window_margins (struct window *, Lisp_Object, |
| 75 | Lisp_Object); | 66 | Lisp_Object); |
| 76 | static struct window *set_window_scroll_bars (struct window *, Lisp_Object, | 67 | static struct window *set_window_scroll_bars (struct window *, Lisp_Object, |
| 77 | Lisp_Object, Lisp_Object, Lisp_Object); | 68 | Lisp_Object, Lisp_Object, |
| 69 | Lisp_Object); | ||
| 78 | static void apply_window_adjustment (struct window *); | 70 | static void apply_window_adjustment (struct window *); |
| 79 | 71 | ||
| 80 | /* This is the window in which the terminal's cursor should | 72 | /* This is the window in which the terminal's cursor should |
| @@ -102,7 +94,7 @@ Lisp_Object minibuf_window; | |||
| 102 | Lisp_Object minibuf_selected_window; | 94 | Lisp_Object minibuf_selected_window; |
| 103 | 95 | ||
| 104 | /* Incremented for each window created. */ | 96 | /* Incremented for each window created. */ |
| 105 | static int sequence_number; | 97 | static EMACS_INT sequence_number; |
| 106 | 98 | ||
| 107 | /* Used by the function window_scroll_pixel_based. */ | 99 | /* Used by the function window_scroll_pixel_based. */ |
| 108 | static int window_scroll_pixel_based_preserve_x; | 100 | static int window_scroll_pixel_based_preserve_x; |
| @@ -216,7 +208,7 @@ wset_combination (struct window *w, bool horflag, Lisp_Object val) | |||
| 216 | w->horizontal = horflag; | 208 | w->horizontal = horflag; |
| 217 | } | 209 | } |
| 218 | 210 | ||
| 219 | /* Nonzero if leaf window W doesn't reflect the actual state | 211 | /* True if leaf window W doesn't reflect the actual state |
| 220 | of displayed buffer due to its text or overlays change. */ | 212 | of displayed buffer due to its text or overlays change. */ |
| 221 | 213 | ||
| 222 | bool | 214 | bool |
| @@ -279,7 +271,7 @@ adjust_window_count (struct window *w, int arg) | |||
| 279 | b->window_count += arg; | 271 | b->window_count += arg; |
| 280 | eassert (b->window_count >= 0); | 272 | eassert (b->window_count >= 0); |
| 281 | /* These should be recalculated by redisplay code. */ | 273 | /* These should be recalculated by redisplay code. */ |
| 282 | w->window_end_valid = 0; | 274 | w->window_end_valid = false; |
| 283 | w->base_line_pos = 0; | 275 | w->base_line_pos = 0; |
| 284 | } | 276 | } |
| 285 | } | 277 | } |
| @@ -460,17 +452,18 @@ selected windows appears and to which many commands apply. */) | |||
| 460 | return selected_window; | 452 | return selected_window; |
| 461 | } | 453 | } |
| 462 | 454 | ||
| 463 | int window_select_count; | 455 | EMACS_INT window_select_count; |
| 464 | 456 | ||
| 465 | /* If select_window is called with inhibit_point_swap non-zero it will | 457 | /* If select_window is called with inhibit_point_swap true it will |
| 466 | not store point of the old selected window's buffer back into that | 458 | not store point of the old selected window's buffer back into that |
| 467 | window's pointm slot. This is needed by Fset_window_configuration to | 459 | window's pointm slot. This is needed by Fset_window_configuration to |
| 468 | avoid that the display routine is called with selected_window set to | 460 | avoid that the display routine is called with selected_window set to |
| 469 | Qnil causing a subsequent crash. */ | 461 | Qnil causing a subsequent crash. */ |
| 470 | static Lisp_Object | 462 | static Lisp_Object |
| 471 | select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | 463 | select_window (Lisp_Object window, Lisp_Object norecord, |
| 464 | bool inhibit_point_swap) | ||
| 472 | { | 465 | { |
| 473 | register struct window *w; | 466 | struct window *w; |
| 474 | struct frame *sf; | 467 | struct frame *sf; |
| 475 | 468 | ||
| 476 | CHECK_LIVE_WINDOW (window); | 469 | CHECK_LIVE_WINDOW (window); |
| @@ -577,9 +570,9 @@ time a window gets selected put it on `buffer-list-update-hook'. | |||
| 577 | 570 | ||
| 578 | Also note that the main editor command loop sets the current buffer to | 571 | Also note that the main editor command loop sets the current buffer to |
| 579 | the buffer of the selected window before each command. */) | 572 | the buffer of the selected window before each command. */) |
| 580 | (register Lisp_Object window, Lisp_Object norecord) | 573 | (Lisp_Object window, Lisp_Object norecord) |
| 581 | { | 574 | { |
| 582 | return select_window (window, norecord, 0); | 575 | return select_window (window, norecord, false); |
| 583 | } | 576 | } |
| 584 | 577 | ||
| 585 | DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, | 578 | DEFUN ("window-buffer", Fwindow_buffer, Swindow_buffer, 0, 1, 0, |
| @@ -930,11 +923,10 @@ window_body_width (struct window *w, bool pixelwise) | |||
| 930 | - WINDOW_RIGHT_DIVIDER_WIDTH (w) | 923 | - WINDOW_RIGHT_DIVIDER_WIDTH (w) |
| 931 | - (WINDOW_HAS_VERTICAL_SCROLL_BAR (w) | 924 | - (WINDOW_HAS_VERTICAL_SCROLL_BAR (w) |
| 932 | ? WINDOW_SCROLL_BAR_AREA_WIDTH (w) | 925 | ? WINDOW_SCROLL_BAR_AREA_WIDTH (w) |
| 933 | : ((!FRAME_WINDOW_P (f) | 926 | : (/* A vertical bar is either 1 or 0. */ |
| 934 | && !WINDOW_RIGHTMOST_P (w) | 927 | !FRAME_WINDOW_P (f) |
| 935 | && !WINDOW_RIGHT_DIVIDER_WIDTH (w)) | 928 | && !WINDOW_RIGHTMOST_P (w) |
| 936 | /* A vertical bar is either 1 or 0. */ | 929 | && !WINDOW_RIGHT_DIVIDER_WIDTH (w))) |
| 937 | ? 1 : 0)) | ||
| 938 | - WINDOW_MARGINS_WIDTH (w) | 930 | - WINDOW_MARGINS_WIDTH (w) |
| 939 | - (FRAME_WINDOW_P (f) | 931 | - (FRAME_WINDOW_P (f) |
| 940 | ? WINDOW_FRINGES_WIDTH (w) | 932 | ? WINDOW_FRINGES_WIDTH (w) |
| @@ -961,7 +953,7 @@ visible, that line is not counted. */) | |||
| 961 | (Lisp_Object window, Lisp_Object pixelwise) | 953 | (Lisp_Object window, Lisp_Object pixelwise) |
| 962 | { | 954 | { |
| 963 | return make_number (window_body_height (decode_live_window (window), | 955 | return make_number (window_body_height (decode_live_window (window), |
| 964 | NILP (pixelwise) ? 0 : 1)); | 956 | !NILP (pixelwise))); |
| 965 | } | 957 | } |
| 966 | 958 | ||
| 967 | DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 2, 0, | 959 | DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 2, 0, |
| @@ -981,7 +973,7 @@ continuation glyph. */) | |||
| 981 | (Lisp_Object window, Lisp_Object pixelwise) | 973 | (Lisp_Object window, Lisp_Object pixelwise) |
| 982 | { | 974 | { |
| 983 | return make_number (window_body_width (decode_live_window (window), | 975 | return make_number (window_body_width (decode_live_window (window), |
| 984 | NILP (pixelwise) ? 0 : 1)); | 976 | !NILP (pixelwise))); |
| 985 | } | 977 | } |
| 986 | 978 | ||
| 987 | DEFUN ("window-mode-line-height", Fwindow_mode_line_height, | 979 | DEFUN ("window-mode-line-height", Fwindow_mode_line_height, |
| @@ -1062,10 +1054,10 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll) | |||
| 1062 | 1054 | ||
| 1063 | /* Prevent redisplay shortcuts when changing the hscroll. */ | 1055 | /* Prevent redisplay shortcuts when changing the hscroll. */ |
| 1064 | if (w->hscroll != new_hscroll) | 1056 | if (w->hscroll != new_hscroll) |
| 1065 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; | 1057 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = true; |
| 1066 | 1058 | ||
| 1067 | w->hscroll = new_hscroll; | 1059 | w->hscroll = new_hscroll; |
| 1068 | w->suspend_auto_hscroll = 1; | 1060 | w->suspend_auto_hscroll = true; |
| 1069 | 1061 | ||
| 1070 | return make_number (new_hscroll); | 1062 | return make_number (new_hscroll); |
| 1071 | } | 1063 | } |
| @@ -1583,7 +1575,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ | |||
| 1583 | Check if window W contains coordinates *CW->x and *CW->y. If it | 1575 | Check if window W contains coordinates *CW->x and *CW->y. If it |
| 1584 | does, return W in *CW->window, as Lisp_Object, and return in | 1576 | does, return W in *CW->window, as Lisp_Object, and return in |
| 1585 | *CW->part the part of the window under coordinates *X,*Y. Return | 1577 | *CW->part the part of the window under coordinates *X,*Y. Return |
| 1586 | zero from this function to stop iterating over windows. */ | 1578 | false from this function to stop iterating over windows. */ |
| 1587 | 1579 | ||
| 1588 | struct check_window_data | 1580 | struct check_window_data |
| 1589 | { | 1581 | { |
| @@ -1592,22 +1584,19 @@ struct check_window_data | |||
| 1592 | enum window_part *part; | 1584 | enum window_part *part; |
| 1593 | }; | 1585 | }; |
| 1594 | 1586 | ||
| 1595 | static int | 1587 | static bool |
| 1596 | check_window_containing (struct window *w, void *user_data) | 1588 | check_window_containing (struct window *w, void *user_data) |
| 1597 | { | 1589 | { |
| 1598 | struct check_window_data *cw = user_data; | 1590 | struct check_window_data *cw = user_data; |
| 1599 | enum window_part found; | 1591 | enum window_part found = coordinates_in_window (w, cw->x, cw->y); |
| 1600 | int continue_p = 1; | 1592 | if (found == ON_NOTHING) |
| 1601 | 1593 | return true; | |
| 1602 | found = coordinates_in_window (w, cw->x, cw->y); | 1594 | else |
| 1603 | if (found != ON_NOTHING) | ||
| 1604 | { | 1595 | { |
| 1605 | *cw->part = found; | 1596 | *cw->part = found; |
| 1606 | XSETWINDOW (*cw->window, w); | 1597 | XSETWINDOW (*cw->window, w); |
| 1607 | continue_p = 0; | 1598 | return false; |
| 1608 | } | 1599 | } |
| 1609 | |||
| 1610 | return continue_p; | ||
| 1611 | } | 1600 | } |
| 1612 | 1601 | ||
| 1613 | 1602 | ||
| @@ -1618,7 +1607,7 @@ check_window_containing (struct window *w, void *user_data) | |||
| 1618 | set *PART to the id of that element. | 1607 | set *PART to the id of that element. |
| 1619 | 1608 | ||
| 1620 | If there is no window under X, Y return nil and leave *PART | 1609 | If there is no window under X, Y return nil and leave *PART |
| 1621 | unmodified. TOOL_BAR_P non-zero means detect tool-bar windows. | 1610 | unmodified. TOOL_BAR_P means detect tool-bar windows. |
| 1622 | 1611 | ||
| 1623 | This function was previously implemented with a loop cycling over | 1612 | This function was previously implemented with a loop cycling over |
| 1624 | windows with Fnext_window, and starting with the frame's selected | 1613 | windows with Fnext_window, and starting with the frame's selected |
| @@ -1680,7 +1669,7 @@ column 0. */) | |||
| 1680 | + FRAME_INTERNAL_BORDER_WIDTH (f)), | 1669 | + FRAME_INTERNAL_BORDER_WIDTH (f)), |
| 1681 | (FRAME_PIXEL_Y_FROM_CANON_Y (f, y) | 1670 | (FRAME_PIXEL_Y_FROM_CANON_Y (f, y) |
| 1682 | + FRAME_INTERNAL_BORDER_WIDTH (f)), | 1671 | + FRAME_INTERNAL_BORDER_WIDTH (f)), |
| 1683 | 0, 0); | 1672 | 0, false); |
| 1684 | } | 1673 | } |
| 1685 | 1674 | ||
| 1686 | DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, | 1675 | DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, |
| @@ -1787,7 +1776,7 @@ if it isn't already recorded. */) | |||
| 1787 | if (it.current_y < it.last_visible_y) | 1776 | if (it.current_y < it.last_visible_y) |
| 1788 | move_it_past_eol (&it); | 1777 | move_it_past_eol (&it); |
| 1789 | value = make_number (IT_CHARPOS (it)); | 1778 | value = make_number (IT_CHARPOS (it)); |
| 1790 | bidi_unshelve_cache (itdata, 0); | 1779 | bidi_unshelve_cache (itdata, false); |
| 1791 | 1780 | ||
| 1792 | if (old_buffer) | 1781 | if (old_buffer) |
| 1793 | set_buffer_internal (old_buffer); | 1782 | set_buffer_internal (old_buffer); |
| @@ -1845,12 +1834,12 @@ overriding motion of point in order to display at this exact start. */) | |||
| 1845 | 1834 | ||
| 1846 | set_marker_restricted (w->start, pos, w->contents); | 1835 | set_marker_restricted (w->start, pos, w->contents); |
| 1847 | /* This is not right, but much easier than doing what is right. */ | 1836 | /* This is not right, but much easier than doing what is right. */ |
| 1848 | w->start_at_line_beg = 0; | 1837 | w->start_at_line_beg = false; |
| 1849 | if (NILP (noforce)) | 1838 | if (NILP (noforce)) |
| 1850 | w->force_start = 1; | 1839 | w->force_start = true; |
| 1851 | w->update_mode_line = 1; | 1840 | w->update_mode_line = true; |
| 1852 | /* Bug#15957. */ | 1841 | /* Bug#15957. */ |
| 1853 | w->window_end_valid = 0; | 1842 | w->window_end_valid = false; |
| 1854 | wset_redisplay (w); | 1843 | wset_redisplay (w); |
| 1855 | 1844 | ||
| 1856 | return pos; | 1845 | return pos; |
| @@ -1878,12 +1867,13 @@ POS, ROWH is the visible height of that row, and VPOS is the row number | |||
| 1878 | \(zero-based). */) | 1867 | \(zero-based). */) |
| 1879 | (Lisp_Object pos, Lisp_Object window, Lisp_Object partially) | 1868 | (Lisp_Object pos, Lisp_Object window, Lisp_Object partially) |
| 1880 | { | 1869 | { |
| 1881 | register struct window *w; | 1870 | struct window *w; |
| 1882 | register EMACS_INT posint; | 1871 | EMACS_INT posint; |
| 1883 | register struct buffer *buf; | 1872 | struct buffer *buf; |
| 1884 | struct text_pos top; | 1873 | struct text_pos top; |
| 1885 | Lisp_Object in_window = Qnil; | 1874 | Lisp_Object in_window = Qnil; |
| 1886 | int rtop, rbot, rowh, vpos, fully_p = 1; | 1875 | int rtop, rbot, rowh, vpos; |
| 1876 | bool fully_p = true; | ||
| 1887 | int x, y; | 1877 | int x, y; |
| 1888 | 1878 | ||
| 1889 | w = decode_live_window (window); | 1879 | w = decode_live_window (window); |
| @@ -1908,9 +1898,12 @@ POS, ROWH is the visible height of that row, and VPOS is the row number | |||
| 1908 | || (posint >= CHARPOS (top) && posint <= BUF_ZV (buf))) | 1898 | || (posint >= CHARPOS (top) && posint <= BUF_ZV (buf))) |
| 1909 | && CHARPOS (top) >= BUF_BEGV (buf) | 1899 | && CHARPOS (top) >= BUF_BEGV (buf) |
| 1910 | && CHARPOS (top) <= BUF_ZV (buf) | 1900 | && CHARPOS (top) <= BUF_ZV (buf) |
| 1911 | && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos) | 1901 | && pos_visible_p (w, posint, &x, &y, &rtop, &rbot, &rowh, &vpos)) |
| 1912 | && (fully_p = !rtop && !rbot, (!NILP (partially) || fully_p))) | 1902 | { |
| 1913 | in_window = Qt; | 1903 | fully_p = !rtop && !rbot; |
| 1904 | if (!NILP (partially) || fully_p) | ||
| 1905 | in_window = Qt; | ||
| 1906 | } | ||
| 1914 | 1907 | ||
| 1915 | if (!NILP (in_window) && !NILP (partially)) | 1908 | if (!NILP (in_window) && !NILP (partially)) |
| 1916 | { | 1909 | { |
| @@ -2215,7 +2208,7 @@ unshow_buffer (register struct window *w) | |||
| 2215 | 2208 | ||
| 2216 | eassert (b == XMARKER (w->pointm)->buffer); | 2209 | eassert (b == XMARKER (w->pointm)->buffer); |
| 2217 | 2210 | ||
| 2218 | #if 0 | 2211 | #if false |
| 2219 | if (w == XWINDOW (selected_window) | 2212 | if (w == XWINDOW (selected_window) |
| 2220 | || ! EQ (buf, XWINDOW (selected_window)->contents)) | 2213 | || ! EQ (buf, XWINDOW (selected_window)->contents)) |
| 2221 | /* Do this except when the selected window's buffer | 2214 | /* Do this except when the selected window's buffer |
| @@ -2254,14 +2247,14 @@ unshow_buffer (register struct window *w) | |||
| 2254 | bset_last_selected_window (b, Qnil); | 2247 | bset_last_selected_window (b, Qnil); |
| 2255 | } | 2248 | } |
| 2256 | 2249 | ||
| 2257 | /* Put NEW into the window structure in place of OLD. SETFLAG zero | 2250 | /* Put NEW into the window structure in place of OLD. SETFLAG false |
| 2258 | means change window structure only. Otherwise store geometry and | 2251 | means change window structure only. Otherwise store geometry and |
| 2259 | other settings as well. */ | 2252 | other settings as well. */ |
| 2260 | static void | 2253 | static void |
| 2261 | replace_window (Lisp_Object old, Lisp_Object new, int setflag) | 2254 | replace_window (Lisp_Object old, Lisp_Object new, bool setflag) |
| 2262 | { | 2255 | { |
| 2263 | register Lisp_Object tem; | 2256 | Lisp_Object tem; |
| 2264 | register struct window *o = XWINDOW (old), *n = XWINDOW (new); | 2257 | struct window *o = XWINDOW (old), *n = XWINDOW (new); |
| 2265 | 2258 | ||
| 2266 | /* If OLD is its frame's root window, then NEW is the new | 2259 | /* If OLD is its frame's root window, then NEW is the new |
| 2267 | root window for that frame. */ | 2260 | root window for that frame. */ |
| @@ -2291,11 +2284,11 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) | |||
| 2291 | n->phys_cursor_type = NO_CURSOR; | 2284 | n->phys_cursor_type = NO_CURSOR; |
| 2292 | n->phys_cursor_width = -1; | 2285 | n->phys_cursor_width = -1; |
| 2293 | #endif | 2286 | #endif |
| 2294 | n->must_be_updated_p = 0; | 2287 | n->must_be_updated_p = false; |
| 2295 | n->pseudo_window_p = 0; | 2288 | n->pseudo_window_p = false; |
| 2296 | n->window_end_vpos = 0; | 2289 | n->window_end_vpos = 0; |
| 2297 | n->window_end_pos = 0; | 2290 | n->window_end_pos = 0; |
| 2298 | n->window_end_valid = 0; | 2291 | n->window_end_valid = false; |
| 2299 | } | 2292 | } |
| 2300 | 2293 | ||
| 2301 | tem = o->next; | 2294 | tem = o->next; |
| @@ -2380,7 +2373,7 @@ recombine_windows (Lisp_Object window) | |||
| 2380 | } | 2373 | } |
| 2381 | 2374 | ||
| 2382 | /* WINDOW can be deleted now. */ | 2375 | /* WINDOW can be deleted now. */ |
| 2383 | wset_combination (w, 0, Qnil); | 2376 | wset_combination (w, false, Qnil); |
| 2384 | } | 2377 | } |
| 2385 | } | 2378 | } |
| 2386 | } | 2379 | } |
| @@ -2401,14 +2394,14 @@ delete_deletable_window (Lisp_Object window) | |||
| 2401 | pointer. This is a callback function for foreach_window, used in | 2394 | pointer. This is a callback function for foreach_window, used in |
| 2402 | the window_list function. */ | 2395 | the window_list function. */ |
| 2403 | 2396 | ||
| 2404 | static int | 2397 | static bool |
| 2405 | add_window_to_list (struct window *w, void *user_data) | 2398 | add_window_to_list (struct window *w, void *user_data) |
| 2406 | { | 2399 | { |
| 2407 | Lisp_Object *list = user_data; | 2400 | Lisp_Object *list = user_data; |
| 2408 | Lisp_Object window; | 2401 | Lisp_Object window; |
| 2409 | XSETWINDOW (window, w); | 2402 | XSETWINDOW (window, w); |
| 2410 | *list = Fcons (window, *list); | 2403 | *list = Fcons (window, *list); |
| 2411 | return 1; | 2404 | return true; |
| 2412 | } | 2405 | } |
| 2413 | 2406 | ||
| 2414 | 2407 | ||
| @@ -2441,7 +2434,7 @@ window_list (void) | |||
| 2441 | } | 2434 | } |
| 2442 | 2435 | ||
| 2443 | 2436 | ||
| 2444 | /* Value is non-zero if WINDOW satisfies the constraints given by | 2437 | /* Value is true if WINDOW satisfies the constraints given by |
| 2445 | OWINDOW, MINIBUF and ALL_FRAMES. | 2438 | OWINDOW, MINIBUF and ALL_FRAMES. |
| 2446 | 2439 | ||
| 2447 | MINIBUF t means WINDOW may be minibuffer windows. | 2440 | MINIBUF t means WINDOW may be minibuffer windows. |
| @@ -2463,20 +2456,20 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, | |||
| 2463 | { | 2456 | { |
| 2464 | struct window *w = XWINDOW (window); | 2457 | struct window *w = XWINDOW (window); |
| 2465 | struct frame *f = XFRAME (w->frame); | 2458 | struct frame *f = XFRAME (w->frame); |
| 2466 | bool candidate_p = 1; | 2459 | bool candidate_p = true; |
| 2467 | 2460 | ||
| 2468 | if (!BUFFERP (w->contents)) | 2461 | if (!BUFFERP (w->contents)) |
| 2469 | candidate_p = 0; | 2462 | candidate_p = false; |
| 2470 | else if (MINI_WINDOW_P (w) | 2463 | else if (MINI_WINDOW_P (w) |
| 2471 | && (EQ (minibuf, Qlambda) | 2464 | && (EQ (minibuf, Qlambda) |
| 2472 | || (WINDOWP (minibuf) && !EQ (minibuf, window)))) | 2465 | || (WINDOWP (minibuf) && !EQ (minibuf, window)))) |
| 2473 | { | 2466 | { |
| 2474 | /* If MINIBUF is `lambda' don't consider any mini-windows. | 2467 | /* If MINIBUF is `lambda' don't consider any mini-windows. |
| 2475 | If it is a window, consider only that one. */ | 2468 | If it is a window, consider only that one. */ |
| 2476 | candidate_p = 0; | 2469 | candidate_p = false; |
| 2477 | } | 2470 | } |
| 2478 | else if (EQ (all_frames, Qt)) | 2471 | else if (EQ (all_frames, Qt)) |
| 2479 | candidate_p = 1; | 2472 | candidate_p = true; |
| 2480 | else if (NILP (all_frames)) | 2473 | else if (NILP (all_frames)) |
| 2481 | { | 2474 | { |
| 2482 | eassert (WINDOWP (owindow)); | 2475 | eassert (WINDOWP (owindow)); |
| @@ -2556,12 +2549,13 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object | |||
| 2556 | 2549 | ||
| 2557 | 2550 | ||
| 2558 | /* Return the next or previous window of WINDOW in cyclic ordering | 2551 | /* Return the next or previous window of WINDOW in cyclic ordering |
| 2559 | of windows. NEXT_P non-zero means return the next window. See the | 2552 | of windows. NEXT_P means return the next window. See the |
| 2560 | documentation string of next-window for the meaning of MINIBUF and | 2553 | documentation string of next-window for the meaning of MINIBUF and |
| 2561 | ALL_FRAMES. */ | 2554 | ALL_FRAMES. */ |
| 2562 | 2555 | ||
| 2563 | static Lisp_Object | 2556 | static Lisp_Object |
| 2564 | next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, int next_p) | 2557 | next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, |
| 2558 | bool next_p) | ||
| 2565 | { | 2559 | { |
| 2566 | decode_next_window_args (&window, &minibuf, &all_frames); | 2560 | decode_next_window_args (&window, &minibuf, &all_frames); |
| 2567 | 2561 | ||
| @@ -2659,7 +2653,7 @@ windows, eventually ending up back at the window you started with. | |||
| 2659 | `previous-window' traverses the same cycle, in the reverse order. */) | 2653 | `previous-window' traverses the same cycle, in the reverse order. */) |
| 2660 | (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) | 2654 | (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) |
| 2661 | { | 2655 | { |
| 2662 | return next_window (window, minibuf, all_frames, 1); | 2656 | return next_window (window, minibuf, all_frames, true); |
| 2663 | } | 2657 | } |
| 2664 | 2658 | ||
| 2665 | 2659 | ||
| @@ -2699,7 +2693,7 @@ started with. `next-window' traverses the same cycle, in the | |||
| 2699 | reverse order. */) | 2693 | reverse order. */) |
| 2700 | (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) | 2694 | (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames) |
| 2701 | { | 2695 | { |
| 2702 | return next_window (window, minibuf, all_frames, 0); | 2696 | return next_window (window, minibuf, all_frames, false); |
| 2703 | } | 2697 | } |
| 2704 | 2698 | ||
| 2705 | 2699 | ||
| @@ -2797,7 +2791,7 @@ be listed first but no error is signaled. */) | |||
| 2797 | Qnil, look at just the selected frame; | 2791 | Qnil, look at just the selected frame; |
| 2798 | Qvisible, look at visible frames; | 2792 | Qvisible, look at visible frames; |
| 2799 | a frame, just look at windows on that frame. | 2793 | a frame, just look at windows on that frame. |
| 2800 | If MINI is non-zero, perform the operation on minibuffer windows too. */ | 2794 | If MINI, perform the operation on minibuffer windows too. */ |
| 2801 | 2795 | ||
| 2802 | enum window_loop | 2796 | enum window_loop |
| 2803 | { | 2797 | { |
| @@ -2809,10 +2803,11 @@ enum window_loop | |||
| 2809 | }; | 2803 | }; |
| 2810 | 2804 | ||
| 2811 | static Lisp_Object | 2805 | static Lisp_Object |
| 2812 | window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frames) | 2806 | window_loop (enum window_loop type, Lisp_Object obj, bool mini, |
| 2807 | Lisp_Object frames) | ||
| 2813 | { | 2808 | { |
| 2814 | Lisp_Object window, windows, best_window, frame_arg; | 2809 | Lisp_Object window, windows, best_window, frame_arg; |
| 2815 | int frame_best_window_flag = 0; | 2810 | bool frame_best_window_flag = false; |
| 2816 | struct frame *f; | 2811 | struct frame *f; |
| 2817 | struct gcpro gcpro1; | 2812 | struct gcpro gcpro1; |
| 2818 | 2813 | ||
| @@ -2872,7 +2867,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2872 | if (EQ (w->contents, obj) | 2867 | if (EQ (w->contents, obj) |
| 2873 | /* Don't find any minibuffer window except the one that | 2868 | /* Don't find any minibuffer window except the one that |
| 2874 | is currently in use. */ | 2869 | is currently in use. */ |
| 2875 | && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) | 2870 | && (!MINI_WINDOW_P (w) || EQ (window, minibuf_window))) |
| 2876 | { | 2871 | { |
| 2877 | if (EQ (window, selected_window)) | 2872 | if (EQ (window, selected_window)) |
| 2878 | /* Preferably return the selected window. */ | 2873 | /* Preferably return the selected window. */ |
| @@ -2883,7 +2878,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2883 | choose another one if we have one already). */ | 2878 | choose another one if we have one already). */ |
| 2884 | { | 2879 | { |
| 2885 | best_window = window; | 2880 | best_window = window; |
| 2886 | frame_best_window_flag = 1; | 2881 | frame_best_window_flag = true; |
| 2887 | } | 2882 | } |
| 2888 | else if (NILP (best_window)) | 2883 | else if (NILP (best_window)) |
| 2889 | best_window = window; | 2884 | best_window = window; |
| @@ -2900,7 +2895,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2900 | /* Make WINDOW show the buffer returned by | 2895 | /* Make WINDOW show the buffer returned by |
| 2901 | other_buffer_safely, don't run any hooks. */ | 2896 | other_buffer_safely, don't run any hooks. */ |
| 2902 | set_window_buffer | 2897 | set_window_buffer |
| 2903 | (window, other_buffer_safely (w->contents), 0, 0); | 2898 | (window, other_buffer_safely (w->contents), false, false); |
| 2904 | /* If WINDOW is the selected window, make its buffer | 2899 | /* If WINDOW is the selected window, make its buffer |
| 2905 | current. But do so only if the window shows the | 2900 | current. But do so only if the window shows the |
| 2906 | current buffer (Bug#6454). */ | 2901 | current buffer (Bug#6454). */ |
| @@ -2913,9 +2908,9 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame | |||
| 2913 | case REDISPLAY_BUFFER_WINDOWS: | 2908 | case REDISPLAY_BUFFER_WINDOWS: |
| 2914 | if (EQ (w->contents, obj)) | 2909 | if (EQ (w->contents, obj)) |
| 2915 | { | 2910 | { |
| 2916 | mark_window_display_accurate (window, 0); | 2911 | mark_window_display_accurate (window, false); |
| 2917 | w->update_mode_line = 1; | 2912 | w->update_mode_line = true; |
| 2918 | XBUFFER (obj)->prevent_redisplay_optimizations_p = 1; | 2913 | XBUFFER (obj)->prevent_redisplay_optimizations_p = true; |
| 2919 | update_mode_lines = 27; | 2914 | update_mode_lines = 27; |
| 2920 | best_window = window; | 2915 | best_window = window; |
| 2921 | } | 2916 | } |
| @@ -2952,7 +2947,7 @@ extern void check_all_windows (void) EXTERNALLY_VISIBLE; | |||
| 2952 | void | 2947 | void |
| 2953 | check_all_windows (void) | 2948 | check_all_windows (void) |
| 2954 | { | 2949 | { |
| 2955 | window_loop (CHECK_ALL_WINDOWS, Qnil, 1, Qt); | 2950 | window_loop (CHECK_ALL_WINDOWS, Qnil, true, Qt); |
| 2956 | } | 2951 | } |
| 2957 | 2952 | ||
| 2958 | DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 0, 2, 0, | 2953 | DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 0, 2, 0, |
| @@ -2983,7 +2978,7 @@ selected frame and no others. */) | |||
| 2983 | buffer = Fget_buffer (buffer_or_name); | 2978 | buffer = Fget_buffer (buffer_or_name); |
| 2984 | 2979 | ||
| 2985 | if (BUFFERP (buffer)) | 2980 | if (BUFFERP (buffer)) |
| 2986 | return window_loop (GET_BUFFER_WINDOW, buffer, 1, all_frames); | 2981 | return window_loop (GET_BUFFER_WINDOW, buffer, true, all_frames); |
| 2987 | else | 2982 | else |
| 2988 | return Qnil; | 2983 | return Qnil; |
| 2989 | } | 2984 | } |
| @@ -3040,7 +3035,7 @@ window-start value is reasonable when this function is called. */) | |||
| 3040 | struct frame *f; | 3035 | struct frame *f; |
| 3041 | Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; | 3036 | Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; |
| 3042 | ptrdiff_t startpos IF_LINT (= 0), startbyte IF_LINT (= 0); | 3037 | ptrdiff_t startpos IF_LINT (= 0), startbyte IF_LINT (= 0); |
| 3043 | int top IF_LINT (= 0), new_top, resize_failed; | 3038 | int top IF_LINT (= 0), new_top; |
| 3044 | 3039 | ||
| 3045 | w = decode_valid_window (window); | 3040 | w = decode_valid_window (window); |
| 3046 | XSETWINDOW (window, w); | 3041 | XSETWINDOW (window, w); |
| @@ -3097,7 +3092,7 @@ window-start value is reasonable when this function is called. */) | |||
| 3097 | parents and comparing each one with WINDOW. If it isn't we | 3092 | parents and comparing each one with WINDOW. If it isn't we |
| 3098 | need a new selected window for this frame. */ | 3093 | need a new selected window for this frame. */ |
| 3099 | swindow = FRAME_SELECTED_WINDOW (f); | 3094 | swindow = FRAME_SELECTED_WINDOW (f); |
| 3100 | while (1) | 3095 | while (true) |
| 3101 | { | 3096 | { |
| 3102 | pwindow = swindow; | 3097 | pwindow = swindow; |
| 3103 | while (!NILP (pwindow) && !EQ (window, pwindow)) | 3098 | while (!NILP (pwindow) && !EQ (window, pwindow)) |
| @@ -3129,7 +3124,7 @@ window-start value is reasonable when this function is called. */) | |||
| 3129 | /* We are going to free the glyph matrices of WINDOW, and with | 3124 | /* We are going to free the glyph matrices of WINDOW, and with |
| 3130 | that we might lose any information about glyph rows that have | 3125 | that we might lose any information about glyph rows that have |
| 3131 | some of their glyphs highlighted in mouse face. (These rows | 3126 | some of their glyphs highlighted in mouse face. (These rows |
| 3132 | are marked with a non-zero mouse_face_p flag.) If WINDOW | 3127 | are marked with a mouse_face_p flag.) If WINDOW |
| 3133 | indeed has some glyphs highlighted in mouse face, signal to | 3128 | indeed has some glyphs highlighted in mouse face, signal to |
| 3134 | frame's up-to-date hook that mouse highlight was overwritten, | 3129 | frame's up-to-date hook that mouse highlight was overwritten, |
| 3135 | so that it will arrange for redisplaying the highlight. */ | 3130 | so that it will arrange for redisplaying the highlight. */ |
| @@ -3140,8 +3135,8 @@ window-start value is reasonable when this function is called. */) | |||
| 3140 | 3135 | ||
| 3141 | fset_redisplay (f); | 3136 | fset_redisplay (f); |
| 3142 | Vwindow_list = Qnil; | 3137 | Vwindow_list = Qnil; |
| 3143 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 3138 | FRAME_WINDOW_SIZES_CHANGED (f) = true; |
| 3144 | resize_failed = 0; | 3139 | bool resize_failed = false; |
| 3145 | 3140 | ||
| 3146 | if (!WINDOW_LEAF_P (w)) | 3141 | if (!WINDOW_LEAF_P (w)) |
| 3147 | { | 3142 | { |
| @@ -3150,21 +3145,21 @@ window-start value is reasonable when this function is called. */) | |||
| 3150 | w->pixel_top = r->pixel_top; | 3145 | w->pixel_top = r->pixel_top; |
| 3151 | w->top_line = r->top_line; | 3146 | w->top_line = r->top_line; |
| 3152 | resize_root_window (window, delta, Qnil, Qnil, Qt); | 3147 | resize_root_window (window, delta, Qnil, Qnil, Qt); |
| 3153 | if (window_resize_check (w, 0)) | 3148 | if (window_resize_check (w, false)) |
| 3154 | { | 3149 | { |
| 3155 | window_resize_apply (w, 0); | 3150 | window_resize_apply (w, false); |
| 3156 | window_pixel_to_total (w->frame, Qnil); | 3151 | window_pixel_to_total (w->frame, Qnil); |
| 3157 | } | 3152 | } |
| 3158 | else | 3153 | else |
| 3159 | { | 3154 | { |
| 3160 | resize_root_window (window, delta, Qnil, Qt, Qt); | 3155 | resize_root_window (window, delta, Qnil, Qt, Qt); |
| 3161 | if (window_resize_check (w, 0)) | 3156 | if (window_resize_check (w, false)) |
| 3162 | { | 3157 | { |
| 3163 | window_resize_apply (w, 0); | 3158 | window_resize_apply (w, false); |
| 3164 | window_pixel_to_total (w->frame, Qnil); | 3159 | window_pixel_to_total (w->frame, Qnil); |
| 3165 | } | 3160 | } |
| 3166 | else | 3161 | else |
| 3167 | resize_failed = 1; | 3162 | resize_failed = true; |
| 3168 | } | 3163 | } |
| 3169 | 3164 | ||
| 3170 | /* Resize child windows horizontally. */ | 3165 | /* Resize child windows horizontally. */ |
| @@ -3174,21 +3169,21 @@ window-start value is reasonable when this function is called. */) | |||
| 3174 | w->pixel_left = r->pixel_left; | 3169 | w->pixel_left = r->pixel_left; |
| 3175 | XSETINT (delta, r->pixel_width - w->pixel_width); | 3170 | XSETINT (delta, r->pixel_width - w->pixel_width); |
| 3176 | resize_root_window (window, delta, Qt, Qnil, Qt); | 3171 | resize_root_window (window, delta, Qt, Qnil, Qt); |
| 3177 | if (window_resize_check (w, 1)) | 3172 | if (window_resize_check (w, true)) |
| 3178 | { | 3173 | { |
| 3179 | window_resize_apply (w, 1); | 3174 | window_resize_apply (w, true); |
| 3180 | window_pixel_to_total (w->frame, Qt); | 3175 | window_pixel_to_total (w->frame, Qt); |
| 3181 | } | 3176 | } |
| 3182 | else | 3177 | else |
| 3183 | { | 3178 | { |
| 3184 | resize_root_window (window, delta, Qt, Qt, Qt); | 3179 | resize_root_window (window, delta, Qt, Qt, Qt); |
| 3185 | if (window_resize_check (w, 1)) | 3180 | if (window_resize_check (w, true)) |
| 3186 | { | 3181 | { |
| 3187 | window_resize_apply (w, 1); | 3182 | window_resize_apply (w, true); |
| 3188 | window_pixel_to_total (w->frame, Qt); | 3183 | window_pixel_to_total (w->frame, Qt); |
| 3189 | } | 3184 | } |
| 3190 | else | 3185 | else |
| 3191 | resize_failed = 1; | 3186 | resize_failed = true; |
| 3192 | } | 3187 | } |
| 3193 | } | 3188 | } |
| 3194 | 3189 | ||
| @@ -3224,10 +3219,10 @@ window-start value is reasonable when this function is called. */) | |||
| 3224 | if (WINDOWP (r->contents)) | 3219 | if (WINDOWP (r->contents)) |
| 3225 | { | 3220 | { |
| 3226 | delete_all_child_windows (r->contents); | 3221 | delete_all_child_windows (r->contents); |
| 3227 | wset_combination (r, 0, Qnil); | 3222 | wset_combination (r, false, Qnil); |
| 3228 | } | 3223 | } |
| 3229 | 3224 | ||
| 3230 | replace_window (root, window, 1); | 3225 | replace_window (root, window, true); |
| 3231 | 3226 | ||
| 3232 | /* This must become SWINDOW anyway ....... */ | 3227 | /* This must become SWINDOW anyway ....... */ |
| 3233 | if (BUFFERP (w->contents) && !resize_failed) | 3228 | if (BUFFERP (w->contents) && !resize_failed) |
| @@ -3251,12 +3246,12 @@ window-start value is reasonable when this function is called. */) | |||
| 3251 | pos = *vmotion (startpos, startbyte, -top, w); | 3246 | pos = *vmotion (startpos, startbyte, -top, w); |
| 3252 | 3247 | ||
| 3253 | set_marker_both (w->start, w->contents, pos.bufpos, pos.bytepos); | 3248 | set_marker_both (w->start, w->contents, pos.bufpos, pos.bytepos); |
| 3254 | w->window_end_valid = 0; | 3249 | w->window_end_valid = false; |
| 3255 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE | 3250 | w->start_at_line_beg = (pos.bytepos == BEGV_BYTE |
| 3256 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); | 3251 | || FETCH_BYTE (pos.bytepos - 1) == '\n'); |
| 3257 | /* We need to do this, so that the window-scroll-functions | 3252 | /* We need to do this, so that the window-scroll-functions |
| 3258 | get called. */ | 3253 | get called. */ |
| 3259 | w->optional_new_start = 1; | 3254 | w->optional_new_start = true; |
| 3260 | 3255 | ||
| 3261 | set_buffer_internal (obuf); | 3256 | set_buffer_internal (obuf); |
| 3262 | } | 3257 | } |
| @@ -3291,7 +3286,7 @@ replace_buffer_in_windows_safely (Lisp_Object buffer) | |||
| 3291 | considers frames on the current keyboard. So loop manually over | 3286 | considers frames on the current keyboard. So loop manually over |
| 3292 | frames, and handle each one. */ | 3287 | frames, and handle each one. */ |
| 3293 | FOR_EACH_FRAME (tail, frame) | 3288 | FOR_EACH_FRAME (tail, frame) |
| 3294 | window_loop (REPLACE_BUFFER_IN_WINDOWS_SAFELY, buffer, 1, frame); | 3289 | window_loop (REPLACE_BUFFER_IN_WINDOWS_SAFELY, buffer, true, frame); |
| 3295 | } | 3290 | } |
| 3296 | } | 3291 | } |
| 3297 | 3292 | ||
| @@ -3391,9 +3386,9 @@ If WINDOW is omitted or nil, it defaults to the selected window. */) | |||
| 3391 | return Qnil; | 3386 | return Qnil; |
| 3392 | } | 3387 | } |
| 3393 | 3388 | ||
| 3394 | /* Make WINDOW display BUFFER. RUN_HOOKS_P non-zero means it's allowed | 3389 | /* Make WINDOW display BUFFER. RUN_HOOKS_P means it's allowed |
| 3395 | to run hooks. See make_frame for a case where it's not allowed. | 3390 | to run hooks. See make_frame for a case where it's not allowed. |
| 3396 | KEEP_MARGINS_P non-zero means that the current margins, fringes, and | 3391 | KEEP_MARGINS_P means that the current margins, fringes, and |
| 3397 | scroll-bar settings of the window are not reset from the buffer's | 3392 | scroll-bar settings of the window are not reset from the buffer's |
| 3398 | local settings. */ | 3393 | local settings. */ |
| 3399 | 3394 | ||
| @@ -3435,15 +3430,15 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, | |||
| 3435 | doc-view-mode since it resets the image's position whenever we | 3430 | doc-view-mode since it resets the image's position whenever we |
| 3436 | resize the frame. */ | 3431 | resize the frame. */ |
| 3437 | w->hscroll = w->min_hscroll = w->hscroll_whole = 0; | 3432 | w->hscroll = w->min_hscroll = w->hscroll_whole = 0; |
| 3438 | w->suspend_auto_hscroll = 0; | 3433 | w->suspend_auto_hscroll = false; |
| 3439 | w->vscroll = 0; | 3434 | w->vscroll = 0; |
| 3440 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); | 3435 | set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); |
| 3441 | set_marker_both (w->old_pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); | 3436 | set_marker_both (w->old_pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); |
| 3442 | set_marker_restricted (w->start, | 3437 | set_marker_restricted (w->start, |
| 3443 | make_number (b->last_window_start), | 3438 | make_number (b->last_window_start), |
| 3444 | buffer); | 3439 | buffer); |
| 3445 | w->start_at_line_beg = 0; | 3440 | w->start_at_line_beg = false; |
| 3446 | w->force_start = 0; | 3441 | w->force_start = false; |
| 3447 | } | 3442 | } |
| 3448 | /* Maybe we could move this into the `if' but it's not obviously safe and | 3443 | /* Maybe we could move this into the `if' but it's not obviously safe and |
| 3449 | I doubt it's worth the trouble. */ | 3444 | I doubt it's worth the trouble. */ |
| @@ -3534,7 +3529,7 @@ This function runs `window-scroll-functions' before running | |||
| 3534 | unshow_buffer (w); | 3529 | unshow_buffer (w); |
| 3535 | } | 3530 | } |
| 3536 | 3531 | ||
| 3537 | set_window_buffer (window, buffer, 1, !NILP (keep_margins)); | 3532 | set_window_buffer (window, buffer, true, !NILP (keep_margins)); |
| 3538 | 3533 | ||
| 3539 | return Qnil; | 3534 | return Qnil; |
| 3540 | } | 3535 | } |
| @@ -3563,10 +3558,10 @@ displaying that buffer. */) | |||
| 3563 | if (WINDOWP (object)) | 3558 | if (WINDOWP (object)) |
| 3564 | { | 3559 | { |
| 3565 | struct window *w = XWINDOW (object); | 3560 | struct window *w = XWINDOW (object); |
| 3566 | mark_window_display_accurate (object, 0); | 3561 | mark_window_display_accurate (object, false); |
| 3567 | w->update_mode_line = 1; | 3562 | w->update_mode_line = true; |
| 3568 | if (BUFFERP (w->contents)) | 3563 | if (BUFFERP (w->contents)) |
| 3569 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; | 3564 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = true; |
| 3570 | update_mode_lines = 29; | 3565 | update_mode_lines = 29; |
| 3571 | return Qt; | 3566 | return Qt; |
| 3572 | } | 3567 | } |
| @@ -3578,7 +3573,7 @@ displaying that buffer. */) | |||
| 3578 | { | 3573 | { |
| 3579 | /* If buffer is live and shown in at least one window, find | 3574 | /* If buffer is live and shown in at least one window, find |
| 3580 | all windows showing this buffer and force update of them. */ | 3575 | all windows showing this buffer and force update of them. */ |
| 3581 | object = window_loop (REDISPLAY_BUFFER_WINDOWS, object, 0, Qvisible); | 3576 | object = window_loop (REDISPLAY_BUFFER_WINDOWS, object, false, Qvisible); |
| 3582 | return NILP (object) ? Qnil : Qt; | 3577 | return NILP (object) ? Qnil : Qt; |
| 3583 | } | 3578 | } |
| 3584 | 3579 | ||
| @@ -3614,7 +3609,7 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3614 | Vminibuf_scroll_window = window; | 3609 | Vminibuf_scroll_window = window; |
| 3615 | w = XWINDOW (window); | 3610 | w = XWINDOW (window); |
| 3616 | w->hscroll = w->min_hscroll = w->hscroll_whole = 0; | 3611 | w->hscroll = w->min_hscroll = w->hscroll_whole = 0; |
| 3617 | w->suspend_auto_hscroll = 0; | 3612 | w->suspend_auto_hscroll = false; |
| 3618 | set_marker_restricted_both (w->start, buf, BEG, BEG); | 3613 | set_marker_restricted_both (w->start, buf, BEG, BEG); |
| 3619 | set_marker_restricted_both (w->pointm, buf, BEG, BEG); | 3614 | set_marker_restricted_both (w->pointm, buf, BEG, BEG); |
| 3620 | set_marker_restricted_both (w->old_pointm, buf, BEG, BEG); | 3615 | set_marker_restricted_both (w->old_pointm, buf, BEG, BEG); |
| @@ -3651,7 +3646,7 @@ allocate_window (void) | |||
| 3651 | } | 3646 | } |
| 3652 | 3647 | ||
| 3653 | /* Make new window, have it replace WINDOW in window-tree, and make | 3648 | /* Make new window, have it replace WINDOW in window-tree, and make |
| 3654 | WINDOW its only vertical child (HORFLAG 1 means make WINDOW its only | 3649 | WINDOW its only vertical child (HORFLAG means make WINDOW its only |
| 3655 | horizontal child). */ | 3650 | horizontal child). */ |
| 3656 | static void | 3651 | static void |
| 3657 | make_parent_window (Lisp_Object window, bool horflag) | 3652 | make_parent_window (Lisp_Object window, bool horflag) |
| @@ -3670,7 +3665,7 @@ make_parent_window (Lisp_Object window, bool horflag) | |||
| 3670 | 3665 | ||
| 3671 | p->sequence_number = ++sequence_number; | 3666 | p->sequence_number = ++sequence_number; |
| 3672 | 3667 | ||
| 3673 | replace_window (window, parent, 1); | 3668 | replace_window (window, parent, true); |
| 3674 | 3669 | ||
| 3675 | wset_next (o, Qnil); | 3670 | wset_next (o, Qnil); |
| 3676 | wset_prev (o, Qnil); | 3671 | wset_prev (o, Qnil); |
| @@ -3799,14 +3794,14 @@ Note: This function does not operate on any child windows of WINDOW. */) | |||
| 3799 | return size; | 3794 | return size; |
| 3800 | } | 3795 | } |
| 3801 | 3796 | ||
| 3802 | /* Return 1 if setting w->pixel_height (w->pixel_width if HORFLAG is | 3797 | /* Return true if setting w->pixel_height (w->pixel_width if HORFLAG) |
| 3803 | non-zero) to w->new_pixel would result in correct heights (widths) | 3798 | to w->new_pixel would result in correct heights (widths) |
| 3804 | for window W and recursively all child windows of W. | 3799 | for window W and recursively all child windows of W. |
| 3805 | 3800 | ||
| 3806 | Note: This function does not check any of `window-fixed-size-p', | 3801 | Note: This function does not check any of `window-fixed-size-p', |
| 3807 | `window-min-height' or `window-min-width'. It does check that window | 3802 | `window-min-height' or `window-min-width'. It does check that window |
| 3808 | sizes do not drop below one line (two columns). */ | 3803 | sizes do not drop below one line (two columns). */ |
| 3809 | static int | 3804 | static bool |
| 3810 | window_resize_check (struct window *w, bool horflag) | 3805 | window_resize_check (struct window *w, bool horflag) |
| 3811 | { | 3806 | { |
| 3812 | struct frame *f = XFRAME (w->frame); | 3807 | struct frame *f = XFRAME (w->frame); |
| @@ -3823,12 +3818,12 @@ window_resize_check (struct window *w, bool horflag) | |||
| 3823 | { | 3818 | { |
| 3824 | if (XINT (c->new_pixel) != XINT (w->new_pixel) | 3819 | if (XINT (c->new_pixel) != XINT (w->new_pixel) |
| 3825 | || !window_resize_check (c, horflag)) | 3820 | || !window_resize_check (c, horflag)) |
| 3826 | return 0; | 3821 | return false; |
| 3827 | 3822 | ||
| 3828 | c = NILP (c->next) ? 0 : XWINDOW (c->next); | 3823 | c = NILP (c->next) ? 0 : XWINDOW (c->next); |
| 3829 | } | 3824 | } |
| 3830 | 3825 | ||
| 3831 | return 1; | 3826 | return true; |
| 3832 | } | 3827 | } |
| 3833 | else | 3828 | else |
| 3834 | /* The sum of the heights of the child windows of W must equal | 3829 | /* The sum of the heights of the child windows of W must equal |
| @@ -3839,11 +3834,11 @@ window_resize_check (struct window *w, bool horflag) | |||
| 3839 | while (c) | 3834 | while (c) |
| 3840 | { | 3835 | { |
| 3841 | if (!window_resize_check (c, horflag)) | 3836 | if (!window_resize_check (c, horflag)) |
| 3842 | return 0; | 3837 | return false; |
| 3843 | 3838 | ||
| 3844 | remaining_pixels -= XINT (c->new_pixel); | 3839 | remaining_pixels -= XINT (c->new_pixel); |
| 3845 | if (remaining_pixels < 0) | 3840 | if (remaining_pixels < 0) |
| 3846 | return 0; | 3841 | return false; |
| 3847 | c = NILP (c->next) ? 0 : XWINDOW (c->next); | 3842 | c = NILP (c->next) ? 0 : XWINDOW (c->next); |
| 3848 | } | 3843 | } |
| 3849 | 3844 | ||
| @@ -3863,11 +3858,11 @@ window_resize_check (struct window *w, bool horflag) | |||
| 3863 | while (c) | 3858 | while (c) |
| 3864 | { | 3859 | { |
| 3865 | if (!window_resize_check (c, horflag)) | 3860 | if (!window_resize_check (c, horflag)) |
| 3866 | return 0; | 3861 | return false; |
| 3867 | 3862 | ||
| 3868 | remaining_pixels -= XINT (c->new_pixel); | 3863 | remaining_pixels -= XINT (c->new_pixel); |
| 3869 | if (remaining_pixels < 0) | 3864 | if (remaining_pixels < 0) |
| 3870 | return 0; | 3865 | return false; |
| 3871 | c = NILP (c->next) ? 0 : XWINDOW (c->next); | 3866 | c = NILP (c->next) ? 0 : XWINDOW (c->next); |
| 3872 | } | 3867 | } |
| 3873 | 3868 | ||
| @@ -3880,12 +3875,12 @@ window_resize_check (struct window *w, bool horflag) | |||
| 3880 | { | 3875 | { |
| 3881 | if (XINT (c->new_pixel) != XINT (w->new_pixel) | 3876 | if (XINT (c->new_pixel) != XINT (w->new_pixel) |
| 3882 | || !window_resize_check (c, horflag)) | 3877 | || !window_resize_check (c, horflag)) |
| 3883 | return 0; | 3878 | return false; |
| 3884 | 3879 | ||
| 3885 | c = NILP (c->next) ? 0 : XWINDOW (c->next); | 3880 | c = NILP (c->next) ? 0 : XWINDOW (c->next); |
| 3886 | } | 3881 | } |
| 3887 | 3882 | ||
| 3888 | return 1; | 3883 | return true; |
| 3889 | } | 3884 | } |
| 3890 | } | 3885 | } |
| 3891 | else | 3886 | else |
| @@ -3898,7 +3893,7 @@ window_resize_check (struct window *w, bool horflag) | |||
| 3898 | } | 3893 | } |
| 3899 | 3894 | ||
| 3900 | 3895 | ||
| 3901 | /* Set w->pixel_height (w->pixel_width if HORFLAG is non-zero) to | 3896 | /* Set w->pixel_height (w->pixel_width if HORFLAG) to |
| 3902 | w->new_pixel for window W and recursively all child windows of W. | 3897 | w->new_pixel for window W and recursively all child windows of W. |
| 3903 | Also calculate and assign the new vertical (horizontal) pixel start | 3898 | Also calculate and assign the new vertical (horizontal) pixel start |
| 3904 | positions of each of these windows. | 3899 | positions of each of these windows. |
| @@ -3984,11 +3979,11 @@ window_resize_apply (struct window *w, bool horflag) | |||
| 3984 | } | 3979 | } |
| 3985 | else | 3980 | else |
| 3986 | /* Bug#15957. */ | 3981 | /* Bug#15957. */ |
| 3987 | w->window_end_valid = 0; | 3982 | w->window_end_valid = false; |
| 3988 | } | 3983 | } |
| 3989 | 3984 | ||
| 3990 | 3985 | ||
| 3991 | /* Set w->total_lines (w->total_cols if HORFLAG is non-zero) to | 3986 | /* Set w->total_lines (w->total_cols if HORFLAG) to |
| 3992 | w->new_total for window W and recursively all child windows of W. | 3987 | w->new_total for window W and recursively all child windows of W. |
| 3993 | Also calculate and assign the new vertical (horizontal) start | 3988 | Also calculate and assign the new vertical (horizontal) start |
| 3994 | positions of each of these windows. */ | 3989 | positions of each of these windows. */ |
| @@ -4083,7 +4078,7 @@ be applied on the Elisp level. */) | |||
| 4083 | window_resize_apply (r, horflag); | 4078 | window_resize_apply (r, horflag); |
| 4084 | 4079 | ||
| 4085 | fset_redisplay (f); | 4080 | fset_redisplay (f); |
| 4086 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4081 | FRAME_WINDOW_SIZES_CHANGED (f) = true; |
| 4087 | 4082 | ||
| 4088 | adjust_frame_glyphs (f); | 4083 | adjust_frame_glyphs (f); |
| 4089 | unblock_input (); | 4084 | unblock_input (); |
| @@ -4133,8 +4128,8 @@ values. */) | |||
| 4133 | 4128 | ||
| 4134 | 4129 | ||
| 4135 | /* Resize frame F's windows when number of lines of F is set to SIZE. | 4130 | /* Resize frame F's windows when number of lines of F is set to SIZE. |
| 4136 | HORFLAG 1 means resize windows when number of columns of F is set to | 4131 | HORFLAG means resize windows when number of columns of F is set to |
| 4137 | SIZE. PIXELWISE 1 means to interpret SIZE as pixels. */ | 4132 | SIZE. PIXELWISE means to interpret SIZE as pixels. */ |
| 4138 | void | 4133 | void |
| 4139 | resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) | 4134 | resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) |
| 4140 | { | 4135 | { |
| @@ -4168,12 +4163,9 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) | |||
| 4168 | } | 4163 | } |
| 4169 | else | 4164 | else |
| 4170 | { | 4165 | { |
| 4171 | new_size = max (horflag | 4166 | new_size = max (size - (!horflag |
| 4172 | ? size | 4167 | && FRAME_HAS_MINIBUF_P (f) |
| 4173 | : (size | 4168 | && !FRAME_MINIBUF_ONLY_P (f)), |
| 4174 | - ((FRAME_HAS_MINIBUF_P (f) | ||
| 4175 | && !FRAME_MINIBUF_ONLY_P (f)) | ||
| 4176 | ? 1 : 0)), | ||
| 4177 | 1); | 4169 | 1); |
| 4178 | new_pixel_size = new_size * unit; | 4170 | new_pixel_size = new_size * unit; |
| 4179 | } | 4171 | } |
| @@ -4224,7 +4216,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) | |||
| 4224 | { | 4216 | { |
| 4225 | window_resize_apply (r, horflag); | 4217 | window_resize_apply (r, horflag); |
| 4226 | window_pixel_to_total (r->frame, horflag ? Qt : Qnil); | 4218 | window_pixel_to_total (r->frame, horflag ? Qt : Qnil); |
| 4227 | #if 0 /* Let's try without safe sizes and/or killing other windows. */ | 4219 | #if false /* Let's try without safe sizes and/or killing other windows. */ |
| 4228 | } | 4220 | } |
| 4229 | else | 4221 | else |
| 4230 | { | 4222 | { |
| @@ -4254,7 +4246,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) | |||
| 4254 | XWINDOW (root)->pixel_height = new_pixel_size; | 4246 | XWINDOW (root)->pixel_height = new_pixel_size; |
| 4255 | } | 4247 | } |
| 4256 | } | 4248 | } |
| 4257 | #endif /* 0 */ | 4249 | #endif /* false */ |
| 4258 | } | 4250 | } |
| 4259 | } | 4251 | } |
| 4260 | } | 4252 | } |
| @@ -4284,7 +4276,7 @@ resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise) | |||
| 4284 | DEFUN ("split-window-internal", Fsplit_window_internal, Ssplit_window_internal, 4, 4, 0, | 4276 | DEFUN ("split-window-internal", Fsplit_window_internal, Ssplit_window_internal, 4, 4, 0, |
| 4285 | doc: /* Split window OLD. | 4277 | doc: /* Split window OLD. |
| 4286 | Second argument PIXEL-SIZE specifies the number of pixels of the | 4278 | Second argument PIXEL-SIZE specifies the number of pixels of the |
| 4287 | new window. In any case TOTAL-SIZE must be a positive integer. | 4279 | new window. It must be a positive integer. |
| 4288 | 4280 | ||
| 4289 | Third argument SIDE nil (or `below') specifies that the new window shall | 4281 | Third argument SIDE nil (or `below') specifies that the new window shall |
| 4290 | be located below WINDOW. SIDE `above' means the new window shall be | 4282 | be located below WINDOW. SIDE `above' means the new window shall be |
| @@ -4311,14 +4303,12 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 4311 | provided OLD is a leaf window, or to the frame's selected window. | 4303 | provided OLD is a leaf window, or to the frame's selected window. |
| 4312 | NEW (*n) is the new window created with some parameters taken from | 4304 | NEW (*n) is the new window created with some parameters taken from |
| 4313 | REFERENCE (*r). */ | 4305 | REFERENCE (*r). */ |
| 4314 | register Lisp_Object new, frame, reference; | 4306 | Lisp_Object new, frame, reference; |
| 4315 | register struct window *o, *p, *n, *r, *c; | 4307 | struct window *o, *p, *n, *r, *c; |
| 4316 | struct frame *f; | 4308 | struct frame *f; |
| 4317 | bool horflag | 4309 | bool horflag |
| 4318 | /* HORFLAG is 1 when we split side-by-side, 0 otherwise. */ | 4310 | /* HORFLAG is true when we split side-by-side, false otherwise. */ |
| 4319 | = EQ (side, Qt) || EQ (side, Qleft) || EQ (side, Qright); | 4311 | = EQ (side, Qt) || EQ (side, Qleft) || EQ (side, Qright); |
| 4320 | int combination_limit = 0, sum = 0; | ||
| 4321 | int total_size; | ||
| 4322 | 4312 | ||
| 4323 | CHECK_WINDOW (old); | 4313 | CHECK_WINDOW (old); |
| 4324 | o = XWINDOW (old); | 4314 | o = XWINDOW (old); |
| @@ -4326,20 +4316,20 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 4326 | f = XFRAME (frame); | 4316 | f = XFRAME (frame); |
| 4327 | 4317 | ||
| 4328 | CHECK_NUMBER (pixel_size); | 4318 | CHECK_NUMBER (pixel_size); |
| 4329 | total_size | 4319 | EMACS_INT total_size |
| 4330 | = XINT (pixel_size) / (horflag | 4320 | = XINT (pixel_size) / (horflag |
| 4331 | ? FRAME_COLUMN_WIDTH (f) | 4321 | ? FRAME_COLUMN_WIDTH (f) |
| 4332 | : FRAME_LINE_HEIGHT (f)); | 4322 | : FRAME_LINE_HEIGHT (f)); |
| 4333 | 4323 | ||
| 4334 | /* Set combination_limit to 1 if we have to make a new parent window. | 4324 | /* Set combination_limit if we have to make a new parent window. |
| 4335 | We do that if either `window-combination-limit' is t, or OLD has no | 4325 | We do that if either `window-combination-limit' is t, or OLD has no |
| 4336 | parent, or OLD is ortho-combined. */ | 4326 | parent, or OLD is ortho-combined. */ |
| 4337 | combination_limit = | 4327 | bool combination_limit |
| 4338 | EQ (Vwindow_combination_limit, Qt) | 4328 | = (EQ (Vwindow_combination_limit, Qt) |
| 4339 | || NILP (o->parent) | 4329 | || NILP (o->parent) |
| 4340 | || (horflag | 4330 | || (horflag |
| 4341 | ? WINDOW_VERTICAL_COMBINATION_P (XWINDOW (o->parent)) | 4331 | ? WINDOW_VERTICAL_COMBINATION_P (XWINDOW (o->parent)) |
| 4342 | : WINDOW_HORIZONTAL_COMBINATION_P (XWINDOW (o->parent))); | 4332 | : WINDOW_HORIZONTAL_COMBINATION_P (XWINDOW (o->parent)))); |
| 4343 | 4333 | ||
| 4344 | /* We need a live reference window to initialize some parameters. */ | 4334 | /* We need a live reference window to initialize some parameters. */ |
| 4345 | if (WINDOW_LIVE_P (old)) | 4335 | if (WINDOW_LIVE_P (old)) |
| @@ -4405,7 +4395,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 4405 | p = XWINDOW (o->parent); | 4395 | p = XWINDOW (o->parent); |
| 4406 | 4396 | ||
| 4407 | fset_redisplay (f); | 4397 | fset_redisplay (f); |
| 4408 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4398 | FRAME_WINDOW_SIZES_CHANGED (f) = true; |
| 4409 | new = make_window (); | 4399 | new = make_window (); |
| 4410 | n = XWINDOW (new); | 4400 | n = XWINDOW (new); |
| 4411 | wset_frame (n, frame); | 4401 | wset_frame (n, frame); |
| @@ -4430,7 +4420,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 4430 | wset_next (o, new); | 4420 | wset_next (o, new); |
| 4431 | } | 4421 | } |
| 4432 | 4422 | ||
| 4433 | n->window_end_valid = 0; | 4423 | n->window_end_valid = false; |
| 4434 | n->last_cursor_vpos = 0; | 4424 | n->last_cursor_vpos = 0; |
| 4435 | 4425 | ||
| 4436 | /* Get special geometry settings from reference window. */ | 4426 | /* Get special geometry settings from reference window. */ |
| @@ -4463,6 +4453,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 4463 | /* Iso-coordinates and sizes are assigned by window_resize_apply, | 4453 | /* Iso-coordinates and sizes are assigned by window_resize_apply, |
| 4464 | get them ready here. */ | 4454 | get them ready here. */ |
| 4465 | wset_new_pixel (n, pixel_size); | 4455 | wset_new_pixel (n, pixel_size); |
| 4456 | EMACS_INT sum = 0; | ||
| 4466 | c = XWINDOW (p->contents); | 4457 | c = XWINDOW (p->contents); |
| 4467 | while (c) | 4458 | while (c) |
| 4468 | { | 4459 | { |
| @@ -4481,7 +4472,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 4481 | adjust_frame_glyphs (f); | 4472 | adjust_frame_glyphs (f); |
| 4482 | /* Set buffer of NEW to buffer of reference window. Don't run | 4473 | /* Set buffer of NEW to buffer of reference window. Don't run |
| 4483 | any hooks. */ | 4474 | any hooks. */ |
| 4484 | set_window_buffer (new, r->contents, 0, 1); | 4475 | set_window_buffer (new, r->contents, false, true); |
| 4485 | unblock_input (); | 4476 | unblock_input (); |
| 4486 | 4477 | ||
| 4487 | /* Maybe we should run the scroll functions in Elisp (which already | 4478 | /* Maybe we should run the scroll functions in Elisp (which already |
| @@ -4498,12 +4489,12 @@ DEFUN ("delete-window-internal", Fdelete_window_internal, Sdelete_window_interna | |||
| 4498 | doc: /* Remove WINDOW from its frame. | 4489 | doc: /* Remove WINDOW from its frame. |
| 4499 | WINDOW defaults to the selected window. Return nil. | 4490 | WINDOW defaults to the selected window. Return nil. |
| 4500 | Signal an error when WINDOW is the only window on its frame. */) | 4491 | Signal an error when WINDOW is the only window on its frame. */) |
| 4501 | (register Lisp_Object window) | 4492 | (Lisp_Object window) |
| 4502 | { | 4493 | { |
| 4503 | register Lisp_Object parent, sibling, frame, root; | 4494 | Lisp_Object parent, sibling, frame, root; |
| 4504 | struct window *w, *p, *s, *r; | 4495 | struct window *w, *p, *s, *r; |
| 4505 | struct frame *f; | 4496 | struct frame *f; |
| 4506 | bool horflag, before_sibling = 0; | 4497 | bool horflag, before_sibling = false; |
| 4507 | 4498 | ||
| 4508 | w = decode_any_window (window); | 4499 | w = decode_any_window (window); |
| 4509 | XSETWINDOW (window, w); | 4500 | XSETWINDOW (window, w); |
| @@ -4533,9 +4524,9 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4533 | if (NILP (w->prev)) | 4524 | if (NILP (w->prev)) |
| 4534 | /* Get SIBLING below (on the right of) WINDOW. */ | 4525 | /* Get SIBLING below (on the right of) WINDOW. */ |
| 4535 | { | 4526 | { |
| 4536 | /* before_sibling 1 means WINDOW is the first child of its | 4527 | /* before_sibling means WINDOW is the first child of its |
| 4537 | parent and thus before the sibling. */ | 4528 | parent and thus before the sibling. */ |
| 4538 | before_sibling = 1; | 4529 | before_sibling = true; |
| 4539 | sibling = w->next; | 4530 | sibling = w->next; |
| 4540 | s = XWINDOW (sibling); | 4531 | s = XWINDOW (sibling); |
| 4541 | wset_prev (s, Qnil); | 4532 | wset_prev (s, Qnil); |
| @@ -4572,7 +4563,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4572 | 4563 | ||
| 4573 | fset_redisplay (f); | 4564 | fset_redisplay (f); |
| 4574 | Vwindow_list = Qnil; | 4565 | Vwindow_list = Qnil; |
| 4575 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4566 | FRAME_WINDOW_SIZES_CHANGED (f) = true; |
| 4576 | 4567 | ||
| 4577 | wset_next (w, Qnil); /* Don't delete w->next too. */ | 4568 | wset_next (w, Qnil); /* Don't delete w->next too. */ |
| 4578 | free_window_matrices (w); | 4569 | free_window_matrices (w); |
| @@ -4580,7 +4571,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4580 | if (WINDOWP (w->contents)) | 4571 | if (WINDOWP (w->contents)) |
| 4581 | { | 4572 | { |
| 4582 | delete_all_child_windows (w->contents); | 4573 | delete_all_child_windows (w->contents); |
| 4583 | wset_combination (w, 0, Qnil); | 4574 | wset_combination (w, false, Qnil); |
| 4584 | } | 4575 | } |
| 4585 | else | 4576 | else |
| 4586 | { | 4577 | { |
| @@ -4596,13 +4587,13 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4596 | PARENT. */ | 4587 | PARENT. */ |
| 4597 | { | 4588 | { |
| 4598 | /* Put SIBLING into PARENT's place. */ | 4589 | /* Put SIBLING into PARENT's place. */ |
| 4599 | replace_window (parent, sibling, 0); | 4590 | replace_window (parent, sibling, false); |
| 4600 | /* Have SIBLING inherit the following three slot values from | 4591 | /* Have SIBLING inherit the following three slot values from |
| 4601 | PARENT (the combination_limit slot is not inherited). */ | 4592 | PARENT (the combination_limit slot is not inherited). */ |
| 4602 | wset_normal_cols (s, p->normal_cols); | 4593 | wset_normal_cols (s, p->normal_cols); |
| 4603 | wset_normal_lines (s, p->normal_lines); | 4594 | wset_normal_lines (s, p->normal_lines); |
| 4604 | /* Mark PARENT as deleted. */ | 4595 | /* Mark PARENT as deleted. */ |
| 4605 | wset_combination (p, 0, Qnil); | 4596 | wset_combination (p, false, Qnil); |
| 4606 | /* Try to merge SIBLING into its new parent. */ | 4597 | /* Try to merge SIBLING into its new parent. */ |
| 4607 | recombine_windows (sibling); | 4598 | recombine_windows (sibling); |
| 4608 | } | 4599 | } |
| @@ -4687,10 +4678,10 @@ grow_mini_window (struct window *w, int delta, bool pixelwise) | |||
| 4687 | r = XWINDOW (root); | 4678 | r = XWINDOW (root); |
| 4688 | height = call3 (Qwindow_resize_root_window_vertically, | 4679 | height = call3 (Qwindow_resize_root_window_vertically, |
| 4689 | root, make_number (- delta), pixelwise ? Qt : Qnil); | 4680 | root, make_number (- delta), pixelwise ? Qt : Qnil); |
| 4690 | if (INTEGERP (height) && window_resize_check (r, 0)) | 4681 | if (INTEGERP (height) && window_resize_check (r, false)) |
| 4691 | { | 4682 | { |
| 4692 | block_input (); | 4683 | block_input (); |
| 4693 | window_resize_apply (r, 0); | 4684 | window_resize_apply (r, false); |
| 4694 | 4685 | ||
| 4695 | if (pixelwise) | 4686 | if (pixelwise) |
| 4696 | { | 4687 | { |
| @@ -4742,10 +4733,10 @@ shrink_mini_window (struct window *w, bool pixelwise) | |||
| 4742 | delta = call3 (Qwindow_resize_root_window_vertically, | 4733 | delta = call3 (Qwindow_resize_root_window_vertically, |
| 4743 | root, make_number (height - unit), | 4734 | root, make_number (height - unit), |
| 4744 | pixelwise ? Qt : Qnil); | 4735 | pixelwise ? Qt : Qnil); |
| 4745 | if (INTEGERP (delta) && window_resize_check (r, 0)) | 4736 | if (INTEGERP (delta) && window_resize_check (r, false)) |
| 4746 | { | 4737 | { |
| 4747 | block_input (); | 4738 | block_input (); |
| 4748 | window_resize_apply (r, 0); | 4739 | window_resize_apply (r, false); |
| 4749 | 4740 | ||
| 4750 | /* Shrink the mini-window. */ | 4741 | /* Shrink the mini-window. */ |
| 4751 | w->top_line = r->top_line + r->total_lines; | 4742 | w->top_line = r->top_line + r->total_lines; |
| @@ -4784,12 +4775,12 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4784 | 4775 | ||
| 4785 | r = XWINDOW (FRAME_ROOT_WINDOW (f)); | 4776 | r = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 4786 | height = r->pixel_height + w->pixel_height; | 4777 | height = r->pixel_height + w->pixel_height; |
| 4787 | if (window_resize_check (r, 0) | 4778 | if (window_resize_check (r, false) |
| 4788 | && XINT (w->new_pixel) > 0 | 4779 | && XINT (w->new_pixel) > 0 |
| 4789 | && height == XINT (r->new_pixel) + XINT (w->new_pixel)) | 4780 | && height == XINT (r->new_pixel) + XINT (w->new_pixel)) |
| 4790 | { | 4781 | { |
| 4791 | block_input (); | 4782 | block_input (); |
| 4792 | window_resize_apply (r, 0); | 4783 | window_resize_apply (r, false); |
| 4793 | 4784 | ||
| 4794 | w->pixel_height = XFASTINT (w->new_pixel); | 4785 | w->pixel_height = XFASTINT (w->new_pixel); |
| 4795 | w->total_lines = w->pixel_height / FRAME_LINE_HEIGHT (f); | 4786 | w->total_lines = w->pixel_height / FRAME_LINE_HEIGHT (f); |
| @@ -4797,7 +4788,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4797 | w->top_line = r->top_line + r->total_lines; | 4788 | w->top_line = r->top_line + r->total_lines; |
| 4798 | 4789 | ||
| 4799 | fset_redisplay (f); | 4790 | fset_redisplay (f); |
| 4800 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4791 | FRAME_WINDOW_SIZES_CHANGED (f) = true; |
| 4801 | adjust_frame_glyphs (f); | 4792 | adjust_frame_glyphs (f); |
| 4802 | unblock_input (); | 4793 | unblock_input (); |
| 4803 | return Qt; | 4794 | return Qt; |
| @@ -4819,7 +4810,7 @@ mark_window_cursors_off (struct window *w) | |||
| 4819 | if (WINDOWP (w->contents)) | 4810 | if (WINDOWP (w->contents)) |
| 4820 | mark_window_cursors_off (XWINDOW (w->contents)); | 4811 | mark_window_cursors_off (XWINDOW (w->contents)); |
| 4821 | else | 4812 | else |
| 4822 | w->phys_cursor_on_p = 0; | 4813 | w->phys_cursor_on_p = false; |
| 4823 | 4814 | ||
| 4824 | w = NILP (w->next) ? 0 : XWINDOW (w->next); | 4815 | w = NILP (w->next) ? 0 : XWINDOW (w->next); |
| 4825 | } | 4816 | } |
| @@ -4854,19 +4845,19 @@ window_internal_height (struct window *w) | |||
| 4854 | Window Scrolling | 4845 | Window Scrolling |
| 4855 | ***********************************************************************/ | 4846 | ***********************************************************************/ |
| 4856 | 4847 | ||
| 4857 | /* Scroll contents of window WINDOW up. If WHOLE is non-zero, scroll | 4848 | /* Scroll contents of window WINDOW up. If WHOLE, scroll |
| 4858 | N screen-fulls, which is defined as the height of the window minus | 4849 | N screen-fulls, which is defined as the height of the window minus |
| 4859 | next_screen_context_lines. If WHOLE is zero, scroll up N lines | 4850 | next_screen_context_lines. If WHOLE is zero, scroll up N lines |
| 4860 | instead. Negative values of N mean scroll down. NOERROR non-zero | 4851 | instead. Negative values of N mean scroll down. NOERROR |
| 4861 | means don't signal an error if we try to move over BEGV or ZV, | 4852 | means don't signal an error if we try to move over BEGV or ZV, |
| 4862 | respectively. */ | 4853 | respectively. */ |
| 4863 | 4854 | ||
| 4864 | static void | 4855 | static void |
| 4865 | window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror) | 4856 | window_scroll (Lisp_Object window, EMACS_INT n, bool whole, bool noerror) |
| 4866 | { | 4857 | { |
| 4867 | ptrdiff_t count = SPECPDL_INDEX (); | 4858 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4868 | 4859 | ||
| 4869 | immediate_quit = 1; | 4860 | immediate_quit = true; |
| 4870 | n = clip_to_bounds (INT_MIN, n, INT_MAX); | 4861 | n = clip_to_bounds (INT_MIN, n, INT_MAX); |
| 4871 | 4862 | ||
| 4872 | wset_redisplay (XWINDOW (window)); | 4863 | wset_redisplay (XWINDOW (window)); |
| @@ -4884,8 +4875,8 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror) | |||
| 4884 | unbind_to (count, Qnil); | 4875 | unbind_to (count, Qnil); |
| 4885 | 4876 | ||
| 4886 | /* Bug#15957. */ | 4877 | /* Bug#15957. */ |
| 4887 | XWINDOW (window)->window_end_valid = 0; | 4878 | XWINDOW (window)->window_end_valid = false; |
| 4888 | immediate_quit = 0; | 4879 | immediate_quit = false; |
| 4889 | } | 4880 | } |
| 4890 | 4881 | ||
| 4891 | 4882 | ||
| @@ -4894,14 +4885,14 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror) | |||
| 4894 | descriptions. */ | 4885 | descriptions. */ |
| 4895 | 4886 | ||
| 4896 | static void | 4887 | static void |
| 4897 | window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | 4888 | window_scroll_pixel_based (Lisp_Object window, int n, bool whole, bool noerror) |
| 4898 | { | 4889 | { |
| 4899 | struct it it; | 4890 | struct it it; |
| 4900 | struct window *w = XWINDOW (window); | 4891 | struct window *w = XWINDOW (window); |
| 4901 | struct text_pos start; | 4892 | struct text_pos start; |
| 4902 | int this_scroll_margin; | 4893 | int this_scroll_margin; |
| 4903 | /* True if we fiddled the window vscroll field without really scrolling. */ | 4894 | /* True if we fiddled the window vscroll field without really scrolling. */ |
| 4904 | int vscrolled = 0; | 4895 | bool vscrolled = false; |
| 4905 | int x, y, rtop, rbot, rowh, vpos; | 4896 | int x, y, rtop, rbot, rowh, vpos; |
| 4906 | void *itdata = NULL; | 4897 | void *itdata = NULL; |
| 4907 | int window_total_lines; | 4898 | int window_total_lines; |
| @@ -4944,7 +4935,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 4944 | } | 4935 | } |
| 4945 | 4936 | ||
| 4946 | start = it.current.pos; | 4937 | start = it.current.pos; |
| 4947 | bidi_unshelve_cache (itdata, 0); | 4938 | bidi_unshelve_cache (itdata, false); |
| 4948 | } | 4939 | } |
| 4949 | else if (auto_window_vscroll_p) | 4940 | else if (auto_window_vscroll_p) |
| 4950 | { | 4941 | { |
| @@ -4997,11 +4988,11 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 4997 | spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); | 4988 | spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); |
| 4998 | set_marker_restricted (w->start, make_number (spos), | 4989 | set_marker_restricted (w->start, make_number (spos), |
| 4999 | w->contents); | 4990 | w->contents); |
| 5000 | w->start_at_line_beg = 1; | 4991 | w->start_at_line_beg = true; |
| 5001 | w->update_mode_line = 1; | 4992 | w->update_mode_line = true; |
| 5002 | /* Set force_start so that redisplay_window will run the | 4993 | /* Set force_start so that redisplay_window will run the |
| 5003 | window-scroll-functions. */ | 4994 | window-scroll-functions. */ |
| 5004 | w->force_start = 1; | 4995 | w->force_start = true; |
| 5005 | return; | 4996 | return; |
| 5006 | } | 4997 | } |
| 5007 | } | 4998 | } |
| @@ -5095,7 +5086,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5095 | } | 5086 | } |
| 5096 | else | 5087 | else |
| 5097 | { | 5088 | { |
| 5098 | bidi_unshelve_cache (itdata, 0); | 5089 | bidi_unshelve_cache (itdata, false); |
| 5099 | if (noerror) | 5090 | if (noerror) |
| 5100 | return; | 5091 | return; |
| 5101 | else if (n < 0) /* could happen with empty buffers */ | 5092 | else if (n < 0) /* could happen with empty buffers */ |
| @@ -5112,7 +5103,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5112 | w->vscroll = 0; | 5103 | w->vscroll = 0; |
| 5113 | else | 5104 | else |
| 5114 | { | 5105 | { |
| 5115 | bidi_unshelve_cache (itdata, 0); | 5106 | bidi_unshelve_cache (itdata, false); |
| 5116 | if (noerror) | 5107 | if (noerror) |
| 5117 | return; | 5108 | return; |
| 5118 | else | 5109 | else |
| @@ -5122,10 +5113,10 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5122 | 5113 | ||
| 5123 | /* If control gets here, then we vscrolled. */ | 5114 | /* If control gets here, then we vscrolled. */ |
| 5124 | 5115 | ||
| 5125 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; | 5116 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = true; |
| 5126 | 5117 | ||
| 5127 | /* Don't try to change the window start below. */ | 5118 | /* Don't try to change the window start below. */ |
| 5128 | vscrolled = 1; | 5119 | vscrolled = true; |
| 5129 | } | 5120 | } |
| 5130 | 5121 | ||
| 5131 | if (! vscrolled) | 5122 | if (! vscrolled) |
| @@ -5146,10 +5137,10 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5146 | IT_BYTEPOS (it)); | 5137 | IT_BYTEPOS (it)); |
| 5147 | bytepos = marker_byte_position (w->start); | 5138 | bytepos = marker_byte_position (w->start); |
| 5148 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); | 5139 | w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); |
| 5149 | w->update_mode_line = 1; | 5140 | w->update_mode_line = true; |
| 5150 | /* Set force_start so that redisplay_window will run the | 5141 | /* Set force_start so that redisplay_window will run the |
| 5151 | window-scroll-functions. */ | 5142 | window-scroll-functions. */ |
| 5152 | w->force_start = 1; | 5143 | w->force_start = true; |
| 5153 | } | 5144 | } |
| 5154 | 5145 | ||
| 5155 | /* The rest of this function uses current_y in a nonstandard way, | 5146 | /* The rest of this function uses current_y in a nonstandard way, |
| @@ -5182,8 +5173,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5182 | This is necessary because we set it.current_y to 0, above. */ | 5173 | This is necessary because we set it.current_y to 0, above. */ |
| 5183 | move_it_to (&it, -1, | 5174 | move_it_to (&it, -1, |
| 5184 | window_scroll_pixel_based_preserve_x, | 5175 | window_scroll_pixel_based_preserve_x, |
| 5185 | window_scroll_pixel_based_preserve_y | 5176 | (window_scroll_pixel_based_preserve_y |
| 5186 | - (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0 ), | 5177 | - WINDOW_WANTS_HEADER_LINE_P (w)), |
| 5187 | -1, MOVE_TO_Y | MOVE_TO_X); | 5178 | -1, MOVE_TO_Y | MOVE_TO_X); |
| 5188 | SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); | 5179 | SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); |
| 5189 | } | 5180 | } |
| @@ -5202,7 +5193,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5202 | else if (n < 0) | 5193 | else if (n < 0) |
| 5203 | { | 5194 | { |
| 5204 | ptrdiff_t charpos, bytepos; | 5195 | ptrdiff_t charpos, bytepos; |
| 5205 | int partial_p; | 5196 | bool partial_p; |
| 5206 | 5197 | ||
| 5207 | /* Save our position, for the | 5198 | /* Save our position, for the |
| 5208 | window_scroll_pixel_based_preserve_y case. */ | 5199 | window_scroll_pixel_based_preserve_y case. */ |
| @@ -5238,12 +5229,12 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5238 | { | 5229 | { |
| 5239 | charpos = IT_CHARPOS (it); | 5230 | charpos = IT_CHARPOS (it); |
| 5240 | bytepos = IT_BYTEPOS (it); | 5231 | bytepos = IT_BYTEPOS (it); |
| 5241 | bidi_unshelve_cache (it_data, 1); | 5232 | bidi_unshelve_cache (it_data, true); |
| 5242 | } | 5233 | } |
| 5243 | else | 5234 | else |
| 5244 | { | 5235 | { |
| 5245 | it = it2; | 5236 | it = it2; |
| 5246 | bidi_unshelve_cache (it_data, 0); | 5237 | bidi_unshelve_cache (it_data, false); |
| 5247 | } | 5238 | } |
| 5248 | } | 5239 | } |
| 5249 | 5240 | ||
| @@ -5287,7 +5278,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5287 | SET_PT_BOTH (charpos, bytepos); | 5278 | SET_PT_BOTH (charpos, bytepos); |
| 5288 | } | 5279 | } |
| 5289 | } | 5280 | } |
| 5290 | bidi_unshelve_cache (itdata, 0); | 5281 | bidi_unshelve_cache (itdata, false); |
| 5291 | 5282 | ||
| 5292 | if (adjust_old_pointm) | 5283 | if (adjust_old_pointm) |
| 5293 | Fset_marker (w->old_pointm, | 5284 | Fset_marker (w->old_pointm, |
| @@ -5302,9 +5293,9 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5302 | See the comment of window_scroll for parameter descriptions. */ | 5293 | See the comment of window_scroll for parameter descriptions. */ |
| 5303 | 5294 | ||
| 5304 | static void | 5295 | static void |
| 5305 | window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror) | 5296 | window_scroll_line_based (Lisp_Object window, int n, bool whole, bool noerror) |
| 5306 | { | 5297 | { |
| 5307 | register struct window *w = XWINDOW (window); | 5298 | struct window *w = XWINDOW (window); |
| 5308 | /* Fvertical_motion enters redisplay, which can trigger | 5299 | /* Fvertical_motion enters redisplay, which can trigger |
| 5309 | fontification, which in turn can modify buffer text (e.g., if the | 5300 | fontification, which in turn can modify buffer text (e.g., if the |
| 5310 | fontification functions replace escape sequences with faces, as | 5301 | fontification functions replace escape sequences with faces, as |
| @@ -5334,7 +5325,7 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5334 | || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command))) | 5325 | || NILP (Fget (KVAR (current_kboard, Vlast_command), Qscroll_command))) |
| 5335 | { | 5326 | { |
| 5336 | struct position posit | 5327 | struct position posit |
| 5337 | = *compute_motion (startpos, startbyte, 0, 0, 0, | 5328 | = *compute_motion (startpos, startbyte, 0, 0, false, |
| 5338 | PT, ht, 0, -1, w->hscroll, 0, w); | 5329 | PT, ht, 0, -1, w->hscroll, 0, w); |
| 5339 | 5330 | ||
| 5340 | window_scroll_preserve_vpos = posit.vpos; | 5331 | window_scroll_preserve_vpos = posit.vpos; |
| @@ -5380,10 +5371,10 @@ window_scroll_line_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 5380 | 5371 | ||
| 5381 | set_marker_restricted_both (w->start, w->contents, pos, pos_byte); | 5372 | set_marker_restricted_both (w->start, w->contents, pos, pos_byte); |
| 5382 | w->start_at_line_beg = !NILP (bolp); | 5373 | w->start_at_line_beg = !NILP (bolp); |
| 5383 | w->update_mode_line = 1; | 5374 | w->update_mode_line = true; |
| 5384 | /* Set force_start so that redisplay_window will run | 5375 | /* Set force_start so that redisplay_window will run |
| 5385 | the window-scroll-functions. */ | 5376 | the window-scroll-functions. */ |
| 5386 | w->force_start = 1; | 5377 | w->force_start = true; |
| 5387 | 5378 | ||
| 5388 | if (!NILP (Vscroll_preserve_screen_position) | 5379 | if (!NILP (Vscroll_preserve_screen_position) |
| 5389 | && (whole || !EQ (Vscroll_preserve_screen_position, Qt))) | 5380 | && (whole || !EQ (Vscroll_preserve_screen_position, Qt))) |
| @@ -5485,13 +5476,13 @@ scroll_command (Lisp_Object n, int direction) | |||
| 5485 | } | 5476 | } |
| 5486 | 5477 | ||
| 5487 | if (NILP (n)) | 5478 | if (NILP (n)) |
| 5488 | window_scroll (selected_window, direction, 1, 0); | 5479 | window_scroll (selected_window, direction, true, false); |
| 5489 | else if (EQ (n, Qminus)) | 5480 | else if (EQ (n, Qminus)) |
| 5490 | window_scroll (selected_window, -direction, 1, 0); | 5481 | window_scroll (selected_window, -direction, true, false); |
| 5491 | else | 5482 | else |
| 5492 | { | 5483 | { |
| 5493 | n = Fprefix_numeric_value (n); | 5484 | n = Fprefix_numeric_value (n); |
| 5494 | window_scroll (selected_window, XINT (n) * direction, 0, 0); | 5485 | window_scroll (selected_window, XINT (n) * direction, false, false); |
| 5495 | } | 5486 | } |
| 5496 | 5487 | ||
| 5497 | unbind_to (count, Qnil); | 5488 | unbind_to (count, Qnil); |
| @@ -5599,15 +5590,15 @@ specifies the window to scroll. This takes precedence over | |||
| 5599 | SET_PT_BOTH (marker_position (w->old_pointm), marker_byte_position (w->old_pointm)); | 5590 | SET_PT_BOTH (marker_position (w->old_pointm), marker_byte_position (w->old_pointm)); |
| 5600 | 5591 | ||
| 5601 | if (NILP (arg)) | 5592 | if (NILP (arg)) |
| 5602 | window_scroll (window, 1, 1, 1); | 5593 | window_scroll (window, 1, true, true); |
| 5603 | else if (EQ (arg, Qminus)) | 5594 | else if (EQ (arg, Qminus)) |
| 5604 | window_scroll (window, -1, 1, 1); | 5595 | window_scroll (window, -1, true, true); |
| 5605 | else | 5596 | else |
| 5606 | { | 5597 | { |
| 5607 | if (CONSP (arg)) | 5598 | if (CONSP (arg)) |
| 5608 | arg = XCAR (arg); | 5599 | arg = XCAR (arg); |
| 5609 | CHECK_NUMBER (arg); | 5600 | CHECK_NUMBER (arg); |
| 5610 | window_scroll (window, XINT (arg), 0, 1); | 5601 | window_scroll (window, XINT (arg), false, true); |
| 5611 | } | 5602 | } |
| 5612 | 5603 | ||
| 5613 | set_marker_both (w->pointm, Qnil, PT, PT_BYTE); | 5604 | set_marker_both (w->pointm, Qnil, PT, PT_BYTE); |
| @@ -5637,7 +5628,7 @@ by this function. This happens in an interactive call. */) | |||
| 5637 | if (!NILP (set_minimum)) | 5628 | if (!NILP (set_minimum)) |
| 5638 | w->min_hscroll = w->hscroll; | 5629 | w->min_hscroll = w->hscroll; |
| 5639 | 5630 | ||
| 5640 | w->suspend_auto_hscroll = 1; | 5631 | w->suspend_auto_hscroll = true; |
| 5641 | 5632 | ||
| 5642 | return result; | 5633 | return result; |
| 5643 | } | 5634 | } |
| @@ -5662,7 +5653,7 @@ by this function. This happens in an interactive call. */) | |||
| 5662 | if (!NILP (set_minimum)) | 5653 | if (!NILP (set_minimum)) |
| 5663 | w->min_hscroll = w->hscroll; | 5654 | w->min_hscroll = w->hscroll; |
| 5664 | 5655 | ||
| 5665 | w->suspend_auto_hscroll = 1; | 5656 | w->suspend_auto_hscroll = true; |
| 5666 | 5657 | ||
| 5667 | return result; | 5658 | return result; |
| 5668 | } | 5659 | } |
| @@ -5710,7 +5701,7 @@ displayed_window_lines (struct window *w) | |||
| 5710 | start_display (&it, w, start); | 5701 | start_display (&it, w, start); |
| 5711 | move_it_vertically (&it, height); | 5702 | move_it_vertically (&it, height); |
| 5712 | bottom_y = line_bottom_y (&it); | 5703 | bottom_y = line_bottom_y (&it); |
| 5713 | bidi_unshelve_cache (itdata, 0); | 5704 | bidi_unshelve_cache (itdata, false); |
| 5714 | 5705 | ||
| 5715 | /* rms: On a non-window display, | 5706 | /* rms: On a non-window display, |
| 5716 | the value of it.vpos at the bottom of the screen | 5707 | the value of it.vpos at the bottom of the screen |
| @@ -5754,7 +5745,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5754 | { | 5745 | { |
| 5755 | struct window *w = XWINDOW (selected_window); | 5746 | struct window *w = XWINDOW (selected_window); |
| 5756 | struct buffer *buf = XBUFFER (w->contents); | 5747 | struct buffer *buf = XBUFFER (w->contents); |
| 5757 | bool center_p = 0; | 5748 | bool center_p = false; |
| 5758 | ptrdiff_t charpos, bytepos; | 5749 | ptrdiff_t charpos, bytepos; |
| 5759 | EMACS_INT iarg IF_LINT (= 0); | 5750 | EMACS_INT iarg IF_LINT (= 0); |
| 5760 | int this_scroll_margin; | 5751 | int this_scroll_margin; |
| @@ -5783,10 +5774,10 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5783 | SET_FRAME_GARBAGED (WINDOW_XFRAME (w)); | 5774 | SET_FRAME_GARBAGED (WINDOW_XFRAME (w)); |
| 5784 | } | 5775 | } |
| 5785 | 5776 | ||
| 5786 | center_p = 1; | 5777 | center_p = true; |
| 5787 | } | 5778 | } |
| 5788 | else if (CONSP (arg)) /* Just C-u. */ | 5779 | else if (CONSP (arg)) /* Just C-u. */ |
| 5789 | center_p = 1; | 5780 | center_p = true; |
| 5790 | else | 5781 | else |
| 5791 | { | 5782 | { |
| 5792 | arg = Fprefix_numeric_value (arg); | 5783 | arg = Fprefix_numeric_value (arg); |
| @@ -5799,10 +5790,9 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5799 | this_scroll_margin | 5790 | this_scroll_margin |
| 5800 | = max (0, min (scroll_margin, w->total_lines / 4)); | 5791 | = max (0, min (scroll_margin, w->total_lines / 4)); |
| 5801 | 5792 | ||
| 5802 | /* Handle centering on a graphical frame specially. Such frames can | 5793 | /* Don't use redisplay code for initial frames, as the necessary |
| 5803 | have variable-height lines and centering point on the basis of | 5794 | data structures might not be set up yet then. */ |
| 5804 | line counts would lead to strange effects. */ | 5795 | if (!FRAME_INITIAL_P (XFRAME (w->frame))) |
| 5805 | if (FRAME_WINDOW_P (XFRAME (w->frame))) | ||
| 5806 | { | 5796 | { |
| 5807 | if (center_p) | 5797 | if (center_p) |
| 5808 | { | 5798 | { |
| @@ -5815,7 +5805,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5815 | move_it_vertically_backward (&it, window_box_height (w) / 2); | 5805 | move_it_vertically_backward (&it, window_box_height (w) / 2); |
| 5816 | charpos = IT_CHARPOS (it); | 5806 | charpos = IT_CHARPOS (it); |
| 5817 | bytepos = IT_BYTEPOS (it); | 5807 | bytepos = IT_BYTEPOS (it); |
| 5818 | bidi_unshelve_cache (itdata, 0); | 5808 | bidi_unshelve_cache (itdata, false); |
| 5819 | } | 5809 | } |
| 5820 | else if (iarg < 0) | 5810 | else if (iarg < 0) |
| 5821 | { | 5811 | { |
| @@ -5824,9 +5814,11 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5824 | ptrdiff_t nlines = min (PTRDIFF_MAX, -iarg); | 5814 | ptrdiff_t nlines = min (PTRDIFF_MAX, -iarg); |
| 5825 | int extra_line_spacing; | 5815 | int extra_line_spacing; |
| 5826 | int h = window_box_height (w); | 5816 | int h = window_box_height (w); |
| 5817 | int ht = window_internal_height (w); | ||
| 5827 | void *itdata = bidi_shelve_cache (); | 5818 | void *itdata = bidi_shelve_cache (); |
| 5828 | 5819 | ||
| 5829 | iarg = - max (-iarg, this_scroll_margin); | 5820 | nlines = clip_to_bounds (this_scroll_margin + 1, nlines, |
| 5821 | ht - this_scroll_margin); | ||
| 5830 | 5822 | ||
| 5831 | SET_TEXT_POS (pt, PT, PT_BYTE); | 5823 | SET_TEXT_POS (pt, PT, PT_BYTE); |
| 5832 | start_display (&it, w, pt); | 5824 | start_display (&it, w, pt); |
| @@ -5863,7 +5855,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5863 | } | 5855 | } |
| 5864 | if (h <= 0) | 5856 | if (h <= 0) |
| 5865 | { | 5857 | { |
| 5866 | bidi_unshelve_cache (itdata, 0); | 5858 | bidi_unshelve_cache (itdata, false); |
| 5867 | return Qnil; | 5859 | return Qnil; |
| 5868 | } | 5860 | } |
| 5869 | 5861 | ||
| @@ -5886,17 +5878,37 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5886 | charpos = IT_CHARPOS (it); | 5878 | charpos = IT_CHARPOS (it); |
| 5887 | bytepos = IT_BYTEPOS (it); | 5879 | bytepos = IT_BYTEPOS (it); |
| 5888 | 5880 | ||
| 5889 | bidi_unshelve_cache (itdata, 0); | 5881 | bidi_unshelve_cache (itdata, false); |
| 5890 | } | 5882 | } |
| 5891 | else | 5883 | else |
| 5892 | { | 5884 | { |
| 5893 | struct position pos; | 5885 | struct it it; |
| 5886 | struct text_pos pt; | ||
| 5887 | ptrdiff_t nlines = min (PTRDIFF_MAX, iarg); | ||
| 5888 | int ht = window_internal_height (w); | ||
| 5889 | void *itdata = bidi_shelve_cache (); | ||
| 5890 | |||
| 5891 | nlines = clip_to_bounds (this_scroll_margin, nlines, | ||
| 5892 | ht - this_scroll_margin - 1); | ||
| 5893 | |||
| 5894 | SET_TEXT_POS (pt, PT, PT_BYTE); | ||
| 5895 | start_display (&it, w, pt); | ||
| 5894 | 5896 | ||
| 5895 | iarg = max (iarg, this_scroll_margin); | 5897 | /* Move to the beginning of screen line containing PT. */ |
| 5898 | move_it_by_lines (&it, 0); | ||
| 5896 | 5899 | ||
| 5897 | pos = *vmotion (PT, PT_BYTE, -iarg, w); | 5900 | /* Move back to find the point which is ARG screen lines above PT. */ |
| 5898 | charpos = pos.bufpos; | 5901 | if (nlines > 0) |
| 5899 | bytepos = pos.bytepos; | 5902 | { |
| 5903 | it.current_y = 0; | ||
| 5904 | it.vpos = 0; | ||
| 5905 | move_it_by_lines (&it, -nlines); | ||
| 5906 | } | ||
| 5907 | |||
| 5908 | charpos = IT_CHARPOS (it); | ||
| 5909 | bytepos = IT_BYTEPOS (it); | ||
| 5910 | |||
| 5911 | bidi_unshelve_cache (itdata, false); | ||
| 5900 | } | 5912 | } |
| 5901 | } | 5913 | } |
| 5902 | else | 5914 | else |
| @@ -5920,9 +5932,9 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5920 | 5932 | ||
| 5921 | /* Set the new window start. */ | 5933 | /* Set the new window start. */ |
| 5922 | set_marker_both (w->start, w->contents, charpos, bytepos); | 5934 | set_marker_both (w->start, w->contents, charpos, bytepos); |
| 5923 | w->window_end_valid = 0; | 5935 | w->window_end_valid = false; |
| 5924 | 5936 | ||
| 5925 | w->optional_new_start = 1; | 5937 | w->optional_new_start = true; |
| 5926 | 5938 | ||
| 5927 | w->start_at_line_beg = (bytepos == BEGV_BYTE | 5939 | w->start_at_line_beg = (bytepos == BEGV_BYTE |
| 5928 | || FETCH_BYTE (bytepos - 1) == '\n'); | 5940 | || FETCH_BYTE (bytepos - 1) == '\n'); |
| @@ -5986,7 +5998,7 @@ zero means top of window, negative means relative to bottom of window. */) | |||
| 5986 | struct window *w = XWINDOW (selected_window); | 5998 | struct window *w = XWINDOW (selected_window); |
| 5987 | int lines, start; | 5999 | int lines, start; |
| 5988 | Lisp_Object window; | 6000 | Lisp_Object window; |
| 5989 | #if 0 | 6001 | #if false |
| 5990 | int this_scroll_margin; | 6002 | int this_scroll_margin; |
| 5991 | #endif | 6003 | #endif |
| 5992 | 6004 | ||
| @@ -6003,14 +6015,14 @@ zero means top of window, negative means relative to bottom of window. */) | |||
| 6003 | Fvertical_motion (make_number (- (height / 2)), window, Qnil); | 6015 | Fvertical_motion (make_number (- (height / 2)), window, Qnil); |
| 6004 | set_marker_both (w->start, w->contents, PT, PT_BYTE); | 6016 | set_marker_both (w->start, w->contents, PT, PT_BYTE); |
| 6005 | w->start_at_line_beg = !NILP (Fbolp ()); | 6017 | w->start_at_line_beg = !NILP (Fbolp ()); |
| 6006 | w->force_start = 1; | 6018 | w->force_start = true; |
| 6007 | } | 6019 | } |
| 6008 | else | 6020 | else |
| 6009 | Fgoto_char (w->start); | 6021 | Fgoto_char (w->start); |
| 6010 | 6022 | ||
| 6011 | lines = displayed_window_lines (w); | 6023 | lines = displayed_window_lines (w); |
| 6012 | 6024 | ||
| 6013 | #if 0 | 6025 | #if false |
| 6014 | this_scroll_margin = max (0, min (scroll_margin, lines / 4)); | 6026 | this_scroll_margin = max (0, min (scroll_margin, lines / 4)); |
| 6015 | #endif | 6027 | #endif |
| 6016 | 6028 | ||
| @@ -6023,11 +6035,11 @@ zero means top of window, negative means relative to bottom of window. */) | |||
| 6023 | if (iarg < 0) | 6035 | if (iarg < 0) |
| 6024 | iarg = iarg + lines; | 6036 | iarg = iarg + lines; |
| 6025 | 6037 | ||
| 6026 | #if 0 /* This code would prevent move-to-window-line from moving point | 6038 | #if false /* This code would prevent move-to-window-line from moving point |
| 6027 | to a place inside the scroll margins (which would cause the | 6039 | to a place inside the scroll margins (which would cause the |
| 6028 | next redisplay to scroll). I wrote this code, but then concluded | 6040 | next redisplay to scroll). I wrote this code, but then concluded |
| 6029 | it is probably better not to install it. However, it is here | 6041 | it is probably better not to install it. However, it is here |
| 6030 | inside #if 0 so as not to lose it. -- rms. */ | 6042 | inside #if false so as not to lose it. -- rms. */ |
| 6031 | 6043 | ||
| 6032 | /* Don't let it get into the margin at either top or bottom. */ | 6044 | /* Don't let it get into the margin at either top or bottom. */ |
| 6033 | iarg = max (iarg, this_scroll_margin); | 6045 | iarg = max (iarg, this_scroll_margin); |
| @@ -6193,14 +6205,12 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6193 | { | 6205 | { |
| 6194 | Lisp_Object window; | 6206 | Lisp_Object window; |
| 6195 | Lisp_Object dead_windows = Qnil; | 6207 | Lisp_Object dead_windows = Qnil; |
| 6196 | register Lisp_Object tem, par, pers; | 6208 | Lisp_Object tem, par, pers; |
| 6197 | register struct window *w; | 6209 | struct window *w; |
| 6198 | register struct saved_window *p; | 6210 | struct saved_window *p; |
| 6199 | struct window *root_window; | 6211 | struct window *root_window; |
| 6200 | struct window **leaf_windows; | 6212 | struct window **leaf_windows; |
| 6201 | int n_leaf_windows; | 6213 | ptrdiff_t i, k, n_leaf_windows; |
| 6202 | ptrdiff_t k; | ||
| 6203 | int i, n; | ||
| 6204 | 6214 | ||
| 6205 | /* Don't do this within the main loop below: This may call Lisp | 6215 | /* Don't do this within the main loop below: This may call Lisp |
| 6206 | code and is thus potentially unsafe while input is blocked. */ | 6216 | code and is thus potentially unsafe while input is blocked. */ |
| @@ -6238,14 +6248,14 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6238 | } | 6248 | } |
| 6239 | 6249 | ||
| 6240 | fset_redisplay (f); | 6250 | fset_redisplay (f); |
| 6241 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 6251 | FRAME_WINDOW_SIZES_CHANGED (f) = true; |
| 6242 | 6252 | ||
| 6243 | /* Problem: Freeing all matrices and later allocating them again | 6253 | /* Problem: Freeing all matrices and later allocating them again |
| 6244 | is a serious redisplay flickering problem. What we would | 6254 | is a serious redisplay flickering problem. What we would |
| 6245 | really like to do is to free only those matrices not reused | 6255 | really like to do is to free only those matrices not reused |
| 6246 | below. */ | 6256 | below. */ |
| 6247 | root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); | 6257 | root_window = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 6248 | int nwindows = count_windows (root_window); | 6258 | ptrdiff_t nwindows = count_windows (root_window); |
| 6249 | SAFE_NALLOCA (leaf_windows, 1, nwindows); | 6259 | SAFE_NALLOCA (leaf_windows, 1, nwindows); |
| 6250 | n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0); | 6260 | n_leaf_windows = get_leaf_windows (root_window, leaf_windows, 0); |
| 6251 | 6261 | ||
| @@ -6369,7 +6379,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6369 | (w->old_pointm, w->contents, | 6379 | (w->old_pointm, w->contents, |
| 6370 | BUF_PT (XBUFFER (w->contents)), | 6380 | BUF_PT (XBUFFER (w->contents)), |
| 6371 | BUF_PT_BYTE (XBUFFER (w->contents))); | 6381 | BUF_PT_BYTE (XBUFFER (w->contents))); |
| 6372 | w->start_at_line_beg = 1; | 6382 | w->start_at_line_beg = true; |
| 6373 | } | 6383 | } |
| 6374 | else if (!NILP (w->start)) | 6384 | else if (!NILP (w->start)) |
| 6375 | /* Leaf window has no live buffer, get one. */ | 6385 | /* Leaf window has no live buffer, get one. */ |
| @@ -6384,7 +6394,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6384 | set_marker_restricted_both (w->start, w->contents, 0, 0); | 6394 | set_marker_restricted_both (w->start, w->contents, 0, 0); |
| 6385 | set_marker_restricted_both (w->pointm, w->contents, 0, 0); | 6395 | set_marker_restricted_both (w->pointm, w->contents, 0, 0); |
| 6386 | set_marker_restricted_both (w->old_pointm, w->contents, 0, 0); | 6396 | set_marker_restricted_both (w->old_pointm, w->contents, 0, 0); |
| 6387 | w->start_at_line_beg = 1; | 6397 | w->start_at_line_beg = true; |
| 6388 | if (!NILP (w->dedicated)) | 6398 | if (!NILP (w->dedicated)) |
| 6389 | /* Record this window as dead. */ | 6399 | /* Record this window as dead. */ |
| 6390 | dead_windows = Fcons (window, dead_windows); | 6400 | dead_windows = Fcons (window, dead_windows); |
| @@ -6408,7 +6418,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6408 | 6418 | ||
| 6409 | Do not record the buffer here. We do that in a separate call | 6419 | Do not record the buffer here. We do that in a separate call |
| 6410 | to select_window below. See also Bug#16207. */ | 6420 | to select_window below. See also Bug#16207. */ |
| 6411 | select_window (data->current_window, Qt, 1); | 6421 | select_window (data->current_window, Qt, true); |
| 6412 | BVAR (XBUFFER (XWINDOW (selected_window)->contents), | 6422 | BVAR (XBUFFER (XWINDOW (selected_window)->contents), |
| 6413 | last_selected_window) | 6423 | last_selected_window) |
| 6414 | = selected_window; | 6424 | = selected_window; |
| @@ -6419,18 +6429,14 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6419 | Fredirect_frame_focus (frame, data->focus_frame); | 6429 | Fredirect_frame_focus (frame, data->focus_frame); |
| 6420 | 6430 | ||
| 6421 | /* Now, free glyph matrices in windows that were not reused. */ | 6431 | /* Now, free glyph matrices in windows that were not reused. */ |
| 6422 | for (i = n = 0; i < n_leaf_windows; ++i) | 6432 | for (i = 0; i < n_leaf_windows; i++) |
| 6423 | { | 6433 | if (NILP (leaf_windows[i]->contents)) |
| 6424 | if (NILP (leaf_windows[i]->contents)) | 6434 | free_window_matrices (leaf_windows[i]); |
| 6425 | free_window_matrices (leaf_windows[i]); | ||
| 6426 | else if (EQ (leaf_windows[i]->contents, new_current_buffer)) | ||
| 6427 | ++n; | ||
| 6428 | } | ||
| 6429 | 6435 | ||
| 6430 | /* Allow x_set_window_size again and apply frame size changes if | 6436 | /* Allow x_set_window_size again and apply frame size changes if |
| 6431 | needed. */ | 6437 | needed. */ |
| 6432 | f->can_x_set_window_size = true; | 6438 | f->can_x_set_window_size = true; |
| 6433 | adjust_frame_size (f, -1, -1, 1, 0, Qset_window_configuration); | 6439 | adjust_frame_size (f, -1, -1, 1, false, Qset_window_configuration); |
| 6434 | 6440 | ||
| 6435 | adjust_frame_glyphs (f); | 6441 | adjust_frame_glyphs (f); |
| 6436 | unblock_input (); | 6442 | unblock_input (); |
| @@ -6445,7 +6451,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6445 | 6451 | ||
| 6446 | /* Record the selected window's buffer here. The window should | 6452 | /* Record the selected window's buffer here. The window should |
| 6447 | already be the selected one from the call above. */ | 6453 | already be the selected one from the call above. */ |
| 6448 | select_window (data->current_window, Qnil, 0); | 6454 | select_window (data->current_window, Qnil, false); |
| 6449 | 6455 | ||
| 6450 | /* Fselect_window will have made f the selected frame, so we | 6456 | /* Fselect_window will have made f the selected frame, so we |
| 6451 | reselect the proper frame here. Fhandle_switch_frame will change the | 6457 | reselect the proper frame here. Fhandle_switch_frame will change the |
| @@ -6500,7 +6506,7 @@ delete_all_child_windows (Lisp_Object window) | |||
| 6500 | if (WINDOWP (w->contents)) | 6506 | if (WINDOWP (w->contents)) |
| 6501 | { | 6507 | { |
| 6502 | delete_all_child_windows (w->contents); | 6508 | delete_all_child_windows (w->contents); |
| 6503 | wset_combination (w, 0, Qnil); | 6509 | wset_combination (w, false, Qnil); |
| 6504 | } | 6510 | } |
| 6505 | else if (BUFFERP (w->contents)) | 6511 | else if (BUFFERP (w->contents)) |
| 6506 | { | 6512 | { |
| @@ -6518,10 +6524,10 @@ delete_all_child_windows (Lisp_Object window) | |||
| 6518 | Vwindow_list = Qnil; | 6524 | Vwindow_list = Qnil; |
| 6519 | } | 6525 | } |
| 6520 | 6526 | ||
| 6521 | static int | 6527 | static ptrdiff_t |
| 6522 | count_windows (register struct window *window) | 6528 | count_windows (struct window *window) |
| 6523 | { | 6529 | { |
| 6524 | register int count = 1; | 6530 | ptrdiff_t count = 1; |
| 6525 | if (!NILP (window->next)) | 6531 | if (!NILP (window->next)) |
| 6526 | count += count_windows (XWINDOW (window->next)); | 6532 | count += count_windows (XWINDOW (window->next)); |
| 6527 | if (WINDOWP (window->contents)) | 6533 | if (WINDOWP (window->contents)) |
| @@ -6532,8 +6538,8 @@ count_windows (register struct window *window) | |||
| 6532 | 6538 | ||
| 6533 | /* Fill vector FLAT with leaf windows under W, starting at index I. | 6539 | /* Fill vector FLAT with leaf windows under W, starting at index I. |
| 6534 | Value is last index + 1. */ | 6540 | Value is last index + 1. */ |
| 6535 | static int | 6541 | static ptrdiff_t |
| 6536 | get_leaf_windows (struct window *w, struct window **flat, int i) | 6542 | get_leaf_windows (struct window *w, struct window **flat, ptrdiff_t i) |
| 6537 | { | 6543 | { |
| 6538 | while (w) | 6544 | while (w) |
| 6539 | { | 6545 | { |
| @@ -6587,12 +6593,12 @@ get_phys_cursor_glyph (struct window *w) | |||
| 6587 | } | 6593 | } |
| 6588 | 6594 | ||
| 6589 | 6595 | ||
| 6590 | static int | 6596 | static ptrdiff_t |
| 6591 | save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) | 6597 | save_window_save (Lisp_Object window, struct Lisp_Vector *vector, ptrdiff_t i) |
| 6592 | { | 6598 | { |
| 6593 | register struct saved_window *p; | 6599 | struct saved_window *p; |
| 6594 | register struct window *w; | 6600 | struct window *w; |
| 6595 | register Lisp_Object tem, pers, par; | 6601 | Lisp_Object tem, pers, par; |
| 6596 | 6602 | ||
| 6597 | for (; !NILP (window); window = w->next) | 6603 | for (; !NILP (window); window = w->next) |
| 6598 | { | 6604 | { |
| @@ -6730,10 +6736,9 @@ redirection (see `redirect-frame-focus'). The variable | |||
| 6730 | saved by this function. */) | 6736 | saved by this function. */) |
| 6731 | (Lisp_Object frame) | 6737 | (Lisp_Object frame) |
| 6732 | { | 6738 | { |
| 6733 | register Lisp_Object tem; | 6739 | Lisp_Object tem; |
| 6734 | register int n_windows; | 6740 | ptrdiff_t i, n_windows; |
| 6735 | register struct save_window_data *data; | 6741 | struct save_window_data *data; |
| 6736 | register int i; | ||
| 6737 | struct frame *f = decode_live_frame (frame); | 6742 | struct frame *f = decode_live_frame (frame); |
| 6738 | 6743 | ||
| 6739 | n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); | 6744 | n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); |
| @@ -6772,7 +6777,7 @@ apply_window_adjustment (struct window *w) | |||
| 6772 | { | 6777 | { |
| 6773 | eassert (w); | 6778 | eassert (w); |
| 6774 | clear_glyph_matrix (w->current_matrix); | 6779 | clear_glyph_matrix (w->current_matrix); |
| 6775 | w->window_end_valid = 0; | 6780 | w->window_end_valid = false; |
| 6776 | windows_or_buffers_changed = 30; | 6781 | windows_or_buffers_changed = 30; |
| 6777 | wset_redisplay (w); | 6782 | wset_redisplay (w); |
| 6778 | adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w))); | 6783 | adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w))); |
| @@ -6783,17 +6788,22 @@ apply_window_adjustment (struct window *w) | |||
| 6783 | Marginal Areas | 6788 | Marginal Areas |
| 6784 | ***********************************************************************/ | 6789 | ***********************************************************************/ |
| 6785 | 6790 | ||
| 6791 | static int | ||
| 6792 | extract_dimension (Lisp_Object dimension) | ||
| 6793 | { | ||
| 6794 | if (NILP (dimension)) | ||
| 6795 | return -1; | ||
| 6796 | CHECK_RANGED_INTEGER (dimension, 0, INT_MAX); | ||
| 6797 | return XINT (dimension); | ||
| 6798 | } | ||
| 6799 | |||
| 6786 | static struct window * | 6800 | static struct window * |
| 6787 | set_window_margins (struct window *w, Lisp_Object left_width, | 6801 | set_window_margins (struct window *w, Lisp_Object left_width, |
| 6788 | Lisp_Object right_width) | 6802 | Lisp_Object right_width) |
| 6789 | { | 6803 | { |
| 6790 | int left, right; | ||
| 6791 | int unit = WINDOW_FRAME_COLUMN_WIDTH (w); | 6804 | int unit = WINDOW_FRAME_COLUMN_WIDTH (w); |
| 6792 | 6805 | int left = NILP (left_width) ? 0 : extract_dimension (left_width); | |
| 6793 | left = (NILP (left_width) ? 0 | 6806 | int right = NILP (right_width) ? 0 : extract_dimension (right_width); |
| 6794 | : (CHECK_NATNUM (left_width), XINT (left_width))); | ||
| 6795 | right = (NILP (right_width) ? 0 | ||
| 6796 | : (CHECK_NATNUM (right_width), XINT (right_width))); | ||
| 6797 | 6807 | ||
| 6798 | if (w->left_margin_cols != left || w->right_margin_cols != right) | 6808 | if (w->left_margin_cols != left || w->right_margin_cols != right) |
| 6799 | { | 6809 | { |
| @@ -6862,12 +6872,9 @@ static struct window * | |||
| 6862 | set_window_fringes (struct window *w, Lisp_Object left_width, | 6872 | set_window_fringes (struct window *w, Lisp_Object left_width, |
| 6863 | Lisp_Object right_width, Lisp_Object outside_margins) | 6873 | Lisp_Object right_width, Lisp_Object outside_margins) |
| 6864 | { | 6874 | { |
| 6865 | int left, right, outside = !NILP (outside_margins); | 6875 | bool outside = !NILP (outside_margins); |
| 6866 | 6876 | int left = extract_dimension (left_width); | |
| 6867 | left = (NILP (left_width) ? -1 | 6877 | int right = extract_dimension (right_width); |
| 6868 | : (CHECK_NATNUM (left_width), XINT (left_width))); | ||
| 6869 | right = (NILP (right_width) ? -1 | ||
| 6870 | : (CHECK_NATNUM (right_width), XINT (right_width))); | ||
| 6871 | 6878 | ||
| 6872 | /* Do nothing on a tty or if nothing to actually change. */ | 6879 | /* Do nothing on a tty or if nothing to actually change. */ |
| 6873 | if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) | 6880 | if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) |
| @@ -6947,8 +6954,8 @@ set_window_scroll_bars (struct window *w, Lisp_Object width, | |||
| 6947 | Lisp_Object vertical_type, Lisp_Object height, | 6954 | Lisp_Object vertical_type, Lisp_Object height, |
| 6948 | Lisp_Object horizontal_type) | 6955 | Lisp_Object horizontal_type) |
| 6949 | { | 6956 | { |
| 6950 | int iwidth = (NILP (width) ? -1 : (CHECK_NATNUM (width), XINT (width))); | 6957 | int iwidth = extract_dimension (width); |
| 6951 | bool changed = 0; | 6958 | bool changed = false; |
| 6952 | 6959 | ||
| 6953 | if (iwidth == 0) | 6960 | if (iwidth == 0) |
| 6954 | vertical_type = Qnil; | 6961 | vertical_type = Qnil; |
| @@ -6971,13 +6978,13 @@ set_window_scroll_bars (struct window *w, Lisp_Object width, | |||
| 6971 | { | 6978 | { |
| 6972 | w->scroll_bar_width = iwidth; | 6979 | w->scroll_bar_width = iwidth; |
| 6973 | wset_vertical_scroll_bar_type (w, vertical_type); | 6980 | wset_vertical_scroll_bar_type (w, vertical_type); |
| 6974 | changed = 1; | 6981 | changed = true; |
| 6975 | } | 6982 | } |
| 6976 | } | 6983 | } |
| 6977 | 6984 | ||
| 6978 | #if USE_HORIZONTAL_SCROLL_BARS | 6985 | #if USE_HORIZONTAL_SCROLL_BARS |
| 6979 | { | 6986 | { |
| 6980 | int iheight = (NILP (height) ? -1 : (CHECK_NATNUM (height), XINT (height))); | 6987 | int iheight = extract_dimension (height); |
| 6981 | 6988 | ||
| 6982 | if (MINI_WINDOW_P (w) || iheight == 0) | 6989 | if (MINI_WINDOW_P (w) || iheight == 0) |
| 6983 | horizontal_type = Qnil; | 6990 | horizontal_type = Qnil; |
| @@ -6999,7 +7006,7 @@ set_window_scroll_bars (struct window *w, Lisp_Object width, | |||
| 6999 | { | 7006 | { |
| 7000 | w->scroll_bar_height = iheight; | 7007 | w->scroll_bar_height = iheight; |
| 7001 | wset_horizontal_scroll_bar_type (w, horizontal_type); | 7008 | wset_horizontal_scroll_bar_type (w, horizontal_type); |
| 7002 | changed = 1; | 7009 | changed = true; |
| 7003 | } | 7010 | } |
| 7004 | } | 7011 | } |
| 7005 | } | 7012 | } |
| @@ -7122,7 +7129,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */) | |||
| 7122 | adjust_frame_glyphs (f); | 7129 | adjust_frame_glyphs (f); |
| 7123 | 7130 | ||
| 7124 | /* Prevent redisplay shortcuts. */ | 7131 | /* Prevent redisplay shortcuts. */ |
| 7125 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; | 7132 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = true; |
| 7126 | } | 7133 | } |
| 7127 | } | 7134 | } |
| 7128 | 7135 | ||
| @@ -7135,7 +7142,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */) | |||
| 7135 | additional argument USER_DATA. Stops when FN returns 0. */ | 7142 | additional argument USER_DATA. Stops when FN returns 0. */ |
| 7136 | 7143 | ||
| 7137 | static void | 7144 | static void |
| 7138 | foreach_window (struct frame *f, int (*fn) (struct window *, void *), | 7145 | foreach_window (struct frame *f, bool (*fn) (struct window *, void *), |
| 7139 | void *user_data) | 7146 | void *user_data) |
| 7140 | { | 7147 | { |
| 7141 | /* delete_frame may set FRAME_ROOT_WINDOW (f) to Qnil. */ | 7148 | /* delete_frame may set FRAME_ROOT_WINDOW (f) to Qnil. */ |
| @@ -7147,14 +7154,15 @@ foreach_window (struct frame *f, int (*fn) (struct window *, void *), | |||
| 7147 | /* Helper function for foreach_window. Call FN for all leaf windows | 7154 | /* Helper function for foreach_window. Call FN for all leaf windows |
| 7148 | reachable from W. FN is called with the first argument being a | 7155 | reachable from W. FN is called with the first argument being a |
| 7149 | pointer to the leaf window, and with additional argument USER_DATA. | 7156 | pointer to the leaf window, and with additional argument USER_DATA. |
| 7150 | Stop when FN returns 0. Value is 0 if stopped by FN. */ | 7157 | Stop when FN returns false. Value is false if stopped by FN. */ |
| 7151 | 7158 | ||
| 7152 | static int | 7159 | static bool |
| 7153 | foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *user_data) | 7160 | foreach_window_1 (struct window *w, bool (*fn) (struct window *, void *), |
| 7161 | void *user_data) | ||
| 7154 | { | 7162 | { |
| 7155 | int cont; | 7163 | bool cont; |
| 7156 | 7164 | ||
| 7157 | for (cont = 1; w && cont;) | 7165 | for (cont = true; w && cont;) |
| 7158 | { | 7166 | { |
| 7159 | if (WINDOWP (w->contents)) | 7167 | if (WINDOWP (w->contents)) |
| 7160 | cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data); | 7168 | cont = foreach_window_1 (XWINDOW (w->contents), fn, user_data); |
| @@ -7171,7 +7179,7 @@ foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *u | |||
| 7171 | Initialization | 7179 | Initialization |
| 7172 | ***********************************************************************/ | 7180 | ***********************************************************************/ |
| 7173 | 7181 | ||
| 7174 | /* Return 1 if window configurations CONFIGURATION1 and CONFIGURATION2 | 7182 | /* Return true if window configurations CONFIGURATION1 and CONFIGURATION2 |
| 7175 | describe the same state of affairs. This is used by Fequal. | 7183 | describe the same state of affairs. This is used by Fequal. |
| 7176 | 7184 | ||
| 7177 | IGNORE_POSITIONS means ignore non-matching scroll positions | 7185 | IGNORE_POSITIONS means ignore non-matching scroll positions |
| @@ -7210,7 +7218,7 @@ compare_window_configurations (Lisp_Object configuration1, | |||
| 7210 | || !EQ (d1->focus_frame, d2->focus_frame) | 7218 | || !EQ (d1->focus_frame, d2->focus_frame) |
| 7211 | /* Verify that the two configurations have the same number of windows. */ | 7219 | /* Verify that the two configurations have the same number of windows. */ |
| 7212 | || sws1->header.size != sws2->header.size) | 7220 | || sws1->header.size != sws2->header.size) |
| 7213 | return 0; | 7221 | return false; |
| 7214 | 7222 | ||
| 7215 | for (i = 0; i < sws1->header.size; i++) | 7223 | for (i = 0; i < sws1->header.size; i++) |
| 7216 | { | 7224 | { |
| @@ -7254,10 +7262,10 @@ compare_window_configurations (Lisp_Object configuration1, | |||
| 7254 | || !EQ (sw1->scroll_bar_height, sw2->scroll_bar_height) | 7262 | || !EQ (sw1->scroll_bar_height, sw2->scroll_bar_height) |
| 7255 | || !EQ (sw1->vertical_scroll_bar_type, sw2->vertical_scroll_bar_type) | 7263 | || !EQ (sw1->vertical_scroll_bar_type, sw2->vertical_scroll_bar_type) |
| 7256 | || !EQ (sw1->horizontal_scroll_bar_type, sw2->horizontal_scroll_bar_type)) | 7264 | || !EQ (sw1->horizontal_scroll_bar_type, sw2->horizontal_scroll_bar_type)) |
| 7257 | return 0; | 7265 | return false; |
| 7258 | } | 7266 | } |
| 7259 | 7267 | ||
| 7260 | return 1; | 7268 | return true; |
| 7261 | } | 7269 | } |
| 7262 | 7270 | ||
| 7263 | DEFUN ("compare-window-configurations", Fcompare_window_configurations, | 7271 | DEFUN ("compare-window-configurations", Fcompare_window_configurations, |
| @@ -7267,7 +7275,7 @@ This function ignores details such as the values of point | |||
| 7267 | and scrolling positions. */) | 7275 | and scrolling positions. */) |
| 7268 | (Lisp_Object x, Lisp_Object y) | 7276 | (Lisp_Object x, Lisp_Object y) |
| 7269 | { | 7277 | { |
| 7270 | if (compare_window_configurations (x, y, 1)) | 7278 | if (compare_window_configurations (x, y, true)) |
| 7271 | return Qt; | 7279 | return Qt; |
| 7272 | return Qnil; | 7280 | return Qnil; |
| 7273 | } | 7281 | } |