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.13 by root, Sun Aug 15 22:09:24 2004 UTC vs.
Revision 1.21 by root, Mon Jan 16 15:12:48 2006 UTC

25#include "rxvt.h" /* NECESSARY */ 25#include "rxvt.h" /* NECESSARY */
26 26
27/*----------------------------------------------------------------------*/ 27/*----------------------------------------------------------------------*/
28#if defined(RXVT_SCROLLBAR) 28#if defined(RXVT_SCROLLBAR)
29 29
30#define DOUBLED 1
31
30/* draw triangular button with a shadow of SHADOW (1 or 2) pixels */ 32/* draw triangular button with a shadow of 2 pixels */
31void 33void
32rxvt_term::Draw_button (int x, int y, int state, int dirn) 34rxvt_term::Draw_button (int x, int y, int state, int dirn)
33{ 35{
34 unsigned int sz, sz2; 36 unsigned int sz, sz2;
35 XPoint pt[3]; 37 XPoint pt[3];
78 pt[1].x = x + sz2 - 1; 80 pt[1].x = x + sz2 - 1;
79 pt[1].y = y + (dirn == UP ? 0 : sz - 1); 81 pt[1].y = y + (dirn == UP ? 0 : sz - 1);
80 XDrawLine (display->display, scrollBar.win, top, 82 XDrawLine (display->display, scrollBar.win, top,
81 pt[0].x, pt[0].y, pt[1].x, pt[1].y); 83 pt[0].x, pt[0].y, pt[1].x, pt[1].y);
82 84
83#if (SHADOW > 1) 85#if DOUBLED
84 /* doubled */ 86 /* doubled */
85 pt[0].x++; 87 pt[0].x++;
88
86 if (dirn == UP) 89 if (dirn == UP)
87 { 90 {
88 pt[0].y--; 91 pt[0].y--;
89 pt[1].y++; 92 pt[1].y++;
90 } 93 }
91 else 94 else
92 { 95 {
93 pt[0].y++; 96 pt[0].y++;
94 pt[1].y--; 97 pt[1].y--;
95 } 98 }
99
96 XDrawLine (display->display, scrollBar.win, top, 100 XDrawLine (display->display, scrollBar.win, top,
97 pt[0].x, pt[0].y, pt[1].x, pt[1].y); 101 pt[0].x, pt[0].y, pt[1].x, pt[1].y);
98#endif 102#endif
103
99 /* draw shadow on right */ 104 /* draw shadow on right */
100 pt[1].x = x + sz - 1; 105 pt[1].x = x + sz - 1;
101 /* pt[2].x = x + sz2; */ 106 /* pt[2].x = x + sz2; */
102 pt[1].y = y + (dirn == UP ? sz - 1 : 0); 107 pt[1].y = y + (dirn == UP ? sz - 1 : 0);
103 pt[2].y = y + (dirn == UP ? 0 : sz - 1); 108 pt[2].y = y + (dirn == UP ? 0 : sz - 1);
104 XDrawLine (display->display, scrollBar.win, bot, 109 XDrawLine (display->display, scrollBar.win, bot,
105 pt[2].x, pt[2].y, pt[1].x, pt[1].y); 110 pt[2].x, pt[2].y, pt[1].x, pt[1].y);
106#if (SHADOW > 1) 111
112#if DOUBLED
107 /* doubled */ 113 /* doubled */
108 pt[1].x--; 114 pt[1].x--;
109 if (dirn == UP) 115 if (dirn == UP)
110 { 116 {
111 pt[2].y++; 117 pt[2].y++;
121 pt[2].x, pt[2].y, pt[1].x, pt[1].y); 127 pt[2].x, pt[2].y, pt[1].x, pt[1].y);
122#endif 128#endif
123} 129}
124 130
125int 131int
126rxvt_term::scrollbar_show_rxvt (int update __attribute__ ((unused)), int last_top, int last_bot, int scrollbar_len) 132rxvt_term::scrollbar_show_rxvt (int update, int last_top, int last_bot, int scrollbar_len)
127{ 133{
128 int sbshadow = sb_shadow; 134 int sbshadow = sb_shadow;
129 int sbwidth = (int)scrollBar.width; 135 int sbwidth = (int)scrollBar.width;
130 136
131 if ((scrollBar.init & R_SB_RXVT) == 0) 137 if ((scrollBar.init & R_SB_RXVT) == 0)
132 { 138 {
133 scrollBar.init |= R_SB_RXVT; 139 scrollBar.init |= R_SB_RXVT;
140
134 if (sbshadow) 141 if (sbshadow)
135 { 142 {
136 XSetWindowBackground (display->display, scrollBar.win, pix_colors[Color_trough]); 143 XSetWindowBackground (display->display, scrollBar.win, pix_colors_focused[Color_trough]);
137 XClearWindow (display->display, scrollBar.win); 144 XClearWindow (display->display, scrollBar.win);
138 } 145 }
139 } 146 }
140 else 147 else
141 { 148 {
142 /* instead of XClearWindow (display->display, scrollBar.win); */ 149 if (update)
150 {
143 if (last_top < scrollBar.top) 151 if (last_top < scrollBar.top)
144 XClearArea (display->display, scrollBar.win, 152 XClearArea (display->display, scrollBar.win,
145 sbshadow, last_top, 153 sbshadow, last_top,
146 sbwidth, (scrollBar.top - last_top), 154 sbwidth, (scrollBar.top - last_top),
147 False); 155 False);
148 156
149 if (scrollBar.bot < last_bot) 157 if (scrollBar.bot < last_bot)
150 XClearArea (display->display, scrollBar.win, 158 XClearArea (display->display, scrollBar.win,
151 sbshadow, scrollBar.bot, 159 sbshadow, scrollBar.bot,
152 sbwidth, (last_bot - scrollBar.bot), 160 sbwidth, (last_bot - scrollBar.bot),
153 False); 161 False);
162 }
163 else
164 XClearWindow (display->display, scrollBar.win);
154 } 165 }
155 166
156 /* scrollbar slider */ 167 /* scrollbar slider */
157#ifdef SB_BORDER 168#ifdef SB_BORDER
158 { 169 {
159 int xofs; 170 int xofs;
160 171
161 if (options & Opt_scrollBar_right) 172 if (OPTION (Opt_scrollBar_right))
162 xofs = 0; 173 xofs = 0;
163 else 174 else
164 xofs = sbshadow ? sbwidth : sbwidth - 1; 175 xofs = sbshadow ? sbwidth : sbwidth - 1;
165 176
166 XDrawLine (display->display, scrollBar.win, botShadowGC, 177 XDrawLine (display->display, scrollBar.win, botShadowGC,
192 203
193 return 1; 204 return 1;
194} 205}
195#endif /* RXVT_SCROLLBAR */ 206#endif /* RXVT_SCROLLBAR */
196/*----------------------- end-of-file (C source) -----------------------*/ 207/*----------------------- end-of-file (C source) -----------------------*/
208

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines