… | |
… | |
125 | #endif |
125 | #endif |
126 | |
126 | |
127 | #ifndef EXIT_SUCCESS /* missing from <stdlib.h> */ |
127 | #ifndef EXIT_SUCCESS /* missing from <stdlib.h> */ |
128 | # define EXIT_SUCCESS 0 /* exit function success */ |
128 | # define EXIT_SUCCESS 0 /* exit function success */ |
129 | # define EXIT_FAILURE 1 /* exit function failure */ |
129 | # define EXIT_FAILURE 1 /* exit function failure */ |
130 | #endif |
|
|
131 | |
|
|
132 | #ifndef PATH_MAX |
|
|
133 | # define PATH_MAX 16384 |
|
|
134 | #endif |
130 | #endif |
135 | |
131 | |
136 | /****************************************************************************/ |
132 | /****************************************************************************/ |
137 | |
133 | |
138 | // exception thrown on fatal (per-instance) errors |
134 | // exception thrown on fatal (per-instance) errors |
… | |
… | |
161 | |
157 | |
162 | const char * rxvt_basename (const char *str) NOTHROW; |
158 | const char * rxvt_basename (const char *str) NOTHROW; |
163 | void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; |
159 | void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; |
164 | void rxvt_log (const char *fmt,...) NOTHROW; |
160 | void rxvt_log (const char *fmt,...) NOTHROW; |
165 | void rxvt_warn (const char *fmt,...) NOTHROW; |
161 | void rxvt_warn (const char *fmt,...) NOTHROW; |
166 | void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) NORETURN; |
162 | void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) ecb_noreturn; |
167 | void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) NORETURN; |
163 | void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) ecb_noreturn; |
168 | |
164 | |
169 | char * rxvt_strtrim (char *str) NOTHROW; |
165 | char * rxvt_strtrim (char *str) NOTHROW; |
170 | char ** rxvt_strsplit (char delim, const char *str) NOTHROW; |
166 | char ** rxvt_strsplit (char delim, const char *str) NOTHROW; |
171 | |
167 | |
172 | static inline void |
168 | static inline void |
… | |
… | |
308 | # define NSCREENS 0 |
304 | # define NSCREENS 0 |
309 | #else |
305 | #else |
310 | # define NSCREENS 1 |
306 | # define NSCREENS 1 |
311 | #endif |
307 | #endif |
312 | |
308 | |
313 | /* special (internal) prefix for font commands */ |
|
|
314 | #define FONT_CMD '#' |
|
|
315 | #define FONT_DN "#-" |
|
|
316 | #define FONT_UP "#+" |
|
|
317 | |
|
|
318 | /* flags for rxvt_scr_gotorc () */ |
309 | /* flags for rxvt_term::scr_gotorc () */ |
319 | enum { |
310 | enum { |
320 | C_RELATIVE = 1, /* col movement is relative */ |
311 | C_RELATIVE = 1, /* col movement is relative */ |
321 | R_RELATIVE = 2, /* row movement is relative */ |
312 | R_RELATIVE = 2, /* row movement is relative */ |
322 | RELATIVE = C_RELATIVE | R_RELATIVE, |
313 | RELATIVE = C_RELATIVE | R_RELATIVE, |
323 | }; |
314 | }; |
324 | |
315 | |
325 | /* modes for rxvt_scr_insdel_chars (), rxvt_scr_insdel_lines () */ |
316 | /* modes for rxvt_term::scr_insdel_chars (), rxvt_term::scr_insdel_lines () */ |
326 | enum { |
317 | enum { |
327 | INSERT = -1, /* don't change these values */ |
318 | INSERT = -1, /* don't change these values */ |
328 | DELETE = +1, |
319 | DELETE = +1, |
329 | ERASE = +2, |
320 | ERASE = +2, |
330 | }; |
321 | }; |
331 | |
322 | |
332 | /* modes for rxvt_scr_page () - scroll page. used by scrollbar window */ |
323 | /* modes for rxvt_term::scr_page () - scroll page. used by scrollbar window */ |
333 | enum page_dirn { |
324 | enum page_dirn { |
334 | UP, |
325 | UP, |
335 | DN, |
326 | DN, |
336 | NO_DIR, |
327 | NO_DIR, |
337 | }; |
328 | }; |
338 | |
329 | |
339 | /* arguments for rxvt_scr_change_screen () */ |
330 | /* arguments for rxvt_term::scr_change_screen () */ |
340 | enum { |
331 | enum { |
341 | PRIMARY = 0, |
332 | PRIMARY = 0, |
342 | SECONDARY, |
333 | SECONDARY, |
343 | }; |
334 | }; |
344 | |
335 | |
… | |
… | |
386 | #define RS_baseattrMask (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline) |
377 | #define RS_baseattrMask (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline) |
387 | #define RS_attrMask (RS_baseattrMask | RS_fontMask) |
378 | #define RS_attrMask (RS_baseattrMask | RS_fontMask) |
388 | |
379 | |
389 | #define DEFAULT_RSTYLE (RS_None | (Color_fg << RS_fgShift) | (Color_bg << RS_bgShift)) |
380 | #define DEFAULT_RSTYLE (RS_None | (Color_fg << RS_fgShift) | (Color_bg << RS_bgShift)) |
390 | #define OVERLAY_RSTYLE (RS_None | (Color_Black << RS_fgShift) | (Color_Yellow << RS_bgShift)) |
381 | #define OVERLAY_RSTYLE (RS_None | (Color_Black << RS_fgShift) | (Color_Yellow << RS_bgShift)) |
391 | |
|
|
392 | #define Sel_none 0 /* Not waiting */ |
|
|
393 | #define Sel_normal 0x01 /* normal selection */ |
|
|
394 | #define Sel_incr 0x02 /* incremental selection */ |
|
|
395 | #define Sel_direct 0x00 |
|
|
396 | #define Sel_Primary 0x01 |
|
|
397 | #define Sel_Secondary 0x02 |
|
|
398 | #define Sel_Clipboard 0x03 |
|
|
399 | #define Sel_whereMask 0x0f |
|
|
400 | #define Sel_CompoundText 0x10 /* last request was COMPOUND_TEXT */ |
|
|
401 | #define Sel_UTF8String 0x20 /* last request was UTF8_STRING */ |
|
|
402 | |
382 | |
403 | enum { |
383 | enum { |
404 | C0_NUL = 0x00, |
384 | C0_NUL = 0x00, |
405 | C0_SOH, C0_STX, C0_ETX, C0_EOT, C0_ENQ, C0_ACK, C0_BEL, |
385 | C0_SOH, C0_STX, C0_ETX, C0_EOT, C0_ENQ, C0_ACK, C0_BEL, |
406 | C0_BS , C0_HT , C0_LF , C0_VT , C0_FF , C0_CR , C0_SO , C0_SI , |
386 | C0_BS , C0_HT , C0_LF , C0_VT , C0_FF , C0_CR , C0_SO , C0_SI , |
… | |
… | |
687 | |
667 | |
688 | #define GET_ATTR(x) (((x) & RS_attrMask)) |
668 | #define GET_ATTR(x) (((x) & RS_attrMask)) |
689 | // return attributes defining the background, encoding doesn't matter |
669 | // return attributes defining the background, encoding doesn't matter |
690 | // depends on RS_fgShift > RS_bgShift |
670 | // depends on RS_fgShift > RS_bgShift |
691 | #define GET_BGATTR(x) \ |
671 | #define GET_BGATTR(x) \ |
692 | (expect_false ((x) & RS_RVid) \ |
672 | (ecb_unlikely ((x) & RS_RVid) \ |
693 | ? (((x) & (RS_attrMask & ~RS_RVid)) \ |
673 | ? (((x) & (RS_attrMask & ~RS_RVid)) \ |
694 | | (((x) & RS_fgMask) >> (RS_fgShift - RS_bgShift))) \ |
674 | | (((x) & RS_fgMask) >> (RS_fgShift - RS_bgShift))) \ |
695 | : ((x) & (RS_attrMask | RS_bgMask))) |
675 | : ((x) & (RS_attrMask | RS_bgMask))) |
696 | #define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | ((fg) << RS_fgShift)) |
676 | #define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | ((fg) << RS_fgShift)) |
697 | #define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg) << RS_bgShift)) |
677 | #define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg) << RS_bgShift)) |
… | |
… | |
908 | int saveLines; /* number of lines that fit in scrollback */ |
888 | int saveLines; /* number of lines that fit in scrollback */ |
909 | int total_rows; /* total number of rows in this terminal */ |
889 | int total_rows; /* total number of rows in this terminal */ |
910 | int term_start; /* term lines start here */ |
890 | int term_start; /* term lines start here */ |
911 | int view_start; /* scrollback view starts here */ |
891 | int view_start; /* scrollback view starts here */ |
912 | int top_row; /* topmost row index of scrollback */ |
892 | int top_row; /* topmost row index of scrollback */ |
913 | Window parent[6]; /* parent identifiers - we're parent[0] */ |
893 | Window parent; /* parent identifier */ |
914 | Window vt; /* vt100 window */ |
894 | Window vt; /* vt100 window */ |
915 | GC gc; /* GC for drawing */ |
895 | GC gc; /* GC for drawing */ |
916 | Pixmap pixmap; |
896 | Pixmap pixmap; |
917 | rxvt_drawable *drawable; |
897 | rxvt_drawable *drawable; |
918 | rxvt_fontset *fontset[4]; |
898 | rxvt_fontset *fontset[4]; |
… | |
… | |
1001 | scrollBar_t scrollBar; |
981 | scrollBar_t scrollBar; |
1002 | uint8_t options[(Opt_count + 7) >> 3]; |
982 | uint8_t options[(Opt_count + 7) >> 3]; |
1003 | XSizeHints szHint; |
983 | XSizeHints szHint; |
1004 | rxvt_color *pix_colors; |
984 | rxvt_color *pix_colors; |
1005 | Cursor TermWin_cursor; /* cursor for vt window */ |
985 | Cursor TermWin_cursor; /* cursor for vt window */ |
1006 | line_t *row_buf; // all lines, scrollback + terminal, circular, followed by temp_buf |
986 | line_t *row_buf; // all lines, scrollback + terminal, circular |
1007 | line_t *drawn_buf; // text on screen |
987 | line_t *drawn_buf; // text on screen |
1008 | line_t *swap_buf; // lines for swap buffer |
988 | line_t *swap_buf; // lines for swap buffer |
1009 | char *tabs; /* per location: 1 == tab-stop */ |
989 | char *tabs; /* per location: 1 == tab-stop */ |
1010 | screen_t screen; |
990 | screen_t screen; |
1011 | screen_t swap; |
991 | screen_t swap; |
… | |
… | |
1052 | seen_resize:1, /* whether we had a resize event */ |
1032 | seen_resize:1, /* whether we had a resize event */ |
1053 | parsed_geometry:1; |
1033 | parsed_geometry:1; |
1054 | |
1034 | |
1055 | unsigned char refresh_type, |
1035 | unsigned char refresh_type, |
1056 | #ifdef META8_OPTION |
1036 | #ifdef META8_OPTION |
1057 | meta_char, /* Alt-key prefix */ |
1037 | meta_char; /* Alt-key prefix */ |
1058 | #endif |
1038 | #endif |
1059 | selection_wait, |
|
|
1060 | selection_type; |
|
|
1061 | /* ---------- */ |
1039 | /* ---------- */ |
1062 | bool rvideo_state, rvideo_mode; |
1040 | bool rvideo_state, rvideo_mode; |
1063 | #ifndef NO_BELL |
1041 | #ifndef NO_BELL |
1064 | bool rvideo_bell; |
1042 | bool rvideo_bell; |
1065 | #endif |
1043 | #endif |
… | |
… | |
1101 | SavedModes; |
1079 | SavedModes; |
1102 | /* ---------- */ |
1080 | /* ---------- */ |
1103 | Atom *xa; |
1081 | Atom *xa; |
1104 | /* ---------- */ |
1082 | /* ---------- */ |
1105 | Time selection_time, |
1083 | Time selection_time, |
1106 | selection_request_time, |
|
|
1107 | clipboard_time; |
1084 | clipboard_time; |
|
|
1085 | rxvt_selection *selection_req; |
1108 | pid_t cmd_pid; /* process id of child */ |
1086 | pid_t cmd_pid; /* process id of child */ |
1109 | char * incr_buf; |
|
|
1110 | size_t incr_buf_size, incr_buf_fill; |
|
|
1111 | /* ---------- */ |
1087 | /* ---------- */ |
1112 | struct mouse_event MEvent; |
1088 | struct mouse_event MEvent; |
1113 | XComposeStatus compose; |
1089 | XComposeStatus compose; |
1114 | static struct termios def_tio; |
1090 | static struct termios def_tio; |
1115 | row_col_t oldcursor; |
1091 | row_col_t oldcursor; |
… | |
… | |
1304 | void child_cb (ev::child &w, int revents); ev::child child_ev; |
1280 | void child_cb (ev::child &w, int revents); ev::child child_ev; |
1305 | void destroy_cb (ev::idle &w, int revents); ev::idle destroy_ev; |
1281 | void destroy_cb (ev::idle &w, int revents); ev::idle destroy_ev; |
1306 | void refresh_check (); |
1282 | void refresh_check (); |
1307 | void flush (); |
1283 | void flush (); |
1308 | void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; |
1284 | void flush_cb (ev::timer &w, int revents); ev::timer flush_ev; |
|
|
1285 | void cmdbuf_reify (); |
|
|
1286 | void cmdbuf_append (const char *str, size_t count); |
1309 | bool pty_fill (); |
1287 | bool pty_fill (); |
1310 | void pty_cb (ev::io &w, int revents); ev::io pty_ev; |
1288 | void pty_cb (ev::io &w, int revents); ev::io pty_ev; |
1311 | void incr_cb (ev::timer &w, int revents) NOTHROW; ev::timer incr_ev; |
|
|
1312 | |
1289 | |
1313 | #ifdef CURSOR_BLINK |
1290 | #ifdef CURSOR_BLINK |
1314 | void cursor_blink_cb (ev::timer &w, int revents); ev::timer cursor_blink_ev; |
1291 | void cursor_blink_cb (ev::timer &w, int revents); ev::timer cursor_blink_ev; |
1315 | #endif |
1292 | #endif |
1316 | #ifdef TEXT_BLINK |
1293 | #ifdef TEXT_BLINK |
… | |
… | |
1364 | void im_set_size (XRectangle &size); |
1341 | void im_set_size (XRectangle &size); |
1365 | void im_set_position (XPoint &pos) NOTHROW; |
1342 | void im_set_position (XPoint &pos) NOTHROW; |
1366 | void im_set_color (unsigned long &fg, unsigned long &bg); |
1343 | void im_set_color (unsigned long &fg, unsigned long &bg); |
1367 | void im_set_preedit_area (XRectangle &preedit_rect, XRectangle &status_rect, const XRectangle &needed_rect); |
1344 | void im_set_preedit_area (XRectangle &preedit_rect, XRectangle &status_rect, const XRectangle &needed_rect); |
1368 | |
1345 | |
1369 | bool IMisRunning (); |
1346 | bool im_is_running (); |
1370 | void IMSendSpot (); |
1347 | void im_send_spot (); |
1371 | bool IM_get_IC (const char *modifiers); |
1348 | bool im_get_ic (const char *modifiers); |
1372 | void IMSetPosition (); |
1349 | void im_set_position (); |
1373 | #endif |
1350 | #endif |
1374 | |
1351 | |
1375 | // command.C |
1352 | // command.C |
1376 | void key_press (XKeyEvent &ev); |
1353 | void key_press (XKeyEvent &ev); |
1377 | void key_release (XKeyEvent &ev); |
1354 | void key_release (XKeyEvent &ev); |
1378 | unsigned int cmd_write (const char *str, unsigned int count); |
|
|
1379 | |
1355 | |
1380 | wchar_t next_char () NOTHROW; |
1356 | wchar_t next_char () NOTHROW; |
1381 | wchar_t cmd_getc () THROW ((class out_of_input)); |
1357 | wchar_t cmd_getc () THROW ((class out_of_input)); |
1382 | uint32_t next_octet () NOTHROW; |
1358 | uint32_t next_octet () NOTHROW; |
1383 | uint32_t cmd_get8 () THROW ((class out_of_input)); |
1359 | uint32_t cmd_get8 () THROW ((class out_of_input)); |
… | |
… | |
1410 | void process_color_seq (int report, int color, const char *str, char resp); |
1386 | void process_color_seq (int report, int color, const char *str, char resp); |
1411 | void process_xterm_seq (int op, char *str, char resp); |
1387 | void process_xterm_seq (int op, char *str, char resp); |
1412 | int privcases (int mode, unsigned long bit); |
1388 | int privcases (int mode, unsigned long bit); |
1413 | void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); |
1389 | void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); |
1414 | void process_sgr_mode (unsigned int nargs, const int *arg); |
1390 | void process_sgr_mode (unsigned int nargs, const int *arg); |
1415 | void process_graphics (); |
|
|
1416 | // init.C |
1391 | // init.C |
1417 | void init_vars (); |
1392 | void init_vars (); |
1418 | const char **init_resources (int argc, const char *const *argv); |
1393 | const char **init_resources (int argc, const char *const *argv); |
1419 | void init (int argc, const char *const *argv, stringvec *envv); |
1394 | void init (int argc, const char *const *argv, stringvec *envv); |
1420 | void init_env (); |
1395 | void init_env (); |
… | |
… | |
1587 | void scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) NOTHROW; |
1562 | void scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle) NOTHROW; |
1588 | void scr_reverse_selection () NOTHROW; |
1563 | void scr_reverse_selection () NOTHROW; |
1589 | void scr_dump (int fd) NOTHROW; |
1564 | void scr_dump (int fd) NOTHROW; |
1590 | |
1565 | |
1591 | void selection_check (int check_more) NOTHROW; |
1566 | void selection_check (int check_more) NOTHROW; |
1592 | void selection_paste (Window win, Atom prop, bool delete_prop) NOTHROW; |
|
|
1593 | void selection_property (Window win, Atom prop) NOTHROW; |
|
|
1594 | void selection_request (Time tm, int selnum = Sel_Primary) NOTHROW; |
1567 | void selection_request (Time tm, int selnum = Sel_Primary) NOTHROW; |
1595 | int selection_request_other (Atom target, int selnum) NOTHROW; |
|
|
1596 | void selection_clear (bool clipboard = false) NOTHROW; |
1568 | void selection_clear (bool clipboard = false) NOTHROW; |
1597 | void selection_make (Time tm); |
1569 | void selection_make (Time tm); |
1598 | bool selection_grab (Time tm, bool clipboard = false) NOTHROW; |
1570 | bool selection_grab (Time tm, bool clipboard = false) NOTHROW; |
1599 | void selection_start_colrow (int col, int row) NOTHROW; |
1571 | void selection_start_colrow (int col, int row) NOTHROW; |
1600 | void selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) NOTHROW; |
1572 | void selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, row_col_t *ret) NOTHROW; |