dwm-meillo

diff event.c @ 146:f328ce9c558c

centralized/externalized configuration to config.h
author arg@10ksloc.org
date Tue, 01 Aug 2006 13:59:13 +0200
parents 774754477c35
children 5267e1204367
line diff
     1.1 --- a/event.c	Tue Aug 01 12:41:38 2006 +0200
     1.2 +++ b/event.c	Tue Aug 01 13:59:13 2006 +0200
     1.3 @@ -8,7 +8,7 @@
     1.4  #include <X11/keysym.h>
     1.5  #include <X11/Xatom.h>
     1.6  
     1.7 -/* CUSTOMIZE */
     1.8 +/* static */
     1.9  
    1.10  typedef struct {
    1.11  	unsigned long mod;
    1.12 @@ -17,52 +17,10 @@
    1.13  	Arg arg;
    1.14  } Key;
    1.15  
    1.16 -const char *browse[] = { "firefox", NULL };
    1.17 -const char *gimp[] = { "gimp", NULL };
    1.18 -const char *term[] = { /*"xterm", NULL };*/
    1.19 -	"urxvt", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white",
    1.20 -	"-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL
    1.21 -};
    1.22 -const char *xlock[] = { "xlock", NULL };
    1.23 +CMDS
    1.24 +KEYS
    1.25  
    1.26 -static Key key[] = {
    1.27 -	/* modifier		key		function	arguments */
    1.28 -	{ MODKEY,		XK_0,		view,		{ .i = Tfnord } }, 
    1.29 -	{ MODKEY,		XK_1,		view,		{ .i = Tdev } }, 
    1.30 -	{ MODKEY,		XK_2,		view,		{ .i = Tnet } }, 
    1.31 -	{ MODKEY,		XK_3,		view,		{ .i = Twork } }, 
    1.32 -	{ MODKEY,		XK_4,		view,		{ .i = Tmisc} }, 
    1.33 -	{ MODKEY,		XK_h,		viewprev,	{ 0 } },
    1.34 -	{ MODKEY,		XK_j,		focusnext,	{ 0 } }, 
    1.35 -	{ MODKEY,		XK_k,		focusprev,	{ 0 } },
    1.36 -	{ MODKEY,		XK_l,		viewnext,	{ 0 } },
    1.37 -	{ MODKEY,		XK_m,		togglemax,	{ 0 } }, 
    1.38 -	{ MODKEY,		XK_space,	togglemode,	{ 0 } }, 
    1.39 -	{ MODKEY,		XK_Return,	zoom,		{ 0 } },
    1.40 -	{ MODKEY|ControlMask,	XK_0,		appendtag,	{ .i = Tfnord } }, 
    1.41 -	{ MODKEY|ControlMask,	XK_1,		appendtag,	{ .i = Tdev } }, 
    1.42 -	{ MODKEY|ControlMask,	XK_2,		appendtag,	{ .i = Tnet } }, 
    1.43 -	{ MODKEY|ControlMask,	XK_3,		appendtag,	{ .i = Twork } }, 
    1.44 -	{ MODKEY|ControlMask,	XK_4,		appendtag,	{ .i = Tmisc } }, 
    1.45 -	{ MODKEY|ShiftMask,	XK_0,		replacetag,	{ .i = Tfnord } }, 
    1.46 -	{ MODKEY|ShiftMask,	XK_1,		replacetag,	{ .i = Tdev } }, 
    1.47 -	{ MODKEY|ShiftMask,	XK_2,		replacetag,	{ .i = Tnet } }, 
    1.48 -	{ MODKEY|ShiftMask,	XK_3,		replacetag,	{ .i = Twork } }, 
    1.49 -	{ MODKEY|ShiftMask,	XK_4,		replacetag,	{ .i = Tmisc } }, 
    1.50 -	{ MODKEY|ShiftMask,	XK_c,		killclient,	{ 0 } }, 
    1.51 -	{ MODKEY|ShiftMask,	XK_q,		quit,		{ 0 } },
    1.52 -	{ MODKEY|ShiftMask,	XK_Return,	spawn,		{ .argv = term } },
    1.53 -	{ MODKEY|ShiftMask,	XK_g,		spawn,		{ .argv = gimp } },
    1.54 -	{ MODKEY|ShiftMask,	XK_l,		spawn,		{ .argv = xlock } },
    1.55 -	{ MODKEY|ShiftMask,	XK_w,		spawn,		{ .argv = browse } },
    1.56 -};
    1.57 -
    1.58 -#define NumLockMask Mod2Mask
    1.59 -unsigned int valid_mask =  255 &  ~( NumLockMask | LockMask);
    1.60 -
    1.61 -/* END CUSTOMIZE */
    1.62 -
    1.63 -/* static */
    1.64 +static unsigned int valid_mask =  255 &  ~(NUMLOCKMASK | LockMask);
    1.65  
    1.66  static void
    1.67  movemouse(Client *c)
    1.68 @@ -381,19 +339,13 @@
    1.69  	for(i = 0; i < len; i++) {
    1.70  		code = XKeysymToKeycode(dpy, key[i].keysym);
    1.71  		XUngrabKey(dpy, code, key[i].mod, root);
    1.72 -		if (NumLockMask)
    1.73 -		{
    1.74 -			XUngrabKey(dpy, code, key[i].mod | NumLockMask, root);
    1.75 -			XUngrabKey(dpy, code, key[i].mod | NumLockMask | LockMask, root);
    1.76 -		}
    1.77 +		XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root);
    1.78 +		XUngrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root);
    1.79  		XGrabKey(dpy, code, key[i].mod, root, True,
    1.80  				GrabModeAsync, GrabModeAsync);
    1.81 -		if (NumLockMask)
    1.82 -		{
    1.83 -			XGrabKey(dpy, code, key[i].mod | NumLockMask, root, True,
    1.84 -					GrabModeAsync, GrabModeAsync);
    1.85 -			XGrabKey(dpy, code, key[i].mod | NumLockMask | LockMask, root, True,
    1.86 -					GrabModeAsync, GrabModeAsync);
    1.87 -		}
    1.88 +		XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK, root, True,
    1.89 +				GrabModeAsync, GrabModeAsync);
    1.90 +		XGrabKey(dpy, code, key[i].mod | NUMLOCKMASK | LockMask, root, True,
    1.91 +				GrabModeAsync, GrabModeAsync);
    1.92  	}
    1.93  }