--- rxvt-unicode/src/scrollbar-plain.C 2004/02/13 12:16:21 1.5 +++ rxvt-unicode/src/scrollbar-plain.C 2006/02/02 18:04:46 1.19 @@ -1,9 +1,10 @@ /*----------------------------------------------------------------------* - * File: scrollbar-plain.c + * File: scrollbar-plain.C *----------------------------------------------------------------------* * * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1999-2001 Geoff Wing + * Copyright (c) 2004 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 @@ -22,13 +23,12 @@ #include "../config.h" /* NECESSARY */ #include "rxvt.h" /* NECESSARY */ -#include "scrollbar-plain.intpro" /* PROTOS for internal routines */ /*----------------------------------------------------------------------*/ #if defined(PLAIN_SCROLLBAR) int -rxvt_term::scrollbar_show_plain (int update __attribute__ ((unused)), int last_top, int last_bot, int scrollbar_len) +rxvt_term::scrollbar_show_plain (int update, int last_top, int last_bot, int scrollbar_len) { int xsb = 0; int sbwidth = scrollBar.width - 1; @@ -38,27 +38,31 @@ XGCValues gcvalue; scrollBar.init |= R_SB_PLAIN; - gcvalue.foreground = PixColors[Color_fg]; - gcvalue.background = PixColors[Color_bg]; + gcvalue.foreground = pix_colors_focused[Color_scroll]; - pscrollbarGC = XCreateGC (display->display, scrollBar.win, - GCForeground | GCBackground, &gcvalue); + pscrollbarGC = XCreateGC (dpy, scrollBar.win, GCForeground, &gcvalue); } - /* instead of XClearWindow (display->display, scrollBar.win); */ - xsb = (Options & Opt_scrollBar_right) ? 1 : 0; - if (last_top < scrollBar.top) - XClearArea (display->display, scrollBar.win, - sb_shadow + xsb, last_top, - sbwidth + 1, (scrollBar.top - last_top), False); - - if (scrollBar.bot < last_bot) - XClearArea (display->display, scrollBar.win, - sb_shadow + xsb, scrollBar.bot, - sbwidth + 1, (last_bot - scrollBar.bot), False); + + xsb = OPTION (Opt_scrollBar_right) ? 1 : 0; + + if (update) + { + if (last_top < scrollBar.top) + XClearArea (dpy, scrollBar.win, + sb_shadow, last_top, + sbwidth + 1, scrollBar.top - last_top, False); + + if (scrollBar.bot < last_bot) + XClearArea (dpy, scrollBar.win, + sb_shadow, scrollBar.bot, + sbwidth + 1, last_bot - scrollBar.bot, False); + } + else + XClearWindow (dpy, scrollBar.win); /* scrollbar slider */ - XFillRectangle (display->display, scrollBar.win, pscrollbarGC, - xsb + 1, scrollBar.top, sbwidth, scrollbar_len); + XFillRectangle (dpy, scrollBar.win, pscrollbarGC, + 1 - xsb, scrollBar.top, sbwidth, scrollbar_len); return 1; }