From c29f8a1bac9768de5201662635296f49f7d2b537 Mon Sep 17 00:00:00 2001
From: root
Date: Tue, 10 Jan 2006 19:46:28 +0000
Subject: [PATCH] *** empty log message ***
---
doc/rxvtperl.3.html | 76 ++++++++++++++++++++++++++++++++++++++-----
doc/rxvtperl.3.man.in | 70 ++++++++++++++++++++++++++++++---------
doc/rxvtperl.3.txt | 49 ++++++++++++++++++++++++----
src/urxvt.pm | 51 ++++++++++++++++++++++++-----
4 files changed, 205 insertions(+), 41 deletions(-)
diff --git a/doc/rxvtperl.3.html b/doc/rxvtperl.3.html
index 03acad9a..624de21d 100644
--- a/doc/rxvtperl.3.html
+++ b/doc/rxvtperl.3.html
@@ -453,13 +453,34 @@ output, if any, in locale-specific encoding.
+- $urxvt::LIBDIR
+
+-
+The rxvt-unicode library directory, where, among other things, the perl
+modules and scripts are stored.
+
+
+- $urxvt::RESCLASS, $urxvt::RESCLASS
+
+-
+The resource class and name rxvt-unicode uses to look up X resources.
+
+
+- $urxvt::RXVTNAME
+
+-
+The basename of the installed binaries, usually
urxvt
.
+
+
- $urxvt::TERM
-
The current terminal. This variable stores the current
urxvt::term
object, whenever a callback/hook is executing.
-
+
+
+
@@ -557,16 +578,16 @@ the bitset.
Return the foreground/background colour index, respectively.
-$rend = urxvt::SET_FGCOLOR ($rend, $new_colour)
+$rend = urxvt::SET_FGCOLOR $rend, $new_colour
-$rend = urxvt::SET_BGCOLOR ($rend, $new_colour)
+$rend = urxvt::SET_BGCOLOR $rend, $new_colour
Replace the foreground/background colour in the rendition mask with the
specified one.
-$value = urxvt::GET_CUSTOM ($rend)
+$value = urxvt::GET_CUSTOM $rend
Return the ``custom'' value: Every rendition has 5 bits for use by
@@ -574,7 +595,7 @@ extensions. They can be set and changed as you like and are initially
zero.
-$rend = urxvt::SET_CUSTOM ($rend, $new_value)
+$rend = urxvt::SET_CUSTOM $rend, $new_value
Change the custom value.
@@ -585,9 +606,10 @@ Change the custom value.
The sole purpose of this class is to deliver an interface to the
AnyEvent
module - any module using it will work inside urxvt without
-further work. The only exception is that you cannot wait on condition
-variables, but non-blocking condvar use is ok. What this means is that you
-cannot use blocking APIs, but the non-blocking variant should work.
+further programming. The only exception is that you cannot wait on
+condition variables, but non-blocking condvar use is ok. What this means
+is that you cannot use blocking APIs, but the non-blocking variant should
+work.
@@ -595,7 +617,9 @@ cannot use blocking APIs, but the non-blocking variant should work.
$term->destroy
-Destroy the terminal object (close the window, free resources etc.).
+Destroy the terminal object (close the window, free resources
+etc.). Please note that rxvt will not exit as long as any event
+watchers (timers, io watchers) are still active.
$isset = $term->option ($optval[, $set])
@@ -1094,6 +1118,40 @@ the session.
+
+- $popup->add_title ($title)
+
+-
+Adds a non-clickable title to the popup.
+
+
+- $popup->add_separator ([$sepchr])
+
+-
+Creates a separator, optionally using the character given as
$sepchr
.
+
+
+- $popup->add_button ($text, $cb)
+
+-
+Adds a clickable button to the popup.
$cb
is called whenever it is
+selected.
+
+
+- $popup->add_toggle ($text, $cb, $initial_value)
+
+-
+Adds a toggle/checkbox item to the popup. Teh callback gets called
+whenever it gets toggled, with a boolean indicating its value as its first
+argument.
+
+
+- $popup->show
+
+-
+Displays the popup (which is initially hidden).
+
+
diff --git a/doc/rxvtperl.3.man.in b/doc/rxvtperl.3.man.in
index 2189ba5a..d5c939ca 100644
--- a/doc/rxvtperl.3.man.in
+++ b/doc/rxvtperl.3.man.in
@@ -462,15 +462,29 @@ subwindow.
.ie n .Sh "Variables in the ""urxvt"" Package"
.el .Sh "Variables in the \f(CWurxvt\fP Package"
.IX Subsection "Variables in the urxvt Package"
+.IP "$urxvt::LIBDIR" 4
+.IX Item "$urxvt::LIBDIR"
+The rxvt-unicode library directory, where, among other things, the perl
+modules and scripts are stored.
+.ie n .IP "$urxvt::RESCLASS, $urxvt::RESCLASS" 4
+.el .IP "$urxvt::RESCLASS, \f(CW$urxvt::RESCLASS\fR" 4
+.IX Item "$urxvt::RESCLASS, $urxvt::RESCLASS"
+The resource class and name rxvt-unicode uses to look up X resources.
+.IP "$urxvt::RXVTNAME" 4
+.IX Item "$urxvt::RXVTNAME"
+The basename of the installed binaries, usually \f(CW\*(C`urxvt\*(C'\fR.
.IP "$urxvt::TERM" 4
.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
.IP "$term = new urxvt [arg...]" 4
.IX Item "$term = new urxvt [arg...]"
+.PD
Creates a new terminal, very similar as if you had started it with
\&\f(CW\*(C`system $binfile, arg...\*(C'\fR. 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
@@ -536,39 +550,43 @@ the bitset.
.IX Item "$background = urxvt::GET_BASEBG $rend"
.PD
Return the foreground/background colour index, respectively.
-.ie n .IP "$rend = urxvt::SET_FGCOLOR ($rend, $new_colour)" 4
-.el .IP "$rend = urxvt::SET_FGCOLOR ($rend, \f(CW$new_colour\fR)" 4
-.IX Item "$rend = urxvt::SET_FGCOLOR ($rend, $new_colour)"
+.ie n .IP "$rend = urxvt::SET_FGCOLOR $rend\fR, \f(CW$new_colour" 4
+.el .IP "$rend = urxvt::SET_FGCOLOR \f(CW$rend\fR, \f(CW$new_colour\fR" 4
+.IX Item "$rend = urxvt::SET_FGCOLOR $rend, $new_colour"
.PD 0
-.ie n .IP "$rend = urxvt::SET_BGCOLOR ($rend, $new_colour)" 4
-.el .IP "$rend = urxvt::SET_BGCOLOR ($rend, \f(CW$new_colour\fR)" 4
-.IX Item "$rend = urxvt::SET_BGCOLOR ($rend, $new_colour)"
+.ie n .IP "$rend = urxvt::SET_BGCOLOR $rend\fR, \f(CW$new_colour" 4
+.el .IP "$rend = urxvt::SET_BGCOLOR \f(CW$rend\fR, \f(CW$new_colour\fR" 4
+.IX Item "$rend = urxvt::SET_BGCOLOR $rend, $new_colour"
.PD
Replace the foreground/background colour in the rendition mask with the
specified one.
-.IP "$value = urxvt::GET_CUSTOM ($rend)" 4
-.IX Item "$value = urxvt::GET_CUSTOM ($rend)"
+.ie n .IP "$value = urxvt::GET_CUSTOM $rend" 4
+.el .IP "$value = urxvt::GET_CUSTOM \f(CW$rend\fR" 4
+.IX Item "$value = urxvt::GET_CUSTOM $rend"
Return the \*(L"custom\*(R" value: Every rendition has 5 bits for use by
extensions. They can be set and changed as you like and are initially
zero.
-.ie n .IP "$rend = urxvt::SET_CUSTOM ($rend, $new_value)" 4
-.el .IP "$rend = urxvt::SET_CUSTOM ($rend, \f(CW$new_value\fR)" 4
-.IX Item "$rend = urxvt::SET_CUSTOM ($rend, $new_value)"
+.ie n .IP "$rend = urxvt::SET_CUSTOM $rend\fR, \f(CW$new_value" 4
+.el .IP "$rend = urxvt::SET_CUSTOM \f(CW$rend\fR, \f(CW$new_value\fR" 4
+.IX Item "$rend = urxvt::SET_CUSTOM $rend, $new_value"
Change the custom value.
.ie n .Sh "The ""urxvt::anyevent"" Class"
.el .Sh "The \f(CWurxvt::anyevent\fP Class"
.IX Subsection "The urxvt::anyevent Class"
The sole purpose of this class is to deliver an interface to the
\&\f(CW\*(C`AnyEvent\*(C'\fR module \- any module using it will work inside urxvt without
-further work. The only exception is that you cannot wait on condition
-variables, but non-blocking condvar use is ok. What this means is that you
-cannot use blocking APIs, but the non-blocking variant should work.
+further programming. The only exception is that you cannot wait on
+condition variables, but non-blocking condvar use is ok. What this means
+is that you cannot use blocking APIs, but the non-blocking variant should
+work.
.ie n .Sh "The ""urxvt::term"" Class"
.el .Sh "The \f(CWurxvt::term\fP Class"
.IX Subsection "The urxvt::term Class"
.IP "$term\->destroy" 4
.IX Item "$term->destroy"
-Destroy the terminal object (close the window, free resources etc.).
+Destroy the terminal object (close the window, free resources
+etc.). Please note that @@RXVT_NAME@@ will not exit as long as any event
+watchers (timers, io watchers) are still active.
.ie n .IP "$isset = $term\fR\->option ($optval[, \f(CW$set])" 4
.el .IP "$isset = \f(CW$term\fR\->option ($optval[, \f(CW$set\fR])" 4
.IX Item "$isset = $term->option ($optval[, $set])"
@@ -967,10 +985,29 @@ the session.
.ie n .Sh "The ""urxvt::popup"" Class"
.el .Sh "The \f(CWurxvt::popup\fP Class"
.IX Subsection "The urxvt::popup Class"
+.IP "$popup\->add_title ($title)" 4
+.IX Item "$popup->add_title ($title)"
+Adds a non-clickable title to the popup.
+.IP "$popup\->add_separator ([$sepchr])" 4
+.IX Item "$popup->add_separator ([$sepchr])"
+Creates a separator, optionally using the character given as \f(CW$sepchr\fR.
+.ie n .IP "$popup\->add_button ($text, $cb)" 4
+.el .IP "$popup\->add_button ($text, \f(CW$cb\fR)" 4
+.IX Item "$popup->add_button ($text, $cb)"
+Adds a clickable button to the popup. \f(CW$cb\fR is called whenever it is
+selected.
+.ie n .IP "$popup\->add_toggle ($text, $cb\fR, \f(CW$initial_value)" 4
+.el .IP "$popup\->add_toggle ($text, \f(CW$cb\fR, \f(CW$initial_value\fR)" 4
+.IX Item "$popup->add_toggle ($text, $cb, $initial_value)"
+Adds a toggle/checkbox item to the popup. Teh callback gets called
+whenever it gets toggled, with a boolean indicating its value as its first
+argument.
+.IP "$popup\->show" 4
+.IX Item "$popup->show"
+Displays the popup (which is initially hidden).
.ie n .Sh "The ""urxvt::timer"" Class"
.el .Sh "The \f(CWurxvt::timer\fP Class"
.IX Subsection "The urxvt::timer Class"
-.RS 4
This class implements timer watchers/events. Time is represented as a
fractional number of seconds since the epoch. Example:
.Sp
@@ -984,6 +1021,7 @@ fractional number of seconds since the epoch. Example:
\& 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
diff --git a/doc/rxvtperl.3.txt b/doc/rxvtperl.3.txt
index ee4e5fe1..713d8fb5 100644
--- a/doc/rxvtperl.3.txt
+++ b/doc/rxvtperl.3.txt
@@ -286,10 +286,23 @@ API DOCUMENTATION
subwindow.
Variables in the "urxvt" Package
+ $urxvt::LIBDIR
+ The rxvt-unicode library directory, where, among other things, the
+ perl modules and scripts are stored.
+
+ $urxvt::RESCLASS, $urxvt::RESCLASS
+ The resource class and name rxvt-unicode uses to look up X
+ resources.
+
+ $urxvt::RXVTNAME
+ The basename of the installed binaries, usually "urxvt".
+
$urxvt::TERM
The current terminal. This variable stores the current "urxvt::term"
object, whenever a callback/hook is executing.
+ *
+
Functions in the "urxvt" Package
$term = new urxvt [arg...]
Creates a new terminal, very similar as if you had started it with
@@ -352,29 +365,32 @@ API DOCUMENTATION
$background = urxvt::GET_BASEBG $rend
Return the foreground/background colour index, respectively.
- $rend = urxvt::SET_FGCOLOR ($rend, $new_colour)
- $rend = urxvt::SET_BGCOLOR ($rend, $new_colour)
+ $rend = urxvt::SET_FGCOLOR $rend, $new_colour
+ $rend = urxvt::SET_BGCOLOR $rend, $new_colour
Replace the foreground/background colour in the rendition mask with
the specified one.
- $value = urxvt::GET_CUSTOM ($rend)
+ $value = urxvt::GET_CUSTOM $rend
Return the "custom" value: Every rendition has 5 bits for use by
extensions. They can be set and changed as you like and are
initially zero.
- $rend = urxvt::SET_CUSTOM ($rend, $new_value)
+ $rend = urxvt::SET_CUSTOM $rend, $new_value
Change the custom value.
The "urxvt::anyevent" Class
The sole purpose of this class is to deliver an interface to the
"AnyEvent" module - any module using it will work inside urxvt without
- further work. The only exception is that you cannot wait on condition
- variables, but non-blocking condvar use is ok. What this means is that
- you cannot use blocking APIs, but the non-blocking variant should work.
+ further programming. The only exception is that you cannot wait on
+ condition variables, but non-blocking condvar use is ok. What this means
+ is that you cannot use blocking APIs, but the non-blocking variant
+ should work.
The "urxvt::term" Class
$term->destroy
Destroy the terminal object (close the window, free resources etc.).
+ Please note that rxvt will not exit as long as any event watchers
+ (timers, io watchers) are still active.
$isset = $term->option ($optval[, $set])
Returns true if the option specified by $optval is enabled, and
@@ -693,6 +709,25 @@ API DOCUMENTATION
case as the session.
The "urxvt::popup" Class
+ $popup->add_title ($title)
+ Adds a non-clickable title to the popup.
+
+ $popup->add_separator ([$sepchr])
+ Creates a separator, optionally using the character given as
+ $sepchr.
+
+ $popup->add_button ($text, $cb)
+ Adds a clickable button to the popup. $cb is called whenever it is
+ selected.
+
+ $popup->add_toggle ($text, $cb, $initial_value)
+ Adds a toggle/checkbox item to the popup. Teh callback gets called
+ whenever it gets toggled, with a boolean indicating its value as its
+ first argument.
+
+ $popup->show
+ 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:
diff --git a/src/urxvt.pm b/src/urxvt.pm
index 0cef7cbd..c943bd83 100644
--- a/src/urxvt.pm
+++ b/src/urxvt.pm
@@ -1313,6 +1313,28 @@ sub add_item {
push @{ $self->{item} }, $item;
}
+=item $popup->add_title ($title)
+
+Adds a non-clickable title to the popup.
+
+=cut
+
+sub add_title {
+ my ($self, $title) = @_;
+
+ $self->add_item ({
+ rend => { normal => "\x1b[38;5;11;44m", hover => "\x1b[38;5;11;44m", active => "\x1b[38;5;11;44m" },
+ text => $title,
+ activate => sub { },
+ });
+}
+
+=item $popup->add_separator ([$sepchr])
+
+Creates a separator, optionally using the character given as C<$sepchr>.
+
+=cut
+
sub add_separator {
my ($self, $sep) = @_;
@@ -1326,15 +1348,12 @@ sub add_separator {
});
}
-sub add_title {
- my ($self, $title) = @_;
+=item $popup->add_button ($text, $cb)
- $self->add_item ({
- rend => { normal => "\x1b[38;5;11;44m", hover => "\x1b[38;5;11;44m", active => "\x1b[38;5;11;44m" },
- text => $title,
- activate => sub { },
- });
-}
+Adds a clickable button to the popup. C<$cb> is called whenever it is
+selected.
+
+=cut
sub add_button {
my ($self, $text, $cb) = @_;
@@ -1342,6 +1361,14 @@ sub add_button {
$self->add_item ({ type => "button", text => $text, activate => $cb});
}
+=item $popup->add_toggle ($text, $cb, $initial_value)
+
+Adds a toggle/checkbox item to the popup. Teh callback gets called
+whenever it gets toggled, with a boolean indicating its value as its first
+argument.
+
+=cut
+
sub add_toggle {
my ($self, $text, $cb, $value) = @_;
@@ -1350,12 +1377,18 @@ sub add_toggle {
text => " $text",
value => $value,
render => sub { ($_[0]{value} ? "* " : " ") . $text },
- activate => sub { $cb->($_[0]{value} = !$_[0]{value}); },
+ activate => sub { $cb->($_[1]{value} = !$_[1]{value}); },
};
$self->add_item ($item);
}
+=item $popup->show
+
+Displays the popup (which is initially hidden).
+
+=cut
+
sub show {
my ($self) = @_;
--
2.34.1