made plural arrays
This commit is contained in:
parent
e40448fd63
commit
04dec4c943
|
@ -15,7 +15,7 @@
|
|||
#define TAGS \
|
||||
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
|
||||
#define RULES \
|
||||
static Rule rule[] = { \
|
||||
static Rule rules[] = { \
|
||||
/* class:instance:title regex tags regex isfloating */ \
|
||||
{ "Firefox", "3", False }, \
|
||||
{ "Gimp", NULL, True }, \
|
||||
|
@ -26,7 +26,7 @@ static Rule rule[] = { \
|
|||
/* layout(s) */
|
||||
#include "tile.h"
|
||||
#define LAYOUTS \
|
||||
static Layout layout[] = { \
|
||||
static Layout layouts[] = { \
|
||||
/* symbol function */ \
|
||||
{ "[]=", tile }, /* first entry is default */ \
|
||||
{ "><>", floating }, \
|
||||
|
@ -37,7 +37,7 @@ static Layout layout[] = { \
|
|||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
#define KEYS \
|
||||
Key key[] = { \
|
||||
Key keys[] = { \
|
||||
/* modifier key function argument */ \
|
||||
{ MODKEY, XK_p, spawn, \
|
||||
"exe=`dmenu_path | dmenu -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"'" \
|
||||
|
|
|
@ -17,7 +17,7 @@ const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
|
|||
/* Query class:instance:title for regex matching info with following command:
|
||||
* xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */
|
||||
#define RULES \
|
||||
static Rule rule[] = { \
|
||||
static Rule rules[] = { \
|
||||
/* class:instance:title regex tags regex isfloating */ \
|
||||
{ "Gimp", NULL, True }, \
|
||||
{ "MPlayer", NULL, True }, \
|
||||
|
@ -27,7 +27,7 @@ static Rule rule[] = { \
|
|||
/* layout(s) */
|
||||
#include "tile.h"
|
||||
#define LAYOUTS \
|
||||
static Layout layout[] = { \
|
||||
static Layout layouts[] = { \
|
||||
/* symbol function */ \
|
||||
{ "[]=", tile }, /* first entry is default */ \
|
||||
{ "><>", floating }, \
|
||||
|
@ -38,7 +38,7 @@ static Layout layout[] = { \
|
|||
/* key definitions */
|
||||
#define MODKEY Mod1Mask
|
||||
#define KEYS \
|
||||
Key key[] = { \
|
||||
Key keys[] = { \
|
||||
/* modifier key function argument */ \
|
||||
{ MODKEY|ShiftMask, XK_Return, spawn, "exec xterm" }, \
|
||||
{ MODKEY, XK_p, spawn, "exe=`dmenu_path | dmenu` && exec $exe" }, \
|
||||
|
|
22
event.c
22
event.c
|
@ -252,18 +252,18 @@ expose(XEvent *e) {
|
|||
static void
|
||||
keypress(XEvent *e) {
|
||||
KEYS
|
||||
unsigned int len = sizeof key / sizeof key[0];
|
||||
unsigned int len = sizeof keys / sizeof keys[0];
|
||||
unsigned int i;
|
||||
KeySym keysym;
|
||||
XKeyEvent *ev = &e->xkey;
|
||||
|
||||
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
|
||||
for(i = 0; i < len; i++)
|
||||
if(keysym == key[i].keysym
|
||||
&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
|
||||
if(keysym == keys[i].keysym
|
||||
&& CLEANMASK(keys[i].mod) == CLEANMASK(ev->state))
|
||||
{
|
||||
if(key[i].func)
|
||||
key[i].func(key[i].arg);
|
||||
if(keys[i].func)
|
||||
keys[i].func(keys[i].arg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,20 +358,20 @@ void (*handler[LASTEvent]) (XEvent *) = {
|
|||
void
|
||||
grabkeys(void) {
|
||||
KEYS
|
||||
unsigned int len = sizeof key / sizeof key[0];
|
||||
unsigned int len = sizeof keys / sizeof keys[0];
|
||||
unsigned int i;
|
||||
KeyCode code;
|
||||
|
||||
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||
for(i = 0; i < len; i++) {
|
||||
code = XKeysymToKeycode(dpy, key[i].keysym);
|
||||
XGrabKey(dpy, code, key[i].mod, root, True,
|
||||
code = XKeysymToKeycode(dpy, keys[i].keysym);
|
||||
XGrabKey(dpy, code, keys[i].mod, root, True,
|
||||
GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(dpy, code, key[i].mod | LockMask, root, True,
|
||||
XGrabKey(dpy, code, keys[i].mod | LockMask, root, True,
|
||||
GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(dpy, code, key[i].mod | numlockmask, root, True,
|
||||
XGrabKey(dpy, code, keys[i].mod | numlockmask, root, True,
|
||||
GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(dpy, code, key[i].mod | numlockmask | LockMask, root, True,
|
||||
XGrabKey(dpy, code, keys[i].mod | numlockmask | LockMask, root, True,
|
||||
GrabModeAsync, GrabModeAsync);
|
||||
}
|
||||
}
|
||||
|
|
12
layout.c
12
layout.c
|
@ -94,10 +94,10 @@ void
|
|||
initlayouts(void) {
|
||||
unsigned int i, w;
|
||||
|
||||
lt = &layout[0];
|
||||
nlayouts = sizeof layout / sizeof layout[0];
|
||||
lt = &layouts[0];
|
||||
nlayouts = sizeof layouts / sizeof layouts[0];
|
||||
for(blw = i = 0; i < nlayouts; i++) {
|
||||
w = textw(layout[i].symbol);
|
||||
w = textw(layouts[i].symbol);
|
||||
if(w > blw)
|
||||
blw = w;
|
||||
}
|
||||
|
@ -144,14 +144,14 @@ setlayout(const char *arg) {
|
|||
|
||||
if(!arg) {
|
||||
lt++;
|
||||
if(lt == layout + nlayouts)
|
||||
lt = layout;
|
||||
if(lt == layouts + nlayouts)
|
||||
lt = layouts;
|
||||
}
|
||||
else {
|
||||
i = atoi(arg);
|
||||
if(i < 0 || i >= nlayouts)
|
||||
return;
|
||||
lt = &layout[i];
|
||||
lt = &layouts[i];
|
||||
}
|
||||
if(sel)
|
||||
arrange();
|
||||
|
|
12
tag.c
12
tag.c
|
@ -59,19 +59,19 @@ compileregs(void) {
|
|||
|
||||
if(regs)
|
||||
return;
|
||||
nrules = sizeof rule / sizeof rule[0];
|
||||
nrules = sizeof rules / sizeof rules[0];
|
||||
regs = emallocz(nrules * sizeof(Regs));
|
||||
for(i = 0; i < nrules; i++) {
|
||||
if(rule[i].prop) {
|
||||
if(rules[i].prop) {
|
||||
reg = emallocz(sizeof(regex_t));
|
||||
if(regcomp(reg, rule[i].prop, REG_EXTENDED))
|
||||
if(regcomp(reg, rules[i].prop, REG_EXTENDED))
|
||||
free(reg);
|
||||
else
|
||||
regs[i].propregex = reg;
|
||||
}
|
||||
if(rule[i].tags) {
|
||||
if(rules[i].tags) {
|
||||
reg = emallocz(sizeof(regex_t));
|
||||
if(regcomp(reg, rule[i].tags, REG_EXTENDED))
|
||||
if(regcomp(reg, rules[i].tags, REG_EXTENDED))
|
||||
free(reg);
|
||||
else
|
||||
regs[i].tagregex = reg;
|
||||
|
@ -124,7 +124,7 @@ settags(Client *c, Client *trans) {
|
|||
ch.res_name ? ch.res_name : "", c->name);
|
||||
for(i = 0; i < nrules; i++)
|
||||
if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) {
|
||||
c->isfloating = rule[i].isfloating;
|
||||
c->isfloating = rules[i].isfloating;
|
||||
for(j = 0; regs[i].tagregex && j < ntags; j++) {
|
||||
if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
|
||||
matched = True;
|
||||
|
|
Loading…
Reference in New Issue