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

Comparing rxvt-unicode/src/perl/overlay-osc (file contents):
Revision 1.1 by root, Fri Oct 10 00:11:40 2008 UTC vs.
Revision 1.2 by root, Fri Oct 10 00:21:16 2008 UTC

1#! perl 1#! perl
2 2
3# allows programs to open popups 3# allows programs to open popups
4# printf "\033]777;overlay;action;args\007" 4# printf "\033]777;overlay;action;args\007"
5# 5#
6# action "simple;<id>;<x>;<y>;<h|t>;<text>" 6# action "simple;<id>;<timeout>;<x>;<y>;<h|t>;<text>"
7# printf "\033]777;overlay;simple;ov1;0;0;t;test\007" 7# printf "\033]777;overlay;simple;ov1;0;0;t;test\007"
8# 8#
9## action "complex;<id>;<x>;<y>;<w>;<h>;<rstyle>;<border>;<h|t>;<text>"
10 9
11# action "timeout;<id>;<seconds>" 10# action "timeout;<id>;<seconds>"
12# printf "\033]777;overlay;timeout;ov1;6\007" 11# printf "\033]777;overlay;timeout;ov1;6\007"
13 12
14# action "destroy;<id>" 13# action "destroy;<id>"
14# printf "\033]777;overlay;destroy;ov1\007"
15
16# TODO:
17## action "complex;<id>;<timeout>;<x>;<y>;<width>;<height>;<rstyle>;<border>"
18## action "set;<id>;<x>;<y>;<h|t>;<hextext>;<rendition...>"
15 19
16sub on_osc_seq_perl { 20sub on_osc_seq_perl {
17 my ($self, $osc, $resp) = @_; 21 my ($self, $osc, $resp) = @_;
18 22
19 return unless $osc =~ s/^overlay;//; 23 return unless $osc =~ s/^overlay;//;
30 } else { 34 } else {
31 delete $ov->{to}; 35 delete $ov->{to};
32 } 36 }
33 37
34 } elsif ($1 eq "simple") { 38 } elsif ($1 eq "simple") {
35 my ($id, $x, $y, $t, $txt) = split /;/, $osc, 5; 39 my ($id, $to, $x, $y, $t, $txt) = split /;/, $osc, 6;
36 if ($t eq "h") { 40 if ($t eq "h") {
37 $txt = pack "H*", $txt; 41 $txt = pack "H*", $txt;
38 utf8::decode $txt; 42 utf8::decode $txt;
39 } 43 }
40 $self->{ov}{$id} = { 44 $self->{ov}{$id} = {
41 ov => $self->overlay_simple ($x, $y, $txt), 45 ov => $self->overlay_simple ($x, $y, $txt),
42 to => urxvt::timer 46 to => urxvt::timer
43 ->new 47 ->new
44 ->start (urxvt::NOW + 60) 48 ->start (urxvt::NOW + $to)
45 ->cb(sub { 49 ->cb(sub {
46 delete $self->{ov}{$id}; 50 delete $self->{ov}{$id};
47 }), 51 }),
48 }; 52 };
49 53

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines