--- rxvt-unicode/src/scrollbar-xterm.C 2006/01/25 21:09:21 1.19 +++ rxvt-unicode/src/scrollbar-xterm.C 2008/02/19 13:01:33 1.31 @@ -1,10 +1,10 @@ -/*--------------------------------*-C-*---------------------------------* +/*----------------------------------------------------------------------* * File: scrollbar-xterm.C *----------------------------------------------------------------------* * * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1999-2001 Geoff Wing - * Copyright (c) 2004 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 @@ -32,57 +32,58 @@ const unsigned char x_stp_bits[] = { 0xaa, 0x55 }; int -rxvt_term::scrollbar_show_xterm (int update, int last_top, int last_bot, int scrollbar_len) +scrollBar_t::show_xterm (int update) { int xsb = 0; - int sbwidth = scrollBar.width - 1; + int sbwidth = width - 1; - if ((scrollBar.init & R_SB_XTERM) == 0) + if ((init & R_SB_XTERM) == 0) { XGCValues gcvalue; - scrollBar.init |= R_SB_XTERM; - gcvalue.stipple = XCreateBitmapFromData (xdisp, scrollBar.win, - (char *)x_stp_bits, x_stp_width, - x_stp_height); + init |= R_SB_XTERM; + gcvalue.stipple = XCreateBitmapFromData (term->dpy, win, + (char *)x_stp_bits, x_stp_width, + x_stp_height); if (!gcvalue.stipple) rxvt_fatal ("can't create bitmap\n"); gcvalue.fill_style = FillOpaqueStippled; - gcvalue.foreground = pix_colors_focused[Color_fg]; - gcvalue.background = pix_colors_focused[Color_bg]; + gcvalue.foreground = term->pix_colors_focused[Color_scroll]; + gcvalue.background = term->pix_colors_focused[Color_bg]; - xscrollbarGC = XCreateGC (xdisp, scrollBar.win, + xscrollbarGC = XCreateGC (term->dpy, win, GCForeground | GCBackground | GCFillStyle | GCStipple, &gcvalue); - gcvalue.foreground = pix_colors_focused[Color_border]; - ShadowGC = XCreateGC (xdisp, scrollBar.win, GCForeground, &gcvalue); + gcvalue.foreground = term->pix_colors_focused[Color_border]; + ShadowGC = XCreateGC (term->dpy, win, GCForeground, &gcvalue); } + xsb = term->option (Opt_scrollBar_right) ? 1 : 0; + 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); + if (last_top < top) + XClearArea (term->dpy, win, + xsb, last_top, + sbwidth, (top - last_top), False); + + if (bot < last_bot) + XClearArea (term->dpy, win, + xsb, bot, + sbwidth, (last_bot - bot), False); } else - XClearWindow (xdisp, scrollBar.win); + XClearWindow (term->dpy, win); /* scrollbar slider */ - XFillRectangle (xdisp, scrollBar.win, xscrollbarGC, - xsb + 1, scrollBar.top, sbwidth - 2, scrollbar_len); + XFillRectangle (term->dpy, win, xscrollbarGC, + xsb + 1, top, sbwidth - 2, len); - XDrawLine (xdisp, scrollBar.win, ShadowGC, - xsb ? 0 : sbwidth, scrollBar.beg, - xsb ? 0 : sbwidth, scrollBar.end); + XDrawLine (term->dpy, win, ShadowGC, + xsb ? 0 : sbwidth, beg, + xsb ? 0 : sbwidth, end); return 1; } -#endif /* XTERM_SCROLLBAR */ +#endif /* XTERM_SCROLLBAR */ /*----------------------- end-of-file (C source) -----------------------*/