… | |
… | |
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
22 | *----------------------------------------------------------------------*/ |
22 | *----------------------------------------------------------------------*/ |
23 | |
23 | |
24 | #include "../config.h" /* NECESSARY */ |
24 | #include "../config.h" /* NECESSARY */ |
25 | #include "rxvt.h" /* NECESSARY */ |
25 | #include "rxvt.h" /* NECESSARY */ |
26 | #include "scrollbar-rxvt.intpro" /* PROTOS for internal routines */ |
|
|
27 | |
26 | |
28 | /*----------------------------------------------------------------------*/ |
27 | /*----------------------------------------------------------------------*/ |
29 | #if defined(RXVT_SCROLLBAR) |
28 | #if defined(RXVT_SCROLLBAR) |
30 | |
29 | |
31 | /* draw triangular button with a shadow of SHADOW (1 or 2) pixels */ |
30 | /* draw triangular button with a shadow of SHADOW (1 or 2) pixels */ |
… | |
… | |
122 | pt[2].x, pt[2].y, pt[1].x, pt[1].y); |
121 | pt[2].x, pt[2].y, pt[1].x, pt[1].y); |
123 | #endif |
122 | #endif |
124 | } |
123 | } |
125 | |
124 | |
126 | int |
125 | int |
127 | rxvt_term::scrollbar_show_rxvt (int update __attribute__ ((unused)), int last_top, int last_bot, int scrollbar_len) |
126 | rxvt_term::scrollbar_show_rxvt (int update, int last_top, int last_bot, int scrollbar_len) |
128 | { |
127 | { |
129 | int sbshadow = sb_shadow; |
128 | int sbshadow = sb_shadow; |
130 | int sbwidth = (int)scrollBar.width; |
129 | int sbwidth = (int)scrollBar.width; |
131 | |
130 | |
132 | if ((scrollBar.init & R_SB_RXVT) == 0) |
131 | if ((scrollBar.init & R_SB_RXVT) == 0) |
133 | { |
132 | { |
134 | scrollBar.init |= R_SB_RXVT; |
133 | scrollBar.init |= R_SB_RXVT; |
135 | if (sbshadow) |
134 | if (sbshadow) |
136 | { |
135 | { |
137 | XSetWindowBackground (display->display, scrollBar.win, PixColors[Color_trough]); |
136 | XSetWindowBackground (display->display, scrollBar.win, pix_colors_focused[Color_trough]); |
138 | XClearWindow (display->display, scrollBar.win); |
137 | XClearWindow (display->display, scrollBar.win); |
139 | } |
138 | } |
140 | } |
139 | } |
141 | else |
140 | else |
142 | { |
141 | { |
143 | /* instead of XClearWindow (display->display, scrollBar.win); */ |
142 | if (update) |
|
|
143 | { |
144 | if (last_top < scrollBar.top) |
144 | if (last_top < scrollBar.top) |
145 | XClearArea (display->display, scrollBar.win, |
145 | XClearArea (display->display, scrollBar.win, |
146 | sbshadow, last_top, |
146 | sbshadow, last_top, |
147 | sbwidth, (scrollBar.top - last_top), |
147 | sbwidth, (scrollBar.top - last_top), |
148 | False); |
148 | False); |
149 | |
149 | |
150 | if (scrollBar.bot < last_bot) |
150 | if (scrollBar.bot < last_bot) |
151 | XClearArea (display->display, scrollBar.win, |
151 | XClearArea (display->display, scrollBar.win, |
152 | sbshadow, scrollBar.bot, |
152 | sbshadow, scrollBar.bot, |
153 | sbwidth, (last_bot - scrollBar.bot), |
153 | sbwidth, (last_bot - scrollBar.bot), |
154 | False); |
154 | False); |
|
|
155 | } |
|
|
156 | else |
|
|
157 | XClearWindow (display->display, scrollBar.win); |
155 | } |
158 | } |
156 | |
159 | |
157 | /* scrollbar slider */ |
160 | /* scrollbar slider */ |
158 | #ifdef SB_BORDER |
161 | #ifdef SB_BORDER |
159 | { |
162 | { |
160 | int xofs; |
163 | int xofs; |
161 | |
164 | |
162 | if (Options & Opt_scrollBar_right) |
165 | if (options & Opt_scrollBar_right) |
163 | xofs = 0; |
166 | xofs = 0; |
164 | else |
167 | else |
165 | xofs = sbshadow ? sbwidth : sbwidth - 1; |
168 | xofs = sbshadow ? sbwidth : sbwidth - 1; |
166 | |
169 | |
167 | XDrawLine (display->display, scrollBar.win, botShadowGC, |
170 | XDrawLine (display->display, scrollBar.win, botShadowGC, |