mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Much like we do for keyboard and mouse bindings, remove duplicates for
command name - last match.
This commit is contained in:
parent
1f8f19b4d5
commit
4438970b64
15
conf.c
15
conf.c
@ -32,6 +32,7 @@
|
|||||||
#include "calmwm.h"
|
#include "calmwm.h"
|
||||||
|
|
||||||
static const char *conf_bind_getmask(const char *, unsigned int *);
|
static const char *conf_bind_getmask(const char *, unsigned int *);
|
||||||
|
static void conf_cmd_remove(struct conf *, const char *);
|
||||||
static void conf_unbind_kbd(struct conf *, struct keybinding *);
|
static void conf_unbind_kbd(struct conf *, struct keybinding *);
|
||||||
static void conf_unbind_mouse(struct conf *, struct mousebinding *);
|
static void conf_unbind_mouse(struct conf *, struct mousebinding *);
|
||||||
|
|
||||||
@ -52,6 +53,8 @@ conf_cmd_add(struct conf *c, const char *name, const char *path)
|
|||||||
} else {
|
} else {
|
||||||
cmd = xmalloc(sizeof(*cmd));
|
cmd = xmalloc(sizeof(*cmd));
|
||||||
|
|
||||||
|
conf_cmd_remove(c, name);
|
||||||
|
|
||||||
if (strlcpy(cmd->name, name, sizeof(cmd->name)) >=
|
if (strlcpy(cmd->name, name, sizeof(cmd->name)) >=
|
||||||
sizeof(cmd->name))
|
sizeof(cmd->name))
|
||||||
return (0);
|
return (0);
|
||||||
@ -63,6 +66,18 @@ conf_cmd_add(struct conf *c, const char *name, const char *path)
|
|||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
conf_cmd_remove(struct conf *c, const char *name)
|
||||||
|
{
|
||||||
|
struct cmd *cmd = NULL, *cmdnxt;
|
||||||
|
|
||||||
|
TAILQ_FOREACH_SAFE(cmd, &c->cmdq, entry, cmdnxt) {
|
||||||
|
if (strcmp(cmd->name, name) == 0) {
|
||||||
|
TAILQ_REMOVE(&c->cmdq, cmd, entry);
|
||||||
|
free(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
void
|
void
|
||||||
conf_autogroup(struct conf *c, int no, const char *val)
|
conf_autogroup(struct conf *c, int no, const char *val)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user