… | |
… | |
49 | change = 1; |
49 | change = 1; |
50 | } |
50 | } |
51 | } |
51 | } |
52 | else |
52 | else |
53 | { |
53 | { |
54 | state = 0; |
54 | state = STATE_OFF; |
55 | XUnmapWindow (term->dpy, win); |
55 | XUnmapWindow (term->dpy, win); |
56 | change = 1; |
56 | change = 1; |
57 | } |
57 | } |
58 | |
58 | |
59 | return change; |
59 | return change; |
… | |
… | |
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 style, width; |
|
|
147 | const char *scrollalign, *scrollstyle, *thickness; |
145 | const char *scrollalign, *scrollstyle, *thickness; |
148 | |
146 | |
149 | this->term = term; |
147 | this->term = term; |
150 | scrollalign = term->rs[Rs_scrollBar_align]; |
148 | scrollalign = term->rs[Rs_scrollBar_align]; |
151 | scrollstyle = term->rs[Rs_scrollstyle]; |
149 | scrollstyle = term->rs[Rs_scrollstyle]; |
… | |
… | |
197 | # ifdef RXVT_SCROLLBAR |
195 | # ifdef RXVT_SCROLLBAR |
198 | if (! term->option (Opt_scrollBar_floating) && style == R_SB_RXVT) |
196 | if (! term->option (Opt_scrollBar_floating) && style == R_SB_RXVT) |
199 | shadow = SHADOW_WIDTH; |
197 | shadow = SHADOW_WIDTH; |
200 | # endif |
198 | # endif |
201 | |
199 | |
202 | this->style = style; |
|
|
203 | this->width = width; |
|
|
204 | |
|
|
205 | /* align = R_SB_ALIGN_CENTRE; */ |
200 | /* align = R_SB_ALIGN_CENTRE; */ |
206 | if (scrollalign) |
201 | if (scrollalign) |
207 | { |
202 | { |
208 | if (strncasecmp (scrollalign, "top", 3) == 0) |
203 | if (strncasecmp (scrollalign, "top", 3) == 0) |
209 | align = R_SB_ALIGN_TOP; |
204 | align = R_SB_ALIGN_TOP; |
210 | else if (strncasecmp (scrollalign, "bottom", 6) == 0) |
205 | else if (strncasecmp (scrollalign, "bottom", 6) == 0) |
211 | align = R_SB_ALIGN_BOTTOM; |
206 | align = R_SB_ALIGN_BOTTOM; |
212 | } |
207 | } |
213 | last_state = 0; |
208 | last_state = STATE_OFF; |
214 | /* cursor scrollBar: Black-on-White */ |
209 | /* cursor scrollBar: Black-on-White */ |
215 | leftptr_cursor = XCreateFontCursor (term->dpy, XC_left_ptr); |
210 | leftptr_cursor = XCreateFontCursor (term->dpy, XC_left_ptr); |
216 | } |
211 | } |
217 | |
212 | |
218 | void |
213 | void |