diff options
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 63 |
1 files changed, 19 insertions, 44 deletions
diff --git a/src/window.c b/src/window.c index 1331ac014ff..410015e472e 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -39,13 +39,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 39 | #include "blockinput.h" | 39 | #include "blockinput.h" |
| 40 | #include "intervals.h" | 40 | #include "intervals.h" |
| 41 | #include "termhooks.h" /* For FRAME_TERMINAL. */ | 41 | #include "termhooks.h" /* For FRAME_TERMINAL. */ |
| 42 | 42 | #ifdef HAVE_WINDOW_SYSTEM | |
| 43 | #ifdef HAVE_X_WINDOWS | 43 | #include TERM_HEADER |
| 44 | #include "xterm.h" | 44 | #endif /* HAVE_WINDOW_SYSTEM */ |
| 45 | #endif /* HAVE_X_WINDOWS */ | ||
| 46 | #ifdef HAVE_NTGUI | ||
| 47 | #include "w32term.h" | ||
| 48 | #endif | ||
| 49 | #ifdef MSDOS | 45 | #ifdef MSDOS |
| 50 | #include "msdos.h" | 46 | #include "msdos.h" |
| 51 | #endif | 47 | #endif |
| @@ -552,15 +548,7 @@ select_window_1 (Lisp_Object window, bool inhibit_point_swap) | |||
| 552 | than one window. It also matters when | 548 | than one window. It also matters when |
| 553 | redisplay_window has altered point after scrolling, | 549 | redisplay_window has altered point after scrolling, |
| 554 | because it makes the change only in the window. */ | 550 | because it makes the change only in the window. */ |
| 555 | { | 551 | set_point_from_marker (XWINDOW (window)->pointm); |
| 556 | register ptrdiff_t new_point = marker_position (XWINDOW (window)->pointm); | ||
| 557 | if (new_point < BEGV) | ||
| 558 | SET_PT (BEGV); | ||
| 559 | else if (new_point > ZV) | ||
| 560 | SET_PT (ZV); | ||
| 561 | else | ||
| 562 | SET_PT (new_point); | ||
| 563 | } | ||
| 564 | } | 552 | } |
| 565 | 553 | ||
| 566 | DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, | 554 | DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, |
| @@ -1505,7 +1493,6 @@ if it isn't already recorded. */) | |||
| 1505 | && !noninteractive) | 1493 | && !noninteractive) |
| 1506 | { | 1494 | { |
| 1507 | struct text_pos startp; | 1495 | struct text_pos startp; |
| 1508 | ptrdiff_t charpos = marker_position (w->start); | ||
| 1509 | struct it it; | 1496 | struct it it; |
| 1510 | struct buffer *old_buffer = NULL; | 1497 | struct buffer *old_buffer = NULL; |
| 1511 | void *itdata = NULL; | 1498 | void *itdata = NULL; |
| @@ -1523,12 +1510,7 @@ if it isn't already recorded. */) | |||
| 1523 | `-l' containing a call to `rmail' with subsequent other | 1510 | `-l' containing a call to `rmail' with subsequent other |
| 1524 | commands. At the end, W->start happened to be BEG, while | 1511 | commands. At the end, W->start happened to be BEG, while |
| 1525 | rmail had already narrowed the buffer. */ | 1512 | rmail had already narrowed the buffer. */ |
| 1526 | if (charpos < BEGV) | 1513 | CLIP_TEXT_POS_FROM_MARKER (startp, w->start); |
| 1527 | SET_TEXT_POS (startp, BEGV, BEGV_BYTE); | ||
| 1528 | else if (charpos > ZV) | ||
| 1529 | SET_TEXT_POS (startp, ZV, ZV_BYTE); | ||
| 1530 | else | ||
| 1531 | SET_TEXT_POS_FROM_MARKER (startp, w->start); | ||
| 1532 | 1514 | ||
| 1533 | itdata = bidi_shelve_cache (); | 1515 | itdata = bidi_shelve_cache (); |
| 1534 | start_display (&it, w, startp); | 1516 | start_display (&it, w, startp); |
| @@ -2969,7 +2951,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2969 | } | 2951 | } |
| 2970 | } | 2952 | } |
| 2971 | 2953 | ||
| 2972 | adjust_glyphs (f); | 2954 | adjust_frame_glyphs (f); |
| 2973 | unblock_input (); | 2955 | unblock_input (); |
| 2974 | 2956 | ||
| 2975 | run_window_configuration_change_hook (f); | 2957 | run_window_configuration_change_hook (f); |
| @@ -3352,10 +3334,8 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3352 | 3334 | ||
| 3353 | if (!NILP (Vtemp_buffer_show_function)) | 3335 | if (!NILP (Vtemp_buffer_show_function)) |
| 3354 | call1 (Vtemp_buffer_show_function, buf); | 3336 | call1 (Vtemp_buffer_show_function, buf); |
| 3355 | else | 3337 | else if (WINDOW_LIVE_P (window = display_buffer (buf, Qnil, Qnil))) |
| 3356 | { | 3338 | { |
| 3357 | window = display_buffer (buf, Qnil, Qnil); | ||
| 3358 | |||
| 3359 | if (!EQ (XWINDOW (window)->frame, selected_frame)) | 3339 | if (!EQ (XWINDOW (window)->frame, selected_frame)) |
| 3360 | Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); | 3340 | Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
| 3361 | Vminibuf_scroll_window = window; | 3341 | Vminibuf_scroll_window = window; |
| @@ -3445,6 +3425,7 @@ make_window (void) | |||
| 3445 | non-Lisp data, so do it only for slots which should not be zero. */ | 3425 | non-Lisp data, so do it only for slots which should not be zero. */ |
| 3446 | w->nrows_scale_factor = w->ncols_scale_factor = 1; | 3426 | w->nrows_scale_factor = w->ncols_scale_factor = 1; |
| 3447 | w->left_fringe_width = w->right_fringe_width = -1; | 3427 | w->left_fringe_width = w->right_fringe_width = -1; |
| 3428 | w->mode_line_height = w->header_line_height = -1; | ||
| 3448 | w->phys_cursor_type = -1; | 3429 | w->phys_cursor_type = -1; |
| 3449 | w->phys_cursor_width = -1; | 3430 | w->phys_cursor_width = -1; |
| 3450 | w->scroll_bar_width = -1; | 3431 | w->scroll_bar_width = -1; |
| @@ -3670,7 +3651,7 @@ be applied on the Elisp level. */) | |||
| 3670 | windows_or_buffers_changed++; | 3651 | windows_or_buffers_changed++; |
| 3671 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 3652 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 3672 | 3653 | ||
| 3673 | adjust_glyphs (f); | 3654 | adjust_frame_glyphs (f); |
| 3674 | unblock_input (); | 3655 | unblock_input (); |
| 3675 | 3656 | ||
| 3676 | run_window_configuration_change_hook (f); | 3657 | run_window_configuration_change_hook (f); |
| @@ -3940,7 +3921,7 @@ set correctly. See the code of `split-window' for how this is done. */) | |||
| 3940 | 3921 | ||
| 3941 | block_input (); | 3922 | block_input (); |
| 3942 | window_resize_apply (p, horflag); | 3923 | window_resize_apply (p, horflag); |
| 3943 | adjust_glyphs (f); | 3924 | adjust_frame_glyphs (f); |
| 3944 | /* Set buffer of NEW to buffer of reference window. Don't run | 3925 | /* Set buffer of NEW to buffer of reference window. Don't run |
| 3945 | any hooks. */ | 3926 | any hooks. */ |
| 3946 | set_window_buffer (new, r->contents, 0, 1); | 3927 | set_window_buffer (new, r->contents, 0, 1); |
| @@ -4072,7 +4053,7 @@ Signal an error when WINDOW is the only window on its frame. */) | |||
| 4072 | recombine_windows (sibling); | 4053 | recombine_windows (sibling); |
| 4073 | } | 4054 | } |
| 4074 | 4055 | ||
| 4075 | adjust_glyphs (f); | 4056 | adjust_frame_glyphs (f); |
| 4076 | 4057 | ||
| 4077 | if (!WINDOW_LIVE_P (FRAME_SELECTED_WINDOW (f))) | 4058 | if (!WINDOW_LIVE_P (FRAME_SELECTED_WINDOW (f))) |
| 4078 | /* We deleted the frame's selected window. */ | 4059 | /* We deleted the frame's selected window. */ |
| @@ -4159,7 +4140,7 @@ grow_mini_window (struct window *w, int delta) | |||
| 4159 | w->total_lines -= XINT (value); | 4140 | w->total_lines -= XINT (value); |
| 4160 | /* Enforce full redisplay. FIXME: make it more selective. */ | 4141 | /* Enforce full redisplay. FIXME: make it more selective. */ |
| 4161 | windows_or_buffers_changed++; | 4142 | windows_or_buffers_changed++; |
| 4162 | adjust_glyphs (f); | 4143 | adjust_frame_glyphs (f); |
| 4163 | unblock_input (); | 4144 | unblock_input (); |
| 4164 | } | 4145 | } |
| 4165 | } | 4146 | } |
| @@ -4193,7 +4174,7 @@ shrink_mini_window (struct window *w) | |||
| 4193 | w->total_lines = 1; | 4174 | w->total_lines = 1; |
| 4194 | /* Enforce full redisplay. FIXME: make it more selective. */ | 4175 | /* Enforce full redisplay. FIXME: make it more selective. */ |
| 4195 | windows_or_buffers_changed++; | 4176 | windows_or_buffers_changed++; |
| 4196 | adjust_glyphs (f); | 4177 | adjust_frame_glyphs (f); |
| 4197 | unblock_input (); | 4178 | unblock_input (); |
| 4198 | } | 4179 | } |
| 4199 | /* If the above failed for whatever strange reason we must make a | 4180 | /* If the above failed for whatever strange reason we must make a |
| @@ -4234,7 +4215,7 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini | |||
| 4234 | 4215 | ||
| 4235 | windows_or_buffers_changed++; | 4216 | windows_or_buffers_changed++; |
| 4236 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; | 4217 | FRAME_WINDOW_SIZES_CHANGED (f) = 1; |
| 4237 | adjust_glyphs (f); | 4218 | adjust_frame_glyphs (f); |
| 4238 | unblock_input (); | 4219 | unblock_input (); |
| 4239 | 4220 | ||
| 4240 | run_window_configuration_change_hook (f); | 4221 | run_window_configuration_change_hook (f); |
| @@ -4505,7 +4486,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, bool whole, int noerror) | |||
| 4505 | visible. */ | 4486 | visible. */ |
| 4506 | w->vscroll = (it.last_visible_y | 4487 | w->vscroll = (it.last_visible_y |
| 4507 | - it.current_y + it.max_ascent + it.max_descent); | 4488 | - it.current_y + it.max_ascent + it.max_descent); |
| 4508 | adjust_glyphs (it.f); | 4489 | adjust_frame_glyphs (it.f); |
| 4509 | } | 4490 | } |
| 4510 | else | 4491 | else |
| 4511 | { | 4492 | { |
| @@ -5054,7 +5035,6 @@ displayed_window_lines (struct window *w) | |||
| 5054 | { | 5035 | { |
| 5055 | struct it it; | 5036 | struct it it; |
| 5056 | struct text_pos start; | 5037 | struct text_pos start; |
| 5057 | ptrdiff_t charpos = marker_position (w->start); | ||
| 5058 | int height = window_box_height (w); | 5038 | int height = window_box_height (w); |
| 5059 | struct buffer *old_buffer; | 5039 | struct buffer *old_buffer; |
| 5060 | int bottom_y; | 5040 | int bottom_y; |
| @@ -5071,12 +5051,7 @@ displayed_window_lines (struct window *w) | |||
| 5071 | /* In case W->start is out of the accessible range, do something | 5051 | /* In case W->start is out of the accessible range, do something |
| 5072 | reasonable. This happens in Info mode when Info-scroll-down | 5052 | reasonable. This happens in Info mode when Info-scroll-down |
| 5073 | calls (recenter -1) while W->start is 1. */ | 5053 | calls (recenter -1) while W->start is 1. */ |
| 5074 | if (charpos < BEGV) | 5054 | CLIP_TEXT_POS_FROM_MARKER (start, w->start); |
| 5075 | SET_TEXT_POS (start, BEGV, BEGV_BYTE); | ||
| 5076 | else if (charpos > ZV) | ||
| 5077 | SET_TEXT_POS (start, ZV, ZV_BYTE); | ||
| 5078 | else | ||
| 5079 | SET_TEXT_POS_FROM_MARKER (start, w->start); | ||
| 5080 | 5055 | ||
| 5081 | itdata = bidi_shelve_cache (); | 5056 | itdata = bidi_shelve_cache (); |
| 5082 | start_display (&it, w, start); | 5057 | start_display (&it, w, start); |
| @@ -5788,7 +5763,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5788 | ++n; | 5763 | ++n; |
| 5789 | } | 5764 | } |
| 5790 | 5765 | ||
| 5791 | adjust_glyphs (f); | 5766 | adjust_frame_glyphs (f); |
| 5792 | unblock_input (); | 5767 | unblock_input (); |
| 5793 | 5768 | ||
| 5794 | /* Scan dead buffer windows. */ | 5769 | /* Scan dead buffer windows. */ |
| @@ -6117,7 +6092,7 @@ apply_window_adjustment (struct window *w) | |||
| 6117 | clear_glyph_matrix (w->current_matrix); | 6092 | clear_glyph_matrix (w->current_matrix); |
| 6118 | w->window_end_valid = 0; | 6093 | w->window_end_valid = 0; |
| 6119 | windows_or_buffers_changed++; | 6094 | windows_or_buffers_changed++; |
| 6120 | adjust_glyphs (XFRAME (WINDOW_FRAME (w))); | 6095 | adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w))); |
| 6121 | } | 6096 | } |
| 6122 | 6097 | ||
| 6123 | 6098 | ||
| @@ -6383,7 +6358,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */) | |||
| 6383 | /* Adjust glyph matrix of the frame if the virtual display | 6358 | /* Adjust glyph matrix of the frame if the virtual display |
| 6384 | area becomes larger than before. */ | 6359 | area becomes larger than before. */ |
| 6385 | if (w->vscroll < 0 && w->vscroll < old_dy) | 6360 | if (w->vscroll < 0 && w->vscroll < old_dy) |
| 6386 | adjust_glyphs (f); | 6361 | adjust_frame_glyphs (f); |
| 6387 | 6362 | ||
| 6388 | /* Prevent redisplay shortcuts. */ | 6363 | /* Prevent redisplay shortcuts. */ |
| 6389 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; | 6364 | XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; |