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.10 by root, Mon Jun 21 22:24:07 2004 UTC vs.
Revision 1.18 by root, Mon Jun 13 05:30:26 2005 UTC

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 */
82 pt[0].x, pt[0].y, pt[1].x, pt[1].y); 81 pt[0].x, pt[0].y, pt[1].x, pt[1].y);
83 82
84#if (SHADOW > 1) 83#if (SHADOW > 1)
85 /* doubled */ 84 /* doubled */
86 pt[0].x++; 85 pt[0].x++;
86
87 if (dirn == UP) 87 if (dirn == UP)
88 { 88 {
89 pt[0].y--; 89 pt[0].y--;
90 pt[1].y++; 90 pt[1].y++;
91 } 91 }
92 else 92 else
93 { 93 {
94 pt[0].y++; 94 pt[0].y++;
95 pt[1].y--; 95 pt[1].y--;
96 } 96 }
97
97 XDrawLine (display->display, scrollBar.win, top, 98 XDrawLine (display->display, scrollBar.win, top,
98 pt[0].x, pt[0].y, pt[1].x, pt[1].y); 99 pt[0].x, pt[0].y, pt[1].x, pt[1].y);
99#endif 100#endif
100 /* draw shadow on right */ 101 /* draw shadow on right */
101 pt[1].x = x + sz - 1; 102 pt[1].x = x + sz - 1;
102 /* pt[2].x = x + sz2; */ 103 /* pt[2].x = x + sz2; */
103 pt[1].y = y + (dirn == UP ? sz - 1 : 0); 104 pt[1].y = y + (dirn == UP ? sz - 1 : 0);
104 pt[2].y = y + (dirn == UP ? 0 : sz - 1); 105 pt[2].y = y + (dirn == UP ? 0 : sz - 1);
105 XDrawLine (display->display, scrollBar.win, bot, 106 XDrawLine (display->display, scrollBar.win, bot,
106 pt[2].x, pt[2].y, pt[1].x, pt[1].y); 107 pt[2].x, pt[2].y, pt[1].x, pt[1].y);
108
107#if (SHADOW > 1) 109#if (SHADOW > 1)
108 /* doubled */ 110 /* doubled */
109 pt[1].x--; 111 pt[1].x--;
110 if (dirn == UP) 112 if (dirn == UP)
111 { 113 {
122 pt[2].x, pt[2].y, pt[1].x, pt[1].y); 124 pt[2].x, pt[2].y, pt[1].x, pt[1].y);
123#endif 125#endif
124} 126}
125 127
126int 128int
127rxvt_term::scrollbar_show_rxvt (int update __attribute__ ((unused)), int last_top, int last_bot, int scrollbar_len) 129rxvt_term::scrollbar_show_rxvt (int update, int last_top, int last_bot, int scrollbar_len)
128{ 130{
129 int sbshadow = sb_shadow; 131 int sbshadow = sb_shadow;
130 int sbwidth = (int)scrollBar.width; 132 int sbwidth = (int)scrollBar.width;
131 133
132 if ((scrollBar.init & R_SB_RXVT) == 0) 134 if ((scrollBar.init & R_SB_RXVT) == 0)
133 { 135 {
134 scrollBar.init |= R_SB_RXVT; 136 scrollBar.init |= R_SB_RXVT;
137
135 if (sbshadow) 138 if (sbshadow)
136 { 139 {
137 XSetWindowBackground (display->display, scrollBar.win, PixColors[Color_trough]); 140 XSetWindowBackground (display->display, scrollBar.win, pix_colors_focused[Color_trough]);
138 XClearWindow (display->display, scrollBar.win); 141 XClearWindow (display->display, scrollBar.win);
139 } 142 }
140 } 143 }
141 else 144 else
142 { 145 {
143 /* instead of XClearWindow (display->display, scrollBar.win); */ 146 if (update)
147 {
144 if (last_top < scrollBar.top) 148 if (last_top < scrollBar.top)
145 XClearArea (display->display, scrollBar.win, 149 XClearArea (display->display, scrollBar.win,
146 sbshadow, last_top, 150 sbshadow, last_top,
147 sbwidth, (scrollBar.top - last_top), 151 sbwidth, (scrollBar.top - last_top),
148 False); 152 False);
149 153
150 if (scrollBar.bot < last_bot) 154 if (scrollBar.bot < last_bot)
151 XClearArea (display->display, scrollBar.win, 155 XClearArea (display->display, scrollBar.win,
152 sbshadow, scrollBar.bot, 156 sbshadow, scrollBar.bot,
153 sbwidth, (last_bot - scrollBar.bot), 157 sbwidth, (last_bot - scrollBar.bot),
154 False); 158 False);
159 }
160 else
161 XClearWindow (display->display, scrollBar.win);
155 } 162 }
156 163
157 /* scrollbar slider */ 164 /* scrollbar slider */
158#ifdef SB_BORDER 165#ifdef SB_BORDER
159 { 166 {
160 int xofs; 167 int xofs;
161 168
162 if (Options & Opt_scrollBar_right) 169 if (options & Opt_scrollBar_right)
163 xofs = 0; 170 xofs = 0;
164 else 171 else
165 xofs = sbshadow ? sbwidth : sbwidth - 1; 172 xofs = sbshadow ? sbwidth : sbwidth - 1;
166 173
167 XDrawLine (display->display, scrollBar.win, botShadowGC, 174 XDrawLine (display->display, scrollBar.win, botShadowGC,
193 200
194 return 1; 201 return 1;
195} 202}
196#endif /* RXVT_SCROLLBAR */ 203#endif /* RXVT_SCROLLBAR */
197/*----------------------- end-of-file (C source) -----------------------*/ 204/*----------------------- end-of-file (C source) -----------------------*/
205

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines