1 | /* |
|
|
2 | * $Id: rxvt.h,v 1.16 2003/12/18 05:45:11 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 | |
… | |
… | |
16 | |
12 | |
17 | #include "defaultfont.h" |
13 | #include "defaultfont.h" |
18 | #include "rxvtcolor.h" |
14 | #include "rxvtcolor.h" |
19 | #include "iom.h" |
15 | #include "iom.h" |
20 | #include "salloc.h" |
16 | #include "salloc.h" |
|
|
17 | |
|
|
18 | #include <wchar.h> |
21 | |
19 | |
22 | /* |
20 | /* |
23 | ***************************************************************************** |
21 | ***************************************************************************** |
24 | * SYSTEM HACKS |
22 | * SYSTEM HACKS |
25 | ***************************************************************************** |
23 | ***************************************************************************** |
… | |
… | |
660 | #define STRLEN(x) strlen((const char *)(x)) |
658 | #define STRLEN(x) strlen((const char *)(x)) |
661 | #define STRCHR(x, y) strchr((const char *)(x), (int)(y)) |
659 | #define STRCHR(x, y) strchr((const char *)(x), (int)(y)) |
662 | #define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) |
660 | #define STRRCHR(x, y) strrchr((const char *)(x), (int)(y)) |
663 | |
661 | |
664 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
662 | /* convert pixel dimensions to row/column values. Everything as int32_t */ |
665 | #define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)R->TermWin.int_bwidth) |
663 | #define Pixel2Col(x) Pixel2Width((int32_t)(x) - (int32_t)TermWin.int_bwidth) |
666 | #define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)R->TermWin.int_bwidth) |
664 | #define Pixel2Row(y) Pixel2Height((int32_t)(y) - (int32_t)TermWin.int_bwidth) |
667 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)R->TermWin.fwidth) |
665 | #define Pixel2Width(x) ((int32_t)(x) / (int32_t)TermWin.fwidth) |
668 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)R->TermWin.fheight) |
666 | #define Pixel2Height(y) ((int32_t)(y) / (int32_t)TermWin.fheight) |
669 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)R->TermWin.int_bwidth) |
667 | #define Col2Pixel(col) ((int32_t)Width2Pixel(col) + (int32_t)TermWin.int_bwidth) |
670 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)R->TermWin.int_bwidth) |
668 | #define Row2Pixel(row) ((int32_t)Height2Pixel(row) + (int32_t)TermWin.int_bwidth) |
671 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)R->TermWin.fwidth) |
669 | #define Width2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fwidth) |
672 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)R->TermWin.fheight) |
670 | #define Height2Pixel(n) ((int32_t)(n) * (int32_t)TermWin.fheight) |
673 | |
671 | |
674 | #define TermWin_TotalWidth() ((int32_t)R->TermWin.width + 2 * (int32_t)R->TermWin.int_bwidth) |
672 | #define TermWin_TotalWidth() ((int32_t)TermWin.width + 2 * (int32_t)TermWin.int_bwidth) |
675 | #define TermWin_TotalHeight() ((int32_t)R->TermWin.height + 2 * (int32_t)R->TermWin.int_bwidth) |
673 | #define TermWin_TotalHeight() ((int32_t)TermWin.height + 2 * (int32_t)TermWin.int_bwidth) |
676 | |
674 | |
677 | #define Xscreen DefaultScreen(R->Xdisplay) |
675 | #define Xscreen DefaultScreen(R->Xdisplay) |
678 | #define Xroot DefaultRootWindow(R->Xdisplay) |
676 | #define Xroot DefaultRootWindow(R->Xdisplay) |
679 | |
677 | |
680 | /* how to build & extract colors and attributes */ |
678 | /* how to build & extract colors and attributes */ |
… | |
… | |
712 | |
710 | |
713 | #define SET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS))) |
711 | #define SET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS))) |
714 | #define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS))) |
712 | #define ISSET_PIXCOLOR(h, x) ((h)->pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS))) |
715 | |
713 | |
716 | #ifdef HAVE_SCROLLBARS |
714 | #ifdef HAVE_SCROLLBARS |
717 | # define scrollbar_TotalWidth() (R->scrollBar.width + R->sb_shadow * 2) |
715 | # define scrollbar_TotalWidth() (scrollBar.width + sb_shadow * 2) |
718 | #else |
716 | #else |
719 | # define scrollbar_TotalWidth() (0) |
717 | # define scrollbar_TotalWidth() (0) |
720 | #endif |
718 | #endif |
721 | #define scrollbar_isMotion() (R->scrollBar.state == 'm') |
719 | #define scrollbar_isMotion() (R->scrollBar.state == 'm') |
722 | #define scrollbar_isUp() (R->scrollBar.state == 'U') |
720 | #define scrollbar_isUp() (R->scrollBar.state == 'U') |
… | |
… | |
743 | #define scrollbar_size() (R->scrollBar.end - R->scrollBar.beg \ |
741 | #define scrollbar_size() (R->scrollBar.end - R->scrollBar.beg \ |
744 | - scrollbar_minheight()) |
742 | - scrollbar_minheight()) |
745 | |
743 | |
746 | #if (MENUBAR_MAX > 1) |
744 | #if (MENUBAR_MAX > 1) |
747 | /* rendition style flags */ |
745 | /* rendition style flags */ |
748 | # define menuBar_height() (R->TermWin.fheight + SHADOW) |
746 | # define menuBar_height() (TermWin.fheight + SHADOW) |
749 | # define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin) |
747 | # define menuBar_TotalHeight() (menuBar_height() + SHADOW + menuBar_margin) |
750 | # define isMenuBarWindow(w) ((w) == R->menuBar.win) |
748 | # define isMenuBarWindow(w) ((w) == R->menuBar.win) |
751 | #else |
749 | #else |
752 | # define menuBar_height() (0) |
750 | # define menuBar_height() (0) |
753 | # define menuBar_TotalHeight() (0) |
751 | # define menuBar_TotalHeight() (0) |
… | |
… | |
831 | #endif |
829 | #endif |
832 | |
830 | |
833 | #define BLINK_INTERVAL 0.5 |
831 | #define BLINK_INTERVAL 0.5 |
834 | |
832 | |
835 | struct mbstate { |
833 | struct mbstate { |
836 | unsigned char orig; |
834 | mbstate_t mbs; |
837 | uint32_t reg; |
|
|
838 | int cnt; |
|
|
839 | |
835 | |
840 | mbstate () |
836 | mbstate () |
841 | { |
837 | { |
842 | cnt = 0; |
838 | MEMSET (&mbs, 0, sizeof (mbs)); |
843 | } |
839 | } |
844 | }; |
840 | }; |
845 | |
841 | |
846 | struct rxvt_term : rxvt_vars { |
842 | struct rxvt_term : rxvt_vars { |
847 | struct mbstate mbstate; |
843 | struct mbstate mbstate; |
… | |
… | |
863 | #endif |
859 | #endif |
864 | #ifdef POINTER_BLANK |
860 | #ifdef POINTER_BLANK |
865 | hidden_pointer:1, |
861 | hidden_pointer:1, |
866 | #endif |
862 | #endif |
867 | parsed_geometry:1, |
863 | parsed_geometry:1, |
868 | seen_input:1; /* wether any input has been seen so far */ |
864 | seen_input:1, /* wether any input has been seen so far */ |
|
|
865 | enc_utf8:1; /* wether terminal reads/writes utf-8 */ |
869 | |
866 | |
870 | unsigned char refresh_type, |
867 | unsigned char refresh_type, |
871 | #ifdef UTMP_SUPPORT |
868 | #ifdef UTMP_SUPPORT |
872 | next_utmp_action, |
869 | next_utmp_action, |
873 | #endif |
870 | #endif |
… | |
… | |
884 | #ifdef GREEK_SUPPORT |
881 | #ifdef GREEK_SUPPORT |
885 | short greek_mode; /* greek keyboard mode */ |
882 | short greek_mode; /* greek keyboard mode */ |
886 | #endif |
883 | #endif |
887 | short rvideo; |
884 | short rvideo; |
888 | int16_t num_scr; /* screen: number lines scrolled */ |
885 | int16_t num_scr; /* screen: number lines scrolled */ |
889 | uint16_t prev_ncol, /* screen: previous number of columns */ |
886 | unsigned int prev_ncol, /* screen: previous number of columns */ |
890 | prev_nrow; /* screen: previous number of rows */ |
887 | prev_nrow; /* screen: previous number of rows */ |
891 | #ifdef RXVT_GRAPHICS |
888 | #ifdef RXVT_GRAPHICS |
892 | uint16_t gr_prev_start; |
889 | uint16_t gr_prev_start; |
893 | #endif |
890 | #endif |
894 | /* ---------- */ |
891 | /* ---------- */ |
895 | rend_t rstyle; |
892 | rend_t rstyle; |
896 | /* ---------- */ |
893 | /* ---------- */ |
897 | uint32_t pixcolor_set[NPIXCLR_SETS]; |
894 | uint32_t pixcolor_set[NPIXCLR_SETS]; |
898 | /* ---------- */ |
895 | /* ---------- */ |
899 | #ifdef SELECTION_SCROLLING |
896 | #ifdef SELECTION_SCROLLING |
900 | int scroll_selection_delay, |
897 | int scroll_selection_delay, |
901 | scroll_selection_lines; |
898 | scroll_selection_lines; |
902 | enum page_dirn scroll_selection_dir; |
899 | enum page_dirn scroll_selection_dir; |
… | |
… | |
1078 | #endif |
1075 | #endif |
1079 | const char *rs[NUM_RESOURCES]; |
1076 | const char *rs[NUM_RESOURCES]; |
1080 | /* command input buffering */ |
1077 | /* command input buffering */ |
1081 | unsigned char *cmdbuf_ptr, *cmdbuf_endp; |
1078 | unsigned char *cmdbuf_ptr, *cmdbuf_endp; |
1082 | unsigned char cmdbuf_base[BUFSIZ]; |
1079 | unsigned char cmdbuf_base[BUFSIZ]; |
1083 | unsigned char kbuf[KBUFSZ]; |
|
|
1084 | |
1080 | |
1085 | rxvt_salloc *ralloc; |
1081 | rxvt_salloc *ralloc; |
1086 | rxvt_salloc *talloc; |
1082 | rxvt_salloc *talloc; |
1087 | |
1083 | |
1088 | void paste (const unsigned char *data, unsigned int len); |
1084 | void paste (const unsigned char *data, unsigned int len); |
… | |
… | |
1128 | void operator delete (void *p, size_t s); |
1124 | void operator delete (void *p, size_t s); |
1129 | |
1125 | |
1130 | void init_secondary (); |
1126 | void init_secondary (); |
1131 | const char **init_resources (int argc, const char *const *argv); |
1127 | const char **init_resources (int argc, const char *const *argv); |
1132 | void init_env (); |
1128 | void init_env (); |
|
|
1129 | void set_locale (const char *locale); |
1133 | void init_xlocale (); |
1130 | void init_xlocale (); |
1134 | void init_command (const char *const *argv); |
1131 | void init_command (const char *const *argv); |
1135 | int run_command (const char *const *argv); |
1132 | int run_command (const char *const *argv); |
1136 | int run_child (const char *const *argv); |
1133 | int run_child (const char *const *argv); |
1137 | |
1134 | |
1138 | void color_aliases(int idx); |
1135 | void color_aliases(int idx); |
1139 | void recolour_cursor (); |
1136 | void recolour_cursor (); |
|
|
1137 | void create_windows (int argc, const char *const *argv); |
|
|
1138 | void resize_all_windows (unsigned int width, unsigned int height, int ignoreparent); |
|
|
1139 | void window_calc (unsigned int width, unsigned int height); |
|
|
1140 | void set_preedit_area (XRectangle * preedit_rect, XRectangle * status_rect, XRectangle * needed_rect); |
|
|
1141 | |
|
|
1142 | #if USE_XIM |
|
|
1143 | void set_size (XRectangle *size); |
|
|
1144 | void set_position (XPoint *pos); |
|
|
1145 | void set_color (unsigned long *fg, unsigned long *bg); |
|
|
1146 | #endif |
|
|
1147 | |
|
|
1148 | void resize_scrollbar (); |
|
|
1149 | |
|
|
1150 | void pixel_position (int *x, int *y); |
|
|
1151 | |
|
|
1152 | void selection_click (int clicks, int x, int y); |
|
|
1153 | void selection_extend (int x, int y, int flag); |
|
|
1154 | void selection_rotate (int x, int y); |
1140 | |
1155 | |
1141 | /* screen(!) */ |
1156 | /* screen(!) */ |
1142 | void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs); |
1157 | void scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs); |
1143 | void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); |
1158 | void scr_blank_screen_mem (text_t **tp, rend_t **rp, unsigned int row, rend_t efs); |
1144 | int scr_scroll_text (int row1, int row2, int count, int spec); |
1159 | int scr_scroll_text (int row1, int row2, int count, int spec); |
1145 | void scr_reset (); |
1160 | void scr_reset (); |
1146 | void scr_reset_realloc (); |
1161 | void scr_reset_realloc (); |
1147 | void scr_release (); |
1162 | void scr_release (); |
|
|
1163 | void scr_clear (); |
|
|
1164 | void scr_refresh (unsigned char refresh_type); |
|
|
1165 | void scr_erase_screen (int mode); |
|
|
1166 | void scr_touch (bool refresh); |
|
|
1167 | void scr_expose (int x, int y, int width, int height, bool refresh); |
1148 | }; |
1168 | }; |
1149 | |
1169 | |
1150 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
1170 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
1151 | extern void rxvt_set_locale (const char *locale); |
1171 | extern void rxvt_set_locale (const char *locale); |
1152 | |
1172 | |