… | |
… | |
23 | #if HAVE_WCHAR_H |
23 | #if HAVE_WCHAR_H |
24 | # include <wchar.h> |
24 | # include <wchar.h> |
25 | #else |
25 | #else |
26 | // stdlib.h might provide it |
26 | // stdlib.h might provide it |
27 | #endif |
27 | #endif |
|
|
28 | |
|
|
29 | #include <libptytty.h> |
28 | |
30 | |
29 | // we assume that Xlib.h defines XPointer, and it does since at least 1994... |
31 | // we assume that Xlib.h defines XPointer, and it does since at least 1994... |
30 | |
32 | |
31 | extern "C" { |
33 | extern "C" { |
32 | #include <X11/Xlib.h> |
34 | #include <X11/Xlib.h> |
… | |
… | |
88 | #include "rxvtfont.h" |
90 | #include "rxvtfont.h" |
89 | #include "rxvttoolkit.h" |
91 | #include "rxvttoolkit.h" |
90 | #include "rxvtimg.h" |
92 | #include "rxvtimg.h" |
91 | #include "scrollbar.h" |
93 | #include "scrollbar.h" |
92 | #include "ev_cpp.h" |
94 | #include "ev_cpp.h" |
93 | #include "libptytty.h" |
|
|
94 | |
95 | |
95 | #include "rxvtperl.h" |
96 | #include "rxvtperl.h" |
96 | |
97 | |
97 | // try to avoid some macros to decrease code size, on some systems |
98 | // try to avoid some macros to decrease code size, on some systems |
98 | #if ENABLE_MINIMAL |
99 | #if ENABLE_MINIMAL |
… | |
… | |
123 | #endif |
124 | #endif |
124 | |
125 | |
125 | /****************************************************************************/ |
126 | /****************************************************************************/ |
126 | |
127 | |
127 | // exception thrown on fatal (per-instance) errors |
128 | // exception thrown on fatal (per-instance) errors |
128 | class rxvt_failure_exception { }; |
129 | class rxvt_failure_exception : public std::exception |
|
|
130 | { |
|
|
131 | public: |
|
|
132 | const char * |
|
|
133 | what () const noexcept override |
|
|
134 | { |
|
|
135 | return ""; |
|
|
136 | } |
|
|
137 | }; |
129 | |
138 | |
130 | // exception thrown when the command parser runs out of input data |
139 | // exception thrown when the command parser runs out of input data |
131 | class out_of_input { }; |
140 | class out_of_input { }; |
132 | |
141 | |
133 | /* |
142 | /* |
… | |
… | |
441 | URxvt_boldItalicFont = 713, |
450 | URxvt_boldItalicFont = 713, |
442 | |
451 | |
443 | URxvt_view_up = 720, |
452 | URxvt_view_up = 720, |
444 | URxvt_view_down = 721, |
453 | URxvt_view_down = 721, |
445 | |
454 | |
|
|
455 | URxvt_cellinfo = 776, // returns font cell width, height etc. |
446 | URxvt_perl = 777, // for use by perl extensions, starts with "extension-name;" |
456 | URxvt_perl = 777, // for use by perl extensions, starts with "extension-name;" |
447 | }; |
457 | }; |
448 | |
458 | |
449 | /* Words starting with `Color_' are colours. Others are counts */ |
459 | /* Words starting with `Color_' are colours. Others are counts */ |
450 | /* |
460 | /* |
… | |
… | |
789 | // compose chars are used to represent composite characters |
799 | // compose chars are used to represent composite characters |
790 | // that are not representable in unicode, as well as characters |
800 | // that are not representable in unicode, as well as characters |
791 | // not fitting in the BMP. |
801 | // not fitting in the BMP. |
792 | struct compose_char |
802 | struct compose_char |
793 | { |
803 | { |
794 | // c1 can be any chaarcter != NOCHAR, including another compose character |
804 | // c1 can be any character != NOCHAR, including another compose character |
795 | // c2 must always be a zero-width character or NOCHAR, in case |
805 | // c2 must always be a zero-width character or NOCHAR, in case |
796 | // this just extends beyondthe BMP. |
806 | // this just extends beyond the BMP. |
797 | unicode_t c1, c2; |
807 | unicode_t c1, c2; |
798 | |
808 | |
799 | compose_char (unicode_t c1, unicode_t c2) |
809 | compose_char (unicode_t c1, unicode_t c2) |
800 | : c1(c1), c2(c2) |
810 | : c1(c1), c2(c2) |
801 | { } |
811 | { } |
802 | }; |
812 | }; |
803 | |
813 | |
804 | class rxvt_composite_vec |
814 | struct rxvt_composite_vec |
805 | { |
815 | { |
806 | vector<compose_char> v; |
816 | vector<compose_char> v; |
807 | public: |
817 | |
808 | text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); |
818 | text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); |
809 | template<typename T> int expand (unicode_t c, T *r); |
819 | template<typename T> int expand (unicode_t c, T *r); |
810 | int expand (unicode_t c) { return expand (c, (text_t *)0); } |
820 | int expand (unicode_t c) { return expand (c, (text_t *)0); } |
811 | compose_char *operator [](text_t c) |
821 | compose_char *operator [](text_t c) |
812 | { |
822 | { |
… | |
… | |
815 | : 0; |
825 | : 0; |
816 | } |
826 | } |
817 | }; |
827 | }; |
818 | |
828 | |
819 | extern class rxvt_composite_vec rxvt_composite; |
829 | extern class rxvt_composite_vec rxvt_composite; |
|
|
830 | #endif |
|
|
831 | |
|
|
832 | #if 0 |
|
|
833 | // expand the sequence into a static array |
|
|
834 | // works even without ENABLE_COMBINING |
|
|
835 | template<typename T, int max_size_ = 48> |
|
|
836 | struct rxvt_compose_expand_static |
|
|
837 | { |
|
|
838 | #if ENABLE_COMBINING |
|
|
839 | enum { max_size = max_size_ }; |
|
|
840 | |
|
|
841 | T chrs[max_size]; |
|
|
842 | |
|
|
843 | // expand sequence and return start ptr |
|
|
844 | // guarantees at least one output |
|
|
845 | // get the length with length () on that ptr |
|
|
846 | T *operator ()(unicode_t c) |
|
|
847 | { |
|
|
848 | T *cur = chrs + max_size; |
|
|
849 | |
|
|
850 | while (ecb_expect_false (IS_COMPOSE (c))) |
|
|
851 | if (ecb_expect_true (c - COMPOSE_LO < rxvt_composite.v.size ())) |
|
|
852 | { |
|
|
853 | compose_char *cc = &rxvt_composite.v [c - COMPOSE_LO]; |
|
|
854 | |
|
|
855 | if (cc->c2 != NOCHAR) |
|
|
856 | { |
|
|
857 | cur -= cur > chrs; *cur = cc->c2; |
|
|
858 | } |
|
|
859 | |
|
|
860 | c = cc->c1; |
|
|
861 | } |
|
|
862 | else |
|
|
863 | c = NOCHAR; |
|
|
864 | |
|
|
865 | cur -= cur > chrs; *cur = c; |
|
|
866 | |
|
|
867 | return cur; |
|
|
868 | } |
|
|
869 | |
|
|
870 | int length (T *first) |
|
|
871 | { |
|
|
872 | return chrs + max_size - first; |
|
|
873 | } |
|
|
874 | #else |
|
|
875 | T chr; |
|
|
876 | |
|
|
877 | T *operator ()(text_t c); |
|
|
878 | { |
|
|
879 | chr = c; |
|
|
880 | return &chr; |
|
|
881 | } |
|
|
882 | |
|
|
883 | int length (T *first) |
|
|
884 | { |
|
|
885 | return 1; |
|
|
886 | } |
|
|
887 | #endif |
|
|
888 | }; |
820 | #endif |
889 | #endif |
821 | |
890 | |
822 | /****************************************************************************/ |
891 | /****************************************************************************/ |
823 | |
892 | |
824 | #ifdef KEYSYM_RESOURCE |
893 | #ifdef KEYSYM_RESOURCE |
… | |
… | |
1033 | current_screen:1, /* primary or secondary */ |
1102 | current_screen:1, /* primary or secondary */ |
1034 | num_scr_allow:1, |
1103 | num_scr_allow:1, |
1035 | bypass_keystate:1, |
1104 | bypass_keystate:1, |
1036 | #if ENABLE_FRILLS |
1105 | #if ENABLE_FRILLS |
1037 | urgency_hint:1, |
1106 | urgency_hint:1, |
|
|
1107 | rewrap_always:1, |
|
|
1108 | rewrap_never:1, |
1038 | #endif |
1109 | #endif |
1039 | #if CURSOR_BLINK |
1110 | #if CURSOR_BLINK |
1040 | hidden_cursor:1, |
1111 | hidden_cursor:1, |
1041 | #endif |
1112 | #endif |
1042 | #if TEXT_BLINK |
1113 | #if TEXT_BLINK |