… | |
… | |
58 | # endif |
58 | # endif |
59 | |
59 | |
60 | void |
60 | void |
61 | rxvt_term::bg_destroy () |
61 | rxvt_term::bg_destroy () |
62 | { |
62 | { |
|
|
63 | # ifdef BG_IMAGE_FROM_FILE |
|
|
64 | for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++) |
|
|
65 | bg_image->destroy (); |
|
|
66 | # endif |
|
|
67 | |
63 | if (bg_pixmap) |
68 | if (bg_pixmap) |
64 | XFreePixmap (dpy, bg_pixmap); |
69 | XFreePixmap (dpy, bg_pixmap); |
65 | } |
70 | } |
66 | |
71 | |
67 | bool |
72 | bool |
… | |
… | |
614 | |
619 | |
615 | Picture mask = create_xrender_mask (dpy, vt, False, False); |
620 | Picture mask = create_xrender_mask (dpy, vt, False, False); |
616 | |
621 | |
617 | XRenderColor mask_c; |
622 | XRenderColor mask_c; |
618 | |
623 | |
619 | mask_c.alpha = gdk_pixbuf_get_has_alpha (image.pixbuf) ? 0xffff : image.alpha; |
624 | mask_c.alpha = image.alpha; |
620 | mask_c.red = |
625 | mask_c.red = |
621 | mask_c.green = |
626 | mask_c.green = |
622 | mask_c.blue = 0; |
627 | mask_c.blue = 0; |
623 | XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1); |
628 | XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1); |
624 | |
629 | |
… | |
… | |
669 | } |
674 | } |
670 | |
675 | |
671 | void |
676 | void |
672 | rxvt_term::parse_image (int id, const char *type, const char *arg) |
677 | rxvt_term::parse_image (int id, const char *type, const char *arg) |
673 | { |
678 | { |
674 | rxvt_image *image; |
679 | if (image_vec.size () < id + 1) |
|
|
680 | image_vec.resize (id + 1); |
675 | |
681 | |
676 | for (image = image_vec.begin (); image < image_vec.end (); image++) |
682 | rxvt_image *image = &image_vec[id]; |
677 | if (image->id == id) |
|
|
678 | break; |
|
|
679 | |
|
|
680 | if (image == image_vec.end ()) |
|
|
681 | { |
|
|
682 | image = new_image (); |
|
|
683 | image->id = id; |
|
|
684 | } |
|
|
685 | } |
683 | } |
686 | # endif |
684 | # endif |
687 | |
685 | |
688 | rxvt_image::rxvt_image () |
686 | rxvt_image::rxvt_image () |
689 | { |
687 | { |
690 | id = |
688 | alpha = 0xffff; |
691 | alpha = |
|
|
692 | flags = |
689 | flags = 0; |
693 | h_scale = |
690 | h_scale = |
694 | v_scale = |
691 | v_scale = defaultScale; |
695 | h_align = |
692 | h_align = |
696 | v_align = 0; |
693 | v_align = defaultAlign; |
697 | |
694 | |
698 | # ifdef HAVE_PIXBUF |
695 | # ifdef HAVE_PIXBUF |
699 | pixbuf.reset (0); |
696 | pixbuf = 0; |
700 | # endif |
697 | # endif |
701 | } |
698 | } |
702 | |
699 | |
703 | bool |
700 | bool |
704 | rxvt_image::set_file_geometry (const char *file) |
701 | rxvt_image::set_file_geometry (const char *file) |
… | |
… | |
717 | file = f; |
714 | file = f; |
718 | } |
715 | } |
719 | |
716 | |
720 | bool ret = set_file (file); |
717 | bool ret = set_file (file); |
721 | alpha = 0x8000; |
718 | alpha = 0x8000; |
722 | if (ret && p) |
719 | if (ret) |
723 | set_geometry (p + 1); |
720 | set_geometry (p ? p + 1 : ""); |
724 | return ret; |
721 | return ret; |
725 | } |
722 | } |
726 | |
723 | |
727 | bool |
724 | bool |
728 | rxvt_image::set_file (const char *file) |
725 | rxvt_image::set_file (const char *file) |
… | |
… | |
733 | GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL); |
730 | GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL); |
734 | if (image) |
731 | if (image) |
735 | { |
732 | { |
736 | if (pixbuf) |
733 | if (pixbuf) |
737 | g_object_unref (pixbuf); |
734 | g_object_unref (pixbuf); |
738 | pixbuf.reset (image); |
735 | pixbuf = image; |
739 | ret = true; |
736 | ret = true; |
740 | } |
737 | } |
741 | # endif |
738 | # endif |
742 | |
739 | |
743 | if (ret) |
740 | if (ret) |
744 | { |
741 | flags |= IM_IS_SET; |
745 | alpha = 0xffff; |
|
|
746 | flags = IM_IS_SET | IM_IS_SIZE_SENSITIVE; |
|
|
747 | h_scale = v_scale = defaultScale; |
|
|
748 | h_align = v_align = defaultAlign; |
|
|
749 | } |
|
|
750 | |
742 | |
751 | return ret; |
743 | return ret; |
752 | } |
744 | } |
753 | |
745 | |
754 | # endif /* BG_IMAGE_FROM_FILE */ |
746 | # endif /* BG_IMAGE_FROM_FILE */ |