… | |
… | |
77 | |
77 | |
78 | #ifdef HAVE_AFTERIMAGE |
78 | #ifdef HAVE_AFTERIMAGE |
79 | # include <afterimage.h> |
79 | # include <afterimage.h> |
80 | #undef min |
80 | #undef min |
81 | #undef max |
81 | #undef max |
82 | #elif defined(XPM_BACKGROUND) |
|
|
83 | # ifdef XPM_INC_X11 |
|
|
84 | # include <X11/xpm.h> |
|
|
85 | # else |
|
|
86 | # include <xpm.h> |
|
|
87 | # endif |
|
|
88 | #endif |
82 | #endif |
89 | |
83 | |
90 | #ifndef STDIN_FILENO |
84 | #ifndef STDIN_FILENO |
91 | # define STDIN_FILENO 0 |
85 | # define STDIN_FILENO 0 |
92 | # define STDOUT_FILENO 1 |
86 | # define STDOUT_FILENO 1 |
… | |
… | |
105 | ***************************************************************************** |
99 | ***************************************************************************** |
106 | * PROTOTYPES |
100 | * PROTOTYPES |
107 | ***************************************************************************** |
101 | ***************************************************************************** |
108 | */ |
102 | */ |
109 | // main.C |
103 | // main.C |
110 | RETSIGTYPE rxvt_Child_signal (int sig) NOTHROW; |
|
|
111 | RETSIGTYPE rxvt_Exit_signal (int sig) NOTHROW; |
|
|
112 | void rxvt_clean_exit () NOTHROW; |
|
|
113 | void * rxvt_malloc (size_t size); |
104 | void * rxvt_malloc (size_t size); |
114 | void * rxvt_calloc (size_t number, size_t size); |
105 | void * rxvt_calloc (size_t number, size_t size); |
115 | void * rxvt_realloc (void *ptr, size_t size); |
106 | void * rxvt_realloc (void *ptr, size_t size); |
116 | |
107 | |
117 | // misc.C |
108 | // misc.C |
118 | char * rxvt_wcstombs (const wchar_t *str, int len = -1); |
109 | char * rxvt_wcstombs (const wchar_t *str, int len = -1); |
119 | wchar_t * rxvt_mbstowcs (const char *str, int len = -1); |
110 | wchar_t * rxvt_mbstowcs (const char *str, int len = -1); |
120 | char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); |
111 | char * rxvt_wcstoutf8 (const wchar_t *str, int len = -1); |
121 | wchar_t * rxvt_utf8towcs (const char *str, int len = -1); |
112 | wchar_t * rxvt_utf8towcs (const char *str, int len = -1); |
122 | char * rxvt_strdup_cpp (const char *str); |
|
|
123 | |
113 | |
124 | #define rxvt_strdup(s) ((s) ? strdup(s) : 0) |
114 | #define rxvt_strdup(s) ((s) ? strdup(s) : 0) |
125 | |
115 | |
126 | char * rxvt_r_basename (const char *str) NOTHROW; |
116 | char * rxvt_r_basename (const char *str) NOTHROW; |
127 | void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; |
117 | void rxvt_vlog (const char *fmt, va_list arg_ptr) NOTHROW; |
… | |
… | |
129 | void rxvt_warn (const char *fmt,...) NOTHROW; |
119 | void rxvt_warn (const char *fmt,...) NOTHROW; |
130 | void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) NORETURN; |
120 | void rxvt_fatal (const char *fmt, ...) THROW ((class rxvt_failure_exception)) NORETURN; |
131 | void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) NORETURN; |
121 | void rxvt_exit_failure () THROW ((class rxvt_failure_exception)) NORETURN; |
132 | |
122 | |
133 | int rxvt_Str_match (const char *s1, const char *s2) NOTHROW; |
123 | int rxvt_Str_match (const char *s1, const char *s2) NOTHROW; |
134 | const char * rxvt_Str_skip_space (const char *str) NOTHROW; |
|
|
135 | char * rxvt_Str_trim (char *str) NOTHROW; |
124 | char * rxvt_Str_trim (char *str) NOTHROW; |
136 | int rxvt_Str_escaped (char *str) NOTHROW; |
125 | int rxvt_Str_escaped (char *str) NOTHROW; |
137 | char ** rxvt_splitcommastring (const char *cs) NOTHROW; |
126 | char ** rxvt_splitcommastring (const char *cs) NOTHROW; |
138 | void rxvt_freecommastring (char **cs) NOTHROW; |
127 | void rxvt_freecommastring (char **cs) NOTHROW; |
139 | |
128 | |
… | |
… | |
141 | |
130 | |
142 | // temporarily replace the process environment |
131 | // temporarily replace the process environment |
143 | extern char **environ; |
132 | extern char **environ; |
144 | extern char **rxvt_environ; // the original environ pointer |
133 | extern char **rxvt_environ; // the original environ pointer |
145 | |
134 | |
146 | inline void set_environ (stringvec *envv) |
135 | static inline void set_environ (stringvec *envv) |
147 | { |
136 | { |
148 | #if ENABLE_PERL |
137 | #if ENABLE_PERL |
149 | assert (envv); |
138 | assert (envv); |
150 | #else |
139 | #else |
151 | if (envv) |
140 | if (envv) |
152 | #endif |
141 | #endif |
153 | environ = (char **)envv->begin (); |
142 | environ = (char **)envv->begin (); |
154 | } |
143 | } |
155 | |
144 | |
156 | inline void set_environ (char **envv) |
145 | static inline void set_environ (char **envv) |
157 | { |
146 | { |
158 | #if ENABLE_PERL |
147 | #if ENABLE_PERL |
159 | assert (envv); |
148 | assert (envv); |
160 | #else |
149 | #else |
161 | if (envv) |
150 | if (envv) |
… | |
… | |
177 | # define KEEP_SCROLLCOLOR 1 |
166 | # define KEEP_SCROLLCOLOR 1 |
178 | #else |
167 | #else |
179 | # undef KEEP_SCROLLCOLOR |
168 | # undef KEEP_SCROLLCOLOR |
180 | #endif |
169 | #endif |
181 | |
170 | |
|
|
171 | #if defined(XPM_BACKGROUND) || defined(ENABLE_TRANSPARENCY) |
|
|
172 | # define HAVE_BG_PIXMAP 1/* to simplify further usage */ |
|
|
173 | struct bgPixmap_t { |
|
|
174 | |
|
|
175 | enum { |
|
|
176 | geometrySet = (1UL<<0), |
|
|
177 | propScale = (1UL<<1), |
|
|
178 | geometryFlags = (geometrySet|propScale), |
|
|
179 | |
|
|
180 | tintSet = (1UL<<8), |
|
|
181 | tintNeeded = (1UL<<9), |
|
|
182 | tintWholesome = (1UL<<10), |
|
|
183 | tintServerSide = (1UL<<11), |
|
|
184 | tintFlags = (tintSet|tintServerSide|tintNeeded|tintWholesome), |
|
|
185 | blurNeeded = (1UL<<12), |
|
|
186 | |
|
|
187 | isTransparent = (1UL<<16), |
|
|
188 | isInvalid = (1UL<<17) |
|
|
189 | }; |
|
|
190 | |
|
|
191 | unsigned long flags; |
|
|
192 | |
|
|
193 | enum { |
|
|
194 | transpPmapTiled = (1UL<<0), |
|
|
195 | transpPmapTinted = tintNeeded, |
|
|
196 | transpPmapBlured = blurNeeded, |
|
|
197 | transpTransformations = (tintNeeded|blurNeeded) |
|
|
198 | }; /* this flags are returned by make_transparency_pixmap if called */ |
|
|
199 | |
182 | #ifdef XPM_BACKGROUND |
200 | # ifdef XPM_BACKGROUND |
183 | typedef struct { |
201 | # ifdef HAVE_AFTERIMAGE |
184 | short w, h, x, y; |
202 | ASImage *original_asim; |
185 | bool auto_resize ; |
203 | bool render_asim (ASImage *background, ARGB32 background_tint); |
|
|
204 | # endif |
|
|
205 | |
|
|
206 | enum { defaultScale = 100, defaultAlign = 50 }; |
|
|
207 | |
|
|
208 | unsigned int h_scale, v_scale;/* percents of the window size */ |
|
|
209 | int h_align, v_align; /* percents of the window size: |
|
|
210 | 0 - left align, 50 - center, 100 - right */ |
|
|
211 | void unset_geometry () { flags = flags & ~geometryFlags; }; |
|
|
212 | bool set_geometry (const char *geom); |
|
|
213 | void set_defaultGeometry () |
|
|
214 | { |
|
|
215 | h_scale = v_scale = defaultScale; |
|
|
216 | h_align = v_align = defaultAlign; |
|
|
217 | flags |= geometrySet; |
|
|
218 | }; |
|
|
219 | |
|
|
220 | bool set_file (const char *file); |
|
|
221 | # endif /* XPM_BACKGROUND */ |
|
|
222 | |
|
|
223 | rxvt_term *target; |
|
|
224 | bool set_target (rxvt_term *new_target); |
|
|
225 | |
|
|
226 | # ifdef ENABLE_TRANSPARENCY |
|
|
227 | int root_depth; /* obtained when target is set */ |
|
|
228 | Pixmap root_pixmap; /* current root pixmap set */ |
|
|
229 | rxvt_color tint; |
|
|
230 | int shade; |
|
|
231 | int h_blurRadius, v_blurRadius; |
|
|
232 | |
|
|
233 | bool set_transparent (); |
|
|
234 | bool set_blur_radius (const char *geom); |
|
|
235 | bool set_tint (rxvt_color &new_tint); |
|
|
236 | bool unset_tint (); |
|
|
237 | bool set_shade (const char *shade_str); |
|
|
238 | bool set_root_pixmap (); |
|
|
239 | |
|
|
240 | unsigned long make_transparency_pixmap ();/* returns combination of the transpTransformations flags */ |
|
|
241 | # endif |
|
|
242 | double invalid_since; |
|
|
243 | |
186 | Pixmap pixmap; |
244 | Pixmap pixmap; |
187 | } bgPixmap_t; |
245 | unsigned int pmap_width, pmap_height; |
|
|
246 | unsigned int pmap_depth; |
|
|
247 | |
|
|
248 | bool window_size_sensitive (); |
|
|
249 | bool need_client_side_rendering (); |
|
|
250 | void apply (); |
|
|
251 | bool render (); |
|
|
252 | void invalidate () { |
|
|
253 | if (!(flags & isInvalid)) |
|
|
254 | { |
|
|
255 | flags |= isInvalid; |
|
|
256 | invalid_since = NOW; |
|
|
257 | } |
|
|
258 | }; |
|
|
259 | }; |
|
|
260 | #else |
|
|
261 | # undef HAVE_BG_PIXMAP |
188 | #endif |
262 | #endif |
189 | |
263 | |
190 | /* |
264 | /* |
191 | * the 'essential' information for reporting Mouse Events |
265 | * the 'essential' information for reporting Mouse Events |
192 | * pared down from XButtonEvent |
266 | * pared down from XButtonEvent |
… | |
… | |
566 | #endif |
640 | #endif |
567 | #ifdef KEEP_SCROLLCOLOR |
641 | #ifdef KEEP_SCROLLCOLOR |
568 | Color_scroll, |
642 | Color_scroll, |
569 | Color_trough, |
643 | Color_trough, |
570 | #endif |
644 | #endif |
571 | #if TINTING |
645 | #if ENABLE_TRANSPARENCY |
572 | Color_tint, |
646 | Color_tint, |
573 | #endif |
647 | #endif |
574 | #if OFF_FOCUS_FADING |
648 | #if OFF_FOCUS_FADING |
575 | Color_fade, |
649 | Color_fade, |
576 | #endif |
650 | #endif |
… | |
… | |
621 | #define PrivMode_LFNL (1UL<<19) |
695 | #define PrivMode_LFNL (1UL<<19) |
622 | /* too annoying to implement X11 highlight tracking */ |
696 | /* too annoying to implement X11 highlight tracking */ |
623 | /* #define PrivMode_MouseX11Track (1LU<<20) */ |
697 | /* #define PrivMode_MouseX11Track (1LU<<20) */ |
624 | |
698 | |
625 | #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11) |
699 | #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11) |
626 | #define PrivMode(test,bit) \ |
|
|
627 | if (test) \ |
|
|
628 | priv_modes |= (bit); \ |
|
|
629 | else \ |
|
|
630 | priv_modes &= ~(bit) |
|
|
631 | |
700 | |
632 | #ifdef ALLOW_132_MODE |
701 | #ifdef ALLOW_132_MODE |
633 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) |
702 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) |
634 | #else |
703 | #else |
635 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
704 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
… | |
… | |
757 | #define scrollbar_below_slider(y) ((y) > scrollBar.bot) |
826 | #define scrollbar_below_slider(y) ((y) > scrollBar.bot) |
758 | #define scrollbar_position(y) ((y) - scrollBar.beg) |
827 | #define scrollbar_position(y) ((y) - scrollBar.beg) |
759 | #define scrollbar_size() (scrollBar.end - scrollBar.beg \ |
828 | #define scrollbar_size() (scrollBar.end - scrollBar.beg \ |
760 | - scrollbar_minheight ()) |
829 | - scrollbar_minheight ()) |
761 | |
830 | |
762 | #ifdef XPM_BACKGROUND |
|
|
763 | # define XPMClearArea(a, b, c, d, e, f, g) XClearArea((a), (b), (c), (d), (e), (f), (g)) |
|
|
764 | #else |
|
|
765 | # define XPMClearArea(a, b, c, d, e, f, g) |
|
|
766 | #endif |
|
|
767 | |
|
|
768 | typedef callback<void (const char *)> log_callback; |
831 | typedef callback<void (const char *)> log_callback; |
769 | typedef callback<int (int)> getfd_callback; |
832 | typedef callback<int (int)> getfd_callback; |
770 | |
833 | |
771 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
834 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
772 | extern bool rxvt_set_locale (const char *locale) NOTHROW; |
835 | extern bool rxvt_set_locale (const char *locale) NOTHROW; |
… | |
… | |
883 | |
946 | |
884 | #ifdef KEYSYM_RESOURCE |
947 | #ifdef KEYSYM_RESOURCE |
885 | class keyboard_manager; |
948 | class keyboard_manager; |
886 | #endif |
949 | #endif |
887 | |
950 | |
888 | /* to get libAfterImage to work with multiple displays we use that hack : */ |
|
|
889 | /* should not need that with libAfterImage version >= 1.15 */ |
|
|
890 | #define AFTERIMAGE_DPY_OP(op) ((::dpy = dpy), (op)) |
|
|
891 | |
|
|
892 | struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { |
951 | struct rxvt_term : zero_initialized, rxvt_vars, rxvt_screen { |
893 | |
952 | |
894 | // special markers with magic addresses |
953 | // special markers with magic addresses |
895 | static const char resval_undef []; // options specifically unset |
954 | static const char resval_undef []; // options specifically unset |
896 | static const char resval_on []; // boolean options switched on |
955 | static const char resval_on []; // boolean options switched on |
… | |
… | |
904 | struct mbstate mbstate; // current input multibyte state |
963 | struct mbstate mbstate; // current input multibyte state |
905 | |
964 | |
906 | unsigned char want_refresh:1, |
965 | unsigned char want_refresh:1, |
907 | #ifdef ENABLE_TRANSPARENCY |
966 | #ifdef ENABLE_TRANSPARENCY |
908 | want_full_refresh:1, /* awaiting full screen refresh */ |
967 | want_full_refresh:1, /* awaiting full screen refresh */ |
909 | am_transparent:1, /* is a transparent term */ |
|
|
910 | am_pixmap_trans:1, /* transparency w/known root pixmap */ |
|
|
911 | #endif |
968 | #endif |
912 | current_screen:1, /* primary or secondary */ |
969 | current_screen:1, /* primary or secondary */ |
913 | num_scr_allow:1, |
970 | num_scr_allow:1, |
914 | bypass_keystate:1, |
971 | bypass_keystate:1, |
915 | #ifdef CURSOR_BLINK |
972 | #ifdef CURSOR_BLINK |
… | |
… | |
1021 | #endif |
1078 | #endif |
1022 | struct mouse_event MEvent; |
1079 | struct mouse_event MEvent; |
1023 | XComposeStatus compose; |
1080 | XComposeStatus compose; |
1024 | ttymode_t tio; |
1081 | ttymode_t tio; |
1025 | row_col_t oldcursor; |
1082 | row_col_t oldcursor; |
1026 | #ifdef XPM_BACKGROUND |
1083 | #ifdef HAVE_BG_PIXMAP |
1027 | bgPixmap_t bgPixmap; |
1084 | bgPixmap_t bgPixmap; |
|
|
1085 | #endif |
1028 | #ifdef HAVE_AFTERIMAGE |
1086 | #ifdef HAVE_AFTERIMAGE |
1029 | struct ASVisual *asv; |
1087 | ASVisual *asv; |
1030 | ASImageManager *asimman; |
1088 | ASImageManager *asimman; |
1031 | ASImage *original_asim; |
|
|
1032 | struct { unsigned int width, height; } xpmAttr; /* all we need is width/height */ |
|
|
1033 | #else |
|
|
1034 | XpmAttributes xpmAttr; /* originally loaded pixmap and its scaling */ |
|
|
1035 | #endif |
|
|
1036 | #endif |
1089 | #endif |
1037 | |
1090 | |
1038 | #if ENABLE_OVERLAY |
1091 | #if ENABLE_OVERLAY |
1039 | int ov_x, ov_y, ov_w, ov_h; // overlay dimensions |
1092 | int ov_x, ov_y, ov_w, ov_h; // overlay dimensions |
1040 | text_t **ov_text; |
1093 | text_t **ov_text; |
… | |
… | |
1102 | |
1155 | |
1103 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1156 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1104 | void rootwin_cb (XEvent &xev); |
1157 | void rootwin_cb (XEvent &xev); |
1105 | xevent_watcher rootwin_ev; |
1158 | xevent_watcher rootwin_ev; |
1106 | #endif |
1159 | #endif |
1107 | #if ENABLE_TRANSPARENCY |
1160 | #ifdef HAVE_BG_PIXMAP |
1108 | int check_our_parents (); |
1161 | int update_background (); |
1109 | void check_our_parents_cb (time_watcher &w); |
1162 | void update_background_cb (time_watcher &w); |
1110 | time_watcher check_our_parents_ev; |
1163 | time_watcher update_background_ev; |
1111 | #endif |
1164 | #endif |
1112 | |
1165 | |
1113 | void x_cb (XEvent &xev); |
1166 | void x_cb (XEvent &xev); |
1114 | void flush (); |
1167 | void flush (); |
1115 | xevent_watcher termwin_ev; |
1168 | xevent_watcher termwin_ev; |
… | |
… | |
1336 | { |
1389 | { |
1337 | if (set) |
1390 | if (set) |
1338 | options[opt >> 3] |= (1 << (opt & 7)); |
1391 | options[opt >> 3] |= (1 << (opt & 7)); |
1339 | else |
1392 | else |
1340 | options[opt >> 3] &= ~(1 << (opt & 7)); |
1393 | options[opt >> 3] &= ~(1 << (opt & 7)); |
|
|
1394 | } |
|
|
1395 | |
|
|
1396 | void PrivMode (int set, unsigned bit) NOTHROW |
|
|
1397 | { |
|
|
1398 | if (set) |
|
|
1399 | priv_modes |= bit; |
|
|
1400 | else |
|
|
1401 | priv_modes &= ~bit; |
1341 | } |
1402 | } |
1342 | |
1403 | |
1343 | void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; |
1404 | void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; |
1344 | void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; |
1405 | void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; |
1345 | int scr_scroll_text (int row1, int row2, int count) NOTHROW; |
1406 | int scr_scroll_text (int row1, int row2, int count) NOTHROW; |
… | |
… | |
1451 | void get_options (int argc, const char *const *argv); |
1512 | void get_options (int argc, const char *const *argv); |
1452 | int parse_keysym (const char *str, const char *arg); |
1513 | int parse_keysym (const char *str, const char *arg); |
1453 | void get_xdefaults (FILE *stream, const char *name); |
1514 | void get_xdefaults (FILE *stream, const char *name); |
1454 | void extract_resources (); |
1515 | void extract_resources (); |
1455 | // xpm.C |
1516 | // xpm.C |
1456 | int scale_pixmap (const char *geom); |
1517 | void get_window_origin (int &x, int &y); |
1457 | void resize_pixmap (); |
1518 | Pixmap get_pixmap_property (int prop_id); |
1458 | Pixmap set_bgPixmap (const char *file); |
|
|
1459 | }; |
1519 | }; |
1460 | |
1520 | |
1461 | /* |
|
|
1462 | ***************************************************************************** |
|
|
1463 | * PROTOTYPES |
|
|
1464 | ***************************************************************************** |
|
|
1465 | */ |
|
|
1466 | #ifdef PROTOTYPES |
|
|
1467 | # define __PROTO(p) p |
|
|
1468 | #else |
|
|
1469 | # define __PROTO(p) () |
|
|
1470 | #endif |
|
|
1471 | |
|
|
1472 | #endif /* _RXVT_H_ */ |
1521 | #endif /* _RXVT_H_ */ |
1473 | |
1522 | |