… | |
… | |
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; |
128 | void rxvt_log (const char *fmt,...) NOTHROW; |
118 | void rxvt_log (const char *fmt,...) 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; |
|
|
134 | const char * rxvt_Str_skip_space (const char *str) NOTHROW; |
|
|
135 | char * rxvt_Str_trim (char *str) NOTHROW; |
123 | char * rxvt_Str_trim (char *str) NOTHROW; |
136 | int rxvt_Str_escaped (char *str) NOTHROW; |
|
|
137 | char ** rxvt_splitcommastring (const char *cs) NOTHROW; |
124 | char ** rxvt_splitcommastring (const char *cs) NOTHROW; |
138 | void rxvt_freecommastring (char **cs) NOTHROW; |
125 | void rxvt_freecommastring (char **cs) NOTHROW; |
139 | |
126 | |
140 | ///////////////////////////////////////////////////////////////////////////// |
127 | ///////////////////////////////////////////////////////////////////////////// |
141 | |
128 | |
142 | // temporarily replace the process environment |
129 | // temporarily replace the process environment |
143 | extern char **environ; |
130 | extern char **environ; |
144 | extern char **rxvt_environ; // the original environ pointer |
131 | extern char **rxvt_environ; // the original environ pointer |
145 | |
132 | |
146 | inline void set_environ (stringvec *envv) |
133 | static inline void set_environ (stringvec *envv) |
147 | { |
134 | { |
148 | #if ENABLE_PERL |
135 | #if ENABLE_PERL |
149 | assert (envv); |
136 | assert (envv); |
150 | #else |
137 | #else |
151 | if (envv) |
138 | if (envv) |
152 | #endif |
139 | #endif |
153 | environ = (char **)envv->begin (); |
140 | environ = (char **)envv->begin (); |
154 | } |
141 | } |
155 | |
142 | |
156 | inline void set_environ (char **envv) |
143 | static inline void set_environ (char **envv) |
157 | { |
144 | { |
158 | #if ENABLE_PERL |
145 | #if ENABLE_PERL |
159 | assert (envv); |
146 | assert (envv); |
160 | #else |
147 | #else |
161 | if (envv) |
148 | if (envv) |
… | |
… | |
177 | # define KEEP_SCROLLCOLOR 1 |
164 | # define KEEP_SCROLLCOLOR 1 |
178 | #else |
165 | #else |
179 | # undef KEEP_SCROLLCOLOR |
166 | # undef KEEP_SCROLLCOLOR |
180 | #endif |
167 | #endif |
181 | |
168 | |
|
|
169 | #if defined(XPM_BACKGROUND) || defined(ENABLE_TRANSPARENCY) |
|
|
170 | # define HAVE_BG_PIXMAP 1/* to simplify further usage */ |
|
|
171 | struct bgPixmap_t { |
|
|
172 | |
|
|
173 | enum { |
|
|
174 | geometrySet = (1UL<<0), |
|
|
175 | propScale = (1UL<<1), |
|
|
176 | geometryFlags = (geometrySet|propScale), |
|
|
177 | |
|
|
178 | tintSet = (1UL<<8), |
|
|
179 | tintNeeded = (1UL<<9), |
|
|
180 | tintWholesome = (1UL<<10), |
|
|
181 | tintServerSide = (1UL<<11), |
|
|
182 | tintFlags = (tintSet|tintServerSide|tintNeeded|tintWholesome), |
|
|
183 | blurNeeded = (1UL<<12), |
|
|
184 | |
|
|
185 | isTransparent = (1UL<<16), |
|
|
186 | isInvalid = (1UL<<17) |
|
|
187 | }; |
|
|
188 | |
|
|
189 | unsigned long flags; |
|
|
190 | |
|
|
191 | enum { |
|
|
192 | transpPmapTiled = (1UL<<0), |
|
|
193 | transpPmapTinted = tintNeeded, |
|
|
194 | transpPmapBlured = blurNeeded, |
|
|
195 | transpTransformations = (tintNeeded|blurNeeded) |
|
|
196 | }; /* this flags are returned by make_transparency_pixmap if called */ |
|
|
197 | |
182 | #ifdef XPM_BACKGROUND |
198 | # ifdef XPM_BACKGROUND |
183 | typedef struct { |
199 | # ifdef HAVE_AFTERIMAGE |
184 | short w, h, x, y; |
200 | ASImage *original_asim; |
185 | bool auto_resize ; |
201 | bool render_asim (ASImage *background, ARGB32 background_tint); |
|
|
202 | # endif |
|
|
203 | |
|
|
204 | enum { defaultScale = 100, defaultAlign = 50 }; |
|
|
205 | |
|
|
206 | unsigned int h_scale, v_scale;/* percents of the window size */ |
|
|
207 | int h_align, v_align; /* percents of the window size: |
|
|
208 | 0 - left align, 50 - center, 100 - right */ |
|
|
209 | void unset_geometry () { flags = flags & ~geometryFlags; }; |
|
|
210 | bool set_geometry (const char *geom); |
|
|
211 | void set_defaultGeometry () |
|
|
212 | { |
|
|
213 | h_scale = v_scale = defaultScale; |
|
|
214 | h_align = v_align = defaultAlign; |
|
|
215 | flags |= geometrySet; |
|
|
216 | }; |
|
|
217 | |
|
|
218 | bool set_file (const char *file); |
|
|
219 | # endif /* XPM_BACKGROUND */ |
|
|
220 | |
|
|
221 | rxvt_term *target; |
|
|
222 | bool set_target (rxvt_term *new_target); |
|
|
223 | |
|
|
224 | # ifdef ENABLE_TRANSPARENCY |
|
|
225 | int root_depth; /* obtained when target is set */ |
|
|
226 | Pixmap root_pixmap; /* current root pixmap set */ |
|
|
227 | rxvt_color tint; |
|
|
228 | int shade; |
|
|
229 | int h_blurRadius, v_blurRadius; |
|
|
230 | |
|
|
231 | bool set_transparent (); |
|
|
232 | bool set_blur_radius (const char *geom); |
|
|
233 | bool set_tint (rxvt_color &new_tint); |
|
|
234 | bool unset_tint (); |
|
|
235 | bool set_shade (const char *shade_str); |
|
|
236 | bool set_root_pixmap (); |
|
|
237 | |
|
|
238 | unsigned long make_transparency_pixmap ();/* returns combination of the transpTransformations flags */ |
|
|
239 | # endif |
|
|
240 | double invalid_since; |
|
|
241 | |
186 | Pixmap pixmap; |
242 | Pixmap pixmap; |
187 | } bgPixmap_t; |
243 | unsigned int pmap_width, pmap_height; |
|
|
244 | unsigned int pmap_depth; |
|
|
245 | |
|
|
246 | bool window_size_sensitive (); |
|
|
247 | bool need_client_side_rendering (); |
|
|
248 | void apply (); |
|
|
249 | bool render (); |
|
|
250 | void invalidate () { |
|
|
251 | if (!(flags & isInvalid)) |
|
|
252 | { |
|
|
253 | flags |= isInvalid; |
|
|
254 | invalid_since = NOW; |
|
|
255 | } |
|
|
256 | }; |
|
|
257 | }; |
|
|
258 | #else |
|
|
259 | # undef HAVE_BG_PIXMAP |
188 | #endif |
260 | #endif |
189 | |
261 | |
190 | /* |
262 | /* |
191 | * the 'essential' information for reporting Mouse Events |
263 | * the 'essential' information for reporting Mouse Events |
192 | * pared down from XButtonEvent |
264 | * pared down from XButtonEvent |
… | |
… | |
566 | #endif |
638 | #endif |
567 | #ifdef KEEP_SCROLLCOLOR |
639 | #ifdef KEEP_SCROLLCOLOR |
568 | Color_scroll, |
640 | Color_scroll, |
569 | Color_trough, |
641 | Color_trough, |
570 | #endif |
642 | #endif |
571 | #if TINTING |
643 | #if ENABLE_TRANSPARENCY |
572 | Color_tint, |
644 | Color_tint, |
573 | #endif |
645 | #endif |
574 | #if OFF_FOCUS_FADING |
646 | #if OFF_FOCUS_FADING |
575 | Color_fade, |
647 | Color_fade, |
576 | #endif |
648 | #endif |
… | |
… | |
621 | #define PrivMode_LFNL (1UL<<19) |
693 | #define PrivMode_LFNL (1UL<<19) |
622 | /* too annoying to implement X11 highlight tracking */ |
694 | /* too annoying to implement X11 highlight tracking */ |
623 | /* #define PrivMode_MouseX11Track (1LU<<20) */ |
695 | /* #define PrivMode_MouseX11Track (1LU<<20) */ |
624 | |
696 | |
625 | #define PrivMode_mouse_report (PrivMode_MouseX10|PrivMode_MouseX11) |
697 | #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 | |
698 | |
632 | #ifdef ALLOW_132_MODE |
699 | #ifdef ALLOW_132_MODE |
633 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) |
700 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor|PrivMode_132OK) |
634 | #else |
701 | #else |
635 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
702 | # define PrivMode_Default (PrivMode_Autowrap|PrivMode_ShiftKeys|PrivMode_VisibleCursor) |
… | |
… | |
757 | #define scrollbar_below_slider(y) ((y) > scrollBar.bot) |
824 | #define scrollbar_below_slider(y) ((y) > scrollBar.bot) |
758 | #define scrollbar_position(y) ((y) - scrollBar.beg) |
825 | #define scrollbar_position(y) ((y) - scrollBar.beg) |
759 | #define scrollbar_size() (scrollBar.end - scrollBar.beg \ |
826 | #define scrollbar_size() (scrollBar.end - scrollBar.beg \ |
760 | - scrollbar_minheight ()) |
827 | - scrollbar_minheight ()) |
761 | |
828 | |
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; |
829 | typedef callback<void (const char *)> log_callback; |
769 | typedef callback<int (int)> getfd_callback; |
830 | typedef callback<int (int)> getfd_callback; |
770 | |
831 | |
771 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
832 | #define SET_LOCALE(locale) rxvt_set_locale (locale) |
772 | extern bool rxvt_set_locale (const char *locale) NOTHROW; |
833 | extern bool rxvt_set_locale (const char *locale) NOTHROW; |
… | |
… | |
900 | struct mbstate mbstate; // current input multibyte state |
961 | struct mbstate mbstate; // current input multibyte state |
901 | |
962 | |
902 | unsigned char want_refresh:1, |
963 | unsigned char want_refresh:1, |
903 | #ifdef ENABLE_TRANSPARENCY |
964 | #ifdef ENABLE_TRANSPARENCY |
904 | want_full_refresh:1, /* awaiting full screen refresh */ |
965 | want_full_refresh:1, /* awaiting full screen refresh */ |
905 | am_transparent:1, /* is a transparent term */ |
|
|
906 | am_pixmap_trans:1, /* transparency w/known root pixmap */ |
|
|
907 | #endif |
966 | #endif |
908 | current_screen:1, /* primary or secondary */ |
967 | current_screen:1, /* primary or secondary */ |
909 | num_scr_allow:1, |
968 | num_scr_allow:1, |
910 | bypass_keystate:1, |
969 | bypass_keystate:1, |
911 | #ifdef CURSOR_BLINK |
970 | #ifdef CURSOR_BLINK |
… | |
… | |
1017 | #endif |
1076 | #endif |
1018 | struct mouse_event MEvent; |
1077 | struct mouse_event MEvent; |
1019 | XComposeStatus compose; |
1078 | XComposeStatus compose; |
1020 | ttymode_t tio; |
1079 | ttymode_t tio; |
1021 | row_col_t oldcursor; |
1080 | row_col_t oldcursor; |
1022 | #ifdef XPM_BACKGROUND |
1081 | #ifdef HAVE_BG_PIXMAP |
1023 | bgPixmap_t bgPixmap; |
1082 | bgPixmap_t bgPixmap; |
|
|
1083 | #endif |
1024 | #ifdef HAVE_AFTERIMAGE |
1084 | #ifdef HAVE_AFTERIMAGE |
1025 | struct ASVisual *asv; |
1085 | ASVisual *asv; |
1026 | /* to get libAfterImage to work with multiple displays we use that hack : */ |
|
|
1027 | /* should not need that with libAfterImage version >= 1.15 */ |
|
|
1028 | #define AFTERIMAGE_DPY_OP(_op) ({::dpy = dpy; _op;}) |
|
|
1029 | ASImageManager *asimman; |
1086 | ASImageManager *asimman; |
1030 | ASImage *original_asim; |
|
|
1031 | struct { unsigned int width, height; } xpmAttr; /* all we need is width/height */ |
|
|
1032 | #else |
|
|
1033 | XpmAttributes xpmAttr; /* originally loaded pixmap and its scaling */ |
|
|
1034 | #endif |
|
|
1035 | #endif |
1087 | #endif |
1036 | |
1088 | |
1037 | #if ENABLE_OVERLAY |
1089 | #if ENABLE_OVERLAY |
1038 | int ov_x, ov_y, ov_w, ov_h; // overlay dimensions |
1090 | int ov_x, ov_y, ov_w, ov_h; // overlay dimensions |
1039 | text_t **ov_text; |
1091 | text_t **ov_text; |
… | |
… | |
1101 | |
1153 | |
1102 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1154 | #if ENABLE_TRANSPARENCY || ENABLE_PERL |
1103 | void rootwin_cb (XEvent &xev); |
1155 | void rootwin_cb (XEvent &xev); |
1104 | xevent_watcher rootwin_ev; |
1156 | xevent_watcher rootwin_ev; |
1105 | #endif |
1157 | #endif |
1106 | #if ENABLE_TRANSPARENCY |
1158 | #ifdef HAVE_BG_PIXMAP |
1107 | int check_our_parents (); |
1159 | int update_background (); |
1108 | void check_our_parents_cb (time_watcher &w); |
1160 | void update_background_cb (time_watcher &w); |
1109 | time_watcher check_our_parents_ev; |
1161 | time_watcher update_background_ev; |
1110 | #endif |
1162 | #endif |
1111 | |
1163 | |
1112 | void x_cb (XEvent &xev); |
1164 | void x_cb (XEvent &xev); |
1113 | void flush (); |
1165 | void flush (); |
1114 | xevent_watcher termwin_ev; |
1166 | xevent_watcher termwin_ev; |
… | |
… | |
1335 | { |
1387 | { |
1336 | if (set) |
1388 | if (set) |
1337 | options[opt >> 3] |= (1 << (opt & 7)); |
1389 | options[opt >> 3] |= (1 << (opt & 7)); |
1338 | else |
1390 | else |
1339 | options[opt >> 3] &= ~(1 << (opt & 7)); |
1391 | options[opt >> 3] &= ~(1 << (opt & 7)); |
|
|
1392 | } |
|
|
1393 | |
|
|
1394 | void PrivMode (int set, unsigned bit) NOTHROW |
|
|
1395 | { |
|
|
1396 | if (set) |
|
|
1397 | priv_modes |= bit; |
|
|
1398 | else |
|
|
1399 | priv_modes &= ~bit; |
1340 | } |
1400 | } |
1341 | |
1401 | |
1342 | void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; |
1402 | void scr_blank_line (line_t &l, unsigned int col, unsigned int width, rend_t efs) const NOTHROW; |
1343 | void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; |
1403 | void scr_blank_screen_mem (line_t &l, rend_t efs) const NOTHROW; |
1344 | int scr_scroll_text (int row1, int row2, int count) NOTHROW; |
1404 | int scr_scroll_text (int row1, int row2, int count) NOTHROW; |
… | |
… | |
1450 | void get_options (int argc, const char *const *argv); |
1510 | void get_options (int argc, const char *const *argv); |
1451 | int parse_keysym (const char *str, const char *arg); |
1511 | int parse_keysym (const char *str, const char *arg); |
1452 | void get_xdefaults (FILE *stream, const char *name); |
1512 | void get_xdefaults (FILE *stream, const char *name); |
1453 | void extract_resources (); |
1513 | void extract_resources (); |
1454 | // xpm.C |
1514 | // xpm.C |
1455 | int scale_pixmap (const char *geom); |
1515 | void get_window_origin (int &x, int &y); |
1456 | void resize_pixmap (); |
1516 | Pixmap get_pixmap_property (int prop_id); |
1457 | Pixmap set_bgPixmap (const char *file); |
|
|
1458 | }; |
1517 | }; |
1459 | |
1518 | |
1460 | /* |
|
|
1461 | ***************************************************************************** |
|
|
1462 | * PROTOTYPES |
|
|
1463 | ***************************************************************************** |
|
|
1464 | */ |
|
|
1465 | #ifdef PROTOTYPES |
|
|
1466 | # define __PROTO(p) p |
|
|
1467 | #else |
|
|
1468 | # define __PROTO(p) () |
|
|
1469 | #endif |
|
|
1470 | |
|
|
1471 | #endif /* _RXVT_H_ */ |
1519 | #endif /* _RXVT_H_ */ |
1472 | |
1520 | |