Browse Source

made plural arrays

config
Anselm R. Garbe 17 years ago
parent
commit
04dec4c943
5 changed files with 29 additions and 29 deletions
  1. +3
    -3
      config.arg.h
  2. +3
    -3
      config.default.h
  3. +11
    -11
      event.c
  4. +6
    -6
      layout.c
  5. +6
    -6
      tag.c

+ 3
- 3
config.arg.h View File

@ -15,7 +15,7 @@
#define TAGS \ #define TAGS \
const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL }; const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9", NULL };
#define RULES \ #define RULES \
static Rule rule[] = { \
static Rule rules[] = { \
/* class:instance:title regex tags regex isfloating */ \ /* class:instance:title regex tags regex isfloating */ \
{ "Firefox", "3", False }, \ { "Firefox", "3", False }, \
{ "Gimp", NULL, True }, \ { "Gimp", NULL, True }, \
@ -26,7 +26,7 @@ static Rule rule[] = { \
/* layout(s) */ /* layout(s) */
#include "tile.h" #include "tile.h"
#define LAYOUTS \ #define LAYOUTS \
static Layout layout[] = { \
static Layout layouts[] = { \
/* symbol function */ \ /* symbol function */ \
{ "[]=", tile }, /* first entry is default */ \ { "[]=", tile }, /* first entry is default */ \
{ "><>", floating }, \ { "><>", floating }, \
@ -37,7 +37,7 @@ static Layout layout[] = { \
/* key definitions */ /* key definitions */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define KEYS \ #define KEYS \
Key key[] = { \
Key keys[] = { \
/* modifier key function argument */ \ /* modifier key function argument */ \
{ MODKEY, XK_p, spawn, \ { MODKEY, XK_p, spawn, \
"exe=`dmenu_path | dmenu -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"'" \ "exe=`dmenu_path | dmenu -fn '"FONT"' -nb '"NORMBGCOLOR"' -nf '"NORMFGCOLOR"'" \


+ 3
- 3
config.default.h View File

@ -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: /* 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) }' */ * xprop | awk -F '"' '/^WM_CLASS/ { printf("%s:%s:",$4,$2) }; /^WM_NAME/ { printf("%s\n",$2) }' */
#define RULES \ #define RULES \
static Rule rule[] = { \
static Rule rules[] = { \
/* class:instance:title regex tags regex isfloating */ \ /* class:instance:title regex tags regex isfloating */ \
{ "Gimp", NULL, True }, \ { "Gimp", NULL, True }, \
{ "MPlayer", NULL, True }, \ { "MPlayer", NULL, True }, \
@ -27,7 +27,7 @@ static Rule rule[] = { \
/* layout(s) */ /* layout(s) */
#include "tile.h" #include "tile.h"
#define LAYOUTS \ #define LAYOUTS \
static Layout layout[] = { \
static Layout layouts[] = { \
/* symbol function */ \ /* symbol function */ \
{ "[]=", tile }, /* first entry is default */ \ { "[]=", tile }, /* first entry is default */ \
{ "><>", floating }, \ { "><>", floating }, \
@ -38,7 +38,7 @@ static Layout layout[] = { \
/* key definitions */ /* key definitions */
#define MODKEY Mod1Mask #define MODKEY Mod1Mask
#define KEYS \ #define KEYS \
Key key[] = { \
Key keys[] = { \
/* modifier key function argument */ \ /* modifier key function argument */ \
{ MODKEY|ShiftMask, XK_Return, spawn, "exec xterm" }, \ { MODKEY|ShiftMask, XK_Return, spawn, "exec xterm" }, \
{ MODKEY, XK_p, spawn, "exe=`dmenu_path | dmenu` && exec $exe" }, \ { MODKEY, XK_p, spawn, "exe=`dmenu_path | dmenu` && exec $exe" }, \


+ 11
- 11
event.c View File

@ -252,18 +252,18 @@ expose(XEvent *e) {
static void static void
keypress(XEvent *e) { keypress(XEvent *e) {
KEYS KEYS
unsigned int len = sizeof key / sizeof key[0];
unsigned int len = sizeof keys / sizeof keys[0];
unsigned int i; unsigned int i;
KeySym keysym; KeySym keysym;
XKeyEvent *ev = &e->xkey; XKeyEvent *ev = &e->xkey;
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
for(i = 0; i < len; i++) 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 void
grabkeys(void) { grabkeys(void) {
KEYS KEYS
unsigned int len = sizeof key / sizeof key[0];
unsigned int len = sizeof keys / sizeof keys[0];
unsigned int i; unsigned int i;
KeyCode code; KeyCode code;
XUngrabKey(dpy, AnyKey, AnyModifier, root); XUngrabKey(dpy, AnyKey, AnyModifier, root);
for(i = 0; i < len; i++) { 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); GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, key[i].mod | LockMask, root, True,
XGrabKey(dpy, code, keys[i].mod | LockMask, root, True,
GrabModeAsync, GrabModeAsync); GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, key[i].mod | numlockmask, root, True,
XGrabKey(dpy, code, keys[i].mod | numlockmask, root, True,
GrabModeAsync, GrabModeAsync); GrabModeAsync, GrabModeAsync);
XGrabKey(dpy, code, key[i].mod | numlockmask | LockMask, root, True,
XGrabKey(dpy, code, keys[i].mod | numlockmask | LockMask, root, True,
GrabModeAsync, GrabModeAsync); GrabModeAsync, GrabModeAsync);
} }
} }

+ 6
- 6
layout.c View File

@ -94,10 +94,10 @@ void
initlayouts(void) { initlayouts(void) {
unsigned int i, w; 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++) { for(blw = i = 0; i < nlayouts; i++) {
w = textw(layout[i].symbol);
w = textw(layouts[i].symbol);
if(w > blw) if(w > blw)
blw = w; blw = w;
} }
@ -144,14 +144,14 @@ setlayout(const char *arg) {
if(!arg) { if(!arg) {
lt++; lt++;
if(lt == layout + nlayouts)
lt = layout;
if(lt == layouts + nlayouts)
lt = layouts;
} }
else { else {
i = atoi(arg); i = atoi(arg);
if(i < 0 || i >= nlayouts) if(i < 0 || i >= nlayouts)
return; return;
lt = &layout[i];
lt = &layouts[i];
} }
if(sel) if(sel)
arrange(); arrange();


+ 6
- 6
tag.c View File

@ -59,19 +59,19 @@ compileregs(void) {
if(regs) if(regs)
return; return;
nrules = sizeof rule / sizeof rule[0];
nrules = sizeof rules / sizeof rules[0];
regs = emallocz(nrules * sizeof(Regs)); regs = emallocz(nrules * sizeof(Regs));
for(i = 0; i < nrules; i++) { for(i = 0; i < nrules; i++) {
if(rule[i].prop) {
if(rules[i].prop) {
reg = emallocz(sizeof(regex_t)); reg = emallocz(sizeof(regex_t));
if(regcomp(reg, rule[i].prop, REG_EXTENDED))
if(regcomp(reg, rules[i].prop, REG_EXTENDED))
free(reg); free(reg);
else else
regs[i].propregex = reg; regs[i].propregex = reg;
} }
if(rule[i].tags) {
if(rules[i].tags) {
reg = emallocz(sizeof(regex_t)); reg = emallocz(sizeof(regex_t));
if(regcomp(reg, rule[i].tags, REG_EXTENDED))
if(regcomp(reg, rules[i].tags, REG_EXTENDED))
free(reg); free(reg);
else else
regs[i].tagregex = reg; regs[i].tagregex = reg;
@ -124,7 +124,7 @@ settags(Client *c, Client *trans) {
ch.res_name ? ch.res_name : "", c->name); ch.res_name ? ch.res_name : "", c->name);
for(i = 0; i < nrules; i++) for(i = 0; i < nrules; i++)
if(regs[i].propregex && !regexec(regs[i].propregex, prop, 1, &tmp, 0)) { 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++) { for(j = 0; regs[i].tagregex && j < ntags; j++) {
if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) { if(!regexec(regs[i].tagregex, tags[j], 1, &tmp, 0)) {
matched = True; matched = True;


Loading…
Cancel
Save