… | |
… | |
68 | |
68 | |
69 | #define R_SCROLLBEG_XTERM 0 |
69 | #define R_SCROLLBEG_XTERM 0 |
70 | #define R_SCROLLEND_XTERM szHint.height |
70 | #define R_SCROLLEND_XTERM szHint.height |
71 | #define R_SCROLLBEG_NEXT 0 |
71 | #define R_SCROLLBEG_NEXT 0 |
72 | #define R_SCROLLEND_NEXT szHint.height - (SB_BUTTON_TOTAL_HEIGHT + \ |
72 | #define R_SCROLLEND_NEXT szHint.height - (SB_BUTTON_TOTAL_HEIGHT + \ |
73 | SB_PADDING) |
73 | SB_PADDING) |
74 | #define R_SCROLLBEG_RXVT (scrollBar.width + 1) + sb_shadow |
74 | #define R_SCROLLBEG_RXVT (scrollBar.width + 1) + sb_shadow |
75 | #define R_SCROLLEND_RXVT szHint.height - R_SCROLLBEG_RXVT - \ |
75 | #define R_SCROLLEND_RXVT szHint.height - R_SCROLLBEG_RXVT - \ |
76 | (2 * sb_shadow) |
76 | (2 * sb_shadow) |
77 | |
77 | |
78 | #if defined(PLAIN_SCROLLBAR) |
78 | #if defined(PLAIN_SCROLLBAR) |
79 | if (scrollBar.style == R_SB_PLAIN) |
79 | if (scrollBar.style == R_SB_PLAIN) |
80 | { |
80 | { |
81 | scrollBar.beg = R_SCROLLBEG_XTERM; |
81 | scrollBar.beg = R_SCROLLBEG_XTERM; |
… | |
… | |
110 | |
110 | |
111 | if (!scrollBar.win) |
111 | if (!scrollBar.win) |
112 | { |
112 | { |
113 | /* create the scrollbar window */ |
113 | /* create the scrollbar window */ |
114 | scrollBar.win = XCreateSimpleWindow (display->display, |
114 | scrollBar.win = XCreateSimpleWindow (display->display, |
115 | TermWin.parent[0], |
115 | parent[0], |
116 | window_sb_x, 0, |
116 | window_sb_x, 0, |
117 | scrollbar_TotalWidth (), |
117 | scrollbar_TotalWidth (), |
118 | szHint.height, |
118 | szHint.height, |
119 | 0, |
119 | 0, |
120 | pix_colors[Color_fg], |
120 | pix_colors[Color_fg], |
121 | pix_colors[Color_border]); |
121 | pix_colors[Color_border]); |
122 | #ifdef DEBUG_X |
122 | #ifdef DEBUG_X |
123 | XStoreName (display->display, scrollBar.win, "scrollbar"); |
123 | XStoreName (display->display, scrollBar.win, "scrollbar"); |
124 | #endif |
124 | #endif |
125 | XDefineCursor (display->display, scrollBar.win, leftptr_cursor); |
125 | XDefineCursor (display->display, scrollBar.win, leftptr_cursor); |
126 | |
126 | |
… | |
… | |
153 | if (!scrollbar_visible ()) |
153 | if (!scrollbar_visible ()) |
154 | return 0; |
154 | return 0; |
155 | |
155 | |
156 | if (update) |
156 | if (update) |
157 | { |
157 | { |
158 | top = (TermWin.nscrolled - TermWin.view_start); |
158 | top = nsaved - view_start; |
159 | bot = top + (TermWin.nrow - 1); |
159 | bot = top + (nrow - 1); |
160 | len = max ((TermWin.nscrolled + (TermWin.nrow - 1)), 1); |
160 | len = max (nsaved + (nrow - 1), 1); |
161 | adj = (((bot - top) * scrollbar_size ()) % len) > 0 ? 1 : 0; |
161 | adj = (((bot - top) * scrollbar_size ()) % len) > 0 ? 1 : 0; |
162 | |
162 | |
163 | scrollBar.top = (scrollBar.beg + (top * scrollbar_size ()) / len); |
163 | scrollBar.top = (scrollBar.beg + (top * scrollbar_size ()) / len); |
164 | scrollbar_len = ((bot - top) * scrollbar_size ()) / len + |
164 | scrollbar_len = ((bot - top) * scrollbar_size ()) / len + |
165 | scrollbar_minheight () + adj; |
165 | scrollbar_minheight () + adj; |
… | |
… | |
230 | if (style != R_SB_NEXT) /* dishonour request - for now */ |
230 | if (style != R_SB_NEXT) /* dishonour request - for now */ |
231 | if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM) |
231 | if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM) |
232 | width = min (i, SB_WIDTH_MAXIMUM); |
232 | width = min (i, SB_WIDTH_MAXIMUM); |
233 | |
233 | |
234 | # if defined(RXVT_SCROLLBAR) |
234 | # if defined(RXVT_SCROLLBAR) |
235 | if (! (options & Opt_scrollBar_floating) && style == R_SB_RXVT) |
235 | if (! OPTION (Opt_scrollBar_floating) && style == R_SB_RXVT) |
236 | sb_shadow = SHADOW; |
236 | sb_shadow = SHADOW; |
237 | # endif |
237 | # endif |
238 | |
238 | |
239 | scrollBar.style = style; |
239 | scrollBar.style = style; |
240 | scrollBar.width = width; |
240 | scrollBar.width = width; |