… | |
… | |
65 | rxvt_term::bg_destroy () |
65 | rxvt_term::bg_destroy () |
66 | { |
66 | { |
67 | #ifdef HAVE_AFTERIMAGE |
67 | #ifdef HAVE_AFTERIMAGE |
68 | if (original_asim) |
68 | if (original_asim) |
69 | safe_asimage_destroy (original_asim); |
69 | safe_asimage_destroy (original_asim); |
|
|
70 | if (asv) |
|
|
71 | destroy_asvisual (asv, 0); |
|
|
72 | if (asimman) |
|
|
73 | destroy_image_manager (asimman, 0); |
70 | #endif |
74 | #endif |
71 | |
75 | |
72 | #ifdef HAVE_PIXBUF |
76 | #ifdef HAVE_PIXBUF |
73 | if (pixbuf) |
77 | if (pixbuf) |
74 | g_object_unref (pixbuf); |
78 | g_object_unref (pixbuf); |
… | |
… | |
94 | |
98 | |
95 | bool |
99 | bool |
96 | rxvt_term::bg_window_size_sensitive () |
100 | rxvt_term::bg_window_size_sensitive () |
97 | { |
101 | { |
98 | # ifdef ENABLE_TRANSPARENCY |
102 | # ifdef ENABLE_TRANSPARENCY |
99 | if (bg_flags & isTransparent) |
103 | if (bg_flags & BG_IS_TRANSPARENT) |
100 | return true; |
104 | return true; |
101 | # endif |
105 | # endif |
102 | |
106 | |
103 | # ifdef BG_IMAGE_FROM_FILE |
107 | # ifdef BG_IMAGE_FROM_FILE |
104 | if (have_image) |
108 | if (bg_flags & BG_IS_FROM_FILE) |
105 | { |
109 | { |
106 | if (bg_flags & sizeSensitive) |
110 | if (bg_flags & BG_IS_SIZE_SENSITIVE) |
107 | return true; |
111 | return true; |
108 | } |
112 | } |
109 | # endif |
113 | # endif |
110 | |
114 | |
111 | return false; |
115 | return false; |
… | |
… | |
113 | |
117 | |
114 | bool |
118 | bool |
115 | rxvt_term::bg_window_position_sensitive () |
119 | rxvt_term::bg_window_position_sensitive () |
116 | { |
120 | { |
117 | # ifdef ENABLE_TRANSPARENCY |
121 | # ifdef ENABLE_TRANSPARENCY |
118 | if (bg_flags & isTransparent) |
122 | if (bg_flags & BG_IS_TRANSPARENT) |
119 | return true; |
123 | return true; |
120 | # endif |
124 | # endif |
121 | |
125 | |
122 | # ifdef BG_IMAGE_FROM_FILE |
126 | # ifdef BG_IMAGE_FROM_FILE |
123 | if (have_image) |
127 | if (bg_flags & BG_IS_FROM_FILE) |
124 | { |
128 | { |
125 | if (bg_flags & rootAlign) |
129 | if (bg_flags & BG_ROOT_ALIGN) |
126 | return true; |
130 | return true; |
127 | } |
131 | } |
128 | # endif |
132 | # endif |
129 | |
133 | |
130 | return false; |
134 | return false; |
… | |
… | |
204 | bool changed = false; |
208 | bool changed = false; |
205 | int geom_flags = 0; |
209 | int geom_flags = 0; |
206 | int x = 0, y = 0; |
210 | int x = 0, y = 0; |
207 | unsigned int w = 0, h = 0; |
211 | unsigned int w = 0, h = 0; |
208 | unsigned int n; |
212 | unsigned int n; |
209 | unsigned long new_flags = (bg_flags & (~geometryFlags)); |
213 | unsigned long new_flags = (bg_flags & (~BG_GEOMETRY_FLAGS)); |
210 | const char *ops; |
214 | const char *ops; |
211 | |
215 | |
212 | if (geom == NULL) |
216 | if (geom == NULL) |
213 | return false; |
217 | return false; |
214 | |
218 | |
… | |
… | |
261 | w = h = noScale; |
265 | w = h = noScale; |
262 | geom_flags |= WidthValue|HeightValue; |
266 | geom_flags |= WidthValue|HeightValue; |
263 | } |
267 | } |
264 | else if (!strcasecmp (arr[i], "propscale")) |
268 | else if (!strcasecmp (arr[i], "propscale")) |
265 | { |
269 | { |
266 | new_flags |= propScale; |
270 | new_flags |= BG_PROP_SCALE; |
267 | } |
271 | } |
268 | else if (!strcasecmp (arr[i], "hscale")) |
272 | else if (!strcasecmp (arr[i], "hscale")) |
269 | { |
273 | { |
270 | if (w == 0) w = windowScale; |
274 | if (w == 0) w = windowScale; |
271 | |
275 | |
… | |
… | |
292 | x = y = centerAlign; |
296 | x = y = centerAlign; |
293 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
297 | geom_flags |= WidthValue|HeightValue|XValue|YValue; |
294 | } |
298 | } |
295 | else if (!strcasecmp (arr[i], "root")) |
299 | else if (!strcasecmp (arr[i], "root")) |
296 | { |
300 | { |
297 | new_flags |= rootAlign; |
301 | new_flags |= BG_ROOT_ALIGN; |
298 | w = h = noScale; |
302 | w = h = noScale; |
299 | geom_flags |= WidthValue|HeightValue; |
303 | geom_flags |= WidthValue|HeightValue; |
300 | } |
304 | } |
301 | } /* done parsing ops */ |
305 | } /* done parsing ops */ |
302 | |
306 | |
… | |
… | |
321 | rxvt_term::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
325 | rxvt_term::get_image_geometry (int image_width, int image_height, int &w, int &h, int &x, int &y) |
322 | { |
326 | { |
323 | int target_width = szHint.width; |
327 | int target_width = szHint.width; |
324 | int target_height = szHint.height; |
328 | int target_height = szHint.height; |
325 | |
329 | |
326 | if (bg_flags & propScale) |
330 | if (bg_flags & BG_PROP_SCALE) |
327 | { |
331 | { |
328 | float scale = (float)target_width / image_width; |
332 | float scale = (float)target_width / image_width; |
329 | min_it (scale, (float)target_height / image_height); |
333 | min_it (scale, (float)target_height / image_height); |
330 | w = image_width * scale + 0.5; |
334 | w = image_width * scale + 0.5; |
331 | h = image_height * scale + 0.5; |
335 | h = image_height * scale + 0.5; |
… | |
… | |
337 | } |
341 | } |
338 | |
342 | |
339 | if (!w) w = image_width; |
343 | if (!w) w = image_width; |
340 | if (!h) h = image_height; |
344 | if (!h) h = image_height; |
341 | |
345 | |
342 | if (bg_flags & rootAlign) |
346 | if (bg_flags & BG_ROOT_ALIGN) |
343 | { |
347 | { |
344 | x = -target_x; |
348 | x = -target_x; |
345 | y = -target_y; |
349 | y = -target_y; |
346 | } |
350 | } |
347 | else |
351 | else |
348 | { |
352 | { |
349 | x = make_align_position (h_align, target_width, w); |
353 | x = make_align_position (h_align, target_width, w); |
350 | y = make_align_position (v_align, target_height, h); |
354 | y = make_align_position (v_align, target_height, h); |
351 | } |
355 | } |
352 | |
356 | |
353 | bg_flags &= ~sizeSensitive; |
357 | bg_flags &= ~BG_IS_SIZE_SENSITIVE; |
354 | if ((bg_flags & propScale) || h_scale || v_scale |
358 | if ((bg_flags & BG_PROP_SCALE) || h_scale || v_scale |
355 | || (!(bg_flags & rootAlign) && (h_align || v_align)) |
359 | || (!(bg_flags & BG_ROOT_ALIGN) && (h_align || v_align)) |
356 | || w > target_width || h > target_height) |
360 | || w > target_width || h > target_height) |
357 | bg_flags |= sizeSensitive; |
361 | bg_flags |= BG_IS_SIZE_SENSITIVE; |
358 | } |
362 | } |
359 | |
363 | |
360 | # ifdef HAVE_AFTERIMAGE |
364 | # ifdef HAVE_AFTERIMAGE |
361 | bool |
365 | bool |
362 | rxvt_term::render_image (unsigned long tr_flags) |
366 | rxvt_term::render_image (unsigned long tr_flags) |
… | |
… | |
368 | |
372 | |
369 | # ifdef ENABLE_TRANSPARENCY |
373 | # ifdef ENABLE_TRANSPARENCY |
370 | if (tr_flags) |
374 | if (tr_flags) |
371 | background = pixmap2ximage (asv, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, 100); |
375 | background = pixmap2ximage (asv, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, 100); |
372 | |
376 | |
373 | if (tr_flags & tintNeeded) |
377 | if (tr_flags & BG_NEEDS_TINT) |
374 | { |
378 | { |
375 | ShadingInfo as_shade; |
379 | ShadingInfo as_shade; |
376 | as_shade.shading = shade; |
380 | as_shade.shading = shade; |
377 | |
381 | |
378 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
382 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
379 | if (bg_flags & tintSet) |
383 | if (bg_flags & BG_TINT_SET) |
380 | tint.get (c); |
384 | tint.get (c); |
381 | as_shade.tintColor.red = c.r; |
385 | as_shade.tintColor.red = c.r; |
382 | as_shade.tintColor.green = c.g; |
386 | as_shade.tintColor.green = c.g; |
383 | as_shade.tintColor.blue = c.b; |
387 | as_shade.tintColor.blue = c.b; |
384 | |
388 | |
385 | background_tint = shading2tint32 (&as_shade); |
389 | background_tint = shading2tint32 (&as_shade); |
386 | } |
390 | } |
387 | |
391 | |
388 | if ((tr_flags & blurNeeded) && background != NULL) |
392 | if ((tr_flags & BG_NEEDS_BLUR) && background != NULL) |
389 | { |
393 | { |
390 | ASImage *tmp = blur_asimage_gauss (asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
394 | ASImage *tmp = blur_asimage_gauss (asv, background, h_blurRadius, v_blurRadius, 0xFFFFFFFF, |
391 | (original_asim == NULL || tint == TINT_LEAVE_SAME) ? ASA_XImage : ASA_ASImage, |
395 | (original_asim == NULL || tint == TINT_LEAVE_SAME) ? ASA_XImage : ASA_ASImage, |
392 | 100, ASIMAGE_QUALITY_DEFAULT); |
396 | 100, ASIMAGE_QUALITY_DEFAULT); |
393 | if (tmp) |
397 | if (tmp) |
… | |
… | |
412 | |
416 | |
413 | if (original_asim) |
417 | if (original_asim) |
414 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
418 | get_image_geometry (original_asim->width, original_asim->height, w, h, x, y); |
415 | |
419 | |
416 | if (!original_asim |
420 | if (!original_asim |
417 | || (!(bg_flags & rootAlign) |
421 | || (!(bg_flags & BG_ROOT_ALIGN) |
418 | && (x >= target_width |
422 | && (x >= target_width |
419 | || y >= target_height |
423 | || y >= target_height |
420 | || (x + w <= 0) |
424 | || (x + w <= 0) |
421 | || (y + h <= 0)))) |
425 | || (y + h <= 0)))) |
422 | { |
426 | { |
… | |
… | |
682 | { |
686 | { |
683 | if (!pixbuf) |
687 | if (!pixbuf) |
684 | return false; |
688 | return false; |
685 | |
689 | |
686 | if (tr_flags |
690 | if (tr_flags |
687 | && !(bg_flags & HAS_RENDER)) |
691 | && !(bg_flags & BG_HAS_RENDER)) |
688 | return false; |
692 | return false; |
689 | |
693 | |
690 | GdkPixbuf *result; |
694 | GdkPixbuf *result; |
691 | |
695 | |
692 | int image_width = gdk_pixbuf_get_width (pixbuf); |
696 | int image_width = gdk_pixbuf_get_width (pixbuf); |
… | |
… | |
702 | int w = 0; |
706 | int w = 0; |
703 | int h = 0; |
707 | int h = 0; |
704 | |
708 | |
705 | get_image_geometry (image_width, image_height, w, h, x, y); |
709 | get_image_geometry (image_width, image_height, w, h, x, y); |
706 | |
710 | |
707 | if (!(bg_flags & rootAlign) |
711 | if (!(bg_flags & BG_ROOT_ALIGN) |
708 | && (x >= target_width |
712 | && (x >= target_width |
709 | || y >= target_height |
713 | || y >= target_height |
710 | || (x + w <= 0) |
714 | || (x + w <= 0) |
711 | || (y + h <= 0))) |
715 | || (y + h <= 0))) |
712 | return false; |
716 | return false; |
… | |
… | |
868 | if (image) |
872 | if (image) |
869 | { |
873 | { |
870 | if (original_asim) |
874 | if (original_asim) |
871 | safe_asimage_destroy (original_asim); |
875 | safe_asimage_destroy (original_asim); |
872 | original_asim = image; |
876 | original_asim = image; |
873 | bg_flags |= CLIENT_RENDER; |
877 | bg_flags |= BG_IS_FROM_FILE | BG_CLIENT_RENDER; |
874 | have_image = true; |
|
|
875 | return true; |
878 | return true; |
876 | } |
879 | } |
877 | # endif |
880 | # endif |
878 | |
881 | |
879 | # ifdef HAVE_PIXBUF |
882 | # ifdef HAVE_PIXBUF |
… | |
… | |
881 | if (image) |
884 | if (image) |
882 | { |
885 | { |
883 | if (pixbuf) |
886 | if (pixbuf) |
884 | g_object_unref (pixbuf); |
887 | g_object_unref (pixbuf); |
885 | pixbuf = image; |
888 | pixbuf = image; |
886 | have_image = true; |
889 | bg_flags |= BG_IS_FROM_FILE; |
887 | return true; |
890 | return true; |
888 | } |
891 | } |
889 | # endif |
892 | # endif |
890 | |
893 | |
891 | return false; |
894 | return false; |
… | |
… | |
895 | |
898 | |
896 | # ifdef ENABLE_TRANSPARENCY |
899 | # ifdef ENABLE_TRANSPARENCY |
897 | bool |
900 | bool |
898 | rxvt_term::bg_set_transparent () |
901 | rxvt_term::bg_set_transparent () |
899 | { |
902 | { |
900 | if (!(bg_flags & isTransparent)) |
903 | if (!(bg_flags & BG_IS_TRANSPARENT)) |
901 | { |
904 | { |
902 | bg_flags |= isTransparent; |
905 | bg_flags |= BG_IS_TRANSPARENT; |
903 | return true; |
906 | return true; |
904 | } |
907 | } |
905 | |
908 | |
906 | return false; |
909 | return false; |
907 | } |
910 | } |
… | |
… | |
933 | changed = true; |
936 | changed = true; |
934 | v_blurRadius = vr; |
937 | v_blurRadius = vr; |
935 | } |
938 | } |
936 | |
939 | |
937 | if (v_blurRadius == 0 && h_blurRadius == 0) |
940 | if (v_blurRadius == 0 && h_blurRadius == 0) |
938 | bg_flags &= ~blurNeeded; |
941 | bg_flags &= ~BG_NEEDS_BLUR; |
939 | else |
942 | else |
940 | bg_flags |= blurNeeded; |
943 | bg_flags |= BG_NEEDS_BLUR; |
941 | |
944 | |
942 | return changed; |
945 | return changed; |
943 | } |
946 | } |
944 | |
947 | |
945 | static inline unsigned long |
948 | static inline unsigned long |
… | |
… | |
954 | tint->get (c); |
957 | tint->get (c); |
955 | if (!has_shade |
958 | if (!has_shade |
956 | && (c.r <= 0x00ff || c.r >= 0xff00) |
959 | && (c.r <= 0x00ff || c.r >= 0xff00) |
957 | && (c.g <= 0x00ff || c.g >= 0xff00) |
960 | && (c.g <= 0x00ff || c.g >= 0xff00) |
958 | && (c.b <= 0x00ff || c.b >= 0xff00)) |
961 | && (c.b <= 0x00ff || c.b >= 0xff00)) |
959 | flags |= rxvt_term::tintWholesome; |
962 | flags |= rxvt_term::BG_TINT_BITAND; |
960 | } |
963 | } |
961 | |
964 | |
962 | if (has_shade || tint) |
965 | if (has_shade || tint) |
963 | flags |= rxvt_term::tintNeeded; |
966 | flags |= rxvt_term::BG_NEEDS_TINT; |
964 | |
967 | |
965 | return flags; |
968 | return flags; |
966 | } |
969 | } |
967 | |
970 | |
968 | bool |
971 | bool |
969 | rxvt_term::bg_set_tint (rxvt_color &new_tint) |
972 | rxvt_term::bg_set_tint (rxvt_color &new_tint) |
970 | { |
973 | { |
971 | if (!(bg_flags & tintSet) || tint != new_tint) |
974 | if (!(bg_flags & BG_TINT_SET) || tint != new_tint) |
972 | { |
975 | { |
973 | unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); |
976 | unsigned long new_flags = compute_tint_shade_flags (&new_tint, shade); |
974 | tint = new_tint; |
977 | tint = new_tint; |
975 | bg_flags = (bg_flags & ~tintFlags) | new_flags | tintSet; |
978 | bg_flags = (bg_flags & ~BG_TINT_FLAGS) | new_flags | BG_TINT_SET; |
976 | return true; |
979 | return true; |
977 | } |
980 | } |
978 | |
981 | |
979 | return false; |
982 | return false; |
980 | } |
983 | } |
… | |
… | |
988 | if (new_shade < 0) |
991 | if (new_shade < 0) |
989 | new_shade = 200 - (100 + new_shade); |
992 | new_shade = 200 - (100 + new_shade); |
990 | |
993 | |
991 | if (new_shade != shade) |
994 | if (new_shade != shade) |
992 | { |
995 | { |
993 | unsigned long new_flags = compute_tint_shade_flags ((bg_flags & tintSet) ? &tint : NULL, new_shade); |
996 | unsigned long new_flags = compute_tint_shade_flags ((bg_flags & BG_TINT_SET) ? &tint : NULL, new_shade); |
994 | shade = new_shade; |
997 | shade = new_shade; |
995 | bg_flags = (bg_flags & ~tintFlags) | new_flags; |
998 | bg_flags = (bg_flags & ~BG_TINT_FLAGS) | new_flags; |
996 | return true; |
999 | return true; |
997 | } |
1000 | } |
998 | |
1001 | |
999 | return false; |
1002 | return false; |
1000 | } |
1003 | } |
… | |
… | |
1088 | bool |
1091 | bool |
1089 | rxvt_term::tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height) |
1092 | rxvt_term::tint_pixmap (Pixmap pixmap, Visual *visual, int width, int height) |
1090 | { |
1093 | { |
1091 | bool ret = false; |
1094 | bool ret = false; |
1092 | |
1095 | |
1093 | if (bg_flags & tintWholesome) |
1096 | if (bg_flags & BG_TINT_BITAND) |
1094 | { |
1097 | { |
1095 | XGCValues gcv; |
1098 | XGCValues gcv; |
1096 | GC gc; |
1099 | GC gc; |
1097 | |
1100 | |
1098 | /* In this case we can tint image server-side getting significant |
1101 | /* In this case we can tint image server-side getting significant |
… | |
… | |
1112 | else |
1115 | else |
1113 | { |
1116 | { |
1114 | # if XRENDER |
1117 | # if XRENDER |
1115 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1118 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1116 | |
1119 | |
1117 | if (bg_flags & tintSet) |
1120 | if (bg_flags & BG_TINT_SET) |
1118 | tint.get (c); |
1121 | tint.get (c); |
1119 | |
1122 | |
1120 | if (shade <= 100) |
1123 | if (shade <= 100) |
1121 | { |
1124 | { |
1122 | c.r = (c.r * shade) / 100; |
1125 | c.r = (c.r * shade) / 100; |
… | |
… | |
1233 | Pixmap recoded_root_pmap = root_pixmap; |
1236 | Pixmap recoded_root_pmap = root_pixmap; |
1234 | |
1237 | |
1235 | if (root_pixmap != None && root_depth != depth) |
1238 | if (root_pixmap != None && root_depth != depth) |
1236 | { |
1239 | { |
1237 | #if XRENDER |
1240 | #if XRENDER |
1238 | if (bg_flags & HAS_RENDER) |
1241 | if (bg_flags & BG_HAS_RENDER) |
1239 | { |
1242 | { |
1240 | XRenderPictureAttributes pa; |
1243 | XRenderPictureAttributes pa; |
1241 | |
1244 | |
1242 | XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen)); |
1245 | XRenderPictFormat *src_format = XRenderFindVisualFormat (dpy, DefaultVisual (dpy, screen)); |
1243 | Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, &pa); |
1246 | Picture src = XRenderCreatePicture (dpy, root_pixmap, src_format, 0, &pa); |
… | |
… | |
1290 | gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1293 | gc = XCreateGC (dpy, vt, GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin, &gcv); |
1291 | |
1294 | |
1292 | if (gc) |
1295 | if (gc) |
1293 | { |
1296 | { |
1294 | XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height); |
1297 | XFillRectangle (dpy, bg_pixmap, gc, 0, 0, window_width, window_height); |
1295 | result |= isValid | (bg_flags & effectsFlags); |
1298 | result |= BG_IS_VALID | (bg_flags & BG_EFFECTS_FLAGS); |
1296 | XFreeGC (dpy, gc); |
1299 | XFreeGC (dpy, gc); |
1297 | |
1300 | |
1298 | if (!(bg_flags & CLIENT_RENDER)) |
1301 | if (!(bg_flags & BG_CLIENT_RENDER)) |
1299 | { |
1302 | { |
1300 | if ((bg_flags & blurNeeded) |
1303 | if ((bg_flags & BG_NEEDS_BLUR) |
1301 | && (bg_flags & HAS_RENDER_CONV)) |
1304 | && (bg_flags & BG_HAS_RENDER_CONV)) |
1302 | { |
1305 | { |
1303 | if (blur_pixmap (bg_pixmap, visual, window_width, window_height)) |
1306 | if (blur_pixmap (bg_pixmap, visual, window_width, window_height)) |
1304 | result &= ~blurNeeded; |
1307 | result &= ~BG_NEEDS_BLUR; |
1305 | } |
1308 | } |
1306 | if ((bg_flags & tintNeeded) |
1309 | if ((bg_flags & BG_NEEDS_TINT) |
1307 | && (bg_flags & (tintWholesome | HAS_RENDER))) |
1310 | && (bg_flags & (BG_TINT_BITAND | BG_HAS_RENDER))) |
1308 | { |
1311 | { |
1309 | if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) |
1312 | if (tint_pixmap (bg_pixmap, visual, window_width, window_height)) |
1310 | result &= ~tintNeeded; |
1313 | result &= ~BG_NEEDS_TINT; |
1311 | } |
1314 | } |
1312 | } /* server side rendering completed */ |
1315 | } /* server side rendering completed */ |
1313 | } |
1316 | } |
1314 | |
1317 | |
1315 | if (recoded_root_pmap != root_pixmap) |
1318 | if (recoded_root_pmap != root_pixmap) |
… | |
… | |
1338 | { |
1341 | { |
1339 | unsigned long tr_flags = 0; |
1342 | unsigned long tr_flags = 0; |
1340 | |
1343 | |
1341 | bg_invalidate (); |
1344 | bg_invalidate (); |
1342 | # ifdef ENABLE_TRANSPARENCY |
1345 | # ifdef ENABLE_TRANSPARENCY |
1343 | if (bg_flags & isTransparent) |
1346 | if (bg_flags & BG_IS_TRANSPARENT) |
1344 | { |
1347 | { |
1345 | /* we need to re-generate transparency pixmap in that case ! */ |
1348 | /* we need to re-generate transparency pixmap in that case ! */ |
1346 | tr_flags = make_transparency_pixmap (); |
1349 | tr_flags = make_transparency_pixmap (); |
1347 | if (tr_flags == 0) |
1350 | if (tr_flags == 0) |
1348 | return false; |
1351 | return false; |
1349 | else if (!(tr_flags & effectsFlags)) |
1352 | else if (!(tr_flags & BG_EFFECTS_FLAGS)) |
1350 | bg_flags |= isValid; |
1353 | bg_flags |= BG_IS_VALID; |
1351 | } |
1354 | } |
1352 | # endif |
1355 | # endif |
1353 | |
1356 | |
1354 | # ifdef BG_IMAGE_FROM_FILE |
1357 | # ifdef BG_IMAGE_FROM_FILE |
1355 | if (have_image |
1358 | if ((bg_flags & BG_IS_FROM_FILE) |
1356 | || (tr_flags & effectsFlags)) |
1359 | || (tr_flags & BG_EFFECTS_FLAGS)) |
1357 | { |
1360 | { |
1358 | if (render_image (tr_flags)) |
1361 | if (render_image (tr_flags)) |
1359 | bg_flags |= isValid; |
1362 | bg_flags |= BG_IS_VALID; |
1360 | } |
1363 | } |
1361 | # endif |
1364 | # endif |
1362 | |
1365 | |
1363 | # if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1366 | # if defined(ENABLE_TRANSPARENCY) && !defined(HAVE_AFTERIMAGE) |
1364 | XImage *result = NULL; |
1367 | XImage *result = NULL; |
1365 | |
1368 | |
1366 | if (tr_flags && !(bg_flags & isValid)) |
1369 | if (tr_flags && !(bg_flags & BG_IS_VALID)) |
1367 | { |
1370 | { |
1368 | result = XGetImage (dpy, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, ZPixmap); |
1371 | result = XGetImage (dpy, bg_pixmap, 0, 0, bg_pmap_width, bg_pmap_height, AllPlanes, ZPixmap); |
1369 | } |
1372 | } |
1370 | |
1373 | |
1371 | if (result) |
1374 | if (result) |
1372 | { |
1375 | { |
1373 | /* our own client-side tinting */ |
1376 | /* our own client-side tinting */ |
1374 | if (tr_flags & tintNeeded) |
1377 | if (tr_flags & BG_NEEDS_TINT) |
1375 | { |
1378 | { |
1376 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1379 | rgba c (rgba::MAX_CC,rgba::MAX_CC,rgba::MAX_CC); |
1377 | if (bg_flags & tintSet) |
1380 | if (bg_flags & BG_TINT_SET) |
1378 | tint.get (c); |
1381 | tint.get (c); |
1379 | shade_ximage (DefaultVisual (dpy, display->screen), result, shade, c); |
1382 | shade_ximage (DefaultVisual (dpy, display->screen), result, shade, c); |
1380 | } |
1383 | } |
1381 | |
1384 | |
1382 | GC gc = XCreateGC (dpy, vt, 0UL, NULL); |
1385 | GC gc = XCreateGC (dpy, vt, 0UL, NULL); |
… | |
… | |
1384 | if (gc) |
1387 | if (gc) |
1385 | { |
1388 | { |
1386 | XPutImage (dpy, bg_pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
1389 | XPutImage (dpy, bg_pixmap, gc, result, 0, 0, 0, 0, result->width, result->height); |
1387 | |
1390 | |
1388 | XFreeGC (dpy, gc); |
1391 | XFreeGC (dpy, gc); |
1389 | bg_flags |= isValid; |
1392 | bg_flags |= BG_IS_VALID; |
1390 | } |
1393 | } |
1391 | |
1394 | |
1392 | XDestroyImage (result); |
1395 | XDestroyImage (result); |
1393 | } |
1396 | } |
1394 | # endif |
1397 | # endif |
1395 | |
1398 | |
1396 | if (!(bg_flags & isValid)) |
1399 | if (!(bg_flags & BG_IS_VALID)) |
1397 | { |
1400 | { |
1398 | if (bg_pixmap != None) |
1401 | if (bg_pixmap != None) |
1399 | { |
1402 | { |
1400 | XFreePixmap (dpy, bg_pixmap); |
1403 | XFreePixmap (dpy, bg_pixmap); |
1401 | bg_pixmap = None; |
1404 | bg_pixmap = None; |
1402 | } |
1405 | } |
1403 | } |
1406 | } |
1404 | |
1407 | |
1405 | scr_recolour (false); |
1408 | scr_recolour (false); |
1406 | bg_flags |= hasChanged; |
1409 | bg_flags |= BG_NEEDS_REFRESH; |
1407 | |
1410 | |
1408 | bg_valid_since = ev::now (); |
1411 | bg_valid_since = ev::now (); |
1409 | |
1412 | |
1410 | return true; |
1413 | return true; |
1411 | } |
1414 | } |
… | |
… | |
1415 | { |
1418 | { |
1416 | #ifdef ENABLE_TRANSPARENCY |
1419 | #ifdef ENABLE_TRANSPARENCY |
1417 | shade = 100; |
1420 | shade = 100; |
1418 | #endif |
1421 | #endif |
1419 | |
1422 | |
1420 | bg_flags &= ~(HAS_RENDER | HAS_RENDER_CONV); |
1423 | bg_flags &= ~(BG_HAS_RENDER | BG_HAS_RENDER_CONV); |
1421 | #if XRENDER |
1424 | #if XRENDER |
1422 | int major, minor; |
1425 | int major, minor; |
1423 | if (XRenderQueryVersion (dpy, &major, &minor)) |
1426 | if (XRenderQueryVersion (dpy, &major, &minor)) |
1424 | bg_flags |= HAS_RENDER; |
1427 | bg_flags |= BG_HAS_RENDER; |
1425 | XFilters *filters = XRenderQueryFilters (dpy, vt); |
1428 | XFilters *filters = XRenderQueryFilters (dpy, vt); |
1426 | if (filters) |
1429 | if (filters) |
1427 | { |
1430 | { |
1428 | for (int i = 0; i < filters->nfilter; i++) |
1431 | for (int i = 0; i < filters->nfilter; i++) |
1429 | if (!strcmp (filters->filter[i], FilterConvolution)) |
1432 | if (!strcmp (filters->filter[i], FilterConvolution)) |
1430 | bg_flags |= HAS_RENDER_CONV; |
1433 | bg_flags |= BG_HAS_RENDER_CONV; |
1431 | |
1434 | |
1432 | XFree (filters); |
1435 | XFree (filters); |
1433 | } |
1436 | } |
1434 | #endif |
1437 | #endif |
1435 | } |
1438 | } |