Remove 'len' member of scrollBar_t and compute it on demand.
authorayin <ayin>
Tue, 19 Feb 2008 17:49:16 +0000 (17:49 +0000)
committerayin <ayin>
Tue, 19 Feb 2008 17:49:16 +0000 (17:49 +0000)
src/scrollbar-next.C
src/scrollbar-plain.C
src/scrollbar-rxvt.C
src/scrollbar-xterm.C
src/scrollbar.C
src/scrollbar.h

index 2d2d60ba285a156559b2fa106399e8d7736f37eb..ea30cd71b1385b8e6c88ddaba1745cf0dc6b2696 100644 (file)
@@ -266,17 +266,17 @@ scrollBar_t::show_next (int update)
 
       XFillRectangle (term->dpy, win, grayGC,
                       SB_LEFT_PADDING, top + SB_PADDING,
-                      SB_BUTTON_WIDTH, len);
+                      SB_BUTTON_WIDTH, bot - top);
 
       XCopyArea (term->dpy, dimple, win, whiteGC, 0, 0,
                  SCROLLER_DIMPLE_WIDTH, SCROLLER_DIMPLE_HEIGHT,
                  (SB_WIDTH_NEXT - SCROLLER_DIMPLE_WIDTH) / 2,
                  top + SB_BEVEL_WIDTH_UPPER_LEFT +
-                 (len - SCROLLER_DIMPLE_HEIGHT) / 2);
+                 (bot - top - SCROLLER_DIMPLE_HEIGHT) / 2);
 
       drawBevel (this, SB_BUTTON_BEVEL_X,
                  top + SB_PADDING, SB_BUTTON_WIDTH,
-                 len);
+                 bot - top);
       drawBevel (this, SB_BUTTON_BEVEL_X,
                  height - SB_BUTTON_BOTH_HEIGHT, SB_BUTTON_WIDTH,
                  SB_BUTTON_HEIGHT);
index f486dff2bb7788675744327a160932b24068f18b..4a264f1e6d9a85c591a93e536d3710df40846eff 100644 (file)
@@ -62,7 +62,7 @@ scrollBar_t::show_plain (int update)
 
   /* scrollbar slider */
   XFillRectangle (term->dpy, win, pscrollbarGC,
-                  1 - xsb, top, sbwidth, len);
+                  1 - xsb, top, sbwidth, bot - top);
 
   return 1;
 }
index 0c038023d63ec5a00e11afa86e89b91611e584a8..8573285a895c35e8d029fd43fad2ac45794e4d8a 100644 (file)
@@ -208,14 +208,14 @@ scrollBar_t::show_rxvt (int update)
 
   XFillRectangle (term->dpy, win, scrollbarGC,
                   sbshadow, top, sbwidth,
-                  len);
+                  bot - top);
 
   if (sbshadow)
     /* trough shadow */
     draw_shadow (this, 0, 0, sbwidth + 2 * sbshadow, end + (sbwidth + 1) + sbshadow);
 
   /* shadow for scrollbar slider */
-  draw_shadow (this, sbshadow, top, sbwidth, len);
+  draw_shadow (this, sbshadow, top, sbwidth, bot - top);
 
   /* Redraw scrollbar arrows */
   draw_button (this, sbshadow, sbshadow, UP);
index e6b4e087647943296901a7d129656c0cb2536559..7c745d3e320fd404f711b1f90d9718ae247a1e54 100644 (file)
@@ -78,7 +78,7 @@ scrollBar_t::show_xterm (int update)
 
   /* scrollbar slider */
   XFillRectangle (term->dpy, win, xscrollbarGC,
-                  xsb + 1, top, sbwidth - 2, len);
+                  xsb + 1, top, sbwidth - 2, bot - top);
 
   XDrawLine (term->dpy, win, ShadowGC,
              xsb ? 0 : sbwidth, beg,
index 92f0452e36a53c3274e830d5a3e69ab4664f8030..0dffa22fa4d7c4e557c2cc3708280aacdf762529 100644 (file)
@@ -121,8 +121,7 @@ scrollBar_t::show (int refresh)
       int sb_size = (sb_bot - sb_top) * size ();
 
       top = beg + (sb_top * size ()) / sb_len;
-      len = sb_size / sb_len + min_height () + (sb_size % sb_len > 0);
-      bot = top + len;
+      bot = top + sb_size / sb_len + min_height () + (sb_size % sb_len > 0);
       /* no change */
       if (top == last_top
           && bot == last_bot
index 803f399ab92e48278395a8333ff6bc8f66bf9ddf..8929e5d49ec822c8dc948e69a7ec333a53bcd8c2 100644 (file)
@@ -60,7 +60,6 @@ struct scrollBar_t {
   int             last_bot;     /* scrollbar last bottom position           */
   int             last_top;     /* scrollbar last top position              */
   int             last_state;   /* scrollbar last state                     */
-  int             len;
   unsigned char   align;
   Window          win;
   Cursor          leftptr_cursor;