emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r111204: * dispnew.c (set_window_curs


From: Dmitry Antipov
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r111204: * dispnew.c (set_window_cursor_after_update): Use clip_to_bounds.
Date: Wed, 12 Dec 2012 19:33:30 +0400
User-agent: Bazaar (2.5.0)

------------------------------------------------------------
revno: 111204
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Wed 2012-12-12 19:33:30 +0400
message:
  * 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.
modified:
  src/ChangeLog
  src/dispnew.c
  src/gtkutil.c
  src/window.c
  src/xdisp.c
  src/xterm.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2012-12-12 03:26:52 +0000
+++ b/src/ChangeLog     2012-12-12 15:33:30 +0000
@@ -1,3 +1,11 @@
+2012-12-12  Dmitry Antipov  <address@hidden>
+
+       * 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  <address@hidden>
 
        * unexcw.c (fixup_executable): use posix_fallocate to ensure that

=== modified file 'src/dispnew.c'
--- a/src/dispnew.c     2012-11-13 06:11:40 +0000
+++ b/src/dispnew.c     2012-12-12 15:33:30 +0000
@@ -4016,11 +4016,10 @@
       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);
 }
 

=== modified file 'src/gtkutil.c'
--- a/src/gtkutil.c     2012-12-03 19:16:17 +0000
+++ b/src/gtkutil.c     2012-12-12 15:33:30 +0000
@@ -3796,13 +3796,8 @@
           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));

=== modified file 'src/window.c'
--- a/src/window.c      2012-12-11 09:51:12 +0000
+++ b/src/window.c      2012-12-12 15:33:30 +0000
@@ -5347,8 +5347,8 @@
        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;

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2012-12-11 12:22:35 +0000
+++ b/src/xdisp.c       2012-12-12 15:33:30 +0000
@@ -10393,8 +10393,7 @@
        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 @@
              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 @@
 
   /* 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.  */

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2012-12-08 17:19:51 +0000
+++ b/src/xterm.c       2012-12-12 15:33:30 +0000
@@ -4834,9 +4834,7 @@
       /* 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;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]