aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorokan2019-03-07 13:14:41 +0000
committerokan2019-03-07 13:14:41 +0000
commit39f6f479f6e5636dd0498d419a2172b9683f75ce (patch)
tree03ca887c30e655efdc249464f8aef91691225abb
parent3ac2ad35ec0bf84d329aff3ee68fd551d4e14fc9 (diff)
downloadcwm-39f6f479f6e5636dd0498d419a2172b9683f75ce.tar.gz
gc clientq inside groups, instead use the better maintained one per-screen
-rw-r--r--calmwm.h4
-rw-r--r--client.c21
-rw-r--r--group.c49
3 files changed, 43 insertions, 31 deletions
diff --git a/calmwm.h b/calmwm.h
index b1376d4..ef622a7 100644
--- a/calmwm.h
+++ b/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.369 2019/03/07 12:54:21 okan Exp $
+ * $OpenBSD: calmwm.h,v 1.370 2019/03/07 13:14:41 okan Exp $
*/
#ifndef _CALMWM_H_
@@ -121,7 +121,6 @@ TAILQ_HEAD(ignore_q, winname);
struct client_ctx {
TAILQ_ENTRY(client_ctx) entry;
- TAILQ_ENTRY(client_ctx) group_entry;
struct screen_ctx *sc;
struct group_ctx *gc;
Window win;
@@ -187,7 +186,6 @@ struct group_ctx {
struct screen_ctx *sc;
char *name;
int num;
- struct client_q clientq;
};
TAILQ_HEAD(group_q, group_ctx);
diff --git a/client.c b/client.c
index e86ded2..ef4a766 100644
--- a/client.c
+++ b/client.c
@@ -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: client.c,v 1.252 2019/02/28 13:11:53 okan Exp $
+ * $OpenBSD: client.c,v 1.253 2019/03/07 13:14:41 okan Exp $
*/
#include <sys/types.h>
@@ -183,9 +183,6 @@ client_remove(struct client_ctx *cc)
if (cc->flags & CLIENT_ACTIVE)
xu_ewmh_net_active_window(sc, None);
- if (cc->gc != NULL)
- TAILQ_REMOVE(&cc->gc->clientq, cc, group_entry);
-
while ((wn = TAILQ_FIRST(&cc->nameq)) != NULL) {
TAILQ_REMOVE(&cc->nameq, wn, entry);
free(wn->name);
@@ -976,7 +973,9 @@ client_htile(struct client_ctx *cc)
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2, CWM_GAP);
- TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(ci, &sc->clientq, entry) {
+ if (ci->gc != cc->gc)
+ continue;
if (ci->flags & CLIENT_HIDDEN ||
ci->flags & CLIENT_IGNORE || (ci == cc) ||
ci->geom.x < area.x ||
@@ -1005,7 +1004,9 @@ client_htile(struct client_ctx *cc)
x = area.x;
w = area.w / n;
h = area.h - mh;
- TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(ci, &sc->clientq, entry) {
+ if (ci->gc != cc->gc)
+ continue;
if (ci->flags & CLIENT_HIDDEN ||
ci->flags & CLIENT_IGNORE || (ci == cc) ||
ci->geom.x < area.x ||
@@ -1044,7 +1045,9 @@ client_vtile(struct client_ctx *cc)
cc->geom.x + cc->geom.w / 2,
cc->geom.y + cc->geom.h / 2, CWM_GAP);
- TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(ci, &sc->clientq, entry) {
+ if (ci->gc != cc->gc)
+ continue;
if (ci->flags & CLIENT_HIDDEN ||
ci->flags & CLIENT_IGNORE || (ci == cc) ||
ci->geom.x < area.x ||
@@ -1073,7 +1076,9 @@ client_vtile(struct client_ctx *cc)
y = area.y;
h = area.h / n;
w = area.w - mw;
- TAILQ_FOREACH(ci, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(ci, &sc->clientq, entry) {
+ if (ci->gc != cc->gc)
+ continue;
if (ci->flags & CLIENT_HIDDEN ||
ci->flags & CLIENT_IGNORE || (ci == cc) ||
ci->geom.x < area.x ||
diff --git a/group.c b/group.c
index 3419c8b..da2072a 100644
--- a/group.c
+++ b/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.134 2019/03/07 12:54:21 okan Exp $
+ * $OpenBSD: group.c,v 1.135 2019/03/07 13:14:41 okan Exp $
*/
#include <sys/types.h>
@@ -40,28 +40,25 @@ static void group_setactive(struct group_ctx *);
void
group_assign(struct group_ctx *gc, struct client_ctx *cc)
{
- if (cc->gc != NULL)
- TAILQ_REMOVE(&cc->gc->clientq, cc, group_entry);
-
if ((gc != NULL) && (gc->num == 0))
gc = NULL;
cc->gc = gc;
- if (cc->gc != NULL)
- TAILQ_INSERT_TAIL(&gc->clientq, cc, group_entry);
-
xu_ewmh_net_wm_desktop(cc);
}
void
group_hide(struct group_ctx *gc)
{
+ struct screen_ctx *sc = gc->sc;
struct client_ctx *cc;
screen_updatestackingorder(gc->sc);
- TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(cc, &sc->clientq, entry) {
+ if (cc->gc != gc)
+ continue;
if (!(cc->flags & CLIENT_STICKY) &&
!(cc->flags & CLIENT_HIDDEN))
client_hide(cc);
@@ -71,9 +68,12 @@ group_hide(struct group_ctx *gc)
void
group_show(struct group_ctx *gc)
{
+ struct screen_ctx *sc = gc->sc;
struct client_ctx *cc;
- TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(cc, &sc->clientq, entry) {
+ if (cc->gc != gc)
+ continue;
if (!(cc->flags & CLIENT_STICKY) &&
(cc->flags & CLIENT_HIDDEN))
client_show(cc);
@@ -86,19 +86,24 @@ group_show(struct group_ctx *gc)
static void
group_restack(struct group_ctx *gc)
{
+ struct screen_ctx *sc = gc->sc;
struct client_ctx *cc;
Window *winlist;
int i, lastempty = -1;
int nwins = 0, highstack = 0;
- TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(cc, &sc->clientq, entry) {
+ if (cc->gc != gc)
+ continue;
if (cc->stackingorder > highstack)
highstack = cc->stackingorder;
}
winlist = xreallocarray(NULL, (highstack + 1), sizeof(*winlist));
/* Invert the stacking order for XRestackWindows(). */
- TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(cc, &sc->clientq, entry) {
+ if (cc->gc != gc)
+ continue;
winlist[highstack - cc->stackingorder] = cc->win;
nwins++;
}
@@ -127,7 +132,6 @@ group_init(struct screen_ctx *sc, int num, const char *name)
gc->sc = sc;
gc->name = xstrdup(name);
gc->num = num;
- TAILQ_INIT(&gc->clientq);
TAILQ_INSERT_TAIL(&sc->groupq, gc, entry);
@@ -182,9 +186,12 @@ group_toggle_membership(struct client_ctx *cc)
int
group_holds_only_sticky(struct group_ctx *gc)
{
+ struct screen_ctx *sc = gc->sc;
struct client_ctx *cc;
- TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(cc, &sc->clientq, entry) {
+ if (cc->gc != gc)
+ continue;
if (!(cc->flags & CLIENT_STICKY))
return(0);
}
@@ -194,9 +201,12 @@ group_holds_only_sticky(struct group_ctx *gc)
int
group_holds_only_hidden(struct group_ctx *gc)
{
+ struct screen_ctx *sc = gc->sc;
struct client_ctx *cc;
- TAILQ_FOREACH(cc, &gc->clientq, group_entry) {
+ TAILQ_FOREACH(cc, &sc->clientq, entry) {
+ if (cc->gc != gc)
+ continue;
if (!(cc->flags & (CLIENT_HIDDEN | CLIENT_STICKY)))
return(0);
}
@@ -225,12 +235,8 @@ group_toggle(struct screen_ctx *sc, int idx)
if (gc->num == idx) {
if (group_holds_only_hidden(gc))
group_show(gc);
- else {
+ else
group_hide(gc);
- /* make clients stick to empty group */
- if (TAILQ_EMPTY(&gc->clientq))
- group_setactive(gc);
- }
}
}
}
@@ -257,8 +263,11 @@ group_close(struct screen_ctx *sc, int idx)
TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (gc->num == idx) {
- TAILQ_FOREACH(cc, &gc->clientq, group_entry)
+ TAILQ_FOREACH(cc, &sc->clientq, entry) {
+ if (cc->gc != gc)
+ continue;
client_close(cc);
+ }
}
}
}