Move stuff that doesn't belong in group_init; while here, explicitly

initialize hideall and cycling.
This commit is contained in:
okan 2014-09-23 13:45:48 +00:00
parent cbc7f76074
commit cb65869d7a
3 changed files with 15 additions and 15 deletions

View File

@ -229,19 +229,19 @@ struct screen_ctx {
Window rootwin; Window rootwin;
Window menuwin; Window menuwin;
int cycling; int cycling;
int hideall;
int snapdist; int snapdist;
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 client_ctx_q clientq; struct client_ctx_q clientq;
struct region_ctx_q regionq; struct region_ctx_q regionq;
#define CALMWM_NGROUPS 10
struct group_ctx_q groupq;
struct group_ctx *group_active;
XftColor xftcolor[CWM_COLOR_NITEMS]; XftColor xftcolor[CWM_COLOR_NITEMS];
XftDraw *xftdraw; XftDraw *xftdraw;
XftFont *xftfont; XftFont *xftfont;
#define CALMWM_NGROUPS 10
struct group_ctx_q groupq;
int group_hideall;
struct group_ctx *group_active;
}; };
TAILQ_HEAD(screen_ctx_q, screen_ctx); TAILQ_HEAD(screen_ctx_q, screen_ctx);

13
group.c
View File

@ -119,9 +119,6 @@ group_init(struct screen_ctx *sc)
struct group_ctx *gc; struct group_ctx *gc;
int i; int i;
TAILQ_INIT(&sc->groupq);
sc->group_hideall = 0;
for (i = 0; i < CALMWM_NGROUPS; i++) { for (i = 0; i < CALMWM_NGROUPS; i++) {
gc = xcalloc(1, sizeof(*gc)); gc = xcalloc(1, sizeof(*gc));
gc->sc = sc; gc->sc = sc;
@ -131,12 +128,6 @@ group_init(struct screen_ctx *sc)
TAILQ_INSERT_TAIL(&sc->groupq, gc, entry); TAILQ_INSERT_TAIL(&sc->groupq, gc, entry);
} }
xu_ewmh_net_desktop_names(sc);
xu_ewmh_net_wm_desktop_viewport(sc);
xu_ewmh_net_wm_number_of_desktops(sc);
xu_ewmh_net_showing_desktop(sc);
xu_ewmh_net_virtual_roots(sc);
group_setactive(sc, 1); group_setactive(sc, 1);
} }
@ -315,12 +306,12 @@ group_alltoggle(struct screen_ctx *sc)
struct group_ctx *gc; struct group_ctx *gc;
TAILQ_FOREACH(gc, &sc->groupq, entry) { TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (sc->group_hideall) if (sc->hideall)
group_show(gc); group_show(gc);
else else
group_hide(gc); group_hide(gc);
} }
sc->group_hideall = !sc->group_hideall; sc->hideall = !sc->hideall;
} }
void void

View File

@ -42,9 +42,12 @@ screen_init(int which)
TAILQ_INIT(&sc->clientq); TAILQ_INIT(&sc->clientq);
TAILQ_INIT(&sc->regionq); TAILQ_INIT(&sc->regionq);
TAILQ_INIT(&sc->groupq);
sc->which = which; sc->which = which;
sc->rootwin = RootWindow(X_Dpy, sc->which); sc->rootwin = RootWindow(X_Dpy, sc->which);
sc->cycling = 0;
sc->hideall = 0;
conf_screen(sc); conf_screen(sc);
xu_ewmh_net_supported(sc); xu_ewmh_net_supported(sc);
@ -53,6 +56,12 @@ screen_init(int which)
screen_update_geometry(sc); screen_update_geometry(sc);
group_init(sc); group_init(sc);
xu_ewmh_net_desktop_names(sc);
xu_ewmh_net_wm_desktop_viewport(sc);
xu_ewmh_net_wm_number_of_desktops(sc);
xu_ewmh_net_showing_desktop(sc);
xu_ewmh_net_virtual_roots(sc);
rootattr.cursor = Conf.cursor[CF_NORMAL]; rootattr.cursor = Conf.cursor[CF_NORMAL];
rootattr.event_mask = SubstructureRedirectMask|SubstructureNotifyMask| rootattr.event_mask = SubstructureRedirectMask|SubstructureNotifyMask|
PropertyChangeMask|EnterWindowMask|LeaveWindowMask| PropertyChangeMask|EnterWindowMask|LeaveWindowMask|