… | |
… | |
371 | |
371 | |
372 | Called whenever the user presses a key combination that has a |
372 | Called whenever the user presses a key combination that has a |
373 | C<perl:string> action bound to it (see description of the B<keysym> |
373 | C<perl:string> action bound to it (see description of the B<keysym> |
374 | resource in the @@RXVT_NAME@@(1) manpage). |
374 | resource in the @@RXVT_NAME@@(1) manpage). |
375 | |
375 | |
|
|
376 | =item on_x_event $term, $event |
|
|
377 | |
|
|
378 | Called on every X event received on the vt window (and possibly other |
|
|
379 | windows). Should only be used as a last resort. Most event structure |
|
|
380 | members are not passed. |
|
|
381 | |
376 | =item on_focus_in $term |
382 | =item on_focus_in $term |
377 | |
383 | |
378 | Called whenever the window gets the keyboard focus, before rxvt-unicode |
384 | Called whenever the window gets the keyboard focus, before rxvt-unicode |
379 | does focus in processing. |
385 | does focus in processing. |
380 | |
386 | |
… | |
… | |
490 | =item urxvt::CurrentTime |
496 | =item urxvt::CurrentTime |
491 | |
497 | |
492 | =item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, |
498 | =item urxvt::ShiftMask, LockMask, ControlMask, Mod1Mask, Mod2Mask, |
493 | Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, |
499 | Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, |
494 | Button4Mask, Button5Mask, AnyModifier |
500 | Button4Mask, Button5Mask, AnyModifier |
|
|
501 | |
|
|
502 | =item urxvt::NoEventMask, KeyPressMask, KeyReleaseMask, |
|
|
503 | ButtonPressMask, ButtonReleaseMask, EnterWindowMask, LeaveWindowMask, |
|
|
504 | PointerMotionMask, PointerMotionHintMask, Button1MotionMask, Button2MotionMask, |
|
|
505 | Button3MotionMask, Button4MotionMask, Button5MotionMask, ButtonMotionMask, |
|
|
506 | KeymapStateMask, ExposureMask, VisibilityChangeMask, StructureNotifyMask, |
|
|
507 | ResizeRedirectMask, SubstructureNotifyMask, SubstructureRedirectMask, |
|
|
508 | FocusChangeMask, PropertyChangeMask, ColormapChangeMask, OwnerGrabButtonMask |
|
|
509 | |
|
|
510 | =item urxvt::KeyPress, KeyRelease, ButtonPress, ButtonRelease, MotionNotify, |
|
|
511 | EnterNotify, LeaveNotify, FocusIn, FocusOut, KeymapNotify, Expose, |
|
|
512 | GraphicsExpose, NoExpose, VisibilityNotify, CreateNotify, DestroyNotify, |
|
|
513 | UnmapNotify, MapNotify, MapRequest, ReparentNotify, ConfigureNotify, |
|
|
514 | ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify, |
|
|
515 | CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest, |
|
|
516 | SelectionNotify, ColormapNotify, ClientMessage, MappingNotify |
495 | |
517 | |
496 | Various constants for use in X calls and event processing. |
518 | Various constants for use in X calls and event processing. |
497 | |
519 | |
498 | =back |
520 | =back |
499 | |
521 | |
… | |
… | |
567 | delete $ENV{CDPATH}; |
589 | delete $ENV{CDPATH}; |
568 | delete $ENV{BASH_ENV}; |
590 | delete $ENV{BASH_ENV}; |
569 | $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin"; |
591 | $ENV{PATH} = "/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin"; |
570 | } |
592 | } |
571 | |
593 | |
572 | my @hook_count; |
|
|
573 | my $verbosity = $ENV{URXVT_PERL_VERBOSITY}; |
594 | my $verbosity = $ENV{URXVT_PERL_VERBOSITY}; |
574 | |
595 | |
575 | sub verbose { |
596 | sub verbose { |
576 | my ($level, $msg) = @_; |
597 | my ($level, $msg) = @_; |
577 | warn "$msg\n" if $level <= $verbosity; |
598 | warn "$msg\n" if $level <= $verbosity; |
… | |
… | |
665 | verbose 11, "$HOOKNAME[$htype] returning <$retval>" |
686 | verbose 11, "$HOOKNAME[$htype] returning <$retval>" |
666 | if $verbosity >= 11; |
687 | if $verbosity >= 11; |
667 | } |
688 | } |
668 | |
689 | |
669 | if ($htype == 1) { # DESTROY |
690 | if ($htype == 1) { # DESTROY |
670 | if (my $hook = delete $TERM->{_hook}) { |
|
|
671 | for my $htype (0..$#$hook) { |
|
|
672 | $hook_count[$htype] -= scalar keys %{ $hook->[$htype] || {} } |
|
|
673 | or set_should_invoke $htype, 0; |
|
|
674 | } |
|
|
675 | } |
|
|
676 | |
|
|
677 | # clear package objects |
691 | # clear package objects |
678 | %$_ = () for values %{ $TERM->{_pkg} }; |
692 | %$_ = () for values %{ $TERM->{_pkg} }; |
679 | |
693 | |
680 | # clear package |
694 | # clear package |
681 | %$TERM = (); |
695 | %$TERM = (); |
… | |
… | |
707 | while (my ($name, $cb) = each %hook) { |
721 | while (my ($name, $cb) = each %hook) { |
708 | my $htype = $HOOKTYPE{uc $name}; |
722 | my $htype = $HOOKTYPE{uc $name}; |
709 | defined $htype |
723 | defined $htype |
710 | or Carp::croak "unsupported hook type '$name'"; |
724 | or Carp::croak "unsupported hook type '$name'"; |
711 | |
725 | |
|
|
726 | $self->set_should_invoke ($htype, +1) |
712 | unless (exists $self->{term}{_hook}[$htype]{$pkg}) { |
727 | unless exists $self->{term}{_hook}[$htype]{$pkg}; |
713 | $hook_count[$htype]++ |
|
|
714 | or urxvt::set_should_invoke $htype, 1; |
|
|
715 | } |
|
|
716 | |
728 | |
717 | $self->{term}{_hook}[$htype]{$pkg} = $cb; |
729 | $self->{term}{_hook}[$htype]{$pkg} = $cb; |
718 | } |
730 | } |
719 | } |
731 | } |
720 | |
732 | |
… | |
… | |
725 | for my $name (@hook) { |
737 | for my $name (@hook) { |
726 | my $htype = $HOOKTYPE{uc $name}; |
738 | my $htype = $HOOKTYPE{uc $name}; |
727 | defined $htype |
739 | defined $htype |
728 | or Carp::croak "unsupported hook type '$name'"; |
740 | or Carp::croak "unsupported hook type '$name'"; |
729 | |
741 | |
|
|
742 | $self->set_should_invoke ($htype, -1) |
730 | if (delete $self->{term}{_hook}[$htype]{$pkg}) { |
743 | if delete $self->{term}{_hook}[$htype]{$pkg}; |
731 | --$hook_count[$htype] |
|
|
732 | or urxvt::set_should_invoke $htype, 0; |
|
|
733 | } |
|
|
734 | } |
744 | } |
735 | } |
745 | } |
736 | |
746 | |
737 | our $AUTOLOAD; |
747 | our $AUTOLOAD; |
738 | |
748 | |
… | |
… | |
1143 | |
1153 | |
1144 | =item $windowid = $term->vt |
1154 | =item $windowid = $term->vt |
1145 | |
1155 | |
1146 | Return the window id of the terminal window. |
1156 | Return the window id of the terminal window. |
1147 | |
1157 | |
|
|
1158 | =item $term->vt_emask_add ($x_event_mask) |
|
|
1159 | |
|
|
1160 | Adds the specified events to the vt event mask. Useful e.g. when you want |
|
|
1161 | to receive pointer events all the times: |
|
|
1162 | |
|
|
1163 | $term->vt_emask_add (urxvt::PointerMotionMask); |
|
|
1164 | |
1148 | =item $window_width = $term->width |
1165 | =item $window_width = $term->width |
1149 | |
1166 | |
1150 | =item $window_height = $term->height |
1167 | =item $window_height = $term->height |
1151 | |
1168 | |
1152 | =item $font_width = $term->fwidth |
1169 | =item $font_width = $term->fwidth |