cvsimport

This commit is contained in:
okan 2014-09-27 19:04:32 +00:00
commit c700f7e19a
8 changed files with 37 additions and 42 deletions

View File

@ -248,19 +248,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);
@ -433,8 +433,8 @@ void group_init(struct screen_ctx *);
void group_movetogroup(struct client_ctx *, int); void group_movetogroup(struct client_ctx *, int);
void group_only(struct screen_ctx *, int); void group_only(struct screen_ctx *, int);
void group_show(struct group_ctx *); void group_show(struct group_ctx *);
void group_sticky_toggle_enter(struct client_ctx *); void group_toggle_membership_enter(struct client_ctx *);
void group_sticky_toggle_exit(struct client_ctx *); void group_toggle_membership_leave(struct client_ctx *);
void group_update_names(struct screen_ctx *); void group_update_names(struct screen_ctx *);
void search_match_client(struct menu_q *, struct menu_q *, void search_match_client(struct menu_q *, struct menu_q *,
@ -563,7 +563,7 @@ void xu_ewmh_net_wm_desktop_viewport(struct screen_ctx *);
void xu_ewmh_net_wm_number_of_desktops(struct screen_ctx *); void xu_ewmh_net_wm_number_of_desktops(struct screen_ctx *);
void xu_ewmh_net_showing_desktop(struct screen_ctx *); void xu_ewmh_net_showing_desktop(struct screen_ctx *);
void xu_ewmh_net_virtual_roots(struct screen_ctx *); void xu_ewmh_net_virtual_roots(struct screen_ctx *);
void xu_ewmh_net_current_desktop(struct screen_ctx *, long); void xu_ewmh_net_current_desktop(struct screen_ctx *);
void xu_ewmh_net_desktop_names(struct screen_ctx *); void xu_ewmh_net_desktop_names(struct screen_ctx *);
void xu_ewmh_net_wm_desktop(struct client_ctx *); void xu_ewmh_net_wm_desktop(struct client_ctx *);

View File

@ -696,7 +696,7 @@ client_cycle_leave(struct screen_ctx *sc)
if ((cc = client_current())) { if ((cc = client_current())) {
client_mtf(cc); client_mtf(cc);
group_sticky_toggle_exit(cc); group_toggle_membership_leave(cc);
XUngrabKeyboard(X_Dpy, CurrentTime); XUngrabKeyboard(X_Dpy, CurrentTime);
} }
} }

42
group.c
View File

@ -34,7 +34,7 @@
static void group_assign(struct group_ctx *, struct client_ctx *); static void group_assign(struct group_ctx *, struct client_ctx *);
static void group_restack(struct group_ctx *); static void group_restack(struct group_ctx *);
static void group_setactive(struct screen_ctx *, long); static void group_setactive(struct group_ctx *);
const char *num_to_name[] = { const char *num_to_name[] = {
"nogroup", "one", "two", "three", "four", "five", "six", "nogroup", "one", "two", "three", "four", "five", "six",
@ -75,7 +75,7 @@ group_show(struct group_ctx *gc)
client_unhide(cc); client_unhide(cc);
group_restack(gc); group_restack(gc);
group_setactive(gc->sc, gc->num); group_setactive(gc);
} }
static void static void
@ -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;
@ -129,29 +126,19 @@ group_init(struct screen_ctx *sc)
gc->name = xstrdup(num_to_name[i]); gc->name = xstrdup(num_to_name[i]);
gc->num = i; gc->num = i;
TAILQ_INSERT_TAIL(&sc->groupq, gc, entry); TAILQ_INSERT_TAIL(&sc->groupq, gc, entry);
if (i == 1)
group_setactive(gc);
} }
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);
} }
static void static void
group_setactive(struct screen_ctx *sc, long idx) group_setactive(struct group_ctx *gc)
{ {
struct group_ctx *gc; struct screen_ctx *sc = gc->sc;
TAILQ_FOREACH(gc, &sc->groupq, entry) {
if (gc->num == idx)
break;
}
sc->group_active = gc; sc->group_active = gc;
xu_ewmh_net_current_desktop(sc, idx); xu_ewmh_net_current_desktop(sc);
} }
void void
@ -175,11 +162,8 @@ group_movetogroup(struct client_ctx *cc, int idx)
group_assign(gc, cc); group_assign(gc, cc);
} }
/*
* Colouring for groups upon add/remove.
*/
void void
group_sticky_toggle_enter(struct client_ctx *cc) group_toggle_membership_enter(struct client_ctx *cc)
{ {
struct screen_ctx *sc = cc->sc; struct screen_ctx *sc = cc->sc;
struct group_ctx *gc = sc->group_active; struct group_ctx *gc = sc->group_active;
@ -196,7 +180,7 @@ group_sticky_toggle_enter(struct client_ctx *cc)
} }
void void
group_sticky_toggle_exit(struct client_ctx *cc) group_toggle_membership_leave(struct client_ctx *cc)
{ {
cc->flags &= ~CLIENT_HIGHLIGHT; cc->flags &= ~CLIENT_HIGHLIGHT;
client_draw_border(cc); client_draw_border(cc);
@ -252,7 +236,7 @@ group_hidetoggle(struct screen_ctx *sc, int idx)
group_hide(gc); group_hide(gc);
/* make clients stick to empty group */ /* make clients stick to empty group */
if (TAILQ_EMPTY(&gc->clientq)) if (TAILQ_EMPTY(&gc->clientq))
group_setactive(sc, idx); group_setactive(gc);
} }
} }
@ -306,7 +290,7 @@ group_cycle(struct screen_ctx *sc, int flags)
if (group_holds_only_hidden(showgroup)) if (group_holds_only_hidden(showgroup))
group_show(showgroup); group_show(showgroup);
else else
group_setactive(sc, showgroup->num); group_setactive(showgroup);
} }
void void
@ -315,12 +299,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

@ -438,7 +438,7 @@ kbfunc_client_grouptoggle(struct client_ctx *cc, union arg *arg)
XGrabKeyboard(X_Dpy, cc->win, True, XGrabKeyboard(X_Dpy, cc->win, True,
GrabModeAsync, GrabModeAsync, CurrentTime); GrabModeAsync, GrabModeAsync, CurrentTime);
group_sticky_toggle_enter(cc); group_toggle_membership_enter(cc);
} }
void void

View File

@ -174,7 +174,7 @@ mousefunc_client_move(struct client_ctx *cc, union arg *arg)
void void
mousefunc_client_grouptoggle(struct client_ctx *cc, union arg *arg) mousefunc_client_grouptoggle(struct client_ctx *cc, union arg *arg)
{ {
group_sticky_toggle_enter(cc); group_toggle_membership_enter(cc);
} }
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|

View File

@ -251,7 +251,7 @@ xev_handle_buttonrelease(XEvent *ee)
struct client_ctx *cc; struct client_ctx *cc;
if ((cc = client_current())) if ((cc = client_current()))
group_sticky_toggle_exit(cc); group_toggle_membership_leave(cc);
} }
static void static void

View File

@ -274,10 +274,12 @@ xu_ewmh_net_virtual_roots(struct screen_ctx *sc)
} }
void void
xu_ewmh_net_current_desktop(struct screen_ctx *sc, long idx) xu_ewmh_net_current_desktop(struct screen_ctx *sc)
{ {
long num = sc->group_active->num;
XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CURRENT_DESKTOP], XChangeProperty(X_Dpy, sc->rootwin, ewmh[_NET_CURRENT_DESKTOP],
XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&idx, 1); XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&num, 1);
} }
void void