From aa2ac82b777a5d00aa00280888bbd94af5595ad9 Mon Sep 17 00:00:00 2001 From: ayin Date: Tue, 19 Feb 2008 17:49:16 +0000 Subject: [PATCH] Remove 'len' member of scrollBar_t and compute it on demand. --- src/scrollbar-next.C | 6 +++--- src/scrollbar-plain.C | 2 +- src/scrollbar-rxvt.C | 4 ++-- src/scrollbar-xterm.C | 2 +- src/scrollbar.C | 3 +-- src/scrollbar.h | 1 - 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/scrollbar-next.C b/src/scrollbar-next.C index 2d2d60ba..ea30cd71 100644 --- a/src/scrollbar-next.C +++ b/src/scrollbar-next.C @@ -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); diff --git a/src/scrollbar-plain.C b/src/scrollbar-plain.C index f486dff2..4a264f1e 100644 --- a/src/scrollbar-plain.C +++ b/src/scrollbar-plain.C @@ -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; } diff --git a/src/scrollbar-rxvt.C b/src/scrollbar-rxvt.C index 0c038023..8573285a 100644 --- a/src/scrollbar-rxvt.C +++ b/src/scrollbar-rxvt.C @@ -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); diff --git a/src/scrollbar-xterm.C b/src/scrollbar-xterm.C index e6b4e087..7c745d3e 100644 --- a/src/scrollbar-xterm.C +++ b/src/scrollbar-xterm.C @@ -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, diff --git a/src/scrollbar.C b/src/scrollbar.C index 92f0452e..0dffa22f 100644 --- a/src/scrollbar.C +++ b/src/scrollbar.C @@ -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 diff --git a/src/scrollbar.h b/src/scrollbar.h index 803f399a..8929e5d4 100644 --- a/src/scrollbar.h +++ b/src/scrollbar.h @@ -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; -- 2.34.1