ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/scrollbar-xterm.C
Revision: 1.27
Committed: Sat Dec 29 14:25:43 2007 UTC (16 years, 4 months ago) by ayin
Content type: text/plain
Branch: MAIN
Changes since 1.26: +2 -2 lines
Log Message:
Move sb_shadow from rxvt_vars to scrollBar_t.

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.21 * Copyright (c) 2004-2006 Marc Lehmann <pcg@goof.com>
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     * 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    
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 root 1.17 rxvt_term::scrollbar_show_xterm (int update, int last_top, int last_bot, int scrollbar_len)
36 pcg 1.1 {
37 root 1.17 int xsb = 0;
38     int sbwidth = scrollBar.width - 1;
39 pcg 1.1
40 pcg 1.6 if ((scrollBar.init & R_SB_XTERM) == 0)
41     {
42     XGCValues gcvalue;
43    
44     scrollBar.init |= R_SB_XTERM;
45 root 1.20 gcvalue.stipple = XCreateBitmapFromData (dpy, scrollBar.win,
46 pcg 1.6 (char *)x_stp_bits, x_stp_width,
47     x_stp_height);
48     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 root 1.23 gcvalue.foreground = pix_colors_focused[Color_scroll];
53 root 1.17 gcvalue.background = pix_colors_focused[Color_bg];
54 pcg 1.6
55 root 1.20 xscrollbarGC = XCreateGC (dpy, scrollBar.win,
56 root 1.11 GCForeground | GCBackground
57     | GCFillStyle | GCStipple, &gcvalue);
58 root 1.17 gcvalue.foreground = pix_colors_focused[Color_border];
59 root 1.20 ShadowGC = XCreateGC (dpy, scrollBar.win, GCForeground, &gcvalue);
60 pcg 1.1 }
61 root 1.17
62 ayin 1.26 xsb = option (Opt_scrollBar_right) ? 1 : 0;
63    
64 root 1.17 if (update)
65     {
66     if (last_top < scrollBar.top)
67 root 1.20 XClearArea (dpy, scrollBar.win,
68 ayin 1.27 scrollBar.sb_shadow + xsb, last_top,
69 root 1.17 sbwidth, (scrollBar.top - last_top), False);
70    
71     if (scrollBar.bot < last_bot)
72 root 1.20 XClearArea (dpy, scrollBar.win,
73 ayin 1.27 scrollBar.sb_shadow + xsb, scrollBar.bot,
74 root 1.17 sbwidth, (last_bot - scrollBar.bot), False);
75     }
76     else
77 root 1.20 XClearWindow (dpy, scrollBar.win);
78 pcg 1.6
79     /* scrollbar slider */
80 root 1.20 XFillRectangle (dpy, scrollBar.win, xscrollbarGC,
81 pcg 1.6 xsb + 1, scrollBar.top, sbwidth - 2, scrollbar_len);
82    
83 root 1.20 XDrawLine (dpy, scrollBar.win, ShadowGC,
84 pcg 1.6 xsb ? 0 : sbwidth, scrollBar.beg,
85     xsb ? 0 : sbwidth, scrollBar.end);
86     return 1;
87 pcg 1.1 }
88 ayin 1.25 #endif /* XTERM_SCROLLBAR */
89 pcg 1.1 /*----------------------- end-of-file (C source) -----------------------*/