mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
constify and rename some confusing variables around cmdq.
This commit is contained in:
parent
7263fb4c84
commit
d91571c567
13
calmwm.h
13
calmwm.h
@ -267,9 +267,9 @@ TAILQ_HEAD(mousebinding_q, mousebinding);
|
|||||||
|
|
||||||
struct cmd {
|
struct cmd {
|
||||||
TAILQ_ENTRY(cmd) entry;
|
TAILQ_ENTRY(cmd) entry;
|
||||||
char image[MAXPATHLEN];
|
#define CMD_MAXNAMELEN 256
|
||||||
#define CMD_MAXLABELLEN 256
|
char name[CMD_MAXNAMELEN];
|
||||||
char label[CMD_MAXLABELLEN];
|
char path[MAXPATHLEN];
|
||||||
};
|
};
|
||||||
TAILQ_HEAD(cmd_q, cmd);
|
TAILQ_HEAD(cmd_q, cmd);
|
||||||
|
|
||||||
@ -514,19 +514,20 @@ void menuq_clear(struct menu_q *);
|
|||||||
int parse_config(const char *, struct conf *);
|
int parse_config(const char *, struct conf *);
|
||||||
|
|
||||||
void conf_atoms(void);
|
void conf_atoms(void);
|
||||||
void conf_autogroup(struct conf *, int, char *);
|
void conf_autogroup(struct conf *, int, const char *);
|
||||||
int conf_bind_kbd(struct conf *, const char *,
|
int conf_bind_kbd(struct conf *, const char *,
|
||||||
const char *);
|
const char *);
|
||||||
int conf_bind_mouse(struct conf *, const char *,
|
int conf_bind_mouse(struct conf *, const char *,
|
||||||
const char *);
|
const char *);
|
||||||
void conf_clear(struct conf *);
|
void conf_clear(struct conf *);
|
||||||
void conf_client(struct client_ctx *);
|
void conf_client(struct client_ctx *);
|
||||||
void conf_cmd_add(struct conf *, char *, char *);
|
void conf_cmd_add(struct conf *, const char *,
|
||||||
|
const char *);
|
||||||
void conf_cursor(struct conf *);
|
void conf_cursor(struct conf *);
|
||||||
void conf_grab_kbd(Window);
|
void conf_grab_kbd(Window);
|
||||||
void conf_grab_mouse(Window);
|
void conf_grab_mouse(Window);
|
||||||
void conf_init(struct conf *);
|
void conf_init(struct conf *);
|
||||||
void conf_ignore(struct conf *, char *);
|
void conf_ignore(struct conf *, const char *);
|
||||||
void conf_screen(struct screen_ctx *);
|
void conf_screen(struct screen_ctx *);
|
||||||
|
|
||||||
void xev_loop(void);
|
void xev_loop(void);
|
||||||
|
18
conf.c
18
conf.c
@ -37,23 +37,23 @@ static void conf_unbind_mouse(struct conf *, struct mousebinding *);
|
|||||||
|
|
||||||
/* Add an command menu entry to the end of the menu */
|
/* Add an command menu entry to the end of the menu */
|
||||||
void
|
void
|
||||||
conf_cmd_add(struct conf *c, char *image, char *label)
|
conf_cmd_add(struct conf *c, const char *name, const char *path)
|
||||||
{
|
{
|
||||||
/* "term" and "lock" have special meanings. */
|
/* "term" and "lock" have special meanings. */
|
||||||
if (strcmp(label, "term") == 0)
|
if (strcmp(name, "term") == 0)
|
||||||
(void)strlcpy(c->termpath, image, sizeof(c->termpath));
|
(void)strlcpy(c->termpath, path, sizeof(c->termpath));
|
||||||
else if (strcmp(label, "lock") == 0)
|
else if (strcmp(name, "lock") == 0)
|
||||||
(void)strlcpy(c->lockpath, image, sizeof(c->lockpath));
|
(void)strlcpy(c->lockpath, path, sizeof(c->lockpath));
|
||||||
else {
|
else {
|
||||||
struct cmd *cmd = xmalloc(sizeof(*cmd));
|
struct cmd *cmd = xmalloc(sizeof(*cmd));
|
||||||
(void)strlcpy(cmd->image, image, sizeof(cmd->image));
|
(void)strlcpy(cmd->name, name, sizeof(cmd->name));
|
||||||
(void)strlcpy(cmd->label, label, sizeof(cmd->label));
|
(void)strlcpy(cmd->path, path, sizeof(cmd->path));
|
||||||
TAILQ_INSERT_TAIL(&c->cmdq, cmd, entry);
|
TAILQ_INSERT_TAIL(&c->cmdq, cmd, entry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
conf_autogroup(struct conf *c, int no, char *val)
|
conf_autogroup(struct conf *c, int no, const char *val)
|
||||||
{
|
{
|
||||||
struct autogroupwin *aw;
|
struct autogroupwin *aw;
|
||||||
char *p;
|
char *p;
|
||||||
@ -74,7 +74,7 @@ conf_autogroup(struct conf *c, int no, char *val)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
conf_ignore(struct conf *c, char *val)
|
conf_ignore(struct conf *c, const char *val)
|
||||||
{
|
{
|
||||||
struct winmatch *wm;
|
struct winmatch *wm;
|
||||||
|
|
||||||
|
4
kbfunc.c
4
kbfunc.c
@ -178,11 +178,11 @@ kbfunc_menu_search(struct client_ctx *cc, union arg *arg)
|
|||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
TAILQ_FOREACH(cmd, &Conf.cmdq, entry)
|
TAILQ_FOREACH(cmd, &Conf.cmdq, entry)
|
||||||
menuq_add(&menuq, cmd, "%s", cmd->label);
|
menuq_add(&menuq, cmd, "%s", cmd->name);
|
||||||
|
|
||||||
if ((mi = menu_filter(sc, &menuq, "application", NULL, 0,
|
if ((mi = menu_filter(sc, &menuq, "application", NULL, 0,
|
||||||
search_match_text, NULL)) != NULL)
|
search_match_text, NULL)) != NULL)
|
||||||
u_spawn(((struct cmd *)mi->ctx)->image);
|
u_spawn(((struct cmd *)mi->ctx)->path);
|
||||||
|
|
||||||
menuq_clear(&menuq);
|
menuq_clear(&menuq);
|
||||||
}
|
}
|
||||||
|
@ -265,13 +265,13 @@ mousefunc_menu_cmd(struct client_ctx *cc, union arg *arg)
|
|||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
TAILQ_FOREACH(cmd, &Conf.cmdq, entry)
|
TAILQ_FOREACH(cmd, &Conf.cmdq, entry)
|
||||||
menuq_add(&menuq, cmd, "%s", cmd->label);
|
menuq_add(&menuq, cmd, "%s", cmd->name);
|
||||||
if (TAILQ_EMPTY(&menuq))
|
if (TAILQ_EMPTY(&menuq))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL);
|
mi = menu_filter(sc, &menuq, NULL, NULL, 0, NULL, NULL);
|
||||||
if (mi != NULL)
|
if (mi != NULL)
|
||||||
u_spawn(((struct cmd *)mi->ctx)->image);
|
u_spawn(((struct cmd *)mi->ctx)->path);
|
||||||
|
|
||||||
menuq_clear(&menuq);
|
menuq_clear(&menuq);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user