diff options
author | okan | 2014-08-20 15:15:29 +0000 |
---|---|---|
committer | okan | 2014-08-20 15:15:29 +0000 |
commit | baef75bfc55b19ae2f4f1a5f09c82d35539d5637 (patch) | |
tree | 1781b9efc7f70975adf5efab5cc71169288c2032 | |
parent | 081e6ab493c1cb965f3f03d6b55f2a24117e9290 (diff) | |
download | cwm-baef75bfc55b19ae2f4f1a5f09c82d35539d5637.tar.gz |
Purely mechanical; unify 'num', 'no' and 'shortcut'.
-rw-r--r-- | calmwm.h | 4 | ||||
-rw-r--r-- | client.c | 4 | ||||
-rw-r--r-- | conf.c | 6 | ||||
-rw-r--r-- | group.c | 40 | ||||
-rw-r--r-- | mousefunc.c | 5 | ||||
-rw-r--r-- | screen.c | 8 | ||||
-rw-r--r-- | search.c | 4 | ||||
-rw-r--r-- | xutil.c | 6 |
8 files changed, 38 insertions, 39 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: calmwm.h,v 1.261 2014/08/19 12:47:51 okan Exp $ + * $OpenBSD: calmwm.h,v 1.262 2014/08/20 15:15:29 okan Exp $ */ #ifndef _CALMWM_H_ @@ -203,7 +203,7 @@ TAILQ_HEAD(cycle_entry_q, client_ctx); struct group_ctx { TAILQ_ENTRY(group_ctx) entry; struct client_ctx_q clients; - int shortcut; + int num; int hidden; }; TAILQ_HEAD(group_ctx_q, group_ctx); @@ -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: client.c,v 1.172 2014/02/06 20:58:46 okan Exp $ + * $OpenBSD: client.c,v 1.173 2014/08/20 15:15:29 okan Exp $ */ #include <sys/param.h> @@ -869,7 +869,7 @@ client_transient(struct client_ctx *cc) if (XGetTransientForHint(X_Dpy, cc->win, &trans)) { if ((tc = client_find(trans)) && tc->group) { - group_movetogroup(cc, tc->group->shortcut); + group_movetogroup(cc, tc->group->num); if (tc->flags & CLIENT_IGNORE) cc->flags |= CLIENT_IGNORE; } @@ -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.174 2014/08/19 18:39:41 okan Exp $ + * $OpenBSD: conf.c,v 1.175 2014/08/20 15:15:29 okan Exp $ */ #include <sys/param.h> @@ -78,7 +78,7 @@ conf_cmd_remove(struct conf *c, const char *name) } } void -conf_autogroup(struct conf *c, int no, const char *val) +conf_autogroup(struct conf *c, int num, const char *val) { struct autogroupwin *aw; char *p; @@ -93,7 +93,7 @@ conf_autogroup(struct conf *c, int no, const char *val) aw->name = xstrdup(val); aw->class = xstrdup(p); } - aw->num = no; + aw->num = num; TAILQ_INSERT_TAIL(&c->autogroupq, aw, entry); } @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: group.c,v 1.91 2014/08/20 13:42:27 okan Exp $ + * $OpenBSD: group.c,v 1.92 2014/08/20 15:15:29 okan Exp $ */ #include <sys/param.h> @@ -40,7 +40,7 @@ static void group_set_hidden_state(struct group_ctx *); static void group_setactive(struct screen_ctx *, long); static void group_set_names(struct screen_ctx *); -const char *shortcut_to_name[] = { +const char *num_to_name[] = { "nogroup", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" }; @@ -86,7 +86,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc) gc->hidden = 0; group_restack(sc, gc); - group_setactive(sc, gc->shortcut); + group_setactive(sc, gc->num); } static void @@ -140,7 +140,7 @@ group_init(struct screen_ctx *sc) for (i = 0; i < CALMWM_NGROUPS; i++) { TAILQ_INIT(&sc->groups[i].clients); sc->groups[i].hidden = 0; - sc->groups[i].shortcut = i; + sc->groups[i].num = i; TAILQ_INSERT_TAIL(&sc->groupq, &sc->groups[i], entry); } @@ -261,7 +261,7 @@ group_only(struct screen_ctx *sc, int idx) errx(1, "group_only: index out of range (%d)", idx); TAILQ_FOREACH(gc, &sc->groupq, entry) { - if (gc->shortcut == idx) + if (gc->num == idx) group_show(sc, gc); else group_hide(sc, gc); @@ -302,7 +302,7 @@ group_cycle(struct screen_ctx *sc, int flags) if (showgroup->hidden) group_show(sc, showgroup); else - group_setactive(sc, showgroup->shortcut); + group_setactive(sc, showgroup->num); } void @@ -319,7 +319,7 @@ group_menu(struct screen_ctx *sc) continue; menuq_add(&menuq, gc, gc->hidden ? "%d: [%s]" : "%d: %s", - gc->shortcut, sc->group_names[gc->shortcut]); + gc->num, sc->group_names[gc->num]); } if (TAILQ_EMPTY(&menuq)) @@ -354,36 +354,36 @@ group_autogroup(struct client_ctx *cc) struct screen_ctx *sc = cc->sc; struct autogroupwin *aw; struct group_ctx *gc; - int no = -1, both_match = 0; - long *grpno; + int num = -1, both_match = 0; + long *grpnum; if (cc->ch.res_class == NULL || cc->ch.res_name == NULL) return; if (xu_getprop(cc->win, ewmh[_NET_WM_DESKTOP], - XA_CARDINAL, 1, (unsigned char **)&grpno) > 0) { - if (*grpno == -1) - no = 0; - else if (*grpno > CALMWM_NGROUPS || *grpno < 0) - no = CALMWM_NGROUPS - 1; + XA_CARDINAL, 1, (unsigned char **)&grpnum) > 0) { + if (*grpnum == -1) + num = 0; + else if (*grpnum > CALMWM_NGROUPS || *grpnum < 0) + num = CALMWM_NGROUPS - 1; else - no = *grpno; - XFree(grpno); + num = *grpnum; + XFree(grpnum); } else { TAILQ_FOREACH(aw, &Conf.autogroupq, entry) { if (strcmp(aw->class, cc->ch.res_class) == 0) { if ((aw->name != NULL) && (strcmp(aw->name, cc->ch.res_name) == 0)) { - no = aw->num; + num = aw->num; both_match = 1; } else if (aw->name == NULL && !both_match) - no = aw->num; + num = aw->num; } } } TAILQ_FOREACH(gc, &sc->groupq, entry) { - if (gc->shortcut == no) { + if (gc->num == num) { group_assign(gc, cc); return; } @@ -427,7 +427,7 @@ group_update_names(struct screen_ctx *sc) setnames = 1; i = 0; while (n < CALMWM_NGROUPS) - strings[n++] = xstrdup(shortcut_to_name[i++]); + strings[n++] = xstrdup(num_to_name[i++]); } if (prop_ret != NULL) diff --git a/mousefunc.c b/mousefunc.c index 5bf3468..c954991 100644 --- a/mousefunc.c +++ b/mousefunc.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $OpenBSD: mousefunc.c,v 1.71 2014/02/07 21:59:56 okan Exp $ + * $OpenBSD: mousefunc.c,v 1.72 2014/08/20 15:15:29 okan Exp $ */ #include <sys/param.h> @@ -202,8 +202,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg) if (wname == NULL) continue; - menuq_add(&menuq, cc, "(%d) %s", - cc->group->shortcut, wname); + menuq_add(&menuq, cc, "(%d) %s", cc->group->num, wname); } if (TAILQ_EMPTY(&menuq)) @@ -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: screen.c,v 1.62 2014/08/20 12:35:39 okan Exp $ + * $OpenBSD: screen.c,v 1.63 2014/08/20 15:15:29 okan Exp $ */ #include <sys/param.h> @@ -142,7 +142,7 @@ screen_update_geometry(struct screen_ctx *sc) { XineramaScreenInfo *info = NULL; struct region_ctx *region; - int info_no = 0, i; + int info_num = 0, i; sc->view.x = 0; sc->view.y = 0; @@ -156,13 +156,13 @@ screen_update_geometry(struct screen_ctx *sc) /* RandR event may have a CTRC added or removed. */ if (XineramaIsActive(X_Dpy)) - info = XineramaQueryScreens(X_Dpy, &info_no); + info = XineramaQueryScreens(X_Dpy, &info_num); while ((region = TAILQ_FIRST(&sc->regionq)) != NULL) { TAILQ_REMOVE(&sc->regionq, region, entry); free(region); } - for (i = 0; i < info_no; i++) { + for (i = 0; i < info_num; i++) { region = xmalloc(sizeof(*region)); region->num = i; region->area.x = info[i].x_org; @@ -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: search.c,v 1.37 2014/02/07 21:59:56 okan Exp $ + * $OpenBSD: search.c,v 1.38 2014/08/20 15:15:29 okan Exp $ */ #include <sys/param.h> @@ -143,7 +143,7 @@ search_print_client(struct menu *mi, int list) cc->matchname = cc->name; (void)snprintf(mi->print, sizeof(mi->print), "(%d) %c%s", - cc->group->shortcut, flag, cc->matchname); + cc->group->num, flag, cc->matchname); if (!list && cc->matchname != cc->name && strlen(mi->print) < sizeof(mi->print) - 1) { @@ -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: xutil.c,v 1.85 2014/02/27 00:52:57 okan Exp $ + * $OpenBSD: xutil.c,v 1.86 2014/08/20 15:15:29 okan Exp $ */ #include <sys/param.h> @@ -291,10 +291,10 @@ xu_ewmh_net_desktop_names(struct screen_ctx *sc, char *data, int n) void xu_ewmh_net_wm_desktop(struct client_ctx *cc) { - long no = cc->group->shortcut; + long num = cc->group->num; XChangeProperty(X_Dpy, cc->win, ewmh[_NET_WM_DESKTOP], - XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&no, 1); + XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&num, 1); } Atom * |