mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Turn CALMWM_NGROUPS define into variable, ngroups.
This commit is contained in:
parent
8aa5033d12
commit
9306c1fbd3
2
calmwm.h
2
calmwm.h
@ -235,7 +235,6 @@ struct screen_ctx {
|
|||||||
struct gap gap;
|
struct gap gap;
|
||||||
struct client_ctx_q clientq;
|
struct client_ctx_q clientq;
|
||||||
struct region_ctx_q regionq;
|
struct region_ctx_q regionq;
|
||||||
#define CALMWM_NGROUPS 10
|
|
||||||
struct group_ctx_q groupq;
|
struct group_ctx_q groupq;
|
||||||
struct group_ctx *group_active;
|
struct group_ctx *group_active;
|
||||||
struct {
|
struct {
|
||||||
@ -283,6 +282,7 @@ struct conf {
|
|||||||
struct autogroupwin_q autogroupq;
|
struct autogroupwin_q autogroupq;
|
||||||
struct ignore_q ignoreq;
|
struct ignore_q ignoreq;
|
||||||
struct cmd_q cmdq;
|
struct cmd_q cmdq;
|
||||||
|
int ngroups;
|
||||||
int stickygroups;
|
int stickygroups;
|
||||||
int bwidth;
|
int bwidth;
|
||||||
int mamount;
|
int mamount;
|
||||||
|
1
conf.c
1
conf.c
@ -258,6 +258,7 @@ conf_init(struct conf *c)
|
|||||||
c->bwidth = 1;
|
c->bwidth = 1;
|
||||||
c->mamount = 1;
|
c->mamount = 1;
|
||||||
c->snapdist = 0;
|
c->snapdist = 0;
|
||||||
|
c->ngroups = 10;
|
||||||
|
|
||||||
TAILQ_INIT(&c->ignoreq);
|
TAILQ_INIT(&c->ignoreq);
|
||||||
TAILQ_INIT(&c->cmdq);
|
TAILQ_INIT(&c->cmdq);
|
||||||
|
8
group.c
8
group.c
@ -154,7 +154,7 @@ group_movetogroup(struct client_ctx *cc, int idx)
|
|||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct group_ctx *gc;
|
struct group_ctx *gc;
|
||||||
|
|
||||||
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
if (idx < 0 || idx >= Conf.ngroups)
|
||||||
errx(1, "group_movetogroup: index out of range (%d)", idx);
|
errx(1, "group_movetogroup: index out of range (%d)", idx);
|
||||||
|
|
||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
@ -222,7 +222,7 @@ group_hidetoggle(struct screen_ctx *sc, int idx)
|
|||||||
{
|
{
|
||||||
struct group_ctx *gc;
|
struct group_ctx *gc;
|
||||||
|
|
||||||
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
if (idx < 0 || idx >= Conf.ngroups)
|
||||||
errx(1, "group_hidetoggle: index out of range (%d)", idx);
|
errx(1, "group_hidetoggle: index out of range (%d)", idx);
|
||||||
|
|
||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
@ -245,7 +245,7 @@ group_only(struct screen_ctx *sc, int idx)
|
|||||||
{
|
{
|
||||||
struct group_ctx *gc;
|
struct group_ctx *gc;
|
||||||
|
|
||||||
if (idx < 0 || idx >= CALMWM_NGROUPS)
|
if (idx < 0 || idx >= Conf.ngroups)
|
||||||
errx(1, "group_only: index out of range (%d)", idx);
|
errx(1, "group_only: index out of range (%d)", idx);
|
||||||
|
|
||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
@ -335,7 +335,7 @@ group_restore(struct client_ctx *cc)
|
|||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
num = (*grpnum == -1) ? 0 : *grpnum;
|
num = (*grpnum == -1) ? 0 : *grpnum;
|
||||||
num = MIN(num, (CALMWM_NGROUPS - 1));
|
num = MIN(num, (Conf.ngroups - 1));
|
||||||
XFree(grpnum);
|
XFree(grpnum);
|
||||||
|
|
||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
|
2
screen.c
2
screen.c
@ -57,7 +57,7 @@ screen_init(int which)
|
|||||||
|
|
||||||
screen_update_geometry(sc);
|
screen_update_geometry(sc);
|
||||||
|
|
||||||
for (i = 0; i < CALMWM_NGROUPS; i++)
|
for (i = 0; i < Conf.ngroups; i++)
|
||||||
group_init(sc, i);
|
group_init(sc, i);
|
||||||
|
|
||||||
xu_ewmh_net_desktop_names(sc);
|
xu_ewmh_net_desktop_names(sc);
|
||||||
|
23
xutil.c
23
xutil.c
@ -131,19 +131,20 @@ xu_ewmh_net_desktop_geometry(struct screen_ctx *sc)
|
|||||||
void
|
void
|
||||||
xu_ewmh_net_workarea(struct screen_ctx *sc)
|
xu_ewmh_net_workarea(struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
long workareas[CALMWM_NGROUPS][4];
|
unsigned long *workarea;
|
||||||
int i;
|
int i, ngroups = Conf.ngroups;
|
||||||
|
|
||||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
workarea = xreallocarray(NULL, ngroups * 4, sizeof(unsigned long));
|
||||||
workareas[i][0] = sc->work.x;
|
for (i = 0; i < ngroups; i++) {
|
||||||
workareas[i][1] = sc->work.y;
|
workarea[4 * i + 0] = sc->work.x;
|
||||||
workareas[i][2] = sc->work.w;
|
workarea[4 * i + 1] = sc->work.y;
|
||||||
workareas[i][3] = sc->work.h;
|
workarea[4 * i + 2] = sc->work.w;
|
||||||
|
workarea[4 * i + 3] = sc->work.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_WORKAREA],
|
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_WORKAREA],
|
||||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)workareas,
|
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)workarea,
|
||||||
CALMWM_NGROUPS * 4);
|
ngroups * 4);
|
||||||
|
free(workarea);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -223,7 +224,7 @@ xu_ewmh_net_wm_desktop_viewport(struct screen_ctx *sc)
|
|||||||
void
|
void
|
||||||
xu_ewmh_net_wm_number_of_desktops(struct screen_ctx *sc)
|
xu_ewmh_net_wm_number_of_desktops(struct screen_ctx *sc)
|
||||||
{
|
{
|
||||||
long ndesks = CALMWM_NGROUPS;
|
long ndesks = Conf.ngroups;
|
||||||
|
|
||||||
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_NUMBER_OF_DESKTOPS],
|
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_NUMBER_OF_DESKTOPS],
|
||||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&ndesks, 1);
|
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&ndesks, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user