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

Comparing rxvt-unicode/src/urxvt.pm (file contents):
Revision 1.55 by root, Sun Jan 8 05:50:27 2006 UTC vs.
Revision 1.59 by root, Mon Jan 9 00:34:36 2006 UTC

58 58
59=back 59=back
60 60
61=item option-popup (enabled by default) 61=item option-popup (enabled by default)
62 62
63Binds a popup menu to Ctrl-Button3 that lets you toggle (some) options at 63Binds a popup menu to Ctrl-Button2 that lets you toggle (some) options at
64runtime. 64runtime.
65
66=item selection-popup (enabled by default)
67
68Binds a popup menu to Ctrl-Button3 that lets you convert the selection
69text into various other formats/action.
65 70
66=item digital-clock 71=item digital-clock
67 72
68Displays a digital clock using the built-in overlay. 73Displays a digital clock using the built-in overlay.
69 74
423 my $msg = join "", @_; 428 my $msg = join "", @_;
424 $msg .= "\n" 429 $msg .= "\n"
425 unless $msg =~ /\n$/; 430 unless $msg =~ /\n$/;
426 urxvt::warn ($msg); 431 urxvt::warn ($msg);
427 }; 432 };
433
434 $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin";
435 delete $ENV{CDPATH};
428} 436}
429 437
430my @hook_count; 438my @hook_count;
431my $verbosity = $ENV{URXVT_PERL_VERBOSITY}; 439my $verbosity = $ENV{URXVT_PERL_VERBOSITY};
432 440
465 verbose 3, "loading extension '$path' into package '$pkg'"; 473 verbose 3, "loading extension '$path' into package '$pkg'";
466 474
467 open my $fh, "<:raw", $path 475 open my $fh, "<:raw", $path
468 or die "$path: $!"; 476 or die "$path: $!";
469 477
470 my $source = "package $pkg; use strict; use utf8;\n" 478 my $source = untaint "package $pkg; use strict; use utf8;\n"
471 . "use base urxvt::term::proxy::;\n" 479 . "use base urxvt::term::proxy::;\n"
472 . "#line 1 \"$path\"\n{\n" 480 . "#line 1 \"$path\"\n{\n"
473 . (do { local $/; <$fh> }) 481 . (do { local $/; <$fh> })
474 . "\n};\n1"; 482 . "\n};\n1";
475 483
491 499
492 my %want_ext; 500 my %want_ext;
493 501
494 for (map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) { 502 for (map { split /,/, $TERM->resource ("perl_ext_$_") } 1, 2) {
495 if ($_ eq "default") { 503 if ($_ eq "default") {
496 $want_ext{$_}++ for qw(selection option-popup); 504 $want_ext{$_}++ for qw(selection option-popup selection-popup);
497 } elsif (/^-(.*)$/) { 505 } elsif (/^-(.*)$/) {
498 delete $want_ext{$1}; 506 delete $want_ext{$1};
499 } else { 507 } else {
500 $want_ext{$_}++; 508 $want_ext{$_}++;
501 } 509 }
532 $proxy 540 $proxy
533 }, 541 },
534 @_, 542 @_,
535 ) and last; 543 ) and last;
536 }; 544 };
537 warn $@ if $@;#d# 545 if ($@) {
546 $TERM->ungrab; # better to lose the grab than the session
547 warn $@;
548 }
538 } 549 }
539 } 550 }
540 551
541 if ($htype == 1) { # DESTROY 552 if ($htype == 1) { # DESTROY
542 # remove hooks if unused 553 # remove hooks if unused
572 } or die "FATAL: unable to compile method forwarder: $@"; 583 } or die "FATAL: unable to compile method forwarder: $@";
573 584
574 goto &$urxvt::term::proxy::AUTOLOAD; 585 goto &$urxvt::term::proxy::AUTOLOAD;
575} 586}
576 587
588sub urxvt::term::proxy::DESTROY {
589 # nop
590}
591
577# urxvt::destroy_hook 592# urxvt::destroy_hook
578 593
579sub urxvt::destroy_hook::DESTROY { 594sub urxvt::destroy_hook::DESTROY {
580 ${$_[0]}->(); 595 ${$_[0]}->();
581} 596}
582 597
583sub urxvt::destroy_hook(&) { 598sub urxvt::destroy_hook(&) {
584 bless \shift, urxvt::destroy_hook:: 599 bless \shift, urxvt::destroy_hook::
585} 600}
586 601
587# urxvt::anyevent
588
589package urxvt::anyevent; 602package urxvt::anyevent;
603
604=head2 The C<urxvt::anyevent> Class
605
606The sole purpose of this class is to deliver an interface to the
607C<AnyEvent> module - any module using it will work inside urxvt without
608further work. The only exception is that you cannot wait on condition
609variables, but non-blocking condvar use is ok. What this means is that you
610cannot use blocking APIs, but the non-blocking variant should work.
611
612=cut
590 613
591our $VERSION = 1; 614our $VERSION = 1;
592 615
593$INC{"urxvt/anyevent.pm"} = 1; # mark us as there 616$INC{"urxvt/anyevent.pm"} = 1; # mark us as there
594push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::]; 617push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::];
1147 1170
1148 my $item; $item = { 1171 my $item; $item = {
1149 type => "button", 1172 type => "button",
1150 text => " $text", 1173 text => " $text",
1151 value => $value, 1174 value => $value,
1152 render => sub { ($item->{value} ? "* " : " ") . $text }, 1175 render => sub { ($_[0]{value} ? "* " : " ") . $text },
1153 activate => sub { $cb->($item->{value} = !$item->{value}); }, 1176 activate => sub { $cb->($_[0]{value} = !$_[0]{value}); },
1154 }; 1177 };
1155 1178
1156 $self->add_item ($item); 1179 $self->add_item ($item);
1157} 1180}
1158 1181
1168} 1191}
1169 1192
1170sub DESTROY { 1193sub DESTROY {
1171 my ($self) = @_; 1194 my ($self) = @_;
1172 1195
1196 delete $self->{term}{_destroy}{$self};
1173 $self->{term}->ungrab; 1197 $self->{term}->ungrab;
1174} 1198}
1175 1199
1176=head2 The C<urxvt::timer> Class 1200=head2 The C<urxvt::timer> Class
1177 1201
1281This variable controls the verbosity level of the perl extension. Higher 1305This variable controls the verbosity level of the perl extension. Higher
1282numbers indicate more verbose output. 1306numbers indicate more verbose output.
1283 1307
1284=over 4 1308=over 4
1285 1309
1286=item =0 - only fatal messages 1310=item == 0 - fatal messages
1287 1311
1288=item =3 - script loading and management 1312=item >= 3 - script loading and management
1289 1313
1290=item =10 - all events received 1314=item >=10 - all events received
1291 1315
1292=back 1316=back
1293 1317
1294=head1 AUTHOR 1318=head1 AUTHOR
1295 1319

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines