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

Comparing rxvt-unicode/src/scrollbar.C (file contents):
Revision 1.64 by root, Mon Feb 21 07:41:04 2011 UTC vs.
Revision 1.69 by sf-exg, Thu Aug 25 18:01:28 2011 UTC

49 change = 1; 49 change = 1;
50 } 50 }
51 } 51 }
52 else 52 else
53 { 53 {
54 state = 0; 54 state = STATE_OFF;
55 XUnmapWindow (term->dpy, win); 55 XUnmapWindow (term->dpy, win);
56 change = 1; 56 change = 1;
57 } 57 }
58 58
59 return change; 59 return change;
72 72
73 if (!win) 73 if (!win)
74 { 74 {
75 /* create the scrollbar window */ 75 /* create the scrollbar window */
76 win = XCreateSimpleWindow (term->dpy, 76 win = XCreateSimpleWindow (term->dpy,
77 term->parent[0], 77 term->parent,
78 window_sb_x, 0, 78 window_sb_x, 0,
79 total_width (), 79 total_width (),
80 term->szHint.height, 80 term->szHint.height,
81 0, 81 0,
82 term->pix_colors[Color_fg], 82 term->pix_colors[Color_fg],
116 if (refresh) 116 if (refresh)
117 { 117 {
118 int sb_top = term->view_start - term->top_row; 118 int sb_top = term->view_start - term->top_row;
119 int sb_bot = sb_top + (term->nrow - 1); 119 int sb_bot = sb_top + (term->nrow - 1);
120 int sb_len = max (term->nrow - 1 - term->top_row, 1); 120 int sb_len = max (term->nrow - 1 - term->top_row, 1);
121 int sb_size = (sb_bot - sb_top) * size ();
122 121
123 top = beg + (sb_top * size ()) / sb_len; 122 top = beg + (sb_top * size ()) / sb_len;
124 bot = top + sb_size / sb_len + min_height () + (sb_size % sb_len > 0); 123 bot = top + ecb_div_ru ((sb_bot - sb_top) * size (), sb_len) + min_height ();
125 /* no change */ 124 /* no change */
126 if (top == last_top 125 if (top == last_top
127 && bot == last_bot 126 && bot == last_bot
128 && (state == last_state 127 && (state == last_state
129 || !(state == STATE_UP || state == STATE_DOWN))) 128 || !(state == STATE_UP || state == STATE_DOWN)))
141 140
142void 141void
143scrollBar_t::setup (rxvt_term *term) 142scrollBar_t::setup (rxvt_term *term)
144{ 143{
145 int i; 144 int i;
146 short style, width; 145 short width;
147 const char *scrollalign, *scrollstyle, *thickness; 146 const char *scrollalign, *scrollstyle, *thickness;
147 enum sb_style style;
148 148
149 this->term = term; 149 this->term = term;
150 scrollalign = term->rs[Rs_scrollBar_align]; 150 scrollalign = term->rs[Rs_scrollBar_align];
151 scrollstyle = term->rs[Rs_scrollstyle]; 151 scrollstyle = term->rs[Rs_scrollstyle];
152 thickness = term->rs[Rs_scrollBar_thickness]; 152 thickness = term->rs[Rs_scrollBar_thickness];
192 192
193 if (style != R_SB_NEXT) /* dishonour request - for now */ 193 if (style != R_SB_NEXT) /* dishonour request - for now */
194 if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM) 194 if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM)
195 width = min (i, SB_WIDTH_MAXIMUM); 195 width = min (i, SB_WIDTH_MAXIMUM);
196 196
197# ifdef RXVT_SCROLLBAR
198 if (! term->option (Opt_scrollBar_floating) && style == R_SB_RXVT)
199 shadow = SHADOW_WIDTH;
200# endif
201
197 this->style = style; 202 this->style = style;
198 this->width = width; 203 this->width = width;
199 204
200 /* align = R_SB_ALIGN_CENTRE; */ 205 /* align = R_SB_ALIGN_CENTRE; */
201 if (scrollalign) 206 if (scrollalign)
203 if (strncasecmp (scrollalign, "top", 3) == 0) 208 if (strncasecmp (scrollalign, "top", 3) == 0)
204 align = R_SB_ALIGN_TOP; 209 align = R_SB_ALIGN_TOP;
205 else if (strncasecmp (scrollalign, "bottom", 6) == 0) 210 else if (strncasecmp (scrollalign, "bottom", 6) == 0)
206 align = R_SB_ALIGN_BOTTOM; 211 align = R_SB_ALIGN_BOTTOM;
207 } 212 }
208 last_bot = last_state = -1; 213 last_state = STATE_OFF;
209 /* cursor scrollBar: Black-on-White */ 214 /* cursor scrollBar: Black-on-White */
210 leftptr_cursor = XCreateFontCursor (term->dpy, XC_left_ptr); 215 leftptr_cursor = XCreateFontCursor (term->dpy, XC_left_ptr);
211} 216}
212 217
213void 218void

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines