summary refs log tree commit diff
path: root/group.c
diff options
context:
space:
mode:
authorokan <okan>2014-08-20 13:42:27 +0000
committerokan <okan>2014-08-20 13:42:27 +0000
commit30da2211ddbc39036e98ae951ea53d9a1793c376 (patch)
tree32e3807273d4018f5aea2635b1231a69380d53a0 /group.c
parent7f4547153815a2851b158fab11de1ea6d96dba76 (diff)
downloadcwm-30da2211ddbc39036e98ae951ea53d9a1793c376.tar.gz
cwm-30da2211ddbc39036e98ae951ea53d9a1793c376.tar.xz
cwm-30da2211ddbc39036e98ae951ea53d9a1793c376.zip
Split off group window restacking.
Diffstat (limited to 'group.c')
-rw-r--r--group.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/group.c b/group.c
index 008118b..5eefea8 100644
--- a/group.c
+++ b/group.c
@@ -35,6 +35,7 @@
 static void		 group_assign(struct group_ctx *, struct client_ctx *);
 static void		 group_hide(struct screen_ctx *, struct group_ctx *);
 static void		 group_show(struct screen_ctx *, struct group_ctx *);
+static void		 group_restack(struct screen_ctx *, struct group_ctx *);
 static void		 group_set_hidden_state(struct group_ctx *);
 static void		 group_setactive(struct screen_ctx *, long);
 static void		 group_set_names(struct screen_ctx *);
@@ -78,6 +79,20 @@ static void
 group_show(struct screen_ctx *sc, struct group_ctx *gc)
 {
 	struct client_ctx	*cc;
+
+	TAILQ_FOREACH(cc, &gc->clients, group_entry)
+		client_unhide(cc);
+
+	gc->hidden = 0;
+
+	group_restack(sc, gc);
+	group_setactive(sc, gc->shortcut);
+}
+
+static void
+group_restack(struct screen_ctx *sc, struct group_ctx *gc)
+{
+	struct client_ctx	*cc;
 	Window			*winlist;
 	int			 i, lastempty = -1;
 	int			 nwins = 0, highstack = 0;
@@ -91,7 +106,6 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
 	/* Invert the stacking order for XRestackWindows(). */
 	TAILQ_FOREACH(cc, &gc->clients, group_entry) {
 		winlist[highstack - cc->stackingorder] = cc->win;
-		client_unhide(cc);
 		nwins++;
 	}
 
@@ -108,9 +122,6 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
 
 	XRestackWindows(X_Dpy, winlist, nwins);
 	free(winlist);
-
-	gc->hidden = 0;
-	group_setactive(sc, gc->shortcut);
 }
 
 void