… | |
… | |
179 | should extend the selection itelf and return true to suppress the built-in |
179 | should extend the selection itelf and return true to suppress the built-in |
180 | processing. |
180 | processing. |
181 | |
181 | |
182 | See the F<selection> example extension. |
182 | See the F<selection> example extension. |
183 | |
183 | |
184 | =item on_focus_in $term |
|
|
185 | |
|
|
186 | Called whenever the window gets the keyboard focus, before urxvt does |
|
|
187 | focus in processing. |
|
|
188 | |
|
|
189 | =item on_focus_out $term |
|
|
190 | |
|
|
191 | Called wheneever the window loses keyboard focus, before urxvt does focus |
|
|
192 | out processing. |
|
|
193 | |
|
|
194 | =item on_view_change $term, $offset |
184 | =item on_view_change $term, $offset |
195 | |
185 | |
196 | Called whenever the view offset changes, i..e the user or program |
186 | Called whenever the view offset changes, i..e the user or program |
197 | scrolls. Offset C<0> means display the normal terminal, positive values |
187 | scrolls. Offset C<0> means display the normal terminal, positive values |
198 | show this many lines of scrollback. |
188 | show this many lines of scrollback. |
… | |
… | |
261 | |
251 | |
262 | Called whenever the user presses a key combination that has a |
252 | Called whenever the user presses a key combination that has a |
263 | C<perl:string> action bound to it (see description of the B<keysym> |
253 | C<perl:string> action bound to it (see description of the B<keysym> |
264 | resource in the @@RXVT_NAME@@(1) manpage). |
254 | resource in the @@RXVT_NAME@@(1) manpage). |
265 | |
255 | |
|
|
256 | =item on_focus_in $term |
|
|
257 | |
|
|
258 | Called whenever the window gets the keyboard focus, before rxvt-unicode |
|
|
259 | does focus in processing. |
|
|
260 | |
|
|
261 | =item on_focus_out $term |
|
|
262 | |
|
|
263 | Called wheneever the window loses keyboard focus, before rxvt-unicode does |
|
|
264 | focus out processing. |
|
|
265 | |
266 | =item on_key_press $term, $event, $octets |
266 | =item on_key_press $term, $event, $octets |
267 | |
267 | |
268 | =item on_key_release $term, $event |
268 | =item on_key_release $term, $event |
269 | |
269 | |
270 | =item on_button_press $term, $event |
270 | =item on_button_press $term, $event |
271 | |
271 | |
272 | =item on_button_release $term, $event |
272 | =item on_button_release $term, $event |
273 | |
273 | |
274 | =item on_motion_notify $term, $event |
274 | =item on_motion_notify $term, $event |
|
|
275 | |
|
|
276 | =item on_map_notify $term, $event |
|
|
277 | |
|
|
278 | =item on_unmap_notify $term, $event |
275 | |
279 | |
276 | Called whenever the corresponding X event is received for the terminal If |
280 | Called whenever the corresponding X event is received for the terminal If |
277 | the hook returns true, then the even will be ignored by rxvt-unicode. |
281 | the hook returns true, then the even will be ignored by rxvt-unicode. |
278 | |
282 | |
279 | The event is a hash with most values as named by Xlib (see the XEvent |
283 | The event is a hash with most values as named by Xlib (see the XEvent |
… | |
… | |
534 | } or die "FATAL: unable to compile method forwarder: $@"; |
538 | } or die "FATAL: unable to compile method forwarder: $@"; |
535 | |
539 | |
536 | goto &$urxvt::term::proxy::AUTOLOAD; |
540 | goto &$urxvt::term::proxy::AUTOLOAD; |
537 | } |
541 | } |
538 | |
542 | |
|
|
543 | sub urxvt::destroy_hook::DESTROY { |
|
|
544 | ${$_[0]}->(); |
|
|
545 | } |
|
|
546 | |
|
|
547 | sub urxvt::destroy_hook(&) { |
|
|
548 | bless \shift, urxvt::destroy_hook:: |
|
|
549 | } |
|
|
550 | |
539 | =head2 The C<urxvt::term> Class |
551 | =head2 The C<urxvt::term> Class |
540 | |
552 | |
541 | =over 4 |
553 | =over 4 |
542 | |
554 | |
543 | =item $term->destroy |
555 | =item $term->destroy |
… | |
… | |
581 | =cut |
593 | =cut |
582 | |
594 | |
583 | sub urxvt::term::resource($$;$) { |
595 | sub urxvt::term::resource($$;$) { |
584 | my ($self, $name) = (shift, shift); |
596 | my ($self, $name) = (shift, shift); |
585 | unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); |
597 | unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); |
586 | goto &urxvt::term::_resource; |
598 | &urxvt::term::_resource |
587 | } |
599 | } |
588 | |
600 | |
589 | =item $rend = $term->rstyle ([$new_rstyle]) |
601 | =item $rend = $term->rstyle ([$new_rstyle]) |
590 | |
602 | |
591 | Return and optionally change the current rendition. Text that is output by |
603 | Return and optionally change the current rendition. Text that is output by |
… | |
… | |
667 | |
679 | |
668 | If hidden, display the overlay again. |
680 | If hidden, display the overlay again. |
669 | |
681 | |
670 | =back |
682 | =back |
671 | |
683 | |
|
|
684 | =item $popup = $term->popup ($event) |
|
|
685 | |
|
|
686 | Creates a new C<urxvt::popup> object that implements a popup menu. The |
|
|
687 | C<$event> I<must> be the event causing the menu to pop up (a button event, |
|
|
688 | currently). |
|
|
689 | |
|
|
690 | =cut |
|
|
691 | |
|
|
692 | sub urxvt::term::popup { |
|
|
693 | my ($self, $event) = @_; |
|
|
694 | |
|
|
695 | $self->grab ($event->{time}, 1) |
|
|
696 | or return; |
|
|
697 | |
|
|
698 | my $popup = bless { |
|
|
699 | term => $self, |
|
|
700 | event => $event, |
|
|
701 | }, urxvt::popup::; |
|
|
702 | |
|
|
703 | Scalar::Util::weaken $popup->{term}; |
|
|
704 | |
|
|
705 | $self->{_destroy}{$popup} = urxvt::destroy_hook { $popup->{popup}->destroy }; |
|
|
706 | Scalar::Util::weaken $self->{_destroy}{$popup}; |
|
|
707 | |
|
|
708 | $popup |
|
|
709 | } |
|
|
710 | |
672 | =item $cellwidth = $term->strwidth ($string) |
711 | =item $cellwidth = $term->strwidth ($string) |
673 | |
712 | |
674 | Returns the number of screen-cells this string would need. Correctly |
713 | Returns the number of screen-cells this string would need. Correctly |
675 | accounts for wide and combining characters. |
714 | accounts for wide and combining characters. |
676 | |
715 | |
… | |
… | |
926 | |
965 | |
927 | Converts rxvt-unicodes text reprsentation into a perl string. See |
966 | Converts rxvt-unicodes text reprsentation into a perl string. See |
928 | C<< $term->ROW_t >> for details. |
967 | C<< $term->ROW_t >> for details. |
929 | |
968 | |
930 | =back |
969 | =back |
|
|
970 | |
|
|
971 | =head2 The C<urxvt::popup> Class |
|
|
972 | |
|
|
973 | =over 4 |
|
|
974 | |
|
|
975 | =cut |
|
|
976 | |
|
|
977 | package urxvt::popup; |
|
|
978 | |
|
|
979 | sub add_item { |
|
|
980 | my ($self, $item) = @_; |
|
|
981 | |
|
|
982 | push @{ $self->{item} }, $item; |
|
|
983 | } |
|
|
984 | |
|
|
985 | sub add_button { |
|
|
986 | my ($self, $text, $cb) = @_; |
|
|
987 | |
|
|
988 | $self->add_item ({ type => "button", text => "[ $text ]", activate => $cb }); |
|
|
989 | } |
|
|
990 | |
|
|
991 | sub show { |
|
|
992 | my ($self) = @_; |
|
|
993 | |
|
|
994 | local $urxvt::popup::self = $self; |
|
|
995 | |
|
|
996 | urxvt->new ("--perl-lib" => "", "--perl-ext-common" => "", "-pty-fd" => -1, "-sl" => 0, "-b" => 0, |
|
|
997 | "--transient-for" => $self->{term}->parent, |
|
|
998 | "-pe" => "urxvt_popup") |
|
|
999 | or die "unable to create popup window\n"; |
|
|
1000 | } |
|
|
1001 | |
|
|
1002 | sub DESTROY { |
|
|
1003 | my ($self) = @_; |
|
|
1004 | |
|
|
1005 | $self->{term}->ungrab; |
|
|
1006 | } |
931 | |
1007 | |
932 | =head2 The C<urxvt::timer> Class |
1008 | =head2 The C<urxvt::timer> Class |
933 | |
1009 | |
934 | This class implements timer watchers/events. Time is represented as a |
1010 | This class implements timer watchers/events. Time is represented as a |
935 | fractional number of seconds since the epoch. Example: |
1011 | fractional number of seconds since the epoch. Example: |