mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
group_ctx->name is only used in this one function, and for now it
corresponds directly to the static list of group names. Just use the static list and stop strdup()ing a new version for the context struct. Since that never got freed this also fixes a small memleak. Kill some unused variables while i'm here. ok okan@
This commit is contained in:
parent
a21a064a9b
commit
5c402536fa
1
calmwm.h
1
calmwm.h
@ -171,7 +171,6 @@ static char *shortcut_to_name[] = {
|
|||||||
struct group_ctx {
|
struct group_ctx {
|
||||||
TAILQ_ENTRY(group_ctx) entry;
|
TAILQ_ENTRY(group_ctx) entry;
|
||||||
struct client_ctx_q clients;
|
struct client_ctx_q clients;
|
||||||
char *name;
|
|
||||||
int shortcut;
|
int shortcut;
|
||||||
int hidden;
|
int hidden;
|
||||||
int nhidden;
|
int nhidden;
|
||||||
|
9
group.c
9
group.c
@ -24,10 +24,8 @@
|
|||||||
|
|
||||||
#define CALMWM_NGROUPS 9
|
#define CALMWM_NGROUPS 9
|
||||||
|
|
||||||
int Groupnamemode = 0;
|
|
||||||
struct group_ctx *Group_active = NULL;
|
struct group_ctx *Group_active = NULL;
|
||||||
struct group_ctx Groups[CALMWM_NGROUPS];
|
struct group_ctx Groups[CALMWM_NGROUPS];
|
||||||
char Group_name[256];
|
|
||||||
int Grouphideall = 0;
|
int Grouphideall = 0;
|
||||||
struct group_ctx_q Groupq;
|
struct group_ctx_q Groupq;
|
||||||
|
|
||||||
@ -266,16 +264,13 @@ group_menu(XButtonEvent *e)
|
|||||||
if (TAILQ_EMPTY(&gc->clients))
|
if (TAILQ_EMPTY(&gc->clients))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (gc->name == NULL)
|
|
||||||
gc->name = xstrdup(shortcut_to_name[gc->shortcut]);
|
|
||||||
|
|
||||||
XCALLOC(mi, struct menu);
|
XCALLOC(mi, struct menu);
|
||||||
if (gc->hidden)
|
if (gc->hidden)
|
||||||
snprintf(mi->text, sizeof(mi->text), "%d: [%s]",
|
snprintf(mi->text, sizeof(mi->text), "%d: [%s]",
|
||||||
gc->shortcut, gc->name);
|
gc->shortcut, shortcut_to_name[gc->shortcut]);
|
||||||
else
|
else
|
||||||
snprintf(mi->text, sizeof(mi->text), "%d: %s",
|
snprintf(mi->text, sizeof(mi->text), "%d: %s",
|
||||||
gc->shortcut, gc->name);
|
gc->shortcut, shortcut_to_name[gc->shortcut]);
|
||||||
mi->ctx = gc;
|
mi->ctx = gc;
|
||||||
TAILQ_INSERT_TAIL(&menuq, mi, entry);
|
TAILQ_INSERT_TAIL(&menuq, mi, entry);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user