mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
clarify kbd vs mouse functions
This commit is contained in:
parent
912ec90ea1
commit
a493734066
4
calmwm.h
4
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);
|
||||
|
32
conf.c
32
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;
|
||||
|
||||
|
4
parse.y
4
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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user