1 | /* |
|
|
2 | * $Id: rxvtlib.h.in,v 1.3 2003/11/25 11:52:42 pcg Exp $ |
|
|
3 | */ |
|
|
4 | |
|
|
5 | #ifndef _RXVTLIB_H_ /* include once only */ |
1 | #ifndef _RXVTLIB_H_ /* include once only */ |
6 | #define _RXVTLIB_H_ |
2 | #define _RXVTLIB_H_ |
7 | |
3 | |
8 | /* |
|
|
9 | * section 1 generated by GNU autoconf for @build@ |
|
|
10 | * this section may be changed as appropriate _before_ building |
|
|
11 | */ |
|
|
12 | /***************************************************************************** |
|
|
13 | * SECTION 1 * |
|
|
14 | *****************************************************************************/ |
|
|
15 | |
|
|
16 | /* |
|
|
17 | * The following line MUST not be changed without also changing |
|
|
18 | * config.h in the main directory before building |
|
|
19 | */ |
|
|
20 | // none anymore |
|
|
21 | |
|
|
22 | /***************************************************************************** |
|
|
23 | * INCLUDES * |
|
|
24 | *****************************************************************************/ |
|
|
25 | |
|
|
26 | #include <stdio.h> |
4 | #include <cstdio> |
27 | #include <ctype.h> |
5 | #include <cctype> |
28 | #include <errno.h> |
6 | #include <cerrno> |
29 | @include_stdarg_h@ |
7 | @include_stdarg_h@ |
30 | @include_stdlib_h@ |
8 | @include_stdlib_h@ |
31 | @include_stdint_h@ |
9 | @include_stdint_h@ |
32 | #include <sys/types.h> |
10 | #include <sys/types.h> |
33 | @include_unistd_h@ |
11 | @include_unistd_h@ |
… | |
… | |
42 | @include_sys_strredir_h@ |
20 | @include_sys_strredir_h@ |
43 | |
21 | |
44 | #include <sys/wait.h> |
22 | #include <sys/wait.h> |
45 | #include <sys/stat.h> |
23 | #include <sys/stat.h> |
46 | |
24 | |
|
|
25 | #include <cwchar> |
|
|
26 | |
47 | extern "C" { |
27 | extern "C" { |
48 | #include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */ |
28 | #include <X11/Intrinsic.h> /* Xlib, Xutil, Xresource, Xfuncproto */ |
49 | } |
29 | } |
50 | |
30 | |
51 | /* |
31 | /* |
… | |
… | |
60 | /* whatever normal size corresponds to a integer pointer */ |
40 | /* whatever normal size corresponds to a integer pointer */ |
61 | @rxvt_intp_define@ |
41 | @rxvt_intp_define@ |
62 | /* whatever normal size corresponds to a unsigned integer pointer */ |
42 | /* whatever normal size corresponds to a unsigned integer pointer */ |
63 | @rxvt_u_intp_define@ |
43 | @rxvt_u_intp_define@ |
64 | |
44 | |
65 | /***************************************************************************** |
|
|
66 | * SECTION 2 * |
|
|
67 | * DO NOT TOUCH ANYTHING BELOW HERE * |
|
|
68 | *****************************************************************************/ |
|
|
69 | |
|
|
70 | struct rxvt_fontset; |
45 | struct rxvt_fontset; |
71 | struct rxvt_color; |
46 | struct rxvt_color; |
72 | struct rxvt_vars; /* defined later on */ |
47 | struct rxvt_vars; /* defined later on */ |
73 | struct rxvt_term; |
48 | struct rxvt_term; |
|
|
49 | struct rxvt_display; |
|
|
50 | struct rxvt_im; |
|
|
51 | struct rxvt_drawable; |
74 | |
52 | |
75 | typedef struct rxvt_term *rxvt_t; |
53 | typedef struct rxvt_term *rxvt_t; |
76 | |
54 | |
77 | extern rxvt_t rxvt_current_term; |
55 | extern rxvt_t rxvt_current_term; |
78 | |
|
|
79 | #define EXPLICIT_CONTEXT 1 |
|
|
80 | |
|
|
81 | #if EXPLICIT_CONTEXT |
|
|
82 | |
|
|
83 | # define pR rxvt_t rxvt_term |
|
|
84 | # define aR rxvt_term |
|
|
85 | # define pR_ pR, |
|
|
86 | # define aR_ aR, |
|
|
87 | |
|
|
88 | # define R rxvt_term |
|
|
89 | |
56 | |
90 | # define SET_R(r) rxvt_current_term = (r) |
57 | # define SET_R(r) rxvt_current_term = (r) |
91 | # define GET_R rxvt_current_term |
58 | # define GET_R rxvt_current_term |
92 | |
59 | |
93 | #else |
|
|
94 | |
|
|
95 | # define pR |
|
|
96 | # define pR_ |
|
|
97 | # define aR |
|
|
98 | # define aR_ |
|
|
99 | |
|
|
100 | # define R rxvt_current_term |
|
|
101 | |
|
|
102 | # define SET_R(r) rxvt_current_term = (r) |
|
|
103 | # define GET_R R |
|
|
104 | |
|
|
105 | #endif |
|
|
106 | |
|
|
107 | #define dR rxvt_t rxvt_term = GET_R |
|
|
108 | |
|
|
109 | #define scrollbar_visible(rxvtvars) ((rxvtvars)->scrollBar.state) |
60 | #define scrollbar_visible() scrollBar.state |
110 | #define menubar_visible(rxvtvars) ((rxvtvars)->menuBar.state) |
61 | #define menubar_visible() menuBar.state |
111 | |
62 | |
112 | typedef struct { |
63 | typedef struct { |
113 | int32_t row; |
64 | int32_t row; |
114 | int32_t col; |
65 | int32_t col; |
115 | } row_col_t; |
66 | } row_col_t; |
116 | |
67 | |
117 | #if UNICODE3 |
68 | #if UNICODE_3 |
118 | typedef uint32_t text_t; |
69 | typedef uint32_t text_t; |
119 | #else |
70 | #else |
120 | typedef uint16_t text_t; // saves lots of memory |
71 | typedef uint16_t text_t; // saves lots of memory |
121 | #endif |
72 | #endif |
122 | typedef uint32_t rend_t; |
73 | typedef uint32_t rend_t; |
… | |
… | |
152 | Window parent[6]; /* parent identifiers - we're parent[0] */ |
103 | Window parent[6]; /* parent identifiers - we're parent[0] */ |
153 | Window vt; /* vt100 window */ |
104 | Window vt; /* vt100 window */ |
154 | GC gc; /* GC for drawing */ |
105 | GC gc; /* GC for drawing */ |
155 | Pixmap pixmap; |
106 | Pixmap pixmap; |
156 | rxvt_fontset *fontset; |
107 | rxvt_fontset *fontset; |
|
|
108 | rxvt_drawable *drawable; |
157 | } TermWin_t; |
109 | } TermWin_t; |
158 | |
110 | |
159 | /* |
111 | /* |
160 | * screen accounting: |
112 | * screen accounting: |
161 | * screen_t elements |
113 | * screen_t elements |
… | |
… | |
184 | * scrollback region : we're only here if TermWin.view_start != 0 |
136 | * scrollback region : we're only here if TermWin.view_start != 0 |
185 | * Rows [TermWin.saveLines] ... [TermWin.saveLines + TermWin.nrow - 1] |
137 | * Rows [TermWin.saveLines] ... [TermWin.saveLines + TermWin.nrow - 1] |
186 | * normal `unscrolled' screen region |
138 | * normal `unscrolled' screen region |
187 | */ |
139 | */ |
188 | typedef struct { |
140 | typedef struct { |
|
|
141 | int16_t *tlen; /* length of each text line */ |
189 | text_t **text; /* _all_ the text */ |
142 | text_t **text; /* _all_ the text */ |
190 | int16_t *tlen; /* length of each text line */ |
|
|
191 | rend_t **rend; /* rendition, uses RS_ flags */ |
143 | rend_t **rend; /* rendition, uses RS_ flags */ |
192 | row_col_t cur; /* cursor position on the screen */ |
144 | row_col_t cur; /* cursor position on the screen */ |
193 | uint16_t tscroll; /* top of settable scroll region */ |
145 | uint16_t tscroll; /* top of settable scroll region */ |
194 | uint16_t bscroll; /* bottom of settable scroll region */ |
146 | uint16_t bscroll; /* bottom of settable scroll region */ |
195 | uint16_t charset; /* character set number [0..3] */ |
147 | uint16_t charset; /* character set number [0..3] */ |
… | |
… | |
207 | SELECTION_CONT, /* continued selection */ |
159 | SELECTION_CONT, /* continued selection */ |
208 | SELECTION_DONE /* selection put in CUT_BUFFER0 */ |
160 | SELECTION_DONE /* selection put in CUT_BUFFER0 */ |
209 | }; |
161 | }; |
210 | |
162 | |
211 | typedef struct { |
163 | typedef struct { |
212 | unsigned char *text; /* selected text */ |
164 | wchar_t *text; /* selected text */ |
213 | uint32_t len; /* length of selected text */ |
165 | uint32_t len; /* length of selected text */ |
214 | short screen; /* screen being used */ |
166 | short screen; /* screen being used */ |
215 | short clicks; /* number of clicks */ |
167 | short clicks; /* number of clicks */ |
216 | selection_op_t op; /* current operation */ |
168 | selection_op_t op; /* current operation */ |
217 | row_col_t beg; /* beginning of selection <= mark */ |
169 | row_col_t beg; /* beginning of selection <= mark */ |
218 | row_col_t mark; /* point of initial click <= end */ |
170 | row_col_t mark; /* point of initial click <= end */ |
219 | row_col_t end; /* one character past end point */ |
171 | row_col_t end; /* one character past end point */ |
220 | } selection_t; |
172 | } selection_t; |
221 | |
|
|
222 | typedef enum { |
|
|
223 | OLD_SELECT, OLD_WORD_SELECT, NEW_SELECT |
|
|
224 | } sstyle_t; |
|
|
225 | |
173 | |
226 | /* ------------------------------------------------------------------------- */ |
174 | /* ------------------------------------------------------------------------- */ |
227 | |
175 | |
228 | /* screen_t flags */ |
176 | /* screen_t flags */ |
229 | #define Screen_Relative (1<<0) /* relative origin mode flag */ |
177 | #define Screen_Relative (1<<0) /* relative origin mode flag */ |
… | |
… | |
247 | #define Opt_meta8 (1LU<<10) |
195 | #define Opt_meta8 (1LU<<10) |
248 | #define Opt_scrollTtyOutput (1LU<<11) |
196 | #define Opt_scrollTtyOutput (1LU<<11) |
249 | #define Opt_scrollTtyKeypress (1LU<<12) |
197 | #define Opt_scrollTtyKeypress (1LU<<12) |
250 | #define Opt_transparent (1LU<<13) |
198 | #define Opt_transparent (1LU<<13) |
251 | #define Opt_transparent_all (1LU<<14) |
199 | #define Opt_transparent_all (1LU<<14) |
252 | #define Opt_mc_hack (1LU<<15) |
200 | #define Opt_15 (1LU<<15) // UNALLOCATED |
253 | #define Opt_tripleclickwords (1LU<<16) |
201 | #define Opt_tripleclickwords (1LU<<16) |
254 | #define Opt_scrollWithBuffer (1LU<<17) |
202 | #define Opt_scrollWithBuffer (1LU<<17) |
255 | #define Opt_jumpScroll (1LU<<18) |
203 | #define Opt_jumpScroll (1LU<<18) |
256 | #define Opt_mouseWheelScrollPage (1LU<<19) |
204 | #define Opt_mouseWheelScrollPage (1LU<<19) |
257 | #define Opt_pointerBlank (1LU<<20) |
205 | #define Opt_pointerBlank (1LU<<20) |
… | |
… | |
266 | /* ------------------------------------------------------------------------- */ |
214 | /* ------------------------------------------------------------------------- */ |
267 | |
215 | |
268 | typedef struct { |
216 | typedef struct { |
269 | short state; |
217 | short state; |
270 | Window win; |
218 | Window win; |
|
|
219 | struct rxvt_drawable *drawable; |
271 | } menuBar_t; |
220 | } menuBar_t; |
272 | |
221 | |
273 | typedef struct { |
222 | typedef struct { |
274 | char state; /* scrollbar state */ |
223 | char state; /* scrollbar state */ |
275 | char init; /* scrollbar has been initialised */ |
224 | char init; /* scrollbar has been initialised */ |
… | |
… | |
278 | short top; /* slider top position */ |
227 | short top; /* slider top position */ |
279 | short bot; /* slider bottom position */ |
228 | short bot; /* slider bottom position */ |
280 | short style; /* style: rxvt, xterm, next */ |
229 | short style; /* style: rxvt, xterm, next */ |
281 | short width; /* scrollbar width */ |
230 | short width; /* scrollbar width */ |
282 | Window win; |
231 | Window win; |
283 | int (*update)(pR_ int, int, int, int); |
232 | int (rxvt_term::*update)(int, int, int, int); |
|
|
233 | |
|
|
234 | void setIdle() { state = 1 ; } |
|
|
235 | void setMotion() { state = 'm'; } |
|
|
236 | void setUp() { state = 'U'; } |
|
|
237 | void setDn() { state = 'D'; } |
284 | } scrollBar_t; |
238 | } scrollBar_t; |
285 | |
239 | |
286 | struct rxvt_vars { |
240 | struct rxvt_vars { |
287 | TermWin_t TermWin; |
241 | TermWin_t TermWin; |
288 | scrollBar_t scrollBar; |
242 | scrollBar_t scrollBar; |
289 | menuBar_t menuBar; |
243 | menuBar_t menuBar; |
290 | Display *Xdisplay; |
|
|
291 | unsigned long Options; |
244 | unsigned long Options; |
292 | XSizeHints szHint; |
245 | XSizeHints szHint; |
293 | Colormap Xcmap; |
246 | rxvt_display *display; |
294 | rxvt_color *PixColors; |
247 | rxvt_color *PixColors; |
295 | short numPixColors; |
248 | short numPixColors; |
296 | Cursor TermWin_cursor; /* cursor for vt window */ |
249 | Cursor TermWin_cursor; /* cursor for vt window */ |
297 | int Xdepth; |
|
|
298 | int sb_shadow; /* scrollbar shadow width */ |
250 | int sb_shadow; /* scrollbar shadow width */ |
299 | int Xfd; /* file descriptor of X server connection */ |
|
|
300 | int cmd_fd; /* pty file descriptor; connected to command */ |
251 | int cmd_fd; /* pty file descriptor; connected to command */ |
301 | int tty_fd; /* tty file descriptor; connected to child */ |
252 | int tty_fd; /* tty file descriptor; connected to child */ |
302 | int num_fds; /* number of file descriptors being used */ |
|
|
303 | int numlock_state; |
253 | int numlock_state; |
304 | text_t **drawn_text; /* text drawn on screen (characters) */ |
254 | text_t **drawn_text; /* text drawn on screen (characters) */ |
305 | rend_t **drawn_rend; /* text drawn on screen (rendition) */ |
255 | rend_t **drawn_rend; /* text drawn on screen (rendition) */ |
306 | text_t **buf_text; |
256 | text_t **buf_text; |
307 | rend_t **buf_rend; |
257 | rend_t **buf_rend; |
308 | char *tabs; /* per location: 1 == tab-stop */ |
258 | char *tabs; /* per location: 1 == tab-stop */ |
309 | screen_t screen; |
259 | screen_t screen; |
310 | screen_t swap; |
260 | screen_t swap; |
311 | selection_t selection; |
261 | selection_t selection; |
312 | sstyle_t selection_style; |
|
|
313 | }; |
262 | }; |
314 | |
263 | |
|
|
264 | void rxvt_init_signals (); |
315 | rxvt_t rxvt_init (int argc, const char *const *argv); |
265 | rxvt_t rxvt_init (int argc, const char *const *argv); |
316 | |
266 | |
317 | #endif /* _RXVTLIB_H_ */ |
267 | #endif /* _RXVTLIB_H_ */ |
318 | |
268 | |