changeset: 958:8b502be8b8e0
tag: tip
user: Anselm R. Garbe <garbeam_AT_gmail.com>
date: Thu Aug 16 18:41:22 2007 +0200
summary: made plural arrays
diff -r e61ca30d9474 -r 8b502be8b8e0 config.arg.h
--- a/config.arg.h Thu Aug 16 18:30:25 2007 +0200
+++ b/config.arg.h Thu Aug 16 18:41:22 2007 +0200
@@ -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"'" \
diff -r e61ca30d9474 -r 8b502be8b8e0 config.default.h
--- a/config.default.h Thu Aug 16 18:30:25 2007 +0200
+++ b/config.default.h Thu Aug 16 18:41:22 2007 +0200
@@ -17,7 +17,7 @@ const char *tags[] = { "1", "2", "3", "4
/* 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" }, \
diff -r e61ca30d9474 -r 8b502be8b8e0 event.c
--- a/event.c Thu Aug 16 18:30:25 2007 +0200
+++ b/event.c Thu Aug 16 18:41:22 2007 +0200
@@ -252,18 +252,18 @@ static void
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
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,
- GrabModeAsync, GrabModeAsync);
- XGrabKey(dpy, code, key[i].mod | LockMask, root, True,
- GrabModeAsync, GrabModeAsync);
- XGrabKey(dpy, code, key[i].mod | numlockmask, root, True,
- GrabModeAsync, GrabModeAsync);
- XGrabKey(dpy, code, key[i].mod | numlockmask | LockMask, root, True,
- GrabModeAsync, GrabModeAsync);
- }
-}
+ code = XKeysymToKeycode(dpy, keys[i].keysym);
+ XGrabKey(dpy, code, keys[i].mod, root, True,
+ GrabModeAsync, GrabModeAsync);
+ XGrabKey(dpy, code, keys[i].mod | LockMask, root, True,
+ GrabModeAsync, GrabModeAsync);
+ XGrabKey(dpy, code, keys[i].mod | numlockmask, root, True,
+ GrabModeAsync, GrabModeAsync);
+ XGrabKey(dpy, code, keys[i].mod | numlockmask | LockMask, root, True,
+ GrabModeAsync, GrabModeAsync);
+ }
+}
diff -r e61ca30d9474 -r 8b502be8b8e0 layout.c
--- a/layout.c Thu Aug 16 18:30:25 2007 +0200
+++ b/layout.c Thu Aug 16 18:41:22 2007 +0200
@@ -94,10 +94,10 @@ initlayouts(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();
diff -r e61ca30d9474 -r 8b502be8b8e0 tag.c
--- a/tag.c Thu Aug 16 18:30:25 2007 +0200
+++ b/tag.c Thu Aug 16 18:41:22 2007 +0200
@@ -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;
Received on Thu Aug 16 2007 - 18:42:08 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:55 UTC