diff options
| author | Joakim Verona | 2012-05-30 14:08:12 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-05-30 14:08:12 +0200 |
| commit | 70700d8c47a35b19e29607ac5f0ed322bdd78249 (patch) | |
| tree | 4fa00d3fac00025354f0b6e23dcda1b58689a094 /src/window.c | |
| parent | 44fce8ffe7198991c41c985ff4e67ec7d407907e (diff) | |
| parent | 72cb32cf2f0938dd7dc733eed77b1ed1e497b053 (diff) | |
| download | emacs-70700d8c47a35b19e29607ac5f0ed322bdd78249.tar.gz emacs-70700d8c47a35b19e29607ac5f0ed322bdd78249.zip | |
upstream
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 58 |
1 files changed, 30 insertions, 28 deletions
diff --git a/src/window.c b/src/window.c index 827d3646e49..a10222b1aff 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -65,7 +65,7 @@ static int displayed_window_lines (struct window *); | |||
| 65 | static struct window *decode_window (Lisp_Object); | 65 | static struct window *decode_window (Lisp_Object); |
| 66 | static int count_windows (struct window *); | 66 | static int count_windows (struct window *); |
| 67 | static int get_leaf_windows (struct window *, struct window **, int); | 67 | static int get_leaf_windows (struct window *, struct window **, int); |
| 68 | static void window_scroll (Lisp_Object, int, int, int); | 68 | static void window_scroll (Lisp_Object, EMACS_INT, int, int); |
| 69 | static void window_scroll_pixel_based (Lisp_Object, int, int, int); | 69 | static void window_scroll_pixel_based (Lisp_Object, int, int, int); |
| 70 | static void window_scroll_line_based (Lisp_Object, int, int, int); | 70 | static void window_scroll_line_based (Lisp_Object, int, int, int); |
| 71 | static int freeze_window_start (struct window *, void *); | 71 | static int freeze_window_start (struct window *, void *); |
| @@ -129,8 +129,8 @@ static int window_scroll_pixel_based_preserve_x; | |||
| 129 | static int window_scroll_pixel_based_preserve_y; | 129 | static int window_scroll_pixel_based_preserve_y; |
| 130 | 130 | ||
| 131 | /* Same for window_scroll_line_based. */ | 131 | /* Same for window_scroll_line_based. */ |
| 132 | static int window_scroll_preserve_hpos; | 132 | static EMACS_INT window_scroll_preserve_hpos; |
| 133 | static int window_scroll_preserve_vpos; | 133 | static EMACS_INT window_scroll_preserve_vpos; |
| 134 | 134 | ||
| 135 | static struct window * | 135 | static struct window * |
| 136 | decode_window (register Lisp_Object window) | 136 | decode_window (register Lisp_Object window) |
| @@ -380,7 +380,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) | |||
| 380 | redisplay_window has altered point after scrolling, | 380 | redisplay_window has altered point after scrolling, |
| 381 | because it makes the change only in the window. */ | 381 | because it makes the change only in the window. */ |
| 382 | { | 382 | { |
| 383 | register EMACS_INT new_point = marker_position (w->pointm); | 383 | register ptrdiff_t new_point = marker_position (w->pointm); |
| 384 | if (new_point < BEGV) | 384 | if (new_point < BEGV) |
| 385 | SET_PT (BEGV); | 385 | SET_PT (BEGV); |
| 386 | else if (new_point > ZV) | 386 | else if (new_point > ZV) |
| @@ -682,10 +682,10 @@ window so that the location of point moves off-window. */) | |||
| 682 | (Lisp_Object window, Lisp_Object ncol) | 682 | (Lisp_Object window, Lisp_Object ncol) |
| 683 | { | 683 | { |
| 684 | struct window *w = decode_window (window); | 684 | struct window *w = decode_window (window); |
| 685 | int hscroll; | 685 | ptrdiff_t hscroll; |
| 686 | 686 | ||
| 687 | CHECK_NUMBER (ncol); | 687 | CHECK_NUMBER (ncol); |
| 688 | hscroll = max (0, XINT (ncol)); | 688 | hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX); |
| 689 | 689 | ||
| 690 | /* Prevent redisplay shortcuts when changing the hscroll. */ | 690 | /* Prevent redisplay shortcuts when changing the hscroll. */ |
| 691 | if (XINT (w->hscroll) != hscroll) | 691 | if (XINT (w->hscroll) != hscroll) |
| @@ -1497,7 +1497,8 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1497 | register struct window *w; | 1497 | register struct window *w; |
| 1498 | register struct buffer *b; | 1498 | register struct buffer *b; |
| 1499 | struct glyph_row *row, *end_row; | 1499 | struct glyph_row *row, *end_row; |
| 1500 | int max_y, crop, i, n; | 1500 | int max_y, crop, i; |
| 1501 | EMACS_INT n; | ||
| 1501 | 1502 | ||
| 1502 | w = decode_window (window); | 1503 | w = decode_window (window); |
| 1503 | 1504 | ||
| @@ -2565,7 +2566,7 @@ window-start value is reasonable when this function is called. */) | |||
| 2565 | struct window *w, *r, *s; | 2566 | struct window *w, *r, *s; |
| 2566 | struct frame *f; | 2567 | struct frame *f; |
| 2567 | Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; | 2568 | Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta; |
| 2568 | EMACS_INT startpos IF_LINT (= 0); | 2569 | ptrdiff_t startpos IF_LINT (= 0); |
| 2569 | int top IF_LINT (= 0), new_top, resize_failed; | 2570 | int top IF_LINT (= 0), new_top, resize_failed; |
| 2570 | Mouse_HLInfo *hlinfo; | 2571 | Mouse_HLInfo *hlinfo; |
| 2571 | 2572 | ||
| @@ -2906,7 +2907,7 @@ select_frame_norecord (Lisp_Object frame) | |||
| 2906 | void | 2907 | void |
| 2907 | run_window_configuration_change_hook (struct frame *f) | 2908 | run_window_configuration_change_hook (struct frame *f) |
| 2908 | { | 2909 | { |
| 2909 | int count = SPECPDL_INDEX (); | 2910 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2910 | Lisp_Object frame, global_wcch | 2911 | Lisp_Object frame, global_wcch |
| 2911 | = Fdefault_value (Qwindow_configuration_change_hook); | 2912 | = Fdefault_value (Qwindow_configuration_change_hook); |
| 2912 | XSETFRAME (frame, f); | 2913 | XSETFRAME (frame, f); |
| @@ -2937,7 +2938,7 @@ run_window_configuration_change_hook (struct frame *f) | |||
| 2937 | if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook, | 2938 | if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook, |
| 2938 | buffer))) | 2939 | buffer))) |
| 2939 | { | 2940 | { |
| 2940 | int inner_count = SPECPDL_INDEX (); | 2941 | ptrdiff_t inner_count = SPECPDL_INDEX (); |
| 2941 | record_unwind_protect (select_window_norecord, Fselected_window ()); | 2942 | record_unwind_protect (select_window_norecord, Fselected_window ()); |
| 2942 | select_window_norecord (window); | 2943 | select_window_norecord (window); |
| 2943 | run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook, | 2944 | run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook, |
| @@ -2972,7 +2973,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int | |||
| 2972 | { | 2973 | { |
| 2973 | struct window *w = XWINDOW (window); | 2974 | struct window *w = XWINDOW (window); |
| 2974 | struct buffer *b = XBUFFER (buffer); | 2975 | struct buffer *b = XBUFFER (buffer); |
| 2975 | int count = SPECPDL_INDEX (); | 2976 | ptrdiff_t count = SPECPDL_INDEX (); |
| 2976 | int samebuf = EQ (buffer, w->buffer); | 2977 | int samebuf = EQ (buffer, w->buffer); |
| 2977 | 2978 | ||
| 2978 | w->buffer = buffer; | 2979 | w->buffer = buffer; |
| @@ -3203,7 +3204,7 @@ temp_output_buffer_show (register Lisp_Object buf) | |||
| 3203 | /* Run temp-buffer-show-hook, with the chosen window selected | 3204 | /* Run temp-buffer-show-hook, with the chosen window selected |
| 3204 | and its buffer current. */ | 3205 | and its buffer current. */ |
| 3205 | { | 3206 | { |
| 3206 | int count = SPECPDL_INDEX (); | 3207 | ptrdiff_t count = SPECPDL_INDEX (); |
| 3207 | Lisp_Object prev_window, prev_buffer; | 3208 | Lisp_Object prev_window, prev_buffer; |
| 3208 | prev_window = selected_window; | 3209 | prev_window = selected_window; |
| 3209 | XSETBUFFER (prev_buffer, old); | 3210 | XSETBUFFER (prev_buffer, old); |
| @@ -4194,9 +4195,10 @@ window_internal_height (struct window *w) | |||
| 4194 | respectively. */ | 4195 | respectively. */ |
| 4195 | 4196 | ||
| 4196 | static void | 4197 | static void |
| 4197 | window_scroll (Lisp_Object window, int n, int whole, int noerror) | 4198 | window_scroll (Lisp_Object window, EMACS_INT n, int whole, int noerror) |
| 4198 | { | 4199 | { |
| 4199 | immediate_quit = 1; | 4200 | immediate_quit = 1; |
| 4201 | n = clip_to_bounds (INT_MIN, n, INT_MAX); | ||
| 4200 | 4202 | ||
| 4201 | /* If we must, use the pixel-based version which is much slower than | 4203 | /* If we must, use the pixel-based version which is much slower than |
| 4202 | the line-based one but can handle varying line heights. */ | 4204 | the line-based one but can handle varying line heights. */ |
| @@ -4297,7 +4299,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4297 | /* Maybe modify window start instead of scrolling. */ | 4299 | /* Maybe modify window start instead of scrolling. */ |
| 4298 | if (rbot > 0 || w->vscroll < 0) | 4300 | if (rbot > 0 || w->vscroll < 0) |
| 4299 | { | 4301 | { |
| 4300 | EMACS_INT spos; | 4302 | ptrdiff_t spos; |
| 4301 | 4303 | ||
| 4302 | Fset_window_vscroll (window, make_number (0), Qt); | 4304 | Fset_window_vscroll (window, make_number (0), Qt); |
| 4303 | /* If there are other text lines above the current row, | 4305 | /* If there are other text lines above the current row, |
| @@ -4352,7 +4354,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4352 | start_display (&it, w, start); | 4354 | start_display (&it, w, start); |
| 4353 | if (whole) | 4355 | if (whole) |
| 4354 | { | 4356 | { |
| 4355 | EMACS_INT start_pos = IT_CHARPOS (it); | 4357 | ptrdiff_t start_pos = IT_CHARPOS (it); |
| 4356 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); | 4358 | int dy = WINDOW_FRAME_LINE_HEIGHT (w); |
| 4357 | dy = max ((window_box_height (w) | 4359 | dy = max ((window_box_height (w) |
| 4358 | - next_screen_context_lines * dy), | 4360 | - next_screen_context_lines * dy), |
| @@ -4439,8 +4441,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4439 | 4441 | ||
| 4440 | if (! vscrolled) | 4442 | if (! vscrolled) |
| 4441 | { | 4443 | { |
| 4442 | EMACS_INT pos = IT_CHARPOS (it); | 4444 | ptrdiff_t pos = IT_CHARPOS (it); |
| 4443 | EMACS_INT bytepos; | 4445 | ptrdiff_t bytepos; |
| 4444 | 4446 | ||
| 4445 | /* If in the middle of a multi-glyph character move forward to | 4447 | /* If in the middle of a multi-glyph character move forward to |
| 4446 | the next character. */ | 4448 | the next character. */ |
| @@ -4510,7 +4512,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4510 | } | 4512 | } |
| 4511 | else if (n < 0) | 4513 | else if (n < 0) |
| 4512 | { | 4514 | { |
| 4513 | EMACS_INT charpos, bytepos; | 4515 | ptrdiff_t charpos, bytepos; |
| 4514 | int partial_p; | 4516 | int partial_p; |
| 4515 | 4517 | ||
| 4516 | /* Save our position, for the | 4518 | /* Save our position, for the |
| @@ -4587,12 +4589,12 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4587 | in `grep-mode-font-lock-keywords'). So we use a marker to record | 4589 | in `grep-mode-font-lock-keywords'). So we use a marker to record |
| 4588 | the old point position, to prevent crashes in SET_PT_BOTH. */ | 4590 | the old point position, to prevent crashes in SET_PT_BOTH. */ |
| 4589 | Lisp_Object opoint_marker = Fpoint_marker (); | 4591 | Lisp_Object opoint_marker = Fpoint_marker (); |
| 4590 | register EMACS_INT pos, pos_byte; | 4592 | register ptrdiff_t pos, pos_byte; |
| 4591 | register int ht = window_internal_height (w); | 4593 | register int ht = window_internal_height (w); |
| 4592 | register Lisp_Object tem; | 4594 | register Lisp_Object tem; |
| 4593 | int lose; | 4595 | int lose; |
| 4594 | Lisp_Object bolp; | 4596 | Lisp_Object bolp; |
| 4595 | EMACS_INT startpos; | 4597 | ptrdiff_t startpos; |
| 4596 | Lisp_Object original_pos = Qnil; | 4598 | Lisp_Object original_pos = Qnil; |
| 4597 | 4599 | ||
| 4598 | /* If scrolling screen-fulls, compute the number of lines to | 4600 | /* If scrolling screen-fulls, compute the number of lines to |
| @@ -4741,7 +4743,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) | |||
| 4741 | static void | 4743 | static void |
| 4742 | scroll_command (Lisp_Object n, int direction) | 4744 | scroll_command (Lisp_Object n, int direction) |
| 4743 | { | 4745 | { |
| 4744 | int count = SPECPDL_INDEX (); | 4746 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4745 | 4747 | ||
| 4746 | xassert (eabs (direction) == 1); | 4748 | xassert (eabs (direction) == 1); |
| 4747 | 4749 | ||
| @@ -4856,7 +4858,7 @@ specifies the window to scroll. This takes precedence over | |||
| 4856 | { | 4858 | { |
| 4857 | Lisp_Object window; | 4859 | Lisp_Object window; |
| 4858 | struct window *w; | 4860 | struct window *w; |
| 4859 | int count = SPECPDL_INDEX (); | 4861 | ptrdiff_t count = SPECPDL_INDEX (); |
| 4860 | 4862 | ||
| 4861 | window = Fother_window_for_scrolling (); | 4863 | window = Fother_window_for_scrolling (); |
| 4862 | w = XWINDOW (window); | 4864 | w = XWINDOW (window); |
| @@ -4898,7 +4900,7 @@ by this function. This happens in an interactive call. */) | |||
| 4898 | (register Lisp_Object arg, Lisp_Object set_minimum) | 4900 | (register Lisp_Object arg, Lisp_Object set_minimum) |
| 4899 | { | 4901 | { |
| 4900 | Lisp_Object result; | 4902 | Lisp_Object result; |
| 4901 | int hscroll; | 4903 | EMACS_INT hscroll; |
| 4902 | struct window *w = XWINDOW (selected_window); | 4904 | struct window *w = XWINDOW (selected_window); |
| 4903 | 4905 | ||
| 4904 | if (NILP (arg)) | 4906 | if (NILP (arg)) |
| @@ -4927,7 +4929,7 @@ by this function. This happens in an interactive call. */) | |||
| 4927 | (register Lisp_Object arg, Lisp_Object set_minimum) | 4929 | (register Lisp_Object arg, Lisp_Object set_minimum) |
| 4928 | { | 4930 | { |
| 4929 | Lisp_Object result; | 4931 | Lisp_Object result; |
| 4930 | int hscroll; | 4932 | EMACS_INT hscroll; |
| 4931 | struct window *w = XWINDOW (selected_window); | 4933 | struct window *w = XWINDOW (selected_window); |
| 4932 | 4934 | ||
| 4933 | if (NILP (arg)) | 4935 | if (NILP (arg)) |
| @@ -5038,7 +5040,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5038 | struct buffer *buf = XBUFFER (w->buffer); | 5040 | struct buffer *buf = XBUFFER (w->buffer); |
| 5039 | struct buffer *obuf = current_buffer; | 5041 | struct buffer *obuf = current_buffer; |
| 5040 | int center_p = 0; | 5042 | int center_p = 0; |
| 5041 | EMACS_INT charpos, bytepos; | 5043 | ptrdiff_t charpos, bytepos; |
| 5042 | EMACS_INT iarg IF_LINT (= 0); | 5044 | EMACS_INT iarg IF_LINT (= 0); |
| 5043 | int this_scroll_margin; | 5045 | int this_scroll_margin; |
| 5044 | 5046 | ||
| @@ -5103,7 +5105,7 @@ and redisplay normally--don't erase and redraw the frame. */) | |||
| 5103 | { | 5105 | { |
| 5104 | struct it it; | 5106 | struct it it; |
| 5105 | struct text_pos pt; | 5107 | struct text_pos pt; |
| 5106 | int nlines = min (INT_MAX, -iarg); | 5108 | ptrdiff_t nlines = min (PTRDIFF_MAX, -iarg); |
| 5107 | int extra_line_spacing; | 5109 | int extra_line_spacing; |
| 5108 | int h = window_box_height (w); | 5110 | int h = window_box_height (w); |
| 5109 | void *itdata = bidi_shelve_cache (); | 5111 | void *itdata = bidi_shelve_cache (); |
| @@ -5387,7 +5389,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 5387 | Lisp_Object frame; | 5389 | Lisp_Object frame; |
| 5388 | Lisp_Object auto_buffer_name; | 5390 | Lisp_Object auto_buffer_name; |
| 5389 | FRAME_PTR f; | 5391 | FRAME_PTR f; |
| 5390 | EMACS_INT old_point = -1; | 5392 | ptrdiff_t old_point = -1; |
| 5391 | 5393 | ||
| 5392 | CHECK_WINDOW_CONFIGURATION (configuration); | 5394 | CHECK_WINDOW_CONFIGURATION (configuration); |
| 5393 | 5395 | ||
| @@ -6192,7 +6194,7 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */) | |||
| 6192 | 6194 | ||
| 6193 | if (!NILP (width)) | 6195 | if (!NILP (width)) |
| 6194 | { | 6196 | { |
| 6195 | CHECK_NATNUM (width); | 6197 | CHECK_RANGED_INTEGER (0, width, INT_MAX); |
| 6196 | 6198 | ||
| 6197 | if (XINT (width) == 0) | 6199 | if (XINT (width) == 0) |
| 6198 | vertical_type = Qnil; | 6200 | vertical_type = Qnil; |