aewl

diff dev.c @ 51:035617ee18d1

new stuff
author Anselm R. Garbe <garbeam@wmii.de>
date Thu, 13 Jul 2006 19:55:07 +0200
parents 148f25ed0ad7
children d18f6dd0cf23
line diff
     1.1 --- a/dev.c	Thu Jul 13 18:21:38 2006 +0200
     1.2 +++ b/dev.c	Thu Jul 13 19:55:07 2006 +0200
     1.3 @@ -20,8 +20,7 @@
     1.4  const char *xlock[] = { "xlock", NULL };
     1.5  
     1.6  static Key key[] = {
     1.7 -	{ Mod1Mask, XK_Return, zoom, { 0 } },
     1.8 -	{ Mod1Mask, XK_t, spawn, { .argv = term } },
     1.9 +	{ Mod1Mask, XK_Return, spawn, { .argv = term } },
    1.10  	{ Mod1Mask, XK_w, spawn, { .argv = browse } },
    1.11  	{ Mod1Mask, XK_l, spawn, { .argv = xlock } },
    1.12  	{ Mod1Mask, XK_k, prevc, { 0 } },
    1.13 @@ -33,6 +32,7 @@
    1.14  	{ Mod1Mask, XK_3, view, { .i = Twww } }, 
    1.15  	{ Mod1Mask, XK_4, view, { .i = Twork } }, 
    1.16  	{ Mod1Mask, XK_space, tiling, { 0 } }, 
    1.17 +	{ Mod1Mask | ShiftMask, XK_Return, zoom, { 0 } },
    1.18  	{ Mod1Mask | ShiftMask, XK_space, floating, { 0 } }, 
    1.19  	{ Mod1Mask | ShiftMask, XK_0, tag, { .i = Tscratch } }, 
    1.20  	{ Mod1Mask | ShiftMask, XK_1, tag, { .i = Tdev } }, 
    1.21 @@ -48,10 +48,10 @@
    1.22  void
    1.23  update_keys(void)
    1.24  {
    1.25 -	unsigned int i, len;
    1.26 +	static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0;
    1.27 +	unsigned int i;
    1.28  	KeyCode code;
    1.29  
    1.30 -	len = sizeof(key) / sizeof(key[0]);
    1.31  	for(i = 0; i < len; i++) {
    1.32  		code = XKeysymToKeycode(dpy, key[i].keysym);
    1.33  		XUngrabKey(dpy, code, key[i].mod, root);
    1.34 @@ -63,11 +63,11 @@
    1.35  keypress(XEvent *e)
    1.36  {
    1.37  	XKeyEvent *ev = &e->xkey;
    1.38 -	unsigned int i, len;
    1.39 +	static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0;
    1.40 +	unsigned int i;
    1.41  	KeySym keysym;
    1.42  
    1.43  	keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
    1.44 -	len = sizeof(key) / sizeof(key[0]);
    1.45  	for(i = 0; i < len; i++)
    1.46  		if((keysym == key[i].keysym) && (key[i].mod == ev->state)) {
    1.47  			if(key[i].func)