… | |
… | |
342 | |
342 | |
343 | =item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, |
343 | =item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, |
344 | Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, |
344 | Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, |
345 | Button4Mask, Button5Mask, AnyModifier |
345 | Button4Mask, Button5Mask, AnyModifier |
346 | |
346 | |
347 | Various constants for use in X events. |
347 | Various 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 | |
… | |
… | |
407 | use utf8; |
407 | use utf8; |
408 | use strict; |
408 | use strict; |
409 | use Scalar::Util (); |
409 | use Scalar::Util (); |
410 | use List::Util (); |
410 | use List::Util (); |
411 | |
411 | |
|
|
412 | our $VERSION = 1; |
412 | our $TERM; |
413 | our $TERM; |
413 | our @HOOKNAME; |
414 | our @HOOKNAME; |
414 | our %OPTION; |
415 | our %OPTION; |
415 | our $LIBDIR; |
416 | our $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 | |
556 | sub urxvt::term::proxy::AUTOLOAD { |
562 | sub 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 | |
571 | sub urxvt::destroy_hook::DESTROY { |
579 | sub urxvt::destroy_hook::DESTROY { |
572 | ${$_[0]}->(); |
580 | ${$_[0]}->(); |
573 | } |
581 | } |
574 | |
582 | |
575 | sub urxvt::destroy_hook(&) { |
583 | sub urxvt::destroy_hook(&) { |
576 | bless \shift, urxvt::destroy_hook:: |
584 | bless \shift, urxvt::destroy_hook:: |
577 | } |
585 | } |
|
|
586 | |
|
|
587 | # urxvt::anyevent |
|
|
588 | |
|
|
589 | package urxvt::anyevent; |
|
|
590 | |
|
|
591 | our $VERSION = 1; |
|
|
592 | |
|
|
593 | $INC{"urxvt/anyevent.pm"} = 1; # mark us as there |
|
|
594 | push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::]; |
|
|
595 | |
|
|
596 | sub 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 | |
|
|
610 | sub 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 | |
|
|
628 | sub DESTROY { |
|
|
629 | $_[0][1]->stop; |
|
|
630 | } |
|
|
631 | |
|
|
632 | sub condvar { |
|
|
633 | bless \my $flag, urxvt::anyevent::condvar:: |
|
|
634 | } |
|
|
635 | |
|
|
636 | sub urxvt::anyevent::condvar::broadcast { |
|
|
637 | ${$_[0]}++; |
|
|
638 | } |
|
|
639 | |
|
|
640 | sub 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 | |
|
|
647 | package 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 | |
639 | sub urxvt::term::resource($$;$) { |
709 | sub 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 | |
… | |
… | |
731 | C<$event> I<must> be the event causing the menu to pop up (a button event, |
801 | C<$event> I<must> be the event causing the menu to pop up (a button event, |
732 | currently). |
802 | currently). |
733 | |
803 | |
734 | =cut |
804 | =cut |
735 | |
805 | |
736 | sub urxvt::term::popup { |
806 | sub 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 | |
936 | sub urxvt::term::line { |
1006 | sub 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); |
… | |
… | |
1019 | Converts rxvt-unicodes text reprsentation into a perl string. See |
1089 | Converts rxvt-unicodes text reprsentation into a perl string. See |
1020 | C<< $term->ROW_t >> for details. |
1090 | C<< $term->ROW_t >> for details. |
1021 | |
1091 | |
1022 | =back |
1092 | =back |
1023 | |
1093 | |
|
|
1094 | =cut |
|
|
1095 | |
|
|
1096 | package 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 | |
|
|
1030 | package urxvt::popup; |
|
|
1031 | |
1103 | |
1032 | sub add_item { |
1104 | sub 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}; |