dwm-keypressrelease-6.0.diff - sites - public wiki contents of suckless.org | |
git clone git://git.suckless.org/sites | |
Log | |
Files | |
Refs | |
--- | |
dwm-keypressrelease-6.0.diff (6698B) | |
--- | |
1 diff -up dwm-6.0-clean/config.def.h dwm-6.0-patched/config.def.h | |
2 --- dwm-6.0-clean/config.def.h 2011-12-19 16:02:46.000000000 +0100 | |
3 +++ dwm-6.0-patched/config.def.h 2014-02-28 22:21:05.254046315 +0… | |
4 @@ -37,10 +37,10 @@ static const Layout layouts[] = { | |
5 /* key definitions */ | |
6 #define MODKEY Mod1Mask | |
7 #define TAGKEYS(KEY,TAG) \ | |
8 - { MODKEY, KEY, view, {.ui … | |
9 - { MODKEY|ControlMask, KEY, toggleview, {.ui … | |
10 - { MODKEY|ShiftMask, KEY, tag, {.ui … | |
11 - { MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui … | |
12 + { KeyPress, MODKEY, KEY, view, … | |
13 + { KeyPress, MODKEY|ControlMask, KEY, togglevie… | |
14 + { KeyPress, MODKEY|ShiftMask, KEY, tag, … | |
15 + { KeyPress, MODKEY|ControlMask|ShiftMask, KEY, toggletag… | |
16 | |
17 /* helper for spawning shell commands in the pre dwm-5.0 fashion */ | |
18 #define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL }… | |
19 @@ -50,30 +50,30 @@ static const char *dmenucmd[] = { "dmenu | |
20 static const char *termcmd[] = { "uxterm", NULL }; | |
21 | |
22 static Key keys[] = { | |
23 - /* modifier key function argu… | |
24 - { MODKEY, XK_p, spawn, {.v … | |
25 - { MODKEY|ShiftMask, XK_Return, spawn, {.v … | |
26 - { MODKEY, XK_b, togglebar, {0} … | |
27 - { MODKEY, XK_j, focusstack, {.i … | |
28 - { MODKEY, XK_k, focusstack, {.i … | |
29 - { MODKEY, XK_i, incnmaster, {.i … | |
30 - { MODKEY, XK_d, incnmaster, {.i … | |
31 - { MODKEY, XK_h, setmfact, {.f … | |
32 - { MODKEY, XK_l, setmfact, {.f … | |
33 - { MODKEY, XK_Return, zoom, {0} … | |
34 - { MODKEY, XK_Tab, view, {0} … | |
35 - { MODKEY|ShiftMask, XK_c, killclient, {0} … | |
36 - { MODKEY, XK_t, setlayout, {.v … | |
37 - { MODKEY, XK_f, setlayout, {.v … | |
38 - { MODKEY, XK_m, setlayout, {.v … | |
39 - { MODKEY, XK_space, setlayout, {0} … | |
40 - { MODKEY|ShiftMask, XK_space, togglefloating, {0} … | |
41 - { MODKEY, XK_0, view, {.ui… | |
42 - { MODKEY|ShiftMask, XK_0, tag, {.ui… | |
43 - { MODKEY, XK_comma, focusmon, {.i … | |
44 - { MODKEY, XK_period, focusmon, {.i … | |
45 - { MODKEY|ShiftMask, XK_comma, tagmon, {.i … | |
46 - { MODKEY|ShiftMask, XK_period, tagmon, {.i … | |
47 + /* type modifier key function… | |
48 + { KeyPress, MODKEY, XK_p, spawn, … | |
49 + { KeyPress, MODKEY|ShiftMask, XK_Return, spawn, … | |
50 + { KeyPress, MODKEY, XK_b, toggleba… | |
51 + { KeyPress, MODKEY, XK_j, focussta… | |
52 + { KeyPress, MODKEY, XK_k, focussta… | |
53 + { KeyPress, MODKEY, XK_i, incnmast… | |
54 + { KeyPress, MODKEY, XK_d, incnmast… | |
55 + { KeyPress, MODKEY, XK_h, setmfact… | |
56 + { KeyPress, MODKEY, XK_l, setmfact… | |
57 + { KeyPress, MODKEY, XK_Return, zoom, … | |
58 + { KeyPress, MODKEY, XK_Tab, view, … | |
59 + { KeyPress, MODKEY|ShiftMask, XK_c, killclie… | |
60 + { KeyPress, MODKEY, XK_t, setlayou… | |
61 + { KeyPress, MODKEY, XK_f, setlayou… | |
62 + { KeyPress, MODKEY, XK_m, setlayou… | |
63 + { KeyPress, MODKEY, XK_space, setlayou… | |
64 + { KeyPress, MODKEY|ShiftMask, XK_space, togglefl… | |
65 + { KeyPress, MODKEY, XK_0, view, … | |
66 + { KeyPress, MODKEY|ShiftMask, XK_0, tag, … | |
67 + { KeyPress, MODKEY, XK_comma, focusmon… | |
68 + { KeyPress, MODKEY, XK_period, focusmon… | |
69 + { KeyPress, MODKEY|ShiftMask, XK_comma, tagmon, … | |
70 + { KeyPress, MODKEY|ShiftMask, XK_period, tagmon, … | |
71 TAGKEYS( XK_1, 0) | |
72 TAGKEYS( XK_2, 1) | |
73 TAGKEYS( XK_3, 2) | |
74 @@ -83,7 +83,7 @@ static Key keys[] = { | |
75 TAGKEYS( XK_7, 6) | |
76 TAGKEYS( XK_8, 7) | |
77 TAGKEYS( XK_9, 8) | |
78 - { MODKEY|ShiftMask, XK_q, quit, {0} … | |
79 + { KeyPress, MODKEY|ShiftMask, XK_q, quit, … | |
80 }; | |
81 | |
82 /* button definitions */ | |
83 diff -up dwm-6.0-clean/dwm.c dwm-6.0-patched/dwm.c | |
84 --- dwm-6.0-clean/dwm.c 2011-12-19 16:02:46.000000000 +0100 | |
85 +++ dwm-6.0-patched/dwm.c 2014-02-28 22:19:58.466047686 +0100 | |
86 @@ -113,6 +113,7 @@ typedef struct { | |
87 } DC; /* draw context */ | |
88 | |
89 typedef struct { | |
90 + int type; | |
91 unsigned int mod; | |
92 KeySym keysym; | |
93 void (*func)(const Arg *); | |
94 @@ -270,6 +271,7 @@ static void (*handler[LASTEvent]) (XEven | |
95 [Expose] = expose, | |
96 [FocusIn] = focusin, | |
97 [KeyPress] = keypress, | |
98 + [KeyRelease] = keypress, | |
99 [MappingNotify] = mappingnotify, | |
100 [MapRequest] = maprequest, | |
101 [MotionNotify] = motionnotify, | |
102 @@ -1087,6 +1089,7 @@ keypress(XEvent *e) { | |
103 keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); | |
104 for(i = 0; i < LENGTH(keys); i++) | |
105 if(keysym == keys[i].keysym | |
106 + && ev->type == keys[i].type | |
107 && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) | |
108 && keys[i].func) | |
109 keys[i].func(&(keys[i].arg)); |