cvsimport
* refs/heads/master: Fixed memory leak in xu_get_strprop. Prevent out of boundary write with configuration files in which too many quoted arguments are stored for other window managers. Allow configuring a percentage window size of the master window during htile/vtile actions. From Uwe Werler, with a few manpage tweaks. zap stray tabs Instead of using _NET_ACTIVE_WINDOW on restart, use the pointer location to determine what client to set active. Reduces a round trip for every window. Add support for SIGINT/SIGTERM. Simplify conditional construct. Trim event_mask to those that the root window actually needs. No need to lookup current client early; move to right before it is needed. Recommit 1.259, but now with TAILQ_FOREACH_SAFE. Revert previous. Causes a crash as reported by Tom Murphy. Simplify list markup. Plug two memory leaks. Also get rid of a variable that is no longer necessary. Remove ColormaskChange from event-mask since there's no event handler. Unrelated style fixes, consistency changes and sorting, appropriate dosage/removal of wrappers, simplification of name queue, client cycle joins other kb/mb bound functions.
This commit is contained in:
74
conf.c
74
conf.c
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "calmwm.h"
|
||||
|
||||
static const char *conf_bind_getmask(const char *, unsigned int *);
|
||||
static const char *conf_bind_mask(const char *, unsigned int *);
|
||||
static void conf_unbind_key(struct conf *, struct bind_ctx *);
|
||||
static void conf_unbind_mouse(struct conf *, struct bind_ctx *);
|
||||
|
||||
@@ -281,6 +281,8 @@ conf_init(struct conf *c)
|
||||
c->stickygroups = 0;
|
||||
c->bwidth = 1;
|
||||
c->mamount = 1;
|
||||
c->htile = 50;
|
||||
c->vtile = 50;
|
||||
c->snapdist = 0;
|
||||
c->ngroups = 0;
|
||||
c->nameqlen = 5;
|
||||
@@ -517,7 +519,7 @@ conf_group(struct screen_ctx *sc)
|
||||
}
|
||||
|
||||
static const char *
|
||||
conf_bind_getmask(const char *name, unsigned int *mask)
|
||||
conf_bind_mask(const char *name, unsigned int *mask)
|
||||
{
|
||||
char *dash;
|
||||
const char *ch;
|
||||
@@ -525,13 +527,13 @@ conf_bind_getmask(const char *name, unsigned int *mask)
|
||||
|
||||
*mask = 0;
|
||||
if ((dash = strchr(name, '-')) == NULL)
|
||||
return(name);
|
||||
return name;
|
||||
for (i = 0; i < nitems(bind_mods); i++) {
|
||||
if ((ch = strchr(name, bind_mods[i].ch)) != NULL && ch < dash)
|
||||
*mask |= bind_mods[i].mask;
|
||||
}
|
||||
/* Skip past modifiers. */
|
||||
return(dash + 1);
|
||||
return (dash + 1);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -544,20 +546,20 @@ conf_bind_key(struct conf *c, const char *bind, const char *cmd)
|
||||
|
||||
if ((strcmp(bind, "all") == 0) && (cmd == NULL)) {
|
||||
conf_unbind_key(c, NULL);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
kb = xmalloc(sizeof(*kb));
|
||||
key = conf_bind_getmask(bind, &kb->modmask);
|
||||
key = conf_bind_mask(bind, &kb->modmask);
|
||||
kb->press.keysym = XStringToKeysym(key);
|
||||
if (kb->press.keysym == NoSymbol) {
|
||||
warnx("unknown symbol: %s", key);
|
||||
free(kb);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
conf_unbind_key(c, kb);
|
||||
if (cmd == NULL) {
|
||||
free(kb);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
cargs = xcalloc(1, sizeof(*cargs));
|
||||
for (i = 0; i < nitems(name_to_func); i++) {
|
||||
@@ -575,7 +577,7 @@ conf_bind_key(struct conf *c, const char *bind, const char *cmd)
|
||||
out:
|
||||
kb->cargs = cargs;
|
||||
TAILQ_INSERT_TAIL(&c->keybindq, kb, entry);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -605,20 +607,20 @@ conf_bind_mouse(struct conf *c, const char *bind, const char *cmd)
|
||||
|
||||
if ((strcmp(bind, "all") == 0) && (cmd == NULL)) {
|
||||
conf_unbind_mouse(c, NULL);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
mb = xmalloc(sizeof(*mb));
|
||||
button = conf_bind_getmask(bind, &mb->modmask);
|
||||
button = conf_bind_mask(bind, &mb->modmask);
|
||||
mb->press.button = strtonum(button, Button1, Button5, &errstr);
|
||||
if (errstr) {
|
||||
warnx("button number is %s: %s", errstr, button);
|
||||
free(mb);
|
||||
return(0);
|
||||
return 0;
|
||||
}
|
||||
conf_unbind_mouse(c, mb);
|
||||
if (cmd == NULL) {
|
||||
free(mb);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
cargs = xcalloc(1, sizeof(*cargs));
|
||||
for (i = 0; i < nitems(name_to_func); i++) {
|
||||
@@ -636,7 +638,7 @@ conf_bind_mouse(struct conf *c, const char *bind, const char *cmd)
|
||||
out:
|
||||
mb->cargs = cargs;
|
||||
TAILQ_INSERT_TAIL(&c->mousebindq, mb, entry);
|
||||
return(1);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -696,47 +698,3 @@ conf_grab_mouse(Window win)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static char *cwmhints[] = {
|
||||
"WM_STATE",
|
||||
"WM_DELETE_WINDOW",
|
||||
"WM_TAKE_FOCUS",
|
||||
"WM_PROTOCOLS",
|
||||
"_MOTIF_WM_HINTS",
|
||||
"UTF8_STRING",
|
||||
"WM_CHANGE_STATE",
|
||||
};
|
||||
static char *ewmhints[] = {
|
||||
"_NET_SUPPORTED",
|
||||
"_NET_SUPPORTING_WM_CHECK",
|
||||
"_NET_ACTIVE_WINDOW",
|
||||
"_NET_CLIENT_LIST",
|
||||
"_NET_CLIENT_LIST_STACKING",
|
||||
"_NET_NUMBER_OF_DESKTOPS",
|
||||
"_NET_CURRENT_DESKTOP",
|
||||
"_NET_DESKTOP_VIEWPORT",
|
||||
"_NET_DESKTOP_GEOMETRY",
|
||||
"_NET_VIRTUAL_ROOTS",
|
||||
"_NET_SHOWING_DESKTOP",
|
||||
"_NET_DESKTOP_NAMES",
|
||||
"_NET_WORKAREA",
|
||||
"_NET_WM_NAME",
|
||||
"_NET_WM_DESKTOP",
|
||||
"_NET_CLOSE_WINDOW",
|
||||
"_NET_WM_STATE",
|
||||
"_NET_WM_STATE_STICKY",
|
||||
"_NET_WM_STATE_MAXIMIZED_VERT",
|
||||
"_NET_WM_STATE_MAXIMIZED_HORZ",
|
||||
"_NET_WM_STATE_HIDDEN",
|
||||
"_NET_WM_STATE_FULLSCREEN",
|
||||
"_NET_WM_STATE_DEMANDS_ATTENTION",
|
||||
"_NET_WM_STATE_SKIP_PAGER",
|
||||
"_NET_WM_STATE_SKIP_TASKBAR",
|
||||
"_CWM_WM_STATE_FREEZE",
|
||||
};
|
||||
void
|
||||
conf_atoms(void)
|
||||
{
|
||||
XInternAtoms(X_Dpy, cwmhints, nitems(cwmhints), False, cwmh);
|
||||
XInternAtoms(X_Dpy, ewmhints, nitems(ewmhints), False, ewmh);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user