… | |
… | |
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 */ |
|
|
284 | #if 0 |
271 | REFRESH_BOUNDS = 1<<3 |
285 | REFRESH_BOUNDS = 1<<3 |
|
|
286 | #endif |
|
|
287 | REFRESH_BOUNDS = 0 /* only required for old int_bwidth code. */ //TODO: remove this and all depending code |
272 | }; |
288 | }; |
273 | |
289 | |
274 | #ifdef NO_SECONDARY_SCREEN |
290 | #ifdef NO_SECONDARY_SCREEN |
275 | # define NSCREENS 0 |
291 | # define NSCREENS 0 |
276 | #else |
292 | #else |
… | |
… | |
530 | Rs_transparent_all, |
546 | Rs_transparent_all, |
531 | #endif |
547 | #endif |
532 | #ifndef NO_FRILLS |
548 | #ifndef NO_FRILLS |
533 | Rs_ext_bwidth, |
549 | Rs_ext_bwidth, |
534 | Rs_int_bwidth, |
550 | Rs_int_bwidth, |
|
|
551 | Rs_borderLess, |
535 | #endif |
552 | #endif |
536 | Rs_scrollBar_thickness, |
553 | Rs_scrollBar_thickness, |
537 | #ifndef NO_LINESPACE |
554 | #ifndef NO_LINESPACE |
538 | Rs_lineSpace, |
555 | Rs_lineSpace, |
539 | #endif |
556 | #endif |
… | |
… | |
547 | Rs_pointerBlankDelay, |
564 | Rs_pointerBlankDelay, |
548 | Rs_imLocale, |
565 | Rs_imLocale, |
549 | #ifndef NO_SECONDARY_SCREEN |
566 | #ifndef NO_SECONDARY_SCREEN |
550 | Rs_secondaryScreen, |
567 | Rs_secondaryScreen, |
551 | Rs_secondaryScroll, |
568 | Rs_secondaryScroll, |
|
|
569 | #endif |
|
|
570 | #ifndef NO_BOLD_UNDERLINE_REVERSE |
|
|
571 | Rs_realBold, |
|
|
572 | #endif |
|
|
573 | #ifdef OFF_FOCUS_FADING |
|
|
574 | Rs_fade, |
|
|
575 | #endif |
|
|
576 | #ifdef TINTING |
|
|
577 | Rs_shade, |
552 | #endif |
578 | #endif |
553 | NUM_RESOURCES |
579 | NUM_RESOURCES |
554 | }; |
580 | }; |
555 | |
581 | |
556 | // see init.C:xa_names, which must be kept in sync |
582 | // 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) |
637 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) |
612 | #else |
638 | #else |
613 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
639 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
614 | #endif |
640 | #endif |
615 | |
641 | |
616 | #define XDEPTH display->depth |
642 | // 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 |
643 | #define IMBUFSIZ 128 // input modifier buffer sizes |
621 | #define KBUFSZ 512 // size of keyboard mapping buffer |
644 | #define KBUFSZ 512 // size of keyboard mapping buffer |
622 | #define CBUFSIZ 4096 // size of command buffer |
645 | #define CBUFSIZ 4096 // size of command buffer |
623 | #define UBUFSIZ 4096 // character buffer |
646 | #define UBUFSIZ 4096 // character buffer |
624 | |
647 | |
625 | #ifndef PATH_MAX |
648 | #ifndef PATH_MAX |
626 | # define PATH_MAX 16384 |
649 | # define PATH_MAX 16384 |
627 | #endif |
650 | #endif |
|
|
651 | |
|
|
652 | /* Motif window hints */ |
|
|
653 | #define MWM_HINTS_FUNCTIONS (1L << 0) |
|
|
654 | #define MWM_HINTS_DECORATIONS (1L << 1) |
|
|
655 | #define MWM_HINTS_INPUT_MODE (1L << 2) |
|
|
656 | #define MWM_HINTS_STATUS (1L << 3) |
|
|
657 | /* bit definitions for MwmHints.functions */ |
|
|
658 | #define MWM_FUNC_ALL (1L << 0) |
|
|
659 | #define MWM_FUNC_RESIZE (1L << 1) |
|
|
660 | #define MWM_FUNC_MOVE (1L << 2) |
|
|
661 | #define MWM_FUNC_MINIMIZE (1L << 3) |
|
|
662 | #define MWM_FUNC_MAXIMIZE (1L << 4) |
|
|
663 | #define MWM_FUNC_CLOSE (1L << 5) |
|
|
664 | /* bit definitions for MwmHints.decorations */ |
|
|
665 | #define MWM_DECOR_ALL (1L << 0) |
|
|
666 | #define MWM_DECOR_BORDER (1L << 1) |
|
|
667 | #define MWM_DECOR_RESIZEH (1L << 2) |
|
|
668 | #define MWM_DECOR_TITLE (1L << 3) |
|
|
669 | #define MWM_DECOR_MENU (1L << 4) |
|
|
670 | #define MWM_DECOR_MINIMIZE (1L << 5) |
|
|
671 | #define MWM_DECOR_MAXIMIZE (1L << 6) |
|
|
672 | /* bit definitions for MwmHints.inputMode */ |
|
|
673 | #define MWM_INPUT_MODELESS 0 |
|
|
674 | #define MWM_INPUT_PRIMARY_APPLICATION_MODAL 1 |
|
|
675 | #define MWM_INPUT_SYSTEM_MODAL 2 |
|
|
676 | #define MWM_INPUT_FULL_APPLICATION_MODAL 3 |
|
|
677 | #define PROP_MWM_HINTS_ELEMENTS 5 |
628 | |
678 | |
629 | /* |
679 | /* |
630 | ***************************************************************************** |
680 | ***************************************************************************** |
631 | * MACRO DEFINES |
681 | * MACRO DEFINES |
632 | ***************************************************************************** |
682 | ***************************************************************************** |
… | |
… | |
646 | #define STRLEN(x) strlen((const char *)(x)) |
696 | #define STRLEN(x) strlen((const char *)(x)) |
647 | #define STRCHR(x, y) strchr((const char *)(x), (int)(y)) |
697 | #define STRCHR(x, y) strchr((const char *)(x), (int)(y)) |
648 | #define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) |
698 | #define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) |
649 | |
699 | |
650 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
700 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
651 | #define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)TermWin.int_bwidth) |
701 | #define Pixel2Col(x) Pixel2Width((int32_t)(x)) |
652 | #define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)TermWin.int_bwidth) |
702 | #define Pixel2Row(y) Pixel2Height((int32_t)(y)) |
653 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)TermWin.fwidth) |
703 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)TermWin.fwidth) |
654 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)TermWin.fheight) |
704 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)TermWin.fheight) |
655 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)TermWin.int_bwidth) |
705 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col)) |
656 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)TermWin.int_bwidth) |
706 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row)) |
657 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fwidth) |
707 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fwidth) |
658 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fheight) |
708 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fheight) |
659 | |
709 | |
660 | #define TermWin_TotalWidth() ((int32_t)TermWin.width + 2 * (int32_t)TermWin.int_bwidth) |
710 | #define TermWin_TotalWidth() ((int32_t)TermWin.width) |
661 | #define TermWin_TotalHeight() ((int32_t)TermWin.height + 2 * (int32_t)TermWin.int_bwidth) |
711 | #define TermWin_TotalHeight() ((int32_t)TermWin.height) |
662 | |
712 | |
663 | /* how to build & extract colors and attributes */ |
713 | /* how to build & extract colors and attributes */ |
664 | #define GET_BASEFG(x) (((x) & RS_fgMask)) |
714 | #define GET_BASEFG(x) (((x) & RS_fgMask)) |
665 | #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) |
715 | #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) |
666 | #ifndef NO_BRIGHTCOLOR |
716 | #ifndef NO_BRIGHTCOLOR |
… | |
… | |
936 | rend_t rstyle; |
986 | rend_t rstyle; |
937 | /* ---------- */ |
987 | /* ---------- */ |
938 | uint32_t pixcolor_set[NPIXCLR_SETS]; |
988 | uint32_t pixcolor_set[NPIXCLR_SETS]; |
939 | /* ---------- */ |
989 | /* ---------- */ |
940 | #ifdef SELECTION_SCROLLING |
990 | #ifdef SELECTION_SCROLLING |
941 | int scroll_selection_delay, |
|
|
942 | scroll_selection_lines; |
991 | int scroll_selection_lines; |
943 | enum page_dirn scroll_selection_dir; |
992 | enum page_dirn scroll_selection_dir; |
944 | int selection_save_x, |
993 | int selection_save_x, |
945 | selection_save_y, |
994 | selection_save_y, |
946 | selection_save_state, |
995 | selection_save_state; |
947 | pending_scroll_selection; |
|
|
948 | #endif |
996 | #endif |
949 | /* ---------- */ |
997 | /* ---------- */ |
950 | int csrO, /* Hops - csr offset in thumb/slider to */ |
998 | int csrO, /* Hops - csr offset in thumb/slider to */ |
951 | /* give proper Scroll behaviour */ |
999 | /* give proper Scroll behaviour */ |
952 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
953 | scroll_arrow_delay, |
|
|
954 | #endif |
|
|
955 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
1000 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
956 | mouse_slip_wheel_delay, |
|
|
957 | mouse_slip_wheel_speed, |
1001 | mouse_slip_wheel_speed, |
958 | #endif |
1002 | #endif |
959 | refresh_count, |
1003 | refresh_count, |
960 | refresh_limit, |
1004 | refresh_limit, |
961 | fnum, /* logical font number */ |
|
|
962 | last_bot, /* scrollbar last bottom position */ |
1005 | last_bot, /* scrollbar last bottom position */ |
963 | last_top, /* scrollbar last top position */ |
1006 | last_top, /* scrollbar last top position */ |
964 | last_state, /* scrollbar last state */ |
1007 | last_state, /* scrollbar last state */ |
965 | scrollbar_len, |
1008 | scrollbar_len, |
966 | #ifdef MENUBAR |
1009 | #ifdef MENUBAR |
… | |
… | |
1126 | #endif |
1169 | #endif |
1127 | #ifdef MENUBAR |
1170 | #ifdef MENUBAR |
1128 | xevent_watcher menubar_ev; |
1171 | xevent_watcher menubar_ev; |
1129 | #endif |
1172 | #endif |
1130 | |
1173 | |
1131 | void check_cb (check_watcher &w); check_watcher check_ev; |
1174 | void check_cb (check_watcher &w); check_watcher check_ev; |
1132 | void destroy_cb (time_watcher &w); time_watcher destroy_ev; |
1175 | void destroy_cb (time_watcher &w); time_watcher destroy_ev; |
|
|
1176 | void flush_cb (time_watcher &w); time_watcher flush_ev; |
1133 | |
1177 | |
1134 | void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; |
1178 | void pty_cb (io_watcher &w, short revents); io_watcher pty_ev; |
1135 | |
1179 | |
1136 | void incr_cb (time_watcher &w); time_watcher incr_ev; |
1180 | void incr_cb (time_watcher &w); time_watcher incr_ev; |
1137 | |
1181 | |
1138 | #ifdef CURSOR_BLINK |
1182 | #ifdef CURSOR_BLINK |
1139 | void cursor_blink_cb (time_watcher &w); time_watcher cursor_blink_ev; |
1183 | void cursor_blink_cb (time_watcher &w); time_watcher cursor_blink_ev; |
1140 | #endif |
1184 | #endif |
1141 | #ifdef TEXT_BLINK |
1185 | #ifdef TEXT_BLINK |
1142 | void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; |
1186 | void text_blink_cb (time_watcher &w); time_watcher text_blink_ev; |
|
|
1187 | #endif |
|
|
1188 | |
|
|
1189 | #ifndef NO_SCROLLBAR_BUTTON_CONTINUAL_SCROLLING |
|
|
1190 | void cont_scroll_cb (time_watcher &w); time_watcher cont_scroll_ev; |
|
|
1191 | #endif |
|
|
1192 | #ifdef SELECTION_SCROLLING |
|
|
1193 | void sel_scroll_cb (time_watcher &w); time_watcher sel_scroll_ev; |
|
|
1194 | #endif |
|
|
1195 | #if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING) |
|
|
1196 | void slip_wheel_cb (time_watcher &w); time_watcher slip_wheel_ev; |
1143 | #endif |
1197 | #endif |
1144 | |
1198 | |
1145 | #ifdef POINTER_BLANK |
1199 | #ifdef POINTER_BLANK |
1146 | void pointer_cb (time_watcher &w); time_watcher pointer_ev; |
1200 | void pointer_cb (time_watcher &w); time_watcher pointer_ev; |
1147 | void pointer_blank (); |
1201 | void pointer_blank (); |
|
|
1202 | #endif |
1148 | void pointer_unblank (); |
1203 | void pointer_unblank (); |
1149 | #endif |
|
|
1150 | |
1204 | |
1151 | void tt_printf (const char *fmt,...); |
1205 | void tt_printf (const char *fmt,...); |
1152 | void tt_write (const unsigned char *data, unsigned int len); |
1206 | void tt_write (const unsigned char *data, unsigned int len); |
1153 | |
1207 | |
1154 | void tt_winch (); |
1208 | void tt_winch (); |
… | |
… | |
1157 | ~rxvt_term (); |
1211 | ~rxvt_term (); |
1158 | void destroy (); |
1212 | void destroy (); |
1159 | |
1213 | |
1160 | bool init (int argc, const char *const *argv); |
1214 | bool init (int argc, const char *const *argv); |
1161 | bool init_vars (); |
1215 | bool init_vars (); |
1162 | |
|
|
1163 | unicode_t next_char (); |
|
|
1164 | |
1216 | |
1165 | bool pty_fill (); |
1217 | bool pty_fill (); |
1166 | |
1218 | |
1167 | void *operator new (size_t s); |
1219 | void *operator new (size_t s); |
1168 | void operator delete (void *p, size_t s); |
1220 | void operator delete (void *p, size_t s); |
… | |
… | |
1224 | /* autoconvert */ |
1276 | /* autoconvert */ |
1225 | |
1277 | |
1226 | // command.C |
1278 | // command.C |
1227 | void lookup_key (XKeyEvent &ev); |
1279 | void lookup_key (XKeyEvent &ev); |
1228 | unsigned int cmd_write (const unsigned char *str, unsigned int count); |
1280 | unsigned int cmd_write (const unsigned char *str, unsigned int count); |
|
|
1281 | |
|
|
1282 | unicode_t next_char (); |
1229 | unicode_t cmd_getc (); |
1283 | unicode_t cmd_getc (); |
|
|
1284 | unicode_t next_octet (); |
|
|
1285 | unicode_t cmd_get8 (); |
|
|
1286 | |
1230 | bool cmd_parse (); |
1287 | bool cmd_parse (); |
1231 | void mouse_report (XButtonEvent &ev); |
1288 | void mouse_report (XButtonEvent &ev); |
1232 | void button_press (XButtonEvent &ev); |
1289 | void button_press (XButtonEvent &ev); |
1233 | void button_release (XButtonEvent &ev); |
1290 | void button_release (XButtonEvent &ev); |
1234 | int check_our_parents (); |
1291 | int check_our_parents (); |