Introduction
Introduction Statistics Contact Development Disclaimer Help
dwm-keycodes-6.4.diff - sites - public wiki contents of suckless.org
git clone git://git.suckless.org/sites
Log
Files
Refs
---
dwm-keycodes-6.4.diff (7098B)
---
1 From 081fc7fb9aa2f45df786561bbcbc99adf8509a90 Mon Sep 17 00:00:00 2001
2 From: Quentin Rameau <[email protected]>
3 Date: Tue, 10 Apr 2018 13:26:33 +0200
4 Subject: [PATCH] Use keycode for keyboard input instead of keysyms
5
6 ---
7 config.def.h | 68 ++++++++++++++++++++++++++--------------------------
8 dwm.c | 16 +++++--------
9 2 files changed, 40 insertions(+), 44 deletions(-)
10
11 diff --git a/config.def.h b/config.def.h
12 index 061ad66..bba31ed 100644
13 --- a/config.def.h
14 +++ b/config.def.h
15 @@ -60,40 +60,40 @@ static const char *dmenucmd[] = { "dmenu_run", "-fn"…
16 static const char *termcmd[] = { "st", NULL };
17
18 static const Key keys[] = {
19 - /* modifier key function argu…
20 - { MODKEY, XK_p, spawn, {.v …
21 - { MODKEY|ShiftMask, XK_Return, spawn, {.v …
22 - { MODKEY, XK_b, togglebar, {0} …
23 - { MODKEY, XK_j, focusstack, {.i …
24 - { MODKEY, XK_k, focusstack, {.i …
25 - { MODKEY, XK_i, incnmaster, {.i …
26 - { MODKEY, XK_d, incnmaster, {.i …
27 - { MODKEY, XK_h, setmfact, {.f …
28 - { MODKEY, XK_l, setmfact, {.f …
29 - { MODKEY, XK_Return, zoom, {0} …
30 - { MODKEY, XK_Tab, view, {0} …
31 - { MODKEY|ShiftMask, XK_c, killclient, {0} …
32 - { MODKEY, XK_t, setlayout, {.v …
33 - { MODKEY, XK_f, setlayout, {.v …
34 - { MODKEY, XK_m, setlayout, {.v …
35 - { MODKEY, XK_space, setlayout, {0} …
36 - { MODKEY|ShiftMask, XK_space, togglefloating, {0} …
37 - { MODKEY, XK_0, view, {.ui…
38 - { MODKEY|ShiftMask, XK_0, tag, {.ui…
39 - { MODKEY, XK_comma, focusmon, {.i …
40 - { MODKEY, XK_period, focusmon, {.i …
41 - { MODKEY|ShiftMask, XK_comma, tagmon, {.i …
42 - { MODKEY|ShiftMask, XK_period, tagmon, {.i …
43 - TAGKEYS( XK_1, 0)
44 - TAGKEYS( XK_2, 1)
45 - TAGKEYS( XK_3, 2)
46 - TAGKEYS( XK_4, 3)
47 - TAGKEYS( XK_5, 4)
48 - TAGKEYS( XK_6, 5)
49 - TAGKEYS( XK_7, 6)
50 - TAGKEYS( XK_8, 7)
51 - TAGKEYS( XK_9, 8)
52 - { MODKEY|ShiftMask, XK_q, quit, {0} …
53 + /* modifier key function argument */
54 + { MODKEY, 33, spawn, {.v = dmenucmd …
55 + { MODKEY|ShiftMask, 36, spawn, {.v = termcmd }…
56 + { MODKEY, 56, togglebar, {0} }, …
57 + { MODKEY, 44, focusstack, {.i = +1 } }, …
58 + { MODKEY, 45, focusstack, {.i = -1 } }, …
59 + { MODKEY, 31, incnmaster, {.i = +1 } }, …
60 + { MODKEY, 40, incnmaster, {.i = -1 } }, …
61 + { MODKEY, 43, setmfact, {.f = -0.05} },…
62 + { MODKEY, 46, setmfact, {.f = +0.05} },…
63 + { MODKEY, 36, zoom, {0} }, …
64 + { MODKEY, 23, view, {0} }, …
65 + { MODKEY|ShiftMask, 54, killclient, {0} }, …
66 + { MODKEY, 28, setlayout, {.v = &layouts[…
67 + { MODKEY, 41, setlayout, {.v = &layouts[…
68 + { MODKEY, 58, setlayout, {.v = &layouts[…
69 + { MODKEY, 65, setlayout, {0} }, …
70 + { MODKEY|ShiftMask, 65, togglefloating, {0} }, …
71 + { MODKEY, 19, view, {.ui = ~0 } }, …
72 + { MODKEY|ShiftMask, 19, tag, {.ui = ~0 } }, …
73 + { MODKEY, 59, focusmon, {.i = -1 } }, …
74 + { MODKEY, 60, focusmon, {.i = +1 } }, …
75 + { MODKEY|ShiftMask, 59, tagmon, {.i = -1 } }, …
76 + { MODKEY|ShiftMask, 60, tagmon, {.i = +1 } }, …
77 + TAGKEYS( 10, 0) …
78 + TAGKEYS( 11, 1) …
79 + TAGKEYS( 12, 2) …
80 + TAGKEYS( 13, 3) …
81 + TAGKEYS( 14, 4) …
82 + TAGKEYS( 15, 5) …
83 + TAGKEYS( 16, 6) …
84 + TAGKEYS( 17, 7) …
85 + TAGKEYS( 18, 8) …
86 + { MODKEY|ShiftMask, 24, quit, {0} }, …
87 };
88
89 /* button definitions */
90 diff --git a/dwm.c b/dwm.c
91 index e5efb6a..65b4562 100644
92 --- a/dwm.c
93 +++ b/dwm.c
94 @@ -31,7 +31,6 @@
95 #include <sys/types.h>
96 #include <sys/wait.h>
97 #include <X11/cursorfont.h>
98 -#include <X11/keysym.h>
99 #include <X11/Xatom.h>
100 #include <X11/Xlib.h>
101 #include <X11/Xproto.h>
102 @@ -101,7 +100,7 @@ struct Client {
103
104 typedef struct {
105 unsigned int mod;
106 - KeySym keysym;
107 + KeyCode keycode;
108 void (*func)(const Arg *);
109 const Arg arg;
110 } Key;
111 @@ -957,14 +956,13 @@ grabkeys(void)
112 {
113 unsigned int i, j;
114 unsigned int modifiers[] = { 0, LockMask, numlockmask, …
115 - KeyCode code;
116
117 XUngrabKey(dpy, AnyKey, AnyModifier, root);
118 for (i = 0; i < LENGTH(keys); i++)
119 - if ((code = XKeysymToKeycode(dpy, keys[i].keysy…
120 - for (j = 0; j < LENGTH(modifiers); j++)
121 - XGrabKey(dpy, code, keys[i].mod…
122 - True, GrabModeAsync, Gr…
123 + for (j = 0; j < LENGTH(modifiers); j++)
124 + XGrabKey(dpy, keys[i].keycode,
125 + keys[i].mod | modifiers[j], ro…
126 + True, GrabModeAsync, GrabModeA…
127 }
128 }
129
130 @@ -991,13 +989,11 @@ void
131 keypress(XEvent *e)
132 {
133 unsigned int i;
134 - KeySym keysym;
135 XKeyEvent *ev;
136
137 ev = &e->xkey;
138 - keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0);
139 for (i = 0; i < LENGTH(keys); i++)
140 - if (keysym == keys[i].keysym
141 + if (ev->keycode == keys[i].keycode
142 && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state)
143 && keys[i].func)
144 keys[i].func(&(keys[i].arg));
145 --
146 2.40.0
147
You are viewing proxied material from suckless.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.