… | |
… | |
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 | |
… | |
… | |
189 | #else |
187 | #else |
190 | if (envv) |
188 | if (envv) |
191 | #endif |
189 | #endif |
192 | environ = envv; |
190 | environ = envv; |
193 | } |
191 | } |
|
|
192 | |
|
|
193 | struct localise_env |
|
|
194 | { |
|
|
195 | char **orig_env; |
|
|
196 | |
|
|
197 | localise_env (char **new_env) |
|
|
198 | { |
|
|
199 | orig_env = environ; |
|
|
200 | environ = new_env; |
|
|
201 | } |
|
|
202 | |
|
|
203 | ~localise_env () |
|
|
204 | { |
|
|
205 | environ = orig_env; |
|
|
206 | } |
|
|
207 | }; |
194 | |
208 | |
195 | /* |
209 | /* |
196 | ***************************************************************************** |
210 | ***************************************************************************** |
197 | * STRUCTURES AND TYPEDEFS |
211 | * STRUCTURES AND TYPEDEFS |
198 | ***************************************************************************** |
212 | ***************************************************************************** |
… | |
… | |
951 | #define Screen_WrapNext (1<<4) /* need to wrap for next char? */ |
965 | #define Screen_WrapNext (1<<4) /* need to wrap for next char? */ |
952 | #define Screen_DefaultFlags (Screen_VisibleCursor | Screen_Autowrap) |
966 | #define Screen_DefaultFlags (Screen_VisibleCursor | Screen_Autowrap) |
953 | |
967 | |
954 | /* rxvt_vars.options */ |
968 | /* rxvt_vars.options */ |
955 | enum { |
969 | enum { |
956 | # define def(name,idx) Opt_ ## name = idx, |
|
|
957 | # define nodef(name) Opt_ ## name = 0, |
970 | # define def(name) Opt_ ## name, |
|
|
971 | # define nodef(name) Opt_prev_ ## name, Opt_ ## name = 0, Opt_next_ ## name = Opt_prev_ ## name - 1, |
|
|
972 | Opt_0, |
958 | # include "optinc.h" |
973 | # include "optinc.h" |
959 | # undef nodef |
974 | # undef nodef |
960 | # undef def |
975 | # undef def |
961 | Opt_count |
976 | Opt_count |
962 | }; |
977 | }; |
963 | |
978 | |
964 | /* ------------------------------------------------------------------------- */ |
979 | /* ------------------------------------------------------------------------- */ |
965 | |
980 | |
966 | struct rxvt_vars : TermWin_t |
981 | struct rxvt_vars : TermWin_t |
… | |
… | |
1317 | void set_colorfgbg (); |
1332 | void set_colorfgbg (); |
1318 | bool set_color (rxvt_color &color, const char *name); |
1333 | bool set_color (rxvt_color &color, const char *name); |
1319 | void alias_color (int dst, int src); |
1334 | void alias_color (int dst, int src); |
1320 | void set_widthheight (unsigned int newwidth, unsigned int newheight); |
1335 | void set_widthheight (unsigned int newwidth, unsigned int newheight); |
1321 | void get_window_origin (int &x, int &y); |
1336 | void get_window_origin (int &x, int &y); |
1322 | Pixmap get_pixmap_property (int prop_id); |
1337 | Pixmap get_pixmap_property (Atom property); |
1323 | |
1338 | |
1324 | // screen.C |
1339 | // screen.C |
1325 | |
1340 | |
1326 | void lalloc (line_t &l) const |
1341 | void lalloc (line_t &l) const |
1327 | { |
1342 | { |
… | |
… | |
1379 | return base; |
1394 | return base; |
1380 | } |
1395 | } |
1381 | |
1396 | |
1382 | bool option (uint8_t opt) const NOTHROW |
1397 | bool option (uint8_t opt) const NOTHROW |
1383 | { |
1398 | { |
1384 | if (!opt) |
|
|
1385 | return 0; |
|
|
1386 | |
|
|
1387 | --opt; |
|
|
1388 | return options[opt >> 3] & (1 << (opt & 7)); |
1399 | return options[opt >> 3] & (1 << (opt & 7)); |
1389 | } |
1400 | } |
1390 | |
1401 | |
1391 | void set_option (uint8_t opt, bool set = true) NOTHROW |
1402 | 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 | |
1403 | |
1403 | void set_privmode (unsigned bit, int set) NOTHROW |
1404 | void set_privmode (unsigned bit, int set) NOTHROW |
1404 | { |
1405 | { |
1405 | if (set) |
1406 | if (set) |
1406 | priv_modes |= bit; |
1407 | priv_modes |= bit; |