--- rxvt-unicode/src/scrollbar-rxvt.C 2006/01/16 18:10:07 1.24 +++ rxvt-unicode/src/scrollbar-rxvt.C 2006/02/20 22:42:01 1.29 @@ -1,10 +1,10 @@ -/*--------------------------------*-C-*---------------------------------* +/*----------------------------------------------------------------------* * File: scrollbar-rxvt.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 @@ -27,8 +27,6 @@ /*----------------------------------------------------------------------*/ #if defined(RXVT_SCROLLBAR) -#define SHADOW_WIDTH 1 - static void draw_shadow (rxvt_term *term, int x, int y, int w, int h) { @@ -40,10 +38,10 @@ for (; shadow-- > 0; x++, y++, w--, h--) { - XDrawLine (term->display->display, term->scrollBar.win, term->topShadowGC, x, y, w, y); - XDrawLine (term->display->display, term->scrollBar.win, term->topShadowGC, x, y, x, h); - XDrawLine (term->display->display, term->scrollBar.win, term->botShadowGC, w, h, w, y + 1); - XDrawLine (term->display->display, term->scrollBar.win, term->botShadowGC, w, h, x + 1, h); + XDrawLine (term->dpy, term->scrollBar.win, term->topShadowGC, x, y, w , y ); + XDrawLine (term->dpy, term->scrollBar.win, term->topShadowGC, x, y, x , h ); + XDrawLine (term->dpy, term->scrollBar.win, term->botShadowGC, w, h, w , y + 1); + XDrawLine (term->dpy, term->scrollBar.win, term->botShadowGC, w, h, x + 1, h ); } } @@ -57,6 +55,7 @@ sz = term->scrollBar.width; sz2 = sz / 2; + switch (state) { case +1: @@ -76,6 +75,7 @@ pt[0].x = x; pt[1].x = x + sz - 1; pt[2].x = x + sz2; + if (dirn == UP) { pt[0].y = pt[1].y = y + sz - 1; @@ -87,17 +87,17 @@ pt[2].y = y + sz - 1; } - XFillPolygon (term->display->display, term->scrollBar.win, term->scrollbarGC, + XFillPolygon (term->dpy, term->scrollBar.win, term->scrollbarGC, pt, 3, Convex, CoordModeOrigin); /* draw base */ - XDrawLine (term->display->display, term->scrollBar.win, (dirn == UP ? bot : top), + XDrawLine (term->dpy, term->scrollBar.win, (dirn == UP ? bot : top), pt[0].x, pt[0].y, pt[1].x, pt[1].y); /* draw shadow on left */ pt[1].x = x + sz2 - 1; pt[1].y = y + (dirn == UP ? 0 : sz - 1); - XDrawLine (term->display->display, term->scrollBar.win, top, + XDrawLine (term->dpy, term->scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); #if SHADOW_WIDTH > 1 @@ -115,7 +115,7 @@ pt[1].y--; } - XDrawLine (term->display->display, term->scrollBar.win, top, + XDrawLine (term->dpy, term->scrollBar.win, top, pt[0].x, pt[0].y, pt[1].x, pt[1].y); #endif @@ -124,7 +124,7 @@ /* pt[2].x = x + sz2; */ pt[1].y = y + (dirn == UP ? sz - 1 : 0); pt[2].y = y + (dirn == UP ? 0 : sz - 1); - XDrawLine (term->display->display, term->scrollBar.win, bot, + XDrawLine (term->dpy, term->scrollBar.win, bot, pt[2].x, pt[2].y, pt[1].x, pt[1].y); #if SHADOW_WIDTH > 1 @@ -141,7 +141,7 @@ pt[1].y++; } - XDrawLine (term->display->display, term->scrollBar.win, bot, + XDrawLine (term->dpy, term->scrollBar.win, bot, pt[2].x, pt[2].y, pt[1].x, pt[1].y); #endif } @@ -158,8 +158,8 @@ if (sbshadow) { - XSetWindowBackground (display->display, scrollBar.win, pix_colors_focused[Color_trough]); - XClearWindow (display->display, scrollBar.win); + XSetWindowBackground (dpy, scrollBar.win, pix_colors_focused[Color_trough]); + XClearWindow (dpy, scrollBar.win); } } else @@ -167,19 +167,19 @@ if (update) { if (last_top < scrollBar.top) - XClearArea (display->display, scrollBar.win, + XClearArea (dpy, scrollBar.win, sbshadow, last_top, sbwidth, (scrollBar.top - last_top), False); if (scrollBar.bot < last_bot) - XClearArea (display->display, scrollBar.win, + XClearArea (dpy, scrollBar.win, sbshadow, scrollBar.bot, sbwidth, (last_bot - scrollBar.bot), False); } else - XClearWindow (display->display, scrollBar.win); + XClearWindow (dpy, scrollBar.win); } /* scrollbar slider */ @@ -192,12 +192,12 @@ else xofs = sbshadow ? sbwidth : sbwidth - 1; - XDrawLine (display->display, scrollBar.win, botShadowGC, + XDrawLine (dpy, scrollBar.win, botShadowGC, xofs, 0, xofs, scrollBar.end + sbwidth); } #endif - XFillRectangle (display->display, scrollBar.win, scrollbarGC, + XFillRectangle (dpy, scrollBar.win, scrollbarGC, sbshadow, scrollBar.top, sbwidth, scrollbar_len);