… | |
… | |
18 | #include "encoding.h" |
18 | #include "encoding.h" |
19 | #include "rxvtfont.h" |
19 | #include "rxvtfont.h" |
20 | #include "rxvttoolkit.h" |
20 | #include "rxvttoolkit.h" |
21 | #include "iom.h" |
21 | #include "iom.h" |
22 | #include "salloc.h" |
22 | #include "salloc.h" |
|
|
23 | |
|
|
24 | #include "rxvtperl.h" |
23 | |
25 | |
24 | #if ENABLE_FRILLS |
26 | #if ENABLE_FRILLS |
25 | # define ENABLE_XEMBED 1 |
27 | # define ENABLE_XEMBED 1 |
26 | # define ENABLE_EWMH 1 |
28 | # define ENABLE_EWMH 1 |
27 | # define CURSOR_BLINK 1 |
29 | # define CURSOR_BLINK 1 |
… | |
… | |
207 | # define TERMENV "rxvt-unicode" |
209 | # define TERMENV "rxvt-unicode" |
208 | #endif |
210 | #endif |
209 | |
211 | |
210 | #if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR) |
212 | #if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR) |
211 | # define NO_MOUSE_REPORT_SCROLLBAR 1 |
213 | # define NO_MOUSE_REPORT_SCROLLBAR 1 |
212 | #endif |
|
|
213 | |
|
|
214 | #ifdef NO_RESOURCES |
|
|
215 | # undef USE_XGETDEFAULT |
|
|
216 | #endif |
214 | #endif |
217 | |
215 | |
218 | #if defined (ISO_14755) || defined (ENABLE_PERL) |
216 | #if defined (ISO_14755) || defined (ENABLE_PERL) |
219 | # define ENABLE_OVERLAY 1 |
217 | # define ENABLE_OVERLAY 1 |
220 | #endif |
218 | #endif |
… | |
… | |
697 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
695 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
698 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
696 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
699 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) |
697 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)fwidth) |
700 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) |
698 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)fheight) |
701 | |
699 | |
|
|
700 | #define TEMP_ENV temp_environ temp_environ (envv) |
|
|
701 | |
|
|
702 | #define OPTION(opt) (options & (opt)) |
|
|
703 | #define DEFAULT_OPTIONS (Opt_scrollBar | Opt_scrollTtyOutput \ |
|
|
704 | | Opt_jumpScroll | Opt_secondaryScreen \ |
|
|
705 | | Opt_pastableTabs | Opt_intensityStyles) |
|
|
706 | |
702 | // for m >= -n, ensure remainder lies between 0..n-1 |
707 | // for m >= -n, ensure remainder lies between 0..n-1 |
703 | #define MOD(m,n) (((m) + (n)) % (n)) |
708 | #define MOD(m,n) (((m) + (n)) % (n)) |
704 | |
709 | |
705 | #define LINENO(n) MOD (term_start + int(n), total_rows) |
710 | #define LINENO(n) MOD (term_start + int(n), total_rows) |
706 | #define ROW(n) row_buf [LINENO (n)] |
711 | #define ROW(n) row_buf [LINENO (n)] |
… | |
… | |
832 | extern void rxvt_fatal (const char *fmt, ...) __attribute__ ((noreturn)); |
837 | extern void rxvt_fatal (const char *fmt, ...) __attribute__ ((noreturn)); |
833 | extern void rxvt_exit_failure () __attribute__ ((noreturn)); |
838 | extern void rxvt_exit_failure () __attribute__ ((noreturn)); |
834 | |
839 | |
835 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
840 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
836 | extern bool rxvt_set_locale (const char *locale); |
841 | extern bool rxvt_set_locale (const char *locale); |
837 | extern bool rxvt_push_locale (const char *locale); |
842 | extern void rxvt_push_locale (const char *locale); |
838 | extern void rxvt_pop_locale (); |
843 | extern void rxvt_pop_locale (); |
839 | |
844 | |
840 | /****************************************************************************/ |
845 | /****************************************************************************/ |
841 | |
846 | |
842 | #ifdef MENUBAR |
847 | #ifdef MENUBAR |
… | |
… | |
920 | #if UNICODE3 |
925 | #if UNICODE3 |
921 | # define COMPOSE_LO 0x40000000UL |
926 | # define COMPOSE_LO 0x40000000UL |
922 | # define COMPOSE_HI 0x400fffffUL |
927 | # define COMPOSE_HI 0x400fffffUL |
923 | # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) |
928 | # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) |
924 | #else |
929 | #else |
|
|
930 | # if ENABLE_PERL |
|
|
931 | # define COMPOSE_LO 0xe000UL // our _own_ routiens don't like (illegal) surrogates |
|
|
932 | # define COMPOSE_HI 0xf8ffUL // in utf-8, so use private use area only |
|
|
933 | # else |
925 | # define COMPOSE_LO 0xd800UL |
934 | # define COMPOSE_LO 0xd800UL |
926 | # define COMPOSE_HI 0xf8ffUL // dfff should be safer, but... |
935 | # define COMPOSE_HI 0xf8ffUL |
927 | # define IS_COMPOSE(n) (COMPOSE_LO <= (n) && (n) <= COMPOSE_HI) |
936 | # endif |
|
|
937 | # define IS_COMPOSE(n) IN_RANGE_INC ((n), COMPOSE_LO, COMPOSE_HI) |
928 | #endif |
938 | #endif |
929 | |
939 | |
930 | #if ENABLE_COMBINING |
940 | #if ENABLE_COMBINING |
931 | // compose chars are used to represent composite characters |
941 | // compose chars are used to represent composite characters |
932 | // that are not representable in unicode, as well as characters |
942 | // that are not representable in unicode, as well as characters |
… | |
… | |
959 | #ifdef KEYSYM_RESOURCE |
969 | #ifdef KEYSYM_RESOURCE |
960 | class keyboard_manager; |
970 | class keyboard_manager; |
961 | #endif |
971 | #endif |
962 | |
972 | |
963 | struct rxvt_term : zero_initialized, rxvt_vars { |
973 | struct rxvt_term : zero_initialized, rxvt_vars { |
964 | log_callback *log_hook; // log error messages through this hook, if != 0 |
974 | log_callback *log_hook; // log error messages through this hook, if != 0 |
965 | getfd_callback *getfd_hook; // convert remote to local fd, if != 0 |
975 | getfd_callback *getfd_hook; // convert remote to local fd, if != 0 |
966 | |
|
|
967 | #if ENABLE_PERL |
976 | #if ENABLE_PERL |
968 | void *self; // perl's $self |
977 | rxvt_perl_term perl; |
969 | #endif |
978 | #endif |
970 | |
|
|
971 | struct mbstate mbstate; // current input multibyte state |
979 | struct mbstate mbstate; // current input multibyte state |
972 | |
980 | |
973 | unsigned char want_refresh:1, |
981 | unsigned char want_refresh:1, |
974 | #ifdef TRANSPARENT |
982 | #ifdef TRANSPARENT |
975 | want_full_refresh:1, /* awaiting full screen refresh */ |
983 | want_full_refresh:1, /* awaiting full screen refresh */ |
… | |
… | |
1248 | |
1256 | |
1249 | bool pty_fill (); |
1257 | bool pty_fill (); |
1250 | |
1258 | |
1251 | void init_secondary (); |
1259 | void init_secondary (); |
1252 | const char **init_resources (int argc, const char *const *argv); |
1260 | const char **init_resources (int argc, const char *const *argv); |
|
|
1261 | const char *x_resource (const char *name); |
1253 | void init_env (); |
1262 | void init_env (); |
1254 | void set_locale (const char *locale); |
1263 | void set_locale (const char *locale); |
1255 | void init_xlocale (); |
1264 | void init_xlocale (); |
1256 | void init_command (const char *const *argv); |
1265 | void init_command (const char *const *argv); |
1257 | void run_command (const char *const *argv); |
1266 | void run_command (const char *const *argv); |
… | |
… | |
1294 | |
1303 | |
1295 | // command.C |
1304 | // command.C |
1296 | void lookup_key (XKeyEvent &ev); |
1305 | void lookup_key (XKeyEvent &ev); |
1297 | unsigned int cmd_write (const char *str, unsigned int count); |
1306 | unsigned int cmd_write (const char *str, unsigned int count); |
1298 | |
1307 | |
1299 | unicode_t next_char (); |
1308 | wchar_t next_char (); |
1300 | unicode_t cmd_getc (); |
1309 | wchar_t cmd_getc (); |
1301 | unicode_t next_octet (); |
1310 | uint32_t next_octet (); |
1302 | unicode_t cmd_get8 (); |
1311 | uint32_t cmd_get8 (); |
1303 | |
1312 | |
1304 | bool cmd_parse (); |
1313 | bool cmd_parse (); |
1305 | void mouse_report (XButtonEvent &ev); |
1314 | void mouse_report (XButtonEvent &ev); |
1306 | void button_press (XButtonEvent &ev); |
1315 | void button_press (XButtonEvent &ev); |
1307 | void button_release (XButtonEvent &ev); |
1316 | void button_release (XButtonEvent &ev); |
… | |
… | |
1434 | base += minBrightCOLOR - minCOLOR; |
1443 | base += minBrightCOLOR - minCOLOR; |
1435 | #endif |
1444 | #endif |
1436 | return base; |
1445 | return base; |
1437 | } |
1446 | } |
1438 | |
1447 | |
|
|
1448 | bool option (uint32_t opt) |
|
|
1449 | { |
|
|
1450 | return OPTION (opt); |
|
|
1451 | } |
|
|
1452 | |
|
|
1453 | void set_option (uint32_t opt, bool set) |
|
|
1454 | { |
|
|
1455 | if (set) |
|
|
1456 | options |= opt; |
|
|
1457 | else |
|
|
1458 | options &= ~opt; |
|
|
1459 | } |
|
|
1460 | |
1439 | void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs); |
1461 | void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs); |
1440 | void scr_blank_screen_mem (line_t &l, rend_t efs); |
1462 | void scr_blank_screen_mem (line_t &l, rend_t efs); |
1441 | int scr_scroll_text (int row1, int row2, int count); |
1463 | int scr_scroll_text (int row1, int row2, int count); |
1442 | void scr_reset (); |
1464 | void scr_reset (); |
1443 | void scr_release (); |
1465 | void scr_release (); |
… | |
… | |
1461 | void scr_cursor (int mode); |
1483 | void scr_cursor (int mode); |
1462 | void scr_do_wrap (); |
1484 | void scr_do_wrap (); |
1463 | int scr_change_screen (int scrn); |
1485 | int scr_change_screen (int scrn); |
1464 | void scr_color (unsigned int color, int fgbg); |
1486 | void scr_color (unsigned int color, int fgbg); |
1465 | void scr_rendition (int set, int style); |
1487 | void scr_rendition (int set, int style); |
1466 | void scr_add_lines (const unicode_t *str, int nlines, int len); |
1488 | void scr_add_lines (const wchar_t *str, int len, int minlines = 0); |
1467 | void scr_backspace (); |
1489 | void scr_backspace (); |
1468 | void scr_tab (int count, bool ht = false); |
1490 | void scr_tab (int count, bool ht = false); |
1469 | void scr_gotorc (int row, int col, int relative); |
1491 | void scr_gotorc (int row, int col, int relative); |
1470 | void scr_index (enum page_dirn direction); |
1492 | void scr_index (enum page_dirn direction); |
1471 | void scr_erase_line (int mode); |
1493 | void scr_erase_line (int mode); |
… | |
… | |
1486 | int scr_move_to (int y, int len); |
1508 | int scr_move_to (int y, int len); |
1487 | int scr_page (enum page_dirn direction, int nlines); |
1509 | int scr_page (enum page_dirn direction, int nlines); |
1488 | int scr_changeview (unsigned int oldviewstart); |
1510 | int scr_changeview (unsigned int oldviewstart); |
1489 | void scr_bell (); |
1511 | void scr_bell (); |
1490 | void scr_printscreen (int fullhist); |
1512 | void scr_printscreen (int fullhist); |
|
|
1513 | void scr_xor_rect (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle1, rend_t rstyle2); |
|
|
1514 | void scr_xor_span (int beg_row, int beg_col, int end_row, int end_col, rend_t rstyle); |
1491 | void scr_reverse_selection (); |
1515 | void scr_reverse_selection (); |
1492 | void scr_dump (int fd); |
1516 | void scr_dump (int fd); |
1493 | void selection_check (int check_more); |
1517 | void selection_check (int check_more); |
1494 | void selection_paste (Window win, Atom prop, bool delete_prop); |
1518 | void selection_paste (Window win, Atom prop, bool delete_prop); |
1495 | void selection_property (Window win, Atom prop); |
1519 | void selection_property (Window win, Atom prop); |