diff options
author | okan | 2014-09-08 20:11:22 +0000 |
---|---|---|
committer | okan | 2014-09-08 20:11:22 +0000 |
commit | 943a3f1272a3549265acbce2060801cb669396bc (patch) | |
tree | 3aed9fd559210c85c755f7fee645ebaae5b54cdd | |
parent | 25980c356984d6152dc3703f57d4680bb21c1f04 (diff) | |
download | cwm-943a3f1272a3549265acbce2060801cb669396bc.tar.gz |
Remove duplicate client queue (mruq); instead, remove and take the
global Clientq and place it inside screen_ctx since every client belongs
to a screen, then use the same per screen clientq to track stacking
order (the sole reason for mruq).
-rw-r--r-- | calmwm.c | 3 | ||||
-rw-r--r-- | calmwm.h | 11 | ||||
-rw-r--r-- | client.c | 35 | ||||
-rw-r--r-- | kbfunc.c | 4 | ||||
-rw-r--r-- | mousefunc.c | 4 | ||||
-rw-r--r-- | screen.c | 4 | ||||
-rw-r--r-- | xutil.c | 6 |
7 files changed, 32 insertions, 35 deletions
@@ -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.c,v 1.91 2014/09/07 19:27:30 okan Exp $ + * $OpenBSD: calmwm.c,v 1.92 2014/09/08 20:11:22 okan Exp $ */ #include <sys/param.h> @@ -41,7 +41,6 @@ Atom cwmh[CWMH_NITEMS]; Atom ewmh[EWMH_NITEMS]; struct screen_ctx_q Screenq = TAILQ_HEAD_INITIALIZER(Screenq); -struct client_ctx_q Clientq = TAILQ_HEAD_INITIALIZER(Clientq); int HasRandr, Randr_ev; struct conf Conf; @@ -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.272 2014/09/08 13:51:29 okan Exp $ + * $OpenBSD: calmwm.h,v 1.273 2014/09/08 20:11:22 okan Exp $ */ #ifndef _CALMWM_H_ @@ -143,9 +143,8 @@ TAILQ_HEAD(winname_q, winname); TAILQ_HEAD(ignore_q, winname); struct client_ctx { - TAILQ_ENTRY(client_ctx) entry; - TAILQ_ENTRY(client_ctx) group_entry; - TAILQ_ENTRY(client_ctx) mru_entry; + TAILQ_ENTRY(client_ctx) entry; + TAILQ_ENTRY(client_ctx) group_entry; struct screen_ctx *sc; Window win; Colormap colormap; @@ -199,7 +198,6 @@ struct client_ctx { XWMHints *wmh; }; TAILQ_HEAD(client_ctx_q, client_ctx); -TAILQ_HEAD(cycle_entry_q, client_ctx); struct group_ctx { TAILQ_ENTRY(group_ctx) entry; @@ -235,7 +233,7 @@ struct screen_ctx { struct geom view; /* viewable area */ struct geom work; /* workable area, gap-applied */ struct gap gap; - struct cycle_entry_q mruq; + struct client_ctx_q clientq; struct region_ctx_q regionq; XftColor xftcolor[CWM_COLOR_NITEMS]; XftDraw *xftdraw; @@ -315,7 +313,6 @@ struct mwm_hints { extern Display *X_Dpy; extern Time Last_Event_Time; extern struct screen_ctx_q Screenq; -extern struct client_ctx_q Clientq; extern struct conf Conf; extern const char *homedir; extern int HasRandr, Randr_ev; @@ -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.176 2014/09/07 19:27:30 okan Exp $ + * $OpenBSD: client.c,v 1.177 2014/09/08 20:11:22 okan Exp $ */ #include <sys/param.h> @@ -45,11 +45,14 @@ struct client_ctx *curcc = NULL; struct client_ctx * client_find(Window win) { + struct screen_ctx *sc; struct client_ctx *cc; - TAILQ_FOREACH(cc, &Clientq, entry) { - if (cc->win == win) - return(cc); + TAILQ_FOREACH(sc, &Screenq, entry) { + TAILQ_FOREACH(cc, &sc->clientq, entry) { + if (cc->win == win) + return(cc); + } } return(NULL); } @@ -126,8 +129,7 @@ client_init(Window win, struct screen_ctx *sc) (state == IconicState) ? client_hide(cc) : client_unhide(cc); - TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry); - TAILQ_INSERT_TAIL(&Clientq, cc, entry); + TAILQ_INSERT_TAIL(&sc->clientq, cc, entry); xu_ewmh_net_client_list(sc); xu_ewmh_restore_net_wm_state(cc); @@ -147,8 +149,7 @@ client_delete(struct client_ctx *cc) struct screen_ctx *sc = cc->sc; struct winname *wn; - TAILQ_REMOVE(&sc->mruq, cc, mru_entry); - TAILQ_REMOVE(&Clientq, cc, entry); + TAILQ_REMOVE(&sc->clientq, cc, entry); xu_ewmh_net_client_list(sc); @@ -641,13 +642,13 @@ client_cycle(struct screen_ctx *sc, int flags) oldcc = client_current(); /* If no windows then you cant cycle */ - if (TAILQ_EMPTY(&sc->mruq)) + if (TAILQ_EMPTY(&sc->clientq)) return; if (oldcc == NULL) oldcc = (flags & CWM_RCYCLE ? - TAILQ_LAST(&sc->mruq, cycle_entry_q) : - TAILQ_FIRST(&sc->mruq)); + TAILQ_LAST(&sc->clientq, client_ctx_q) : + TAILQ_FIRST(&sc->clientq)); newcc = oldcc; while (again) { @@ -696,8 +697,8 @@ client_mrunext(struct client_ctx *cc) struct screen_ctx *sc = cc->sc; struct client_ctx *ccc; - return((ccc = TAILQ_NEXT(cc, mru_entry)) != NULL ? - ccc : TAILQ_FIRST(&sc->mruq)); + return((ccc = TAILQ_NEXT(cc, entry)) != NULL ? + ccc : TAILQ_FIRST(&sc->clientq)); } static struct client_ctx * @@ -706,8 +707,8 @@ client_mruprev(struct client_ctx *cc) struct screen_ctx *sc = cc->sc; struct client_ctx *ccc; - return((ccc = TAILQ_PREV(cc, cycle_entry_q, mru_entry)) != NULL ? - ccc : TAILQ_LAST(&sc->mruq, cycle_entry_q)); + return((ccc = TAILQ_PREV(cc, client_ctx_q, entry)) != NULL ? + ccc : TAILQ_LAST(&sc->clientq, client_ctx_q)); } static void @@ -765,8 +766,8 @@ client_mtf(struct client_ctx *cc) { struct screen_ctx *sc = cc->sc; - TAILQ_REMOVE(&sc->mruq, cc, mru_entry); - TAILQ_INSERT_HEAD(&sc->mruq, cc, mru_entry); + TAILQ_REMOVE(&sc->clientq, cc, entry); + TAILQ_INSERT_HEAD(&sc->clientq, cc, entry); } void @@ -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: kbfunc.c,v 1.99 2014/09/06 18:50:43 okan Exp $ + * $OpenBSD: kbfunc.c,v 1.100 2014/09/08 20:11:22 okan Exp $ */ #include <sys/param.h> @@ -151,7 +151,7 @@ kbfunc_client_search(struct client_ctx *cc, union arg *arg) old_cc = client_current(); TAILQ_INIT(&menuq); - TAILQ_FOREACH(cc, &Clientq, entry) + TAILQ_FOREACH(cc, &sc->clientq, entry) menuq_add(&menuq, cc, "%s", cc->name); if ((mi = menu_filter(sc, &menuq, "window", NULL, 0, diff --git a/mousefunc.c b/mousefunc.c index 613f21d..f2ce0ef 100644 --- a/mousefunc.c +++ b/mousefunc.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: mousefunc.c,v 1.78 2014/09/08 13:51:29 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.79 2014/09/08 20:11:22 okan Exp $ */ #include <sys/param.h> @@ -219,7 +219,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg) old_cc = client_current(); TAILQ_INIT(&menuq); - TAILQ_FOREACH(cc, &Clientq, entry) { + TAILQ_FOREACH(cc, &sc->clientq, entry) { if (cc->flags & CLIENT_HIDDEN) { wname = (cc->label) ? cc->label : cc->name; if (wname == NULL) @@ -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: screen.c,v 1.66 2014/09/07 19:27:30 okan Exp $ + * $OpenBSD: screen.c,v 1.67 2014/09/08 20:11:22 okan Exp $ */ #include <sys/param.h> @@ -40,7 +40,7 @@ screen_init(int which) sc = xcalloc(1, sizeof(*sc)); - TAILQ_INIT(&sc->mruq); + TAILQ_INIT(&sc->clientq); TAILQ_INIT(&sc->regionq); sc->which = which; @@ -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: xutil.c,v 1.91 2014/09/07 19:27:30 okan Exp $ + * $OpenBSD: xutil.c,v 1.92 2014/09/08 20:11:22 okan Exp $ */ #include <sys/param.h> @@ -214,13 +214,13 @@ xu_ewmh_net_client_list(struct screen_ctx *sc) Window *winlist; int i = 0, j = 0; - TAILQ_FOREACH(cc, &Clientq, entry) + TAILQ_FOREACH(cc, &sc->clientq, entry) i++; if (i == 0) return; winlist = xcalloc(i, sizeof(*winlist)); - TAILQ_FOREACH(cc, &Clientq, entry) + TAILQ_FOREACH(cc, &sc->clientq, entry) winlist[j++] = cc->win; XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST], XA_WINDOW, 32, PropModeReplace, (unsigned char *)winlist, i); |