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.13 by root, Tue Jun 5 19:32:29 2012 UTC vs.
Revision 1.15 by root, Tue Jun 5 22:46:50 2012 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines