ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/scrollbar-xterm.C
Revision: 1.10
Committed: Thu Apr 8 20:31:45 2004 UTC (20 years, 1 month ago) by pcg
Content type: text/plain
Branch: MAIN
CVS Tags: rel-2_8, rel-3_0
Changes since 1.9: +2 -1 lines
Log Message:
*** empty log message ***

File Contents

# Content
1 /*--------------------------------*-C-*---------------------------------*
2 * File: scrollbar-xterm.C
3 *----------------------------------------------------------------------*
4 *
5 * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA>
6 * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com>
7 * Copyright (c) 2004 Marc Lehmann <pcg@goof.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[] = { 0xaa, 0x55 };
34
35 int
36 rxvt_term::scrollbar_show_xterm (int update __attribute__ ((unused)), int last_top, int last_bot, int scrollbar_len)
37 {
38 int xsb = 0;
39 int sbwidth = scrollBar.width - 1;
40
41 if ((scrollBar.init & R_SB_XTERM) == 0)
42 {
43 XGCValues gcvalue;
44
45 scrollBar.init |= R_SB_XTERM;
46 gcvalue.stipple = XCreateBitmapFromData (display->display, scrollBar.win,
47 (char *)x_stp_bits, x_stp_width,
48 x_stp_height);
49 if (!gcvalue.stipple)
50 rxvt_fatal ("can't create bitmap");
51
52 gcvalue.fill_style = FillOpaqueStippled;
53 gcvalue.foreground = PixColors[Color_fg];
54 gcvalue.background = PixColors[Color_bg];
55
56 xscrollbarGC = XCreateGC (display->display, scrollBar.win,
57 GCForeground | GCBackground
58 | GCFillStyle | GCStipple, &gcvalue);
59 gcvalue.foreground = PixColors[Color_border];
60 ShadowGC = XCreateGC (display->display, scrollBar.win, GCForeground, &gcvalue);
61 }
62 /* instead of XClearWindow (display->display, scrollBar.win); */
63 xsb = (Options & Opt_scrollBar_right) ? 1 : 0;
64 if (last_top < scrollBar.top)
65 XClearArea (display->display, scrollBar.win,
66 sb_shadow + xsb, last_top,
67 sbwidth, (scrollBar.top - last_top), False);
68
69 if (scrollBar.bot < last_bot)
70 XClearArea (display->display, scrollBar.win,
71 sb_shadow + xsb, scrollBar.bot,
72 sbwidth, (last_bot - scrollBar.bot), False);
73
74 /* scrollbar slider */
75 XFillRectangle (display->display, scrollBar.win, xscrollbarGC,
76 xsb + 1, scrollBar.top, sbwidth - 2, scrollbar_len);
77
78 XDrawLine (display->display, scrollBar.win, ShadowGC,
79 xsb ? 0 : sbwidth, scrollBar.beg,
80 xsb ? 0 : sbwidth, scrollBar.end);
81 return 1;
82 }
83 #endif /* XTERM_SCROLLBAR */
84 /*----------------------- end-of-file (C source) -----------------------*/