ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/scrollbar.C
(Generate patch)

Comparing rxvt-unicode/src/scrollbar.C (file contents):
Revision 1.5 by pcg, Thu Dec 18 05:45:11 2003 UTC vs.
Revision 1.6 by pcg, Thu Dec 18 13:33:03 2003 UTC

1/*--------------------------------*-C-*---------------------------------* 1/*--------------------------------*-C-*---------------------------------*
2 * File: scrollbar.c 2 * File: scrollbar.c
3 *----------------------------------------------------------------------* 3 *----------------------------------------------------------------------*
4 * $Id: scrollbar.C,v 1.5 2003/12/18 05:45:11 pcg Exp $ 4 * $Id: scrollbar.C,v 1.6 2003/12/18 13:33:03 pcg Exp $
5 * 5 *
6 * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA> 6 * Copyright (c) 1997,1998 mj olesen <olesen@me.QueensU.CA>
7 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org> 7 * Copyright (c) 1998 Alfredo K. Kojima <kojima@windowmaker.org>
8 * - N*XTstep like scrollbars 8 * - N*XTstep like scrollbars
9 * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com> 9 * Copyright (c) 1999-2001 Geoff Wing <gcw@pobox.com>
35/* EXTPROTO */ 35/* EXTPROTO */
36int 36int
37rxvt_scrollbar_mapping(pR_ int map) 37rxvt_scrollbar_mapping(pR_ int map)
38{ 38{
39 int change = 0; 39 int change = 0;
40#ifdef HAVE_SCROLLBARS
41 40
41#ifdef HAVE_SCROLLBARS
42 if (map && !scrollbar_visible(R)) { 42 if (map && !scrollbar_visible(R)) {
43 R->scrollBar.setIdle (); 43 R->scrollBar.setIdle ();
44 if (!R->scrollBar.win) 44 if (!R->scrollBar.win)
45 rxvt_Resize_scrollBar(aR); 45 R->resize_scrollbar ();
46 if (R->scrollBar.win) { 46 if (R->scrollBar.win) {
47 XMapWindow(R->Xdisplay, R->scrollBar.win); 47 XMapWindow(R->Xdisplay, R->scrollBar.win);
48 change = 1; 48 change = 1;
49 } 49 }
50 } else if (!map && scrollbar_visible(R)) { 50 } else if (!map && scrollbar_visible(R)) {
54 } 54 }
55#endif 55#endif
56 return change; 56 return change;
57} 57}
58 58
59/* EXTPROTO */
60void 59void
61rxvt_Resize_scrollBar(pR) 60rxvt_term::resize_scrollbar ()
62{ 61{
63#ifdef HAVE_SCROLLBARS 62#ifdef HAVE_SCROLLBARS
64 int delayed_init = 0; 63 int delayed_init = 0;
65 64
66#define R_SCROLLBEG_XTERM 0 65#define R_SCROLLBEG_XTERM 0
67#define R_SCROLLEND_XTERM R->szHint.height 66#define R_SCROLLEND_XTERM szHint.height
68#define R_SCROLLBEG_NEXT 0 67#define R_SCROLLBEG_NEXT 0
69#define R_SCROLLEND_NEXT R->szHint.height - (SB_BUTTON_TOTAL_HEIGHT + \ 68#define R_SCROLLEND_NEXT szHint.height - (SB_BUTTON_TOTAL_HEIGHT + \
70 SB_PADDING) 69 SB_PADDING)
71#define R_SCROLLBEG_RXVT (R->scrollBar.width + 1) + R->sb_shadow 70#define R_SCROLLBEG_RXVT (scrollBar.width + 1) + sb_shadow
72#define R_SCROLLEND_RXVT R->szHint.height - R_SCROLLBEG_RXVT - \ 71#define R_SCROLLEND_RXVT szHint.height - R_SCROLLBEG_RXVT - \
73 (2 * R->sb_shadow) 72 (2 * sb_shadow)
74 73
75#if defined(XTERM_SCROLLBAR) 74#if defined(XTERM_SCROLLBAR)
76 if (R->scrollBar.style == R_SB_XTERM) { 75 if (scrollBar.style == R_SB_XTERM) {
77 R->scrollBar.beg = R_SCROLLBEG_XTERM; 76 scrollBar.beg = R_SCROLLBEG_XTERM;
78 R->scrollBar.end = R_SCROLLEND_XTERM; 77 scrollBar.end = R_SCROLLEND_XTERM;
79 R->scrollBar.update = rxvt_scrollbar_show_xterm; 78 scrollBar.update = rxvt_scrollbar_show_xterm;
80 } 79 }
81#endif 80#endif
82#if defined(NEXT_SCROLLBAR) 81#if defined(NEXT_SCROLLBAR)
83 if (R->scrollBar.style == R_SB_NEXT) { 82 if (scrollBar.style == R_SB_NEXT) {
84 R->scrollBar.beg = R_SCROLLBEG_NEXT; 83 scrollBar.beg = R_SCROLLBEG_NEXT;
85 R->scrollBar.end = R_SCROLLEND_NEXT; 84 scrollBar.end = R_SCROLLEND_NEXT;
86 R->scrollBar.update = rxvt_scrollbar_show_next; 85 scrollBar.update = rxvt_scrollbar_show_next;
87 } 86 }
88#endif 87#endif
89#if defined(RXVT_SCROLLBAR) 88#if defined(RXVT_SCROLLBAR)
90 if (R->scrollBar.style == R_SB_RXVT) { 89 if (scrollBar.style == R_SB_RXVT) {
91 R->scrollBar.beg = R_SCROLLBEG_RXVT; 90 scrollBar.beg = R_SCROLLBEG_RXVT;
92 R->scrollBar.end = R_SCROLLEND_RXVT; 91 scrollBar.end = R_SCROLLEND_RXVT;
93 R->scrollBar.update = rxvt_scrollbar_show_rxvt; 92 scrollBar.update = rxvt_scrollbar_show_rxvt;
94 } 93 }
95#endif 94#endif
96 95
97 if (!R->scrollBar.win) { 96 if (!scrollBar.win) {
98/* create the scrollbar window */ 97/* create the scrollbar window */
99 R->scrollBar.win = XCreateSimpleWindow(R->Xdisplay, 98 scrollBar.win = XCreateSimpleWindow(Xdisplay,
100 R->TermWin.parent[0], 99 TermWin.parent[0],
101 R->window_sb_x, 0, 100 window_sb_x, 0,
102 scrollbar_TotalWidth(), 101 scrollbar_TotalWidth(),
103 R->szHint.height, 102 szHint.height,
104 0, 103 0,
105 R->PixColors[Color_fg], 104 PixColors[Color_fg],
106 R->PixColors[Color_bg]); 105 PixColors[Color_bg]);
107#ifdef DEBUG_X 106#ifdef DEBUG_X
108 XStoreName(R->Xdisplay, R->scrollBar.win, "scrollbar"); 107 XStoreName(Xdisplay, scrollBar.win, "scrollbar");
109#endif 108#endif
110 XDefineCursor(R->Xdisplay, R->scrollBar.win, R->leftptr_cursor); 109 XDefineCursor(Xdisplay, scrollBar.win, leftptr_cursor);
111 XSelectInput(R->Xdisplay, R->scrollBar.win, 110 XSelectInput(Xdisplay, scrollBar.win,
112 (ExposureMask | ButtonPressMask | ButtonReleaseMask 111 (ExposureMask | ButtonPressMask | ButtonReleaseMask
113 | Button1MotionMask | Button2MotionMask 112 | Button1MotionMask | Button2MotionMask
114 | Button3MotionMask)); 113 | Button3MotionMask));
115 delayed_init = 1; 114 delayed_init = 1;
116 } 115 }
117 rxvt_scrollbar_show(aR_ 1); 116 rxvt_scrollbar_show (this, 1);
118 if (delayed_init) 117 if (delayed_init)
119 XMapWindow(R->Xdisplay, R->scrollBar.win); 118 XMapWindow (Xdisplay, scrollBar.win);
120#endif 119#endif
121} 120}
122 121
123/* 122/*
124 * Update current scrollbar view w.r.t. slider heights, etc. 123 * Update current scrollbar view w.r.t. slider heights, etc.

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines