diff -up dwm-6.0-clean/config.def.h dwm-6.0-patched/config.def.h --- dwm-6.0-clean/config.def.h 2011-12-19 16:02:46.000000000 +0100 +++ dwm-6.0-patched/config.def.h 2014-02-28 22:21:05.254046315 +0100 @@ -37,10 +37,10 @@ static const Layout layouts[] = { /* key definitions */ #define MODKEY Mod1Mask #define TAGKEYS(KEY,TAG) \ - { MODKEY, KEY, view, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ - { MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ - { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, + { KeyPress, MODKEY, KEY, view, {.ui = 1 << TAG} }, \ + { KeyPress, MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \ + { KeyPress, MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \ + { KeyPress, MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} }, /* helper for spawning shell commands in the pre dwm-5.0 fashion */ #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } } @@ -50,30 +50,30 @@ static const char *dmenucmd[] = { "dmenu static const char *termcmd[] = { "uxterm", NULL }; static Key keys[] = { - /* modifier key function argument */ - { MODKEY, XK_p, spawn, {.v = dmenucmd } }, - { MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, - { MODKEY, XK_b, togglebar, {0} }, - { MODKEY, XK_j, focusstack, {.i = +1 } }, - { MODKEY, XK_k, focusstack, {.i = -1 } }, - { MODKEY, XK_i, incnmaster, {.i = +1 } }, - { MODKEY, XK_d, incnmaster, {.i = -1 } }, - { MODKEY, XK_h, setmfact, {.f = -0.05} }, - { MODKEY, XK_l, setmfact, {.f = +0.05} }, - { MODKEY, XK_Return, zoom, {0} }, - { MODKEY, XK_Tab, view, {0} }, - { MODKEY|ShiftMask, XK_c, killclient, {0} }, - { MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, - { MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, - { MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, - { MODKEY, XK_space, setlayout, {0} }, - { MODKEY|ShiftMask, XK_space, togglefloating, {0} }, - { MODKEY, XK_0, view, {.ui = ~0 } }, - { MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, - { MODKEY, XK_comma, focusmon, {.i = -1 } }, - { MODKEY, XK_period, focusmon, {.i = +1 } }, - { MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, - { MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, + /* type modifier key function argument */ + { KeyPress, MODKEY, XK_p, spawn, {.v = dmenucmd } }, + { KeyPress, MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } }, + { KeyPress, MODKEY, XK_b, togglebar, {0} }, + { KeyPress, MODKEY, XK_j, focusstack, {.i = +1 } }, + { KeyPress, MODKEY, XK_k, focusstack, {.i = -1 } }, + { KeyPress, MODKEY, XK_i, incnmaster, {.i = +1 } }, + { KeyPress, MODKEY, XK_d, incnmaster, {.i = -1 } }, + { KeyPress, MODKEY, XK_h, setmfact, {.f = -0.05} }, + { KeyPress, MODKEY, XK_l, setmfact, {.f = +0.05} }, + { KeyPress, MODKEY, XK_Return, zoom, {0} }, + { KeyPress, MODKEY, XK_Tab, view, {0} }, + { KeyPress, MODKEY|ShiftMask, XK_c, killclient, {0} }, + { KeyPress, MODKEY, XK_t, setlayout, {.v = &layouts[0]} }, + { KeyPress, MODKEY, XK_f, setlayout, {.v = &layouts[1]} }, + { KeyPress, MODKEY, XK_m, setlayout, {.v = &layouts[2]} }, + { KeyPress, MODKEY, XK_space, setlayout, {0} }, + { KeyPress, MODKEY|ShiftMask, XK_space, togglefloating, {0} }, + { KeyPress, MODKEY, XK_0, view, {.ui = ~0 } }, + { KeyPress, MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } }, + { KeyPress, MODKEY, XK_comma, focusmon, {.i = -1 } }, + { KeyPress, MODKEY, XK_period, focusmon, {.i = +1 } }, + { KeyPress, MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } }, + { KeyPress, MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } }, TAGKEYS( XK_1, 0) TAGKEYS( XK_2, 1) TAGKEYS( XK_3, 2) @@ -83,7 +83,7 @@ static Key keys[] = { TAGKEYS( XK_7, 6) TAGKEYS( XK_8, 7) TAGKEYS( XK_9, 8) - { MODKEY|ShiftMask, XK_q, quit, {0} }, + { KeyPress, MODKEY|ShiftMask, XK_q, quit, {0} }, }; /* button definitions */ diff -up dwm-6.0-clean/dwm.c dwm-6.0-patched/dwm.c --- dwm-6.0-clean/dwm.c 2011-12-19 16:02:46.000000000 +0100 +++ dwm-6.0-patched/dwm.c 2014-02-28 22:19:58.466047686 +0100 @@ -113,6 +113,7 @@ typedef struct { } DC; /* draw context */ typedef struct { + int type; unsigned int mod; KeySym keysym; void (*func)(const Arg *); @@ -270,6 +271,7 @@ static void (*handler[LASTEvent]) (XEven [Expose] = expose, [FocusIn] = focusin, [KeyPress] = keypress, + [KeyRelease] = keypress, [MappingNotify] = mappingnotify, [MapRequest] = maprequest, [MotionNotify] = motionnotify, @@ -1087,6 +1089,7 @@ keypress(XEvent *e) { keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); for(i = 0; i < LENGTH(keys); i++) if(keysym == keys[i].keysym + && ev->type == keys[i].type && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) && keys[i].func) keys[i].func(&(keys[i].arg));