mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
Get rid of curcc, instead cycle through the queue; removes the need for
client_none().
This commit is contained in:
parent
6a53e3a859
commit
9cf3174696
2
Makefile
2
Makefile
@ -10,7 +10,7 @@ SRCS= calmwm.c screen.c xmalloc.c client.c menu.c \
|
|||||||
|
|
||||||
CPPFLAGS+= -I${X11BASE}/include -I${X11BASE}/include/freetype2 -I${.CURDIR}
|
CPPFLAGS+= -I${X11BASE}/include -I${X11BASE}/include/freetype2 -I${.CURDIR}
|
||||||
|
|
||||||
CFLAGS+= -Wall
|
CFLAGS+= -Wall -g
|
||||||
|
|
||||||
LDADD+= -L${X11BASE}/lib -lXft -lXrender -lX11 -lxcb -lXau -lXdmcp \
|
LDADD+= -L${X11BASE}/lib -lXft -lXrender -lX11 -lxcb -lXau -lXdmcp \
|
||||||
-lfontconfig -lexpat -lfreetype -lz -lXrandr -lXext
|
-lfontconfig -lexpat -lfreetype -lz -lXrandr -lXext
|
||||||
|
32
client.c
32
client.c
@ -34,14 +34,11 @@
|
|||||||
static struct client_ctx *client_next(struct client_ctx *);
|
static struct client_ctx *client_next(struct client_ctx *);
|
||||||
static struct client_ctx *client_prev(struct client_ctx *);
|
static struct client_ctx *client_prev(struct client_ctx *);
|
||||||
static void client_mtf(struct client_ctx *);
|
static void client_mtf(struct client_ctx *);
|
||||||
static void client_none(struct screen_ctx *);
|
|
||||||
static void client_placecalc(struct client_ctx *);
|
static void client_placecalc(struct client_ctx *);
|
||||||
static void client_wm_protocols(struct client_ctx *);
|
static void client_wm_protocols(struct client_ctx *);
|
||||||
static void client_mwm_hints(struct client_ctx *);
|
static void client_mwm_hints(struct client_ctx *);
|
||||||
static int client_inbound(struct client_ctx *, int, int);
|
static int client_inbound(struct client_ctx *, int, int);
|
||||||
|
|
||||||
struct client_ctx *curcc = NULL;
|
|
||||||
|
|
||||||
struct client_ctx *
|
struct client_ctx *
|
||||||
client_init(Window win, struct screen_ctx *sc, int active)
|
client_init(Window win, struct screen_ctx *sc, int active)
|
||||||
{
|
{
|
||||||
@ -178,7 +175,7 @@ client_delete(struct client_ctx *cc)
|
|||||||
xu_ewmh_net_client_list_stacking(sc);
|
xu_ewmh_net_client_list_stacking(sc);
|
||||||
|
|
||||||
if (cc->flags & CLIENT_ACTIVE)
|
if (cc->flags & CLIENT_ACTIVE)
|
||||||
client_none(sc);
|
xu_ewmh_net_active_window(sc, None);
|
||||||
|
|
||||||
if (cc->gc != NULL)
|
if (cc->gc != NULL)
|
||||||
TAILQ_REMOVE(&cc->gc->clientq, cc, group_entry);
|
TAILQ_REMOVE(&cc->gc->clientq, cc, group_entry);
|
||||||
@ -227,7 +224,6 @@ client_setactive(struct client_ctx *cc)
|
|||||||
if (!sc->cycling)
|
if (!sc->cycling)
|
||||||
client_mtf(cc);
|
client_mtf(cc);
|
||||||
|
|
||||||
curcc = cc;
|
|
||||||
cc->flags |= CLIENT_ACTIVE;
|
cc->flags |= CLIENT_ACTIVE;
|
||||||
cc->flags &= ~CLIENT_URGENCY;
|
cc->flags &= ~CLIENT_URGENCY;
|
||||||
client_draw_border(cc);
|
client_draw_border(cc);
|
||||||
@ -235,23 +231,19 @@ client_setactive(struct client_ctx *cc)
|
|||||||
xu_ewmh_net_active_window(sc, cc->win);
|
xu_ewmh_net_active_window(sc, cc->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* set when there is no active client
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
client_none(struct screen_ctx *sc)
|
|
||||||
{
|
|
||||||
Window none = None;
|
|
||||||
|
|
||||||
xu_ewmh_net_active_window(sc, none);
|
|
||||||
|
|
||||||
curcc = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct client_ctx *
|
struct client_ctx *
|
||||||
client_current(void)
|
client_current(void)
|
||||||
{
|
{
|
||||||
return(curcc);
|
struct screen_ctx *sc;
|
||||||
|
struct client_ctx *cc;
|
||||||
|
|
||||||
|
TAILQ_FOREACH(sc, &Screenq, entry) {
|
||||||
|
TAILQ_FOREACH(cc, &sc->clientq, entry) {
|
||||||
|
if (cc->flags & CLIENT_ACTIVE)
|
||||||
|
return(cc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -512,7 +504,7 @@ client_hide(struct client_ctx *cc)
|
|||||||
XUnmapWindow(X_Dpy, cc->win);
|
XUnmapWindow(X_Dpy, cc->win);
|
||||||
|
|
||||||
if (cc->flags & CLIENT_ACTIVE)
|
if (cc->flags & CLIENT_ACTIVE)
|
||||||
client_none(cc->sc);
|
xu_ewmh_net_active_window(cc->sc, None);
|
||||||
|
|
||||||
cc->flags &= ~CLIENT_ACTIVE;
|
cc->flags &= ~CLIENT_ACTIVE;
|
||||||
cc->flags |= CLIENT_HIDDEN;
|
cc->flags |= CLIENT_HIDDEN;
|
||||||
|
Loading…
Reference in New Issue
Block a user