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

Comparing rxvt-unicode/src/perl/background (file contents):
Revision 1.53 by root, Tue Jun 12 18:25:57 2012 UTC vs.
Revision 1.54 by root, Thu Jun 14 16:22:20 2012 UTC

71 return scale load "$HOME/weekday.png"; 71 return scale load "$HOME/weekday.png";
72 } else { 72 } else {
73 return scale load "$HOME/sunday.png"; 73 return scale load "$HOME/sunday.png";
74 } 74 }
75 75
76This expression gets evaluated once per hour. It will set F<sunday.png> as 76This expression is evaluated once per hour. It will set F<sunday.png> as
77background on Sundays, and F<weekday.png> on all other days. 77background on Sundays, and F<weekday.png> on all other days.
78 78
79Fortunately, we expect that most expressions will be much simpler, with 79Fortunately, we expect that most expressions will be much simpler, with
80little Perl knowledge needed. 80little Perl knowledge needed.
81 81
229=item load $path 229=item load $path
230 230
231Loads the image at the given C<$path>. The image is set to plane tiling 231Loads the image at the given C<$path>. The image is set to plane tiling
232mode. 232mode.
233 233
234Loaded images will be cached for one cycle. 234Loaded images will be cached for one cycle, and shared between temrinals
235running in the same process (e.g. in C<urxvtd>).
235 236
237=item load_uc $path
238
239Load uncached - same as load, but does not cache the image. This function
240is most useufl if you want to optimise a background expression in some
241way.
242
236=cut 243=cut
244
245 sub load_uc($) {
246 my ($path) = @_;
247
248 $_IMG_CACHE{$path} || do {
249 my $img = $self->new_img_from_file ($path);
250 Scalar::Util::weaken ($_IMG_CACHE{$path} = $img);
251 $img
252 }
253 }
237 254
238 sub load($) { 255 sub load($) {
239 my ($path) = @_; 256 my ($path) = @_;
240 257
241 $new->{load}{$path} = $old->{load}{$path} || $self->new_img_from_file ($path); 258 $new->{load}{$path} = $old->{load}{$path} || load_uc $path;
242 } 259 }
243 260
244=item root 261=item root
245 262
246Returns the root window pixmap, that is, hopefully, the background image 263Returns the root window pixmap, that is, hopefully, the background image

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines