… | |
… | |
8 | #include <X11/cursorfont.h> |
8 | #include <X11/cursorfont.h> |
9 | #include <X11/keysym.h> |
9 | #include <X11/keysym.h> |
10 | #include <X11/keysymdef.h> |
10 | #include <X11/keysymdef.h> |
11 | #include <X11/Xatom.h> |
11 | #include <X11/Xatom.h> |
12 | |
12 | |
|
|
13 | #include "encoding.h" |
13 | #include "defaultfont.h" |
14 | #include "defaultfont.h" |
14 | #include "rxvtcolor.h" |
15 | #include "rxvtcolor.h" |
15 | #include "iom.h" |
16 | #include "iom.h" |
16 | #include "salloc.h" |
17 | #include "salloc.h" |
17 | |
18 | |
… | |
… | |
27 | # define __svr4__ |
28 | # define __svr4__ |
28 | #endif |
29 | #endif |
29 | #if defined (sun) && !defined (__sun__) |
30 | #if defined (sun) && !defined (__sun__) |
30 | # define __sun__ |
31 | # define __sun__ |
31 | #endif |
32 | #endif |
32 | |
|
|
33 | |
33 | |
34 | #ifndef HAVE_XPOINTER |
34 | #ifndef HAVE_XPOINTER |
35 | typedef char *XPointer; |
35 | typedef char *XPointer; |
36 | #endif |
36 | #endif |
37 | |
37 | |
… | |
… | |
134 | /* |
134 | /* |
135 | ***************************************************************************** |
135 | ***************************************************************************** |
136 | * NORMAL DEFINES |
136 | * NORMAL DEFINES |
137 | ***************************************************************************** |
137 | ***************************************************************************** |
138 | */ |
138 | */ |
139 | |
|
|
140 | #if defined (NO_OLD_SELECTION) && defined(NO_NEW_SELECTION) |
|
|
141 | # error if you disable both selection styles, how can you select, silly? |
|
|
142 | #endif |
|
|
143 | |
139 | |
144 | /* COLORTERM, TERM environment variables */ |
140 | /* COLORTERM, TERM environment variables */ |
145 | #define COLORTERMENV "rxvt" |
141 | #define COLORTERMENV "rxvt" |
146 | #ifdef XPM_BACKGROUND |
142 | #ifdef XPM_BACKGROUND |
147 | # define COLORTERMENVFULL COLORTERMENV "-xpm" |
143 | # define COLORTERMENVFULL COLORTERMENV "-xpm" |
… | |
… | |
588 | #define PrivMode_TtyOutputInh (1LU<<16) |
584 | #define PrivMode_TtyOutputInh (1LU<<16) |
589 | #define PrivMode_Keypress (1LU<<17) |
585 | #define PrivMode_Keypress (1LU<<17) |
590 | #define PrivMode_smoothScroll (1LU<<18) |
586 | #define PrivMode_smoothScroll (1LU<<18) |
591 | #define PrivMode_vt52 (1LU<<19) |
587 | #define PrivMode_vt52 (1LU<<19) |
592 | /* too annoying to implement X11 highlight tracking */ |
588 | /* too annoying to implement X11 highlight tracking */ |
593 | /* #define PrivMode_MouseX11Track (1LU<<18) */ |
589 | /* #define PrivMode_MouseX11Track (1LU<<20) */ |
594 | |
590 | |
595 | #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11) |
591 | #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11) |
596 | #define PrivMode(test,bit) \ |
592 | #define PrivMode(test,bit) \ |
597 | if (test) \ |
593 | if (test) \ |
598 | PrivateModes |= (bit); \ |
594 | PrivateModes |= (bit); \ |
… | |
… | |
607 | |
603 | |
608 | #define XDEPTH display->depth |
604 | #define XDEPTH display->depth |
609 | #define XCMAP display->cmap |
605 | #define XCMAP display->cmap |
610 | #define XVISUAL display->visual |
606 | #define XVISUAL display->visual |
611 | |
607 | |
612 | #define IMBUFSIZ 128 /* input modifier buffer sizes */ |
608 | #define IMBUFSIZ 128 // input modifier buffer sizes |
613 | #ifndef BUFSIZ |
|
|
614 | # define BUFSIZ 4096 |
|
|
615 | #endif |
|
|
616 | #define KBUFSZ 512 /* size of keyboard mapping buffer */ |
609 | #define KBUFSZ 512 // size of keyboard mapping buffer |
|
|
610 | #define CBUFSIZ 4096 // size of command buffer |
|
|
611 | #define UBUFSIZ 4096 // character buffer |
617 | |
612 | |
618 | /* |
613 | /* |
619 | ***************************************************************************** |
614 | ***************************************************************************** |
620 | * MACRO DEFINES |
615 | * MACRO DEFINES |
621 | ***************************************************************************** |
616 | ***************************************************************************** |
… | |
… | |
791 | # define D_X(x) fprintf x ; fputc('\n', stderr) |
786 | # define D_X(x) fprintf x ; fputc('\n', stderr) |
792 | #else |
787 | #else |
793 | # define D_X(x) |
788 | # define D_X(x) |
794 | #endif |
789 | #endif |
795 | |
790 | |
|
|
791 | extern class rxvt_failure_exception { } rxvt_failure_exception; |
|
|
792 | |
|
|
793 | typedef callback1<void, const char *> log_callback; |
|
|
794 | |
|
|
795 | extern void rxvt_vlog (const char *fmt, va_list arg_ptr); |
|
|
796 | extern void rxvt_log (const char *fmt, ...); |
|
|
797 | extern void rxvt_warn (const char *fmt, ...); |
|
|
798 | extern void rxvt_fatal (const char *fmt, ...) __attribute__ ((noreturn)); |
|
|
799 | extern void rxvt_exit_failure () __attribute__ ((noreturn)); |
|
|
800 | |
|
|
801 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
|
|
802 | extern void rxvt_set_locale (const char *locale); |
|
|
803 | |
796 | /* |
804 | /* |
797 | ***************************************************************************** |
805 | ***************************************************************************** |
798 | * VARIABLES |
806 | * VARIABLES |
799 | ***************************************************************************** |
807 | ***************************************************************************** |
800 | */ |
808 | */ |
… | |
… | |
836 | #if ENABLE_COMBINING |
844 | #if ENABLE_COMBINING |
837 | // compose chars are used to represent composite characters |
845 | // compose chars are used to represent composite characters |
838 | // that are not representable in unicode, as well as characters |
846 | // that are not representable in unicode, as well as characters |
839 | // not fitting in the BMP. |
847 | // not fitting in the BMP. |
840 | struct compose_char { |
848 | struct compose_char { |
841 | uint32_t c1, c2; // any chars != NOCHAR are valid |
849 | unicode_t c1, c2; // any chars != NOCHAR are valid |
842 | compose_char (uint32_t c1, uint32_t c2) |
850 | compose_char (unicode_t c1, unicode_t c2) |
843 | : c1(c1), c2(c2) |
851 | : c1(c1), c2(c2) |
844 | { } |
852 | { } |
845 | }; |
853 | }; |
846 | |
854 | |
847 | class rxvt_composite_vec { |
855 | class rxvt_composite_vec { |
848 | vector<compose_char> v; |
856 | vector<compose_char> v; |
849 | public: |
857 | public: |
850 | text_t compose (uint32_t c1, uint32_t c2 = NOCHAR); |
858 | text_t compose (unicode_t c1, unicode_t c2 = NOCHAR); |
851 | int expand (uint32_t c, wchar_t *r); |
859 | int expand (unicode_t c, wchar_t *r); |
852 | compose_char *operator [](text_t c) |
860 | compose_char *operator [](text_t c) |
853 | { |
861 | { |
854 | return c >= COMPOSE_LO && c < COMPOSE_LO + v.size () |
862 | return c >= COMPOSE_LO && c < COMPOSE_LO + v.size () |
855 | ? &v[c - COMPOSE_LO] |
863 | ? &v[c - COMPOSE_LO] |
856 | : 0; |
864 | : 0; |
… | |
… | |
860 | extern class rxvt_composite_vec rxvt_composite; |
868 | extern class rxvt_composite_vec rxvt_composite; |
861 | #endif |
869 | #endif |
862 | |
870 | |
863 | |
871 | |
864 | struct rxvt_term : rxvt_vars { |
872 | struct rxvt_term : rxvt_vars { |
|
|
873 | log_callback *log_hook; |
|
|
874 | |
865 | struct mbstate mbstate; |
875 | struct mbstate mbstate; |
866 | |
876 | |
867 | unsigned char want_refresh:1, |
877 | unsigned char want_refresh:1, |
868 | #ifdef TRANSPARENT |
878 | #ifdef TRANSPARENT |
869 | want_full_refresh:1, /* awaiting full screen refresh */ |
879 | want_full_refresh:1, /* awaiting full screen refresh */ |
… | |
… | |
884 | #endif |
894 | #endif |
885 | #ifdef POINTER_BLANK |
895 | #ifdef POINTER_BLANK |
886 | hidden_pointer:1, |
896 | hidden_pointer:1, |
887 | #endif |
897 | #endif |
888 | parsed_geometry:1, |
898 | parsed_geometry:1, |
|
|
899 | // enc_utf8:1, /* wether terminal reads/writes utf-8 */ |
889 | seen_input:1, /* wether any input has been seen so far */ |
900 | seen_input:1; /* wether any input has been seen so far */ |
890 | enc_utf8:1; /* wether terminal reads/writes utf-8 */ |
|
|
891 | |
901 | |
892 | unsigned char refresh_type, |
902 | unsigned char refresh_type, |
893 | #ifdef UTMP_SUPPORT |
903 | #ifdef UTMP_SUPPORT |
894 | next_utmp_action, |
904 | next_utmp_action, |
895 | #endif |
905 | #endif |
… | |
… | |
1057 | #endif |
1067 | #endif |
1058 | #ifdef POINTER_BLANK |
1068 | #ifdef POINTER_BLANK |
1059 | struct timeval lastmotion; |
1069 | struct timeval lastmotion; |
1060 | #endif |
1070 | #endif |
1061 | |
1071 | |
1062 | /* these three don't need to be kept but do so to placate some mem checkers */ |
1072 | vector<void *> allocated; // free these memory blocks |
|
|
1073 | |
1063 | char *env_windowid; /* environmental variable WINDOWID */ |
1074 | char *env_windowid; /* environmental variable WINDOWID */ |
1064 | char *env_display; /* environmental variable DISPLAY */ |
1075 | char *env_display; /* environmental variable DISPLAY */ |
1065 | char *env_term; /* environmental variable TERM */ |
1076 | char *env_term; /* environmental variable TERM */ |
1066 | char *env_colorfgbg; |
1077 | char *env_colorfgbg; |
1067 | char *locale; |
1078 | char *locale; |
|
|
1079 | #if 0 |
1068 | char *codeset; |
1080 | char *codeset; |
|
|
1081 | #endif |
1069 | char charsets[4]; |
1082 | char charsets[4]; |
1070 | unsigned char *v_buffer; /* pointer to physical buffer */ |
1083 | unsigned char *v_buffer; /* pointer to physical buffer */ |
1071 | unsigned int v_buflen; /* size of area to write */ |
1084 | unsigned int v_buflen; /* size of area to write */ |
1072 | stringvec *argv, *envv; /* if != 0, will be freed on destroy time */ |
1085 | stringvec *argv, *envv; /* if != 0, will be freed on destroy time */ |
1073 | #ifdef KEYSYM_RESOURCE |
1086 | #ifdef KEYSYM_RESOURCE |
1074 | const unsigned char *Keysym_map[256]; |
1087 | const unsigned char *Keysym_map[256]; |
1075 | #endif |
1088 | #endif |
1076 | const char *rs[NUM_RESOURCES]; |
1089 | const char *rs[NUM_RESOURCES]; |
1077 | /* command input buffering */ |
1090 | /* command input buffering */ |
1078 | unsigned char *cmdbuf_ptr, *cmdbuf_endp; |
1091 | unsigned char *cmdbuf_ptr, *cmdbuf_endp; |
1079 | unsigned char cmdbuf_base[BUFSIZ]; |
1092 | unsigned char cmdbuf_base[CBUFSIZ]; |
1080 | |
1093 | |
1081 | rxvt_salloc *ralloc; |
1094 | rxvt_salloc *ralloc; |
1082 | rxvt_salloc *talloc; |
1095 | rxvt_salloc *talloc; |
1083 | |
1096 | |
1084 | void paste (const unsigned char *data, unsigned int len); |
1097 | void paste (const unsigned char *data, unsigned int len); |
… | |
… | |
1128 | void destroy (); |
1141 | void destroy (); |
1129 | |
1142 | |
1130 | bool init (int argc, const char *const *argv); |
1143 | bool init (int argc, const char *const *argv); |
1131 | bool init_vars (); |
1144 | bool init_vars (); |
1132 | |
1145 | |
1133 | uint32_t next_char (); |
1146 | unicode_t next_char (); |
1134 | |
1147 | |
1135 | bool pty_fill (); |
1148 | bool pty_fill (); |
1136 | |
1149 | |
1137 | void *operator new (size_t s); |
1150 | void *operator new (size_t s); |
1138 | void operator delete (void *p, size_t s); |
1151 | void operator delete (void *p, size_t s); |
… | |
… | |
1193 | /* autoconvert */ |
1206 | /* autoconvert */ |
1194 | |
1207 | |
1195 | // command.C |
1208 | // command.C |
1196 | void lookup_key (XKeyEvent &ev); |
1209 | void lookup_key (XKeyEvent &ev); |
1197 | unsigned int cmd_write (const unsigned char *str, unsigned int count); |
1210 | unsigned int cmd_write (const unsigned char *str, unsigned int count); |
1198 | uint32_t cmd_getc (); |
1211 | unicode_t cmd_getc (); |
1199 | bool cmd_parse (); |
1212 | bool cmd_parse (); |
1200 | void mouse_report (XButtonEvent &ev); |
1213 | void mouse_report (XButtonEvent &ev); |
1201 | void button_press (XButtonEvent &ev); |
1214 | void button_press (XButtonEvent &ev); |
1202 | void button_release (XButtonEvent &ev); |
1215 | void button_release (XButtonEvent &ev); |
1203 | int check_our_parents (); |
1216 | int check_our_parents (); |
1204 | #ifdef PRINTPIPE |
1217 | #ifdef PRINTPIPE |
1205 | FILE *popen_printer (); |
1218 | FILE *popen_printer (); |
1206 | int pclose_printer (FILE *stream); |
1219 | int pclose_printer (FILE *stream); |
1207 | #endif |
1220 | #endif |
1208 | void process_print_pipe (); |
1221 | void process_print_pipe (); |
1209 | void process_nonprinting (unsigned char ch); |
1222 | void process_nonprinting (unicode_t ch); |
1210 | void process_escape_vt52 (unsigned char ch); |
1223 | void process_escape_vt52 (unicode_t ch); |
1211 | void process_escape_seq (); |
1224 | void process_escape_seq (); |
1212 | void process_csi_seq (); |
1225 | void process_csi_seq (); |
1213 | void process_window_ops (const int *args, unsigned int nargs); |
1226 | void process_window_ops (const int *args, unsigned int nargs); |
1214 | unsigned char * get_to_st (unsigned char *ends_how); |
1227 | unsigned char *get_to_st (unicode_t &ends_how); |
1215 | void process_dcs_seq (); |
1228 | void process_dcs_seq (); |
1216 | void process_osc_seq (); |
1229 | void process_osc_seq (); |
1217 | void xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))); |
1230 | void xterm_seq (int op, const char *str, unsigned char resp __attribute__ ((unused))); |
1218 | int privcases (int mode, unsigned long bit); |
1231 | int privcases (int mode, unsigned long bit); |
1219 | void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); |
1232 | void process_terminal_mode (int mode, int priv, unsigned int nargs, const int *arg); |
… | |
… | |
1230 | void privileged_utmp (char action); |
1243 | void privileged_utmp (char action); |
1231 | void privileged_ttydev (char action); |
1244 | void privileged_ttydev (char action); |
1232 | bool change_font (const char *fontname); |
1245 | bool change_font (const char *fontname); |
1233 | bool font_up_down (int n, int direction); |
1246 | bool font_up_down (int n, int direction); |
1234 | void set_title (const char *str); |
1247 | void set_title (const char *str); |
1235 | void set_iconName (const char *str); |
1248 | void set_icon_name (const char *str); |
1236 | void set_window_color (int idx, const char *color); |
1249 | void set_window_color (int idx, const char *color); |
1237 | void set_colorfgbg (); |
1250 | void set_colorfgbg (); |
1238 | int rXParseAllocColor (rxvt_color * screen_in_out, const char *colour); |
1251 | int rXParseAllocColor (rxvt_color * screen_in_out, const char *colour); |
1239 | void set_widthheight (unsigned int width, unsigned int height); |
1252 | void set_widthheight (unsigned int width, unsigned int height); |
1240 | |
1253 | |
… | |
… | |
1275 | void scr_poweron (); |
1288 | void scr_poweron (); |
1276 | void scr_cursor (int mode); |
1289 | void scr_cursor (int mode); |
1277 | int scr_change_screen (int scrn); |
1290 | int scr_change_screen (int scrn); |
1278 | void scr_color (unsigned int color, int fgbg); |
1291 | void scr_color (unsigned int color, int fgbg); |
1279 | void scr_rendition (int set, int style); |
1292 | void scr_rendition (int set, int style); |
1280 | void scr_add_lines (const uint32_t *str, int nlines, int len); |
1293 | void scr_add_lines (const unicode_t *str, int nlines, int len); |
1281 | void scr_backspace (); |
1294 | void scr_backspace (); |
1282 | void scr_tab (int count); |
1295 | void scr_tab (int count); |
1283 | void scr_backindex (); |
1296 | void scr_backindex (); |
1284 | void scr_forwardindex (); |
1297 | void scr_forwardindex (); |
1285 | void scr_gotorc (int row, int col, int relative); |
1298 | void scr_gotorc (int row, int col, int relative); |
… | |
… | |
1357 | int scale_pixmap (const char *geom); |
1370 | int scale_pixmap (const char *geom); |
1358 | void resize_pixmap (); |
1371 | void resize_pixmap (); |
1359 | Pixmap set_bgPixmap (const char *file); |
1372 | Pixmap set_bgPixmap (const char *file); |
1360 | }; |
1373 | }; |
1361 | |
1374 | |
1362 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
|
|
1363 | extern void rxvt_set_locale (const char *locale); |
|
|
1364 | |
|
|
1365 | /* |
1375 | /* |
1366 | ***************************************************************************** |
1376 | ***************************************************************************** |
1367 | * PROTOTYPES |
1377 | * PROTOTYPES |
1368 | ***************************************************************************** |
1378 | ***************************************************************************** |
1369 | */ |
1379 | */ |