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.164 by root, Mon Dec 24 08:21:40 2007 UTC vs.
Revision 1.173 by root, Wed Nov 5 12:45:36 2008 UTC

108reference. The string will be used as button text and the code reference 108reference. The string will be used as button text and the code reference
109will be called when the toggle changes, with the new boolean value as 109will be called when the toggle changes, with the new boolean value as
110first argument. 110first argument.
111 111
112The following will add an entry C<myoption> that changes 112The following will add an entry C<myoption> that changes
113C<$self->{myoption}>: 113C<< $self->{myoption} >>:
114 114
115 push @{ $self->{term}{option_popup_hook} }, sub { 115 push @{ $self->{term}{option_popup_hook} }, sub {
116 ("my option" => $myoption, sub { $self->{myoption} = $_[0] }) 116 ("my option" => $myoption, sub { $self->{myoption} = $_[0] })
117 }; 117 };
118 118
303extension will actually grab a physical key just for this function. 303extension will actually grab a physical key just for this function.
304 304
305If you want a quake-like animation, tell your window manager to do so 305If you want a quake-like animation, tell your window manager to do so
306(fvwm can do it). 306(fvwm can do it).
307 307
308=item overlay-osc
309
310This extension implements some OSC commands to display timed popups on the
311screen - useful for status displays from within scripts. You have to read
312the sources for more info.
313
308=item block-graphics-to-ascii 314=item block-graphics-to-ascii
309 315
310A not very useful example of filtering all text output to the terminal 316A not very useful example of filtering all text output to the terminal
311by replacing all line-drawing characters (U+2500 .. U+259F) by a 317by replacing all line-drawing characters (U+2500 .. U+259F) by a
312similar-looking ascii character. 318similar-looking ascii character.
541 547
542It is called before lines are scrolled out (so rows 0 .. min ($lines - 1, 548It is called before lines are scrolled out (so rows 0 .. min ($lines - 1,
543$nrow - 1) represent the lines to be scrolled out). C<$saved> is the total 549$nrow - 1) represent the lines to be scrolled out). C<$saved> is the total
544number of lines that will be in the scrollback buffer. 550number of lines that will be in the scrollback buffer.
545 551
546=item on_osc_seq $term, $op, $args 552=item on_osc_seq $term, $op, $args, $resp
547 553
548Called on every OSC sequence and can be used to suppress it or modify its 554Called on every OSC sequence and can be used to suppress it or modify its
549behaviour. The default should be to return an empty list. A true value 555behaviour. The default should be to return an empty list. A true value
550suppresses execution of the request completely. Make sure you don't get 556suppresses execution of the request completely. Make sure you don't get
551confused by recursive invocations when you output an osc sequence within 557confused by recursive invocations when you output an OSC sequence within
552this callback. 558this callback.
553 559
554C<on_osc_seq_perl> should be used for new behaviour. 560C<on_osc_seq_perl> should be used for new behaviour.
555 561
556=item on_osc_seq_perl $term, $string 562=item on_osc_seq_perl $term, $args, $resp
557 563
558Called whenever the B<ESC ] 777 ; string ST> command sequence (OSC = 564Called whenever the B<ESC ] 777 ; string ST> command sequence (OSC =
559operating system command) is processed. Cursor position and other state 565operating system command) is processed. Cursor position and other state
560information is up-to-date when this happens. For interoperability, the 566information is up-to-date when this happens. For interoperability, the
561string should start with the extension name and a colon, to distinguish 567string should start with the extension name (sans -osc) and a semicolon,
562it from commands for other extensions, and this might be enforced in the 568to distinguish it from commands for other extensions, and this might be
563future. 569enforced in the future.
570
571For example, C<overlay-osc> uses this:
572
573 sub on_osc_seq_perl {
574 my ($self, $osc, $resp) = @_;
575
576 return unless $osc =~ s/^overlay;//;
577
578 ... process remaining $osc string
579 }
564 580
565Be careful not ever to trust (in a security sense) the data you receive, 581Be careful not ever to trust (in a security sense) the data you receive,
566as its source can not easily be controlled (e-mail content, messages from 582as its source can not easily be controlled (e-mail content, messages from
567other users on the same system etc.). 583other users on the same system etc.).
584
585For responses, C<$resp> contains the end-of-args separator used by the
586sender.
568 587
569=item on_add_lines $term, $string 588=item on_add_lines $term, $string
570 589
571Called whenever text is about to be output, with the text as argument. You 590Called whenever text is about to be output, with the text as argument. You
572can filter/change and output the text yourself by returning a true value 591can filter/change and output the text yourself by returning a true value
593later with the already-modified line (e.g. if unrelated parts change), so 612later with the already-modified line (e.g. if unrelated parts change), so
594you cannot just toggle rendition bits, but only set them. 613you cannot just toggle rendition bits, but only set them.
595 614
596=item on_refresh_begin $term 615=item on_refresh_begin $term
597 616
598Called just before the screen gets redrawn. Can be used for overlay 617Called just before the screen gets redrawn. Can be used for overlay or
599or similar effects by modify terminal contents in refresh_begin, and 618similar effects by modifying the terminal contents in refresh_begin, and
600restoring them in refresh_end. The built-in overlay and selection display 619restoring them in refresh_end. The built-in overlay and selection display
601code is run after this hook, and takes precedence. 620code is run after this hook, and takes precedence.
602 621
603=item on_refresh_end $term 622=item on_refresh_end $term
604 623
1091is that you cannot use blocking APIs, but the non-blocking variant should 1110is that you cannot use blocking APIs, but the non-blocking variant should
1092work. 1111work.
1093 1112
1094=cut 1113=cut
1095 1114
1096our $VERSION = 1; 1115our $VERSION = '3.4';
1097 1116
1098$INC{"urxvt/anyevent.pm"} = 1; # mark us as there 1117$INC{"urxvt/anyevent.pm"} = 1; # mark us as there
1099push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::]; 1118push @AnyEvent::REGISTRY, [urxvt => urxvt::anyevent::];
1100 1119
1101sub timer { 1120sub timer {
1132 1151
1133sub DESTROY { 1152sub DESTROY {
1134 $_[0][1]->stop; 1153 $_[0][1]->stop;
1135} 1154}
1136 1155
1137sub condvar {
1138 bless \my $flag, urxvt::anyevent::
1139}
1140
1141sub broadcast {
1142 ${$_[0]}++;
1143}
1144
1145sub wait {
1146 unless (${$_[0]}) {
1147 Carp::croak "AnyEvent->condvar blocking wait unsupported in urxvt, use a non-blocking API";
1148 }
1149}
1150
1151sub one_event { 1156sub one_event {
1152 Carp::croak "AnyEvent->one_event blocking wait unsupported in urxvt, use a non-blocking API"; 1157 Carp::croak "AnyEvent->one_event blocking wait unsupported in urxvt, use a non-blocking API";
1153} 1158}
1154 1159
1155package urxvt::term; 1160package urxvt::term;
1276Here is a likely non-exhaustive list of resource names, not all of which 1281Here is a likely non-exhaustive list of resource names, not all of which
1277are supported in every build, please see the source file F</src/rsinc.h> 1282are supported in every build, please see the source file F</src/rsinc.h>
1278to see the actual list: 1283to see the actual list:
1279 1284
1280 answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont 1285 answerbackstring backgroundPixmap backspace_key boldFont boldItalicFont
1281 borderLess color cursorBlink cursorUnderline cutchars delete_key 1286 borderLess chdir color cursorBlink cursorUnderline cutchars delete_key
1282 display_name embed ext_bwidth fade font geometry hold iconName 1287 display_name embed ext_bwidth fade font geometry hold iconName
1283 imFont imLocale inputMethod insecure int_bwidth intensityStyles 1288 imFont imLocale inputMethod insecure int_bwidth intensityStyles
1284 italicFont jumpScroll lineSpace loginShell mapAlert meta8 modifier 1289 italicFont jumpScroll lineSpace loginShell mapAlert meta8 modifier
1285 mouseWheelScrollPage name override_redirect pastableTabs path perl_eval 1290 mouseWheelScrollPage name override_redirect pastableTabs path perl_eval
1286 perl_ext_1 perl_ext_2 perl_lib pointerBlank pointerBlankDelay 1291 perl_ext_1 perl_ext_2 perl_lib pointerBlank pointerBlankDelay
1294=cut 1299=cut
1295 1300
1296sub resource($$;$) { 1301sub resource($$;$) {
1297 my ($self, $name) = (shift, shift); 1302 my ($self, $name) = (shift, shift);
1298 unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0); 1303 unshift @_, $self, $name, ($name =~ s/\s*\+\s*(\d+)$// ? $1 : 0);
1299 &urxvt::term::_resource 1304 goto &urxvt::term::_resource
1300} 1305}
1301 1306
1302=item $value = $term->x_resource ($pattern) 1307=item $value = $term->x_resource ($pattern)
1303 1308
1304Returns the X-Resource for the given pattern, excluding the program or 1309Returns the X-Resource for the given pattern, excluding the program or
1387 1392
1388The methods currently supported on C<urxvt::overlay> objects are: 1393The methods currently supported on C<urxvt::overlay> objects are:
1389 1394
1390=over 4 1395=over 4
1391 1396
1392=item $overlay->set ($x, $y, $text, $rend) 1397=item $overlay->set ($x, $y, $text[, $rend])
1393 1398
1394Similar to C<< $term->ROW_t >> and C<< $term->ROW_r >> in that it puts 1399Similar to C<< $term->ROW_t >> and C<< $term->ROW_r >> in that it puts
1395text in rxvt-unicode's special encoding and an array of rendition values 1400text in rxvt-unicode's special encoding and an array of rendition values
1396at a specific position inside the overlay. 1401at a specific position inside the overlay.
1402
1403If C<$rend> is missing, then the rendition will not be changed.
1397 1404
1398=item $overlay->hide 1405=item $overlay->hide
1399 1406
1400If visible, hide the overlay, but do not destroy it. 1407If visible, hide the overlay, but do not destroy it.
1401 1408
1611 1618
1612Used after changing terminal contents to display them. 1619Used after changing terminal contents to display them.
1613 1620
1614=item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]]) 1621=item $text = $term->ROW_t ($row_number[, $new_text[, $start_col]])
1615 1622
1616Returns the text of the entire row with number C<$row_number>. Row C<0> 1623Returns the text of the entire row with number C<$row_number>. Row C<< $term->top_row >>
1617is the topmost terminal line, row C<< $term->$ncol-1 >> is the bottommost 1624is the topmost terminal line, row C<< $term->nrow-1 >> is the bottommost
1618terminal line. The scrollback buffer starts at line C<-1> and extends to
1619line C<< -$term->nsaved >>. Nothing will be returned if a nonexistent line 1625terminal line. Nothing will be returned if a nonexistent line
1620is requested. 1626is requested.
1621 1627
1622If C<$new_text> is specified, it will replace characters in the current 1628If C<$new_text> is specified, it will replace characters in the current
1623line, starting at column C<$start_col> (default C<0>), which is useful 1629line, starting at column C<$start_col> (default C<0>), which is useful
1624to replace only parts of a line. The font index in the rendition will 1630to replace only parts of a line. The font index in the rendition will
1822 1828
1823=item @atoms = $term->XListProperties ($window) 1829=item @atoms = $term->XListProperties ($window)
1824 1830
1825=item ($type,$format,$octets) = $term->XGetWindowProperty ($window, $property) 1831=item ($type,$format,$octets) = $term->XGetWindowProperty ($window, $property)
1826 1832
1827=item $term->XChangeWindowProperty ($window, $property, $type, $format, $octets) 1833=item $term->XChangeProperty ($window, $property, $type, $format, $octets)
1828 1834
1829=item $term->XDeleteProperty ($window, $property) 1835=item $term->XDeleteProperty ($window, $property)
1830 1836
1831=item $window = $term->DefaultRootWindow 1837=item $window = $term->DefaultRootWindow
1832 1838

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines