summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsabetts <sabetts>2001-08-24 17:45:19 +0000
committersabetts <sabetts>2001-08-24 17:45:19 +0000
commit87ea5e2a1081de517200e9029842cb6bc0090c47 (patch)
tree70cd465e2b65d79d93c7021eacf1edd5ef73963e /src
parent64bf4e18b28591e8b6a6b133b440fa9f28d8e693 (diff)
downloadratpoison-87ea5e2a1081de517200e9029842cb6bc0090c47.zip
added a user abort key
Diffstat (limited to 'src')
-rw-r--r--src/actions.c20
-rw-r--r--src/conf.h4
-rw-r--r--src/input.c8
3 files changed, 32 insertions, 0 deletions
diff --git a/src/actions.c b/src/actions.c
index b88ce85..3cb5e9a 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -549,6 +549,10 @@ cmd_select (int interactive, void *data)
else
str = strdup ((char *) data);
+ /* User aborted. */
+ if (str == NULL)
+ return NULL;
+
/* Only search if the string contains something to search for. */
if (strlen (str) > 0)
{
@@ -597,6 +601,10 @@ cmd_rename (int interactive, void *data)
else
winname = strdup ((char *) data);
+ /* User aborted. */
+ if (winname == NULL)
+ return NULL;
+
if (*winname)
{
free (current_window()->name);
@@ -717,6 +725,10 @@ cmd_colon (int interactive, void *data)
else
input = get_more_input (MESSAGE_PROMPT_COMMAND, data);
+ /* User aborted. */
+ if (input == NULL)
+ return NULL;
+
result = command (1, input);
/* Gobble the result. */
@@ -738,6 +750,10 @@ cmd_exec (int interactive, void *data)
else
cmd = strdup ((char *) data);
+ /* User aborted. */
+ if (cmd == NULL)
+ return NULL;
+
spawn (cmd);
free (cmd);
@@ -782,6 +798,10 @@ cmd_newwm(int interactive, void *data)
else
prog = strdup ((char *) data);
+ /* User aborted. */
+ if (prog == NULL)
+ return NULL;
+
PRINT_DEBUG ("Switching to %s\n", prog);
putenv(DisplayString(dpy));
diff --git a/src/conf.h b/src/conf.h
index 05727a8..3289d50 100644
--- a/src/conf.h
+++ b/src/conf.h
@@ -28,6 +28,10 @@
#define KEY_PREFIX XK_t
#define MODIFIER_PREFIX ControlMask
+/* This is the abort key when typing input. */
+#define INPUT_ABORT_KEY XK_g
+#define INPUT_ABORT_MODIFIER ControlMask
+
/* After hitting the prefix key ratpoison will change the mouse cursor
to a square to indicate that it is waiting for a second
keystroke. If do not wish this functionality, comment out the
diff --git a/src/input.c b/src/input.c
index 60f4624..a0523eb 100644
--- a/src/input.c
+++ b/src/input.c
@@ -323,6 +323,14 @@ get_more_input (char *prompt, char *preinput)
if (cur_len > 0) cur_len--;
update_input_window(s, prompt, str, cur_len);
}
+ else if (ch == INPUT_ABORT_KEY && modifier == INPUT_ABORT_MODIFIER)
+ {
+ /* User aborted. */
+ free (str);
+ XSetInputFocus (dpy, fwin, RevertToPointerRoot, CurrentTime);
+ XUnmapWindow (dpy, s->input_window);
+ return NULL;
+ }
else
{
if (cur_len + nbytes > allocated_len - 1)