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.231 by sf-exg, Sun Jun 3 17:48:28 2012 UTC vs.
Revision 1.232 by root, Mon Jun 4 15:18:52 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 63# if BG_IMAGE_FROM_FILE
64 for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++) 64 for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++)
65 bg_image->destroy (); 65 bg_image->destroy ();
66# endif 66# endif
67 67
68 if (bg_pixmap) 68 if (bg_pixmap)
84} 84}
85 85
86bool 86bool
87rxvt_term::bg_window_size_sensitive () 87rxvt_term::bg_window_size_sensitive ()
88{ 88{
89# ifdef ENABLE_TRANSPARENCY 89# if ENABLE_TRANSPARENCY
90 if (bg_flags & BG_IS_TRANSPARENT) 90 if (bg_flags & BG_IS_TRANSPARENT)
91 return true; 91 return true;
92# endif 92# endif
93 93
94# ifdef BG_IMAGE_FROM_FILE 94# if BG_IMAGE_FROM_FILE
95 for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++) 95 for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++)
96 { 96 {
97 if ((bg_image->flags & IM_IS_SIZE_SENSITIVE) 97 if ((bg_image->flags & IM_IS_SIZE_SENSITIVE)
98 || bg_image->width () > szHint.width 98 || bg_image->width () > szHint.width
99 || bg_image->height () > szHint.height) 99 || bg_image->height () > szHint.height)
105} 105}
106 106
107bool 107bool
108rxvt_term::bg_window_position_sensitive () 108rxvt_term::bg_window_position_sensitive ()
109{ 109{
110# ifdef ENABLE_TRANSPARENCY 110# if ENABLE_TRANSPARENCY
111 if (bg_flags & BG_IS_TRANSPARENT) 111 if (bg_flags & BG_IS_TRANSPARENT)
112 return true; 112 return true;
113# endif 113# endif
114 114
115# ifdef BG_IMAGE_FROM_FILE 115# if BG_IMAGE_FROM_FILE
116 for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++) 116 for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++)
117 { 117 {
118 if (bg_image->flags & IM_ROOT_ALIGN) 118 if (bg_image->flags & IM_ROOT_ALIGN)
119 return true; 119 return true;
120 } 120 }
121# endif 121# endif
122 122
123 return false; 123 return false;
124} 124}
125 125
126# ifdef BG_IMAGE_FROM_FILE 126# if BG_IMAGE_FROM_FILE
127static inline int 127static inline int
128make_align_position (int align, int window_size, int image_size) 128make_align_position (int align, int window_size, int image_size)
129{ 129{
130 if (align >= 0 && align <= 100) 130 if (align >= 0 && align <= 100)
131 return lerp (0, window_size - image_size, align); 131 return lerp (0, window_size - image_size, align);
347 x = make_align_position (image.h_align, target_width, w); 347 x = make_align_position (image.h_align, target_width, w);
348 y = make_align_position (image.v_align, target_height, h); 348 y = make_align_position (image.v_align, target_height, h);
349 } 349 }
350} 350}
351 351
352# ifdef HAVE_PIXBUF 352# if HAVE_PIXBUF
353bool 353bool
354rxvt_term::pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc, 354rxvt_term::pixbuf_to_pixmap (GdkPixbuf *pixbuf, Pixmap pixmap, GC gc,
355 int src_x, int src_y, int dst_x, int dst_y, 355 int src_x, int src_y, int dst_x, int dst_y,
356 unsigned int width, unsigned int height, bool argb) 356 unsigned int width, unsigned int height, bool argb)
357{ 357{
693 h_scale = 693 h_scale =
694 v_scale = defaultScale; 694 v_scale = defaultScale;
695 h_align = 695 h_align =
696 v_align = defaultAlign; 696 v_align = defaultAlign;
697 697
698# ifdef HAVE_PIXBUF 698# if HAVE_PIXBUF
699 pixbuf = 0; 699 pixbuf = 0;
700# endif 700# endif
701} 701}
702 702
703bool 703bool
727bool 727bool
728rxvt_image::set_file (const char *file) 728rxvt_image::set_file (const char *file)
729{ 729{
730 bool ret = false; 730 bool ret = false;
731 731
732# ifdef HAVE_PIXBUF 732# if HAVE_PIXBUF
733 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL); 733 GdkPixbuf *image = gdk_pixbuf_new_from_file (file, NULL);
734 if (image) 734 if (image)
735 { 735 {
736 if (pixbuf) 736 if (pixbuf)
737 g_object_unref (pixbuf); 737 g_object_unref (pixbuf);
993# endif 993# endif
994 994
995 return ret; 995 return ret;
996} 996}
997 997
998# ifdef ENABLE_TRANSPARENCY 998# if ENABLE_TRANSPARENCY
999/* 999/*
1000 * Builds a pixmap of the same size as the terminal window that contains 1000 * Builds a pixmap of the same size as the terminal window that contains
1001 * the tiled portion of the root pixmap that is supposed to be covered by 1001 * the tiled portion of the root pixmap that is supposed to be covered by
1002 * our window. 1002 * our window.
1003 */ 1003 */
1146 1146
1147bool 1147bool
1148rxvt_term::bg_render () 1148rxvt_term::bg_render ()
1149{ 1149{
1150 bg_invalidate (); 1150 bg_invalidate ();
1151# ifdef ENABLE_TRANSPARENCY 1151# if ENABLE_TRANSPARENCY
1152 if (bg_flags & BG_IS_TRANSPARENT) 1152 if (bg_flags & BG_IS_TRANSPARENT)
1153 { 1153 {
1154 /* we need to re-generate transparency pixmap in that case ! */ 1154 /* we need to re-generate transparency pixmap in that case ! */
1155 if (render_root_image ()) 1155 if (render_root_image ())
1156 bg_flags |= BG_IS_VALID; 1156 bg_flags |= BG_IS_VALID;
1157 } 1157 }
1158# endif 1158# endif
1159 1159
1160# ifdef BG_IMAGE_FROM_FILE 1160# if BG_IMAGE_FROM_FILE
1161 for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++) 1161 for (vector<rxvt_image>::iterator bg_image = image_vec.begin (); bg_image < image_vec.end (); bg_image++)
1162 { 1162 {
1163 if (render_image (*bg_image)) 1163 if (render_image (*bg_image))
1164 bg_flags |= BG_IS_VALID; 1164 bg_flags |= BG_IS_VALID;
1165 } 1165 }
1183} 1183}
1184 1184
1185void 1185void
1186rxvt_term::bg_init () 1186rxvt_term::bg_init ()
1187{ 1187{
1188#ifdef BG_IMAGE_FROM_FILE 1188#if BG_IMAGE_FROM_FILE
1189 if (rs[Rs_backgroundPixmap]) 1189 if (rs[Rs_backgroundPixmap])
1190 { 1190 {
1191 rxvt_image *image = new_image (); 1191 rxvt_image *image = new_image ();
1192 if (!image->set_file_geometry (rs[Rs_backgroundPixmap])) 1192 if (!image->set_file_geometry (rs[Rs_backgroundPixmap]))
1193 image_vec.pop_back (); 1193 image_vec.pop_back ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines