… | |
… | |
2 | * File: scrollbar-rxvt.C |
2 | * File: scrollbar-rxvt.C |
3 | *----------------------------------------------------------------------* |
3 | *----------------------------------------------------------------------* |
4 | * |
4 | * |
5 | * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA> |
5 | * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA> |
6 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
6 | * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> |
7 | * Copyright (c) 2004-2006 Marc Lehmann <pcg@goof.com> |
7 | * Copyright (c) 2004-2006 Marc Lehmann <schmorp@schmorp.de> |
8 | * |
8 | * |
9 | * This program is free software; you can redistribute it and/or modify |
9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by |
10 | * it under the terms of the GNU General Public License as published by |
11 | * the Free Software Foundation; either version 2 of the License, or |
11 | * the Free Software Foundation; either version 3 of the License, or |
12 | * (at your option) any later version. |
12 | * (at your option) any later version. |
13 | * |
13 | * |
14 | * This program is distributed in the hope that it will be useful, |
14 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
… | |
… | |
58 | Display *dpy = sb->term->dpy; |
58 | Display *dpy = sb->term->dpy; |
59 | |
59 | |
60 | sz = sb->width; |
60 | sz = sb->width; |
61 | sz2 = sz / 2; |
61 | sz2 = sz / 2; |
62 | |
62 | |
63 | if ((dirn == UP && sb->state == STATE_UP) |
63 | if ((dirn == UP && sb->state == SB_STATE_UP) |
64 | || (dirn == DN && sb->state == STATE_DOWN)) |
64 | || (dirn == DN && sb->state == SB_STATE_DOWN)) |
65 | { |
65 | { |
66 | top = sb->botShadowGC; |
66 | top = sb->botShadowGC; |
67 | bot = sb->topShadowGC; |
67 | bot = sb->topShadowGC; |
68 | } |
68 | } |
69 | else |
69 | else |
… | |
… | |
148 | } |
148 | } |
149 | |
149 | |
150 | int |
150 | int |
151 | scrollBar_t::show_rxvt (int update) |
151 | scrollBar_t::show_rxvt (int update) |
152 | { |
152 | { |
153 | int sbshadow = shadow; |
|
|
154 | int sbwidth = (int)width; |
153 | int sbwidth = (int)width; |
155 | |
154 | |
156 | if ((init & R_SB_RXVT) == 0) |
155 | if ((init & SB_STYLE_RXVT) == 0) |
157 | { |
156 | { |
158 | XGCValues gcvalue; |
157 | XGCValues gcvalue; |
159 | |
158 | |
160 | init |= R_SB_RXVT; |
159 | init |= SB_STYLE_RXVT; |
161 | |
160 | |
162 | gcvalue.foreground = term->pix_colors[Color_topShadow]; |
161 | gcvalue.foreground = term->pix_colors[Color_topShadow]; |
163 | topShadowGC = XCreateGC (term->dpy, term->vt, GCForeground, &gcvalue); |
162 | topShadowGC = XCreateGC (term->dpy, term->vt, GCForeground, &gcvalue); |
164 | gcvalue.foreground = term->pix_colors[Color_bottomShadow]; |
163 | gcvalue.foreground = term->pix_colors[Color_bottomShadow]; |
165 | botShadowGC = XCreateGC (term->dpy, term->vt, GCForeground, &gcvalue); |
164 | botShadowGC = XCreateGC (term->dpy, term->vt, GCForeground, &gcvalue); |
166 | gcvalue.foreground = term->pix_colors[ (term->depth <= 2 ? Color_fg : Color_scroll)]; |
165 | gcvalue.foreground = term->pix_colors[ (term->depth <= 2 ? Color_fg : Color_scroll)]; |
167 | scrollbarGC = XCreateGC (term->dpy, term->vt, GCForeground, &gcvalue); |
166 | scrollbarGC = XCreateGC (term->dpy, term->vt, GCForeground, &gcvalue); |
168 | if (sbshadow) |
|
|
169 | { |
|
|
170 | XSetWindowBackground (term->dpy, win, term->pix_colors_focused[Color_trough]); |
|
|
171 | XClearWindow (term->dpy, win); |
|
|
172 | } |
|
|
173 | } |
167 | } |
174 | else |
168 | else |
175 | { |
169 | { |
176 | if (update) |
170 | if (update) |
177 | { |
171 | { |
178 | if (last_top < top) |
172 | if (last_top < top) |
179 | XClearArea (term->dpy, win, |
173 | XClearArea (term->dpy, win, |
180 | sbshadow, last_top, |
174 | shadow, last_top, |
181 | sbwidth, (top - last_top), |
175 | sbwidth, (top - last_top), |
182 | False); |
176 | False); |
183 | |
177 | |
184 | if (bot < last_bot) |
178 | if (bot < last_bot) |
185 | XClearArea (term->dpy, win, |
179 | XClearArea (term->dpy, win, |
186 | sbshadow, bot, |
180 | shadow, bot, |
187 | sbwidth, (last_bot - bot), |
181 | sbwidth, (last_bot - bot), |
188 | False); |
182 | False); |
189 | } |
183 | } |
190 | else |
184 | else |
191 | XClearWindow (term->dpy, win); |
185 | XClearWindow (term->dpy, win); |
… | |
… | |
197 | int xofs; |
191 | int xofs; |
198 | |
192 | |
199 | if (term->option (Opt_scrollBar_right)) |
193 | if (term->option (Opt_scrollBar_right)) |
200 | xofs = 0; |
194 | xofs = 0; |
201 | else |
195 | else |
202 | xofs = sbshadow ? sbwidth : sbwidth - 1; |
196 | xofs = shadow ? sbwidth : sbwidth - 1; |
203 | |
197 | |
204 | XDrawLine (term->dpy, win, botShadowGC, |
198 | XDrawLine (term->dpy, win, botShadowGC, |
205 | xofs, 0, xofs, end + sbwidth); |
199 | xofs, 0, xofs, end + sbwidth); |
206 | } |
200 | } |
207 | #endif |
201 | #endif |
208 | |
202 | |
209 | XFillRectangle (term->dpy, win, scrollbarGC, |
203 | XFillRectangle (term->dpy, win, scrollbarGC, |
210 | sbshadow, top, sbwidth, |
204 | shadow, top, sbwidth, |
211 | len); |
205 | bot - top); |
212 | |
206 | |
213 | if (sbshadow) |
207 | if (shadow) |
214 | /* trough shadow */ |
208 | /* trough shadow */ |
215 | draw_shadow (this, 0, 0, sbwidth + 2 * sbshadow, end + (sbwidth + 1) + sbshadow); |
209 | draw_shadow (this, 0, 0, sbwidth + 2 * shadow, end + (sbwidth + 1) + shadow); |
216 | |
210 | |
217 | /* shadow for scrollbar slider */ |
211 | /* shadow for scrollbar slider */ |
218 | draw_shadow (this, sbshadow, top, sbwidth, len); |
212 | draw_shadow (this, shadow, top, sbwidth, bot - top); |
219 | |
213 | |
220 | /* Redraw scrollbar arrows */ |
214 | /* Redraw scrollbar arrows */ |
221 | draw_button (this, sbshadow, sbshadow, UP); |
215 | draw_button (this, shadow, shadow, UP); |
222 | draw_button (this, sbshadow, end + 1, DN); |
216 | draw_button (this, shadow, end + 1, DN); |
223 | |
217 | |
224 | return 1; |
218 | return 1; |
225 | } |
219 | } |
226 | #endif /* RXVT_SCROLLBAR */ |
220 | #endif /* RXVT_SCROLLBAR */ |
227 | /*----------------------- end-of-file (C source) -----------------------*/ |
221 | /*----------------------- end-of-file (C source) -----------------------*/ |