ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/scrollbar-xterm.C
Revision: 1.35
Committed: Thu May 22 18:54:33 2014 UTC (10 years ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: rxvt-unicode-rel-9_29, rxvt-unicode-rel-9_26, rxvt-unicode-rel-9_25, rxvt-unicode-rel-9_22, rxvt-unicode-rel-9_21, rxvt-unicode-rel-9_30, HEAD
Changes since 1.34: +1 -1 lines
Log Message:
GPLv3

File Contents

# User Rev Content
1 root 1.22 /*----------------------------------------------------------------------*
2 pcg 1.10 * File: scrollbar-xterm.C
3 pcg 1.1 *----------------------------------------------------------------------*
4     *
5     * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA>
6     * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com>
7 root 1.33 * Copyright (c) 2004-2006 Marc Lehmann <schmorp@schmorp.de>
8 pcg 1.1 *
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 root 1.35 * the Free Software Foundation; either version 3 of the License, or
12 pcg 1.1 * (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    
27     /*----------------------------------------------------------------------*/
28     #if defined(XTERM_SCROLLBAR)
29    
30     #define x_stp_width 8
31     #define x_stp_height 2
32 pcg 1.5 const unsigned char x_stp_bits[] = { 0xaa, 0x55 };
33 pcg 1.1
34     int
35 ayin 1.31 scrollBar_t::show_xterm (int update)
36 pcg 1.1 {
37 root 1.17 int xsb = 0;
38 ayin 1.31 int sbwidth = width - 1;
39 pcg 1.1
40 sf-exg 1.34 if ((init & SB_STYLE_XTERM) == 0)
41 pcg 1.6 {
42     XGCValues gcvalue;
43    
44 sf-exg 1.34 init |= SB_STYLE_XTERM;
45 ayin 1.31 gcvalue.stipple = XCreateBitmapFromData (term->dpy, win,
46 ayin 1.30 (char *)x_stp_bits, x_stp_width,
47     x_stp_height);
48 pcg 1.6 if (!gcvalue.stipple)
49 root 1.15 rxvt_fatal ("can't create bitmap\n");
50 pcg 1.9
51 pcg 1.6 gcvalue.fill_style = FillOpaqueStippled;
52 ayin 1.31 gcvalue.foreground = term->pix_colors_focused[Color_scroll];
53     gcvalue.background = term->pix_colors_focused[Color_bg];
54 pcg 1.6
55 ayin 1.31 xscrollbarGC = XCreateGC (term->dpy, win,
56 root 1.11 GCForeground | GCBackground
57     | GCFillStyle | GCStipple, &gcvalue);
58 ayin 1.31 gcvalue.foreground = term->pix_colors_focused[Color_border];
59     ShadowGC = XCreateGC (term->dpy, win, GCForeground, &gcvalue);
60 pcg 1.1 }
61 root 1.17
62 ayin 1.31 xsb = term->option (Opt_scrollBar_right) ? 1 : 0;
63 ayin 1.26
64 root 1.17 if (update)
65     {
66 ayin 1.31 if (last_top < top)
67     XClearArea (term->dpy, win,
68 ayin 1.30 xsb, last_top,
69 ayin 1.31 sbwidth, (top - last_top), False);
70 root 1.17
71 ayin 1.31 if (bot < last_bot)
72     XClearArea (term->dpy, win,
73     xsb, bot,
74     sbwidth, (last_bot - bot), False);
75 root 1.17 }
76     else
77 ayin 1.31 XClearWindow (term->dpy, win);
78 pcg 1.6
79     /* scrollbar slider */
80 ayin 1.31 XFillRectangle (term->dpy, win, xscrollbarGC,
81 ayin 1.32 xsb + 1, top, sbwidth - 2, bot - top);
82 pcg 1.6
83 ayin 1.31 XDrawLine (term->dpy, win, ShadowGC,
84     xsb ? 0 : sbwidth, beg,
85     xsb ? 0 : sbwidth, end);
86 pcg 1.6 return 1;
87 pcg 1.1 }
88 ayin 1.25 #endif /* XTERM_SCROLLBAR */
89 pcg 1.1 /*----------------------- end-of-file (C source) -----------------------*/