… | |
… | |
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" |
… | |
… | |
229 | defaultAlign = centerAlign, |
230 | defaultAlign = centerAlign, |
230 | }; |
231 | }; |
231 | |
232 | |
232 | struct rxvt_image |
233 | struct rxvt_image |
233 | { |
234 | { |
|
|
235 | int id; |
|
|
236 | unsigned short alpha; |
234 | uint8_t flags; |
237 | uint8_t flags; |
235 | unsigned int h_scale, v_scale; /* percents of the window size */ |
238 | unsigned int h_scale, v_scale; /* percents of the window size */ |
236 | int h_align, v_align; /* percents of the window size: |
239 | int h_align, v_align; /* percents of the window size: |
237 | 0 - left align, 50 - center, 100 - right */ |
240 | 0 - left align, 50 - center, 100 - right */ |
238 | |
241 | |
239 | # ifdef HAVE_PIXBUF |
242 | # ifdef HAVE_PIXBUF |
240 | GdkPixbuf *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 | } |
241 | # endif |
253 | # endif |
242 | |
254 | |
243 | ~rxvt_image () |
255 | rxvt_image (); |
244 | { |
256 | bool set_file_geometry (const char *file); |
245 | # ifdef HAVE_PIXBUF |
|
|
246 | if (pixbuf) |
|
|
247 | g_object_unref (pixbuf); |
|
|
248 | # endif |
|
|
249 | } |
|
|
250 | |
|
|
251 | int width () |
|
|
252 | { |
|
|
253 | # ifdef HAVE_PIXBUF |
|
|
254 | return gdk_pixbuf_get_width (pixbuf); |
|
|
255 | # endif |
|
|
256 | } |
|
|
257 | int height () |
|
|
258 | { |
|
|
259 | # ifdef HAVE_PIXBUF |
|
|
260 | return gdk_pixbuf_get_height (pixbuf); |
|
|
261 | # endif |
|
|
262 | } |
|
|
263 | bool set_file (const char *file); |
257 | bool set_file (const char *file); |
264 | bool set_geometry (const char *geom, bool update = false); |
258 | bool set_geometry (const char *geom, bool update = false); |
265 | void set_default_geometry () |
|
|
266 | { |
|
|
267 | h_scale = v_scale = defaultScale; |
|
|
268 | h_align = v_align = defaultAlign; |
|
|
269 | flags |= IM_IS_SIZE_SENSITIVE; |
|
|
270 | } |
|
|
271 | }; |
259 | }; |
272 | # endif |
260 | # endif |
273 | #endif |
261 | #endif |
274 | |
262 | |
275 | /* |
263 | /* |
… | |
… | |
831 | // that are not representable in unicode, as well as characters |
819 | // that are not representable in unicode, as well as characters |
832 | // not fitting in the BMP. |
820 | // not fitting in the BMP. |
833 | struct compose_char |
821 | struct compose_char |
834 | { |
822 | { |
835 | unicode_t c1, c2; // any chars != NOCHAR are valid |
823 | unicode_t c1, c2; // any chars != NOCHAR are valid |
836 | #if __cplusplus >= 201103L |
824 | #if __cplusplus >= 201103L || ECB_GCC_VERSION(4,4) |
837 | compose_char () = default; |
825 | compose_char () = default; |
838 | #endif |
826 | #endif |
839 | compose_char (unicode_t c1, unicode_t c2) |
827 | compose_char (unicode_t c1, unicode_t c2) |
840 | : c1(c1), c2(c2) |
828 | : c1(c1), c2(c2) |
841 | { } |
829 | { } |
… | |
… | |
1163 | }; |
1151 | }; |
1164 | |
1152 | |
1165 | uint8_t bg_flags; |
1153 | uint8_t bg_flags; |
1166 | |
1154 | |
1167 | # ifdef BG_IMAGE_FROM_FILE |
1155 | # ifdef BG_IMAGE_FROM_FILE |
|
|
1156 | vector<rxvt_image> image_vec; |
1168 | rxvt_image bg_image; |
1157 | rxvt_image *new_image () |
|
|
1158 | { |
|
|
1159 | image_vec.resize (image_vec.size () + 1); |
|
|
1160 | return &image_vec.back (); |
|
|
1161 | } |
1169 | void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y); |
1162 | void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y); |
1170 | bool render_image (rxvt_image &image); |
1163 | bool render_image (rxvt_image &image); |
|
|
1164 | void parse_image (int id, const char *type, const char *arg); |
1171 | # endif |
1165 | # endif |
1172 | |
1166 | |
1173 | # ifdef ENABLE_TRANSPARENCY |
1167 | # ifdef ENABLE_TRANSPARENCY |
1174 | Pixmap root_pixmap; /* current root pixmap set */ |
1168 | Pixmap root_pixmap; /* current root pixmap set */ |
1175 | rxvt_color tint; |
1169 | rxvt_color tint; |
… | |
… | |
1209 | } |
1203 | } |
1210 | #endif |
1204 | #endif |
1211 | #ifdef HAVE_PIXBUF |
1205 | #ifdef HAVE_PIXBUF |
1212 | bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
1206 | bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
1213 | 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, |
1214 | unsigned int width, unsigned int height); |
1208 | unsigned int width, unsigned int height, bool argb); |
1215 | #endif |
1209 | #endif |
1216 | |
1210 | |
1217 | #if ENABLE_OVERLAY |
1211 | #if ENABLE_OVERLAY |
1218 | overlay_base ov; |
1212 | overlay_base ov; |
1219 | |
1213 | |
… | |
… | |
1579 | const char **get_options (int argc, const char *const *argv); |
1573 | const char **get_options (int argc, const char *const *argv); |
1580 | int parse_keysym (const char *str, const char *arg); |
1574 | int parse_keysym (const char *str, const char *arg); |
1581 | const char *x_resource (const char *name); |
1575 | const char *x_resource (const char *name); |
1582 | void extract_resources (); |
1576 | void extract_resources (); |
1583 | 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 | } |
1584 | }; |
1587 | }; |
1585 | |
1588 | |
1586 | #endif /* _RXVT_H_ */ |
1589 | #endif /* _RXVT_H_ */ |
1587 | |
1590 | |