… | |
… | |
28 | #ifdef HAVE_BG_PIXMAP |
28 | #ifdef HAVE_BG_PIXMAP |
29 | |
29 | |
30 | void |
30 | void |
31 | rxvt_term::bg_destroy () |
31 | rxvt_term::bg_destroy () |
32 | { |
32 | { |
33 | # if ENABLE_TRANSPARENCY |
33 | # if BG_IMAGE_FROM_ROOT |
34 | delete root_img; |
34 | delete root_img; |
35 | root_img = 0; |
35 | root_img = 0; |
36 | # endif |
36 | # endif |
37 | |
37 | |
38 | # if BG_IMAGE_FROM_FILE |
38 | # if BG_IMAGE_FROM_FILE |
39 | fimage.destroy (); |
39 | fimage.destroy (); |
40 | # endif |
40 | # endif |
41 | |
|
|
42 | delete bg_img; |
|
|
43 | bg_img = 0; |
|
|
44 | } |
41 | } |
45 | |
42 | |
46 | bool |
43 | bool |
47 | rxvt_term::bg_window_size_sensitive () |
44 | rxvt_term::bg_window_size_sensitive () |
48 | { |
45 | { |
49 | # if ENABLE_TRANSPARENCY |
46 | # if BG_IMAGE_FROM_ROOT |
50 | if (bg_flags & BG_IS_TRANSPARENT) |
47 | if (root_img) |
51 | return true; |
48 | return true; |
52 | # endif |
49 | # endif |
53 | |
50 | |
54 | # if BG_IMAGE_FROM_FILE |
51 | # if BG_IMAGE_FROM_FILE |
55 | if (fimage.img) |
52 | if (fimage.img) |
… | |
… | |
65 | } |
62 | } |
66 | |
63 | |
67 | bool |
64 | bool |
68 | rxvt_term::bg_window_position_sensitive () |
65 | rxvt_term::bg_window_position_sensitive () |
69 | { |
66 | { |
70 | # if ENABLE_TRANSPARENCY |
67 | # if BG_IMAGE_FROM_ROOT |
71 | if (bg_flags & BG_IS_TRANSPARENT) |
68 | if (root_img) |
72 | return true; |
69 | return true; |
73 | # endif |
70 | # endif |
74 | |
71 | |
75 | # if BG_IMAGE_FROM_FILE |
72 | # if BG_IMAGE_FROM_FILE |
76 | if (fimage.img) |
73 | if (fimage.img) |
… | |
… | |
318 | img->repeat_mode (RepeatNormal); |
315 | img->repeat_mode (RepeatNormal); |
319 | else |
316 | else |
320 | img->repeat_mode (RepeatNone); |
317 | img->repeat_mode (RepeatNone); |
321 | img->sub_rect (-x, -y, parent_width, parent_height)->replace (img); |
318 | img->sub_rect (-x, -y, parent_width, parent_height)->replace (img); |
322 | |
319 | |
323 | if (bg_flags & BG_IS_VALID) |
320 | if (bg_img) |
324 | bg_img->draw (img, PictOpOver, image.alpha * 1. / 0xffff); |
321 | img->draw (bg_img, PictOpOver, image.alpha * 1. / 0xffff); |
325 | |
322 | |
326 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
323 | XRenderPictFormat *format = XRenderFindVisualFormat (dpy, visual); |
327 | img->convert_format (format, pix_colors [Color_bg])->replace (img); |
324 | img->convert_format (format, pix_colors [Color_bg])->replace (img); |
328 | |
325 | |
329 | delete bg_img; |
326 | delete bg_img; |
… | |
… | |
437 | } |
434 | } |
438 | |
435 | |
439 | return false; |
436 | return false; |
440 | } |
437 | } |
441 | |
438 | |
442 | # if ENABLE_TRANSPARENCY |
439 | # if BG_IMAGE_FROM_ROOT |
443 | /* |
440 | /* |
444 | * Builds a pixmap of the same size as the terminal window that contains |
441 | * Builds a pixmap of the same size as the terminal window that contains |
445 | * the tiled portion of the root pixmap that is supposed to be covered by |
442 | * the tiled portion of the root pixmap that is supposed to be covered by |
446 | * our window. |
443 | * our window. |
447 | */ |
444 | */ |
… | |
… | |
459 | int sx, sy; |
456 | int sx, sy; |
460 | |
457 | |
461 | sx = parent_x; |
458 | sx = parent_x; |
462 | sy = parent_y; |
459 | sy = parent_y; |
463 | |
460 | |
464 | if (!root_img) |
|
|
465 | return false; |
|
|
466 | |
|
|
467 | /* check if we are outside of the visible part of the virtual screen : */ |
461 | /* check if we are outside of the visible part of the virtual screen : */ |
468 | if (sx + parent_width <= 0 || sy + parent_height <= 0 |
462 | if (sx + parent_width <= 0 || sy + parent_height <= 0 |
469 | || sx >= root_width || sy >= root_height) |
463 | || sx >= root_width || sy >= root_height) |
470 | return 0; |
464 | return 0; |
471 | |
465 | |
… | |
… | |
493 | rxvt_term::bg_set_root_pixmap () |
487 | rxvt_term::bg_set_root_pixmap () |
494 | { |
488 | { |
495 | delete root_img; |
489 | delete root_img; |
496 | root_img = rxvt_img::new_from_root (this); |
490 | root_img = rxvt_img::new_from_root (this); |
497 | } |
491 | } |
498 | # endif /* ENABLE_TRANSPARENCY */ |
492 | # endif /* BG_IMAGE_FROM_ROOT */ |
499 | |
493 | |
500 | void |
494 | void |
501 | rxvt_term::bg_render () |
495 | rxvt_term::bg_render () |
502 | { |
496 | { |
503 | if (bg_flags & BG_INHIBIT_RENDER) |
497 | if (bg_flags & BG_INHIBIT_RENDER) |
504 | return; |
498 | return; |
505 | |
499 | |
506 | bg_invalidate (); |
500 | delete bg_img; |
507 | # if ENABLE_TRANSPARENCY |
501 | bg_img = 0; |
508 | if (bg_flags & BG_IS_TRANSPARENT) |
502 | bg_flags = 0; |
509 | { |
503 | |
510 | /* we need to re-generate transparency pixmap in that case ! */ |
504 | if (!mapped) |
|
|
505 | return; |
|
|
506 | |
|
|
507 | # if BG_IMAGE_FROM_ROOT |
|
|
508 | if (root_img) |
511 | if (render_root_image ()) |
509 | if (render_root_image ()) |
512 | bg_flags |= BG_IS_VALID; |
510 | bg_flags |= BG_IS_TRANSPARENT; |
513 | } |
|
|
514 | # endif |
511 | # endif |
515 | |
512 | |
516 | # if BG_IMAGE_FROM_FILE |
513 | # if BG_IMAGE_FROM_FILE |
517 | if (fimage.img) |
514 | if (fimage.img) |
518 | { |
|
|
519 | if (render_image (fimage)) |
515 | render_image (fimage); |
520 | bg_flags |= BG_IS_VALID; |
|
|
521 | } |
|
|
522 | # endif |
516 | # endif |
523 | |
|
|
524 | if (!(bg_flags & BG_IS_VALID)) |
|
|
525 | { |
|
|
526 | delete bg_img; |
|
|
527 | bg_img = 0; |
|
|
528 | } |
|
|
529 | |
517 | |
530 | scr_recolour (false); |
518 | scr_recolour (false); |
531 | bg_flags |= BG_NEEDS_REFRESH; |
519 | bg_flags |= BG_NEEDS_REFRESH; |
532 | |
520 | |
533 | bg_valid_since = ev::now (); |
521 | bg_valid_since = ev::now (); |
534 | } |
522 | } |
535 | |
523 | |
536 | void |
524 | void |
537 | rxvt_term::bg_init () |
525 | rxvt_term::bg_init () |
538 | { |
526 | { |
539 | #if ENABLE_TRANSPARENCY |
527 | #if BG_IMAGE_FROM_ROOT |
540 | if (option (Opt_transparent)) |
528 | if (option (Opt_transparent)) |
541 | { |
529 | { |
542 | bg_set_transparent (); |
|
|
543 | |
|
|
544 | if (rs [Rs_blurradius]) |
530 | if (rs [Rs_blurradius]) |
545 | root_effects.set_blur (rs [Rs_blurradius]); |
531 | root_effects.set_blur (rs [Rs_blurradius]); |
546 | |
532 | |
547 | if (ISSET_PIXCOLOR (Color_tint)) |
533 | if (ISSET_PIXCOLOR (Color_tint)) |
548 | root_effects.set_tint (pix_colors_focused [Color_tint]); |
534 | root_effects.set_tint (pix_colors_focused [Color_tint]); |