aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-12-12 19:33:30 +0400
committerDmitry Antipov2012-12-12 19:33:30 +0400
commit2dd61a9b332356fa24d96527a71ef4fe29fb9e5c (patch)
tree880c9e07a5ca6bf5cf04ef80990704b2ada5730b /src
parentd0efe6ec5bc90a206c194a429e6cdfd86a8fb3d5 (diff)
downloademacs-2dd61a9b332356fa24d96527a71ef4fe29fb9e5c.tar.gz
emacs-2dd61a9b332356fa24d96527a71ef4fe29fb9e5c.zip
* 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.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/dispnew.c9
-rw-r--r--src/gtkutil.c9
-rw-r--r--src/window.c4
-rw-r--r--src/xdisp.c12
-rw-r--r--src/xterm.c4
6 files changed, 20 insertions, 26 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d19b7be7395..3070fcb6e9d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12012-12-12 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * dispnew.c (set_window_cursor_after_update): Use clip_to_bounds.
4 * gtkutil.c (xg_set_toolkit_scroll_bar_thumb):
5 * window.c (Frecenter):
6 * xdisp.c (resize_mini_window, hscroll_window_tree, draw_glyphs):
7 * xterm.c (x_set_toolkit_scroll_bar_thumb): Likewise.
8
12012-12-12 Daniel Colascione <dancol@dancol.org> 92012-12-12 Daniel Colascione <dancol@dancol.org>
2 10
3 * unexcw.c (fixup_executable): use posix_fallocate to ensure that 11 * unexcw.c (fixup_executable): use posix_fallocate to ensure that
diff --git a/src/dispnew.c b/src/dispnew.c
index 675c06c22e9..11ae112f837 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -4016,11 +4016,10 @@ set_window_cursor_after_update (struct window *w)
4016 vpos = w->cursor.vpos; 4016 vpos = w->cursor.vpos;
4017 } 4017 }
4018 4018
4019 /* Window cursor can be out of sync for horizontally split windows. */ 4019 /* Window cursor can be out of sync for horizontally split windows.
4020 hpos = max (-1, hpos); /* -1 is for when cursor is on the left fringe */ 4020 Horisontal position is -1 when cursor is on the left fringe. */
4021 hpos = min (w->current_matrix->matrix_w - 1, hpos); 4021 hpos = clip_to_bounds (-1, hpos, w->current_matrix->matrix_w - 1);
4022 vpos = max (0, vpos); 4022 vpos = clip_to_bounds (0, vpos, w->current_matrix->nrows - 1);
4023 vpos = min (w->current_matrix->nrows - 1, vpos);
4024 rif->cursor_to (vpos, hpos, cy, cx); 4023 rif->cursor_to (vpos, hpos, cy, cx);
4025} 4024}
4026 4025
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 52a6c37b0d5..9f2b652525f 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -3796,13 +3796,8 @@ xg_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar,
3796 shown = (gdouble) portion / whole; 3796 shown = (gdouble) portion / whole;
3797 } 3797 }
3798 3798
3799 size = shown * XG_SB_RANGE; 3799 size = clip_to_bounds (1, shown * XG_SB_RANGE, XG_SB_RANGE);
3800 size = min (size, XG_SB_RANGE); 3800 value = clip_to_bounds (XG_SB_MIN, top * XG_SB_RANGE, XG_SB_MAX - size);
3801 size = max (size, 1);
3802
3803 value = top * XG_SB_RANGE;
3804 value = min (value, XG_SB_MAX - size);
3805 value = max (value, XG_SB_MIN);
3806 3801
3807 /* Assume all lines are of equal size. */ 3802 /* Assume all lines are of equal size. */
3808 new_step = size / max (1, FRAME_LINES (f)); 3803 new_step = size / max (1, FRAME_LINES (f));
diff --git a/src/window.c b/src/window.c
index f696e3c2a1b..28c3bf93553 100644
--- a/src/window.c
+++ b/src/window.c
@@ -5347,8 +5347,8 @@ and redisplay normally--don't erase and redraw the frame. */)
5347 iarg += ht; 5347 iarg += ht;
5348 5348
5349 /* Don't let it get into the margin at either top or bottom. */ 5349 /* Don't let it get into the margin at either top or bottom. */
5350 iarg = max (iarg, this_scroll_margin); 5350 iarg = clip_to_bounds (this_scroll_margin, iarg,
5351 iarg = min (iarg, ht - this_scroll_margin - 1); 5351 ht - this_scroll_margin - 1);
5352 5352
5353 pos = *vmotion (PT, - iarg, w); 5353 pos = *vmotion (PT, - iarg, w);
5354 charpos = pos.bufpos; 5354 charpos = pos.bufpos;
diff --git a/src/xdisp.c b/src/xdisp.c
index ad600f3c83d..aead10a7b9b 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10393,8 +10393,7 @@ resize_mini_window (struct window *w, int exact_p)
10393 max_height = total_height / 4; 10393 max_height = total_height / 4;
10394 10394
10395 /* Correct that max. height if it's bogus. */ 10395 /* Correct that max. height if it's bogus. */
10396 max_height = max (1, max_height); 10396 max_height = clip_to_bounds (1, max_height, total_height);
10397 max_height = min (total_height, max_height);
10398 10397
10399 /* Find out the height of the text in the window. */ 10398 /* Find out the height of the text in the window. */
10400 if (it.line_wrap == TRUNCATE) 10399 if (it.line_wrap == TRUNCATE)
@@ -12496,11 +12495,7 @@ hscroll_window_tree (Lisp_Object window)
12496 if (w == XWINDOW (selected_window)) 12495 if (w == XWINDOW (selected_window))
12497 pt = PT; 12496 pt = PT;
12498 else 12497 else
12499 { 12498 pt = clip_to_bounds (BEGV, marker_position (w->pointm), ZV);
12500 pt = marker_position (w->pointm);
12501 pt = max (BEGV, pt);
12502 pt = min (ZV, pt);
12503 }
12504 12499
12505 /* Move iterator to pt starting at cursor_row->start in 12500 /* Move iterator to pt starting at cursor_row->start in
12506 a line with infinite width. */ 12501 a line with infinite width. */
@@ -23485,8 +23480,7 @@ draw_glyphs (struct window *w, int x, struct glyph_row *row,
23485 23480
23486 /* Let's rather be paranoid than getting a SEGV. */ 23481 /* Let's rather be paranoid than getting a SEGV. */
23487 end = min (end, row->used[area]); 23482 end = min (end, row->used[area]);
23488 start = max (0, start); 23483 start = clip_to_bounds (0, start, end);
23489 start = min (end, start);
23490 23484
23491 /* Translate X to frame coordinates. Set last_x to the right 23485 /* Translate X to frame coordinates. Set last_x to the right
23492 end of the drawing area. */ 23486 end of the drawing area. */
diff --git a/src/xterm.c b/src/xterm.c
index e9e99574663..374b6287458 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4834,9 +4834,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio
4834 /* Slider size. Must be in the range [1 .. MAX - MIN] where MAX 4834 /* Slider size. Must be in the range [1 .. MAX - MIN] where MAX
4835 is the scroll bar's maximum and MIN is the scroll bar's minimum 4835 is the scroll bar's maximum and MIN is the scroll bar's minimum
4836 value. */ 4836 value. */
4837 size = shown * XM_SB_MAX; 4837 size = clip_to_bounds (1, shown * XM_SB_MAX, XM_SB_MAX);
4838 size = min (size, XM_SB_MAX);
4839 size = max (size, 1);
4840 4838
4841 /* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */ 4839 /* Position. Must be in the range [MIN .. MAX - SLIDER_SIZE]. */
4842 value = top * XM_SB_MAX; 4840 value = top * XM_SB_MAX;