summary refs log tree commit diff
path: root/group.c
diff options
context:
space:
mode:
authorokan <okan>2014-08-19 12:47:51 +0000
committerokan <okan>2014-08-19 12:47:51 +0000
commit01cca3c114a6a4b82892c7c6f34b00dd898a5900 (patch)
treed1bc55bb5535c32fc6baa424f20ebe2af2c6585a /group.c
parent11920071711238fdfcaf89feb35ab1bf68160347 (diff)
downloadcwm-01cca3c114a6a4b82892c7c6f34b00dd898a5900.tar.gz
cwm-01cca3c114a6a4b82892c7c6f34b00dd898a5900.tar.xz
cwm-01cca3c114a6a4b82892c7c6f34b00dd898a5900.zip
Pull highstack from group_ctx (and useless calculations of); in the one
place that we use highstack, replace that usage with a local variable
(for now until stacking is done properly).
Diffstat (limited to 'group.c')
-rw-r--r--group.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/group.c b/group.c
index c4af66f..647b3d1 100644
--- a/group.c
+++ b/group.c
@@ -68,12 +68,9 @@ group_hide(struct screen_ctx *sc, struct group_ctx *gc)
 
 	screen_updatestackingorder(sc);
 
-	gc->highstack = 0;
-	TAILQ_FOREACH(cc, &gc->clients, group_entry) {
+	TAILQ_FOREACH(cc, &gc->clients, group_entry)
 		client_hide(cc);
-		if (cc->stackingorder > gc->highstack)
-			gc->highstack = cc->stackingorder;
-	}
+
 	gc->hidden = 1;
 }
 
@@ -83,27 +80,23 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
 	struct client_ctx	*cc;
 	Window			*winlist;
 	int			 i, lastempty = -1;
-	int			 nwins = 0;
+	int			 nwins = 0, highstack = 0;
 
-	gc->highstack = 0;
 	TAILQ_FOREACH(cc, &gc->clients, group_entry) {
-		if (cc->stackingorder > gc->highstack)
-			gc->highstack = cc->stackingorder;
+		if (cc->stackingorder > highstack)
+			highstack = cc->stackingorder;
 	}
-	winlist = xcalloc((gc->highstack + 1), sizeof(*winlist));
+	winlist = xcalloc((highstack + 1), sizeof(*winlist));
 
-	/*
-	 * Invert the stacking order as XRestackWindows() expects them
-	 * top-to-bottom.
-	 */
+	/* Invert the stacking order for XRestackWindows(). */
 	TAILQ_FOREACH(cc, &gc->clients, group_entry) {
-		winlist[gc->highstack - cc->stackingorder] = cc->win;
+		winlist[highstack - cc->stackingorder] = cc->win;
 		client_unhide(cc);
 		nwins++;
 	}
 
 	/* Un-sparseify */
-	for (i = 0; i <= gc->highstack; i++) {
+	for (i = 0; i <= highstack; i++) {
 		if (!winlist[i] && lastempty == -1)
 			lastempty = i;
 		else if (winlist[i] && lastempty != -1) {