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.14 by root, Tue Jun 5 22:23:07 2012 UTC vs.
Revision 1.15 by root, Tue Jun 5 22:46:50 2012 UTC

7$EXPR = ' 7$EXPR = '
8 rotate W, H, 50, 50, counter 1/59.95, repeat_mirror, 8 rotate W, H, 50, 50, counter 1/59.95, repeat_mirror,
9 clip X, Y, W, H, repeat_mirror, 9 clip X, Y, W, H, repeat_mirror,
10 load "/root/pix/das_fette_schwein.jpg" 10 load "/root/pix/das_fette_schwein.jpg"
11'; 11';
12$EXPR = 'solid "red"';
12#$EXPR = 'blur root, 10, 10' 13#$EXPR = 'blur root, 10, 10'
13#$EXPR = 'blur move (root, -x, -y), 5, 5' 14#$EXPR = 'blur move (root, -x, -y), 5, 5'
14#resize load "/root/pix/das_fette_schwein.jpg", w, h 15#resize load "/root/pix/das_fette_schwein.jpg", w, h
15 16
16use Safe; 17use Safe;
27 *repeat_black = \&urxvt::RepeatNone; #TODO wtf 28 *repeat_black = \&urxvt::RepeatNone; #TODO wtf
28 *repeat_wrap = \&urxvt::RepeatNormal; 29 *repeat_wrap = \&urxvt::RepeatNormal;
29 *repeat_pad = \&urxvt::RepeatPad; 30 *repeat_pad = \&urxvt::RepeatPad;
30 *repeat_mirror = \&urxvt::RepeatReflect; 31 *repeat_mirror = \&urxvt::RepeatReflect;
31 32
33=head2 PROVIDERS/GENERATORS
34
35=over 4
36
37=item load $path
38
39=cut
40
32 sub load($) { 41 sub load($) {
33 my ($path) = @_; 42 my ($path) = @_;
34 43
35 $new->{load}{$path} = $old->{load}{$path} || $bgdsl_self->new_img_from_file ($path); 44 $new->{load}{$path} = $old->{load}{$path} || $bgdsl_self->new_img_from_file ($path);
36 } 45 }
37 46
38 sub root() { 47 sub root() {
39 $new->{rootpmap_sensitive} = 1; 48 $new->{rootpmap_sensitive} = 1;
40 die "root op not supported, exg, we need you"; 49 die "root op not supported, exg, we need you";
41 } 50 }
51
52 sub solid($;$$) {
53 my $img = $bgdsl_self->new_img (urxvt::PictStandardARGB32, $_[1] || 1, $_[2] || 1);
54 $img->fill ($_[0]);
55 $img
56 }
57
58=back
59
60=head2 OPERATORS
61
62=over 4
63
64=cut
42 65
43# sub clone($) { 66# sub clone($) {
44# $_[0]->clone 67# $_[0]->clone
45# } 68# }
46 69
119 142
120 sub counter($) { 143 sub counter($) {
121 $new->{again} = $_[0]; 144 $new->{again} = $_[0];
122 $bgdsl_self->{counter} + 0 145 $bgdsl_self->{counter} + 0
123 } 146 }
147
148=back
149
150=cut
151
124} 152}
125 153
126sub parse_expr { 154sub parse_expr {
127 my $expr = eval "sub {\npackage urxvt::bgdsl;\n#line 0 'background expression'\n$_[0]\n}"; 155 my $expr = eval "sub {\npackage urxvt::bgdsl;\n#line 0 'background expression'\n$_[0]\n}";
128 die if $@; 156 die if $@;
164 192
165 # evaluate user expression 193 # evaluate user expression
166 194
167 my $img = eval { $self->{expr}->() }; 195 my $img = eval { $self->{expr}->() };
168 warn $@ if $@;#d# 196 warn $@ if $@;#d#
197 die if !UNIVERSAL::isa $img, "urxvt::img";
169 198
170 # if the expression is sensitive to external events, prepare reevaluation then 199 # if the expression is sensitive to external events, prepare reevaluation then
171 200
172 my $repeat; 201 my $repeat;
173 202

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines