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.91 by root, Fri Jan 13 01:09:37 2006 UTC vs.
Revision 1.93 by root, Fri Jan 13 07:03:48 2006 UTC

120 120
121For example, the following will transform selections of the form 121For example, the following will transform selections of the form
122C<filename:number>, often seen in compiler messages, into C<vi +$filename 122C<filename:number>, often seen in compiler messages, into C<vi +$filename
123$word>: 123$word>:
124 124
125 URxvt.selection-autotransform.0: s/^(\\S+):(\\d+):?$/vi +$2 \\Q$1\\E\\x0d/ 125 URxvt.selection-autotransform.0: s/^([^:[:space:]]+):(\\d+):?$/vi +$2 \\Q$1\\E\\x0d/
126 126
127And this example matches the same,but replaces it with vi-commands you can 127And this example matches the same,but replaces it with vi-commands you can
128paste directly into your (vi :) editor: 128paste directly into your (vi :) editor:
129 129
130 URxvt.selection-autotransform.0: s/^(S+):(d+):?$/\\x1b:e \\Q$1\\E\\x0d:$2\\x0d/ 130 URxvt.selection-autotransform.0: s/^([^:[:space:]]+(\\d+):?$/\\x1b:e \\Q$1\\E\\x0d:$2\\x0d/
131 131
132Of course, this can be modified to suit your needs and your editor :) 132Of course, this can be modified to suit your needs and your editor :)
133 133
134To expand the example above to typical perl error messages ("XXX at 134To expand the example above to typical perl error messages ("XXX at
135FILENAME line YYY."), you need a slightly more elaborate solution: 135FILENAME line YYY."), you need a slightly more elaborate solution:
371 371
372Called whenever the user presses a key combination that has a 372Called whenever the user presses a key combination that has a
373C<perl:string> action bound to it (see description of the B<keysym> 373C<perl:string> action bound to it (see description of the B<keysym>
374resource in the @@RXVT_NAME@@(1) manpage). 374resource in the @@RXVT_NAME@@(1) manpage).
375 375
376=item on_x_event $term, $event
377
378Called on every X event received on the vt window (and possibly other
379windows). Should only be used as a last resort. Most event structure
380members are not passed.
381
376=item on_focus_in $term 382=item on_focus_in $term
377 383
378Called whenever the window gets the keyboard focus, before rxvt-unicode 384Called whenever the window gets the keyboard focus, before rxvt-unicode
379does focus in processing. 385does 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,
493Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask, 499Mod3Mask, Mod4Mask, Mod5Mask, Button1Mask, Button2Mask, Button3Mask,
494Button4Mask, Button5Mask, AnyModifier 500Button4Mask, Button5Mask, AnyModifier
501
502=item urxvt::NoEventMask, KeyPressMask, KeyReleaseMask,
503ButtonPressMask, ButtonReleaseMask, EnterWindowMask, LeaveWindowMask,
504PointerMotionMask, PointerMotionHintMask, Button1MotionMask, Button2MotionMask,
505Button3MotionMask, Button4MotionMask, Button5MotionMask, ButtonMotionMask,
506KeymapStateMask, ExposureMask, VisibilityChangeMask, StructureNotifyMask,
507ResizeRedirectMask, SubstructureNotifyMask, SubstructureRedirectMask,
508FocusChangeMask, PropertyChangeMask, ColormapChangeMask, OwnerGrabButtonMask
509
510=item urxvt::KeyPress, KeyRelease, ButtonPress, ButtonRelease, MotionNotify,
511EnterNotify, LeaveNotify, FocusIn, FocusOut, KeymapNotify, Expose,
512GraphicsExpose, NoExpose, VisibilityNotify, CreateNotify, DestroyNotify,
513UnmapNotify, MapNotify, MapRequest, ReparentNotify, ConfigureNotify,
514ConfigureRequest, GravityNotify, ResizeRequest, CirculateNotify,
515CirculateRequest, PropertyNotify, SelectionClear, SelectionRequest,
516SelectionNotify, ColormapNotify, ClientMessage, MappingNotify
495 517
496Various constants for use in X calls and event processing. 518Various 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
572my @hook_count;
573my $verbosity = $ENV{URXVT_PERL_VERBOSITY}; 594my $verbosity = $ENV{URXVT_PERL_VERBOSITY};
574 595
575sub verbose { 596sub 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
737our $AUTOLOAD; 747our $AUTOLOAD;
738 748
1143 1153
1144=item $windowid = $term->vt 1154=item $windowid = $term->vt
1145 1155
1146Return the window id of the terminal window. 1156Return the window id of the terminal window.
1147 1157
1158=item $term->vt_emask_add ($x_event_mask)
1159
1160Adds the specified events to the vt event mask. Useful e.g. when you want
1161to 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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines