ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/scrollbar-xterm.C
Revision: 1.4
Committed: Sat Jan 31 00:20:21 2004 UTC (20 years, 4 months ago) by pcg
Content type: text/plain
Branch: MAIN
Changes since 1.3: +27 -28 lines
Log Message:
*** empty log message ***

File Contents

# User Rev Content
1 pcg 1.1 /*--------------------------------*-C-*---------------------------------*
2     * File: scrollbar-xterm.c
3     *----------------------------------------------------------------------*
4 pcg 1.4 * $Id: scrollbar-xterm.C,v 1.3 2003/11/25 11:52:42 pcg Exp $
5 pcg 1.1 *
6     * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA>
7     * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com>
8     *
9     * This program is free software; you can redistribute it and/or modify
10     * it under the terms of the GNU General Public License as published by
11     * the Free Software Foundation; either version 2 of the License, or
12     * (at your option) any later version.
13     *
14     * This program is distributed in the hope that it will be useful,
15     * but WITHOUT ANY WARRANTY; without even the implied warranty of
16     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17     * GNU General Public License for more details.
18     *
19     * You should have received a copy of the GNU General Public License
20     * along with this program; if not, write to the Free Software
21     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22     *----------------------------------------------------------------------*/
23    
24     #include "../config.h" /* NECESSARY */
25     #include "rxvt.h" /* NECESSARY */
26     #include "scrollbar-xterm.intpro" /* PROTOS for internal routines */
27    
28     /*----------------------------------------------------------------------*/
29     #if defined(XTERM_SCROLLBAR)
30    
31     #define x_stp_width 8
32     #define x_stp_height 2
33     const unsigned char x_stp_bits[] = { 0xff, 0xff };
34    
35     int
36 pcg 1.4 rxvt_term::scrollbar_show_xterm (int update __attribute__((unused)), int last_top, int last_bot, int scrollbar_len)
37 pcg 1.1 {
38     int xsb = 0;
39 pcg 1.4 int sbwidth = scrollBar.width - 1;
40 pcg 1.1
41 pcg 1.4 if ((scrollBar.init & R_SB_XTERM) == 0) {
42 pcg 1.1 XGCValues gcvalue;
43    
44 pcg 1.4 scrollBar.init |= R_SB_XTERM;
45     gcvalue.stipple = XCreateBitmapFromData(Xdisplay, scrollBar.win,
46 pcg 1.1 (char *)x_stp_bits, x_stp_width,
47     x_stp_height);
48     if (!gcvalue.stipple) {
49     rxvt_print_error("can't create bitmap");
50     exit(EXIT_FAILURE);
51     }
52     gcvalue.fill_style = FillOpaqueStippled;
53 pcg 1.4 gcvalue.foreground = PixColors[Color_fg];
54     gcvalue.background = PixColors[Color_bg];
55 pcg 1.1
56 pcg 1.4 xscrollbarGC = XCreateGC(Xdisplay, scrollBar.win,
57 pcg 1.1 GCForeground | GCBackground
58     | GCFillStyle | GCStipple, &gcvalue);
59 pcg 1.4 gcvalue.foreground = PixColors[Color_border];
60     ShadowGC = XCreateGC(Xdisplay, scrollBar.win, GCForeground,
61 pcg 1.1 &gcvalue);
62     }
63 pcg 1.4 /* instead of XClearWindow (Xdisplay, scrollBar.win); */
64     xsb = (Options & Opt_scrollBar_right) ? 1 : 0;
65     if (last_top < scrollBar.top)
66     XClearArea(Xdisplay, scrollBar.win,
67     sb_shadow + xsb, last_top,
68     sbwidth + 1, (scrollBar.top - last_top), False);
69    
70     if (scrollBar.bot < last_bot)
71     XClearArea(Xdisplay, scrollBar.win,
72     sb_shadow + xsb, scrollBar.bot,
73     sbwidth + 1, (last_bot - scrollBar.bot), False);
74 pcg 1.1
75     /* scrollbar slider */
76 pcg 1.4 XFillRectangle(Xdisplay, scrollBar.win, xscrollbarGC,
77     xsb + 1, scrollBar.top, sbwidth, scrollbar_len);
78 pcg 1.1
79 pcg 1.4 /*XDrawLine(Xdisplay, scrollBar.win, ShadowGC,
80     xsb ? 0 : sbwidth, scrollBar.beg,
81     xsb ? 0 : sbwidth, scrollBar.end);*/
82 pcg 1.1 return 1;
83     }
84     #endif /* XTERM_SCROLLBAR */
85     /*----------------------- end-of-file (C source) -----------------------*/