--- rxvt-unicode/src/scrollbar.C 2004/02/13 12:16:21 1.14 +++ rxvt-unicode/src/scrollbar.C 2006/01/03 02:43:33 1.29 @@ -1,11 +1,12 @@ /*--------------------------------*-C-*---------------------------------* - * File: scrollbar.c + * File: scrollbar.C *----------------------------------------------------------------------* * * Copyright (c) 1997,1998 mj olesen * Copyright (c) 1998 Alfredo K. Kojima * - N*XTstep like scrollbars * Copyright (c) 1999-2001 Geoff Wing + * Copyright (c) 2004 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 @@ -24,7 +25,6 @@ #include "../config.h" /* NECESSARY */ #include "rxvt.h" /* NECESSARY */ -#include "scrollbar.intpro" /* PROTOS for internal routines */ /*----------------------------------------------------------------------*/ @@ -37,18 +37,20 @@ int change = 0; #ifdef HAVE_SCROLLBARS - if (map && !scrollbar_visible ()) + if (map) { scrollBar.setIdle (); + if (!scrollBar.win) resize_scrollbar (); + if (scrollBar.win) { XMapWindow (display->display, scrollBar.win); change = 1; } } - else if (!map && scrollbar_visible ()) + else { scrollBar.state = 0; XUnmapWindow (display->display, scrollBar.win); @@ -68,10 +70,10 @@ #define R_SCROLLEND_XTERM szHint.height #define R_SCROLLBEG_NEXT 0 #define R_SCROLLEND_NEXT szHint.height - (SB_BUTTON_TOTAL_HEIGHT + \ - SB_PADDING) + SB_PADDING) #define R_SCROLLBEG_RXVT (scrollBar.width + 1) + sb_shadow #define R_SCROLLEND_RXVT szHint.height - R_SCROLLBEG_RXVT - \ - (2 * sb_shadow) + (2 * sb_shadow) #if defined(PLAIN_SCROLLBAR) if (scrollBar.style == R_SB_PLAIN) @@ -110,13 +112,13 @@ { /* create the scrollbar window */ scrollBar.win = XCreateSimpleWindow (display->display, - TermWin.parent[0], - window_sb_x, 0, - scrollbar_TotalWidth (), - szHint.height, - 0, - PixColors[Color_fg], - PixColors[Color_bg]); + parent[0], + window_sb_x, 0, + scrollbar_TotalWidth (), + szHint.height, + 0, + pix_colors[Color_fg], + pix_colors[Color_border]); #ifdef DEBUG_X XStoreName (display->display, scrollBar.win, "scrollbar"); #endif @@ -153,9 +155,9 @@ if (update) { - top = (TermWin.nscrolled - TermWin.view_start); - bot = top + (TermWin.nrow - 1); - len = max ((TermWin.nscrolled + (TermWin.nrow - 1)), 1); + top = nsaved - view_start; + bot = top + (nrow - 1); + len = max (nsaved + (nrow - 1), 1); adj = (((bot - top) * scrollbar_size ()) % len) > 0 ? 1 : 0; scrollBar.top = (scrollBar.beg + (top * scrollbar_size ()) / len); @@ -202,15 +204,15 @@ if (scrollstyle) { # ifdef NEXT_SCROLLBAR - if (STRNCASECMP (scrollstyle, "next", 4) == 0) + if (strncasecmp (scrollstyle, "next", 4) == 0) style = R_SB_NEXT; # endif # ifdef XTERM_SCROLLBAR - if (STRNCASECMP (scrollstyle, "xterm", 5) == 0) + if (strncasecmp (scrollstyle, "xterm", 5) == 0) style = R_SB_XTERM; # endif # ifdef PLAIN_SCROLLBAR - if (STRNCASECMP (scrollstyle, "plain", 5) == 0) + if (strncasecmp (scrollstyle, "plain", 5) == 0) style = R_SB_PLAIN; # endif @@ -230,8 +232,8 @@ width = min (i, SB_WIDTH_MAXIMUM); # if defined(RXVT_SCROLLBAR) - if (! (Options & Opt_scrollBar_floating) && style == R_SB_RXVT) - sb_shadow = SHADOW; + if (! OPTION (Opt_scrollBar_floating) && style == R_SB_RXVT) + sb_shadow = MENU_SHADOW; # endif scrollBar.style = style; @@ -240,9 +242,9 @@ /* scrollbar_align = R_SB_ALIGN_CENTRE; */ if (scrollalign) { - if (STRNCASECMP (scrollalign, "top", 3) == 0) + if (strncasecmp (scrollalign, "top", 3) == 0) scrollbar_align = R_SB_ALIGN_TOP; - else if (STRNCASECMP (scrollalign, "bottom", 6) == 0) + else if (strncasecmp (scrollalign, "bottom", 6) == 0) scrollbar_align = R_SB_ALIGN_BOTTOM; } #endif