summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOkan Demirmen <okan@cvs.openbsd.org>2014-08-19 12:47:52 +0000
committerOkan Demirmen <okan@cvs.openbsd.org>2014-08-19 12:47:52 +0000
commitb371b69ccc02c838f9b318707cfcfb8fb4f3347d (patch)
tree749c10e7d8690ac3b42c4cfa01629fe2869355e3
parentc4d12d61d2b6d5392b18b84b8a285a2333d6401f (diff)
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).
-rw-r--r--app/cwm/calmwm.h3
-rw-r--r--app/cwm/group.c27
2 files changed, 11 insertions, 19 deletions
diff --git a/app/cwm/calmwm.h b/app/cwm/calmwm.h
index c620e5f8b..88e9c78c7 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.260 2014/08/18 13:57:57 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.261 2014/08/19 12:47:51 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -205,7 +205,6 @@ struct group_ctx {
struct client_ctx_q clients;
int shortcut;
int hidden;
- int highstack;
};
TAILQ_HEAD(group_ctx_q, group_ctx);
diff --git a/app/cwm/group.c b/app/cwm/group.c
index ade20afa9..ef917a171 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.88 2014/08/18 13:57:57 okan Exp $
+ * $OpenBSD: group.c,v 1.89 2014/08/19 12:47:51 okan Exp $
*/
#include <sys/param.h>
@@ -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) {