summaryrefslogtreecommitdiff
path: root/src/window.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-06-28 16:29:37 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-06-28 16:29:37 +0400
commit80b00b0885b8e124a208dfc9de95d2039a101108 (patch)
tree8954c62ff23338f8a2c6063cccab6d40d8707e02 /src/window.c
parent62b2bcf611f144f4dea5a073a362e187970609f6 (diff)
downloademacs-80b00b0885b8e124a208dfc9de95d2039a101108.tar.gz
* window.h (struct window): Change type of 'hscroll',
'min_hscroll' and 'last_point' from Lisp_Object to ptrdiff_t, 'last_modified' and 'last_overlay_modified' to EMACS_INT. Adjust users accordingly. * xdisp.c (try_cursor_movement): Replace type check with eassert. * window.c (Fscroll_left, Fscroll_right): Change type of 'hscroll' from EMACS_INT to ptrdiff_t. (make_window): Omit redundant initialization.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c81
1 files changed, 39 insertions, 42 deletions
diff --git a/src/window.c b/src/window.c
index 55d6ac7a6ee..4f3d40c51e3 100644
--- a/src/window.c
+++ b/src/window.c
@@ -667,7 +667,7 @@ DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
WINDOW must be a live window and defaults to the selected one. */)
(Lisp_Object window)
{
- return decode_window (window)->hscroll;
+ return make_number (decode_window (window)->hscroll);
}
DEFUN ("set-window-hscroll", Fset_window_hscroll, Sset_window_hscroll, 2, 2, 0,
@@ -686,10 +686,10 @@ window so that the location of point moves off-window. */)
hscroll = clip_to_bounds (0, XINT (ncol), PTRDIFF_MAX);
/* Prevent redisplay shortcuts when changing the hscroll. */
- if (XINT (w->hscroll) != hscroll)
+ if (w->hscroll != hscroll)
XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1;
- w->hscroll = make_number (hscroll);
+ w->hscroll = hscroll;
return ncol;
}
@@ -1313,8 +1313,8 @@ if it isn't already recorded. */)
if (! NILP (update)
&& ! (! NILP (w->window_end_valid)
- && XFASTINT (w->last_modified) >= BUF_MODIFF (b)
- && XFASTINT (w->last_overlay_modified) >= BUF_OVERLAY_MODIFF (b))
+ && w->last_modified >= BUF_MODIFF (b)
+ && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b))
&& !noninteractive)
{
struct text_pos startp;
@@ -1397,8 +1397,8 @@ overriding motion of point in order to display at this exact start. */)
if (NILP (noforce))
w->force_start = 1;
w->update_mode_line = 1;
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->last_overlay_modified, 0);
+ w->last_modified = 0;
+ w->last_overlay_modified = 0;
if (!EQ (window, selected_window))
windows_or_buffers_changed++;
@@ -1510,8 +1510,8 @@ Return nil if window display is not up-to-date. In that case, use
if (NILP (w->window_end_valid)
|| current_buffer->clip_changed
|| current_buffer->prevent_redisplay_optimizations_p
- || XFASTINT (w->last_modified) < BUF_MODIFF (b)
- || XFASTINT (w->last_overlay_modified) < BUF_OVERLAY_MODIFF (b))
+ || w->last_modified < BUF_MODIFF (b)
+ || w->last_overlay_modified < BUF_OVERLAY_MODIFF (b))
return Qnil;
if (NILP (line))
@@ -3002,7 +3002,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
Resetting hscroll and vscroll here is problematic for things like
image-mode and doc-view-mode since it resets the image's position
whenever we resize the frame. */
- w->hscroll = w->min_hscroll = make_number (0);
+ w->hscroll = w->min_hscroll = 0;
w->vscroll = 0;
set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b));
set_marker_restricted (w->start,
@@ -3010,8 +3010,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
buffer);
w->start_at_line_beg = 0;
w->force_start = 0;
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->last_overlay_modified, 0);
+ w->last_modified = 0;
+ w->last_overlay_modified = 0;
}
/* Maybe we could move this into the `if' but it's not obviously safe and
I doubt it's worth the trouble. */
@@ -3196,8 +3196,8 @@ temp_output_buffer_show (register Lisp_Object buf)
Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window)));
Vminibuf_scroll_window = window;
w = XWINDOW (window);
- XSETFASTINT (w->hscroll, 0);
- XSETFASTINT (w->min_hscroll, 0);
+ w->hscroll = 0;
+ w->min_hscroll = 0;
set_marker_restricted_both (w->start, buf, BEG, BEG);
set_marker_restricted_both (w->pointm, buf, BEG, BEG);
@@ -3286,9 +3286,6 @@ make_window (void)
XSETFASTINT (w->new_normal, 0);
w->start = Fmake_marker ();
w->pointm = Fmake_marker ();
- XSETFASTINT (w->hscroll, 0);
- XSETFASTINT (w->min_hscroll, 0);
- XSETFASTINT (w->last_point, 0);
w->vertical_scroll_bar_type = Qt;
XSETFASTINT (w->window_end_pos, 0);
XSETFASTINT (w->window_end_vpos, 0);
@@ -3488,8 +3485,8 @@ window_resize_apply (struct window *w, int horflag)
}
/* Clear out some redisplay caches. */
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->last_overlay_modified, 0);
+ w->last_modified = 0;
+ w->last_overlay_modified = 0;
}
@@ -4021,8 +4018,8 @@ grow_mini_window (struct window *w, int delta)
/* Grow the mini-window. */
XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value));
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->last_overlay_modified, 0);
+ w->last_modified = 0;
+ w->last_overlay_modified = 0;
adjust_glyphs (f);
UNBLOCK_INPUT;
@@ -4057,8 +4054,8 @@ shrink_mini_window (struct window *w)
XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines));
XSETFASTINT (w->total_lines, 1);
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->last_overlay_modified, 0);
+ w->last_modified = 0;
+ w->last_overlay_modified = 0;
adjust_glyphs (f);
UNBLOCK_INPUT;
@@ -4285,8 +4282,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
w->buffer);
w->start_at_line_beg = 1;
w->update_mode_line = 1;
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->last_overlay_modified, 0);
+ w->last_modified = 0;
+ w->last_overlay_modified = 0;
/* Set force_start so that redisplay_window will run the
window-scroll-functions. */
w->force_start = 1;
@@ -4431,8 +4428,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror)
bytepos = XMARKER (w->start)->bytepos;
w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n');
w->update_mode_line = 1;
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->last_overlay_modified, 0);
+ w->last_modified = 0;
+ w->last_overlay_modified = 0;
/* Set force_start so that redisplay_window will run the
window-scroll-functions. */
w->force_start = 1;
@@ -4585,10 +4582,10 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
struct position posit
= *compute_motion (startpos, 0, 0, 0,
PT, ht, 0,
- -1, XINT (w->hscroll),
+ -1, w->hscroll,
0, w);
window_scroll_preserve_vpos = posit.vpos;
- window_scroll_preserve_hpos = posit.hpos + XINT (w->hscroll);
+ window_scroll_preserve_hpos = posit.hpos + w->hscroll;
}
original_pos = Fcons (make_number (window_scroll_preserve_hpos),
@@ -4630,8 +4627,8 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror)
set_marker_restricted_both (w->start, w->buffer, pos, pos_byte);
w->start_at_line_beg = !NILP (bolp);
w->update_mode_line = 1;
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->last_overlay_modified, 0);
+ w->last_modified = 0;
+ w->last_overlay_modified = 0;
/* Set force_start so that redisplay_window will run
the window-scroll-functions. */
w->force_start = 1;
@@ -4872,7 +4869,7 @@ by this function. This happens in an interactive call. */)
(register Lisp_Object arg, Lisp_Object set_minimum)
{
Lisp_Object result;
- EMACS_INT hscroll;
+ ptrdiff_t hscroll;
struct window *w = XWINDOW (selected_window);
if (NILP (arg))
@@ -4880,7 +4877,7 @@ by this function. This happens in an interactive call. */)
else
arg = Fprefix_numeric_value (arg);
- hscroll = XINT (w->hscroll) + XINT (arg);
+ hscroll = w->hscroll + XINT (arg);
result = Fset_window_hscroll (selected_window, make_number (hscroll));
if (!NILP (set_minimum))
@@ -4901,7 +4898,7 @@ by this function. This happens in an interactive call. */)
(register Lisp_Object arg, Lisp_Object set_minimum)
{
Lisp_Object result;
- EMACS_INT hscroll;
+ ptrdiff_t hscroll;
struct window *w = XWINDOW (selected_window);
if (NILP (arg))
@@ -4909,7 +4906,7 @@ by this function. This happens in an interactive call. */)
else
arg = Fprefix_numeric_value (arg);
- hscroll = XINT (w->hscroll) - XINT (arg);
+ hscroll = w->hscroll - XINT (arg);
result = Fset_window_hscroll (selected_window, make_number (hscroll));
if (!NILP (set_minimum))
@@ -5537,8 +5534,8 @@ the return value is nil. Otherwise the value is t. */)
w->total_lines = p->total_lines;
w->normal_cols = p->normal_cols;
w->normal_lines = p->normal_lines;
- w->hscroll = p->hscroll;
- w->min_hscroll = p->min_hscroll;
+ w->hscroll = XFASTINT (p->hscroll);
+ w->min_hscroll = XFASTINT (p->min_hscroll);
w->display_table = p->display_table;
w->left_margin_cols = p->left_margin_cols;
w->right_margin_cols = p->right_margin_cols;
@@ -5571,8 +5568,8 @@ the return value is nil. Otherwise the value is t. */)
}
}
- XSETFASTINT (w->last_modified, 0);
- XSETFASTINT (w->last_overlay_modified, 0);
+ w->last_modified = 0;
+ w->last_overlay_modified = 0;
/* Reinstall the saved buffer and pointers into it. */
if (NILP (p->buffer))
@@ -5811,7 +5808,7 @@ get_phys_cursor_glyph (struct window *w)
if (!row->enabled_p)
return NULL;
- if (XINT (w->hscroll))
+ if (w->hscroll)
{
/* When the window is hscrolled, cursor hpos can legitimately be
out of bounds, but we draw the cursor at the corresponding
@@ -5853,8 +5850,8 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
p->total_lines = w->total_lines;
p->normal_cols = w->normal_cols;
p->normal_lines = w->normal_lines;
- p->hscroll = w->hscroll;
- p->min_hscroll = w->min_hscroll;
+ XSETFASTINT (p->hscroll, w->hscroll);
+ XSETFASTINT (p->min_hscroll, w->min_hscroll);
p->display_table = w->display_table;
p->left_margin_cols = w->left_margin_cols;
p->right_margin_cols = w->right_margin_cols;