--- rxvt-unicode/src/scrollbar.C 2011/02/21 07:41:04 1.64 +++ rxvt-unicode/src/scrollbar.C 2011/08/30 16:39:03 1.73 @@ -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 @@ -74,7 +67,7 @@ { /* create the scrollbar window */ win = XCreateSimpleWindow (term->dpy, - term->parent[0], + term->parent, window_sb_x, 0, total_width (), term->szHint.height, @@ -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 @@ -142,8 +134,7 @@ void scrollBar_t::setup (rxvt_term *term) { - int i; - short style, width; + int i; const char *scrollalign, *scrollstyle, *thickness; this->term = term; @@ -194,8 +185,10 @@ if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM) width = min (i, SB_WIDTH_MAXIMUM); - this->style = style; - this->width = width; +# ifdef RXVT_SCROLLBAR + if (! term->option (Opt_scrollBar_floating) && style == R_SB_RXVT) + shadow = SHADOW_WIDTH; +# endif /* align = R_SB_ALIGN_CENTRE; */ if (scrollalign) @@ -205,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); }