From baef75bfc55b19ae2f4f1a5f09c82d35539d5637 Mon Sep 17 00:00:00 2001 From: okan Date: Wed, 20 Aug 2014 15:15:29 +0000 Subject: Purely mechanical; unify 'num', 'no' and 'shortcut'. --- calmwm.h | 4 ++-- client.c | 4 ++-- conf.c | 6 +++--- group.c | 40 ++++++++++++++++++++-------------------- mousefunc.c | 5 ++--- screen.c | 8 ++++---- search.c | 4 ++-- xutil.c | 6 +++--- 8 files changed, 38 insertions(+), 39 deletions(-) diff --git a/calmwm.h b/calmwm.h index 88e9c78..a3e63b3 100644 --- a/calmwm.h +++ b/calmwm.h @@ -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); diff --git a/client.c b/client.c index 2ac5719..d613375 100644 --- a/client.c +++ b/client.c @@ -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 @@ -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; } diff --git a/conf.c b/conf.c index fcf5844..0b254f2 100644 --- a/conf.c +++ b/conf.c @@ -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 @@ -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); } diff --git a/group.c b/group.c index 7c70acc..efab527 100644 --- a/group.c +++ b/group.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: 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 @@ -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 @@ -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)) diff --git a/screen.c b/screen.c index 6018a5d..53c33f6 100644 --- a/screen.c +++ b/screen.c @@ -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 @@ -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; diff --git a/search.c b/search.c index 380f760..0b3b95d 100644 --- a/search.c +++ b/search.c @@ -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 @@ -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) { diff --git a/xutil.c b/xutil.c index 2a535e5..64fccb0 100644 --- a/xutil.c +++ b/xutil.c @@ -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 @@ -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 * -- cgit v1.2.3-2-gb3c3