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.28 by root, Thu Jun 7 12:56:27 2012 UTC vs.
Revision 1.29 by root, Thu Jun 7 13:12:08 2012 UTC

4#:META:X_RESOURCE:%.enable:boolean:some boolean 4#:META:X_RESOURCE:%.enable:boolean:some boolean
5#:META:X_RESOURCE:%.extra.:value:extra config 5#:META:X_RESOURCE:%.extra.:value:extra config
6 6
7our $EXPR; 7our $EXPR;
8#$EXPR = 'move W * 0.1, -H * 0.1, resize W * 0.5, H * 0.5, repeat_none load "opensource.png"'; 8#$EXPR = 'move W * 0.1, -H * 0.1, resize W * 0.5, H * 0.5, repeat_none load "opensource.png"';
9$EXPR = 'border; move -X, -Y, load "argb.png"'; 9$EXPR = 'move -X, -Y, load "argb.png"';
10#$EXPR = ' 10#$EXPR = '
11# rotate W, H, 50, 50, counter 1/59.95, repeat_mirror, 11# rotate W, H, 50, 50, counter 1/59.95, repeat_mirror,
12# clip X, Y, W, H, repeat_mirror, 12# clip X, Y, W, H, repeat_mirror,
13# load "/root/pix/das_fette_schwein.jpg" 13# load "/root/pix/das_fette_schwein.jpg"
14#'; 14#';
17#$EXPR = 'blur move (root, -x, -y), 5, 5' 17#$EXPR = 'blur move (root, -x, -y), 5, 5'
18#resize load "/root/pix/das_fette_schwein.jpg", w, h 18#resize load "/root/pix/das_fette_schwein.jpg", w, h
19 19
20use Safe; 20use Safe;
21 21
22our $border;
23our ($bgdsl_self, $old, $new); 22our ($bgdsl_self, $old, $new);
24our ($l, $t, $w, $h); 23our ($x, $y, $w, $h);
25 24
26# enforce at least this interval between updates 25# enforce at least this interval between updates
27our $MIN_INTERVAL = 1/100; 26our $MIN_INTERVAL = 1/100;
28 27
29{ 28{
30 package urxvt::bgdsl; # background language 29 package urxvt::bgdsl; # background language
31 30
32# *repeat_empty = \&urxvt::RepeatNone;
33# *repeat_tile = \&urxvt::RepeatNormal;
34# *repeat_pad = \&urxvt::RepeatPad;
35# *repeat_mirror = \&urxvt::RepeatReflect;
36
37=head2 PROVIDERS/GENERATORS 31=head2 PROVIDERS/GENERATORS
38 32
39=over 4 33=over 4
40 34
41=item load $path 35=item load $path
36
37Loads the image at the given C<$path>. The image is set to plane tiling
38mode.
39
40
42 41
43=cut 42=cut
44 43
45 sub load($) { 44 sub load($) {
46 my ($path) = @_; 45 my ($path) = @_;
65 64
66=over 4 65=over 4
67 66
68=cut 67=cut
69 68
70 sub X() { $new->{position_sensitive} = 1; $l } 69 sub X() { $new->{position_sensitive} = 1; $x }
71 sub Y() { $new->{position_sensitive} = 1; $t } 70 sub Y() { $new->{position_sensitive} = 1; $y }
72 sub W() { $new->{size_sensitive} = 1; $w } 71 sub W() { $new->{size_sensitive} = 1; $w }
73 sub H() { $new->{size_sensitive} = 1; $h } 72 sub H() { $new->{size_sensitive} = 1; $h }
74 73
75 sub now() { urxvt::NOW } 74 sub now() { urxvt::NOW }
76 75
281 $img 280 $img
282 } 281 }
283 282
284=back 283=back
285 284
286=head2 SETTINGS
287
288=over 4
289
290=item border $respect_border=1
291
292Sets whether the image should respect the terminal border (argument true
293or missing), or whether it should fill the whole window (the default).
294
295By default, the image will cover the whole toplevel window. If C<border>
296is enabled, then it will only fill the character area and leave a normal
297border in the background colour around it and behind the scrollbar.
298
299=cut
300
301 sub border {
302 $border = @_ ? $_[0] : 1;
303 }
304
305=back
306
307=cut 285=cut
308 286
309} 287}
310 288
311sub parse_expr { 289sub parse_expr {
338 $self->{next_refresh} = urxvt::NOW + $MIN_INTERVAL; 316 $self->{next_refresh} = urxvt::NOW + $MIN_INTERVAL;
339 317
340 # set environment to evaluate user expression 318 # set environment to evaluate user expression
341 319
342 local $bgdsl_self = $self; 320 local $bgdsl_self = $self;
343 local $border;
344 321
345 local $old = $self->{state}; 322 local $old = $self->{state};
346 local $new = my $state = $self->{state} = {}; 323 local $new = my $state = $self->{state} = {};
347 324
325 my $border = 0; #d#
326
348 ($l, $t, $w, $h) = 327 ($x, $y, $w, $h) =
349 $self->get_geometry; 328 $self->background_geometry ($border);
350
351 warn "$l,$t,$w,$h\n";#d#
352 329
353 # evaluate user expression 330 # evaluate user expression
354 331
355 my $img = eval { $self->{expr}->() }; 332 my $img = eval { $self->{expr}->() };
356 warn $@ if $@;#d# 333 warn $@ if $@;#d#

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines