1 | /* |
|
|
2 | * $Id: rxvt.h,v 1.17 2003/12/18 07:31:19 pcg Exp $ |
|
|
3 | */ |
|
|
4 | |
|
|
5 | #ifndef _RXVT_H_ /* include once only */ |
1 | #ifndef RXVT_H_ /* include once only */ |
6 | #define _RXVT_H_ |
2 | #define RXVT_H_ |
7 | |
3 | |
8 | #include "rxvtlib.h" |
4 | #include "rxvtlib.h" |
9 | |
5 | |
10 | #include "feature.h" |
6 | #include "feature.h" |
11 | |
7 | |
… | |
… | |
318 | enum { |
314 | enum { |
319 | PRIMARY = 0, |
315 | PRIMARY = 0, |
320 | SECONDARY |
316 | SECONDARY |
321 | }; |
317 | }; |
322 | |
318 | |
323 | enum { |
|
|
324 | SBYTE = 0, |
|
|
325 | WBYTE |
|
|
326 | }; |
|
|
327 | |
|
|
328 | |
|
|
329 | #define RS_None 0 /* Normal */ |
319 | #define RS_None 0 /* Normal */ |
330 | |
320 | |
331 | #define RS_fgMask 0x000001FFu /* 512 colors */ |
321 | #define RS_fgMask 0x000001FFu /* 512 colors */ |
332 | #define RS_bgMask 0x0003FE00u /* 512 colors */ |
322 | #define RS_bgMask 0x0003FE00u /* 512 colors */ |
333 | #define RS_Bold 0x00040000u /* bold */ |
323 | #define RS_Bold 0x00040000u /* bold */ |
334 | #define RS_Blink 0x00080000u /* blink */ |
324 | #define RS_Blink 0x00080000u /* blink */ |
335 | #define RS_RVid 0x00100000u /* reverse video */ |
325 | #define RS_RVid 0x00100000u /* reverse video */ |
336 | #define RS_Uline 0x00200000u /* underline */ |
326 | #define RS_Uline 0x00200000u /* underline */ |
337 | |
327 | |
338 | #define RS_wide 0x00400000u /* only multibyte characters */ |
|
|
339 | #define IS_WIDE(r) ((r) & RS_wide) |
|
|
340 | |
|
|
341 | #define RS_fontMask 0xff000000u /* plenty(?) of fonts */ |
328 | #define RS_fontMask 0xffc00000u /* plenty(?) of fonts */ |
342 | #define RS_fontShift 24 |
329 | #define RS_fontShift 22 |
343 | |
330 | |
344 | #define RS_baseattrMask (RS_Bold|RS_Blink|RS_RVid|RS_Uline) |
331 | #define RS_baseattrMask (RS_Bold|RS_Blink|RS_RVid|RS_Uline) |
345 | #define RS_attrMask (RS_baseattrMask|RS_fontMask|RS_wide) |
332 | #define RS_attrMask (RS_baseattrMask|RS_fontMask) |
346 | |
333 | |
347 | #define Sel_none 0 /* Not waiting */ |
334 | #define Sel_none 0 /* Not waiting */ |
348 | #define Sel_normal 0x01 /* normal selection */ |
335 | #define Sel_normal 0x01 /* normal selection */ |
349 | #define Sel_incr 0x02 /* incremental selection */ |
336 | #define Sel_incr 0x02 /* incremental selection */ |
350 | #define Sel_direct 0x00 |
337 | #define Sel_direct 0x00 |
… | |
… | |
455 | TOTAL_COLORS = NRS_COLORS /* */ |
442 | TOTAL_COLORS = NRS_COLORS /* */ |
456 | #endif |
443 | #endif |
457 | }; |
444 | }; |
458 | |
445 | |
459 | #define Color_Bits 9 |
446 | #define Color_Bits 9 |
460 | #define NPIXCLR_SETS 9 /* (256 + 14) bits / 32 bits */ |
447 | #define NPIXCLR_SETS ((TOTAL_COLORS + 31) / 32) |
461 | #define NPIXCLR_BITS 32 |
448 | #define NPIXCLR_BITS 32 |
462 | |
449 | |
463 | #define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<<Color_Bits)) |
450 | #define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<<Color_Bits)) |
464 | |
451 | |
465 | /* |
452 | /* |
466 | * Resource list |
453 | * Resource list |
467 | */ |
454 | */ |
468 | enum { |
455 | enum { |
… | |
… | |
621 | #else |
608 | #else |
622 | # define PrivMode_Default \ |
609 | # define PrivMode_Default \ |
623 | (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
610 | (PrivMode_Autowrap|PrivMode_aplKP|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
624 | #endif |
611 | #endif |
625 | |
612 | |
626 | #ifdef PREFER_24BIT |
|
|
627 | # define XDEPTH R->Xdepth |
613 | #define XDEPTH R->Xdepth |
628 | # define XCMAP R->Xcmap |
614 | #define XCMAP R->Xcmap |
629 | # define XVISUAL R->Xvisual |
615 | #define XVISUAL R->Xvisual |
630 | #else |
616 | |
631 | # ifdef DEBUG_DEPTH |
|
|
632 | # define XDEPTH DEBUG_DEPTH |
|
|
633 | # else |
|
|
634 | # define XDEPTH DefaultDepth(R->Xdisplay,Xscreen) |
|
|
635 | # define XCMAP DefaultColormap(R->Xdisplay,Xscreen) |
|
|
636 | # define XVISUAL DefaultVisual(R->Xdisplay,Xscreen) |
|
|
637 | # endif |
|
|
638 | #endif |
|
|
639 | #define IMBUFSIZ 128 /* input modifier buffer sizes */ |
617 | #define IMBUFSIZ 128 /* input modifier buffer sizes */ |
640 | #ifndef BUFSIZ |
618 | #ifndef BUFSIZ |
641 | # define BUFSIZ 4096 |
619 | # define BUFSIZ 4096 |
642 | #endif |
620 | #endif |
643 | #define KBUFSZ 512 /* size of keyboard mapping buffer */ |
621 | #define KBUFSZ 512 /* size of keyboard mapping buffer */ |
644 | |
622 | |
645 | /* |
623 | /* |
646 | ***************************************************************************** |
624 | ***************************************************************************** |
647 | * MACRO DEFINES |
625 | * MACRO DEFINES |
648 | ***************************************************************************** |
626 | ***************************************************************************** |
… | |
… | |
662 | #define STRLEN(x) strlen((const char *)(x)) |
640 | #define STRLEN(x) strlen((const char *)(x)) |
663 | #define STRCHR(x, y) strchr((const char *)(x), (int)(y)) |
641 | #define STRCHR(x, y) strchr((const char *)(x), (int)(y)) |
664 | #define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) |
642 | #define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) |
665 | |
643 | |
666 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
644 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
667 | #define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)R->TermWin.int_bwidth) |
645 | #define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)TermWin.int_bwidth) |
668 | #define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)R->TermWin.int_bwidth) |
646 | #define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)TermWin.int_bwidth) |
669 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)R->TermWin.fwidth) |
647 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)TermWin.fwidth) |
670 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)R->TermWin.fheight) |
648 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)TermWin.fheight) |
671 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)R->TermWin.int_bwidth) |
649 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)TermWin.int_bwidth) |
672 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)R->TermWin.int_bwidth) |
650 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)TermWin.int_bwidth) |
673 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)R->TermWin.fwidth) |
651 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fwidth) |
674 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)R->TermWin.fheight) |
652 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fheight) |
675 | |
653 | |
676 | #define TermWin_TotalWidth() ((int32_t)R->TermWin.width + 2 * (int32_t)R->TermWin.int_bwidth) |
654 | #define TermWin_TotalWidth() ((int32_t)TermWin.width + 2 * (int32_t)TermWin.int_bwidth) |
677 | #define TermWin_TotalHeight() ((int32_t)R->TermWin.height + 2 * (int32_t)R->TermWin.int_bwidth) |
655 | #define TermWin_TotalHeight() ((int32_t)TermWin.height + 2 * (int32_t)TermWin.int_bwidth) |
678 | |
656 | |
679 | #define Xscreen DefaultScreen(R->Xdisplay) |
|
|
680 | #define Xroot DefaultRootWindow(R->Xdisplay) |
657 | #define Xroot DefaultRootWindow(R->Xdisplay) |
681 | |
658 | |
682 | /* how to build & extract colors and attributes */ |
659 | /* how to build & extract colors and attributes */ |
683 | #define GET_BASEFG(x) (((x) & RS_fgMask)) |
660 | #define GET_BASEFG(x) (((x) & RS_fgMask)) |
684 | #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) |
661 | #define GET_BASEBG(x) (((x) & RS_bgMask)>>Color_Bits) |
… | |
… | |
711 | #define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | (fg)) |
688 | #define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | (fg)) |
712 | #define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg)<<Color_Bits)) |
689 | #define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg)<<Color_Bits)) |
713 | #define SET_ATTR(x,a) (((x) & ~RS_attrMask)| (a)) |
690 | #define SET_ATTR(x,a) (((x) & ~RS_attrMask)| (a)) |
714 | |
691 | |
715 | #define SET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS))) |
692 | #define SET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS))) |
716 | #define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS))) |
693 | #define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS))) |
717 | |
694 | |
718 | #ifdef HAVE_SCROLLBARS |
695 | #ifdef HAVE_SCROLLBARS |
719 | # define scrollbar_TotalWidth() (R->scrollBar.width + R->sb_shadow * 2) |
696 | # define scrollbar_TotalWidth() (scrollBar.width + sb_shadow * 2) |
720 | #else |
697 | #else |
721 | # define scrollbar_TotalWidth() (0) |
698 | # define scrollbar_TotalWidth() (0) |
722 | #endif |
699 | #endif |
723 | #define scrollbar_isMotion() (R->scrollBar.state == 'm') |
700 | #define scrollbar_isMotion() (R->scrollBar.state == 'm') |
724 | #define scrollbar_isUp() (R->scrollBar.state == 'U') |
701 | #define scrollbar_isUp() (R->scrollBar.state == 'U') |
… | |
… | |
745 | #define scrollbar_size() (R->scrollBar.end - R->scrollBar.beg \ |
722 | #define scrollbar_size() (R->scrollBar.end - R->scrollBar.beg \ |
746 | - scrollbar_minheight()) |
723 | - scrollbar_minheight()) |
747 | |
724 | |
748 | #if (MENUBAR_MAX > 1) |
725 | #if (MENUBAR_MAX > 1) |
749 | /* rendition style flags */ |
726 | /* rendition style flags */ |
750 | # define menuBar_height() (R->TermWin.fheight + SHADOW) |
727 | # define menuBar_height() (TermWin.fheight + SHADOW) |
751 | # define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin) |
728 | # define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin) |
752 | # define isMenuBarWindow(w) ((w) == R->menuBar.win) |
729 | # define isMenuBarWindow(w) ((w) == R->menuBar.win) |
753 | #else |
730 | #else |
754 | # define menuBar_height() (0) |
731 | # define menuBar_height() (0) |
755 | # define menuBar_TotalHeight() (0) |
732 | # define menuBar_TotalHeight() (0) |
… | |
… | |
885 | #ifdef GREEK_SUPPORT |
862 | #ifdef GREEK_SUPPORT |
886 | short greek_mode; /* greek keyboard mode */ |
863 | short greek_mode; /* greek keyboard mode */ |
887 | #endif |
864 | #endif |
888 | short rvideo; |
865 | short rvideo; |
889 | int16_t num_scr; /* screen: number lines scrolled */ |
866 | int16_t num_scr; /* screen: number lines scrolled */ |
890 | uint16_t prev_ncol, /* screen: previous number of columns */ |
867 | unsigned int prev_ncol, /* screen: previous number of columns */ |
891 | prev_nrow; /* screen: previous number of rows */ |
868 | prev_nrow; /* screen: previous number of rows */ |
892 | #ifdef RXVT_GRAPHICS |
869 | #ifdef RXVT_GRAPHICS |
893 | uint16_t gr_prev_start; |
870 | uint16_t gr_prev_start; |
894 | #endif |
871 | #endif |
895 | /* ---------- */ |
872 | /* ---------- */ |
… | |
… | |
948 | #endif |
925 | #endif |
949 | ttymode; |
926 | ttymode; |
950 | unsigned long PrivateModes, |
927 | unsigned long PrivateModes, |
951 | SavedModes; |
928 | SavedModes; |
952 | /* ---------- */ |
929 | /* ---------- */ |
953 | #ifdef PREFER_24BIT |
|
|
954 | Visual *Xvisual; |
|
|
955 | #endif |
|
|
956 | /* ---------- */ |
|
|
957 | Atom xa[NUM_XA]; |
930 | Atom xa[NUM_XA]; |
958 | /* ---------- */ |
931 | /* ---------- */ |
959 | #ifdef MENUBAR |
932 | #ifdef MENUBAR |
960 | GC menubarGC; |
933 | GC menubarGC; |
961 | #endif |
934 | #endif |
… | |
… | |
1079 | #endif |
1052 | #endif |
1080 | const char *rs[NUM_RESOURCES]; |
1053 | const char *rs[NUM_RESOURCES]; |
1081 | /* command input buffering */ |
1054 | /* command input buffering */ |
1082 | unsigned char *cmdbuf_ptr, *cmdbuf_endp; |
1055 | unsigned char *cmdbuf_ptr, *cmdbuf_endp; |
1083 | unsigned char cmdbuf_base[BUFSIZ]; |
1056 | unsigned char cmdbuf_base[BUFSIZ]; |
1084 | unsigned char kbuf[KBUFSZ]; |
|
|
1085 | |
1057 | |
1086 | rxvt_salloc *ralloc; |
1058 | rxvt_salloc *ralloc; |
1087 | rxvt_salloc *talloc; |
1059 | rxvt_salloc *talloc; |
1088 | |
1060 | |
1089 | void paste (const unsigned char *data, unsigned int len); |
1061 | void paste (const unsigned char *data, unsigned int len); |
… | |
… | |
1137 | int run_command (const char *const *argv); |
1109 | int run_command (const char *const *argv); |
1138 | int run_child (const char *const *argv); |
1110 | int run_child (const char *const *argv); |
1139 | |
1111 | |
1140 | void color_aliases(int idx); |
1112 | void color_aliases(int idx); |
1141 | void recolour_cursor (); |
1113 | void recolour_cursor (); |
|
|
1114 | void create_windows (int argc, const char *const *argv); |
|
|
1115 | void resize_all_windows (unsigned int width, unsigned int height, int ignoreparent); |
|
|
1116 | void window_calc (unsigned int width, unsigned int height); |
|
|
1117 | void set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, XRectangle * needed_rect); |
|
|
1118 | |
|
|
1119 | #if USE_XIM |
|
|
1120 | void set_size (XRectangle *size); |
|
|
1121 | void set_position (XPoint *pos); |
|
|
1122 | void set_color (unsigned long *fg, unsigned long *bg); |
|
|
1123 | #endif |
|
|
1124 | |
|
|
1125 | void resize_scrollbar (); |
|
|
1126 | |
|
|
1127 | void pixel_position (int *x, int *y); |
|
|
1128 | |
|
|
1129 | void selection_click (int clicks, int x, int y); |
|
|
1130 | void selection_extend (int x, int y, int flag); |
|
|
1131 | void selection_rotate (int x, int y); |
1142 | |
1132 | |
1143 | /* screen(!) */ |
1133 | /* screen(!) */ |
1144 | void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs); |
1134 | void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs); |
1145 | void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); |
1135 | void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); |
1146 | int scr_scroll_text (int row1, int row2, int count, int spec); |
1136 | int scr_scroll_text (int row1, int row2, int count, int spec); |
1147 | void scr_reset (); |
1137 | void scr_reset (); |
1148 | void scr_reset_realloc (); |
1138 | void scr_reset_realloc (); |
1149 | void scr_release (); |
1139 | void scr_release (); |
|
|
1140 | void scr_clear (); |
|
|
1141 | void scr_refresh (unsigned char refresh_type); |
|
|
1142 | void scr_erase_screen (int mode); |
|
|
1143 | void scr_touch (bool refresh); |
|
|
1144 | void scr_expose (int x, int y, int width, int height, bool refresh); |
1150 | }; |
1145 | }; |
1151 | |
1146 | |
1152 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
1147 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
1153 | extern void rxvt_set_locale (const char *locale); |
1148 | extern void rxvt_set_locale (const char *locale); |
1154 | |
1149 | |