… | |
… | |
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 | uint8_t flags; |
|
|
236 | unsigned int h_scale, v_scale; /* percents of the window size */ |
|
|
237 | int h_align, v_align; /* percents of the window size: |
|
|
238 | 0 - left align, 50 - center, 100 - right */ |
|
|
239 | |
|
|
240 | # ifdef HAVE_PIXBUF |
|
|
241 | GdkPixbuf *pixbuf; |
|
|
242 | |
|
|
243 | ~rxvt_image () |
|
|
244 | { |
|
|
245 | if (pixbuf) |
|
|
246 | g_object_unref (pixbuf); |
|
|
247 | } |
|
|
248 | |
|
|
249 | int width () |
|
|
250 | { |
|
|
251 | return gdk_pixbuf_get_width (pixbuf); |
|
|
252 | } |
|
|
253 | int height () |
|
|
254 | { |
|
|
255 | return gdk_pixbuf_get_height (pixbuf); |
|
|
256 | } |
|
|
257 | # endif |
|
|
258 | |
|
|
259 | bool set_file (const char *file); |
|
|
260 | bool set_geometry (const char *geom, bool update = false); |
|
|
261 | }; |
|
|
262 | # endif |
|
|
263 | #endif |
212 | |
264 | |
213 | /* |
265 | /* |
214 | ***************************************************************************** |
266 | ***************************************************************************** |
215 | * STRUCTURES AND TYPEDEFS |
267 | * STRUCTURES AND TYPEDEFS |
216 | ***************************************************************************** |
268 | ***************************************************************************** |
… | |
… | |
769 | // that are not representable in unicode, as well as characters |
821 | // that are not representable in unicode, as well as characters |
770 | // not fitting in the BMP. |
822 | // not fitting in the BMP. |
771 | struct compose_char |
823 | struct compose_char |
772 | { |
824 | { |
773 | unicode_t c1, c2; // any chars != NOCHAR are valid |
825 | unicode_t c1, c2; // any chars != NOCHAR are valid |
|
|
826 | #if __cplusplus >= 201103L || ECB_GCC_VERSION(4,4) |
|
|
827 | compose_char () = default; |
|
|
828 | #endif |
774 | compose_char (unicode_t c1, unicode_t c2) |
829 | compose_char (unicode_t c1, unicode_t c2) |
775 | : c1(c1), c2(c2) |
830 | : c1(c1), c2(c2) |
776 | { } |
831 | { } |
777 | }; |
832 | }; |
778 | |
833 | |
… | |
… | |
1082 | #ifdef HAVE_BG_PIXMAP |
1137 | #ifdef HAVE_BG_PIXMAP |
1083 | void bg_init (); |
1138 | void bg_init (); |
1084 | void bg_destroy (); |
1139 | void bg_destroy (); |
1085 | |
1140 | |
1086 | enum { |
1141 | enum { |
1087 | BG_IS_VALID = 1 << 0, |
1142 | BG_IS_VALID = 1 << 0, |
1088 | BG_NEEDS_TINT = 1 << 1, |
|
|
1089 | BG_NEEDS_BLUR = 1 << 2, |
|
|
1090 | |
1143 | |
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 | |
|
|
1101 | BG_HAS_RENDER = 1 << 7, |
|
|
1102 | BG_HAS_RENDER_CONV = 1 << 8, |
|
|
1103 | BG_CLIENT_RENDER = 1 << 9, |
|
|
1104 | |
|
|
1105 | BG_IS_TRANSPARENT = 1 << 10, |
1144 | BG_IS_TRANSPARENT = 1 << 1, |
1106 | BG_NEEDS_REFRESH = 1 << 11, |
1145 | BG_NEEDS_REFRESH = 1 << 2, |
1107 | BG_IS_SIZE_SENSITIVE = 1 << 12, |
1146 | |
1108 | BG_IS_FROM_FILE = 1 << 13, |
1147 | BG_HAS_RENDER = 1 << 3, |
|
|
1148 | BG_HAS_RENDER_CONV = 1 << 4, |
|
|
1149 | BG_CLIENT_RENDER = 1 << 5, |
|
|
1150 | |
|
|
1151 | BG_TINT_SET = 1 << 6, |
|
|
1152 | BG_TINT_BITAND = 1 << 7, |
1109 | }; |
1153 | }; |
1110 | |
1154 | |
1111 | unsigned int bg_flags; |
1155 | uint8_t bg_flags; |
1112 | |
1156 | |
1113 | # ifdef BG_IMAGE_FROM_FILE |
1157 | # ifdef BG_IMAGE_FROM_FILE |
|
|
1158 | rxvt_image bg_image; |
1114 | void get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y); |
1159 | void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y); |
1115 | bool render_image (bool transparent); |
1160 | bool render_image (rxvt_image &image); |
1116 | |
|
|
1117 | enum { |
|
|
1118 | noScale = 0, |
|
|
1119 | windowScale = 100, |
|
|
1120 | defaultScale = windowScale, |
|
|
1121 | centerAlign = 50, |
|
|
1122 | defaultAlign = centerAlign, |
|
|
1123 | }; |
|
|
1124 | |
|
|
1125 | unsigned int h_scale, v_scale; /* percents of the window size */ |
|
|
1126 | int h_align, v_align; /* percents of the window size: |
|
|
1127 | 0 - left align, 50 - center, 100 - right */ |
|
|
1128 | |
|
|
1129 | bool bg_set_geometry (const char *geom, bool update = false); |
|
|
1130 | void bg_set_default_geometry () |
|
|
1131 | { |
|
|
1132 | h_scale = v_scale = defaultScale; |
|
|
1133 | h_align = v_align = defaultAlign; |
|
|
1134 | } |
|
|
1135 | |
|
|
1136 | bool bg_set_file (const char *file); |
|
|
1137 | # endif |
1161 | # endif |
1138 | |
1162 | |
1139 | # ifdef ENABLE_TRANSPARENCY |
1163 | # ifdef ENABLE_TRANSPARENCY |
1140 | Pixmap root_pixmap; /* current root pixmap set */ |
1164 | Pixmap root_pixmap; /* current root pixmap set */ |
1141 | rxvt_color tint; |
1165 | rxvt_color tint; |
… | |
… | |
1145 | void bg_set_transparent () |
1169 | void bg_set_transparent () |
1146 | { |
1170 | { |
1147 | bg_flags |= BG_IS_TRANSPARENT; |
1171 | bg_flags |= BG_IS_TRANSPARENT; |
1148 | } |
1172 | } |
1149 | void bg_set_root_pixmap (); |
1173 | void bg_set_root_pixmap (); |
1150 | void set_tint_shade_flags (); |
|
|
1151 | bool bg_set_tint (rxvt_color &new_tint); |
1174 | bool bg_set_tint (rxvt_color &new_tint); |
1152 | bool bg_set_shade (const char *shade_str); |
1175 | bool bg_set_shade (const char *shade_str); |
1153 | bool bg_set_blur (const char *geom); |
1176 | bool bg_set_blur (const char *geom); |
1154 | |
1177 | |
1155 | bool blur_pixmap (Pixmap pixmap, Visual *visual, int width, int height, int depth); |
1178 | bool blur_pixmap (Pixmap pixmap, int width, int height); |
1156 | bool tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height); |
1179 | bool tint_pixmap (Pixmap pixmap, int width, int height); |
1157 | void tint_ximage (Visual *visual, XImage *ximage); |
1180 | void tint_ximage (XImage *ximage); |
1158 | bool make_transparency_pixmap (); |
1181 | bool make_transparency_pixmap (); |
1159 | # endif |
1182 | # endif |
1160 | |
1183 | |
1161 | ev_tstamp bg_valid_since; |
1184 | ev_tstamp bg_valid_since; |
1162 | |
1185 | |
… | |
… | |
1174 | { |
1197 | { |
1175 | bg_flags &= ~BG_IS_VALID; |
1198 | bg_flags &= ~BG_IS_VALID; |
1176 | } |
1199 | } |
1177 | #endif |
1200 | #endif |
1178 | #ifdef HAVE_PIXBUF |
1201 | #ifdef HAVE_PIXBUF |
1179 | GdkPixbuf *pixbuf; |
|
|
1180 | bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
1202 | bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
1181 | int src_x, int src_y, int dst_x, int dst_y, |
1203 | int src_x, int src_y, int dst_x, int dst_y, |
1182 | unsigned int width, unsigned int height); |
1204 | unsigned int width, unsigned int height); |
1183 | #endif |
1205 | #endif |
1184 | |
1206 | |