diff options
author | Okan Demirmen <okan@cvs.openbsd.org> | 2014-08-18 13:57:58 +0000 |
---|---|---|
committer | Okan Demirmen <okan@cvs.openbsd.org> | 2014-08-18 13:57:58 +0000 |
commit | c4d12d61d2b6d5392b18b84b8a285a2333d6401f (patch) | |
tree | 2ec18060c86475175247d8752e608cf0fa91a294 | |
parent | 2bc8761411d46d73f8d57d2ee16128e145ae8887 (diff) |
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().
-rw-r--r-- | app/cwm/calmwm.h | 3 | ||||
-rw-r--r-- | app/cwm/group.c | 14 |
2 files changed, 7 insertions, 10 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h index e02028cc6..c620e5f8b 100644 --- a/app/cwm/calmwm.h +++ b/app/cwm/calmwm.h @@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: calmwm.h,v 1.259 2014/02/08 02:49:30 okan Exp $ + * $OpenBSD: calmwm.h,v 1.260 2014/08/18 13:57:57 okan Exp $ */ #ifndef _CALMWM_H_ @@ -205,7 +205,6 @@ struct group_ctx { struct client_ctx_q clients; int shortcut; int hidden; - int nhidden; int highstack; }; TAILQ_HEAD(group_ctx_q, group_ctx); diff --git a/app/cwm/group.c b/app/cwm/group.c index 67d0c4127..ade20afa9 100644 --- a/app/cwm/group.c +++ b/app/cwm/group.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: group.c,v 1.87 2014/02/08 02:49:30 okan Exp $ + * $OpenBSD: group.c,v 1.88 2014/08/18 13:57:57 okan Exp $ */ #include <sys/param.h> @@ -68,15 +68,13 @@ group_hide(struct screen_ctx *sc, struct group_ctx *gc) screen_updatestackingorder(sc); - gc->nhidden = 0; gc->highstack = 0; TAILQ_FOREACH(cc, &gc->clients, group_entry) { client_hide(cc); - gc->nhidden++; if (cc->stackingorder > gc->highstack) gc->highstack = cc->stackingorder; } - gc->hidden = 1; /* XXX: equivalent to gc->nhidden > 0 */ + gc->hidden = 1; } static void @@ -85,6 +83,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc) struct client_ctx *cc; Window *winlist; int i, lastempty = -1; + int nwins = 0; gc->highstack = 0; 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) { winlist[gc->highstack - cc->stackingorder] = cc->win; client_unhide(cc); + nwins++; } /* 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); gc->hidden = 0; @@ -177,10 +177,8 @@ group_movetogroup(struct client_ctx *cc, int idx) gc = &sc->groups[idx]; if (cc->group == gc) return; - if (gc->hidden) { + if (gc->hidden) client_hide(cc); - gc->nhidden++; - } group_assign(gc, cc); } |