Purely mechanical; unify 'num', 'no' and 'shortcut'.
This commit is contained in:
parent
045b994659
commit
b7cd8019f2
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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_
|
#ifndef _CALMWM_H_
|
||||||
@ -203,7 +203,7 @@ TAILQ_HEAD(cycle_entry_q, client_ctx);
|
|||||||
struct group_ctx {
|
struct group_ctx {
|
||||||
TAILQ_ENTRY(group_ctx) entry;
|
TAILQ_ENTRY(group_ctx) entry;
|
||||||
struct client_ctx_q clients;
|
struct client_ctx_q clients;
|
||||||
int shortcut;
|
int num;
|
||||||
int hidden;
|
int hidden;
|
||||||
};
|
};
|
||||||
TAILQ_HEAD(group_ctx_q, group_ctx);
|
TAILQ_HEAD(group_ctx_q, group_ctx);
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <sys/param.h>
|
||||||
@ -869,7 +869,7 @@ client_transient(struct client_ctx *cc)
|
|||||||
|
|
||||||
if (XGetTransientForHint(X_Dpy, cc->win, &trans)) {
|
if (XGetTransientForHint(X_Dpy, cc->win, &trans)) {
|
||||||
if ((tc = client_find(trans)) && tc->group) {
|
if ((tc = client_find(trans)) && tc->group) {
|
||||||
group_movetogroup(cc, tc->group->shortcut);
|
group_movetogroup(cc, tc->group->num);
|
||||||
if (tc->flags & CLIENT_IGNORE)
|
if (tc->flags & CLIENT_IGNORE)
|
||||||
cc->flags |= CLIENT_IGNORE;
|
cc->flags |= CLIENT_IGNORE;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <sys/param.h>
|
||||||
@ -78,7 +78,7 @@ conf_cmd_remove(struct conf *c, const char *name)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
conf_autogroup(struct conf *c, int no, const char *val)
|
conf_autogroup(struct conf *c, int num, const char *val)
|
||||||
{
|
{
|
||||||
struct autogroupwin *aw;
|
struct autogroupwin *aw;
|
||||||
char *p;
|
char *p;
|
||||||
@ -93,7 +93,7 @@ conf_autogroup(struct conf *c, int no, const char *val)
|
|||||||
aw->name = xstrdup(val);
|
aw->name = xstrdup(val);
|
||||||
aw->class = xstrdup(p);
|
aw->class = xstrdup(p);
|
||||||
}
|
}
|
||||||
aw->num = no;
|
aw->num = num;
|
||||||
|
|
||||||
TAILQ_INSERT_TAIL(&c->autogroupq, aw, entry);
|
TAILQ_INSERT_TAIL(&c->autogroupq, aw, entry);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#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_setactive(struct screen_ctx *, long);
|
||||||
static void group_set_names(struct screen_ctx *);
|
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",
|
"nogroup", "one", "two", "three", "four", "five", "six",
|
||||||
"seven", "eight", "nine"
|
"seven", "eight", "nine"
|
||||||
};
|
};
|
||||||
@ -86,7 +86,7 @@ group_show(struct screen_ctx *sc, struct group_ctx *gc)
|
|||||||
gc->hidden = 0;
|
gc->hidden = 0;
|
||||||
|
|
||||||
group_restack(sc, gc);
|
group_restack(sc, gc);
|
||||||
group_setactive(sc, gc->shortcut);
|
group_setactive(sc, gc->num);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -140,7 +140,7 @@ group_init(struct screen_ctx *sc)
|
|||||||
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||||
TAILQ_INIT(&sc->groups[i].clients);
|
TAILQ_INIT(&sc->groups[i].clients);
|
||||||
sc->groups[i].hidden = 0;
|
sc->groups[i].hidden = 0;
|
||||||
sc->groups[i].shortcut = i;
|
sc->groups[i].num = i;
|
||||||
TAILQ_INSERT_TAIL(&sc->groupq, &sc->groups[i], entry);
|
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);
|
errx(1, "group_only: index out of range (%d)", idx);
|
||||||
|
|
||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
if (gc->shortcut == idx)
|
if (gc->num == idx)
|
||||||
group_show(sc, gc);
|
group_show(sc, gc);
|
||||||
else
|
else
|
||||||
group_hide(sc, gc);
|
group_hide(sc, gc);
|
||||||
@ -302,7 +302,7 @@ group_cycle(struct screen_ctx *sc, int flags)
|
|||||||
if (showgroup->hidden)
|
if (showgroup->hidden)
|
||||||
group_show(sc, showgroup);
|
group_show(sc, showgroup);
|
||||||
else
|
else
|
||||||
group_setactive(sc, showgroup->shortcut);
|
group_setactive(sc, showgroup->num);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -319,7 +319,7 @@ group_menu(struct screen_ctx *sc)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
menuq_add(&menuq, gc, gc->hidden ? "%d: [%s]" : "%d: %s",
|
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))
|
if (TAILQ_EMPTY(&menuq))
|
||||||
@ -354,36 +354,36 @@ group_autogroup(struct client_ctx *cc)
|
|||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct autogroupwin *aw;
|
struct autogroupwin *aw;
|
||||||
struct group_ctx *gc;
|
struct group_ctx *gc;
|
||||||
int no = -1, both_match = 0;
|
int num = -1, both_match = 0;
|
||||||
long *grpno;
|
long *grpnum;
|
||||||
|
|
||||||
if (cc->ch.res_class == NULL || cc->ch.res_name == NULL)
|
if (cc->ch.res_class == NULL || cc->ch.res_name == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (xu_getprop(cc->win, ewmh[_NET_WM_DESKTOP],
|
if (xu_getprop(cc->win, ewmh[_NET_WM_DESKTOP],
|
||||||
XA_CARDINAL, 1, (unsigned char **)&grpno) > 0) {
|
XA_CARDINAL, 1, (unsigned char **)&grpnum) > 0) {
|
||||||
if (*grpno == -1)
|
if (*grpnum == -1)
|
||||||
no = 0;
|
num = 0;
|
||||||
else if (*grpno > CALMWM_NGROUPS || *grpno < 0)
|
else if (*grpnum > CALMWM_NGROUPS || *grpnum < 0)
|
||||||
no = CALMWM_NGROUPS - 1;
|
num = CALMWM_NGROUPS - 1;
|
||||||
else
|
else
|
||||||
no = *grpno;
|
num = *grpnum;
|
||||||
XFree(grpno);
|
XFree(grpnum);
|
||||||
} else {
|
} else {
|
||||||
TAILQ_FOREACH(aw, &Conf.autogroupq, entry) {
|
TAILQ_FOREACH(aw, &Conf.autogroupq, entry) {
|
||||||
if (strcmp(aw->class, cc->ch.res_class) == 0) {
|
if (strcmp(aw->class, cc->ch.res_class) == 0) {
|
||||||
if ((aw->name != NULL) &&
|
if ((aw->name != NULL) &&
|
||||||
(strcmp(aw->name, cc->ch.res_name) == 0)) {
|
(strcmp(aw->name, cc->ch.res_name) == 0)) {
|
||||||
no = aw->num;
|
num = aw->num;
|
||||||
both_match = 1;
|
both_match = 1;
|
||||||
} else if (aw->name == NULL && !both_match)
|
} else if (aw->name == NULL && !both_match)
|
||||||
no = aw->num;
|
num = aw->num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
TAILQ_FOREACH(gc, &sc->groupq, entry) {
|
||||||
if (gc->shortcut == no) {
|
if (gc->num == num) {
|
||||||
group_assign(gc, cc);
|
group_assign(gc, cc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -427,7 +427,7 @@ group_update_names(struct screen_ctx *sc)
|
|||||||
setnames = 1;
|
setnames = 1;
|
||||||
i = 0;
|
i = 0;
|
||||||
while (n < CALMWM_NGROUPS)
|
while (n < CALMWM_NGROUPS)
|
||||||
strings[n++] = xstrdup(shortcut_to_name[i++]);
|
strings[n++] = xstrdup(num_to_name[i++]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prop_ret != NULL)
|
if (prop_ret != NULL)
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <sys/param.h>
|
||||||
@ -202,8 +202,7 @@ mousefunc_menu_unhide(struct client_ctx *cc, union arg *arg)
|
|||||||
if (wname == NULL)
|
if (wname == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
menuq_add(&menuq, cc, "(%d) %s",
|
menuq_add(&menuq, cc, "(%d) %s", cc->group->num, wname);
|
||||||
cc->group->shortcut, wname);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TAILQ_EMPTY(&menuq))
|
if (TAILQ_EMPTY(&menuq))
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <sys/param.h>
|
||||||
@ -142,7 +142,7 @@ screen_update_geometry(struct screen_ctx *sc)
|
|||||||
{
|
{
|
||||||
XineramaScreenInfo *info = NULL;
|
XineramaScreenInfo *info = NULL;
|
||||||
struct region_ctx *region;
|
struct region_ctx *region;
|
||||||
int info_no = 0, i;
|
int info_num = 0, i;
|
||||||
|
|
||||||
sc->view.x = 0;
|
sc->view.x = 0;
|
||||||
sc->view.y = 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. */
|
/* RandR event may have a CTRC added or removed. */
|
||||||
if (XineramaIsActive(X_Dpy))
|
if (XineramaIsActive(X_Dpy))
|
||||||
info = XineramaQueryScreens(X_Dpy, &info_no);
|
info = XineramaQueryScreens(X_Dpy, &info_num);
|
||||||
|
|
||||||
while ((region = TAILQ_FIRST(&sc->regionq)) != NULL) {
|
while ((region = TAILQ_FIRST(&sc->regionq)) != NULL) {
|
||||||
TAILQ_REMOVE(&sc->regionq, region, entry);
|
TAILQ_REMOVE(&sc->regionq, region, entry);
|
||||||
free(region);
|
free(region);
|
||||||
}
|
}
|
||||||
for (i = 0; i < info_no; i++) {
|
for (i = 0; i < info_num; i++) {
|
||||||
region = xmalloc(sizeof(*region));
|
region = xmalloc(sizeof(*region));
|
||||||
region->num = i;
|
region->num = i;
|
||||||
region->area.x = info[i].x_org;
|
region->area.x = info[i].x_org;
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <sys/param.h>
|
||||||
@ -143,7 +143,7 @@ search_print_client(struct menu *mi, int list)
|
|||||||
cc->matchname = cc->name;
|
cc->matchname = cc->name;
|
||||||
|
|
||||||
(void)snprintf(mi->print, sizeof(mi->print), "(%d) %c%s",
|
(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 &&
|
if (!list && cc->matchname != cc->name &&
|
||||||
strlen(mi->print) < sizeof(mi->print) - 1) {
|
strlen(mi->print) < sizeof(mi->print) - 1) {
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* 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>
|
#include <sys/param.h>
|
||||||
@ -291,10 +291,10 @@ xu_ewmh_net_desktop_names(struct screen_ctx *sc, char *data, int n)
|
|||||||
void
|
void
|
||||||
xu_ewmh_net_wm_desktop(struct client_ctx *cc)
|
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],
|
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 *
|
Atom *
|
||||||
|
Loading…
Reference in New Issue
Block a user