--- rxvt-unicode/src/scrollbar-rxvt.C 2006/02/20 22:42:01 1.29 +++ rxvt-unicode/src/scrollbar-rxvt.C 2008/02/19 10:46:03 1.36 @@ -47,7 +47,7 @@ /* draw triangular button with a shadow of 2 pixels */ static void -draw_button (rxvt_term *term, int x, int y, int state, int dirn) +draw_button (rxvt_term *term, int x, int y, int dirn) { unsigned int sz, sz2; XPoint pt[3]; @@ -56,19 +56,16 @@ sz = term->scrollBar.width; sz2 = sz / 2; - switch (state) + if ((dirn == UP && term->scrollBar.state == STATE_UP) + || (dirn == DN && term->scrollBar.state == STATE_DOWN)) { - case +1: - top = term->topShadowGC; - bot = term->botShadowGC; - break; - case -1: - top = term->botShadowGC; - bot = term->topShadowGC; - break; - default: - top = bot = term->scrollbarGC; - break; + top = term->botShadowGC; + bot = term->topShadowGC; + } + else + { + top = term->topShadowGC; + bot = term->botShadowGC; } /* fill triangle */ @@ -149,13 +146,21 @@ int rxvt_term::scrollbar_show_rxvt (int update, int last_top, int last_bot, int scrollbar_len) { - int sbshadow = sb_shadow; + int sbshadow = scrollBar.shadow; int sbwidth = (int)scrollBar.width; if ((scrollBar.init & R_SB_RXVT) == 0) { + XGCValues gcvalue; + scrollBar.init |= R_SB_RXVT; + gcvalue.foreground = pix_colors[Color_topShadow]; + topShadowGC = XCreateGC (dpy, vt, GCForeground, &gcvalue); + gcvalue.foreground = pix_colors[Color_bottomShadow]; + botShadowGC = XCreateGC (dpy, vt, GCForeground, &gcvalue); + gcvalue.foreground = pix_colors[ (depth <= 2 ? Color_fg : Color_scroll)]; + scrollbarGC = XCreateGC (dpy, vt, GCForeground, &gcvalue); if (sbshadow) { XSetWindowBackground (dpy, scrollBar.win, pix_colors_focused[Color_trough]); @@ -187,7 +192,7 @@ { int xofs; - if (OPTION (Opt_scrollBar_right)) + if (option (Opt_scrollBar_right)) xofs = 0; else xofs = sbshadow ? sbwidth : sbwidth - 1; @@ -209,11 +214,11 @@ draw_shadow (this, sbshadow, scrollBar.top, sbwidth, scrollbar_len); /* Redraw scrollbar arrows */ - draw_button (this, sbshadow, sbshadow, (scrollbar_isUp () ? -1 : +1), UP); - draw_button (this, sbshadow, scrollBar.end + 1, (scrollbar_isDn () ? -1 : +1), DN); + draw_button (this, sbshadow, sbshadow, UP); + draw_button (this, sbshadow, scrollBar.end + 1, DN); return 1; } -#endif /* RXVT_SCROLLBAR */ +#endif /* RXVT_SCROLLBAR */ /*----------------------- end-of-file (C source) -----------------------*/