… | |
… | |
78 | |
78 | |
79 | #if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY) |
79 | #if defined(BG_IMAGE_FROM_FILE) || defined(ENABLE_TRANSPARENCY) |
80 | # define HAVE_BG_PIXMAP 1 |
80 | # define HAVE_BG_PIXMAP 1 |
81 | #endif |
81 | #endif |
82 | |
82 | |
|
|
83 | #include <ecb.h> |
83 | #include "encoding.h" |
84 | #include "encoding.h" |
84 | #include "rxvtutil.h" |
85 | #include "rxvtutil.h" |
85 | #include "rxvtfont.h" |
86 | #include "rxvtfont.h" |
86 | #include "rxvttoolkit.h" |
87 | #include "rxvttoolkit.h" |
87 | #include "scrollbar.h" |
88 | #include "scrollbar.h" |
… | |
… | |
207 | ~localise_env () |
208 | ~localise_env () |
208 | { |
209 | { |
209 | environ = orig_env; |
210 | environ = orig_env; |
210 | } |
211 | } |
211 | }; |
212 | }; |
|
|
213 | |
|
|
214 | #ifdef HAVE_BG_PIXMAP |
|
|
215 | # ifdef BG_IMAGE_FROM_FILE |
|
|
216 | enum { |
|
|
217 | IM_IS_SET = 1 << 0, |
|
|
218 | IM_IS_SIZE_SENSITIVE = 1 << 1, |
|
|
219 | IM_KEEP_ASPECT = 1 << 2, |
|
|
220 | IM_ROOT_ALIGN = 1 << 3, |
|
|
221 | IM_TILE = 1 << 4, |
|
|
222 | IM_GEOMETRY_FLAGS = IM_KEEP_ASPECT | IM_ROOT_ALIGN | IM_TILE, |
|
|
223 | }; |
|
|
224 | |
|
|
225 | enum { |
|
|
226 | noScale = 0, |
|
|
227 | windowScale = 100, |
|
|
228 | defaultScale = windowScale, |
|
|
229 | centerAlign = 50, |
|
|
230 | defaultAlign = centerAlign, |
|
|
231 | }; |
|
|
232 | |
|
|
233 | struct rxvt_image |
|
|
234 | { |
|
|
235 | int id; |
|
|
236 | unsigned short alpha; |
|
|
237 | uint8_t flags; |
|
|
238 | unsigned int h_scale, v_scale; /* percents of the window size */ |
|
|
239 | int h_align, v_align; /* percents of the window size: |
|
|
240 | 0 - left align, 50 - center, 100 - right */ |
|
|
241 | |
|
|
242 | # ifdef HAVE_PIXBUF |
|
|
243 | auto_ptr<GdkPixbuf> pixbuf; |
|
|
244 | |
|
|
245 | int width () |
|
|
246 | { |
|
|
247 | return gdk_pixbuf_get_width (pixbuf); |
|
|
248 | } |
|
|
249 | int height () |
|
|
250 | { |
|
|
251 | return gdk_pixbuf_get_height (pixbuf); |
|
|
252 | } |
|
|
253 | # endif |
|
|
254 | |
|
|
255 | rxvt_image (); |
|
|
256 | bool set_file_geometry (const char *file); |
|
|
257 | bool set_file (const char *file); |
|
|
258 | bool set_geometry (const char *geom, bool update = false); |
|
|
259 | }; |
|
|
260 | # endif |
|
|
261 | #endif |
212 | |
262 | |
213 | /* |
263 | /* |
214 | ***************************************************************************** |
264 | ***************************************************************************** |
215 | * STRUCTURES AND TYPEDEFS |
265 | * STRUCTURES AND TYPEDEFS |
216 | ***************************************************************************** |
266 | ***************************************************************************** |
… | |
… | |
769 | // that are not representable in unicode, as well as characters |
819 | // that are not representable in unicode, as well as characters |
770 | // not fitting in the BMP. |
820 | // not fitting in the BMP. |
771 | struct compose_char |
821 | struct compose_char |
772 | { |
822 | { |
773 | unicode_t c1, c2; // any chars != NOCHAR are valid |
823 | unicode_t c1, c2; // any chars != NOCHAR are valid |
|
|
824 | #if __cplusplus >= 201103L || ECB_GCC_VERSION(4,4) |
|
|
825 | compose_char () = default; |
|
|
826 | #endif |
774 | compose_char (unicode_t c1, unicode_t c2) |
827 | compose_char (unicode_t c1, unicode_t c2) |
775 | : c1(c1), c2(c2) |
828 | : c1(c1), c2(c2) |
776 | { } |
829 | { } |
777 | }; |
830 | }; |
778 | |
831 | |
… | |
… | |
1082 | #ifdef HAVE_BG_PIXMAP |
1135 | #ifdef HAVE_BG_PIXMAP |
1083 | void bg_init (); |
1136 | void bg_init (); |
1084 | void bg_destroy (); |
1137 | void bg_destroy (); |
1085 | |
1138 | |
1086 | enum { |
1139 | enum { |
1087 | BG_IS_VALID = 1 << 0, |
1140 | BG_IS_VALID = 1 << 0, |
1088 | BG_NEEDS_TINT = 1 << 1, |
|
|
1089 | BG_NEEDS_BLUR = 1 << 2, |
|
|
1090 | |
1141 | |
1091 | BG_EFFECTS_FLAGS = BG_NEEDS_TINT | BG_NEEDS_BLUR, |
|
|
1092 | |
|
|
1093 | BG_KEEP_ASPECT = 1 << 3, |
|
|
1094 | BG_ROOT_ALIGN = 1 << 4, |
|
|
1095 | BG_TILE = 1 << 14, |
|
|
1096 | BG_GEOMETRY_FLAGS = BG_KEEP_ASPECT | BG_ROOT_ALIGN | BG_TILE, |
|
|
1097 | |
|
|
1098 | BG_TINT_SET = 1 << 5, |
|
|
1099 | BG_TINT_BITAND = 1 << 6, |
|
|
1100 | BG_TINT_FLAGS = BG_NEEDS_TINT | BG_TINT_BITAND, |
|
|
1101 | |
|
|
1102 | BG_HAS_RENDER = 1 << 7, |
|
|
1103 | BG_HAS_RENDER_CONV = 1 << 8, |
|
|
1104 | BG_CLIENT_RENDER = 1 << 9, |
|
|
1105 | |
|
|
1106 | BG_IS_TRANSPARENT = 1 << 10, |
1142 | BG_IS_TRANSPARENT = 1 << 1, |
1107 | BG_NEEDS_REFRESH = 1 << 11, |
1143 | BG_NEEDS_REFRESH = 1 << 2, |
1108 | BG_IS_SIZE_SENSITIVE = 1 << 12, |
1144 | |
1109 | BG_IS_FROM_FILE = 1 << 13, |
1145 | BG_HAS_RENDER = 1 << 3, |
|
|
1146 | BG_HAS_RENDER_CONV = 1 << 4, |
|
|
1147 | BG_CLIENT_RENDER = 1 << 5, |
|
|
1148 | |
|
|
1149 | BG_TINT_SET = 1 << 6, |
|
|
1150 | BG_TINT_BITAND = 1 << 7, |
1110 | }; |
1151 | }; |
1111 | |
1152 | |
1112 | unsigned int bg_flags; |
1153 | uint8_t bg_flags; |
1113 | |
1154 | |
1114 | # ifdef BG_IMAGE_FROM_FILE |
1155 | # ifdef BG_IMAGE_FROM_FILE |
1115 | void get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y); |
1156 | vector<rxvt_image> image_vec; |
1116 | bool render_image (bool transparent); |
1157 | rxvt_image *new_image () |
1117 | |
1158 | { |
1118 | enum { |
1159 | image_vec.resize (image_vec.size () + 1); |
1119 | noScale = 0, |
1160 | return &image_vec.back (); |
1120 | windowScale = 100, |
|
|
1121 | defaultScale = windowScale, |
|
|
1122 | centerAlign = 50, |
|
|
1123 | defaultAlign = centerAlign, |
|
|
1124 | }; |
1161 | } |
1125 | |
1162 | void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y); |
1126 | unsigned int h_scale, v_scale; /* percents of the window size */ |
1163 | bool render_image (rxvt_image &image); |
1127 | int h_align, v_align; /* percents of the window size: |
1164 | void parse_image (int id, const char *type, const char *arg); |
1128 | 0 - left align, 50 - center, 100 - right */ |
|
|
1129 | |
|
|
1130 | bool bg_set_geometry (const char *geom, bool update = false); |
|
|
1131 | void bg_set_default_geometry () |
|
|
1132 | { |
|
|
1133 | h_scale = v_scale = defaultScale; |
|
|
1134 | h_align = v_align = defaultAlign; |
|
|
1135 | } |
|
|
1136 | |
|
|
1137 | bool bg_set_file (const char *file); |
|
|
1138 | # endif |
1165 | # endif |
1139 | |
1166 | |
1140 | # ifdef ENABLE_TRANSPARENCY |
1167 | # ifdef ENABLE_TRANSPARENCY |
1141 | Pixmap root_pixmap; /* current root pixmap set */ |
1168 | Pixmap root_pixmap; /* current root pixmap set */ |
1142 | rxvt_color tint; |
1169 | rxvt_color tint; |
1143 | int shade; |
1170 | int shade; |
1144 | int h_blurRadius, v_blurRadius; |
1171 | int h_blurRadius, v_blurRadius; |
1145 | |
1172 | |
1146 | bool bg_set_transparent (); |
1173 | void bg_set_transparent () |
|
|
1174 | { |
|
|
1175 | bg_flags |= BG_IS_TRANSPARENT; |
|
|
1176 | } |
1147 | void bg_set_root_pixmap (); |
1177 | void bg_set_root_pixmap (); |
1148 | void set_tint_shade_flags (); |
|
|
1149 | bool bg_set_tint (rxvt_color &new_tint); |
1178 | bool bg_set_tint (rxvt_color &new_tint); |
1150 | bool bg_set_shade (const char *shade_str); |
1179 | bool bg_set_shade (const char *shade_str); |
1151 | bool bg_set_blur (const char *geom); |
1180 | bool bg_set_blur (const char *geom); |
1152 | |
1181 | |
1153 | bool blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height, int depth); |
1182 | bool blur_pixmap (Pixmap pixmap, int width, int height); |
1154 | bool tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height); |
1183 | bool tint_pixmap (Pixmap pixmap, int width, int height); |
1155 | void tint_ximage (Visual *visual, XImage *ximage); |
1184 | void tint_ximage (XImage *ximage); |
1156 | bool make_transparency_pixmap (); |
1185 | bool make_transparency_pixmap (); |
1157 | # endif |
1186 | # endif |
1158 | |
1187 | |
1159 | ev_tstamp bg_valid_since; |
1188 | ev_tstamp bg_valid_since; |
1160 | |
1189 | |
… | |
… | |
1172 | { |
1201 | { |
1173 | bg_flags &= ~BG_IS_VALID; |
1202 | bg_flags &= ~BG_IS_VALID; |
1174 | } |
1203 | } |
1175 | #endif |
1204 | #endif |
1176 | #ifdef HAVE_PIXBUF |
1205 | #ifdef HAVE_PIXBUF |
1177 | GdkPixbuf *pixbuf; |
|
|
1178 | bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
1206 | bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
1179 | int src_x, int src_y, int dst_x, int dst_y, |
1207 | int src_x, int src_y, int dst_x, int dst_y, |
1180 | unsigned int width, unsigned int height); |
1208 | unsigned int width, unsigned int height, bool argb); |
1181 | #endif |
1209 | #endif |
1182 | |
1210 | |
1183 | #if ENABLE_OVERLAY |
1211 | #if ENABLE_OVERLAY |
1184 | overlay_base ov; |
1212 | overlay_base ov; |
1185 | |
1213 | |
… | |
… | |
1261 | void cmdbuf_append (const char *str, size_t count); |
1289 | void cmdbuf_append (const char *str, size_t count); |
1262 | bool pty_fill (); |
1290 | bool pty_fill (); |
1263 | void pty_cb (ev::io &w, int revents); ev::io pty_ev; |
1291 | void pty_cb (ev::io &w, int revents); ev::io pty_ev; |
1264 | |
1292 | |
1265 | #ifdef CURSOR_BLINK |
1293 | #ifdef CURSOR_BLINK |
|
|
1294 | void cursor_blink_reset (); |
1266 | void cursor_blink_cb (ev::timer &w, int revents); ev::timer cursor_blink_ev; |
1295 | void cursor_blink_cb (ev::timer &w, int revents); ev::timer cursor_blink_ev; |
1267 | #endif |
1296 | #endif |
1268 | #ifdef TEXT_BLINK |
1297 | #ifdef TEXT_BLINK |
1269 | void text_blink_cb (ev::timer &w, int revents); ev::timer text_blink_ev; |
1298 | void text_blink_cb (ev::timer &w, int revents); ev::timer text_blink_ev; |
1270 | #endif |
1299 | #endif |
… | |
… | |
1544 | const char **get_options (int argc, const char *const *argv); |
1573 | const char **get_options (int argc, const char *const *argv); |
1545 | int parse_keysym (const char *str, const char *arg); |
1574 | int parse_keysym (const char *str, const char *arg); |
1546 | const char *x_resource (const char *name); |
1575 | const char *x_resource (const char *name); |
1547 | void extract_resources (); |
1576 | void extract_resources (); |
1548 | void extract_keysym_resources (); |
1577 | void extract_keysym_resources (); |
|
|
1578 | void find_resources (const char *n_prefix, const char *c_prefix, int mode, |
|
|
1579 | Bool (*proc)(XrmDatabase *, XrmBindingList, XrmQuarkList, XrmRepresentation *, XrmValue *, XPointer)); |
|
|
1580 | bool parse_bool_resource (const char *str) |
|
|
1581 | { |
|
|
1582 | return (!strcasecmp (str, "TRUE") |
|
|
1583 | || !strcasecmp (str, "YES") |
|
|
1584 | || !strcasecmp (str, "ON") |
|
|
1585 | || !strcasecmp (str, "1")); |
|
|
1586 | } |
1549 | }; |
1587 | }; |
1550 | |
1588 | |
1551 | #endif /* _RXVT_H_ */ |
1589 | #endif /* _RXVT_H_ */ |
1552 | |
1590 | |