--- rxvt-unicode/src/scrollbar-xterm.C 2004/06/21 22:24:07 1.11 +++ rxvt-unicode/src/scrollbar-xterm.C 2006/01/25 21:09:21 1.19 @@ -23,7 +23,6 @@ #include "../config.h" /* NECESSARY */ #include "rxvt.h" /* NECESSARY */ -#include "scrollbar-xterm.intpro" /* PROTOS for internal routines */ /*----------------------------------------------------------------------*/ #if defined(XTERM_SCROLLBAR) @@ -33,49 +32,54 @@ const unsigned char x_stp_bits[] = { 0xaa, 0x55 }; int -rxvt_term::scrollbar_show_xterm (int update __attribute__ ((unused)), int last_top, int last_bot, int scrollbar_len) +rxvt_term::scrollbar_show_xterm (int update, int last_top, int last_bot, int scrollbar_len) { - int xsb = 0; - int sbwidth = scrollBar.width - 1; + int xsb = 0; + int sbwidth = scrollBar.width - 1; if ((scrollBar.init & R_SB_XTERM) == 0) { XGCValues gcvalue; scrollBar.init |= R_SB_XTERM; - gcvalue.stipple = XCreateBitmapFromData (display->display, scrollBar.win, + gcvalue.stipple = XCreateBitmapFromData (xdisp, scrollBar.win, (char *)x_stp_bits, x_stp_width, x_stp_height); if (!gcvalue.stipple) - rxvt_fatal ("can't create bitmap"); + rxvt_fatal ("can't create bitmap\n"); gcvalue.fill_style = FillOpaqueStippled; - gcvalue.foreground = PixColors[Color_fg]; - gcvalue.background = PixColors[Color_bg]; + gcvalue.foreground = pix_colors_focused[Color_fg]; + gcvalue.background = pix_colors_focused[Color_bg]; - xscrollbarGC = XCreateGC (display->display, scrollBar.win, + xscrollbarGC = XCreateGC (xdisp, scrollBar.win, GCForeground | GCBackground | GCFillStyle | GCStipple, &gcvalue); - gcvalue.foreground = PixColors[Color_border]; - ShadowGC = XCreateGC (display->display, scrollBar.win, GCForeground, &gcvalue); + gcvalue.foreground = pix_colors_focused[Color_border]; + ShadowGC = XCreateGC (xdisp, 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, (scrollBar.top - last_top), False); - - if (scrollBar.bot < last_bot) - XClearArea (display->display, scrollBar.win, - sb_shadow + xsb, scrollBar.bot, - sbwidth, (last_bot - scrollBar.bot), False); + + if (update) + { + xsb = OPTION (Opt_scrollBar_right) ? 1 : 0; + if (last_top < scrollBar.top) + XClearArea (xdisp, scrollBar.win, + sb_shadow + xsb, last_top, + sbwidth, (scrollBar.top - last_top), False); + + if (scrollBar.bot < last_bot) + XClearArea (xdisp, scrollBar.win, + sb_shadow + xsb, scrollBar.bot, + sbwidth, (last_bot - scrollBar.bot), False); + } + else + XClearWindow (xdisp, scrollBar.win); /* scrollbar slider */ - XFillRectangle (display->display, scrollBar.win, xscrollbarGC, + XFillRectangle (xdisp, scrollBar.win, xscrollbarGC, xsb + 1, scrollBar.top, sbwidth - 2, scrollbar_len); - XDrawLine (display->display, scrollBar.win, ShadowGC, + XDrawLine (xdisp, scrollBar.win, ShadowGC, xsb ? 0 : sbwidth, scrollBar.beg, xsb ? 0 : sbwidth, scrollBar.end); return 1;