From 90507e8e1a2ac93497684c584678e705e658dea7 Mon Sep 17 00:00:00 2001 From: okan Date: Mon, 8 Jul 2013 16:32:51 +0000 Subject: clarify kbd vs mouse functions --- calmwm.h | 6 +++--- conf.c | 34 +++++++++++++++++----------------- parse.y | 6 +++--- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/calmwm.h b/calmwm.h index d3398d9..dbf2675 100644 --- a/calmwm.h +++ b/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. * - * $OpenBSD: calmwm.h,v 1.213 2013/06/17 17:11:10 okan Exp $ + * $OpenBSD: calmwm.h,v 1.214 2013/07/08 16:32:51 okan Exp $ */ #ifndef _CALMWM_H_ @@ -443,7 +443,8 @@ void menuq_clear(struct menu_q *); int parse_config(const char *, struct conf *); void conf_autogroup(struct conf *, int, char *); -void conf_bindname(struct conf *, char *, char *); +void conf_bind_kbd(struct conf *, char *, char *); +int conf_bind_mouse(struct conf *, char *, char *); void conf_clear(struct conf *); void conf_client(struct client_ctx *); void conf_cmd_add(struct conf *, char *, char *); @@ -452,7 +453,6 @@ void conf_grab_kbd(Window); void conf_grab_mouse(Window); void conf_init(struct conf *); void conf_ignore(struct conf *, char *); -int conf_mousebind(struct conf *, char *, char *); void conf_screen(struct screen_ctx *); void xev_loop(void); diff --git a/conf.c b/conf.c index dd78575..421afff 100644 --- a/conf.c +++ b/conf.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. * - * $OpenBSD: conf.c,v 1.138 2013/07/08 16:10:55 okan Exp $ + * $OpenBSD: conf.c,v 1.139 2013/07/08 16:32:51 okan Exp $ */ #include @@ -32,8 +32,8 @@ #include "calmwm.h" static const char *conf_bind_getmask(const char *, u_int *); -static void conf_mouseunbind(struct conf *, struct mousebinding *); -static void conf_unbind(struct conf *, struct keybinding *); +static void conf_unbind_mouse(struct conf *, struct mousebinding *); +static void conf_unbind_kbd(struct conf *, struct keybinding *); /* Add an command menu entry to the end of the menu */ void @@ -145,7 +145,7 @@ conf_screen(struct screen_ctx *sc) static struct { char *key; char *func; -} kb_binds[] = { +} kbd_binds[] = { { "CM-Return", "terminal" }, { "CM-Delete", "lock" }, { "M-question", "exec" }, @@ -204,7 +204,7 @@ static struct { { "CS-Up", "bigptrmoveup" }, { "CS-Right", "bigptrmoveright" }, }, -m_binds[] = { +mouse_binds[] = { { "1", "menu_unhide" }, { "2", "menu_group" }, { "3", "menu_cmd" }, @@ -232,11 +232,11 @@ conf_init(struct conf *c) TAILQ_INIT(&c->autogroupq); TAILQ_INIT(&c->mousebindingq); - for (i = 0; i < nitems(kb_binds); i++) - conf_bindname(c, kb_binds[i].key, kb_binds[i].func); + for (i = 0; i < nitems(kbd_binds); i++) + conf_bind_kbd(c, kbd_binds[i].key, kbd_binds[i].func); - for (i = 0; i < nitems(m_binds); i++) - conf_mousebind(c, m_binds[i].key, m_binds[i].func); + for (i = 0; i < nitems(mouse_binds); i++) + conf_bind_mouse(c, mouse_binds[i].key, mouse_binds[i].func); for (i = 0; i < nitems(color_binds); i++) c->color[i] = xstrdup(color_binds[i]); @@ -434,7 +434,7 @@ static struct { }; static struct { - char chr; + char ch; int mask; } bind_mods[] = { { 'C', ControlMask }, @@ -454,7 +454,7 @@ conf_bind_getmask(const char *name, u_int *mask) if ((dash = strchr(name, '-')) == NULL) return (name); for (i = 0; i < nitems(bind_mods); i++) { - if ((ch = strchr(name, bind_mods[i].chr)) != NULL && ch < dash) + if ((ch = strchr(name, bind_mods[i].ch)) != NULL && ch < dash) *mask |= bind_mods[i].mask; } @@ -463,7 +463,7 @@ conf_bind_getmask(const char *name, u_int *mask) } void -conf_bindname(struct conf *c, char *name, char *binding) +conf_bind_kbd(struct conf *c, char *name, char *binding) { struct keybinding *current_binding; const char *substring; @@ -489,7 +489,7 @@ conf_bindname(struct conf *c, char *name, char *binding) } /* We now have the correct binding, remove duplicates. */ - conf_unbind(c, current_binding); + conf_unbind_kbd(c, current_binding); if (strcmp("unmap", binding) == 0) { free(current_binding); @@ -516,7 +516,7 @@ conf_bindname(struct conf *c, char *name, char *binding) } static void -conf_unbind(struct conf *c, struct keybinding *unbind) +conf_unbind_kbd(struct conf *c, struct keybinding *unbind) { struct keybinding *key = NULL, *keynxt; @@ -557,7 +557,7 @@ static unsigned int mouse_btns[] = { }; int -conf_mousebind(struct conf *c, char *name, char *binding) +conf_bind_mouse(struct conf *c, char *name, char *binding) { struct mousebinding *current_binding; const char *errstr, *substring; @@ -583,7 +583,7 @@ conf_mousebind(struct conf *c, char *name, char *binding) } /* We now have the correct binding, remove duplicates. */ - conf_mouseunbind(c, current_binding); + conf_unbind_mouse(c, current_binding); if (strcmp("unmap", binding) == 0) { free(current_binding); @@ -604,7 +604,7 @@ conf_mousebind(struct conf *c, char *name, char *binding) } static void -conf_mouseunbind(struct conf *c, struct mousebinding *unbind) +conf_unbind_mouse(struct conf *c, struct mousebinding *unbind) { struct mousebinding *mb = NULL, *mbnxt; diff --git a/parse.y b/parse.y index c076c9f..06578e6 100644 --- a/parse.y +++ b/parse.y @@ -1,4 +1,4 @@ -/* $OpenBSD: parse.y,v 1.45 2013/06/03 20:33:17 sthen Exp $ */ +/* $OpenBSD: parse.y,v 1.46 2013/07/08 16:32:51 okan Exp $ */ /* * Copyright (c) 2002, 2003, 2004 Henning Brauer @@ -155,7 +155,7 @@ main : FONTNAME STRING { free($2); } | BIND STRING string { - conf_bindname(conf, $2, $3); + conf_bind_kbd(conf, $2, $3); free($2); free($3); } @@ -171,7 +171,7 @@ main : FONTNAME STRING { conf->gap.right = $5; } | MOUSEBIND STRING string { - if (!conf_mousebind(conf, $2, $3)) { + if (!conf_bind_mouse(conf, $2, $3)) { yyerror("invalid mousebind: %s %s", $2, $3); free($2); free($3); -- cgit v1.2.3-2-gb3c3