… | |
… | |
70 | #include <X11/cursorfont.h> |
70 | #include <X11/cursorfont.h> |
71 | #include <X11/keysym.h> |
71 | #include <X11/keysym.h> |
72 | #include <X11/keysymdef.h> |
72 | #include <X11/keysymdef.h> |
73 | #include <X11/Xatom.h> |
73 | #include <X11/Xatom.h> |
74 | |
74 | |
75 | #ifdef HAVE_PIXBUF |
75 | #if HAVE_PIXBUF |
76 | # include <gdk-pixbuf/gdk-pixbuf.h> |
76 | # include <gdk-pixbuf/gdk-pixbuf.h> |
77 | #endif |
77 | #endif |
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 |
… | |
… | |
83 | #include <ecb.h> |
83 | #include <ecb.h> |
84 | #include "encoding.h" |
84 | #include "encoding.h" |
85 | #include "rxvtutil.h" |
85 | #include "rxvtutil.h" |
86 | #include "rxvtfont.h" |
86 | #include "rxvtfont.h" |
87 | #include "rxvttoolkit.h" |
87 | #include "rxvttoolkit.h" |
|
|
88 | #include "rxvtimg.h" |
88 | #include "scrollbar.h" |
89 | #include "scrollbar.h" |
89 | #include "ev_cpp.h" |
90 | #include "ev_cpp.h" |
90 | #include "libptytty.h" |
91 | #include "libptytty.h" |
91 | |
92 | |
92 | #include "rxvtperl.h" |
93 | #include "rxvtperl.h" |
… | |
… | |
209 | environ = orig_env; |
210 | environ = orig_env; |
210 | } |
211 | } |
211 | }; |
212 | }; |
212 | |
213 | |
213 | #ifdef HAVE_BG_PIXMAP |
214 | #ifdef HAVE_BG_PIXMAP |
|
|
215 | struct image_effects |
|
|
216 | { |
|
|
217 | bool tint_set; |
|
|
218 | rxvt_color tint; |
|
|
219 | int shade; |
|
|
220 | int h_blurRadius, v_blurRadius; |
|
|
221 | |
|
|
222 | image_effects () |
|
|
223 | { |
|
|
224 | tint_set = |
|
|
225 | h_blurRadius = |
|
|
226 | v_blurRadius = 0; |
|
|
227 | shade = 100; |
|
|
228 | } |
|
|
229 | |
|
|
230 | bool need_tint () |
|
|
231 | { |
|
|
232 | return shade != 100 || tint_set; |
|
|
233 | } |
|
|
234 | |
|
|
235 | bool need_blur () |
|
|
236 | { |
|
|
237 | return h_blurRadius && v_blurRadius; |
|
|
238 | } |
|
|
239 | |
|
|
240 | bool set_tint (const rxvt_color &new_tint); |
|
|
241 | bool set_shade (const char *shade_str); |
|
|
242 | bool set_blur (const char *geom); |
|
|
243 | }; |
|
|
244 | |
214 | # ifdef BG_IMAGE_FROM_FILE |
245 | # if BG_IMAGE_FROM_FILE |
215 | enum { |
246 | enum { |
216 | IM_IS_SET = 1 << 0, |
247 | IM_IS_SET = 1 << 0, |
217 | IM_IS_SIZE_SENSITIVE = 1 << 1, |
248 | IM_IS_SIZE_SENSITIVE = 1 << 1, |
218 | IM_KEEP_ASPECT = 1 << 2, |
249 | IM_KEEP_ASPECT = 1 << 2, |
219 | IM_ROOT_ALIGN = 1 << 3, |
250 | IM_ROOT_ALIGN = 1 << 3, |
… | |
… | |
227 | defaultScale = windowScale, |
258 | defaultScale = windowScale, |
228 | centerAlign = 50, |
259 | centerAlign = 50, |
229 | defaultAlign = centerAlign, |
260 | defaultAlign = centerAlign, |
230 | }; |
261 | }; |
231 | |
262 | |
232 | struct rxvt_image |
263 | struct rxvt_image : image_effects |
233 | { |
264 | { |
234 | unsigned short alpha; |
265 | unsigned short alpha; |
235 | uint8_t flags; |
266 | uint8_t flags; |
236 | unsigned int h_scale, v_scale; /* percents of the window size */ |
267 | unsigned int h_scale, v_scale; /* percents of the window size */ |
237 | int h_align, v_align; /* percents of the window size: |
268 | int h_align, v_align; /* percents of the window size: |
… | |
… | |
242 | return (!(flags & IM_TILE) |
273 | return (!(flags & IM_TILE) |
243 | || h_scale || v_scale |
274 | || h_scale || v_scale |
244 | || (!(flags & IM_ROOT_ALIGN) && (h_align || v_align))); |
275 | || (!(flags & IM_ROOT_ALIGN) && (h_align || v_align))); |
245 | } |
276 | } |
246 | |
277 | |
247 | # ifdef HAVE_PIXBUF |
278 | # if HAVE_PIXBUF |
248 | GdkPixbuf *pixbuf; |
279 | GdkPixbuf *pixbuf; |
249 | |
280 | |
250 | void destroy () |
281 | void destroy () |
251 | { |
282 | { |
252 | if (pixbuf) |
283 | if (pixbuf) |
… | |
… | |
320 | ***************************************************************************** |
351 | ***************************************************************************** |
321 | */ |
352 | */ |
322 | |
353 | |
323 | /* COLORTERM, TERM environment variables */ |
354 | /* COLORTERM, TERM environment variables */ |
324 | #define COLORTERMENV "rxvt" |
355 | #define COLORTERMENV "rxvt" |
325 | #ifdef BG_IMAGE_FROM_FILE |
356 | #if BG_IMAGE_FROM_FILE |
326 | # define COLORTERMENVFULL COLORTERMENV "-xpm" |
357 | # define COLORTERMENVFULL COLORTERMENV "-xpm" |
327 | #else |
358 | #else |
328 | # define COLORTERMENVFULL COLORTERMENV |
359 | # define COLORTERMENVFULL COLORTERMENV |
329 | #endif |
360 | #endif |
330 | #ifndef TERMENV |
361 | #ifndef TERMENV |
… | |
… | |
1161 | enum { |
1192 | enum { |
1162 | BG_IS_VALID = 1 << 0, |
1193 | BG_IS_VALID = 1 << 0, |
1163 | |
1194 | |
1164 | BG_IS_TRANSPARENT = 1 << 1, |
1195 | BG_IS_TRANSPARENT = 1 << 1, |
1165 | BG_NEEDS_REFRESH = 1 << 2, |
1196 | BG_NEEDS_REFRESH = 1 << 2, |
1166 | |
|
|
1167 | BG_HAS_RENDER = 1 << 3, |
|
|
1168 | BG_HAS_RENDER_CONV = 1 << 4, |
|
|
1169 | BG_CLIENT_RENDER = 1 << 5, |
|
|
1170 | |
|
|
1171 | BG_TINT_SET = 1 << 6, |
|
|
1172 | BG_TINT_BITAND = 1 << 7, |
|
|
1173 | }; |
1197 | }; |
1174 | |
1198 | |
1175 | uint8_t bg_flags; |
1199 | uint8_t bg_flags; |
1176 | |
1200 | |
1177 | # ifdef BG_IMAGE_FROM_FILE |
1201 | # if BG_IMAGE_FROM_FILE |
1178 | vector<rxvt_image> image_vec; |
1202 | vector<rxvt_image> image_vec; |
1179 | rxvt_image *new_image () |
1203 | rxvt_image *new_image () |
1180 | { |
1204 | { |
1181 | image_vec.resize (image_vec.size () + 1); |
1205 | image_vec.resize (image_vec.size () + 1); |
1182 | return &image_vec.back (); |
1206 | return &image_vec.back (); |
… | |
… | |
1184 | void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y); |
1208 | void get_image_geometry (rxvt_image &image, int &w, int &h, int &x, int &y); |
1185 | bool render_image (rxvt_image &image); |
1209 | bool render_image (rxvt_image &image); |
1186 | void parse_image (int id, const char *type, const char *arg); |
1210 | void parse_image (int id, const char *type, const char *arg); |
1187 | # endif |
1211 | # endif |
1188 | |
1212 | |
1189 | # ifdef ENABLE_TRANSPARENCY |
1213 | # if ENABLE_TRANSPARENCY |
1190 | Pixmap root_pixmap; /* current root pixmap set */ |
1214 | Pixmap root_pixmap; /* current root pixmap set */ |
1191 | rxvt_color tint; |
1215 | image_effects root_effects; |
1192 | int shade; |
|
|
1193 | int h_blurRadius, v_blurRadius; |
|
|
1194 | |
1216 | |
1195 | void bg_set_transparent () |
1217 | void bg_set_transparent () |
1196 | { |
1218 | { |
1197 | bg_flags |= BG_IS_TRANSPARENT; |
1219 | bg_flags |= BG_IS_TRANSPARENT; |
1198 | } |
1220 | } |
1199 | void bg_set_root_pixmap (); |
1221 | void bg_set_root_pixmap (); |
1200 | bool bg_set_tint (rxvt_color &new_tint); |
1222 | bool render_root_image (); |
1201 | bool bg_set_shade (const char *shade_str); |
|
|
1202 | bool bg_set_blur (const char *geom); |
|
|
1203 | |
|
|
1204 | bool blur_pixmap (Pixmap pixmap, int width, int height); |
|
|
1205 | bool tint_pixmap (Pixmap pixmap, int width, int height); |
|
|
1206 | void tint_ximage (XImage *ximage); |
|
|
1207 | bool make_transparency_pixmap (); |
|
|
1208 | # endif |
1223 | # endif |
|
|
1224 | |
|
|
1225 | bool blur_pixmap (Pixmap pixmap, int width, int height, bool argb, int h_blurRadius, int v_blurRadius); |
|
|
1226 | bool tint_pixmap (Pixmap pixmap, int width, int height, bool argb, rxvt_color &tint, bool tint_set, int shade); |
|
|
1227 | void tint_ximage (XImage *ximage, rxvt_color &tint, bool tint_set, int shade); |
1209 | |
1228 | |
1210 | ev_tstamp bg_valid_since; |
1229 | ev_tstamp bg_valid_since; |
1211 | |
1230 | |
1212 | Pixmap bg_pixmap; |
1231 | Pixmap bg_pixmap; |
1213 | unsigned int bg_pmap_width, bg_pmap_height; |
1232 | unsigned int bg_pmap_width, bg_pmap_height; |
… | |
… | |
1222 | void bg_invalidate () |
1241 | void bg_invalidate () |
1223 | { |
1242 | { |
1224 | bg_flags &= ~BG_IS_VALID; |
1243 | bg_flags &= ~BG_IS_VALID; |
1225 | } |
1244 | } |
1226 | #endif |
1245 | #endif |
1227 | #ifdef HAVE_PIXBUF |
1246 | #if HAVE_PIXBUF |
1228 | bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
1247 | bool pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, |
1229 | int src_x, int src_y, int dst_x, int dst_y, |
1248 | int src_x, int src_y, int dst_x, int dst_y, |
1230 | unsigned int width, unsigned int height, bool argb); |
1249 | unsigned int width, unsigned int height, bool argb); |
1231 | #endif |
1250 | #endif |
1232 | |
1251 | |
… | |
… | |
1242 | void scr_overlay_set (int x, int y, const char *s) NOTHROW; |
1261 | void scr_overlay_set (int x, int y, const char *s) NOTHROW; |
1243 | void scr_overlay_set (int x, int y, const wchar_t *s) NOTHROW; |
1262 | void scr_overlay_set (int x, int y, const wchar_t *s) NOTHROW; |
1244 | #endif |
1263 | #endif |
1245 | |
1264 | |
1246 | vector<void *> allocated; // free these memory blocks with free() |
1265 | vector<void *> allocated; // free these memory blocks with free() |
|
|
1266 | |
|
|
1267 | int parent_x, parent_y; // parent window position relative to root, only updated on demand |
1247 | |
1268 | |
1248 | char *locale; |
1269 | char *locale; |
1249 | char charsets[4]; |
1270 | char charsets[4]; |
1250 | char *v_buffer; /* pointer to physical buffer */ |
1271 | char *v_buffer; /* pointer to physical buffer */ |
1251 | unsigned int v_buflen; /* size of area to write */ |
1272 | unsigned int v_buflen; /* size of area to write */ |
… | |
… | |
1446 | char *get_colorfgbg (); |
1467 | char *get_colorfgbg (); |
1447 | bool set_color (rxvt_color &color, const char *name); |
1468 | bool set_color (rxvt_color &color, const char *name); |
1448 | void alias_color (int dst, int src); |
1469 | void alias_color (int dst, int src); |
1449 | void set_widthheight (unsigned int newwidth, unsigned int newheight); |
1470 | void set_widthheight (unsigned int newwidth, unsigned int newheight); |
1450 | void get_window_origin (int &x, int &y); |
1471 | void get_window_origin (int &x, int &y); |
1451 | Pixmap get_pixmap_property (Atom property); |
|
|
1452 | |
1472 | |
1453 | // screen.C |
1473 | // screen.C |
1454 | |
1474 | |
1455 | int fgcolor_of (rend_t r) const NOTHROW |
1475 | int fgcolor_of (rend_t r) const NOTHROW |
1456 | { |
1476 | { |