--- rxvt-unicode/src/scrollbar.C 2008/02/19 17:49:16 1.62 +++ rxvt-unicode/src/scrollbar.C 2011/08/28 18:48:41 1.71 @@ -6,7 +6,7 @@ * Copyright (c) 1998 Alfredo K. Kojima * - N*XTstep like scrollbars * Copyright (c) 1999-2001 Geoff Wing - * Copyright (c) 2004-2006 Marc Lehmann + * Copyright (c) 2004-2006 Marc Lehmann * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,11 +31,9 @@ /* * 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; @@ -46,17 +44,13 @@ if (win) { XMapWindow (term->dpy, win); - change = 1; } } else { - state = 0; + state = STATE_OFF; XUnmapWindow (term->dpy, win); - change = 1; } - - return change; } void @@ -74,7 +68,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 +112,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 +136,6 @@ scrollBar_t::setup (rxvt_term *term) { int i; - short style, width; const char *scrollalign, *scrollstyle, *thickness; this->term = term; @@ -199,9 +191,6 @@ shadow = SHADOW_WIDTH; # endif - this->style = style; - this->width = width; - /* align = R_SB_ALIGN_CENTRE; */ if (scrollalign) { @@ -210,7 +199,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); }