… | |
… | |
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 |
… | |
… | |
835 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
837 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
836 | extern bool rxvt_set_locale (const char *locale); |
838 | extern bool rxvt_set_locale (const char *locale); |
837 | extern bool rxvt_push_locale (const char *locale); |
839 | extern bool rxvt_push_locale (const char *locale); |
838 | extern void rxvt_pop_locale (); |
840 | extern void rxvt_pop_locale (); |
839 | |
841 | |
840 | /* |
|
|
841 | ***************************************************************************** |
842 | /****************************************************************************/ |
842 | * VARIABLES |
843 | |
843 | ***************************************************************************** |
|
|
844 | */ |
|
|
845 | #ifdef MENUBAR |
844 | #ifdef MENUBAR |
846 | # include "menubar.h" |
845 | # include "menubar.h" |
847 | #endif |
846 | #endif |
848 | |
847 | |
849 | #define BLINK_INTERVAL 0.5 |
848 | #define BLINK_INTERVAL 0.5 |
… | |
… | |
856 | # endif |
855 | # endif |
857 | # endif |
856 | # endif |
858 | # define __attribute__(x) |
857 | # define __attribute__(x) |
859 | #endif |
858 | #endif |
860 | |
859 | |
|
|
860 | /****************************************************************************/ |
|
|
861 | |
|
|
862 | #define LINE_LONGER 0x0001 // line is continued on the next row |
|
|
863 | #define LINE_FILTERED 0x0002 // line has been filtered |
|
|
864 | #define LINE_COMPRESSED 0x0004 // line has been compressed (NYI) |
|
|
865 | |
|
|
866 | struct line_t { |
|
|
867 | text_t *t; // terminal the text |
|
|
868 | rend_t *r; // rendition, uses RS_ flags |
|
|
869 | tlen_t_ l; // length of each text line, LINE_CONT == continued on next line |
|
|
870 | uint32_t f; // flags |
|
|
871 | |
|
|
872 | bool is_longer () |
|
|
873 | { |
|
|
874 | return f & LINE_LONGER; |
|
|
875 | } |
|
|
876 | |
|
|
877 | void is_longer (int set) |
|
|
878 | { |
|
|
879 | if (set) |
|
|
880 | f |= LINE_LONGER; |
|
|
881 | else |
|
|
882 | f &= ~LINE_LONGER; |
|
|
883 | } |
|
|
884 | |
|
|
885 | void clear () |
|
|
886 | { |
|
|
887 | t = 0; |
|
|
888 | r = 0; |
|
|
889 | l = 0; |
|
|
890 | f = 0; |
|
|
891 | } |
|
|
892 | |
|
|
893 | void touch () // call whenever a line is changed/touched/updated |
|
|
894 | { |
|
|
895 | #if ENABLE_PERL |
|
|
896 | f &= ~LINE_FILTERED; |
|
|
897 | #endif |
|
|
898 | } |
|
|
899 | |
|
|
900 | void touch (int col) |
|
|
901 | { |
|
|
902 | max_it (l, col); |
|
|
903 | touch (); |
|
|
904 | } |
|
|
905 | }; |
|
|
906 | |
|
|
907 | /****************************************************************************/ |
|
|
908 | |
861 | // primivite wrapper around mbstate_t to ensure initialisation |
909 | // primivite wrapper around mbstate_t to ensure initialisation |
862 | struct mbstate { |
910 | struct mbstate { |
863 | mbstate_t mbs; |
911 | mbstate_t mbs; |
864 | |
912 | |
865 | operator mbstate_t *() { return &mbs; } |
913 | operator mbstate_t *() { return &mbs; } |
866 | void reset () { memset (&mbs, 0, sizeof (mbs)); } |
914 | void reset () { memset (&mbs, 0, sizeof (mbs)); } |
867 | mbstate () { reset (); } |
915 | mbstate () { reset (); } |
868 | }; |
916 | }; |
869 | |
917 | |
|
|
918 | /****************************************************************************/ |
|
|
919 | |
870 | #define UNICODE_MASK 0x1fffffUL |
920 | #define UNICODE_MASK 0x1fffffUL |
871 | |
921 | |
872 | #if UNICODE3 |
922 | #if UNICODE3 |
873 | # define COMPOSE_LO 0x40000000UL |
923 | # define COMPOSE_LO 0x40000000UL |
874 | # define COMPOSE_HI 0x400fffffUL |
924 | # define COMPOSE_HI 0x400fffffUL |
875 | # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) |
925 | # define IS_COMPOSE(n) ((int32_t)(n) >= COMPOSE_LO) |
876 | #else |
926 | #else |
|
|
927 | # if ENABLE_PERL |
|
|
928 | # define COMPOSE_LO 0xe000UL // our _own_ routiens don't like (illegal) surrogates |
|
|
929 | # define COMPOSE_HI 0xf8ffUL // in utf-8, so use private use area only |
|
|
930 | # else |
877 | # define COMPOSE_LO 0xd800UL |
931 | # define COMPOSE_LO 0xd800UL |
878 | # define COMPOSE_HI 0xf8ffUL // dfff should be safer, but... |
932 | # define COMPOSE_HI 0xf8ffUL |
879 | # define IS_COMPOSE(n) (COMPOSE_LO <= (n) && (n) <= COMPOSE_HI) |
933 | # endif |
|
|
934 | # define IS_COMPOSE(n) IN_RANGE_INC ((n), COMPOSE_LO, COMPOSE_HI) |
880 | #endif |
935 | #endif |
881 | |
936 | |
882 | #if ENABLE_COMBINING |
937 | #if ENABLE_COMBINING |
883 | // compose chars are used to represent composite characters |
938 | // compose chars are used to represent composite characters |
884 | // that are not representable in unicode, as well as characters |
939 | // that are not representable in unicode, as well as characters |
… | |
… | |
904 | }; |
959 | }; |
905 | |
960 | |
906 | extern class rxvt_composite_vec rxvt_composite; |
961 | extern class rxvt_composite_vec rxvt_composite; |
907 | #endif |
962 | #endif |
908 | |
963 | |
|
|
964 | /****************************************************************************/ |
909 | |
965 | |
910 | #ifdef KEYSYM_RESOURCE |
966 | #ifdef KEYSYM_RESOURCE |
911 | class keyboard_manager; |
967 | class keyboard_manager; |
912 | #endif |
968 | #endif |
913 | |
969 | |
914 | struct rxvt_term : zero_initialized, rxvt_vars { |
970 | struct rxvt_term : zero_initialized, rxvt_vars { |
915 | log_callback *log_hook; // log error messages through this hook, if != 0 |
971 | log_callback *log_hook; // log error messages through this hook, if != 0 |
916 | getfd_callback *getfd_hook; // convert remote to local fd, if != 0 |
972 | getfd_callback *getfd_hook; // convert remote to local fd, if != 0 |
917 | |
973 | |
918 | #if ENABLE_PERL |
974 | #if ENABLE_PERL |
919 | void *self; // perl's $self |
975 | rxvt_perl_term perl; |
920 | #endif |
976 | #endif |
921 | |
977 | |
922 | struct mbstate mbstate; // current input multibyte state |
978 | struct mbstate mbstate; // current input multibyte state |
923 | |
979 | |
924 | unsigned char want_refresh:1, |
980 | unsigned char want_refresh:1, |
… | |
… | |
1245 | |
1301 | |
1246 | // command.C |
1302 | // command.C |
1247 | void lookup_key (XKeyEvent &ev); |
1303 | void lookup_key (XKeyEvent &ev); |
1248 | unsigned int cmd_write (const char *str, unsigned int count); |
1304 | unsigned int cmd_write (const char *str, unsigned int count); |
1249 | |
1305 | |
1250 | unicode_t next_char (); |
1306 | wchar_t next_char (); |
1251 | unicode_t cmd_getc (); |
1307 | wchar_t cmd_getc (); |
1252 | unicode_t next_octet (); |
1308 | uint32_t next_octet (); |
1253 | unicode_t cmd_get8 (); |
1309 | uint32_t cmd_get8 (); |
1254 | |
1310 | |
1255 | bool cmd_parse (); |
1311 | bool cmd_parse (); |
1256 | void mouse_report (XButtonEvent &ev); |
1312 | void mouse_report (XButtonEvent &ev); |
1257 | void button_press (XButtonEvent &ev); |
1313 | void button_press (XButtonEvent &ev); |
1258 | void button_release (XButtonEvent &ev); |
1314 | void button_release (XButtonEvent &ev); |
… | |
… | |
1404 | void scr_touch (bool refresh); |
1460 | void scr_touch (bool refresh); |
1405 | void scr_expose (int x, int y, int width, int height, bool refresh); |
1461 | void scr_expose (int x, int y, int width, int height, bool refresh); |
1406 | rxvt_fontset *scr_find_fontset (rend_t r = DEFAULT_RSTYLE); |
1462 | rxvt_fontset *scr_find_fontset (rend_t r = DEFAULT_RSTYLE); |
1407 | void scr_recolour (); |
1463 | void scr_recolour (); |
1408 | void scr_remap_chars (); |
1464 | void scr_remap_chars (); |
1409 | void scr_remap_chars (const line_t &l); |
1465 | void scr_remap_chars (line_t &l); |
1410 | |
1466 | |
1411 | void scr_poweron (); |
1467 | void scr_poweron (); |
1412 | void scr_cursor (int mode); |
1468 | void scr_cursor (int mode); |
1413 | void scr_do_wrap (); |
1469 | void scr_do_wrap (); |
1414 | int scr_change_screen (int scrn); |
1470 | int scr_change_screen (int scrn); |
1415 | void scr_color (unsigned int color, int fgbg); |
1471 | void scr_color (unsigned int color, int fgbg); |
1416 | void scr_rendition (int set, int style); |
1472 | void scr_rendition (int set, int style); |
1417 | void scr_add_lines (const unicode_t *str, int nlines, int len); |
1473 | void scr_add_lines (const wchar_t *str, int len, int minlines = 0); |
1418 | void scr_backspace (); |
1474 | void scr_backspace (); |
1419 | void scr_tab (int count, bool ht = false); |
1475 | void scr_tab (int count, bool ht = false); |
1420 | void scr_gotorc (int row, int col, int relative); |
1476 | void scr_gotorc (int row, int col, int relative); |
1421 | void scr_index (enum page_dirn direction); |
1477 | void scr_index (enum page_dirn direction); |
1422 | void scr_erase_line (int mode); |
1478 | void scr_erase_line (int mode); |