--- rxvt-unicode/src/scrollbar.C 2008/02/19 10:47:03 1.60 +++ rxvt-unicode/src/scrollbar.C 2011/02/21 07:41:04 1.64 @@ -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 @@ -121,8 +121,7 @@ int sb_size = (sb_bot - sb_top) * size (); top = beg + (sb_top * size ()) / sb_len; - len = sb_size / sb_len + min_height () + (sb_size % sb_len > 0); - bot = top + len; + bot = top + sb_size / sb_len + min_height () + (sb_size % sb_len > 0); /* no change */ if (top == last_top && bot == last_bot @@ -131,7 +130,7 @@ return 0; } - ret = (term->*update) (refresh, last_top, last_bot, len); + ret = (this->*update) (refresh); last_top = top; last_bot = bot; @@ -195,11 +194,6 @@ if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM) width = min (i, SB_WIDTH_MAXIMUM); -# ifdef RXVT_SCROLLBAR - if (! term->option (Opt_scrollBar_floating) && style == R_SB_RXVT) - shadow = SHADOW_WIDTH; -# endif - this->style = style; this->width = width; @@ -217,6 +211,35 @@ } void +scrollBar_t::destroy () +{ +#ifdef XTERM_SCROLLBAR + if (xscrollbarGC) XFreeGC (term->dpy, xscrollbarGC); + if (ShadowGC) XFreeGC (term->dpy, ShadowGC); +#endif +#ifdef PLAIN_SCROLLBAR + if (pscrollbarGC) XFreeGC (term->dpy, pscrollbarGC); +#endif +#ifdef NEXT_SCROLLBAR + if (blackGC) XFreeGC (term->dpy, blackGC); + if (whiteGC) XFreeGC (term->dpy, whiteGC); + if (grayGC) XFreeGC (term->dpy, grayGC); + if (darkGC) XFreeGC (term->dpy, darkGC); + if (stippleGC) XFreeGC (term->dpy, stippleGC); + if (dimple) XFreePixmap (term->dpy, dimple); + if (upArrow) XFreePixmap (term->dpy, upArrow); + if (downArrow) XFreePixmap (term->dpy, downArrow); + if (upArrowHi) XFreePixmap (term->dpy, upArrowHi); + if (downArrowHi) XFreePixmap (term->dpy, downArrowHi); +#endif +#ifdef RXVT_SCROLLBAR + if (topShadowGC) XFreeGC (term->dpy, topShadowGC); + if (botShadowGC) XFreeGC (term->dpy, botShadowGC); + if (scrollbarGC) XFreeGC (term->dpy, scrollbarGC); +#endif +} + +void scrollBar_t::update_data () { #if defined(PLAIN_SCROLLBAR) @@ -224,7 +247,7 @@ { beg = 0; end = term->szHint.height; - update = &rxvt_term::scrollbar_show_plain; + update = &scrollBar_t::show_plain; } #endif #if defined(XTERM_SCROLLBAR) @@ -232,7 +255,7 @@ { beg = 0; end = term->szHint.height; - update = &rxvt_term::scrollbar_show_xterm; + update = &scrollBar_t::show_xterm; } #endif #if defined(NEXT_SCROLLBAR) @@ -240,7 +263,7 @@ { beg = 0; end = term->szHint.height - (SB_BUTTON_TOTAL_HEIGHT + SB_PADDING); - update = &rxvt_term::scrollbar_show_next; + update = &scrollBar_t::show_next; } #endif #if defined(RXVT_SCROLLBAR) @@ -248,7 +271,7 @@ { beg = (width + 1) + shadow; end = term->szHint.height - beg - (2 * shadow); - update = &rxvt_term::scrollbar_show_rxvt; + update = &scrollBar_t::show_rxvt; } #endif }