diff options
author | okan <okan> | 2013-07-08 16:32:51 +0000 |
---|---|---|
committer | okan <okan> | 2013-07-08 16:32:51 +0000 |
commit | a49373406607e71601ac062c0a75ad36219065e2 (patch) | |
tree | cec8a9df39eebeccce622c49287c74040298f3c2 | |
parent | 912ec90ea1f6e25b33a2bb0d6d7a1138622bd099 (diff) | |
download | cwm-a49373406607e71601ac062c0a75ad36219065e2.tar.gz cwm-a49373406607e71601ac062c0a75ad36219065e2.tar.xz cwm-a49373406607e71601ac062c0a75ad36219065e2.zip |
clarify kbd vs mouse functions
-rw-r--r-- | calmwm.h | 4 | ||||
-rw-r--r-- | conf.c | 32 | ||||
-rw-r--r-- | parse.y | 4 |
3 files changed, 20 insertions, 20 deletions
diff --git a/calmwm.h b/calmwm.h index caf1808..0f74a87 100644 --- a/calmwm.h +++ b/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 d84bc4f..82e6fa8 100644 --- a/conf.c +++ b/conf.c @@ -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 e40177f..58afd25 100644 --- a/parse.y +++ b/parse.y @@ -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); |