… | |
… | |
116 | if (refresh) |
116 | if (refresh) |
117 | { |
117 | { |
118 | int sb_top = term->view_start - term->top_row; |
118 | int sb_top = term->view_start - term->top_row; |
119 | int sb_bot = sb_top + (term->nrow - 1); |
119 | int sb_bot = sb_top + (term->nrow - 1); |
120 | int sb_len = max (term->nrow - 1 - term->top_row, 1); |
120 | int sb_len = max (term->nrow - 1 - term->top_row, 1); |
121 | int sb_size = (sb_bot - sb_top) * size (); |
|
|
122 | |
121 | |
123 | top = beg + (sb_top * size ()) / sb_len; |
122 | top = beg + (sb_top * size ()) / sb_len; |
124 | bot = top + sb_size / sb_len + min_height () + (sb_size % sb_len > 0); |
123 | bot = top + ecb_div_ru ((sb_bot - sb_top) * size (), sb_len) + min_height (); |
125 | /* no change */ |
124 | /* no change */ |
126 | if (top == last_top |
125 | if (top == last_top |
127 | && bot == last_bot |
126 | && bot == last_bot |
128 | && (state == last_state |
127 | && (state == last_state |
129 | || !(state == STATE_UP || state == STATE_DOWN))) |
128 | || !(state == STATE_UP || state == STATE_DOWN))) |
… | |
… | |
141 | |
140 | |
142 | void |
141 | void |
143 | scrollBar_t::setup (rxvt_term *term) |
142 | scrollBar_t::setup (rxvt_term *term) |
144 | { |
143 | { |
145 | int i; |
144 | int i; |
146 | short width; |
|
|
147 | const char *scrollalign, *scrollstyle, *thickness; |
145 | const char *scrollalign, *scrollstyle, *thickness; |
148 | enum sb_style style; |
|
|
149 | |
146 | |
150 | this->term = term; |
147 | this->term = term; |
151 | scrollalign = term->rs[Rs_scrollBar_align]; |
148 | scrollalign = term->rs[Rs_scrollBar_align]; |
152 | scrollstyle = term->rs[Rs_scrollstyle]; |
149 | scrollstyle = term->rs[Rs_scrollstyle]; |
153 | thickness = term->rs[Rs_scrollBar_thickness]; |
150 | thickness = term->rs[Rs_scrollBar_thickness]; |
… | |
… | |
198 | # ifdef RXVT_SCROLLBAR |
195 | # ifdef RXVT_SCROLLBAR |
199 | if (! term->option (Opt_scrollBar_floating) && style == R_SB_RXVT) |
196 | if (! term->option (Opt_scrollBar_floating) && style == R_SB_RXVT) |
200 | shadow = SHADOW_WIDTH; |
197 | shadow = SHADOW_WIDTH; |
201 | # endif |
198 | # endif |
202 | |
199 | |
203 | this->style = style; |
|
|
204 | this->width = width; |
|
|
205 | |
|
|
206 | /* align = R_SB_ALIGN_CENTRE; */ |
200 | /* align = R_SB_ALIGN_CENTRE; */ |
207 | if (scrollalign) |
201 | if (scrollalign) |
208 | { |
202 | { |
209 | if (strncasecmp (scrollalign, "top", 3) == 0) |
203 | if (strncasecmp (scrollalign, "top", 3) == 0) |
210 | align = R_SB_ALIGN_TOP; |
204 | align = R_SB_ALIGN_TOP; |