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.54 by root, Sun Jan 8 01:59:29 2006 UTC vs.
Revision 1.55 by root, Sun Jan 8 05:50:27 2006 UTC

342 342
343=item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, 343=item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask,
344Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, 344Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask,
345Button4Mask, Button5Mask, AnyModifier 345Button4Mask, Button5Mask, AnyModifier
346 346
347Various constants for use in X events. 347Various constants for use in X calls and event processing.
348 348
349=back 349=back
350 350
351=head2 RENDITION 351=head2 RENDITION
352 352
407use utf8; 407use utf8;
408use strict; 408use strict;
409use Scalar::Util (); 409use Scalar::Util ();
410use List::Util (); 410use List::Util ();
411 411
412our $VERSION = 1;
412our $TERM; 413our $TERM;
413our @HOOKNAME; 414our @HOOKNAME;
414our %OPTION; 415our %OPTION;
415our $LIBDIR; 416our $LIBDIR;
416 417
507 register_package extension_package $files[0]; 508 register_package extension_package $files[0];
508 } else { 509 } else {
509 warn "perl extension '$ext' not found in perl library search path\n"; 510 warn "perl extension '$ext' not found in perl library search path\n";
510 } 511 }
511 } 512 }
513
514 eval "#line 1 \"--perl-eval resource/argument\"\n" . $TERM->resource ("perl_eval");
515 warn $@ if $@;
512 } 516 }
513 517
514 $retval = undef; 518 $retval = undef;
515 519
516 if (my $cb = $TERM->{_hook}[$htype]) { 520 if (my $cb = $TERM->{_hook}[$htype]) {
551 } 555 }
552 556
553 $retval 557 $retval
554} 558}
555 559
560# urxvt::term::proxy
561
556sub urxvt::term::proxy::AUTOLOAD { 562sub urxvt::term::proxy::AUTOLOAD {
557 $urxvt::term::proxy::AUTOLOAD =~ /:([^:]+)$/ 563 $urxvt::term::proxy::AUTOLOAD =~ /:([^:]+)$/
558 or die "FATAL: \$AUTOLOAD '$urxvt::term::proxy::AUTOLOAD' unparsable"; 564 or die "FATAL: \$AUTOLOAD '$urxvt::term::proxy::AUTOLOAD' unparsable";
559 565
560 eval qq{ 566 eval qq{
566 } or die "FATAL: unable to compile method forwarder: $@"; 572 } or die "FATAL: unable to compile method forwarder: $@";
567 573
568 goto &$urxvt::term::proxy::AUTOLOAD; 574 goto &$urxvt::term::proxy::AUTOLOAD;
569} 575}
570 576
577# urxvt::destroy_hook
578
571sub urxvt::destroy_hook::DESTROY { 579sub urxvt::destroy_hook::DESTROY {
572 ${$_[0]}->(); 580 ${$_[0]}->();
573} 581}
574 582
575sub urxvt::destroy_hook(&) { 583sub urxvt::destroy_hook(&) {
576 bless \shift, urxvt::destroy_hook:: 584 bless \shift, urxvt::destroy_hook::
577} 585}
586
587# urxvt::anyevent
588
589package urxvt::anyevent;
590
591our $VERSION = 1;
592
593$INC{"urxvt/anyevent.pm"} = 1; # mark us as there
594push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::];
595
596sub timer {
597 my ($class, %arg) = @_;
598
599 my $cb = $arg{cb};
600
601 urxvt::timer
602 ->new
603 ->start (urxvt::NOW + $arg{after})
604 ->cb (sub {
605 $_[0]->stop; # need to cancel manually
606 $cb->();
607 })
608}
609
610sub io {
611 my ($class, %arg) = @_;
612
613 my $cb = $arg{cb};
614
615 bless [$arg{fh}, urxvt::iow
616 ->new
617 ->fd (fileno $arg{fh})
618 ->events (($arg{poll} =~ /r/ ? 1 : 0)
619 | ($arg{poll} =~ /w/ ? 2 : 0))
620 ->start
621 ->cb (sub {
622 $cb->(($_[1] & 1 ? 'r' : '')
623 . ($_[1] & 2 ? 'w' : ''));
624 })],
625 urxvt::anyevent::
626}
627
628sub DESTROY {
629 $_[0][1]->stop;
630}
631
632sub condvar {
633 bless \my $flag, urxvt::anyevent::condvar::
634}
635
636sub urxvt::anyevent::condvar::broadcast {
637 ${$_[0]}++;
638}
639
640sub urxvt::anyevent::condvar::wait {
641 unless (${$_[0]}) {
642 require Carp;
643 Carp::croak ("AnyEvent->condvar blocking wait unsupported in urxvt, use a non-blocking API");
644 }
645}
646
647package urxvt::term;
578 648
579=head2 The C<urxvt::term> Class 649=head2 The C<urxvt::term> Class
580 650
581=over 4 651=over 4
582 652
634 shade term_name title transparent transparent_all tripleclickwords 704 shade term_name title transparent transparent_all tripleclickwords
635 utmpInhibit visualBell 705 utmpInhibit visualBell
636 706
637=cut 707=cut
638 708
639sub urxvt::term::resource($$;$) { 709sub resource($$;$) {
640 my ($self, $name) = (shift, shift); 710 my ($self, $name) = (shift, shift);
641 unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); 711 unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0);
642 &urxvt::term::_resource 712 &urxvt::term::_resource
643} 713}
644 714
731C<$event> I<must> be the event causing the menu to pop up (a button event, 801C<$event> I<must> be the event causing the menu to pop up (a button event,
732currently). 802currently).
733 803
734=cut 804=cut
735 805
736sub urxvt::term::popup { 806sub popup {
737 my ($self, $event) = @_; 807 my ($self, $event) = @_;
738 808
739 $self->grab ($event->{time}, 1) 809 $self->grab ($event->{time}, 1)
740 or return; 810 or return;
741 811
931 1001
932=back 1002=back
933 1003
934=cut 1004=cut
935 1005
936sub urxvt::term::line { 1006sub line {
937 my ($self, $row) = @_; 1007 my ($self, $row) = @_;
938 1008
939 my $maxrow = $self->nrow - 1; 1009 my $maxrow = $self->nrow - 1;
940 1010
941 my ($beg, $end) = ($row, $row); 1011 my ($beg, $end) = ($row, $row);
1019Converts rxvt-unicodes text reprsentation into a perl string. See 1089Converts rxvt-unicodes text reprsentation into a perl string. See
1020C<< $term->ROW_t >> for details. 1090C<< $term->ROW_t >> for details.
1021 1091
1022=back 1092=back
1023 1093
1094=cut
1095
1096package urxvt::popup;
1097
1024=head2 The C<urxvt::popup> Class 1098=head2 The C<urxvt::popup> Class
1025 1099
1026=over 4 1100=over 4
1027 1101
1028=cut 1102=cut
1029
1030package urxvt::popup;
1031 1103
1032sub add_item { 1104sub add_item {
1033 my ($self, $item) = @_; 1105 my ($self, $item) = @_;
1034 1106
1035 $item->{rend}{normal} = "\x1b[0;30;47m" unless exists $item->{rend}{normal}; 1107 $item->{rend}{normal} = "\x1b[0;30;47m" unless exists $item->{rend}{normal};

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines