… | |
… | |
71 | window_sb_x, 0, |
71 | window_sb_x, 0, |
72 | total_width (), |
72 | total_width (), |
73 | term->szHint.height, |
73 | term->szHint.height, |
74 | 0, |
74 | 0, |
75 | term->pix_colors[Color_fg], |
75 | term->pix_colors[Color_fg], |
76 | term->pix_colors[Color_border]); |
76 | term->pix_colors[color ()]); |
77 | XDefineCursor (term->dpy, win, leftptr_cursor); |
77 | XDefineCursor (term->dpy, win, leftptr_cursor); |
78 | |
78 | |
79 | XSelectInput (term->dpy, win, |
79 | XSelectInput (term->dpy, win, |
80 | ExposureMask | ButtonPressMask | ButtonReleaseMask |
80 | ExposureMask | ButtonPressMask | ButtonReleaseMask |
81 | | Button1MotionMask | Button2MotionMask |
81 | | Button1MotionMask | Button2MotionMask |
… | |
… | |
109 | if (refresh) |
109 | if (refresh) |
110 | { |
110 | { |
111 | int sb_top = term->view_start - term->top_row; |
111 | int sb_top = term->view_start - term->top_row; |
112 | int sb_bot = sb_top + (term->nrow - 1); |
112 | int sb_bot = sb_top + (term->nrow - 1); |
113 | int sb_len = max (term->nrow - 1 - term->top_row, 1); |
113 | int sb_len = max (term->nrow - 1 - term->top_row, 1); |
|
|
114 | int n = min (min_height (), size ()); |
114 | |
115 | |
115 | top = beg + (sb_top * size ()) / sb_len; |
116 | top = beg + (sb_top * (size () - n)) / sb_len; |
116 | bot = top + ecb_div_ru ((sb_bot - sb_top) * size (), sb_len) + min_height (); |
117 | bot = top + ecb_div_ru ((sb_bot - sb_top) * (size () - n), sb_len) + n; |
117 | /* no change */ |
118 | /* no change */ |
118 | if (top == last_top |
119 | if (top == last_top |
119 | && bot == last_bot |
120 | && bot == last_bot |
120 | && (state == last_state |
121 | && (state == last_state |
121 | || !(state == SB_STATE_UP || state == SB_STATE_DOWN))) |
122 | || !(state == SB_STATE_UP || state == SB_STATE_DOWN))) |
… | |
… | |
230 | if (botShadowGC) XFreeGC (term->dpy, botShadowGC); |
231 | if (botShadowGC) XFreeGC (term->dpy, botShadowGC); |
231 | if (scrollbarGC) XFreeGC (term->dpy, scrollbarGC); |
232 | if (scrollbarGC) XFreeGC (term->dpy, scrollbarGC); |
232 | #endif |
233 | #endif |
233 | } |
234 | } |
234 | |
235 | |
|
|
236 | int |
|
|
237 | scrollBar_t::color () |
|
|
238 | { |
|
|
239 | #ifdef RXVT_SCROLLBAR |
|
|
240 | if (style == SB_STYLE_RXVT && shadow) |
|
|
241 | return Color_trough; |
|
|
242 | else |
|
|
243 | #endif |
|
|
244 | return Color_border; |
|
|
245 | } |
|
|
246 | |
235 | void |
247 | void |
236 | scrollBar_t::update_data () |
248 | scrollBar_t::update_data () |
237 | { |
249 | { |
238 | #if defined(PLAIN_SCROLLBAR) |
250 | #if defined(PLAIN_SCROLLBAR) |
239 | if (style == SB_STYLE_PLAIN) |
251 | if (style == SB_STYLE_PLAIN) |
… | |
… | |
261 | #endif |
273 | #endif |
262 | #if defined(RXVT_SCROLLBAR) |
274 | #if defined(RXVT_SCROLLBAR) |
263 | if (style == SB_STYLE_RXVT) |
275 | if (style == SB_STYLE_RXVT) |
264 | { |
276 | { |
265 | beg = (width + 1) + shadow; |
277 | beg = (width + 1) + shadow; |
266 | end = term->szHint.height - beg - (2 * shadow); |
278 | end = term->szHint.height - beg; |
267 | update = &scrollBar_t::show_rxvt; |
279 | update = &scrollBar_t::show_rxvt; |
268 | } |
280 | } |
269 | #endif |
281 | #endif |
270 | } |
282 | } |
271 | |
283 | |