--- rxvt-unicode/src/scrollbar.C 2005/12/18 00:59:42 1.26 +++ rxvt-unicode/src/scrollbar.C 2007/05/01 21:30:01 1.39 @@ -1,4 +1,4 @@ -/*--------------------------------*-C-*---------------------------------* +/*----------------------------------------------------------------------* * File: scrollbar.C *----------------------------------------------------------------------* * @@ -6,7 +6,7 @@ * Copyright (c) 1998 Alfredo K. Kojima * - N*XTstep like scrollbars * 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 @@ -34,7 +34,7 @@ int rxvt_term::scrollbar_mapping (int map) { - int change = 0; + int change = 0; #ifdef HAVE_SCROLLBARS if (map) @@ -46,17 +46,18 @@ if (scrollBar.win) { - XMapWindow (display->display, scrollBar.win); + XMapWindow (dpy, scrollBar.win); change = 1; } } else { scrollBar.state = 0; - XUnmapWindow (display->display, scrollBar.win); + XUnmapWindow (dpy, scrollBar.win); change = 1; } #endif + return change; } @@ -111,7 +112,7 @@ if (!scrollBar.win) { /* create the scrollbar window */ - scrollBar.win = XCreateSimpleWindow (display->display, + scrollBar.win = XCreateSimpleWindow (dpy, parent[0], window_sb_x, 0, scrollbar_TotalWidth (), @@ -119,12 +120,9 @@ 0, pix_colors[Color_fg], pix_colors[Color_border]); -#ifdef DEBUG_X - XStoreName (display->display, scrollBar.win, "scrollbar"); -#endif - XDefineCursor (display->display, scrollBar.win, leftptr_cursor); + XDefineCursor (dpy, scrollBar.win, leftptr_cursor); - XSelectInput (display->display, scrollBar.win, + XSelectInput (dpy, scrollBar.win, ExposureMask | ButtonPressMask | ButtonReleaseMask | Button1MotionMask | Button2MotionMask | Button3MotionMask); @@ -136,7 +134,7 @@ scrollbar_show (1); if (delayed_init) - XMapWindow (display->display, scrollBar.win); + XMapWindow (dpy, scrollBar.win); #endif } @@ -150,14 +148,14 @@ #ifdef HAVE_SCROLLBARS int top, bot, len, adj; - if (!scrollbar_visible ()) + if (!scrollBar.state) return 0; if (update) { - top = nscrolled - view_start; + top = view_start - top_row; bot = top + (nrow - 1); - len = max (nscrolled + (nrow - 1), 1); + len = max (nrow - 1 - top_row, 1); adj = (((bot - top) * scrollbar_size ()) % len) > 0 ? 1 : 0; scrollBar.top = (scrollBar.beg + (top * scrollbar_size ()) / len); @@ -231,9 +229,9 @@ if (thickness && (i = atoi (thickness)) >= SB_WIDTH_MINIMUM) width = min (i, SB_WIDTH_MAXIMUM); -# if defined(RXVT_SCROLLBAR) - if (! (options & Opt_scrollBar_floating) && style == R_SB_RXVT) - sb_shadow = SHADOW; +# ifdef RXVT_SCROLLBAR + if (! option (Opt_scrollBar_floating) && style == R_SB_RXVT) + sb_shadow = SHADOW_WIDTH; # endif scrollBar.style = style;