cvsimport
* refs/heads/master: (23 commits) Check the atom type on propertynotify before iterating. use screen_find() for xrandr crtc changes Find the managed screen from the parent window for client_current(). Print window id in hex; while here, remove unnecessary newline. Similar to keypress event, fetch the screen from the event root window in the buttonpress handler; bail if we don't manage the screen. Allows us to find the current client based on the screen/event root. extend verbose logging for key/button events [keypress event] turns out we've been checking the wrong window for a matching client thus always falling back to client_current(); while the current client is problaby right in most cases, use event's subwindow (not window) to find the client. Bail early if this event came to us from a screen we don't manage. This is result of us grabing all keybindings off the root window instead of selectively. add parans for readibility Teach client_current() to use a screen to find the current client instead of iterating over all (fallback if no screen provided for now). Initially convert trivial uses of client_current(). check cc->gc directly zip extra lines gc clientq inside groups, instead use the better maintained one per-screen shuffle deck chairs: rename group actions to match intent for clarity same thing as screen_find() Separate out the menu window from the client resize/move geom window; in each case, create and destroy on-demand. Isolate more menu specific code. fix a few misplaced (and misnamed) ewmh root window functions _NET_WORKAREA needs ngroups, so screen_update_geometry() needs to come after conf_group(). simplify xftcolor config Tie group number and name together during config. Move the group index (desktop number) check to the only 2 callers that require checking due to ewmh. ...
This commit is contained in:
47
conf.c
47
conf.c
@@ -36,6 +36,21 @@ static const char *conf_bind_getmask(const char *, unsigned int *);
|
||||
static void conf_unbind_key(struct conf *, struct bind_ctx *);
|
||||
static void conf_unbind_mouse(struct conf *, struct bind_ctx *);
|
||||
|
||||
static const struct {
|
||||
int num;
|
||||
const char *name;
|
||||
} group_binds[] = {
|
||||
{ 0, "nogroup" },
|
||||
{ 1, "one" },
|
||||
{ 2, "two" },
|
||||
{ 3, "three" },
|
||||
{ 4, "four" },
|
||||
{ 5, "five" },
|
||||
{ 6, "six" },
|
||||
{ 7, "seven" },
|
||||
{ 8, "eight" },
|
||||
{ 9, "nine" },
|
||||
};
|
||||
static int cursor_binds[] = {
|
||||
XC_left_ptr, /* CF_NORMAL */
|
||||
XC_fleur, /* CF_MOVE */
|
||||
@@ -124,7 +139,7 @@ static const struct {
|
||||
|
||||
{ FUNC_SC(group-cycle, group_cycle, (CWM_CYCLE_FORWARD)) },
|
||||
{ FUNC_SC(group-rcycle, group_cycle, (CWM_CYCLE_REVERSE)) },
|
||||
{ FUNC_SC(group-toggle-all, group_alltoggle, 0) },
|
||||
{ FUNC_SC(group-toggle-all, group_toggle_all, 0) },
|
||||
{ FUNC_SC(group-toggle-1, group_toggle, 1) },
|
||||
{ FUNC_SC(group-toggle-2, group_toggle, 2) },
|
||||
{ FUNC_SC(group-toggle-3, group_toggle, 3) },
|
||||
@@ -266,7 +281,7 @@ conf_init(struct conf *c)
|
||||
c->bwidth = 1;
|
||||
c->mamount = 1;
|
||||
c->snapdist = 0;
|
||||
c->ngroups = 10;
|
||||
c->ngroups = 0;
|
||||
c->nameqlen = 5;
|
||||
|
||||
TAILQ_INIT(&c->ignoreq);
|
||||
@@ -478,30 +493,28 @@ conf_screen(struct screen_ctx *sc)
|
||||
warnx("XftColorAllocValue: %s", Conf.color[i]);
|
||||
break;
|
||||
}
|
||||
if (XftColorAllocName(X_Dpy, sc->visual, sc->colormap,
|
||||
Conf.color[i], &xc)) {
|
||||
sc->xftcolor[i] = xc;
|
||||
XftColorFree(X_Dpy, sc->visual, sc->colormap, &xc);
|
||||
} else {
|
||||
if (!XftColorAllocName(X_Dpy, sc->visual, sc->colormap,
|
||||
Conf.color[i], &sc->xftcolor[i])) {
|
||||
warnx("XftColorAllocName: %s", Conf.color[i]);
|
||||
XftColorAllocName(X_Dpy, sc->visual, sc->colormap,
|
||||
color_binds[i], &sc->xftcolor[i]);
|
||||
}
|
||||
}
|
||||
|
||||
sc->menu.win = XCreateSimpleWindow(X_Dpy, sc->rootwin, 0, 0, 1, 1,
|
||||
Conf.bwidth,
|
||||
sc->xftcolor[CWM_COLOR_MENU_FG].pixel,
|
||||
sc->xftcolor[CWM_COLOR_MENU_BG].pixel);
|
||||
|
||||
sc->menu.xftdraw = XftDrawCreate(X_Dpy, sc->menu.win,
|
||||
sc->visual, sc->colormap);
|
||||
if (sc->menu.xftdraw == NULL)
|
||||
errx(1, "%s: XftDrawCreate", __func__);
|
||||
|
||||
conf_grab_kbd(sc->rootwin);
|
||||
}
|
||||
|
||||
void
|
||||
conf_group(struct screen_ctx *sc)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < nitems(group_binds); i++) {
|
||||
group_init(sc, group_binds[i].num, group_binds[i].name);
|
||||
Conf.ngroups++;
|
||||
}
|
||||
}
|
||||
|
||||
static const char *
|
||||
conf_bind_getmask(const char *name, unsigned int *mask)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user