mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
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).
This commit is contained in:
parent
a7f3f29ea9
commit
26ba152692
1
calmwm.c
1
calmwm.c
@ -41,7 +41,6 @@ Atom cwmh[CWMH_NITEMS];
|
|||||||
Atom ewmh[EWMH_NITEMS];
|
Atom ewmh[EWMH_NITEMS];
|
||||||
|
|
||||||
struct screen_ctx_q Screenq = TAILQ_HEAD_INITIALIZER(Screenq);
|
struct screen_ctx_q Screenq = TAILQ_HEAD_INITIALIZER(Screenq);
|
||||||
struct client_ctx_q Clientq = TAILQ_HEAD_INITIALIZER(Clientq);
|
|
||||||
|
|
||||||
int HasRandr, Randr_ev;
|
int HasRandr, Randr_ev;
|
||||||
struct conf Conf;
|
struct conf Conf;
|
||||||
|
9
calmwm.h
9
calmwm.h
@ -143,9 +143,8 @@ TAILQ_HEAD(winname_q, winname);
|
|||||||
TAILQ_HEAD(ignore_q, winname);
|
TAILQ_HEAD(ignore_q, winname);
|
||||||
|
|
||||||
struct client_ctx {
|
struct client_ctx {
|
||||||
TAILQ_ENTRY(client_ctx) entry;
|
TAILQ_ENTRY(client_ctx) entry;
|
||||||
TAILQ_ENTRY(client_ctx) group_entry;
|
TAILQ_ENTRY(client_ctx) group_entry;
|
||||||
TAILQ_ENTRY(client_ctx) mru_entry;
|
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
Window win;
|
Window win;
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
@ -199,7 +198,6 @@ struct client_ctx {
|
|||||||
XWMHints *wmh;
|
XWMHints *wmh;
|
||||||
};
|
};
|
||||||
TAILQ_HEAD(client_ctx_q, client_ctx);
|
TAILQ_HEAD(client_ctx_q, client_ctx);
|
||||||
TAILQ_HEAD(cycle_entry_q, client_ctx);
|
|
||||||
|
|
||||||
struct group_ctx {
|
struct group_ctx {
|
||||||
TAILQ_ENTRY(group_ctx) entry;
|
TAILQ_ENTRY(group_ctx) entry;
|
||||||
@ -235,7 +233,7 @@ struct screen_ctx {
|
|||||||
struct geom view; /* viewable area */
|
struct geom view; /* viewable area */
|
||||||
struct geom work; /* workable area, gap-applied */
|
struct geom work; /* workable area, gap-applied */
|
||||||
struct gap gap;
|
struct gap gap;
|
||||||
struct cycle_entry_q mruq;
|
struct client_ctx_q clientq;
|
||||||
struct region_ctx_q regionq;
|
struct region_ctx_q regionq;
|
||||||
XftColor xftcolor[CWM_COLOR_NITEMS];
|
XftColor xftcolor[CWM_COLOR_NITEMS];
|
||||||
XftDraw *xftdraw;
|
XftDraw *xftdraw;
|
||||||
@ -315,7 +313,6 @@ struct mwm_hints {
|
|||||||
extern Display *X_Dpy;
|
extern Display *X_Dpy;
|
||||||
extern Time Last_Event_Time;
|
extern Time Last_Event_Time;
|
||||||
extern struct screen_ctx_q Screenq;
|
extern struct screen_ctx_q Screenq;
|
||||||
extern struct client_ctx_q Clientq;
|
|
||||||
extern struct conf Conf;
|
extern struct conf Conf;
|
||||||
extern const char *homedir;
|
extern const char *homedir;
|
||||||
extern int HasRandr, Randr_ev;
|
extern int HasRandr, Randr_ev;
|
||||||
|
33
client.c
33
client.c
@ -45,11 +45,14 @@ struct client_ctx *curcc = NULL;
|
|||||||
struct client_ctx *
|
struct client_ctx *
|
||||||
client_find(Window win)
|
client_find(Window win)
|
||||||
{
|
{
|
||||||
|
struct screen_ctx *sc;
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &Clientq, entry) {
|
TAILQ_FOREACH(sc, &Screenq, entry) {
|
||||||
if (cc->win == win)
|
TAILQ_FOREACH(cc, &sc->clientq, entry) {
|
||||||
return(cc);
|
if (cc->win == win)
|
||||||
|
return(cc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
@ -126,8 +129,7 @@ client_init(Window win, struct screen_ctx *sc)
|
|||||||
|
|
||||||
(state == IconicState) ? client_hide(cc) : client_unhide(cc);
|
(state == IconicState) ? client_hide(cc) : client_unhide(cc);
|
||||||
|
|
||||||
TAILQ_INSERT_TAIL(&sc->mruq, cc, mru_entry);
|
TAILQ_INSERT_TAIL(&sc->clientq, cc, entry);
|
||||||
TAILQ_INSERT_TAIL(&Clientq, cc, entry);
|
|
||||||
|
|
||||||
xu_ewmh_net_client_list(sc);
|
xu_ewmh_net_client_list(sc);
|
||||||
xu_ewmh_restore_net_wm_state(cc);
|
xu_ewmh_restore_net_wm_state(cc);
|
||||||
@ -147,8 +149,7 @@ client_delete(struct client_ctx *cc)
|
|||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct winname *wn;
|
struct winname *wn;
|
||||||
|
|
||||||
TAILQ_REMOVE(&sc->mruq, cc, mru_entry);
|
TAILQ_REMOVE(&sc->clientq, cc, entry);
|
||||||
TAILQ_REMOVE(&Clientq, cc, entry);
|
|
||||||
|
|
||||||
xu_ewmh_net_client_list(sc);
|
xu_ewmh_net_client_list(sc);
|
||||||
|
|
||||||
@ -641,13 +642,13 @@ client_cycle(struct screen_ctx *sc, int flags)
|
|||||||
oldcc = client_current();
|
oldcc = client_current();
|
||||||
|
|
||||||
/* If no windows then you cant cycle */
|
/* If no windows then you cant cycle */
|
||||||
if (TAILQ_EMPTY(&sc->mruq))
|
if (TAILQ_EMPTY(&sc->clientq))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (oldcc == NULL)
|
if (oldcc == NULL)
|
||||||
oldcc = (flags & CWM_RCYCLE ?
|
oldcc = (flags & CWM_RCYCLE ?
|
||||||
TAILQ_LAST(&sc->mruq, cycle_entry_q) :
|
TAILQ_LAST(&sc->clientq, client_ctx_q) :
|
||||||
TAILQ_FIRST(&sc->mruq));
|
TAILQ_FIRST(&sc->clientq));
|
||||||
|
|
||||||
newcc = oldcc;
|
newcc = oldcc;
|
||||||
while (again) {
|
while (again) {
|
||||||
@ -696,8 +697,8 @@ client_mrunext(struct client_ctx *cc)
|
|||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct client_ctx *ccc;
|
struct client_ctx *ccc;
|
||||||
|
|
||||||
return((ccc = TAILQ_NEXT(cc, mru_entry)) != NULL ?
|
return((ccc = TAILQ_NEXT(cc, entry)) != NULL ?
|
||||||
ccc : TAILQ_FIRST(&sc->mruq));
|
ccc : TAILQ_FIRST(&sc->clientq));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct client_ctx *
|
static struct client_ctx *
|
||||||
@ -706,8 +707,8 @@ client_mruprev(struct client_ctx *cc)
|
|||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct client_ctx *ccc;
|
struct client_ctx *ccc;
|
||||||
|
|
||||||
return((ccc = TAILQ_PREV(cc, cycle_entry_q, mru_entry)) != NULL ?
|
return((ccc = TAILQ_PREV(cc, client_ctx_q, entry)) != NULL ?
|
||||||
ccc : TAILQ_LAST(&sc->mruq, cycle_entry_q));
|
ccc : TAILQ_LAST(&sc->clientq, client_ctx_q));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -765,8 +766,8 @@ client_mtf(struct client_ctx *cc)
|
|||||||
{
|
{
|
||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
|
|
||||||
TAILQ_REMOVE(&sc->mruq, cc, mru_entry);
|
TAILQ_REMOVE(&sc->clientq, cc, entry);
|
||||||
TAILQ_INSERT_HEAD(&sc->mruq, cc, mru_entry);
|
TAILQ_INSERT_HEAD(&sc->clientq, cc, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
2
kbfunc.c
2
kbfunc.c
@ -151,7 +151,7 @@ kbfunc_client_search(struct client_ctx *cc, union arg *arg)
|
|||||||
old_cc = client_current();
|
old_cc = client_current();
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
TAILQ_FOREACH(cc, &Clientq, entry)
|
TAILQ_FOREACH(cc, &sc->clientq, entry)
|
||||||
menuq_add(&menuq, cc, "%s", cc->name);
|
menuq_add(&menuq, cc, "%s", cc->name);
|
||||||
|
|
||||||
if ((mi = menu_filter(sc, &menuq, "window", NULL, 0,
|
if ((mi = menu_filter(sc, &menuq, "window", NULL, 0,
|
||||||
|
@ -219,7 +219,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg)
|
|||||||
old_cc = client_current();
|
old_cc = client_current();
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
TAILQ_FOREACH(cc, &Clientq, entry) {
|
TAILQ_FOREACH(cc, &sc->clientq, entry) {
|
||||||
if (cc->flags & CLIENT_HIDDEN) {
|
if (cc->flags & CLIENT_HIDDEN) {
|
||||||
wname = (cc->label) ? cc->label : cc->name;
|
wname = (cc->label) ? cc->label : cc->name;
|
||||||
if (wname == NULL)
|
if (wname == NULL)
|
||||||
|
2
screen.c
2
screen.c
@ -40,7 +40,7 @@ screen_init(int which)
|
|||||||
|
|
||||||
sc = xcalloc(1, sizeof(*sc));
|
sc = xcalloc(1, sizeof(*sc));
|
||||||
|
|
||||||
TAILQ_INIT(&sc->mruq);
|
TAILQ_INIT(&sc->clientq);
|
||||||
TAILQ_INIT(&sc->regionq);
|
TAILQ_INIT(&sc->regionq);
|
||||||
|
|
||||||
sc->which = which;
|
sc->which = which;
|
||||||
|
4
xutil.c
4
xutil.c
@ -214,13 +214,13 @@ xu_ewmh_net_client_list(struct screen_ctx *sc)
|
|||||||
Window *winlist;
|
Window *winlist;
|
||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &Clientq, entry)
|
TAILQ_FOREACH(cc, &sc->clientq, entry)
|
||||||
i++;
|
i++;
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
winlist = xcalloc(i, sizeof(*winlist));
|
winlist = xcalloc(i, sizeof(*winlist));
|
||||||
TAILQ_FOREACH(cc, &Clientq, entry)
|
TAILQ_FOREACH(cc, &sc->clientq, entry)
|
||||||
winlist[j++] = cc->win;
|
winlist[j++] = cc->win;
|
||||||
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST],
|
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CLIENT_LIST],
|
||||||
XA_WINDOW, 32, PropModeReplace, (unsigned char *)winlist, i);
|
XA_WINDOW, 32, PropModeReplace, (unsigned char *)winlist, i);
|
||||||
|
Loading…
Reference in New Issue
Block a user