ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/scrollbar-rxvt.C
(Generate patch)

Comparing rxvt-unicode/src/scrollbar-rxvt.C (file contents):
Revision 1.38 by ayin, Tue Feb 19 17:49:16 2008 UTC vs.
Revision 1.41 by root, Mon Feb 21 07:41:04 2011 UTC

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 2 of the License, or
12 * (at your option) any later version. 12 * (at your option) any later version.
148} 148}
149 149
150int 150int
151scrollBar_t::show_rxvt (int update) 151scrollBar_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 & R_SB_RXVT) == 0)
157 { 156 {
158 XGCValues gcvalue; 157 XGCValues gcvalue;
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) 167 if (!term->option (Opt_scrollBar_floating))
169 { 168 {
169 shadow = SHADOW_WIDTH;
170 XSetWindowBackground (term->dpy, win, term->pix_colors_focused[Color_trough]); 170 XSetWindowBackground (term->dpy, win, term->pix_colors_focused[Color_trough]);
171 XClearWindow (term->dpy, win); 171 XClearWindow (term->dpy, win);
172 } 172 }
173 } 173 }
174 else 174 else
175 { 175 {
176 if (update) 176 if (update)
177 { 177 {
178 if (last_top < top) 178 if (last_top < top)
179 XClearArea (term->dpy, win, 179 XClearArea (term->dpy, win,
180 sbshadow, last_top, 180 shadow, last_top,
181 sbwidth, (top - last_top), 181 sbwidth, (top - last_top),
182 False); 182 False);
183 183
184 if (bot < last_bot) 184 if (bot < last_bot)
185 XClearArea (term->dpy, win, 185 XClearArea (term->dpy, win,
186 sbshadow, bot, 186 shadow, bot,
187 sbwidth, (last_bot - bot), 187 sbwidth, (last_bot - bot),
188 False); 188 False);
189 } 189 }
190 else 190 else
191 XClearWindow (term->dpy, win); 191 XClearWindow (term->dpy, win);
197 int xofs; 197 int xofs;
198 198
199 if (term->option (Opt_scrollBar_right)) 199 if (term->option (Opt_scrollBar_right))
200 xofs = 0; 200 xofs = 0;
201 else 201 else
202 xofs = sbshadow ? sbwidth : sbwidth - 1; 202 xofs = shadow ? sbwidth : sbwidth - 1;
203 203
204 XDrawLine (term->dpy, win, botShadowGC, 204 XDrawLine (term->dpy, win, botShadowGC,
205 xofs, 0, xofs, end + sbwidth); 205 xofs, 0, xofs, end + sbwidth);
206 } 206 }
207#endif 207#endif
208 208
209 XFillRectangle (term->dpy, win, scrollbarGC, 209 XFillRectangle (term->dpy, win, scrollbarGC,
210 sbshadow, top, sbwidth, 210 shadow, top, sbwidth,
211 bot - top); 211 bot - top);
212 212
213 if (sbshadow) 213 if (shadow)
214 /* trough shadow */ 214 /* trough shadow */
215 draw_shadow (this, 0, 0, sbwidth + 2 * sbshadow, end + (sbwidth + 1) + sbshadow); 215 draw_shadow (this, 0, 0, sbwidth + 2 * shadow, end + (sbwidth + 1) + shadow);
216 216
217 /* shadow for scrollbar slider */ 217 /* shadow for scrollbar slider */
218 draw_shadow (this, sbshadow, top, sbwidth, bot - top); 218 draw_shadow (this, shadow, top, sbwidth, bot - top);
219 219
220 /* Redraw scrollbar arrows */ 220 /* Redraw scrollbar arrows */
221 draw_button (this, sbshadow, sbshadow, UP); 221 draw_button (this, shadow, shadow, UP);
222 draw_button (this, sbshadow, end + 1, DN); 222 draw_button (this, shadow, end + 1, DN);
223 223
224 return 1; 224 return 1;
225} 225}
226#endif /* RXVT_SCROLLBAR */ 226#endif /* RXVT_SCROLLBAR */
227/*----------------------- end-of-file (C source) -----------------------*/ 227/*----------------------- end-of-file (C source) -----------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines