mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Get rid of nhidden in group_ctx; it actually never reported correctly
since nhidden wasn't incremented nor decremeted in all the right places, thus confusing matters. We don't need to carry a count around, so just use a local variable in the one place we need one to supply XRestackWindows().
This commit is contained in:
1
calmwm.h
1
calmwm.h
@ -205,7 +205,6 @@ struct group_ctx {
|
|||||||
struct client_ctx_q clients;
|
struct client_ctx_q clients;
|
||||||
int shortcut;
|
int shortcut;
|
||||||
int hidden;
|
int hidden;
|
||||||
int nhidden;
|
|
||||||
int highstack;
|
int highstack;
|
||||||
};
|
};
|
||||||
TAILQ_HEAD(group_ctx_q, group_ctx);
|
TAILQ_HEAD(group_ctx_q, group_ctx);
|
||||||
|
12
group.c
12
group.c
@ -68,15 +68,13 @@ group_hide(struct screen_ctx *sc, struct group_ctx *gc)
|
|||||||
|
|
||||||
screen_updatestackingorder(sc);
|
screen_updatestackingorder(sc);
|
||||||
|
|
||||||
gc->nhidden = 0;
|
|
||||||
gc->highstack = 0;
|
gc->highstack = 0;
|
||||||
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
||||||
client_hide(cc);
|
client_hide(cc);
|
||||||
gc->nhidden++;
|
|
||||||
if (cc->stackingorder > gc->highstack)
|
if (cc->stackingorder > gc->highstack)
|
||||||
gc->highstack = cc->stackingorder;
|
gc->highstack = cc->stackingorder;
|
||||||
}
|
}
|
||||||
gc->hidden = 1; /* XXX: equivalent to gc->nhidden > 0 */
|
gc->hidden = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -85,6 +83,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
|
|||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
Window *winlist;
|
Window *winlist;
|
||||||
int i, lastempty = -1;
|
int i, lastempty = -1;
|
||||||
|
int nwins = 0;
|
||||||
|
|
||||||
gc->highstack = 0;
|
gc->highstack = 0;
|
||||||
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
||||||
@ -100,6 +99,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
|
|||||||
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
||||||
winlist[gc->highstack - cc->stackingorder] = cc->win;
|
winlist[gc->highstack - cc->stackingorder] = cc->win;
|
||||||
client_unhide(cc);
|
client_unhide(cc);
|
||||||
|
nwins++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Un-sparseify */
|
/* Un-sparseify */
|
||||||
@ -113,7 +113,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
XRestackWindows(X_Dpy, winlist, gc->nhidden);
|
XRestackWindows(X_Dpy, winlist, nwins);
|
||||||
free(winlist);
|
free(winlist);
|
||||||
|
|
||||||
gc->hidden = 0;
|
gc->hidden = 0;
|
||||||
@ -177,10 +177,8 @@ group_movetogroup(struct client_ctx *cc, int idx)
|
|||||||
gc = &sc->groups[idx];
|
gc = &sc->groups[idx];
|
||||||
if (cc->group == gc)
|
if (cc->group == gc)
|
||||||
return;
|
return;
|
||||||
if (gc->hidden) {
|
if (gc->hidden)
|
||||||
client_hide(cc);
|
client_hide(cc);
|
||||||
gc->nhidden++;
|
|
||||||
}
|
|
||||||
group_assign(gc, cc);
|
group_assign(gc, cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user