ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtlib.h.in
Revision: 1.84
Committed: Tue Dec 18 12:04:50 2007 UTC (16 years, 5 months ago) by ayin
Branch: MAIN
Changes since 1.83: +0 -1 lines
Log Message:
Remove unused member variable.

File Contents

# Content
1 #ifndef _RXVTLIB_H_ /* include once only */
2 #define _RXVTLIB_H_
3
4 #include <cstdio>
5 #include <cctype>
6 #include <cerrno>
7 #include <cstdarg>
8 #include <cstdlib>
9 @include_stdint_h@
10 #include <sys/types.h>
11 #include <unistd.h>
12 #include <cstring>
13 #include <assert.h>
14 @include_sys_ioctl_h@
15 @include_sys_strredir_h@
16
17 #if HAVE_CWCHAR
18 # include <cwchar>
19 #elif HAVE_WCHAR_H
20 # include <wchar.h>
21 #else
22 // stdlib.h might provide it
23 #endif
24
25 using namespace std;
26
27 extern "C" {
28 #include <X11/Xlib.h>
29 #include <X11/Xutil.h>
30 #include <X11/Xresource.h>
31 }
32
33 struct rxvt_fontset;
34 struct rxvt_color;
35 struct rxvt_vars; /* defined later on */
36 struct rxvt_term;
37 struct rxvt_im;
38 struct rxvt_drawable;
39
40 typedef struct rxvt_term *rxvt_t;
41
42 extern rxvt_t rxvt_current_term;
43
44 #define SET_R(r) rxvt_current_term = const_cast<rxvt_term *>(r)
45 #define GET_R rxvt_current_term
46
47 typedef struct {
48 int row;
49 int col;
50 } row_col_t;
51
52 #if UNICODE_3
53 typedef uint32_t text_t;
54 #else
55 typedef uint16_t text_t; // saves lots of memory
56 #endif
57 typedef uint32_t rend_t;
58 typedef int32_t tlen_t; // was int16_t, but this results in smaller code and memory use
59 typedef int32_t tlen_t_; // specifically for use in the line_t structure
60
61 struct line_t;
62
63 /*
64 * terminal limits:
65 *
66 * width : 1 <= width
67 * height : 1 <= height
68 * ncol : 1 <= ncol <= MAX(tlen_t)
69 * nrow : 1 <= nrow <= MAX(int)
70 * saveLines : 0 <= saveLines <= MAX(int)
71 * term_start : 0 <= term_start < saveLines
72 * total_rows : nrow + saveLines
73 *
74 * top_row : -saveLines <= top_row <= 0
75 * view_start : top_row <= view_start <= 0
76 *
77 * | most coordinates are stored relative to term_start,
78 * ROW_BUF | which is the first line of the terminal screen
79 * |························= row_buf[0]
80 * |························= row_buf[1]
81 * |························= row_buf[2] etc.
82 * |
83 * +------------+···········= term_start + top_row
84 * | scrollback |
85 * | scrollback +---------+·= term_start + view_start
86 * | scrollback | display |
87 * | scrollback | display |
88 * +------------+·display·+·= term_start
89 * | terminal | display |
90 * | terminal +---------+
91 * | terminal |
92 * | terminal |
93 * +------------+···········= term_stat + nrow - 1
94 * |
95 * |
96 * END······················= total_rows
97 */
98
99 struct TermWin_t {
100 int width; /* window width [pixels] */
101 int height; /* window height [pixels] */
102 int fwidth; /* font width [pixels] */
103 int fheight; /* font height [pixels] */
104 int fbase; /* font ascent (baseline) [pixels] */
105 int ncol; /* window columns [characters] */
106 int nrow; /* window rows [characters] */
107 int focus; /* window has focus */
108 int mapped; /* window state mapped? */
109 int int_bwidth; /* internal border width */
110 int ext_bwidth; /* external border width */
111 int lineSpace; /* number of extra pixels between rows */
112 int saveLines; /* number of lines that fit in scrollback */
113 int total_rows; /* total number of rows in this terminal */
114 int term_start; /* term lines start here */
115 int view_start; /* scrollback view starts here */
116 int top_row; /* topmost row index of scrollback */
117 Window parent[6]; /* parent identifiers - we're parent[0] */
118 Window vt; /* vt100 window */
119 GC gc; /* GC for drawing */
120 Pixmap pixmap;
121 rxvt_drawable *drawable;
122 rxvt_fontset *fontset[4];
123 };
124
125 /*
126 * screen accounting:
127 * screen_t elements
128 * row: Cursor row position : 0 <= row < nrow
129 * col: Cursor column position : 0 <= col < ncol
130 * tscroll: Scrolling region top row inclusive : 0 <= row < nrow
131 * bscroll: Scrolling region bottom row inclusive : 0 <= row < nrow
132 *
133 * selection_t elements
134 * clicks: 1, 2 or 3 clicks - 4 indicates a special condition of 1 where
135 * nothing is selected
136 * beg: row/column of beginning of selection : never past mark
137 * mark: row/column of initial click : never past end
138 * end: row/column of one character past end of selection
139 * * Note: -nsaved <= beg.row <= mark.row <= end.row < nrow
140 * * Note: col == -1 ==> we're left of screen
141 *
142 */
143 typedef struct {
144 row_col_t cur; /* cursor position on the screen */
145 int tscroll; /* top of settable scroll region */
146 int bscroll; /* bottom of settable scroll region */
147 unsigned int charset; /* character set number [0..3] */
148 unsigned int flags; /* see below */
149 row_col_t s_cur; /* saved cursor position */
150 unsigned int s_charset; /* saved character set number [0..3] */
151 char s_charset_char;
152 rend_t s_rstyle; /* saved rendition style */
153 } screen_t;
154
155 enum selection_op_t {
156 SELECTION_CLEAR = 0, /* nothing selected */
157 SELECTION_INIT, /* marked a point */
158 SELECTION_BEGIN, /* started a selection */
159 SELECTION_CONT, /* continued selection */
160 SELECTION_DONE /* selection put in CUT_BUFFER0 */
161 };
162
163 typedef struct {
164 wchar_t *text; /* selected text */
165 unsigned int len; /* length of selected text */
166 unsigned int screen; /* screen being used */
167 unsigned int clicks; /* number of clicks */
168 selection_op_t op; /* current operation */
169 bool rect; /* rectangular selection? */
170 row_col_t beg; /* beginning of selection <= mark */
171 row_col_t mark; /* point of initial click <= end */
172 row_col_t end; /* one character past end point */
173 } selection_t;
174
175 /* ------------------------------------------------------------------------- */
176
177 /* screen_t flags */
178 #define Screen_Relative (1<<0) /* relative origin mode flag */
179 #define Screen_VisibleCursor (1<<1) /* cursor visible? */
180 #define Screen_Autowrap (1<<2) /* auto-wrap flag */
181 #define Screen_Insert (1<<3) /* insert mode (vs. overstrike) */
182 #define Screen_WrapNext (1<<4) /* need to wrap for next char? */
183 #define Screen_DefaultFlags (Screen_VisibleCursor | Screen_Autowrap)
184
185 /* rxvt_vars.options */
186 enum {
187 # define def(name,idx) Opt_ ## name = idx,
188 # define nodef(name) Opt_ ## name = 0,
189 # include "optinc.h"
190 # undef nodef
191 # undef def
192 Opt_count
193 };
194
195 /* ------------------------------------------------------------------------- */
196
197 typedef struct {
198 char state; /* scrollbar state */
199 char init; /* scrollbar has been initialised */
200 unsigned int beg; /* slider sub-window begin height */
201 unsigned int end; /* slider sub-window end height */
202 unsigned int top; /* slider top position */
203 unsigned int bot; /* slider bottom position */
204 unsigned int style; /* style: rxvt, xterm, next */
205 unsigned int width; /* scrollbar width */
206 Window win;
207 int (rxvt_term::*update)(int, int, int, int);
208
209 void setIdle() { state = 1 ; }
210 void setMotion() { state = 'm'; }
211 void setUp() { state = 'U'; }
212 void setDn() { state = 'D'; }
213 } scrollBar_t;
214
215 struct rxvt_vars : TermWin_t {
216 scrollBar_t scrollBar;
217 uint8_t options[(Opt_count + 7) >> 3];
218 XSizeHints szHint;
219 rxvt_color *pix_colors;
220 rxvt_color *pix_colors_focused;
221 #ifdef OFF_FOCUS_FADING
222 rxvt_color *pix_colors_unfocused;
223 #endif
224 Cursor TermWin_cursor; /* cursor for vt window */
225 int sb_shadow; /* scrollbar shadow width */
226 int numlock_state;
227 line_t *row_buf; // all lines, scrollback + terminal, circular, followed by temp_buf
228 line_t *drawn_buf; // text on screen
229 line_t *swap_buf; // lines for swap buffer
230 char *tabs; /* per location: 1 == tab-stop */
231 screen_t screen;
232 screen_t swap;
233 selection_t selection;
234 };
235
236 void rxvt_init ();
237
238 #endif /* _RXVTLIB_H_ */
239