ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtlib.h.in
Revision: 1.80
Committed: Tue Dec 11 09:10:56 2007 UTC (16 years, 5 months ago) by ayin
Branch: MAIN
Changes since 1.79: +0 -5 lines
Log Message:
Remove definitions for unused types.

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