diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2010-02-10 01:23:06 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2010-02-10 01:23:06 +0000 |
commit | dff54629786a39b954e2875ebca5737567ed9bc9 (patch) | |
tree | b6bbf0004849029076dbf4cdab0249f70db8718e /app/cwm | |
parent | 59c7407d019f80e794db349875776690e826e40c (diff) |
preserve labels after an edit action is aborted; extending the menu
struct just for this is the least intrusive approach until the menu code
is reviewed.
inspired by Thomas Pfaff's report on tech@
ok oga@
Diffstat (limited to 'app/cwm')
-rw-r--r-- | app/cwm/calmwm.h | 3 | ||||
-rw-r--r-- | app/cwm/kbfunc.c | 12 | ||||
-rw-r--r-- | app/cwm/menu.c | 2 |
3 files changed, 10 insertions, 7 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index 565c37926..4898f2c88 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.h,v 1.115 2010/01/27 03:04:50 okan Exp $ + * $Id: calmwm.h,v 1.116 2010/02/10 01:23:05 okan Exp $ */ #ifndef _CALMWM_H_ @@ -320,6 +320,7 @@ struct menu { char print[MENU_MAXENTRY + 1]; void *ctx; short dummy; + short abort; }; TAILQ_HEAD(menu_q, menu); diff --git a/app/cwm/kbfunc.c b/app/cwm/kbfunc.c index 005d00c49..775581b11 100644 --- a/app/cwm/kbfunc.c +++ b/app/cwm/kbfunc.c @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: kbfunc.c,v 1.50 2009/12/15 04:10:42 okan Exp $ + * $Id: kbfunc.c,v 1.51 2010/02/10 01:23:05 okan Exp $ */ #include <sys/param.h> @@ -400,19 +400,19 @@ kbfunc_client_label(struct client_ctx *cc, union arg *arg) { struct menu *mi; struct menu_q menuq; - char *current; TAILQ_INIT(&menuq); - current = cc->label; + /* dummy is set, so this will always return */ + mi = menu_filter(cc->sc, &menuq, "label", cc->label, 1, + search_match_text, NULL); - if ((mi = menu_filter(cc->sc, &menuq, "label", current, 1, - search_match_text, NULL)) != NULL) { + if (!mi->abort) { if (cc->label != NULL) xfree(cc->label); cc->label = xstrdup(mi->text); - xfree(mi); } + xfree(mi); } void diff --git a/app/cwm/menu.c b/app/cwm/menu.c index 96d65564f..6b462be5c 100644 --- a/app/cwm/menu.c +++ b/app/cwm/menu.c @@ -223,6 +223,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq, mc->searchstr, sizeof(mi->text)); mi->dummy = 1; } + mi->abort = 0; return (mi); case CTL_WIPE: mc->searchstr[0] = '\0'; @@ -235,6 +236,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq, mi = xmalloc(sizeof *mi); mi->text[0] = '\0'; mi->dummy = 1; + mi->abort = 1; return (mi); default: break; |