dwm-meillo

changeset 589:732c58a3d92d

returning to old Key struct
author arg@mig29
date Mon, 27 Nov 2006 17:49:58 +0100
parents 1477b61ec8d4
children d6ff27532fdd
files config.arg.h config.default.h event.c
diffstat 3 files changed, 65 insertions(+), 68 deletions(-) [+]
line diff
     1.1 --- a/config.arg.h	Mon Nov 27 17:46:02 2006 +0100
     1.2 +++ b/config.arg.h	Mon Nov 27 17:49:58 2006 +0100
     1.3 @@ -19,44 +19,43 @@
     1.4  
     1.5  #define MASTER			600		/* per thousand */
     1.6  #define MODKEY			Mod1Mask
     1.7 -#define NFUNCS			1		/* number of funcs per key */
     1.8  #define SNAP			40		/* pixel */
     1.9  
    1.10  #define KEYS \
    1.11  static Key key[] = { \
    1.12 -	/* modifier			key		functions		arguments */ \
    1.13 -	{ MODKEY|ShiftMask,		XK_Return,	{ spawn }, \
    1.14 +	/* modifier			key		function		argument */ \
    1.15 +	{ MODKEY|ShiftMask,		XK_Return,	spawn, \
    1.16  		{ .cmd = "exec urxvtc -tr -bg black -fg '#eeeeee' -cr '#eeeeee' +sb -fn '"FONT"'" } }, \
    1.17 -	{ MODKEY,			XK_p,		{ spawn }, \
    1.18 +	{ MODKEY,			XK_p,		spawn, \
    1.19  		{ .cmd = "exe=\"$(lsx `echo $PATH | sed 's/:/ /g'` | sort -u " \
    1.20  			" | dmenu -font '"FONT"' -normbg '"NORMBGCOLOR"' -normfg '"NORMFGCOLOR"' " \
    1.21  			"-selbg '"SELBGCOLOR"' -selfg '"SELFGCOLOR"')\" && exec $exe" } }, \
    1.22 -	{ MODKEY,			XK_j,		{ focusnext },		{ 0 } }, \
    1.23 -	{ MODKEY,			XK_k,		{ focusprev },		{ 0 } }, \
    1.24 -	{ MODKEY,			XK_Return,	{ zoom },		{ 0 } }, \
    1.25 -	{ MODKEY,			XK_g,		{ resizemaster },	{ .i = 15 } }, \
    1.26 -	{ MODKEY,			XK_s,		{ resizemaster },	{ .i = -15 } }, \
    1.27 -	{ MODKEY|ShiftMask,		XK_1,		{ tag },		{ .i = 0 } }, \
    1.28 -	{ MODKEY|ShiftMask,		XK_2,		{ tag },		{ .i = 1 } }, \
    1.29 -	{ MODKEY|ShiftMask,		XK_3,		{ tag },		{ .i = 2 } }, \
    1.30 -	{ MODKEY|ShiftMask,		XK_4,		{ tag },		{ .i = 3 } }, \
    1.31 -	{ MODKEY|ControlMask|ShiftMask,	XK_1,		{ toggletag },		{ .i = 0 } }, \
    1.32 -	{ MODKEY|ControlMask|ShiftMask,	XK_2,		{ toggletag },		{ .i = 1 } }, \
    1.33 -	{ MODKEY|ControlMask|ShiftMask,	XK_3,		{ toggletag },		{ .i = 2 } }, \
    1.34 -	{ MODKEY|ControlMask|ShiftMask,	XK_4,		{ toggletag },		{ .i = 3 } }, \
    1.35 -	{ MODKEY|ShiftMask,		XK_c,		{ killclient },		{ 0 } }, \
    1.36 -	{ MODKEY,			XK_space,	{ togglemode },		{ 0 } }, \
    1.37 -	{ MODKEY|ShiftMask,		XK_space,	{ togglefloat },	{ 0 } }, \
    1.38 -	{ MODKEY,			XK_0,		{ viewall },		{ 0 } }, \
    1.39 -	{ MODKEY,			XK_1,		{ view },		{ .i = 0 } }, \
    1.40 -	{ MODKEY,			XK_2,		{ view },		{ .i = 1 } }, \
    1.41 -	{ MODKEY,			XK_3,		{ view },		{ .i = 2 } }, \
    1.42 -	{ MODKEY,			XK_4,		{ view },		{ .i = 3 } }, \
    1.43 -	{ MODKEY|ControlMask,		XK_1,		{ toggleview },		{ .i = 0 } }, \
    1.44 -	{ MODKEY|ControlMask,		XK_2,		{ toggleview },		{ .i = 1 } }, \
    1.45 -	{ MODKEY|ControlMask,		XK_3,		{ toggleview },		{ .i = 2 } }, \
    1.46 -	{ MODKEY|ControlMask,		XK_4,		{ toggleview },		{ .i = 3 } }, \
    1.47 -	{ MODKEY|ShiftMask,		XK_q,		{ quit },		{ 0 } }, \
    1.48 +	{ MODKEY,			XK_j,		focusnext,	{ 0 } }, \
    1.49 +	{ MODKEY,			XK_k,		focusprev,	{ 0 } }, \
    1.50 +	{ MODKEY,			XK_Return,	zoom,		{ 0 } }, \
    1.51 +	{ MODKEY,			XK_g,		resizemaster,	{ .i = 15 } }, \
    1.52 +	{ MODKEY,			XK_s,		resizemaster,	{ .i = -15 } }, \
    1.53 +	{ MODKEY|ShiftMask,		XK_1,		tag,		{ .i = 0 } }, \
    1.54 +	{ MODKEY|ShiftMask,		XK_2,		tag,		{ .i = 1 } }, \
    1.55 +	{ MODKEY|ShiftMask,		XK_3,		tag,		{ .i = 2 } }, \
    1.56 +	{ MODKEY|ShiftMask,		XK_4,		tag,		{ .i = 3 } }, \
    1.57 +	{ MODKEY|ControlMask|ShiftMask,	XK_1,		toggletag,	{ .i = 0 } }, \
    1.58 +	{ MODKEY|ControlMask|ShiftMask,	XK_2,		toggletag,	{ .i = 1 } }, \
    1.59 +	{ MODKEY|ControlMask|ShiftMask,	XK_3,		toggletag,	{ .i = 2 } }, \
    1.60 +	{ MODKEY|ControlMask|ShiftMask,	XK_4,		toggletag,	{ .i = 3 } }, \
    1.61 +	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
    1.62 +	{ MODKEY,			XK_space,	togglemode,	{ 0 } }, \
    1.63 +	{ MODKEY|ShiftMask,		XK_space,	togglefloat,	{ 0 } }, \
    1.64 +	{ MODKEY,			XK_0,		viewall,	{ 0 } }, \
    1.65 +	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
    1.66 +	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
    1.67 +	{ MODKEY,			XK_3,		view,		{ .i = 2 } }, \
    1.68 +	{ MODKEY,			XK_4,		view,		{ .i = 3 } }, \
    1.69 +	{ MODKEY|ControlMask,		XK_1,		toggleview,	{ .i = 0 } }, \
    1.70 +	{ MODKEY|ControlMask,		XK_2,		toggleview,	{ .i = 1 } }, \
    1.71 +	{ MODKEY|ControlMask,		XK_3,		toggleview,	{ .i = 2 } }, \
    1.72 +	{ MODKEY|ControlMask,		XK_4,		toggleview,	{ .i = 3 } }, \
    1.73 +	{ MODKEY|ShiftMask,		XK_q,		quit,		{ 0 } }, \
    1.74  };
    1.75  
    1.76  #define RULES \
     2.1 --- a/config.default.h	Mon Nov 27 17:46:02 2006 +0100
     2.2 +++ b/config.default.h	Mon Nov 27 17:49:58 2006 +0100
     2.3 @@ -19,43 +19,42 @@
     2.4  
     2.5  #define MASTER			600		/* per thousand */
     2.6  #define MODKEY			Mod1Mask
     2.7 -#define NFUNCS			1		/* number of funcs per key */
     2.8  #define SNAP			20		/* pixel */
     2.9  
    2.10  #define KEYS \
    2.11  static Key key[] = { \
    2.12 -	/* modifier			key		functions		arguments */ \
    2.13 -	{ MODKEY|ShiftMask,		XK_Return,	{ spawn },		{ .cmd = "exec xterm" } }, \
    2.14 -	{ MODKEY,			XK_Tab,		{ focusnext },		{ 0 } }, \
    2.15 -	{ MODKEY|ShiftMask,		XK_Tab,		{ focusprev },		{ 0 } }, \
    2.16 -	{ MODKEY,			XK_Return,	{ zoom },		{ 0 } }, \
    2.17 -	{ MODKEY,			XK_g,		{ resizemaster },	{ .i = 15 } }, \
    2.18 -	{ MODKEY,			XK_s,		{ resizemaster },	{ .i = -15 } }, \
    2.19 -	{ MODKEY|ShiftMask,		XK_1,		{ tag },		{ .i = 0 } }, \
    2.20 -	{ MODKEY|ShiftMask,		XK_2,		{ tag },		{ .i = 1 } }, \
    2.21 -	{ MODKEY|ShiftMask,		XK_3,		{ tag },		{ .i = 2 } }, \
    2.22 -	{ MODKEY|ShiftMask,		XK_4,		{ tag },		{ .i = 3 } }, \
    2.23 -	{ MODKEY|ShiftMask,		XK_5,		{ tag },		{ .i = 4 } }, \
    2.24 -	{ MODKEY|ControlMask|ShiftMask,	XK_1,		{ toggletag },		{ .i = 0 } }, \
    2.25 -	{ MODKEY|ControlMask|ShiftMask,	XK_2,		{ toggletag },		{ .i = 1 } }, \
    2.26 -	{ MODKEY|ControlMask|ShiftMask,	XK_3,		{ toggletag },		{ .i = 2 } }, \
    2.27 -	{ MODKEY|ControlMask|ShiftMask,	XK_4,		{ toggletag },		{ .i = 3 } }, \
    2.28 -	{ MODKEY|ControlMask|ShiftMask,	XK_5,		{ toggletag },		{ .i = 4 } }, \
    2.29 -	{ MODKEY|ShiftMask,		XK_c,		{ killclient },		{ 0 } }, \
    2.30 -	{ MODKEY,			XK_space,	{ togglemode },		{ 0 } }, \
    2.31 -	{ MODKEY|ShiftMask,		XK_space,	{ togglefloat },	{ 0 } }, \
    2.32 -	{ MODKEY,			XK_0,		{ viewall },		{ 0 } }, \
    2.33 -	{ MODKEY,			XK_1,		{ view },		{ .i = 0 } }, \
    2.34 -	{ MODKEY,			XK_2,		{ view },		{ .i = 1 } }, \
    2.35 -	{ MODKEY,			XK_3,		{ view },		{ .i = 2 } }, \
    2.36 -	{ MODKEY,			XK_4,		{ view },		{ .i = 3 } }, \
    2.37 -	{ MODKEY,			XK_5,		{ view },		{ .i = 4 } }, \
    2.38 -	{ MODKEY|ControlMask,		XK_1,		{ toggleview },		{ .i = 0 } }, \
    2.39 -	{ MODKEY|ControlMask,		XK_2,		{ toggleview },		{ .i = 1 } }, \
    2.40 -	{ MODKEY|ControlMask,		XK_3,		{ toggleview },		{ .i = 2 } }, \
    2.41 -	{ MODKEY|ControlMask,		XK_4,		{ toggleview },		{ .i = 3 } }, \
    2.42 -	{ MODKEY|ControlMask,		XK_5,		{ toggleview },		{ .i = 4 } }, \
    2.43 -	{ MODKEY|ShiftMask,		XK_q,		{ quit },		{ 0 } }, \
    2.44 +	/* modifier			key		function	argument */ \
    2.45 +	{ MODKEY|ShiftMask,		XK_Return,	spawn,		{ .cmd = "exec xterm" } }, \
    2.46 +	{ MODKEY,			XK_Tab,		focusnext,	{ 0 } }, \
    2.47 +	{ MODKEY|ShiftMask,		XK_Tab,		focusprev,	{ 0 } }, \
    2.48 +	{ MODKEY,			XK_Return,	zoom,		{ 0 } }, \
    2.49 +	{ MODKEY,			XK_g,		resizemaster,	{ .i = 15 } }, \
    2.50 +	{ MODKEY,			XK_s,		resizemaster,	{ .i = -15 } }, \
    2.51 +	{ MODKEY|ShiftMask,		XK_1,		tag,		{ .i = 0 } }, \
    2.52 +	{ MODKEY|ShiftMask,		XK_2,		tag,		{ .i = 1 } }, \
    2.53 +	{ MODKEY|ShiftMask,		XK_3,		tag,		{ .i = 2 } }, \
    2.54 +	{ MODKEY|ShiftMask,		XK_4,		tag,		{ .i = 3 } }, \
    2.55 +	{ MODKEY|ShiftMask,		XK_5,		tag,		{ .i = 4 } }, \
    2.56 +	{ MODKEY|ControlMask|ShiftMask,	XK_1,		toggletag,	{ .i = 0 } }, \
    2.57 +	{ MODKEY|ControlMask|ShiftMask,	XK_2,		toggletag,	{ .i = 1 } }, \
    2.58 +	{ MODKEY|ControlMask|ShiftMask,	XK_3,		toggletag,	{ .i = 2 } }, \
    2.59 +	{ MODKEY|ControlMask|ShiftMask,	XK_4,		toggletag,	{ .i = 3 } }, \
    2.60 +	{ MODKEY|ControlMask|ShiftMask,	XK_5,		toggletag,	{ .i = 4 } }, \
    2.61 +	{ MODKEY|ShiftMask,		XK_c,		killclient,	{ 0 } }, \
    2.62 +	{ MODKEY,			XK_space,	togglemode,	{ 0 } }, \
    2.63 +	{ MODKEY|ShiftMask,		XK_space,	togglefloat,	{ 0 } }, \
    2.64 +	{ MODKEY,			XK_0,		viewall,	{ 0 } }, \
    2.65 +	{ MODKEY,			XK_1,		view,		{ .i = 0 } }, \
    2.66 +	{ MODKEY,			XK_2,		view,		{ .i = 1 } }, \
    2.67 +	{ MODKEY,			XK_3,		view,		{ .i = 2 } }, \
    2.68 +	{ MODKEY,			XK_4,		view,		{ .i = 3 } }, \
    2.69 +	{ MODKEY,			XK_5,		view,		{ .i = 4 } }, \
    2.70 +	{ MODKEY|ControlMask,		XK_1,		toggleview,	{ .i = 0 } }, \
    2.71 +	{ MODKEY|ControlMask,		XK_2,		toggleview,	{ .i = 1 } }, \
    2.72 +	{ MODKEY|ControlMask,		XK_3,		toggleview,	{ .i = 2 } }, \
    2.73 +	{ MODKEY|ControlMask,		XK_4,		toggleview,	{ .i = 3 } }, \
    2.74 +	{ MODKEY|ControlMask,		XK_5,		toggleview,	{ .i = 4 } }, \
    2.75 +	{ MODKEY|ShiftMask,		XK_q,		quit,		{ 0 } }, \
    2.76  };
    2.77  
    2.78  /* Query class:instance:title for regex matching info with following command:
     3.1 --- a/event.c	Mon Nov 27 17:46:02 2006 +0100
     3.2 +++ b/event.c	Mon Nov 27 17:49:58 2006 +0100
     3.3 @@ -11,7 +11,7 @@
     3.4  typedef struct {
     3.5  	unsigned long mod;
     3.6  	KeySym keysym;
     3.7 -	void (*func[NFUNCS])(Arg *arg);
     3.8 +	void (*func)(Arg *arg);
     3.9  	Arg arg;
    3.10  } Key;
    3.11  
    3.12 @@ -245,7 +245,7 @@
    3.13  static void
    3.14  keypress(XEvent *e) {
    3.15  	static unsigned int len = sizeof key / sizeof key[0];
    3.16 -	unsigned int i, j;
    3.17 +	unsigned int i;
    3.18  	KeySym keysym;
    3.19  	XKeyEvent *ev = &e->xkey;
    3.20  
    3.21 @@ -254,9 +254,8 @@
    3.22  		if(keysym == key[i].keysym
    3.23  			&& CLEANMASK(key[i].mod) == CLEANMASK(ev->state))
    3.24  		{
    3.25 -			for(j = 0; j < NFUNCS; j++)
    3.26 -				if(key[i].func[j])
    3.27 -					key[i].func[j](&key[i].arg);
    3.28 +			if(key[i].func)
    3.29 +				key[i].func(&key[i].arg);
    3.30  			return;
    3.31  		}
    3.32  	}