summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2014-08-20 13:42:28 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2014-08-20 13:42:28 +0000
commit31426fb27ee9d22fc9a44d63d8bb70d046e133e3 (patch)
tree1548684c7903f5582633d8841f841c412a179e87 /app
parent11c48dcddb044a359a269982df2eae183cc1e9c7 (diff)
Split off group window restacking.
Diffstat (limited to 'app')
-rw-r--r--app/cwm/group.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/app/cwm/group.c b/app/cwm/group.c
index a25456b36..7c70acc3a 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.90 2014/08/20 12:33:12 okan Exp $
+ * $OpenBSD: group.c,v 1.91 2014/08/20 13:42:27 okan Exp $
*/
#include <sys/param.h>
@@ -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