ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/background.C
(Generate patch)

Comparing rxvt-unicode/src/background.C (file contents):
Revision 1.220 by sf-exg, Fri May 25 08:27:47 2012 UTC vs.
Revision 1.225 by sf-exg, Wed May 30 21:20:05 2012 UTC

58# endif 58# endif
59 59
60void 60void
61rxvt_term::bg_destroy () 61rxvt_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
67bool 72bool
298 h_align = x; 303 h_align = x;
299 v_align = y; 304 v_align = y;
300 changed = true; 305 changed = true;
301 } 306 }
302 307
303 if (!(flags & IM_TILE) 308 if (is_size_sensitive ())
304 || h_scale || v_scale
305 || (!(flags & IM_ROOT_ALIGN) && (h_align || v_align)))
306 flags |= IM_IS_SIZE_SENSITIVE; 309 flags |= IM_IS_SIZE_SENSITIVE;
307 else 310 else
308 flags &= ~IM_IS_SIZE_SENSITIVE; 311 flags &= ~IM_IS_SIZE_SENSITIVE;
309 312
310 return changed; 313 return changed;
614 617
615 Picture mask = create_xrender_mask (dpy, vt, False, False); 618 Picture mask = create_xrender_mask (dpy, vt, False, False);
616 619
617 XRenderColor mask_c; 620 XRenderColor mask_c;
618 621
619 mask_c.alpha = gdk_pixbuf_get_has_alpha (image.pixbuf) ? 0xffff : image.alpha; 622 mask_c.alpha = image.alpha;
620 mask_c.red = 623 mask_c.red =
621 mask_c.green = 624 mask_c.green =
622 mask_c.blue = 0; 625 mask_c.blue = 0;
623 XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1); 626 XRenderFillRectangle (dpy, PictOpSrc, mask, &mask_c, 0, 0, 1, 1);
624 627
669} 672}
670 673
671void 674void
672rxvt_term::parse_image (int id, const char *type, const char *arg) 675rxvt_term::parse_image (int id, const char *type, const char *arg)
673{ 676{
674 rxvt_image *image; 677 if (image_vec.size () < id + 1)
678 image_vec.resize (id + 1);
675 679
676 for (image = image_vec.begin (); image < image_vec.end (); image++) 680 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} 681}
686# endif 682# endif
687 683
688rxvt_image::rxvt_image () 684rxvt_image::rxvt_image ()
689{ 685{
690 id = 686 alpha = 0xffff;
691 alpha =
692 flags = 687 flags = 0;
693 h_scale = 688 h_scale =
694 v_scale = 689 v_scale = defaultScale;
695 h_align = 690 h_align =
696 v_align = 0; 691 v_align = defaultAlign;
697 692
698# ifdef HAVE_PIXBUF 693# ifdef HAVE_PIXBUF
699 pixbuf.reset (0); 694 pixbuf = 0;
700# endif 695# endif
701} 696}
702 697
703bool 698bool
704rxvt_image::set_file_geometry (const char *file) 699rxvt_image::set_file_geometry (const char *file)
717 file = f; 712 file = f;
718 } 713 }
719 714
720 bool ret = set_file (file); 715 bool ret = set_file (file);
721 alpha = 0x8000; 716 alpha = 0x8000;
722 if (ret && p) 717 if (ret)
723 set_geometry (p + 1); 718 set_geometry (p ? p + 1 : "");
724 return ret; 719 return ret;
725} 720}
726 721
727bool 722bool
728rxvt_image::set_file (const char *file) 723rxvt_image::set_file (const char *file)
733 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL); 728 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL);
734 if (image) 729 if (image)
735 { 730 {
736 if (pixbuf) 731 if (pixbuf)
737 g_object_unref (pixbuf); 732 g_object_unref (pixbuf);
738 pixbuf.reset (image); 733 pixbuf = image;
739 ret = true; 734 ret = true;
740 } 735 }
741# endif 736# endif
742 737
743 if (ret) 738 if (ret)
744 { 739 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 740
751 return ret; 741 return ret;
752} 742}
753 743
754# endif /* BG_IMAGE_FROM_FILE */ 744# endif /* BG_IMAGE_FROM_FILE */
1229 while (bg_image != image_vec.end ()) 1219 while (bg_image != image_vec.end ())
1230 { 1220 {
1231 if (!(bg_image->flags & IM_IS_SET)) 1221 if (!(bg_image->flags & IM_IS_SET))
1232 bg_image = image_vec.erase (bg_image); 1222 bg_image = image_vec.erase (bg_image);
1233 else 1223 else
1224 {
1225 if (bg_image->is_size_sensitive ())
1226 bg_image->flags |= IM_IS_SIZE_SENSITIVE;
1227
1234 bg_image++; 1228 bg_image++;
1229 }
1235 } 1230 }
1236# endif 1231# endif
1237 1232
1238 if (image_vec.size () > 0 1233 if (image_vec.size () > 0
1239 && !bg_window_position_sensitive ()) 1234 && !bg_window_position_sensitive ())

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines