From 87ea5e2a1081de517200e9029842cb6bc0090c47 Mon Sep 17 00:00:00 2001 From: sabetts Date: Fri, 24 Aug 2001 17:45:19 +0000 Subject: added a user abort key --- ChangeLog | 14 ++++++++++++++ NEWS | 12 ++++++++++++ src/actions.c | 20 ++++++++++++++++++++ src/conf.h | 4 ++++ src/input.c | 8 ++++++++ 5 files changed, 58 insertions(+) diff --git a/ChangeLog b/ChangeLog index cc7aa92..b66221e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2001-08-24 Shawn + + * src/input.c (get_more_input): detect and handle a user abort key + sequence. + + * src/conf.h (INPUT_ABORT_KEY): new define + (INPUT_ABORT_MODIFIER): likewise + + * src/actions.c (cmd_select): handle a user abort. + (cmd_rename): likewise + (cmd_colon): likewise + (cmd_exec): likewise + (cmd_newwm): likewise + 2001-08-23 Shawn * src/manage.c (maximize_normal): In the new height on windows diff --git a/NEWS b/NEWS index e702769..8797010 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,18 @@ ratpoison NEWS --- history of user-visible changes. -*- outline -*- * Changes since 0.1.1 +** Transient window handling has changed +Transient windows now map ontop of the current window. + +** new command 'rudeness' +This command allows you to fine tune what windows rp will map +when. For instance you can ask rp not to map new windows. Instead it +will notify you with a message: "New window #1 (emacs)". + +** user abort key sequence +When typing input, hit C-g (customizable in conf.h) to abort the +input. + ** new key syntax keys are now specified with C-, M-, A-, H-, S- which stand for the control, meta, alt, hyper, and super modifiers. ^ does not denote 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) -- cgit v1.2.3