Commit 2dd61a9b authored by Dmitry Antipov's avatar Dmitry Antipov
Browse files

* dispnew.c (set_window_cursor_after_update): Use clip_to_bounds.

* gtkutil.c (xg_set_toolkit_scroll_bar_thumb):
* window.c (Frecenter):
* xdisp.c (resize_mini_window, hscroll_window_tree, draw_glyphs):
* xterm.c (x_set_toolkit_scroll_bar_thumb): Likewise.
parent d0efe6ec
2012-12-12 Dmitry Antipov <dmantipov@yandex.ru>
* dispnew.c (set_window_cursor_after_update): Use clip_to_bounds.
* gtkutil.c (xg_set_toolkit_scroll_bar_thumb):
* window.c (Frecenter):
* xdisp.c (resize_mini_window, hscroll_window_tree, draw_glyphs):
* xterm.c (x_set_toolkit_scroll_bar_thumb): Likewise.
2012-12-12 Daniel Colascione <dancol@dancol.org>
* unexcw.c (fixup_executable): use posix_fallocate to ensure that
......
......@@ -4016,11 +4016,10 @@ set_window_cursor_after_update (struct window *w)
vpos = w->cursor.vpos;
}
/* Window cursor can be out of sync for horizontally split windows. */
hpos = max (-1, hpos); /* -1 is for when cursor is on the left fringe */
hpos = min (w->current_matrix->matrix_w - 1, hpos);
vpos = max (0, vpos);
vpos = min (w->current_matrix->nrows - 1, vpos);
/* Window cursor can be out of sync for horizontally split windows.
Horisontal position is -1 when cursor is on the left fringe. */
hpos = clip_to_bounds (-1, hpos, w->current_matrix->matrix_w - 1);
vpos = clip_to_bounds (0, vpos, w->current_matrix->nrows - 1);
rif->cursor_to (vpos, hpos, cy, cx);
}
......
......@@ -3796,13 +3796,8 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
shown = (gdouble) portion / whole;
}
size = shown * XG_SB_RANGE;
size = min (size, XG_SB_RANGE);
size = max (size, 1);
value = top * XG_SB_RANGE;
value = min (value, XG_SB_MAX - size);
value = max (value, XG_SB_MIN);
size = clip_to_bounds (1, shown * XG_SB_RANGE, XG_SB_RANGE);
value = clip_to_bounds (XG_SB_MIN, top * XG_SB_RANGE, XG_SB_MAX - size);
/* Assume all lines are of equal size. */
new_step = size / max (1, FRAME_LINES (f));
......
......@@ -5347,8 +5347,8 @@ and redisplay normally--don't erase and redraw the frame. */)
iarg += ht;
/* Don't let it get into the margin at either top or bottom. */
iarg = max (iarg, this_scroll_margin);
iarg = min (iarg, ht - this_scroll_margin - 1);
iarg = clip_to_bounds (this_scroll_margin, iarg,
ht - this_scroll_margin - 1);
pos = *vmotion (PT, - iarg, w);
charpos = pos.bufpos;
......
......@@ -10393,8 +10393,7 @@ resize_mini_window (struct window *w, int exact_p)
max_height = total_height / 4;
/* Correct that max. height if it's bogus. */
max_height = max (1, max_height);
max_height = min (total_height, max_height);
max_height = clip_to_bounds (1, max_height, total_height);
/* Find out the height of the text in the window. */
if (it.line_wrap == TRUNCATE)
......@@ -12496,11 +12495,7 @@ hscroll_window_tree (Lisp_Object window)
if (w == XWINDOW (selected_window))
pt = PT;
else
{
pt = marker_position (w->pointm);
pt = max (BEGV, pt);
pt = min (ZV, pt);
}
pt = clip_to_bounds (BEGV, marker_position (w->pointm), ZV);
/* Move iterator to pt starting at cursor_row->start in
a line with infinite width. */
......@@ -23485,8 +23480,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
/* Let's rather be paranoid than getting a SEGV. */
end = min (end, row->used[area]);
start = max (0, start);
start = min (end, start);
start = clip_to_bounds (0, start, end);
/* Translate X to frame coordinates. Set last_x to the right
end of the drawing area. */
......
......@@ -4834,9 +4834,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
/* Slider size. Must be in the range [1 .. MAX - MIN] where MAX
is the scroll bar's maximum and MIN is the scroll bar's minimum
value. */
size = shown * XM_SB_MAX;
size = min (size, XM_SB_MAX);
size = max (size, 1);
size = clip_to_bounds (1, shown * XM_SB_MAX, XM_SB_MAX);
/* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */
value = top * XM_SB_MAX;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment