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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines