ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/rxvtlib.h.in
Revision: 1.83
Committed: Mon Dec 17 11:16:58 2007 UTC (16 years, 5 months ago) by ayin
Branch: MAIN
Changes since 1.82: +0 -3 lines
Log Message:
Remove unneeded includes.

File Contents

# User Rev Content
1 pcg 1.3 #ifndef _RXVTLIB_H_ /* include once only */
2 pcg 1.1 #define _RXVTLIB_H_
3    
4 pcg 1.16 #include <cstdio>
5     #include <cctype>
6     #include <cerrno>
7 ayin 1.81 #include <cstdarg>
8     #include <cstdlib>
9 pcg 1.1 @include_stdint_h@
10     #include <sys/types.h>
11 ayin 1.81 #include <unistd.h>
12     #include <cstring>
13     #include <assert.h>
14 pcg 1.1 @include_sys_ioctl_h@
15     @include_sys_strredir_h@
16    
17 root 1.44 #if HAVE_CWCHAR
18     # include <cwchar>
19 root 1.45 #elif HAVE_WCHAR_H
20 root 1.44 # include <wchar.h>
21     #else
22     // stdlib.h might provide it
23     #endif
24 pcg 1.16
25 root 1.74 using namespace std;
26    
27 pcg 1.1 extern "C" {
28 root 1.73 #include <X11/Xlib.h>
29     #include <X11/Xutil.h>
30     #include <X11/Xresource.h>
31 pcg 1.1 }
32    
33     struct rxvt_fontset;
34     struct rxvt_color;
35 pcg 1.3 struct rxvt_vars; /* defined later on */
36     struct rxvt_term;
37 pcg 1.11 struct rxvt_im;
38 pcg 1.12 struct rxvt_drawable;
39 pcg 1.1
40 pcg 1.3 typedef struct rxvt_term *rxvt_t;
41    
42     extern rxvt_t rxvt_current_term;
43    
44 root 1.66 #define SET_R(r) rxvt_current_term = const_cast<rxvt_term *>(r)
45 root 1.43 #define GET_R rxvt_current_term
46 pcg 1.1
47     typedef struct {
48 root 1.41 int row;
49     int col;
50 pcg 1.1 } row_col_t;
51    
52 pcg 1.16 #if UNICODE_3
53 pcg 1.1 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 root 1.59 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 root 1.49
61 root 1.59 struct line_t;
62 pcg 1.1
63     /*
64 root 1.52 * terminal limits:
65     *
66     * width : 1 <= width
67     * height : 1 <= height
68 root 1.53 * ncol : 1 <= ncol <= MAX(tlen_t)
69     * nrow : 1 <= nrow <= MAX(int)
70     * saveLines : 0 <= saveLines <= MAX(int)
71 root 1.65 * term_start : 0 <= term_start < saveLines
72 root 1.52 * total_rows : nrow + saveLines
73 root 1.65 *
74     * top_row : -saveLines <= top_row <= 0
75     * view_start : top_row <= view_start <= 0
76 root 1.52 *
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 root 1.65 * +------------+···········= term_start + top_row
84 ayin 1.78 * | scrollback |
85 root 1.65 * | scrollback +---------+·= term_start + view_start
86 root 1.52 * | 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 pcg 1.1 */
98    
99 root 1.49 struct TermWin_t {
100 root 1.41 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 root 1.51 int total_rows; /* total number of rows in this terminal */
114 root 1.49 int term_start; /* term lines start here */
115 root 1.41 int view_start; /* scrollback view starts here */
116 root 1.65 int top_row; /* topmost row index of scrollback */
117 pcg 1.3 Window parent[6]; /* parent identifiers - we're parent[0] */
118     Window vt; /* vt100 window */
119     GC gc; /* GC for drawing */
120     Pixmap pixmap;
121 pcg 1.12 rxvt_drawable *drawable;
122 root 1.38 rxvt_fontset *fontset[4];
123 root 1.49 };
124 pcg 1.1
125     /*
126     * screen accounting:
127     * screen_t elements
128 root 1.49 * 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 pcg 1.1 *
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 root 1.51 * * Note: -nsaved <= beg.row <= mark.row <= end.row < nrow
140 pcg 1.1 * * Note: col == -1 ==> we're left of screen
141     *
142     */
143     typedef struct {
144 root 1.52 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 root 1.38 unsigned int charset; /* character set number [0..3] */
148 pcg 1.3 unsigned int flags; /* see below */
149     row_col_t s_cur; /* saved cursor position */
150 root 1.38 unsigned int s_charset; /* saved character set number [0..3] */
151 pcg 1.3 char s_charset_char;
152     rend_t s_rstyle; /* saved rendition style */
153 pcg 1.1 } screen_t;
154    
155     enum selection_op_t {
156 pcg 1.3 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 pcg 1.1 };
162    
163     typedef struct {
164 root 1.41 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 ayin 1.77 bool rect; /* rectangular selection? */
170 root 1.41 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 pcg 1.1 } selection_t;
174    
175     /* ------------------------------------------------------------------------- */
176    
177     /* screen_t flags */
178 root 1.47 #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 root 1.48 #define Screen_DefaultFlags (Screen_VisibleCursor | Screen_Autowrap)
184 pcg 1.1
185 root 1.32 /* rxvt_vars.options */
186 root 1.61 enum {
187 ayin 1.76 # define def(name,idx) Opt_ ## name = idx,
188     # define nodef(name) Opt_ ## name = 0,
189 root 1.61 # include "optinc.h"
190     # undef nodef
191     # undef def
192 ayin 1.76 Opt_count
193 root 1.61 };
194 pcg 1.1
195     /* ------------------------------------------------------------------------- */
196    
197     typedef struct {
198 pcg 1.3 char state; /* scrollbar state */
199     char init; /* scrollbar has been initialised */
200 root 1.38 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 pcg 1.3 Window win;
207 pcg 1.10 int (rxvt_term::*update)(int, int, int, int);
208 pcg 1.7
209     void setIdle() { state = 1 ; }
210     void setMotion() { state = 'm'; }
211     void setUp() { state = 'U'; }
212     void setDn() { state = 'D'; }
213 pcg 1.1 } scrollBar_t;
214    
215 root 1.49 struct rxvt_vars : TermWin_t {
216 pcg 1.3 scrollBar_t scrollBar;
217 ayin 1.76 uint8_t options[(Opt_count + 7) >> 3];
218 pcg 1.3 XSizeHints szHint;
219 root 1.32 rxvt_color *pix_colors;
220     rxvt_color *pix_colors_focused;
221 root 1.24 #ifdef OFF_FOCUS_FADING
222 root 1.32 rxvt_color *pix_colors_unfocused;
223 root 1.24 #endif
224 root 1.32 short numpix_colors;
225 pcg 1.3 Cursor TermWin_cursor; /* cursor for vt window */
226     int sb_shadow; /* scrollbar shadow width */
227     int numlock_state;
228 root 1.64 line_t *row_buf; // all lines, scrollback + terminal, circular, followed by temp_buf
229 root 1.52 line_t *drawn_buf; // text on screen
230     line_t *swap_buf; // lines for swap buffer
231 pcg 1.3 char *tabs; /* per location: 1 == tab-stop */
232     screen_t screen;
233     screen_t swap;
234     selection_t selection;
235     };
236 pcg 1.1
237 root 1.32 void rxvt_init ();
238 pcg 1.1
239 pcg 1.3 #endif /* _RXVTLIB_H_ */
240 pcg 1.1