TODO: "slow" rendering mode for bidi and scripts
TODO: read property sequence is broken with respect to utf-8 etc.
TODO: http://www120.pair.com/mccarthy/nextstep/intro.htmld/Workspace.html is the correct nextstep look.
+TODO: clarify and get rid of SMOOTH_REFRESH etc.
WISH: OnTheSpot editing, or maybe switch to miiiiiiif
WISH: just for fun, do shade and tint with XRender.
WISH: support tex fonts
-TODO: resources! resources! resources!
-TODO: better environment handling in rxvt/xim etc. and urxvt::term->new
-TODO: selection-extending with rmb does not work?
- added sections for DISTRIBUTION MAINTAINERS and about
SETUID/SETGID to the FAQ.
- selection, searchable-scrollback, selection-popup and
<p>See the <code>rxvtperl(3)</code> manpage.</p>
</dd>
<p></p>
+<dt><strong><a name="item_urllauncher_3a_string"><strong>urlLauncher</strong>: <em>string</em></a></strong><br />
+</dt>
+<dd>
+Specifies the program to be started with a URL argument. Used by the
+<code>selection-popup</code> and <code>mark-urls</code> perl extensions.
+</dd>
+<p></p>
<dt><strong><a name="item_transient_2dfor_3a_windowid"><strong>transient-for</strong>: <em>windowid</em></a></strong><br />
</dt>
<dd>
.\" ========================================================================
.\"
.IX Title "rxvt 1"
-.TH rxvt 1 "2006-01-10" "6.3" "RXVT-UNICODE"
+.TH rxvt 1 "2006-01-11" "6.3" "RXVT-UNICODE"
.SH "NAME"
rxvt\-unicode (ouR XVT, unicode) \- (a VT102 emulator for the X window system)
.SH "SYNOPSIS"
will be ignored when running setuid/setgid.
.Sp
See the @@RXVT_NAME@@\fIperl\fR\|(3) manpage.
+.IP "\fBurlLauncher\fR: \fIstring\fR" 4
+.IX Item "urlLauncher: string"
+Specifies the program to be started with a \s-1URL\s0 argument. Used by the
+\&\f(CW\*(C`selection\-popup\*(C'\fR and \f(CW\*(C`mark\-urls\*(C'\fR perl extensions.
.IP "\fBtransient-for\fR: \fIwindowid\fR" 4
.IX Item "transient-for: windowid"
Sets the \s-1WM_TRANSIENT_FOR\s0 property to the given window iw.
See the @@RXVT_NAME@@perl(3) manpage.
+=item B<urlLauncher>: I<string>
+
+Specifies the program to be started with a URL argument. Used by the
+C<selection-popup> and C<mark-urls> perl extensions.
+
=item B<transient-for>: I<windowid>
Sets the WM_TRANSIENT_FOR property to the given window iw.
See the rxvtperl(3) manpage.
+ urlLauncher: *string*
+ Specifies the program to be started with a URL argument. Used by the
+ "selection-popup" and "mark-urls" perl extensions.
+
transient-for: *windowid*
Sets the WM_TRANSIENT_FOR property to the given window iw.
<dt><strong><a name="item_mark_2durls">mark-urls</a></strong><br />
</dt>
<dd>
-Uses per-line display filtering (<code>on_line_update</code>) to underline urls.
+Uses per-line display filtering (<code>on_line_update</code>) to underline urls and
+make them clickable. When clicked, the program specified in the resource
+<code>urlLauncher</code> (default <code>x-www-browser</code>) will be started.
</dd>
<p></p>
<dt><strong><a name="item_block_2dgraphics_2dto_2dascii">block-graphics-to-ascii</a></strong><br />
</dt>
<dd>
Rxvt-unicodes special way of encoding text, where one ``unicode'' character
-always represents one screen cell. See <em>row_t</em> for a discussion of this format.
+always represents one screen cell. See <a href="#item_row_t">ROW_t</a> for a discussion of this format.
</dd>
<p></p>
<dt><strong><a name="item__24string">$string</a></strong><br />
The current terminal. This variable stores the current <code>urxvt::term</code>
object, whenever a callback/hook is executing.
</dd>
-<p></p>
-<dt></dt>
-</dl>
+<p></p></dl>
<p>
</p>
<h2><a name="functions_in_the_urxvt_package">Functions in the <code>urxvt</code> Package</a></h2>
</dt>
<dd>
Creates a new terminal, very similar as if you had started it with system
-<code>$rxvtname, arg...</code>. <code>$envhashref</code> must be a reference to a %ENV>-like
-<code></code>hash which defines the environment of the new terminal.
+<code>$rxvtname, arg...</code>. <code>$envhashref</code> must be a reference to a <code>%ENV</code>-like
+hash which defines the environment of the new terminal.
</dd>
<dd>
-<p>>Croaks (and probably outputs an error message) if the new instance
+<p>Croaks (and probably outputs an error message) if the new instance
couldn't be created. Returns <code>undef</code> if the new instance didn't
initialise perl, and the terminal object otherwise. The <code>init</code> and
<a href="#item_start"><code>start</code></a> hooks will be called during this call.</p>
utmpInhibit visualBell</pre>
</dd>
<p></p>
+<dt><strong><a name="item_x_resource">$value = $term->x_resource ($pattern)</a></strong><br />
+</dt>
+<dd>
+Returns the X-Resource for the given pattern, excluding the program or
+class name, i.e. <a href="#item_x_resource"><code>$term->x_resource ("boldFont")</code></a> should return the
+same value as used by this instance of rxvt-unicode. Returns <code>undef</code> if no
+resource with that pattern exists.
+</dd>
+<dd>
+<p>This method should only be called during the <code>on_start</code> hook, as there is
+only one resource database per display, and later invocations might return
+the wrong resources.</p>
+</dd>
+<p></p>
<dt><strong><a name="item_parse_keysym">$success = $term->parse_keysym ($keysym_spec, $command_string)</a></strong><br />
</dt>
<dd>
Displays a digital clock using the built-in overlay.
.IP "mark-urls" 4
.IX Item "mark-urls"
-Uses per-line display filtering (\f(CW\*(C`on_line_update\*(C'\fR) to underline urls.
+Uses per-line display filtering (\f(CW\*(C`on_line_update\*(C'\fR) to underline urls and
+make them clickable. When clicked, the program specified in the resource
+\&\f(CW\*(C`urlLauncher\*(C'\fR (default \f(CW\*(C`x\-www\-browser\*(C'\fR) will be started.
.IP "block-graphics-to-ascii" 4
.IX Item "block-graphics-to-ascii"
A not very useful example of filtering all text output to the terminal,
.IP "$text" 4
.IX Item "$text"
Rxvt-unicodes special way of encoding text, where one \*(L"unicode\*(R" character
-always represents one screen cell. See row_t for a discussion of this format.
+always represents one screen cell. See ROW_t for a discussion of this format.
.IP "$string" 4
.IX Item "$string"
A perl text string, with an emphasis on \fItext\fR. It can store all unicode
.IX Item "$urxvt::TERM"
The current terminal. This variable stores the current \f(CW\*(C`urxvt::term\*(C'\fR
object, whenever a callback/hook is executing.
-.IP "*" 4
.ie n .Sh "Functions in the ""urxvt"" Package"
.el .Sh "Functions in the \f(CWurxvt\fP Package"
.IX Subsection "Functions in the urxvt Package"
-.PD 0
.ie n .IP "urxvt::fatal $errormessage" 4
.el .IP "urxvt::fatal \f(CW$errormessage\fR" 4
.IX Item "urxvt::fatal $errormessage"
-.PD
Fatally aborts execution with the given error message. Avoid at all
costs! The only time this is acceptable is when the terminal process
starts up.
.el .IP "$term = new urxvt::term \f(CW$envhashref\fR, \f(CW$rxvtname\fR, [arg...]" 4
.IX Item "$term = new urxvt::term $envhashref, $rxvtname, [arg...]"
Creates a new terminal, very similar as if you had started it with system
-\&\f(CW\*(C`$rxvtname, arg...\*(C'\fR. \f(CW$envhashref\fR must be a reference to a \f(CW%ENV\fR>\-like
-\&\f(CW\*(C`hash which defines the environment of the new terminal.
-
-\&\*(C'\fR.Sp
->Croaks (and probably outputs an error message) if the new instance
+\&\f(CW\*(C`$rxvtname, arg...\*(C'\fR. \f(CW$envhashref\fR must be a reference to a \f(CW%ENV\fR\-like
+hash which defines the environment of the new terminal.
+.Sp
+Croaks (and probably outputs an error message) if the new instance
couldn't be created. Returns \f(CW\*(C`undef\*(C'\fR if the new instance didn't
initialise perl, and the terminal object otherwise. The \f(CW\*(C`init\*(C'\fR and
\&\f(CW\*(C`start\*(C'\fR hooks will be called during this call.
\& shade term_name title transparent transparent_all tripleclickwords
\& utmpInhibit visualBell
.Ve
+.ie n .IP "$value = $term\->x_resource ($pattern)" 4
+.el .IP "$value = \f(CW$term\fR\->x_resource ($pattern)" 4
+.IX Item "$value = $term->x_resource ($pattern)"
+Returns the X\-Resource for the given pattern, excluding the program or
+class name, i.e. \f(CW\*(C`$term\->x_resource ("boldFont")\*(C'\fR should return the
+same value as used by this instance of rxvt\-unicode. Returns \f(CW\*(C`undef\*(C'\fR if no
+resource with that pattern exists.
+.Sp
+This method should only be called during the \f(CW\*(C`on_start\*(C'\fR hook, as there is
+only one resource database per display, and later invocations might return
+the wrong resources.
.ie n .IP "$success = $term\fR\->parse_keysym ($keysym_spec, \f(CW$command_string)" 4
.el .IP "$success = \f(CW$term\fR\->parse_keysym ($keysym_spec, \f(CW$command_string\fR)" 4
.IX Item "$success = $term->parse_keysym ($keysym_spec, $command_string)"
.IX Subsection "The urxvt::timer Class"
This class implements timer watchers/events. Time is represented as a
fractional number of seconds since the epoch. Example:
-.Sp
+.PP
.Vb 8
\& $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
\& $term->{timer} = urxvt::timer
\& sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
\& });
.Ve
-.RS 4
.IP "$timer = new urxvt::timer" 4
.IX Item "$timer = new urxvt::timer"
Create a new timer object in started state. It is scheduled to fire
.el .IP "$timer = \f(CW$timer\fR\->stop" 4
.IX Item "$timer = $timer->stop"
Stop the timer.
-.RE
-.RS 4
.ie n .Sh "The ""urxvt::iow"" Class"
.el .Sh "The \f(CWurxvt::iow\fP Class"
.IX Subsection "The urxvt::iow Class"
This class implements io watchers/events. Example:
-.Sp
+.PP
.Vb 12
\& $term->{socket} = ...
\& $term->{iow} = urxvt::iow
.el .IP "$iow = \f(CW$iow\fR\->stop" 4
.IX Item "$iow = $iow->stop"
Stop watching for events on the given filehandle.
-.RE
-.RS 4
.SH "ENVIRONMENT"
.IX Header "ENVIRONMENT"
.Sh "\s-1URXVT_PERL_VERBOSITY\s0"
.IX Item ">= 3 - script loading and management"
.IP ">=10 \- all events received" 4
.IX Item ">=10 - all events received"
-.RE
-.RS 4
.PD
.SH "AUTHOR"
.IX Header "AUTHOR"
Displays a digital clock using the built-in overlay.
mark-urls
- Uses per-line display filtering ("on_line_update") to underline
- urls.
+ Uses per-line display filtering ("on_line_update") to underline urls
+ and make them clickable. When clicked, the program specified in the
+ resource "urlLauncher" (default "x-www-browser") will be started.
block-graphics-to-ascii
A not very useful example of filtering all text output to the
$text
Rxvt-unicodes special way of encoding text, where one "unicode"
- character always represents one screen cell. See row_t for a
+ character always represents one screen cell. See ROW_t for a
discussion of this format.
$string
The current terminal. This variable stores the current "urxvt::term"
object, whenever a callback/hook is executing.
- *
-
Functions in the "urxvt" Package
urxvt::fatal $errormessage
Fatally aborts execution with the given error message. Avoid at all
$term = new urxvt::term $envhashref, $rxvtname, [arg...]
Creates a new terminal, very similar as if you had started it with
system "$rxvtname, arg...". $envhashref must be a reference to a
- %ENV>-like "hash which defines the environment of the new terminal.
- "
+ %ENV-like hash which defines the environment of the new terminal.
- >Croaks (and probably outputs an error message) if the new instance
+ Croaks (and probably outputs an error message) if the new instance
couldn't be created. Returns "undef" if the new instance didn't
initialise perl, and the terminal object otherwise. The "init" and
"start" hooks will be called during this call.
shade term_name title transparent transparent_all tripleclickwords
utmpInhibit visualBell
+ $value = $term->x_resource ($pattern)
+ Returns the X-Resource for the given pattern, excluding the program
+ or class name, i.e. "$term->x_resource ("boldFont")" should return
+ the same value as used by this instance of rxvt-unicode. Returns
+ "undef" if no resource with that pattern exists.
+
+ This method should only be called during the "on_start" hook, as
+ there is only one resource database per display, and later
+ invocations might return the wrong resources.
+
$success = $term->parse_keysym ($keysym_spec, $command_string)
Adds a keymap translation exactly as specified via a resource. See
the "keysym" resource in the rxvt(1) manpage.
Displays the popup (which is initially hidden).
The "urxvt::timer" Class
- This class implements timer watchers/events. Time is represented as
- a fractional number of seconds since the epoch. Example:
+ This class implements timer watchers/events. Time is represented as a
+ fractional number of seconds since the epoch. Example:
- $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
- $term->{timer} = urxvt::timer
- ->new
- ->interval (1)
- ->cb (sub {
- $term->{overlay}->set (0, 0,
- sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
- });
+ $term->{overlay} = $term->overlay (-1, 0, 8, 1, urxvt::OVERLAY_RSTYLE, 0);
+ $term->{timer} = urxvt::timer
+ ->new
+ ->interval (1)
+ ->cb (sub {
+ $term->{overlay}->set (0, 0,
+ sprintf "%2d:%02d:%02d", (localtime urxvt::NOW)[2,1,0]);
+ });
- $timer = new urxvt::timer
- Create a new timer object in started state. It is scheduled to
- fire immediately.
+ $timer = new urxvt::timer
+ Create a new timer object in started state. It is scheduled to fire
+ immediately.
- $timer = $timer->cb (sub { my ($timer) = @_; ... })
- Set the callback to be called when the timer triggers.
+ $timer = $timer->cb (sub { my ($timer) = @_; ... })
+ Set the callback to be called when the timer triggers.
- $tstamp = $timer->at
- Return the time this watcher will fire next.
+ $tstamp = $timer->at
+ Return the time this watcher will fire next.
- $timer = $timer->set ($tstamp)
- Set the time the event is generated to $tstamp.
+ $timer = $timer->set ($tstamp)
+ Set the time the event is generated to $tstamp.
- $timer = $timer->interval ($interval)
- Normally (and when $interval is 0), the timer will automatically
- stop after it has fired once. If $interval is non-zero, then the
- timer is automatically rescheduled at the given intervals.
+ $timer = $timer->interval ($interval)
+ Normally (and when $interval is 0), the timer will automatically
+ stop after it has fired once. If $interval is non-zero, then the
+ timer is automatically rescheduled at the given intervals.
- $timer = $timer->start
- Start the timer.
+ $timer = $timer->start
+ Start the timer.
- $timer = $timer->start ($tstamp)
- Set the event trigger time to $tstamp and start the timer.
+ $timer = $timer->start ($tstamp)
+ Set the event trigger time to $tstamp and start the timer.
- $timer = $timer->stop
- Stop the timer.
+ $timer = $timer->stop
+ Stop the timer.
The "urxvt::iow" Class
- This class implements io watchers/events. Example:
-
- $term->{socket} = ...
- $term->{iow} = urxvt::iow
- ->new
- ->fd (fileno $term->{socket})
- ->events (urxvt::EVENT_READ)
- ->start
- ->cb (sub {
- my ($iow, $revents) = @_;
- # $revents must be 1 here, no need to check
- sysread $term->{socket}, my $buf, 8192
- or end-of-file;
- });
-
- $iow = new urxvt::iow
- Create a new io watcher object in stopped state.
-
- $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... })
- Set the callback to be called when io events are triggered.
- $reventmask is a bitset as described in the "events" method.
-
- $iow = $iow->fd ($fd)
- Set the filedescriptor (not handle) to watch.
-
- $iow = $iow->events ($eventmask)
- Set the event mask to watch. The only allowed values are
- "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be
- ORed together, or "urxvt::EVENT_NONE".
-
- $iow = $iow->start
- Start watching for requested events on the given handle.
-
- $iow = $iow->stop
- Stop watching for events on the given filehandle.
+ This class implements io watchers/events. Example:
+
+ $term->{socket} = ...
+ $term->{iow} = urxvt::iow
+ ->new
+ ->fd (fileno $term->{socket})
+ ->events (urxvt::EVENT_READ)
+ ->start
+ ->cb (sub {
+ my ($iow, $revents) = @_;
+ # $revents must be 1 here, no need to check
+ sysread $term->{socket}, my $buf, 8192
+ or end-of-file;
+ });
+
+ $iow = new urxvt::iow
+ Create a new io watcher object in stopped state.
+
+ $iow = $iow->cb (sub { my ($iow, $reventmask) = @_; ... })
+ Set the callback to be called when io events are triggered.
+ $reventmask is a bitset as described in the "events" method.
+
+ $iow = $iow->fd ($fd)
+ Set the filedescriptor (not handle) to watch.
+
+ $iow = $iow->events ($eventmask)
+ Set the event mask to watch. The only allowed values are
+ "urxvt::EVENT_READ" and "urxvt::EVENT_WRITE", which might be ORed
+ together, or "urxvt::EVENT_NONE".
+
+ $iow = $iow->start
+ Start watching for requested events on the given handle.
+
+ $iow = $iow->stop
+ Stop watching for events on the given filehandle.
ENVIRONMENT
URXVT_PERL_VERBOSITY
- This variable controls the verbosity level of the perl extension.
- Higher numbers indicate more verbose output.
+ This variable controls the verbosity level of the perl extension. Higher
+ numbers indicate more verbose output.
- == 0 - fatal messages
- >= 3 - script loading and management
- >=10 - all events received
+ == 0 - fatal messages
+ >= 3 - script loading and management
+ >=10 - all events received
AUTHOR
- Marc Lehmann <pcg@goof.com>
- http://software.schmorp.de/pkg/rxvt-unicode
+ Marc Lehmann <pcg@goof.com>
+ http://software.schmorp.de/pkg/rxvt-unicode
do
{
- l = &ROW (row++);
+ l = &ROW (row);
if (l->f & LINE_FILTERED)
row++;
scr_expose (ev.xexpose.x, ev.xexpose.y,
ev.xexpose.width, ev.xexpose.height, False);
- scr_refresh (refresh_type);
+ want_refresh = 1;
}
else
{
&unused_mask);
scr_move_to (scrollbar_position (ev.xbutton.y) - csrO,
scrollbar_size ());
- scr_refresh (refresh_type);
+ want_refresh = 1;
refresh_limit = 0;
scrollbar_show (1);
}
else
{
# endif
-# ifdef JUMP_MOUSE_WHEEL
scr_page (v, i);
- scr_refresh (SMOOTH_REFRESH);
scrollbar_show (1);
-# else
- while (i--)
- {
- scr_page (v, 1);
- scr_refresh (SMOOTH_REFRESH);
- scrollbar_show (1);
- }
-# endif
# ifdef MOUSE_SLIP_WHEELING
}
-#endif
+# endif
}
break;
#endif
{
flag = true;
scr_refresh (refresh_type);
- flush_ev.stop ();
+ want_refresh = 1;
}
}
*/
#define MOUSE_THRESHOLD 50
-/*
- * If mouse wheel is defined, then scrolling is by 5 lines (or 1 line
- * if the shift key is down). Scrolling can be smooth or jump scrolling
- */
-#define JUMP_MOUSE_WHEEL
-
/*
* Set delay periods for continuous scrolling with scrollbar buttons
*/
[ab-zA-Z0-9\-\@;\/?:&=%\$_+!*\x27()~] # exclude some trailing characters (heuristic)
)}x;
+sub on_start {
+ my ($self) = @_;
+
+ $self->{browser} = urxvt::untaint $self->x_resource ("urlLauncher") || "x-www-browser";
+}
+
sub on_line_update {
my ($self, $row) = @_;
()
}
-# needs confgiurability TODO
-#sub on_button_press {
-# my ($self, $event) = @_;
-# my $row = $event->{row};
-# my $col = $event->{col};
-#
-# my $line = $self->line ($row);
-# my $text = $line->t;
-#
-# while($text =~ /$url/g) {
-# #print "... " . ($-[0]
-# if ($-[0] <= $col && $+[0] >= $col) {
-# system "firefox \Q$1\E &";
-# return 1;
-# }
-# }
-# ()
-#}
+sub on_button_press {
+ my ($self, $event) = @_;
+ my $row = $event->{row};
+ my $col = $event->{col};
+
+ my $line = $self->line ($row);
+ my $text = $line->t;
+
+ while($text =~ /$url/g) {
+ if ($-[0] <= $col && $+[0] >= $col) {
+ system "$self->{browser} \Q$1\E &";
+ return 1;
+ }
+ }
+ ()
+}
sub on_init {
my ($self) = @_;
- my $hotkey = $self->{argv}[0] || "M-s";
+ my $hotkey = $self->{argv}[0]
+ || $self->x_resource ("searchable-scrollback")
+ || "M-s";
$self->parse_keysym ($hotkey, "perl:searchable-scrollback:start")
or warn "unable to register '$hotkey' as scrollback search start hotkey\n";
);
$self->{manpage_overlay} = $self->overlay (0, -2, $self->ncol, 1, urxvt::OVERLAY_RSTYLE, 0);
- $self->{manpage_overlay}->set (0, 0, "scrollback search, see man ${urxvt::RXVTNAME}perl");
+ $self->{manpage_overlay}->set (0, 0, "scrollback search, see the ${urxvt::RXVTNAME}perl manpage for details");
$self->idle;
}
sub on_start {
my ($self) = @_;
+ $self->{browser} = urxvt::untaint $self->x_resource ("urlLauncher") || "x-www-browser";
+
$self->grab_button (3, urxvt::ControlMask);
}
and $add_button->("shell quote" => sub { $_ = "\Q$_" });
/^(http|ftp|telnet|irc|news):\//
- and $add_button->("run x-www-browser" => sub { system "x-www-browser \Q$_\E &" });
+ and $add_button->("run $self->{browser}" => sub { system "$self->{browser} \Q$_\E &" });
}
$popup->show;
void init_secondary ();
const char **init_resources (int argc, const char *const *argv);
+ const char *x_resource (const char *name);
void init_env ();
void set_locale (const char *locale);
void init_xlocale ();
}
}
+const char *
+rxvt_term::x_resource (const char *name)
+ CLEANUP:
+ SvTAINTED_on (ST (0));
+
bool
rxvt_term::option (U32 optval, int set = -1)
CODE:
*/
scr_reverse_selection ();
- if (refresh_type & SMOOTH_REFRESH)
- XFlush (display->display);
-
num_scr = 0;
num_scr_allow = 1;
}
=item mark-urls
-Uses per-line display filtering (C<on_line_update>) to underline urls.
+Uses per-line display filtering (C<on_line_update>) to underline urls and
+make them clickable. When clicked, the program specified in the resource
+C<urlLauncher> (default C<x-www-browser>) will be started.
=item block-graphics-to-ascii
=item $text
Rxvt-unicodes special way of encoding text, where one "unicode" character
-always represents one screen cell. See L<row_t> for a discussion of this format.
+always represents one screen cell. See L<ROW_t> for a discussion of this format.
=item $string
The current terminal. This variable stores the current C<urxvt::term>
object, whenever a callback/hook is executing.
-=item
-
=back
=head2 Functions in the C<urxvt> Package
=item $term = new urxvt::term $envhashref, $rxvtname, [arg...]
Creates a new terminal, very similar as if you had started it with system
-C<$rxvtname, arg...>. C<$envhashref> must be a reference to a %ENV>-like
-C<hash which defines the environment of the new terminal.
+C<$rxvtname, arg...>. C<$envhashref> must be a reference to a C<%ENV>-like
+hash which defines the environment of the new terminal.
Croaks (and probably outputs an error message) if the new instance
couldn't be created. Returns C<undef> if the new instance didn't
&urxvt::term::_resource
}
+=item $value = $term->x_resource ($pattern)
+
+Returns the X-Resource for the given pattern, excluding the program or
+class name, i.e. C<< $term->x_resource ("boldFont") >> should return the
+same value as used by this instance of rxvt-unicode. Returns C<undef> if no
+resource with that pattern exists.
+
+This method should only be called during the C<on_start> hook, as there is
+only one resource database per display, and later invocations might return
+the wrong resources.
+
=item $success = $term->parse_keysym ($keysym_spec, $command_string)
Adds a keymap translation exactly as specified via a resource. See the
$self->{term}->ungrab;
}
+=back
+
=head2 The C<urxvt::timer> Class
This class implements timer watchers/events. Time is represented as a
# endif /* KEYSYM_RESOURCE */
#endif /* NO_RESOURCES */
-char *get_res (XrmDatabase database, const char *program, const char *option)
+static char *
+get_res (XrmDatabase database, const char *program, const char *option)
{
char resource[512];
char *type;
return result.addr;
}
-/*{{{ read the resources files */
-/*
- * using XGetDefault () or the hand-rolled replacement
- */
-/* ARGSUSED */
+const char *
+rxvt_term::x_resource (const char *name)
+{
+ XrmDatabase database = XrmGetDatabase (display->display);
+
+ const char *p = get_res (database, rs[Rs_name], name);
+ const char *p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", name);
+
+ if (p == NULL || (p0 && strcmp (p, p0) == 0))
+ {
+ p = get_res (database, RESCLASS, name);
+#ifdef RESFALLBACK
+ if (p == NULL || (p0 && strcmp (p, p0) == 0))
+ p = get_res (database, RESFALLBACK, name);
+#endif
+ }
+
+ if (p == NULL && p0)
+ p = p0;
+
+ return p;
+}
+
void
rxvt_term::extract_resources ()
{
- dDisp;
-
#ifndef NO_RESOURCES
- XrmDatabase database = XrmGetDatabase (display->display);
-
/*
* Query resources for options that affect us
*/
for (int entry = 0; entry < optList_size; entry++)
{
int s;
- char *p, *p0;
const char *kw = optList[entry].kw;
if (kw == NULL || rs[optList[entry].doff] != NULL)
continue; // previously set
- p = get_res (database, rs[Rs_name], kw);
- p0 = get_res (database, "!INVALIDPROGRAMMENAMEDONTMATCH!", kw);
- if (p == NULL || (p0 && strcmp (p, p0) == 0))
- {
- p = get_res (database, RESCLASS, kw);
-#ifdef RESFALLBACK
- if (p == NULL || (p0 && strcmp (p, p0) == 0))
- p = get_res (database, RESFALLBACK, kw);
-#endif
- }
-
- if (p == NULL && p0)
- p = p0;
+ const char *p = x_resource (kw);
if (p)
{
p = strdup (p);
- allocated.push_back (p);
+ allocated.push_back ((void *)p);
rs[optList[entry].doff] = p;
if (optList_isBool (entry))
* [R5 or later]: enumerate the resource database
*/
# ifdef KEYSYM_RESOURCE
+ XrmDatabase database = XrmGetDatabase (display->display);
XrmName name_prefix[3];
XrmClass class_prefix[3];
#endif /* NO_RESOURCES */
}
-/*}}} */
/*----------------------- end-of-file (C source) -----------------------*/