summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac8
-rw-r--r--doc/ratpoison.mdoc.191
-rw-r--r--doc/ratpoison.texi111
-rw-r--r--src/actions.c411
-rw-r--r--src/actions.h199
-rw-r--r--src/completions.c1
-rw-r--r--src/data.h8
-rw-r--r--src/globals.c3
-rw-r--r--src/globals.h3
-rw-r--r--src/input.c41
-rw-r--r--src/main.c8
-rw-r--r--src/manage.c2
-rw-r--r--src/ratpoison.h2
13 files changed, 437 insertions, 451 deletions
diff --git a/configure.ac b/configure.ac
index 3b4af55..c685f8e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -211,10 +211,6 @@ AC_CHECK_HEADERS([pwd.h sys/ioctl.h sys/stat.h])
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_TYPEOF
-dnl Checks for library functions.
-AC_CHECK_FUNCS(getline getopt_long getpwuid setenv setpgid setpgrp setsid)
-AC_CHECK_FUNCS(unsetenv vsnprintf)
-
AH_TEMPLATE([HAVE___BUILTIN_PREFETCH],
[Define to 1 if your compiler supports the `__builtin_prefetch' function.])
AC_MSG_CHECKING([for __builtin_prefetch()])
@@ -228,6 +224,10 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([],
AC_MSG_RESULT(yes)],
[AC_MSG_RESULT(no)])
+dnl Checks for library functions.
+AC_CHECK_FUNCS(getline getopt_long getpwuid setenv setpgid setpgrp setsid)
+AC_CHECK_FUNCS(unsetenv vsnprintf)
+
AM_LANGINFO_CODESET
lispdir='${datarootdir}/emacs/site-lisp'
diff --git a/doc/ratpoison.mdoc.1 b/doc/ratpoison.mdoc.1
index 2e3c356..2e19a60 100644
--- a/doc/ratpoison.mdoc.1
+++ b/doc/ratpoison.mdoc.1
@@ -158,6 +158,8 @@ Run after a frame actually switched, but before the window in it is
focused.
.It Cm switchgroup
Run after selecting a new group.
+.It Cm switchscreen
+Run when the user switches to a different screen.
.It Cm switchwin
Run after a new window is selected.
(With dedication, it may already be inactive again, if it was put into
@@ -207,10 +209,6 @@ Execute
.Ar ratpoison\-command
interactively.
(i.e. ask for possible missing arguments.)
-.It Ic compat
-Add aliases for the new
-.Ic set
-commands starting with "def" to support older scripts.
.It Ic cother
Like
.Ic other
@@ -239,17 +237,6 @@ If you cannot guess a name of a key, try either
and look at the error message, or try
.Ic :describekey Li root
and pressing the key.
-.It Ic def...
-When
-.Ic compat
-was called there are some aliases starting with "def", which alias the
-new form with
-.Ic set .
-I.e. instead of
-.Ic defresizeunit
-better use the new
-.Ic set Cm resizeunit
-and so on...
.It Ic dedicate Op Cm 0 | 1
Consider the current frame dedicated/chaste
.Pq Cm 1
@@ -540,6 +527,9 @@ Set the duration the message window is shown.
If
.Ar seconds
is zero, wait infinitely.
+This command is deprecated, please set the
+.Va msgwait
+variable instead.
.It Ic newkmap Ar keymap
Generate a new keymap named
.Ar keymap .
@@ -691,22 +681,9 @@ of pixels given by
Restart
.Nm .
.It Ic rudeness Op Ar rudeness
-Show or set what kind of windows are allowed to jostle into the foreground.
-.Ar rudeness
-is a bitwise OR of the following values:
-.Pp
-.Bl -tag -offset 2n -width 2n -compact
-.It 1
-Transient windows may raise.
-.It 2
-Normal windows may raise.
-.It 4
-New transient windows end up in the foreground.
-.It 8
-New normal windows end up in the foreground.
-.El
-.Pp
-Default is all allowed i.e.\& 15.
+This command is deprecated, please use the
+.Va rudeness
+variable instead.
.It Ic sdump
Output the list of all screens.
The screens are separated by commas. Each screen is shown as 6 values:
@@ -776,6 +753,9 @@ Switch to the screen
Select whether
.Nm
will show a startup message or not.
+This command is deprecated, please use the
+.Va startupmessage
+variable instead.
.It Ic swap Ar dest-frame Oo Ar src-frame Oc Pq Ic C\-t x
Exchange the window in
.Ar src\-frame
@@ -857,14 +837,17 @@ in front of the number or not.
.It Ic warp Cm ( on | off )
Select if focusing a window moves the rat cursor to the place it had been last
time this window was focused, or not.
+This command is deprecated, please set the
+.Va warp
+variable instead.
.It Ic windows Oo Ar format Oc Pq Ic C\-t w
In interactive mode,
show the list of all windows in the current group for the duration
-specified by
-.Ic msgwait .
-If the
-.Ic msgwait
-argument was zero, toggle between indefinitely showing and not showing.
+specified by the variable
+.Va msgwait .
+If
+.Va msgwait
+was zero, toggle between indefinitely showing and not showing.
.Pp
The messages are shown in columns or rows depending on the value of
.Va winliststyle
@@ -1137,10 +1120,46 @@ Default is
.It Cm historyexpansion Li 0 | 1
Decide if history expansion using ! is available.
(Can only be activated when compiled with readline's libhistory.)
+.It Cm msgwait Ar seconds
+The duration the message window is shown.
+If
+.Ar seconds
+is zero, wait infinitely.
+.It Cm framemsgwait Ar seconds
+The duration the
+.Ql Current frame
+indicator is shown.
+If
+.Ar seconds
+is zero, wait until the next interactive command.
+.It Cm startupmessage Li 0 | 1
+Decide whether to show a greeting message at startup.
+.It Cm warp Li 0 | 1
+Decide if focusing a window moves the rat cursor to the place it had
+been last time this window was focused, or not.
.Pp
Default is
.Li 0
(off).
+.It Cm rudeness Ar number
+Show or set what kind of windows are allowed to jostle into the
+foreground.
+.sp
+.Ar number
+is a bitwise OR of the following values:
+.Pp
+.Bl -tag -offset 2n -width 2n -compact
+.It 1
+Transient windows may raise.
+.It 2
+Normal windows may raise.
+.It 4
+New transient windows end up in the foreground.
+.It 8
+New normal windows end up in the foreground.
+.El
+.Pp
+Default is all allowed i.e.\& 15.
.El
.Sh FILES
.Bl -tag -width "%%sysconfdir%%/ratpoisonrc" -compact
diff --git a/doc/ratpoison.texi b/doc/ratpoison.texi
index 8876db1..fb26dac 100644
--- a/doc/ratpoison.texi
+++ b/doc/ratpoison.texi
@@ -321,8 +321,16 @@ Set the default window format for the @command{info} command. See
@command{set winfmt} for accepted format characters.
@end deffn
+@deffn Command {set warp} @var{n}
+Set rat warping. By default this variable is set (@code{1}) and
+ratpoison saves the position of the rat when leaving a window and when
+the user returns to the window the rat's position is restored. If you
+find this counter-intuitive, set this variable to @code{0}.
+
+When called with no arguments, the current setting is returned.
+@end deffn
+
@deffn Command {set winname} @var{name}
-@c @deffnx Command defwinname @var{name}
There are three resources ratpoison can get a window's name from: the
WMNAME hint, the res_name from the WMCLASS hint, or the res_class from
the WMCLASS hint. @var{name} can be @samp{title} which is what most
@@ -333,7 +341,6 @@ When called with no arguments, the current setting is returned.
@end deffn
@deffn Command {set wingravity} @var{g}
-@c @deffnx Command defwingravity @var{g}
Set the default gravity for normal windows. See the
@command{gravity} command.
@@ -341,13 +348,11 @@ When called with no arguments, the current setting is returned.
@end deffn
@deffn Command {set winliststyle} @var{setting}
-@c @deffnx Command defwinliststyle @var{setting}
The window list can be displayed in a row or a column. @var{setting}
can be @samp{row} or @samp{column}.
@end deffn
@deffn Command {set winfmt} @var{fmt}
-@c @deffnx Command defwinfmt @var{fmt}
Set the default window format for the @command{windows} command. By
default it is @samp{%n%s%t}. The following is a list of valid format
characters:
@@ -410,7 +415,6 @@ omitted ratpoison defaults to the current window.
@end deffn
@deffn Command {set transgravity} @var{g}
-@c @deffnx Command deftransgravity @var{g}
Set the default alignment for transient windows. See the
@command{gravity} command.
@@ -419,7 +423,6 @@ returned.
@end deffn
@deffn Command {set maxsizegravity} @var{g}
-@c @deffnx Command defmaxsizegravity @var{g}
Set the default alignment for windows with maxsize hints. See the
@command{gravity} command.
@@ -428,7 +431,6 @@ returned.
@end deffn
@deffn Command {set border} @var{n}
-@c @deffnx Command defborder @var{n}
Set the border width for all windows.
When called with no arguments, the current setting is
@@ -504,12 +506,12 @@ Some programs will attempt to steal the focus without the users
permission. Not only is this a sign of a lame programmers attempt to fix
a window manager problem in the wrong place, it's just plain rude. By
default ratpoison will honour these rudeness requests, but it doesn't
-have to. Use the @command{rudeness} command to deal with such programs.
+have to. Use the rudeness variable to deal with such programs.
-@deffn Command rudeness @var{n}
-The rudeness command lets you decide what windows pop-up automatically
-and when. This is often useful for those deep hack sessions when you
-absolutely can't be disturbed.
+@deffn Command {set rudeness} @var{n}
+The rudeness variable lets you decide what windows pop-up
+automatically and when. This is often useful for those deep hack
+sessions when you absolutely can't be disturbed.
There are two kinds of windows: normal windows (like an xterm) and
transient windows (generally pop-up dialog boxes). When a client
@@ -537,8 +539,9 @@ Tells ratpoison to grant display requests on new normal windows
@end table
For example, if you wanted only wanted to grant transient windows
-raise requests and display requests you would type @samp{rudeness
-5}. If a request is not granted ratpoison will tell you about the
+raise requests and display requests you would type @samp{set rudeness
+5}.
+If a request is not granted ratpoison will tell you about the
request with a message like @samp{Raise request from window 1
(emacs)}.
@@ -737,7 +740,6 @@ The increment size used to resize the frame interactively is
customized with the command @command{set resizeunit}.
@deffn Command {set resizeunit} @var{pixels}
-@c @deffnx Command defresizeunit @var{pixels}
Set the number of pixels a frame will grow or shrink by when being
dynamically resized.
@@ -1265,6 +1267,8 @@ Run when the user switches to another frame. This is also run when the
user switches to a different screen, since a frame switch also occurs.
@item switchgroup
Run when the user switches to a different group.
+@item switchscreen
+Run when the user switches to a different screen.
@item deletewindow
Run when a window is deleted.
@item newwindow
@@ -1301,13 +1305,6 @@ opposed to the invisible evidence including the lack of title bars and
your favorite desktop background) there are also copious visual
customizations available for those rainy days.
-@deffn Command msgwait @var{n}
-Set the bar's timeout in seconds.
-
-When called with no arguments, the current setting is
-returned.
-@end deffn
-
@deffn Command lastmsg
Display the last message.
@end deffn
@@ -1316,8 +1313,14 @@ Display the last message.
Display @var{text} as a message.
@end deffn
+@deffn Command {set msgwait} @var{n}
+Set the bar's timeout in seconds.
+
+When called with no arguments, the current setting is
+returned.
+@end deffn
+
@deffn Command {set inputwidth} @var{n}
-@c @deffnx Command definputwidth @var{n}
Set the width of the input window.
When called with no arguments, the current setting is
@@ -1325,7 +1328,6 @@ returned.
@end deffn
@deffn Command {set font} @var{font}
-@c @deffnx Command deffont @var{font}
Set the font. @var{font} is a font string like @samp{9x15bold}.
When called with no arguments, the current setting is returned.
@@ -1338,7 +1340,6 @@ characters as @command{set winfmt}.
@end deffn
@deffn Command {set fgcolor} @var{color}
-@c @deffnx Command deffgcolor @var{color}
Set the foreground color for all text ratpoison displays. @var{color}
is any valid X11 color.
@@ -1346,7 +1347,6 @@ When called with no arguments, the current setting is returned.
@end deffn
@deffn Command {set bgcolor} @var{color}
-@c @deffnx Command defbgcolor @var{color}
Set the background color for all text ratpoison displays. @var{color}
is any valid X11 color.
@@ -1367,8 +1367,14 @@ is any valid X11 color.
When called with no arguments, the current setting is returned.
@end deffn
+@deffn Command {set framemsgwait} @var{n}
+Set the duration the @samp{Current frame} indicator is shown. If seconds
+is zero, wait until the next interactive command.
+
+When called with no arguments, the current setting is returned.
+@end deffn
+
@deffn Command {set barpadding} @var{x} @var{y}
-@c @deffnx Command defbarpadding @var{x} @var{y}
Set the horizontal and vertical padding inside the bar.
When called with no arguments, the current setting is
@@ -1376,7 +1382,6 @@ returned.
@end deffn
@deffn Command {set bargravity} @var{g}
-@c @deffnx Command defbargravity @var{g}
Set the default alignment for the message bar. See the @command{gravity} command.
When called with no arguments, the current setting is
@@ -1385,7 +1390,6 @@ returned.
@deffn Command {set barborder} @var{n}
-@c @deffnx Command defbarborder @var{n}
Set the border width for the bar window.
When called with no arguments, the current setting is returned.
@@ -1393,7 +1397,6 @@ When called with no arguments, the current setting is returned.
@deffn Command {set barinpadding} @var{n}
-@c @deffnx Command defbarinpadding @var{n}
Set whether the bar window appears at the edge of the screen when there is
padding -- that is, within the "padding" area -- or whether it appears at the
edge of the window area. "1" represents the former, "0" the latter. See the
@@ -1482,20 +1485,13 @@ Change the current directory for ratpoison.
Run a ratpoison command.
@end deffn
-@deffn Command compat
-Install the now obsolete @samp{def*} commands as aliases to the
-corresponding @samp{set *} command.
-@end deffn
-
@deffn Command {set padding} @var{left} @var{top} @var{right} @var{bottom}
-@c @deffnx Command defpadding @var{left} @var{top} @var{right} @var{bottom}
Set the padding around the edge of the screen.
When called with no arguments, the current setting is returned.
@end deffn
@deffn Command {set waitcursor} @var{n}
-@c @deffnx Command defwaitcursor @var{n}
Set whether the rat cursor should change into a square when waiting
for a key. A non-zero number means change the cursor. Zero means don't
change the cursor.
@@ -1559,7 +1555,7 @@ work.
@end deffn
@deffn Command getenv @var{env}
-Display the value of the environment variable, @var{env}.
+Display the value of the environment variable @var{env}.
@end deffn
@deffn Command getsel
@@ -1646,8 +1642,7 @@ Restart ratpoison.
@end deffn
@deffn Command set @var{var} @var{value}
-Set the value of a ratpoison variable. This command replaces the older
-@samp{def*} variable get/set style.
+Set the value of a ratpoison variable.
Here is a list of variables that can be set:
@@ -1674,6 +1669,10 @@ Here is a list of variables that can be set:
@item historysize
@item historycompaction
@item historyexpansion
+@item msgwait
+@item framemsgwait
+@item startupmessage
+@item warp
@end itemize
@end deffn
@@ -1686,14 +1685,6 @@ Set the environment variable @var{env} to @var{value}
Read a text file containing ratpoison commands.
@end deffn
-@deffn Command startup_message @var{state}
-Turn on or off the startup_message. This is most useful in your
-.ratpoisonrc file. @var{state} can be @code{on} or @code{off}.
-
-When called with no arguments, the current setting is
-returned.
-@end deffn
-
@deffn Command swap @var{destination-frame} @var{source-frame}
When called interactively prompt for a frame and swap its window with
the window in the current frame. An optional second argument allows
@@ -1721,13 +1712,6 @@ message saying command was executed.
Print ratpoison version. By default, this is bound to @kbd{C-t v}.
@end deffn
-@deffn Command warp @var{state}
-Toggle rat warping. By default ratpoison saves the position of the
-rat when leaving a window and when the user returns to the window the
-rat's position is restored. This can be counter-intuitive, so you can
-toggle it with this command. @var{state} can be @code{on} or @code{off}.
-@end deffn
-
@node Input
@chapter Input
At various times ratpoison will prompt you for input. Ratpoison sports
@@ -1841,11 +1825,11 @@ from the command-line. with the @option{-c} option you can script
ratpoison using any programming language that can spawn a
process. Some commands behave differently when invoked this
way. Currently the only commands that behaves differently are the
-@code{windows} command and some def* commands. Instead of displaying
-the window list in a message window, it is printed to stdout. The
-output can then be captured and used in the ratpoison script. For
-instance, this could be used to check whether a program is running and
-if it is switch to its window otherwise launch it.
+@code{windows} and @code{set} commands. For @code{windows}, instead of
+displaying the window list in a message window, it is printed to
+stdout. The output can then be captured and used in the ratpoison
+script. For instance, this could be used to check whether a program is
+running and if it is switch to its window otherwise launch it.
It should also be noted that multiple @option{-c} options can be used.
@@ -1887,6 +1871,13 @@ You can also use the @option{-f} option to specify another startup
file, allowing you to switch between different configurations
(@pxref{Command Line Arguments}).
+@deffn Command {set startupmessage} @var{n}
+Turn on or off the startup_message. This is most useful in your
+.ratpoisonrc file. @var{n} can be @code{1} (default) or @code{0}.
+
+When called with no arguments, the current setting is returned.
+@end deffn
+
@node GNU Free Documentation License
@chapter GNU Free Documentation License
@include fdl.texi
diff --git a/src/actions.c b/src/actions.c
index 1134631..c2eca3c 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -41,9 +41,55 @@
#endif
+
+
+/* arg_REST and arg_SHELLCMD eat the rest of the input. */
+enum argtype {
+ arg_REST,
+ arg_NUMBER,
+ arg_STRING,
+ arg_FRAME,
+ arg_WINDOW,
+ arg_COMMAND,
+ arg_SHELLCMD,
+ arg_KEYMAP,
+ arg_KEY,
+ arg_GRAVITY,
+ arg_GROUP,
+ arg_HOOK,
+ arg_VARIABLE,
+ arg_RAW,
+};
+
+union arg_union {
+ rp_frame *frame;
+ int number;
+ float fnumber;
+ rp_window *win;
+ rp_keymap *keymap;
+ rp_group *group;
+ struct list_head *hook;
+ struct set_var *variable;
+ struct rp_key *key;
+ int gravity;
+};
+
+struct cmdarg
+{
+ int type;
+ char *string;
+ union arg_union arg;
+ struct list_head node;
+};
#define ARG_STRING(elt) args[elt]->string
#define ARG(elt, type) args[elt]->arg.type
+struct argspec
+{
+ int type;
+ char *prompt;
+};
+
struct set_var
{
char *var;
@@ -53,6 +99,55 @@ struct set_var
struct list_head node;
};
+struct user_command
+{
+ char *name;
+ cmdret * (*func)(int, struct cmdarg **);
+ struct argspec *args;
+ int num_args;
+ /* The number of required arguments. Any arguments after that are
+ optional and won't be filled in when called
+ interactively. ni_required_args is used when called non-interactively,
+ i_required_args when called interactively. */
+ int ni_required_args, i_required_args;
+
+ struct list_head node;
+};
+
+typedef struct
+{
+ char *name;
+ char *alias;
+} alias_t;
+
+typedef struct rp_frame_undo
+{
+ char *frames;
+ rp_screen *screen;
+ struct list_head node;
+} rp_frame_undo;
+
+
+
+static LIST_HEAD (user_commands);
+static LIST_HEAD (rp_keymaps);
+static LIST_HEAD (set_vars);
+static LIST_HEAD (rp_frame_undos);
+static LIST_HEAD (rp_frame_redos);
+
+static alias_t *alias_list;
+static int alias_list_size;
+static int alias_list_last;
+
+static const char invalid_negative_arg[] = "invalid negative argument";
+
+
+
+static cmdret* frestore (char *data, rp_screen *s);
+static char* fdump (rp_screen *screen);
+static int spawn(char *data, int raw, rp_frame *frame);
+
+/* setter function prototypes */
static cmdret * set_resizeunit (struct cmdarg **args);
static cmdret * set_wingravity (struct cmdarg **args);
static cmdret * set_transgravity (struct cmdarg **args);
@@ -83,8 +178,128 @@ static cmdret * set_historycompaction (struct cmdarg **args);
static cmdret * set_historyexpansion (struct cmdarg **args);
static cmdret * set_msgwait(struct cmdarg **args);
static cmdret * set_framemsgwait(struct cmdarg **args);
+static cmdret * set_startupmessage(struct cmdarg **args);
+static cmdret * set_warp(struct cmdarg **args);
+static cmdret * set_rudeness(struct cmdarg **args);
+
+/* command function prototypes. */
+static cmdret *cmd_abort (int interactive, struct cmdarg **args);
+static cmdret *cmd_addhook (int interactive, struct cmdarg **args);
+static cmdret *cmd_alias (int interactive, struct cmdarg **args);
+static cmdret *cmd_banish (int interactive, struct cmdarg **args);
+static cmdret *cmd_banishrel (int interactive, struct cmdarg **args);
+static cmdret *cmd_chdir (int interactive, struct cmdarg **args);
+static cmdret *cmd_clrunmanaged (int interactive, struct cmdarg **args);
+static cmdret *cmd_colon (int interactive, struct cmdarg **args);
+static cmdret *cmd_commands (int interactive, struct cmdarg **args);
+static cmdret *cmd_curframe (int interactive, struct cmdarg **args);
+static cmdret *cmd_delete (int interactive, struct cmdarg **args);
+static cmdret *cmd_echo (int interactive, struct cmdarg **args);
+static cmdret *cmd_escape (int interactive, struct cmdarg **args);
+static cmdret *cmd_exec (int interactive, struct cmdarg **args);
+static cmdret *cmd_execa (int interactive, struct cmdarg **args);
+static cmdret *cmd_execf (int interactive, struct cmdarg **args);
+static cmdret *cmd_fdump (int interactive, struct cmdarg **args);
+static cmdret *cmd_focusdown (int interactive, struct cmdarg **args);
+static cmdret *cmd_focuslast (int interactive, struct cmdarg **args);
+static cmdret *cmd_focusleft (int interactive, struct cmdarg **args);
+static cmdret *cmd_focusright (int interactive, struct cmdarg **args);
+static cmdret *cmd_focusup (int interactive, struct cmdarg **args);
+static cmdret *cmd_exchangeup (int interactive, struct cmdarg **args);
+static cmdret *cmd_exchangedown (int interactive, struct cmdarg **args);
+static cmdret *cmd_exchangeleft (int interactive, struct cmdarg **args);
+static cmdret *cmd_exchangeright (int interactive, struct cmdarg **args);
+static cmdret *cmd_swap (int interactive, struct cmdarg **args);
+static cmdret *cmd_frestore (int interactive, struct cmdarg **args);
+static cmdret *cmd_fselect (int interactive, struct cmdarg **args);
+static cmdret *cmd_gdelete (int interactive, struct cmdarg **args);
+static cmdret *cmd_getenv (int interactive, struct cmdarg **args);
+static cmdret *cmd_gmerge (int interactive, struct cmdarg **args);
+static cmdret *cmd_gmove (int interactive, struct cmdarg **args);
+static cmdret *cmd_gnew (int interactive, struct cmdarg **args);
+static cmdret *cmd_gnewbg (int interactive, struct cmdarg **args);
+static cmdret *cmd_gnext (int interactive, struct cmdarg **args);
+static cmdret *cmd_gnumber (int interactive, struct cmdarg **args);
+static cmdret *cmd_gprev (int interactive, struct cmdarg **args);
+static cmdret *cmd_gother (int interactive, struct cmdarg **args);
+static cmdret *cmd_gravity (int interactive, struct cmdarg **args);
+static cmdret *cmd_grename (int interactive, struct cmdarg **args);
+static cmdret *cmd_groups (int interactive, struct cmdarg **args);
+static cmdret *cmd_gselect (int interactive, struct cmdarg **args);
+static cmdret *cmd_h_split (int interactive, struct cmdarg **args);
+static cmdret *cmd_help (int interactive, struct cmdarg **args);
+static cmdret *cmd_info (int interactive, struct cmdarg **args);
+static cmdret *cmd_kill (int interactive, struct cmdarg **args);
+static cmdret *cmd_lastmsg (int interactive, struct cmdarg **args);
+static cmdret *cmd_license (int interactive, struct cmdarg **args);
+static cmdret *cmd_link (int interactive, struct cmdarg **args);
+static cmdret *cmd_listhook (int interactive, struct cmdarg **args);
+static cmdret *cmd_meta (int interactive, struct cmdarg **args);
+static cmdret *cmd_msgwait (int interactive, struct cmdarg **args);
+static cmdret *cmd_newwm (int interactive, struct cmdarg **args);
+static cmdret *cmd_next (int interactive, struct cmdarg **args);
+static cmdret *cmd_next_frame (int interactive, struct cmdarg **args);
+static cmdret *cmd_nextscreen (int interactive, struct cmdarg **args);
+static cmdret *cmd_number (int interactive, struct cmdarg **args);
+static cmdret *cmd_only (int interactive, struct cmdarg **args);
+static cmdret *cmd_other (int interactive, struct cmdarg **args);
+static cmdret *cmd_prev (int interactive, struct cmdarg **args);
+static cmdret *cmd_prev_frame (int interactive, struct cmdarg **args);
+static cmdret *cmd_prevscreen (int interactive, struct cmdarg **args);
+static cmdret *cmd_quit (int interactive, struct cmdarg **args);
+static cmdret *cmd_redisplay (int interactive, struct cmdarg **args);
+static cmdret *cmd_remhook (int interactive, struct cmdarg **args);
+static cmdret *cmd_remove (int interactive, struct cmdarg **args);
+static cmdret *cmd_rename (int interactive, struct cmdarg **args);
+static cmdret *cmd_resize (int interactive, struct cmdarg **args);
+static cmdret *cmd_restart (int interactive, struct cmdarg **args);
+static cmdret *cmd_rudeness (int interactive, struct cmdarg **args);
+static cmdret *cmd_select (int interactive, struct cmdarg **args);
+static cmdret *cmd_setenv (int interactive, struct cmdarg **args);
+static cmdret *cmd_shrink (int interactive, struct cmdarg **args);
+static cmdret *cmd_source (int interactive, struct cmdarg **args);
+static cmdret *cmd_startup_message (int interactive, struct cmdarg **args);
+static cmdret *cmd_time (int interactive, struct cmdarg **args);
+static cmdret *cmd_tmpwm (int interactive, struct cmdarg **args);
+static cmdret *cmd_unalias (int interactive, struct cmdarg **args);
+static cmdret *cmd_unmanage (int interactive, struct cmdarg **args);
+static cmdret *cmd_unsetenv (int interactive, struct cmdarg **args);
+static cmdret *cmd_v_split (int interactive, struct cmdarg **args);
+static cmdret *cmd_verbexec (int interactive, struct cmdarg **args);
+static cmdret *cmd_version (int interactive, struct cmdarg **args);
+static cmdret *cmd_warp (int interactive, struct cmdarg **args);
+static cmdret *cmd_windows (int interactive, struct cmdarg **args);
+static cmdret *cmd_readkey (int interactive, struct cmdarg **args);
+static cmdret *cmd_newkmap (int interactive, struct cmdarg **args);
+static cmdret *cmd_delkmap (int interactive, struct cmdarg **args);
+static cmdret *cmd_definekey (int interactive, struct cmdarg **args);
+static cmdret *cmd_undefinekey (int interactive, struct cmdarg **args);
+static cmdret *cmd_set (int interactive, struct cmdarg **args);
+static cmdret *cmd_sselect (int interactive, struct cmdarg **args);
+static cmdret *cmd_ratwarp (int interactive, struct cmdarg **args);
+static cmdret *cmd_ratinfo (int interactive, struct cmdarg **args);
+static cmdret *cmd_ratrelinfo (int interactive, struct cmdarg **args);
+static cmdret *cmd_ratclick (int interactive, struct cmdarg **args);
+static cmdret *cmd_ratrelwarp (int interactive, struct cmdarg **args);
+static cmdret *cmd_rathold (int interactive, struct cmdarg **args);
+static cmdret *cmd_cnext (int interactive, struct cmdarg **args);
+static cmdret *cmd_cother (int interactive, struct cmdarg **args);
+static cmdret *cmd_cprev (int interactive, struct cmdarg **args);
+static cmdret *cmd_dedicate (int interactive, struct cmdarg **args);
+static cmdret *cmd_describekey (int interactive, struct cmdarg **args);
+static cmdret *cmd_inext (int interactive, struct cmdarg **args);
+static cmdret *cmd_iother (int interactive, struct cmdarg **args);
+static cmdret *cmd_iprev (int interactive, struct cmdarg **args);
+static cmdret *cmd_prompt (int interactive, struct cmdarg **args);
+static cmdret *cmd_sdump (int interactive, struct cmdarg **args);
+static cmdret *cmd_sfdump (int interactive, struct cmdarg **args);
+static cmdret *cmd_sfrestore (int interactive, struct cmdarg **args);
+static cmdret *cmd_undo (int interactive, struct cmdarg **args);
+static cmdret *cmd_redo (int interactive, struct cmdarg **args);
+static cmdret *cmd_putsel (int interactive, struct cmdarg **args);
+static cmdret *cmd_getsel (int interactive, struct cmdarg **args);
+
-LIST_HEAD(set_vars);
static void
add_set_var (char *name, cmdret * (*fn)(struct cmdarg **), int nargs, ...)
@@ -108,7 +323,7 @@ add_set_var (char *name, cmdret * (*fn)(struct cmdarg **), int nargs, ...)
}
va_end(va);
- list_add (&var->node, &set_vars);
+ list_add_tail (&var->node, &set_vars);
}
static void
@@ -121,45 +336,45 @@ set_var_free (struct set_var *var)
}
static void
-init_set_vars(void)
+init_set_vars (void)
{
- add_set_var ("resizeunit", set_resizeunit, 1, "", arg_NUMBER);
- add_set_var ("maxundos", set_maxundos, 1, "", arg_NUMBER);
- add_set_var ("wingravity", set_wingravity, 1, "", arg_GRAVITY);
- add_set_var ("transgravity", set_transgravity, 1, "", arg_GRAVITY);
- add_set_var ("maxsizegravity", set_maxsizegravity, 1, "", arg_GRAVITY);
- add_set_var ("bargravity", set_bargravity, 1, "", arg_GRAVITY);
- add_set_var ("font", set_font, 1, "", arg_STRING);
- add_set_var ("padding", set_padding, 4,
- "", arg_NUMBER, "", arg_NUMBER, "", arg_NUMBER, "", arg_NUMBER);
- add_set_var ("border", set_border, 1, "", arg_NUMBER);
+ /* Keep this sorted alphabetically. */
add_set_var ("barborder", set_barborder, 1, "", arg_NUMBER);
+ add_set_var ("bargravity", set_bargravity, 1, "", arg_GRAVITY);
add_set_var ("barinpadding", set_barinpadding, 1, "", arg_NUMBER);
- add_set_var ("inputwidth", set_inputwidth, 1, "", arg_NUMBER);
- add_set_var ("waitcursor", set_waitcursor, 1, "", arg_NUMBER);
- add_set_var ("winfmt", set_winfmt, 1, "", arg_REST);
- add_set_var ("winname", set_winname, 1, "", arg_STRING);
- add_set_var ("framefmt", set_framefmt, 1, "", arg_REST);
- add_set_var ("fgcolor", set_fgcolor, 1, "", arg_STRING);
+ add_set_var ("barpadding", set_barpadding, 2, "", arg_NUMBER, "", arg_NUMBER);
add_set_var ("bgcolor", set_bgcolor, 1, "", arg_STRING);
- add_set_var ("fwcolor", set_fwcolor, 1, "", arg_STRING);
+ add_set_var ("border", set_border, 1, "", arg_NUMBER);
add_set_var ("bwcolor", set_bwcolor, 1, "", arg_STRING);
- add_set_var ("barpadding", set_barpadding, 2, "", arg_NUMBER, "", arg_NUMBER);
- add_set_var ("winliststyle", set_winliststyle, 1, "", arg_STRING);
+ add_set_var ("fgcolor", set_fgcolor, 1, "", arg_STRING);
+ add_set_var ("font", set_font, 1, "", arg_STRING);
+ add_set_var ("framefmt", set_framefmt, 1, "", arg_REST);
+ add_set_var ("framemsgwait", set_framemsgwait, 1, "", arg_NUMBER);
add_set_var ("framesels", set_framesels, 1, "", arg_STRING);
- add_set_var ("infofmt", set_infofmt, 1, "", arg_REST);
- add_set_var ("topkmap", set_topkmap, 1, "", arg_STRING);
- add_set_var ("historysize", set_historysize, 1, "", arg_NUMBER);
+ add_set_var ("fwcolor", set_fwcolor, 1, "", arg_STRING);
add_set_var ("historycompaction", set_historycompaction, 1, "", arg_NUMBER);
add_set_var ("historyexpansion", set_historyexpansion, 1, "", arg_NUMBER);
+ add_set_var ("historysize", set_historysize, 1, "", arg_NUMBER);
+ add_set_var ("infofmt", set_infofmt, 1, "", arg_REST);
+ add_set_var ("inputwidth", set_inputwidth, 1, "", arg_NUMBER);
+ add_set_var ("maxsizegravity", set_maxsizegravity, 1, "", arg_GRAVITY);
+ add_set_var ("maxundos", set_maxundos, 1, "", arg_NUMBER);
add_set_var ("msgwait", set_msgwait, 1, "", arg_NUMBER);
- add_set_var ("framemsgwait", set_framemsgwait, 1, "", arg_NUMBER);
+ add_set_var ("padding", set_padding, 4, "", arg_NUMBER, "", arg_NUMBER, "",
+ arg_NUMBER, "", arg_NUMBER);
+ add_set_var ("resizeunit", set_resizeunit, 1, "", arg_NUMBER);
+ add_set_var ("rudeness", set_rudeness, 1, "", arg_NUMBER);
+ add_set_var ("startupmessage", set_startupmessage, 1, "", arg_NUMBER);
+ add_set_var ("topkmap", set_topkmap, 1, "", arg_STRING);
+ add_set_var ("transgravity", set_transgravity, 1, "", arg_GRAVITY);
+ add_set_var ("waitcursor", set_waitcursor, 1, "", arg_NUMBER);
+ add_set_var ("warp", set_warp, 1, "", arg_NUMBER);
+ add_set_var ("winfmt", set_winfmt, 1, "", arg_REST);
+ add_set_var ("wingravity", set_wingravity, 1, "", arg_GRAVITY);
+ add_set_var ("winliststyle", set_winliststyle, 1, "", arg_STRING);
+ add_set_var ("winname", set_winname, 1, "", arg_STRING);
}
-/* rp_keymaps is ratpoison's list of keymaps. */
-LIST_HEAD(rp_keymaps);
-LIST_HEAD(user_commands);
-
/* i_nrequired is the number required when called
interactively. ni_nrequired is when called non-interactively. */
static void
@@ -398,40 +613,22 @@ init_user_commands(void)
add_command ("putsel", cmd_putsel, 1, 1, 1,
"Text: ", arg_RAW);
add_command ("getsel", cmd_getsel, 0, 0, 0);
- add_command ("compat", cmd_compat, 0, 0, 0);
+ add_command ("commands", cmd_commands, 0, 0, 0);
/*@end (tag required for genrpbindings) */
- /* Commands to help debug ratpoison. */
-#ifdef DEBUG
-#endif
-
- /* the following screen commands may or may not be able to be
- implemented. See the screen documentation for what should be
- emulated with these commands */
-#if 0
- add_command ("msgminwait", cmd_unimplemented, 0);
- add_command ("nethack", cmd_unimplemented, 0);
- add_command ("sleep", cmd_unimplemented, 0);
- add_command ("stuff", cmd_unimplemented, 0);
-#endif
+ /*
+ The following screen commands may or may not be able to be
+ implemented. See the screen documentation for what should be
+ emulated with these commands
+ - msgminwait
+ - nethack
+ - sleep
+ - stuff
+ */
init_set_vars();
}
-typedef struct
-{
- char *name;
- char *alias;
-} alias_t;
-
-static alias_t *alias_list;
-static int alias_list_size;
-static int alias_list_last;
-static const char *invalid_negative_arg = "invalid negative argument";
-
-static cmdret* frestore (char *data, rp_screen *s);
-static char* fdump (rp_screen *screen);
-
/* Delete all entries in the redo list. */
static void
clear_frame_redos (void)
@@ -446,7 +643,7 @@ clear_frame_redos (void)
}
}
-void
+static void
del_frame_undo (rp_frame_undo *u)
{
if (!u) return;
@@ -455,6 +652,18 @@ del_frame_undo (rp_frame_undo *u)
free (u);
}
+void
+clear_frame_undos (void)
+{
+ while (list_size (&rp_frame_undos) > 0)
+ {
+ /* Delete the oldest node */
+ rp_frame_undo *cur;
+ list_last (cur, &rp_frame_undos, node);
+ del_frame_undo (cur);
+ }
+}
+
static void
push_frame_undo(rp_screen *screen)
{
@@ -1148,12 +1357,6 @@ cmd_definekey (int interactive UNUSED, struct cmdarg **args)
}
cmdret *
-cmd_unimplemented (int interactive UNUSED, struct cmdarg **args UNUSED)
-{
- return cmdret_new (RET_FAILURE, "FIXME: unimplemented command");
-}
-
-cmdret *
cmd_source (int interactive UNUSED, struct cmdarg **args)
{
FILE *fileptr;
@@ -2502,7 +2705,7 @@ command (int interactive, char *data)
cmdret *result = NULL;
char *cmd, *rest;
char *input;
- user_command *uc;
+ struct user_command *uc;
int i;
if (data == NULL)
@@ -3588,7 +3791,7 @@ cmd_help (int interactive, struct cmdarg **args)
}
cmdret *
-cmd_rudeness (int interactive UNUSED, struct cmdarg **args)
+set_rudeness (struct cmdarg **args)
{
int num;
@@ -3611,6 +3814,13 @@ cmd_rudeness (int interactive UNUSED, struct cmdarg **args)
return cmdret_new (RET_SUCCESS, NULL);
}
+/* compat */
+cmdret *
+cmd_rudeness (int interactive UNUSED, struct cmdarg **args)
+{
+ return set_rudeness (args);
+}
+
char *
wingravity_to_string (int g)
{
@@ -4514,6 +4724,20 @@ cmd_restart (int interactive UNUSED, struct cmdarg **args UNUSED)
return cmdret_new (RET_SUCCESS, NULL);
}
+static cmdret *
+set_startupmessage (struct cmdarg **args)
+{
+ if (args[0] == NULL)
+ return cmdret_new (RET_SUCCESS, "%d", defaults.startup_message);
+
+ if (ARG(0, number) != 0 && ARG(0, number) != 1)
+ return cmdret_new (RET_FAILURE, "set startupmessage: invalid argument");
+
+ defaults.startup_message = ARG(0, number);
+ return cmdret_new (RET_SUCCESS, NULL);
+}
+
+/* compat */
cmdret *
cmd_startup_message (int interactive UNUSED, struct cmdarg **args)
{
@@ -4683,6 +4907,20 @@ cmd_sselect(int interactive UNUSED, struct cmdarg **args)
return cmdret_new (RET_SUCCESS, NULL);
}
+static cmdret *
+set_warp (struct cmdarg **args)
+{
+ if (args[0] == NULL)
+ return cmdret_new (RET_SUCCESS, "%d", defaults.warp);
+
+ if (ARG(0, number) != 0 && ARG(0, number) != 1)
+ return cmdret_new (RET_FAILURE, "set warp: invalid argument");
+
+ defaults.warp = ARG(0, number);
+ return cmdret_new (RET_SUCCESS, NULL);
+}
+
+/* compat */
cmdret *
cmd_warp (int interactive UNUSED, struct cmdarg **args)
{
@@ -6073,30 +6311,21 @@ cmd_getsel (int interactive UNUSED, struct cmdarg **args UNUSED)
return cmdret_new (RET_FAILURE, "getsel: no X11 selection");
}
-/* This is a command that restores old commands that have been
- recently depricated. */
cmdret *
-cmd_compat (int interactive UNUSED, struct cmdarg **args UNUSED)
-{
- add_alias ("defresizeunit", "set resizeunit");
- add_alias ("defwingravity", "set wingravity");
- add_alias ("deftransgravity", "set transgravity");
- add_alias ("defmaxsizegravity", "set maxsizegravity");
- add_alias ("defbargravity", "set bargravity");
- add_alias ("deffont", "set font");
- add_alias ("defpadding", "set padding");
- add_alias ("defborder", "set border");
- add_alias ("defbarborder", "set barborder");
- add_alias ("definputwidth", "set inputwidth");
- add_alias ("defwaitcursor", "set waitcursor");
- add_alias ("defwinfmt", "set winfmt");
- add_alias ("defwinname", "set winname");
- add_alias ("deffgcolor", "set fgcolor");
- add_alias ("defbgcolor", "set bgcolor");
- add_alias ("defbarpadding", "set barpadding");
- add_alias ("defwinliststyle", "set winliststyle");
- add_alias ("defframesels", "set framesels");
- add_alias ("defmaxundos", "set maxundos");
+cmd_commands (int interactive UNUSED, struct cmdarg **args UNUSED)
+{
+ struct sbuf *sb;
+ struct user_command *cur;
+ cmdret *ret;
- return cmdret_new (RET_SUCCESS, NULL);
+ sb = sbuf_new (0);
+ list_for_each_entry (cur, &user_commands, node)
+ {
+ sbuf_printf_concat (sb, "%s\n", cur->name);
+ }
+ sbuf_chop (sb);
+
+ ret = cmdret_new (RET_SUCCESS, "%s", sbuf_get (sb));
+ sbuf_free (sb);
+ return ret;
}
diff --git a/src/actions.h b/src/actions.h
index 519c1a7..0025e7f 100644
--- a/src/actions.h
+++ b/src/actions.h
@@ -22,209 +22,20 @@
#ifndef _RATPOISON_ACTIONS_H
#define _RATPOISON_ACTIONS_H 1
-#define MAX_COMMAND_LENGTH 100
-#define MAX_ARGS_LENGTH 100
-
-#include <ratpoison.h>
-
-typedef struct user_command user_command;
-
-/* arg_REST and arg_SHELLCMD eat the rest of the input. */
-enum argtype { arg_REST,
- arg_NUMBER,
- arg_STRING,
- arg_FRAME,
- arg_WINDOW,
- arg_COMMAND,
- arg_SHELLCMD,
- arg_KEYMAP,
- arg_KEY,
- arg_GRAVITY,
- arg_GROUP,
- arg_HOOK,
- arg_VARIABLE,
- arg_RAW};
-
-union arg_union {
- rp_frame *frame;
- int number;
- float fnumber;
- rp_window *win;
- rp_keymap *keymap;
- rp_group *group;
- struct list_head *hook;
- struct set_var *variable;
- struct rp_key *key;
- int gravity;
- };
-
-struct cmdarg
-{
- int type;
- char *string;
- union arg_union arg;
- struct list_head node;
-};
-
-struct argspec
-{
- int type;
- char *prompt;
-};
+#include "ratpoison.h"
/* The structure returned by a command. */
-typedef struct cmdret cmdret;
-struct cmdret
+typedef struct cmdret
{
char *output;
int success;
-};
-
-struct
-user_command
-{
- char *name;
- cmdret * (*func)(int, struct cmdarg **);
- struct argspec *args;
- int num_args;
- /* The number of required arguments. Any arguments after that are
- optional and won't be filled in when called
- interactively. ni_required_args is used when called non-interactively,
- i_required_args when called interactively. */
- int ni_required_args, i_required_args;
-
- struct list_head node;
-};
-
-int spawn(char *data, int raw, rp_frame *frame);
-cmdret *command (int interactive, char *data);
-
-/* command function prototypes. */
-#define RP_CMD(cmd) cmdret *cmd_ ## cmd (int interactive, struct cmdarg **args)
-RP_CMD (abort);
-RP_CMD (addhook);
-RP_CMD (alias);
-RP_CMD (banish);
-RP_CMD (banishrel);
-RP_CMD (bind);
-RP_CMD (compat);
-RP_CMD (chdir);
-RP_CMD (clrunmanaged);
-RP_CMD (colon);
-RP_CMD (curframe);
-RP_CMD (delete);
-RP_CMD (echo);
-RP_CMD (escape);
-RP_CMD (exec);
-RP_CMD (execa);
-RP_CMD (execf);
-RP_CMD (fdump);
-RP_CMD (focusdown);
-RP_CMD (focuslast);
-RP_CMD (focusleft);
-RP_CMD (focusright);
-RP_CMD (focusup);
-RP_CMD (exchangeup);
-RP_CMD (exchangedown);
-RP_CMD (exchangeleft);
-RP_CMD (exchangeright);
-RP_CMD (swap);
-RP_CMD (frestore);
-RP_CMD (fselect);
-RP_CMD (gdelete);
-RP_CMD (getenv);
-RP_CMD (gmerge);
-RP_CMD (gmove);
-RP_CMD (gnew);
-RP_CMD (gnewbg);
-RP_CMD (gnext);
-RP_CMD (gnumber);
-RP_CMD (gprev);
-RP_CMD (gother);
-RP_CMD (gravity);
-RP_CMD (grename);
-RP_CMD (groups);
-RP_CMD (gselect);
-RP_CMD (h_split);
-RP_CMD (help);
-RP_CMD (info);
-RP_CMD (kill);
-RP_CMD (lastmsg);
-RP_CMD (license);
-RP_CMD (link);
-RP_CMD (listhook);
-RP_CMD (meta);
-RP_CMD (msgwait);
-RP_CMD (newwm);
-RP_CMD (next);
-RP_CMD (next_frame);
-RP_CMD (nextscreen);
-RP_CMD (number);
-RP_CMD (only);
-RP_CMD (other);
-RP_CMD (prev);
-RP_CMD (prev_frame);
-RP_CMD (prevscreen);
-RP_CMD (quit);
-RP_CMD (redisplay);
-RP_CMD (remhook);
-RP_CMD (remove);
-RP_CMD (rename);
-RP_CMD (resize);
-RP_CMD (restart);
-RP_CMD (rudeness);
-RP_CMD (select);
-RP_CMD (setenv);
-RP_CMD (shrink);
-RP_CMD (source);
-RP_CMD (startup_message);
-RP_CMD (time);
-RP_CMD (tmpwm);
-RP_CMD (unalias);
-RP_CMD (unbind);
-RP_CMD (unimplemented);
-RP_CMD (unmanage);
-RP_CMD (unsetenv);
-RP_CMD (v_split);
-RP_CMD (verbexec);
-RP_CMD (version);
-RP_CMD (warp);
-RP_CMD (windows);
-RP_CMD (readkey);
-RP_CMD (newkmap);
-RP_CMD (delkmap);
-RP_CMD (definekey);
-RP_CMD (undefinekey);
-RP_CMD (set);
-RP_CMD (sselect);
-RP_CMD (ratwarp);
-RP_CMD (ratinfo);
-RP_CMD (ratrelinfo);
-RP_CMD (ratclick);
-RP_CMD (ratrelwarp);
-RP_CMD (rathold);
-RP_CMD (cnext);
-RP_CMD (cother);
-RP_CMD (cprev);
-RP_CMD (dedicate);
-RP_CMD (describekey);
-RP_CMD (inext);
-RP_CMD (iother);
-RP_CMD (iprev);
-RP_CMD (prompt);
-RP_CMD (sdump);
-RP_CMD (sfdump);
-RP_CMD (sfrestore);
-RP_CMD (undo);
-RP_CMD (redo);
-RP_CMD (putsel);
-RP_CMD (getsel);
-
-void del_frame_undo (rp_frame_undo *u);
+} cmdret;
+void clear_frame_undos (void);
rp_keymap *find_keymap (char *name);
void init_user_commands(void);
void initialize_default_keybindings (void);
+cmdret *command (int interactive, char *data);
cmdret *cmdret_new (int success, char *fmt, ...);
void cmdret_free (cmdret *ret);
void keymap_free (rp_keymap *map);
diff --git a/src/completions.c b/src/completions.c
index 7320ae5..70a86d0 100644
--- a/src/completions.c
+++ b/src/completions.c
@@ -18,6 +18,7 @@
* Boston, MA 02111-1307 USA
*/
+#define _BSD_SOURCE
#define _GNU_SOURCE
#include <string.h>
diff --git a/src/data.h b/src/data.h
index 3975955..1d3be80 100644
--- a/src/data.h
+++ b/src/data.h
@@ -416,14 +416,6 @@ struct rp_hook_db_entry
struct list_head *hook;
};
-typedef struct rp_frame_undo rp_frame_undo;
-struct rp_frame_undo
-{
- char *frames;
- rp_screen *screen;
- struct list_head node;
-};
-
typedef struct rp_xselection rp_xselection;
struct rp_xselection
{
diff --git a/src/globals.c b/src/globals.c
index 23aee95..621dcb6 100644
--- a/src/globals.c
+++ b/src/globals.c
@@ -274,9 +274,6 @@ set_window_focus (Window window)
RevertToPointerRoot, CurrentTime);
}
-LIST_HEAD (rp_frame_undos);
-LIST_HEAD (rp_frame_redos);
-
/* Wrapper font functions to support Xft */
diff --git a/src/globals.h b/src/globals.h
index dd21c9b..144273d 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -199,9 +199,6 @@ void set_window_focus (Window window);
extern struct numset *rp_frame_numset;
-extern struct list_head rp_frame_undos;
-extern struct list_head rp_frame_redos;
-
/* Selection handling globals */
extern rp_xselection selection;
void set_selection (char *txt);
diff --git a/src/input.c b/src/input.c
index 8566e32..8abb308 100644
--- a/src/input.c
+++ b/src/input.c
@@ -124,47 +124,6 @@ keycode_to_keysym(Display *dpy, KeyCode kc, int group, int level)
return XKeycodeToKeysym (dpy, kc, level);
}
-/* /\* The caller is responsible for freeing the keycodes. *\/ */
-/* KeyCode * */
-/* keysym_to_keycodes (KeySym sym, int *n_returned) */
-/* { */
-/* int min_code, max_code; */
-/* int syms_per_code; */
-/* KeySym *syms; */
-/* KeyCode *codes; */
-/* int code, code_col; */
-
-/* XDisplayKeycodes (dpy, &min_code, &max_code); */
-/* syms = XGetKeyboardMapping (dpy, */
-/* min_code, max_code - min_code + 1, */
-/* &syms_per_code); */
-
-/* *n_returned = 0; */
-/* codes = xmalloc (sizeof(KeyCode) * n_returned); */
-/* for (code = min_code; code < max_code; code++) */
-/* for (code_col = 0; code_col < syms_per_code; code_col++) */
-/* { */
-/* int s = syms[((code - min_code) * syms_per_code) + code_col]; */
-
-/* if (sym == s) */
-/* { */
-/* n_returned++; */
-/* codes = xrealloc (sizeof(KeyCode) * n_returned); */
-/* codes[n_returned-1] = code; */
-/* } */
-/* } */
-
-/* XFree ((char *) syms); */
-
-/* if (n_returned > 0) */
-/* return codes; */
-/* else */
-/* { */
-/* xfree (codes) */
-/* return NULL; */
-/* } */
-/* } */
-
/* Figure out what keysyms are attached to what modifiers */
void
update_modifier_map (void)
diff --git a/src/main.c b/src/main.c
index 76af702..da6fb9f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -781,13 +781,7 @@ clean_up (void)
screen_free_final ();
/* Delete the undo histories */
- while (list_size (&rp_frame_undos) > 0)
- {
- /* Delete the oldest node */
- rp_frame_undo *cur;
- list_last (cur, &rp_frame_undos, node);
- del_frame_undo (cur);
- }
+ clear_frame_undos ();
/* Free the global frame numset shared by all screens. */
numset_free (rp_frame_numset);
diff --git a/src/manage.c b/src/manage.c
index f2a15f5..db77035 100644
--- a/src/manage.c
+++ b/src/manage.c
@@ -97,8 +97,6 @@ add_unmanaged_window (char *name)
unmanaged_window_list = tmp;
}
-extern Atom wm_state;
-
void
grab_top_level_keys (Window w)
{
diff --git a/src/ratpoison.h b/src/ratpoison.h
index 981a882..3068050 100644
--- a/src/ratpoison.h
+++ b/src/ratpoison.h
@@ -55,8 +55,6 @@ do { \
#define PRINT_DEBUG(fmt) do {} while (0)
#endif /* DEBUG */
-extern XGCValues gv;
-
#include "conf.h"
#include "data.h"