diff options
author | okan | 2020-02-27 14:56:39 +0000 |
---|---|---|
committer | Wynn Wolf Arbor | 2020-03-18 14:30:58 +0100 |
commit | d8f3547b8f545b439d9df7b41cfe872ce6c8f42d (patch) | |
tree | 1be865226e709457b823835f42a3ed338801f74a /conf.c | |
parent | a4006dcef17be430ad3cc2c2a63ea1de75a20d62 (diff) | |
download | cwm-d8f3547b8f545b439d9df7b41cfe872ce6c8f42d.tar.gz |
Unrelated style fixes, consistency changes and sorting, appropriate dosage/removal of wrappers, simplification of name queue, client cycle joins other kb/mb bound functions.
Diffstat (limited to '')
-rw-r--r-- | conf.c | 74 |
1 files changed, 15 insertions, 59 deletions
@@ -15,7 +15,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: conf.c,v 1.250 2020/02/03 16:38:02 okan Exp $ + * $OpenBSD: conf.c,v 1.251 2020/02/27 14:56:39 okan Exp $ */ #include <sys/types.h> @@ -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 *); @@ -517,7 +517,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 +525,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 +544,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 +575,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 +605,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 +636,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 +696,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); -} |