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