… | |
… | |
9 | |
9 | |
10 | #include <X11/cursorfont.h> |
10 | #include <X11/cursorfont.h> |
11 | #include <X11/keysym.h> |
11 | #include <X11/keysym.h> |
12 | #include <X11/keysymdef.h> |
12 | #include <X11/keysymdef.h> |
13 | #include <X11/Xatom.h> |
13 | #include <X11/Xatom.h> |
|
|
14 | #ifndef NO_FRILLS |
|
|
15 | #include <X11/Xmd.h> |
|
|
16 | #endif |
14 | |
17 | |
15 | #include "encoding.h" |
18 | #include "encoding.h" |
16 | #include "defaultfont.h" |
19 | #include "defaultfont.h" |
17 | #include "rxvtcolor.h" |
20 | #include "rxvtcolor.h" |
18 | #include "iom.h" |
21 | #include "iom.h" |
… | |
… | |
130 | } while (/* CONSTCOND */ 0) |
133 | } while (/* CONSTCOND */ 0) |
131 | #define BOUND_POSITIVE_INT16(val) \ |
134 | #define BOUND_POSITIVE_INT16(val) \ |
132 | (int16_t) ((val) <= 0 \ |
135 | (int16_t) ((val) <= 0 \ |
133 | ? 0 \ |
136 | ? 0 \ |
134 | : min ((val), (((uint16_t)-1)>>1))) |
137 | : min ((val), (((uint16_t)-1)>>1))) |
|
|
138 | |
|
|
139 | #ifndef NO_FRILLS |
|
|
140 | typedef struct _mwmhints { |
|
|
141 | CARD32 flags; |
|
|
142 | CARD32 functions; |
|
|
143 | CARD32 decorations; |
|
|
144 | INT32 input_mode; |
|
|
145 | CARD32 status; |
|
|
146 | } MWMHints; |
|
|
147 | #endif |
135 | |
148 | |
136 | /* |
149 | /* |
137 | ***************************************************************************** |
150 | ***************************************************************************** |
138 | * NORMAL DEFINES |
151 | * NORMAL DEFINES |
139 | ***************************************************************************** |
152 | ***************************************************************************** |
… | |
… | |
266 | enum { |
279 | enum { |
267 | NO_REFRESH = 0 , /* Window not visible at all! */ |
280 | NO_REFRESH = 0 , /* Window not visible at all! */ |
268 | FAST_REFRESH = 1<<0, /* Fully exposed window */ |
281 | FAST_REFRESH = 1<<0, /* Fully exposed window */ |
269 | SLOW_REFRESH = 1<<1, /* Partially exposed window */ |
282 | SLOW_REFRESH = 1<<1, /* Partially exposed window */ |
270 | SMOOTH_REFRESH = 1<<2, /* Do sync'ing to make it smooth */ |
283 | SMOOTH_REFRESH = 1<<2, /* Do sync'ing to make it smooth */ |
271 | REFRESH_BOUNDS = 1<<3 |
|
|
272 | }; |
284 | }; |
273 | |
285 | |
274 | #ifdef NO_SECONDARY_SCREEN |
286 | #ifdef NO_SECONDARY_SCREEN |
275 | # define NSCREENS 0 |
287 | # define NSCREENS 0 |
276 | #else |
288 | #else |
… | |
… | |
530 | Rs_transparent_all, |
542 | Rs_transparent_all, |
531 | #endif |
543 | #endif |
532 | #ifndef NO_FRILLS |
544 | #ifndef NO_FRILLS |
533 | Rs_ext_bwidth, |
545 | Rs_ext_bwidth, |
534 | Rs_int_bwidth, |
546 | Rs_int_bwidth, |
|
|
547 | Rs_borderLess, |
535 | #endif |
548 | #endif |
536 | Rs_scrollBar_thickness, |
549 | Rs_scrollBar_thickness, |
537 | #ifndef NO_LINESPACE |
550 | #ifndef NO_LINESPACE |
538 | Rs_lineSpace, |
551 | Rs_lineSpace, |
539 | #endif |
552 | #endif |
… | |
… | |
547 | Rs_pointerBlankDelay, |
560 | Rs_pointerBlankDelay, |
548 | Rs_imLocale, |
561 | Rs_imLocale, |
549 | #ifndef NO_SECONDARY_SCREEN |
562 | #ifndef NO_SECONDARY_SCREEN |
550 | Rs_secondaryScreen, |
563 | Rs_secondaryScreen, |
551 | Rs_secondaryScroll, |
564 | Rs_secondaryScroll, |
|
|
565 | #endif |
|
|
566 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
|
|
567 | Rs_realBold, |
|
|
568 | #endif |
|
|
569 | #ifdef OFF_FOCUS_FADING |
|
|
570 | Rs_fade, |
|
|
571 | #endif |
|
|
572 | #ifdef TINTING |
|
|
573 | Rs_shade, |
552 | #endif |
574 | #endif |
553 | NUM_RESOURCES |
575 | NUM_RESOURCES |
554 | }; |
576 | }; |
555 | |
577 | |
556 | // see init.C:xa_names, which must be kept in sync |
578 | // see init.C:xa_names, which must be kept in sync |
… | |
… | |
611 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) |
633 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) |
612 | #else |
634 | #else |
613 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
635 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
614 | #endif |
636 | #endif |
615 | |
637 | |
616 | #define XDEPTH display->depth |
638 | // do not change these constants lightly, there are many interdependencies |
617 | #define XCMAP display->cmap |
|
|
618 | #define XVISUAL display->visual |
|
|
619 | |
|
|
620 | #define IMBUFSIZ 128 // input modifier buffer sizes |
639 | #define IMBUFSIZ 128 // input modifier buffer sizes |
621 | #define KBUFSZ 512 // size of keyboard mapping buffer |
640 | #define KBUFSZ 512 // size of keyboard mapping buffer |
622 | #define CBUFSIZ 4096 // size of command buffer |
641 | #define CBUFSIZ 4096 // size of command buffer |
623 | #define UBUFSIZ 4096 // character buffer |
642 | #define UBUFSIZ 4096 // character buffer |
624 | |
643 | |
625 | #ifndef PATH_MAX |
644 | #ifndef PATH_MAX |
626 | # define PATH_MAX 16384 |
645 | # define PATH_MAX 16384 |
627 | #endif |
646 | #endif |
|
|
647 | |
|
|
648 | /* Motif window hints */ |
|
|
649 | #define MWM_HINTS_FUNCTIONS (1L << 0) |
|
|
650 | #define MWM_HINTS_DECORATIONS (1L << 1) |
|
|
651 | #define MWM_HINTS_INPUT_MODE (1L << 2) |
|
|
652 | #define MWM_HINTS_STATUS (1L << 3) |
|
|
653 | /* bit definitions for MwmHints.functions */ |
|
|
654 | #define MWM_FUNC_ALL (1L << 0) |
|
|
655 | #define MWM_FUNC_RESIZE (1L << 1) |
|
|
656 | #define MWM_FUNC_MOVE (1L << 2) |
|
|
657 | #define MWM_FUNC_MINIMIZE (1L << 3) |
|
|
658 | #define MWM_FUNC_MAXIMIZE (1L << 4) |
|
|
659 | #define MWM_FUNC_CLOSE (1L << 5) |
|
|
660 | /* bit definitions for MwmHints.decorations */ |
|
|
661 | #define MWM_DECOR_ALL (1L << 0) |
|
|
662 | #define MWM_DECOR_BORDER (1L << 1) |
|
|
663 | #define MWM_DECOR_RESIZEH (1L << 2) |
|
|
664 | #define MWM_DECOR_TITLE (1L << 3) |
|
|
665 | #define MWM_DECOR_MENU (1L << 4) |
|
|
666 | #define MWM_DECOR_MINIMIZE (1L << 5) |
|
|
667 | #define MWM_DECOR_MAXIMIZE (1L << 6) |
|
|
668 | /* bit definitions for MwmHints.inputMode */ |
|
|
669 | #define MWM_INPUT_MODELESS 0 |
|
|
670 | #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 |
|
|
671 | #define MWM_INPUT_SYSTEM_MODAL 2 |
|
|
672 | #define MWM_INPUT_FULL_APPLICATION_MODAL 3 |
|
|
673 | #define PROP_MWM_HINTS_ELEMENTS 5 |
628 | |
674 | |
629 | /* |
675 | /* |
630 | ***************************************************************************** |
676 | ***************************************************************************** |
631 | * MACRO DEFINES |
677 | * MACRO DEFINES |
632 | ***************************************************************************** |
678 | ***************************************************************************** |
… | |
… | |
646 | #define STRLEN(x) strlen((const char *)(x)) |
692 | #define STRLEN(x) strlen((const char *)(x)) |
647 | #define STRCHR(x, y) strchr((const char *)(x), (int)(y)) |
693 | #define STRCHR(x, y) strchr((const char *)(x), (int)(y)) |
648 | #define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) |
694 | #define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) |
649 | |
695 | |
650 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
696 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
651 | #define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)TermWin.int_bwidth) |
697 | #define Pixel2Col(x) Pixel2Width((int32_t)(x)) |
652 | #define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)TermWin.int_bwidth) |
698 | #define Pixel2Row(y) Pixel2Height((int32_t)(y)) |
653 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)TermWin.fwidth) |
699 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)TermWin.fwidth) |
654 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)TermWin.fheight) |
700 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)TermWin.fheight) |
655 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)TermWin.int_bwidth) |
701 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
656 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)TermWin.int_bwidth) |
702 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
657 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fwidth) |
703 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fwidth) |
658 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fheight) |
704 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fheight) |
659 | |
705 | |
660 | #define TermWin_TotalWidth() ((int32_t)TermWin.width + 2 * (int32_t)TermWin.int_bwidth) |
706 | #define TermWin_TotalWidth() ((int32_t)TermWin.width) |
661 | #define TermWin_TotalHeight() ((int32_t)TermWin.height + 2 * (int32_t)TermWin.int_bwidth) |
707 | #define TermWin_TotalHeight() ((int32_t)TermWin.height) |
662 | |
708 | |
663 | /* how to build & extract colors and attributes */ |
709 | /* how to build & extract colors and attributes */ |
664 | #define GET_BASEFG(x) (((x) & RS_fgMask)) |
710 | #define GET_BASEFG(x) (((x) & RS_fgMask)) |
665 | #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) |
711 | #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) |
666 | #ifndef NO_BRIGHTCOLOR |
712 | #ifndef NO_BRIGHTCOLOR |
… | |
… | |
909 | hidden_text:1, |
955 | hidden_text:1, |
910 | #endif |
956 | #endif |
911 | #ifdef POINTER_BLANK |
957 | #ifdef POINTER_BLANK |
912 | hidden_pointer:1, |
958 | hidden_pointer:1, |
913 | #endif |
959 | #endif |
914 | parsed_geometry:1, |
|
|
915 | // enc_utf8:1, /* wether terminal reads/writes utf-8 */ |
960 | // enc_utf8:1, /* wether terminal reads/writes utf-8 */ |
916 | seen_input:1; /* wether any input has been seen so far */ |
961 | parsed_geometry:1; |
917 | |
962 | |
918 | unsigned char refresh_type, |
963 | unsigned char refresh_type, |
919 | #ifdef UTMP_SUPPORT |
964 | #ifdef UTMP_SUPPORT |
920 | next_utmp_action, |
965 | next_utmp_action, |
921 | #endif |
966 | #endif |
… | |
… | |
937 | rend_t rstyle; |
982 | rend_t rstyle; |
938 | /* ---------- */ |
983 | /* ---------- */ |
939 | uint32_t pixcolor_set[NPIXCLR_SETS]; |
984 | uint32_t pixcolor_set[NPIXCLR_SETS]; |
940 | /* ---------- */ |
985 | /* ---------- */ |
941 | #ifdef SELECTION_SCROLLING |
986 | #ifdef SELECTION_SCROLLING |
942 | int scroll_selection_delay, |
|
|
943 | scroll_selection_lines; |
987 | int scroll_selection_lines; |
944 | enum page_dirn scroll_selection_dir; |
988 | enum page_dirn scroll_selection_dir; |
945 | int selection_save_x, |
989 | int selection_save_x, |
946 | selection_save_y, |
990 | selection_save_y, |
947 | selection_save_state, |
991 | selection_save_state; |
948 | pending_scroll_selection; |
|
|
949 | #endif |
992 | #endif |
950 | /* ---------- */ |
993 | /* ---------- */ |
951 | int csrO, /* Hops - csr offset in thumb/slider to */ |
994 | int csrO, /* Hops - csr offset in thumb/slider to */ |
952 | /* give proper Scroll behaviour */ |
995 | /* give proper Scroll behaviour */ |
953 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
954 | scroll_arrow_delay, |
|
|
955 | #endif |
|
|
956 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
996 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
957 | mouse_slip_wheel_delay, |
|
|
958 | mouse_slip_wheel_speed, |
997 | mouse_slip_wheel_speed, |
959 | #endif |
998 | #endif |
960 | refresh_count, |
999 | refresh_count, |
961 | refresh_limit, |
1000 | refresh_limit, |
962 | fnum, /* logical font number */ |
|
|
963 | last_bot, /* scrollbar last bottom position */ |
1001 | last_bot, /* scrollbar last bottom position */ |
964 | last_top, /* scrollbar last top position */ |
1002 | last_top, /* scrollbar last top position */ |
965 | last_state, /* scrollbar last state */ |
1003 | last_state, /* scrollbar last state */ |
966 | scrollbar_len, |
1004 | scrollbar_len, |
967 | #ifdef MENUBAR |
1005 | #ifdef MENUBAR |
… | |
… | |
1127 | #endif |
1165 | #endif |
1128 | #ifdef MENUBAR |
1166 | #ifdef MENUBAR |
1129 | xevent_watcher menubar_ev; |
1167 | xevent_watcher menubar_ev; |
1130 | #endif |
1168 | #endif |
1131 | |
1169 | |
1132 | void check_cb (check_watcher &w); check_watcher check_ev; |
1170 | void check_cb (check_watcher &w); check_watcher check_ev; |
1133 | void destroy_cb (time_watcher &w); time_watcher destroy_ev; |
1171 | void destroy_cb (time_watcher &w); time_watcher destroy_ev; |
|
|
1172 | void flush_cb (time_watcher &w); time_watcher flush_ev; |
1134 | |
1173 | |
1135 | void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; |
1174 | void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; |
1136 | |
1175 | |
1137 | void incr_cb (time_watcher &w); time_watcher incr_ev; |
1176 | void incr_cb (time_watcher &w); time_watcher incr_ev; |
1138 | |
1177 | |
1139 | #ifdef CURSOR_BLINK |
1178 | #ifdef CURSOR_BLINK |
1140 | void cursor_blink_cb (time_watcher &w); time_watcher cursor_blink_ev; |
1179 | void cursor_blink_cb (time_watcher &w); time_watcher cursor_blink_ev; |
1141 | #endif |
1180 | #endif |
1142 | #ifdef TEXT_BLINK |
1181 | #ifdef TEXT_BLINK |
1143 | void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; |
1182 | void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; |
|
|
1183 | #endif |
|
|
1184 | |
|
|
1185 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
1186 | void cont_scroll_cb (time_watcher &w); time_watcher cont_scroll_ev; |
|
|
1187 | #endif |
|
|
1188 | #ifdef SELECTION_SCROLLING |
|
|
1189 | void sel_scroll_cb (time_watcher &w); time_watcher sel_scroll_ev; |
|
|
1190 | #endif |
|
|
1191 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
|
|
1192 | void slip_wheel_cb (time_watcher &w); time_watcher slip_wheel_ev; |
1144 | #endif |
1193 | #endif |
1145 | |
1194 | |
1146 | #ifdef POINTER_BLANK |
1195 | #ifdef POINTER_BLANK |
1147 | void pointer_cb (time_watcher &w); time_watcher pointer_ev; |
1196 | void pointer_cb (time_watcher &w); time_watcher pointer_ev; |
1148 | void pointer_blank (); |
1197 | void pointer_blank (); |
|
|
1198 | #endif |
1149 | void pointer_unblank (); |
1199 | void pointer_unblank (); |
1150 | #endif |
|
|
1151 | |
1200 | |
1152 | void tt_printf (const char *fmt,...); |
1201 | void tt_printf (const char *fmt,...); |
1153 | void tt_write (const unsigned char *data, unsigned int len); |
1202 | void tt_write (const unsigned char *data, unsigned int len); |
1154 | |
1203 | |
1155 | void tt_winch (); |
1204 | void tt_winch (); |
… | |
… | |
1158 | ~rxvt_term (); |
1207 | ~rxvt_term (); |
1159 | void destroy (); |
1208 | void destroy (); |
1160 | |
1209 | |
1161 | bool init (int argc, const char *const *argv); |
1210 | bool init (int argc, const char *const *argv); |
1162 | bool init_vars (); |
1211 | bool init_vars (); |
1163 | |
|
|
1164 | unicode_t next_char (); |
|
|
1165 | |
1212 | |
1166 | bool pty_fill (); |
1213 | bool pty_fill (); |
1167 | |
1214 | |
1168 | void *operator new (size_t s); |
1215 | void *operator new (size_t s); |
1169 | void operator delete (void *p, size_t s); |
1216 | void operator delete (void *p, size_t s); |
… | |
… | |
1211 | void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); |
1258 | void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); |
1212 | int scr_scroll_text (int row1, int row2, int count, int spec); |
1259 | int scr_scroll_text (int row1, int row2, int count, int spec); |
1213 | void scr_reset (); |
1260 | void scr_reset (); |
1214 | void scr_reset_realloc (); |
1261 | void scr_reset_realloc (); |
1215 | void scr_release (); |
1262 | void scr_release (); |
1216 | void scr_clear (bool really = true); |
1263 | void scr_clear (bool really = false); |
1217 | void scr_refresh (unsigned char refresh_type); |
1264 | void scr_refresh (unsigned char refresh_type); |
1218 | bool scr_refresh_rend (rend_t mask, rend_t value); |
1265 | bool scr_refresh_rend (rend_t mask, rend_t value); |
1219 | void scr_erase_screen (int mode); |
1266 | void scr_erase_screen (int mode); |
1220 | void scr_touch (bool refresh); |
1267 | void scr_touch (bool refresh); |
1221 | void scr_expose (int x, int y, int width, int height, bool refresh); |
1268 | void scr_expose (int x, int y, int width, int height, bool refresh); |
… | |
… | |
1225 | /* autoconvert */ |
1272 | /* autoconvert */ |
1226 | |
1273 | |
1227 | // command.C |
1274 | // command.C |
1228 | void lookup_key (XKeyEvent &ev); |
1275 | void lookup_key (XKeyEvent &ev); |
1229 | unsigned int cmd_write (const unsigned char *str, unsigned int count); |
1276 | unsigned int cmd_write (const unsigned char *str, unsigned int count); |
|
|
1277 | |
|
|
1278 | unicode_t next_char (); |
1230 | unicode_t cmd_getc (); |
1279 | unicode_t cmd_getc (); |
|
|
1280 | unicode_t next_octet (); |
|
|
1281 | unicode_t cmd_get8 (); |
|
|
1282 | |
1231 | bool cmd_parse (); |
1283 | bool cmd_parse (); |
1232 | void mouse_report (XButtonEvent &ev); |
1284 | void mouse_report (XButtonEvent &ev); |
1233 | void button_press (XButtonEvent &ev); |
1285 | void button_press (XButtonEvent &ev); |
1234 | void button_release (XButtonEvent &ev); |
1286 | void button_release (XButtonEvent &ev); |
1235 | int check_our_parents (); |
1287 | int check_our_parents (); |