… | |
… | |
27 | #else |
27 | #else |
28 | // stdlib.h might provide it |
28 | // stdlib.h might provide it |
29 | #endif |
29 | #endif |
30 | |
30 | |
31 | using namespace std; |
31 | using namespace std; |
|
|
32 | |
|
|
33 | // we assume that Xlib.h defines XPointer, and it does since at least 1994... |
32 | |
34 | |
33 | extern "C" { |
35 | extern "C" { |
34 | #include <X11/Xlib.h> |
36 | #include <X11/Xlib.h> |
35 | #include <X11/Xutil.h> |
37 | #include <X11/Xutil.h> |
36 | #include <X11/Xresource.h> |
38 | #include <X11/Xresource.h> |
… | |
… | |
97 | /* |
99 | /* |
98 | ***************************************************************************** |
100 | ***************************************************************************** |
99 | * SYSTEM HACKS |
101 | * SYSTEM HACKS |
100 | ***************************************************************************** |
102 | ***************************************************************************** |
101 | */ |
103 | */ |
102 | |
|
|
103 | #ifndef HAVE_XPOINTER |
|
|
104 | typedef char *XPointer; |
|
|
105 | #endif |
|
|
106 | |
104 | |
107 | #include <termios.h> |
105 | #include <termios.h> |
108 | |
106 | |
109 | #include "background.h" |
107 | #include "background.h" |
110 | |
108 | |
… | |
… | |
155 | void rxvt_warn (const char *fmt,...) NOTHROW; |
153 | void rxvt_warn (const char *fmt,...) NOTHROW; |
156 | void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) NORETURN; |
154 | void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) NORETURN; |
157 | void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) NORETURN; |
155 | void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) NORETURN; |
158 | |
156 | |
159 | char * rxvt_strtrim (char *str) NOTHROW; |
157 | char * rxvt_strtrim (char *str) NOTHROW; |
160 | char ** rxvt_splitcommastring (const char *cs) NOTHROW; |
158 | char ** rxvt_strsplit (char delim, const char *str) NOTHROW; |
161 | void rxvt_freecommastring (char **cs) NOTHROW; |
159 | |
|
|
160 | static inline void |
|
|
161 | rxvt_free_strsplit (char **ptr) NOTHROW |
|
|
162 | { |
|
|
163 | free (ptr[0]); |
|
|
164 | free (ptr); |
|
|
165 | } |
162 | |
166 | |
163 | void * rxvt_malloc (size_t size); |
167 | void * rxvt_malloc (size_t size); |
164 | void * rxvt_calloc (size_t number, size_t size); |
168 | void * rxvt_calloc (size_t number, size_t size); |
165 | void * rxvt_realloc (void *ptr, size_t size); |
169 | void * rxvt_realloc (void *ptr, size_t size); |
166 | |
170 | |
… | |
… | |
189 | #else |
193 | #else |
190 | if (envv) |
194 | if (envv) |
191 | #endif |
195 | #endif |
192 | environ = envv; |
196 | environ = envv; |
193 | } |
197 | } |
|
|
198 | |
|
|
199 | struct localise_env |
|
|
200 | { |
|
|
201 | char **orig_env; |
|
|
202 | |
|
|
203 | localise_env (char **new_env) |
|
|
204 | { |
|
|
205 | orig_env = environ; |
|
|
206 | environ = new_env; |
|
|
207 | } |
|
|
208 | |
|
|
209 | ~localise_env () |
|
|
210 | { |
|
|
211 | environ = orig_env; |
|
|
212 | } |
|
|
213 | }; |
194 | |
214 | |
195 | /* |
215 | /* |
196 | ***************************************************************************** |
216 | ***************************************************************************** |
197 | * STRUCTURES AND TYPEDEFS |
217 | * STRUCTURES AND TYPEDEFS |
198 | ***************************************************************************** |
218 | ***************************************************************************** |
… | |
… | |
951 | #define Screen_WrapNext (1<<4) /* need to wrap for next char? */ |
971 | #define Screen_WrapNext (1<<4) /* need to wrap for next char? */ |
952 | #define Screen_DefaultFlags (Screen_VisibleCursor | Screen_Autowrap) |
972 | #define Screen_DefaultFlags (Screen_VisibleCursor | Screen_Autowrap) |
953 | |
973 | |
954 | /* rxvt_vars.options */ |
974 | /* rxvt_vars.options */ |
955 | enum { |
975 | enum { |
956 | # define def(name,idx) Opt_ ## name = idx, |
|
|
957 | # define nodef(name) Opt_ ## name = 0, |
976 | # define def(name) Opt_ ## name, |
|
|
977 | # define nodef(name) Opt_prev_ ## name, Opt_ ## name = 0, Opt_next_ ## name = Opt_prev_ ## name - 1, |
|
|
978 | Opt_0, |
958 | # include "optinc.h" |
979 | # include "optinc.h" |
959 | # undef nodef |
980 | # undef nodef |
960 | # undef def |
981 | # undef def |
961 | Opt_count |
982 | Opt_count |
962 | }; |
983 | }; |
963 | |
984 | |
964 | /* ------------------------------------------------------------------------- */ |
985 | /* ------------------------------------------------------------------------- */ |
965 | |
986 | |
966 | struct rxvt_vars : TermWin_t |
987 | struct rxvt_vars : TermWin_t |
… | |
… | |
1317 | void set_colorfgbg (); |
1338 | void set_colorfgbg (); |
1318 | bool set_color (rxvt_color &color, const char *name); |
1339 | bool set_color (rxvt_color &color, const char *name); |
1319 | void alias_color (int dst, int src); |
1340 | void alias_color (int dst, int src); |
1320 | void set_widthheight (unsigned int newwidth, unsigned int newheight); |
1341 | void set_widthheight (unsigned int newwidth, unsigned int newheight); |
1321 | void get_window_origin (int &x, int &y); |
1342 | void get_window_origin (int &x, int &y); |
1322 | Pixmap get_pixmap_property (int prop_id); |
1343 | Pixmap get_pixmap_property (Atom property); |
1323 | |
1344 | |
1324 | // screen.C |
1345 | // screen.C |
1325 | |
1346 | |
1326 | void lalloc (line_t &l) const |
1347 | void lalloc (line_t &l) const |
1327 | { |
1348 | { |
… | |
… | |
1379 | return base; |
1400 | return base; |
1380 | } |
1401 | } |
1381 | |
1402 | |
1382 | bool option (uint8_t opt) const NOTHROW |
1403 | bool option (uint8_t opt) const NOTHROW |
1383 | { |
1404 | { |
1384 | if (!opt) |
|
|
1385 | return 0; |
|
|
1386 | |
|
|
1387 | --opt; |
|
|
1388 | return options[opt >> 3] & (1 << (opt & 7)); |
1405 | return options[opt >> 3] & (1 << (opt & 7)); |
1389 | } |
1406 | } |
1390 | |
1407 | |
1391 | void set_option (uint8_t opt, bool set = true) NOTHROW |
1408 | void set_option (uint8_t opt, bool set = true) NOTHROW; |
1392 | { |
|
|
1393 | if (!opt) |
|
|
1394 | return; |
|
|
1395 | |
|
|
1396 | --opt; |
|
|
1397 | if (set) |
|
|
1398 | options[opt >> 3] |= (1 << (opt & 7)); |
|
|
1399 | else |
|
|
1400 | options[opt >> 3] &= ~(1 << (opt & 7)); |
|
|
1401 | } |
|
|
1402 | |
1409 | |
1403 | void set_privmode (unsigned bit, int set) NOTHROW |
1410 | void set_privmode (unsigned bit, int set) NOTHROW |
1404 | { |
1411 | { |
1405 | if (set) |
1412 | if (set) |
1406 | priv_modes |= bit; |
1413 | priv_modes |= bit; |
… | |
… | |
1426 | void scr_backindex () NOTHROW; |
1433 | void scr_backindex () NOTHROW; |
1427 | void scr_forwardindex () NOTHROW; |
1434 | void scr_forwardindex () NOTHROW; |
1428 | #endif |
1435 | #endif |
1429 | void scr_touch (bool refresh) NOTHROW; |
1436 | void scr_touch (bool refresh) NOTHROW; |
1430 | void scr_expose (int x, int y, int width, int height, bool refresh) NOTHROW; |
1437 | void scr_expose (int x, int y, int width, int height, bool refresh) NOTHROW; |
1431 | void scr_recolour () NOTHROW; |
1438 | void scr_recolour (bool refresh = true) NOTHROW; |
1432 | void scr_remap_chars () NOTHROW; |
1439 | void scr_remap_chars () NOTHROW; |
1433 | void scr_remap_chars (line_t &l) NOTHROW; |
1440 | void scr_remap_chars (line_t &l) NOTHROW; |
1434 | |
1441 | |
1435 | enum cursor_mode { SAVE, RESTORE }; |
1442 | enum cursor_mode { SAVE, RESTORE }; |
1436 | |
1443 | |