--- rxvt-unicode/src/scrollbar.C 2011/04/07 12:19:41 1.66 +++ rxvt-unicode/src/scrollbar.C 2011/08/28 19:04:23 1.72 @@ -31,32 +31,25 @@ /* * Map or unmap a scrollbar. Returns non-zero upon change of state */ -int +void scrollBar_t::map (int map) { - int change = 0; - if (map) { state = STATE_IDLE; if (!win) resize (); - - if (win) - { - XMapWindow (term->dpy, win); - change = 1; - } + else + XMapWindow (term->dpy, win); } else { - state = 0; - XUnmapWindow (term->dpy, win); - change = 1; - } + state = STATE_OFF; - return change; + if (win) + XUnmapWindow (term->dpy, win); + } } void @@ -118,10 +111,9 @@ int sb_top = term->view_start - term->top_row; int sb_bot = sb_top + (term->nrow - 1); int sb_len = max (term->nrow - 1 - term->top_row, 1); - int sb_size = (sb_bot - sb_top) * size (); top = beg + (sb_top * size ()) / sb_len; - bot = top + sb_size / sb_len + min_height () + (sb_size % sb_len > 0); + bot = top + ecb_div_ru ((sb_bot - sb_top) * size (), sb_len) + min_height (); /* no change */ if (top == last_top && bot == last_bot @@ -143,7 +135,6 @@ scrollBar_t::setup (rxvt_term *term) { int i; - short style, width; const char *scrollalign, *scrollstyle, *thickness; this->term = term; @@ -199,9 +190,6 @@ shadow = SHADOW_WIDTH; # endif - this->style = style; - this->width = width; - /* align = R_SB_ALIGN_CENTRE; */ if (scrollalign) { @@ -210,7 +198,7 @@ else if (strncasecmp (scrollalign, "bottom", 6) == 0) align = R_SB_ALIGN_BOTTOM; } - last_bot = last_state = -1; + last_state = STATE_OFF; /* cursor scrollBar: Black-on-White */ leftptr_cursor = XCreateFontCursor (term->dpy, XC_left_ptr); }