mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
make num of groups no longer off-by-one; from Alexander Polakov
note that a re-exec of cwm will not rewrite the group number atom of *existing* clients, so they will remain off-by-one until each client has its atom updated, or of course a restart of X.
This commit is contained in:
parent
dc1e3a8843
commit
0957fbbee2
4
calmwm.h
4
calmwm.h
@ -74,8 +74,6 @@
|
|||||||
#define CWM_MENU_DUMMY 0x0001
|
#define CWM_MENU_DUMMY 0x0001
|
||||||
#define CWM_MENU_FILE 0x0002
|
#define CWM_MENU_FILE 0x0002
|
||||||
|
|
||||||
#define KBTOGROUP(X) ((X) - 1)
|
|
||||||
|
|
||||||
union arg {
|
union arg {
|
||||||
char *c;
|
char *c;
|
||||||
int i;
|
int i;
|
||||||
@ -222,7 +220,7 @@ struct screen_ctx {
|
|||||||
XftFont *xftfont;
|
XftFont *xftfont;
|
||||||
int xinerama_no;
|
int xinerama_no;
|
||||||
XineramaScreenInfo *xinerama;
|
XineramaScreenInfo *xinerama;
|
||||||
#define CALMWM_NGROUPS 9
|
#define CALMWM_NGROUPS 10
|
||||||
struct group_ctx groups[CALMWM_NGROUPS];
|
struct group_ctx groups[CALMWM_NGROUPS];
|
||||||
struct group_ctx_q groupq;
|
struct group_ctx_q groupq;
|
||||||
int group_hideall;
|
int group_hideall;
|
||||||
|
2
client.c
2
client.c
@ -876,7 +876,7 @@ client_transient(struct client_ctx *cc)
|
|||||||
|
|
||||||
if (XGetTransientForHint(X_Dpy, cc->win, &trans)) {
|
if (XGetTransientForHint(X_Dpy, cc->win, &trans)) {
|
||||||
if ((tc = client_find(trans)) && tc->group) {
|
if ((tc = client_find(trans)) && tc->group) {
|
||||||
group_movetogroup(cc, tc->group->shortcut - 1);
|
group_movetogroup(cc, tc->group->shortcut);
|
||||||
if (tc->flags & CLIENT_IGNORE)
|
if (tc->flags & CLIENT_IGNORE)
|
||||||
cc->flags |= CLIENT_IGNORE;
|
cc->flags |= CLIENT_IGNORE;
|
||||||
}
|
}
|
||||||
|
10
group.c
10
group.c
@ -132,7 +132,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
|
|||||||
free(winlist);
|
free(winlist);
|
||||||
|
|
||||||
gc->hidden = 0;
|
gc->hidden = 0;
|
||||||
group_setactive(sc, gc->shortcut - 1);
|
group_setactive(sc, gc->shortcut);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -151,7 +151,7 @@ group_init(struct screen_ctx *sc)
|
|||||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||||
TAILQ_INIT(&sc->groups[i].clients);
|
TAILQ_INIT(&sc->groups[i].clients);
|
||||||
sc->groups[i].hidden = 0;
|
sc->groups[i].hidden = 0;
|
||||||
sc->groups[i].shortcut = i + 1;
|
sc->groups[i].shortcut = i;
|
||||||
TAILQ_INSERT_TAIL(&sc->groupq, &sc->groups[i], entry);
|
TAILQ_INSERT_TAIL(&sc->groupq, &sc->groups[i], entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ group_cycle(struct screen_ctx *sc, int flags)
|
|||||||
if (showgroup->hidden)
|
if (showgroup->hidden)
|
||||||
group_show(sc, showgroup);
|
group_show(sc, showgroup);
|
||||||
else
|
else
|
||||||
group_setactive(sc, showgroup->shortcut - 1);
|
group_setactive(sc, showgroup->shortcut);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* called when a client is deleted */
|
/* called when a client is deleted */
|
||||||
@ -420,7 +420,7 @@ group_autogroup(struct client_ctx *cc)
|
|||||||
else if (*grpno > CALMWM_NGROUPS || *grpno < 0)
|
else if (*grpno > CALMWM_NGROUPS || *grpno < 0)
|
||||||
no = CALMWM_NGROUPS - 1;
|
no = CALMWM_NGROUPS - 1;
|
||||||
else
|
else
|
||||||
no = *grpno + 1;
|
no = *grpno;
|
||||||
XFree(grpno);
|
XFree(grpno);
|
||||||
} else {
|
} else {
|
||||||
TAILQ_FOREACH(aw, &Conf.autogroupq, entry) {
|
TAILQ_FOREACH(aw, &Conf.autogroupq, entry) {
|
||||||
@ -480,7 +480,7 @@ group_update_names(struct screen_ctx *sc)
|
|||||||
*/
|
*/
|
||||||
if (n < CALMWM_NGROUPS) {
|
if (n < CALMWM_NGROUPS) {
|
||||||
setnames = 1;
|
setnames = 1;
|
||||||
i = 1;
|
i = 0;
|
||||||
while (n < CALMWM_NGROUPS)
|
while (n < CALMWM_NGROUPS)
|
||||||
strings[n++] = xstrdup(shortcut_to_name[i++]);
|
strings[n++] = xstrdup(shortcut_to_name[i++]);
|
||||||
}
|
}
|
||||||
|
6
kbfunc.c
6
kbfunc.c
@ -406,13 +406,13 @@ kbfunc_client_delete(struct client_ctx *cc, union arg *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_client_group(struct client_ctx *cc, union arg *arg)
|
kbfunc_client_group(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
group_hidetoggle(cc->sc, KBTOGROUP(arg->i));
|
group_hidetoggle(cc->sc, arg->i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
kbfunc_client_grouponly(struct client_ctx *cc, union arg *arg)
|
kbfunc_client_grouponly(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
group_only(cc->sc, KBTOGROUP(arg->i));
|
group_only(cc->sc, arg->i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -440,7 +440,7 @@ kbfunc_client_grouptoggle(struct client_ctx *cc, union arg *arg)
|
|||||||
void
|
void
|
||||||
kbfunc_client_movetogroup(struct client_ctx *cc, union arg *arg)
|
kbfunc_client_movetogroup(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
group_movetogroup(cc, KBTOGROUP(arg->i));
|
group_movetogroup(cc, arg->i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
2
xutil.c
2
xutil.c
@ -411,7 +411,7 @@ xu_ewmh_net_wm_desktop(struct client_ctx *cc)
|
|||||||
long no = 0xffffffff;
|
long no = 0xffffffff;
|
||||||
|
|
||||||
if (gc)
|
if (gc)
|
||||||
no = gc->shortcut - 1;
|
no = gc->shortcut;
|
||||||
|
|
||||||
XChangeProperty(X_Dpy, cc->win, ewmh[_NET_WM_DESKTOP].atom,
|
XChangeProperty(X_Dpy, cc->win, ewmh[_NET_WM_DESKTOP].atom,
|
||||||
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&no, 1);
|
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&no, 1);
|
||||||
|
Loading…
Reference in New Issue
Block a user