mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
609 Commits
xf86-input
...
release/25
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bdf7f1d44 | ||
|
|
f32592af5b | ||
|
|
3c37d58f21 | ||
|
|
83d7cfecfd | ||
|
|
93d89e4374 | ||
|
|
87f04d892f | ||
|
|
173cdfa20a | ||
|
|
4d30b39c0a | ||
|
|
0f8cbdff4f | ||
|
|
77129e1138 | ||
|
|
114073c225 | ||
|
|
13fb800c0c | ||
|
|
cfac96b809 | ||
|
|
5c74de60b3 | ||
|
|
679c6cb77f | ||
|
|
298e61e566 | ||
|
|
1a80d31ed7 | ||
|
|
e8a08514f6 | ||
|
|
a413634da8 | ||
|
|
0eb641f218 | ||
|
|
c59ba05346 | ||
|
|
0981f96cdc | ||
|
|
b1320d6f02 | ||
|
|
26dde8fc21 | ||
|
|
51d93c47f7 | ||
|
|
3801a36ec9 | ||
|
|
e361cfad9f | ||
|
|
4570407894 | ||
|
|
9ee18e3450 | ||
|
|
e518cb19bd | ||
|
|
0b5b97bc6b | ||
|
|
96a4dc7565 | ||
|
|
abcafeede7 | ||
|
|
d893fc74d2 | ||
|
|
b9327e6b28 | ||
|
|
917c2ea204 | ||
|
|
b48c2b7028 | ||
|
|
aac329fd2a | ||
|
|
fbfb16edfe | ||
|
|
409e8205e8 | ||
|
|
7fc0d51f70 | ||
|
|
7c48b6225b | ||
|
|
8edcb2b9e8 | ||
|
|
84b2740814 | ||
|
|
469a30f158 | ||
|
|
23909c35a4 | ||
|
|
abf0fa611e | ||
|
|
6609d352f3 | ||
|
|
71036116be | ||
|
|
b6b36166bd | ||
|
|
67a97afbc0 | ||
|
|
2fb95783e0 | ||
|
|
456f23cbbd | ||
|
|
ab1d9adfd3 | ||
|
|
192fdb0690 | ||
|
|
8c1058f2eb | ||
|
|
4921912374 | ||
|
|
67681097b8 | ||
|
|
1dd61111ad | ||
|
|
231061d004 | ||
|
|
425ed6017a | ||
|
|
7251e42dfb | ||
|
|
551db5b86e | ||
|
|
bb8bde7456 | ||
|
|
7b1267f7f1 | ||
|
|
e08b033276 | ||
|
|
7c1971d9e7 | ||
|
|
9a6952dafe | ||
|
|
f12eca9f83 | ||
|
|
33dc3d7128 | ||
|
|
7b0a65d989 | ||
|
|
d24431a186 | ||
|
|
ce7d8fdebc | ||
|
|
6a3beab613 | ||
|
|
d7e61a7074 | ||
|
|
01e7ac4854 | ||
|
|
034be31159 | ||
|
|
66c9978864 | ||
|
|
0d3494eadf | ||
|
|
56a5e67162 | ||
|
|
74433f788a | ||
|
|
fdc33809de | ||
|
|
38e107a39f | ||
|
|
b6176cff5a | ||
|
|
37afebfb67 | ||
|
|
5b5ae1786c | ||
|
|
2c9f4f0380 | ||
|
|
39ef4444a2 | ||
|
|
abc4a8b603 | ||
|
|
b370ccdff8 | ||
|
|
511498478b | ||
|
|
3dcf6f123c | ||
|
|
f59585b367 | ||
|
|
593bbc6390 | ||
|
|
e0e2587a95 | ||
|
|
cb3b023783 | ||
|
|
124eff9ba2 | ||
|
|
605047613c | ||
|
|
3ee98d0b7f | ||
|
|
977588d24a | ||
|
|
291b60172d | ||
|
|
8ce06c96e4 | ||
|
|
5d239ceb26 | ||
|
|
13dea90bc8 | ||
|
|
b25d716165 | ||
|
|
41cf9212d0 | ||
|
|
75368052b5 | ||
|
|
16c85cbeac | ||
|
|
ae67f64f02 | ||
|
|
f6fcad8b10 | ||
|
|
d171b3d919 | ||
|
|
c3251deb4b | ||
|
|
cabed4bbb6 | ||
|
|
a75c43830e | ||
|
|
d9aadfd5f0 | ||
|
|
54a3120e33 | ||
|
|
164c62a975 | ||
|
|
43e270fb7a | ||
|
|
4ca57716ca | ||
|
|
0f16065b00 | ||
|
|
cae1478781 | ||
|
|
27926b3763 | ||
|
|
8a9b1ec6b5 | ||
|
|
356565111a | ||
|
|
fff3a60fbf | ||
|
|
8f209ac60d | ||
|
|
a0d41af896 | ||
|
|
dea1d1a390 | ||
|
|
b59a1a25da | ||
|
|
5138cd2ff4 | ||
|
|
c085c8b6c1 | ||
|
|
2b675f85ae | ||
|
|
2b8b0df62e | ||
|
|
bb9b4146cb | ||
|
|
f5fe533f1b | ||
|
|
2f67509b53 | ||
|
|
ffc0a34642 | ||
|
|
93de7b0b73 | ||
|
|
9ec9d214d0 | ||
|
|
94e6df8f5f | ||
|
|
67e5376aaa | ||
|
|
2432626b70 | ||
|
|
069c035ab0 | ||
|
|
3b7ba39fca | ||
|
|
454194f4b5 | ||
|
|
00341e632c | ||
|
|
f2d2b65343 | ||
|
|
0d6c6b59c1 | ||
|
|
c263d6e46d | ||
|
|
5af11b6752 | ||
|
|
33e7831b5f | ||
|
|
bc8997e812 | ||
|
|
1cb8f074df | ||
|
|
4eacb581fb | ||
|
|
98af2003d4 | ||
|
|
f5ede98085 | ||
|
|
ff926d15b8 | ||
|
|
b0e3c8f978 | ||
|
|
9624f4e2ba | ||
|
|
047955f51e | ||
|
|
8251d7a8ec | ||
|
|
ac5173163d | ||
|
|
61faf2e6e7 | ||
|
|
7f3f98be7f | ||
|
|
4145fe1c08 | ||
|
|
9ce068e760 | ||
|
|
2c8da280b3 | ||
|
|
f28507e8ce | ||
|
|
99340147b9 | ||
|
|
76b1d58a97 | ||
|
|
224a28de25 | ||
|
|
bc2f01ab83 | ||
|
|
9d9c9870c8 | ||
|
|
5c5b2c8db8 | ||
|
|
854df75f49 | ||
|
|
8c55e94a6a | ||
|
|
965338e9d0 | ||
|
|
0075da20d6 | ||
|
|
009ac94a8e | ||
|
|
4b76d80e93 | ||
|
|
6dd6f2d3c6 | ||
|
|
0c7c087f77 | ||
|
|
ba9377c6d9 | ||
|
|
7f7606fc46 | ||
|
|
0ba58f483e | ||
|
|
5fb4875747 | ||
|
|
e99ab2314f | ||
|
|
191660189a | ||
|
|
a1c3f8efbb | ||
|
|
f3c628acc4 | ||
|
|
7909975b0b | ||
|
|
8d6dfd13b0 | ||
|
|
fed454192d | ||
|
|
cf93a21df1 | ||
|
|
fac1a41c75 | ||
|
|
3175a2a96d | ||
|
|
5e9b027807 | ||
|
|
2ce305129c | ||
|
|
9411749f76 | ||
|
|
239e972be1 | ||
|
|
6127923fe0 | ||
|
|
fc4f98153c | ||
|
|
fabee66bcc | ||
|
|
91d90a7959 | ||
|
|
c1b89bda12 | ||
|
|
907b7cad3f | ||
|
|
c9a2b4e9ce | ||
|
|
e18abd0049 | ||
|
|
683a55e504 | ||
|
|
a9cdb6590c | ||
|
|
dd000dd4fa | ||
|
|
745fca03a2 | ||
|
|
b450efdf95 | ||
|
|
eede8ccffc | ||
|
|
2aba790ed3 | ||
|
|
49693892ce | ||
|
|
070f30e089 | ||
|
|
ffe35b6c25 | ||
|
|
5069e05335 | ||
|
|
0b9fad23a3 | ||
|
|
b79776cf8c | ||
|
|
a52cd1cab2 | ||
|
|
eaf202531f | ||
|
|
74151b3c52 | ||
|
|
e9d96e87ac | ||
|
|
bb15bac149 | ||
|
|
7611d2fc73 | ||
|
|
ebe41bfba7 | ||
|
|
68a6a18fc2 | ||
|
|
eeacd3e5a8 | ||
|
|
5708e38494 | ||
|
|
41111ce1ef | ||
|
|
b4c47d5f94 | ||
|
|
50193a0dd3 | ||
|
|
0049cce4d0 | ||
|
|
d9001a6be9 | ||
|
|
22db196815 | ||
|
|
54ac2306b8 | ||
|
|
768c25a99b | ||
|
|
b5c9f41b2b | ||
|
|
8bc4be3048 | ||
|
|
30c3645e20 | ||
|
|
3b52fe2ea4 | ||
|
|
540a4cce90 | ||
|
|
bed25600f6 | ||
|
|
9aea1c5fa0 | ||
|
|
0c987a929d | ||
|
|
242a01eb0f | ||
|
|
7415953b9a | ||
|
|
1ced7ec7e2 | ||
|
|
1c5ad6f8a0 | ||
|
|
6fd1d0860e | ||
|
|
31ba99e9ed | ||
|
|
a4aefca2ed | ||
|
|
20d7a0a4aa | ||
|
|
5e26ba8641 | ||
|
|
71dd18f728 | ||
|
|
c3e49f2b95 | ||
|
|
b06d3ffdcd | ||
|
|
3646371eef | ||
|
|
b48f4c41c0 | ||
|
|
185ad42078 | ||
|
|
7282e3ac6c | ||
|
|
c504852aa2 | ||
|
|
4bbf9c9125 | ||
|
|
684426a9d2 | ||
|
|
9664e5a487 | ||
|
|
0367e3871f | ||
|
|
617a09e298 | ||
|
|
b83515485b | ||
|
|
009d442aa3 | ||
|
|
10493de96e | ||
|
|
829facd516 | ||
|
|
fbafe59420 | ||
|
|
990540fa19 | ||
|
|
b8945e61eb | ||
|
|
97dc45b769 | ||
|
|
ec6cb31cc4 | ||
|
|
ed47c7f33e | ||
|
|
899218e181 | ||
|
|
4964c61f4b | ||
|
|
92e8dc4961 | ||
|
|
e0e4b7d89b | ||
|
|
d2c11d36a0 | ||
|
|
2f636402d8 | ||
|
|
3d3565c069 | ||
|
|
421585fda6 | ||
|
|
8697811f56 | ||
|
|
b06bffdc97 | ||
|
|
9410e452d2 | ||
|
|
516e538da4 | ||
|
|
1f38e1bc11 | ||
|
|
456579ba30 | ||
|
|
21a2ac818e | ||
|
|
4c21624240 | ||
|
|
6e244b1098 | ||
|
|
e7c301563a | ||
|
|
ffc2c9961f | ||
|
|
7c01cff1fa | ||
|
|
e6e20c1b3e | ||
|
|
b27d03b248 | ||
|
|
ba78428ed5 | ||
|
|
041a1f246a | ||
|
|
44b80d177f | ||
|
|
7bbbce9a83 | ||
|
|
35b6085bf8 | ||
|
|
539d67505c | ||
|
|
a77dea1caa | ||
|
|
5fb1e841eb | ||
|
|
a4f2d12cd8 | ||
|
|
6b5c0401e2 | ||
|
|
993e011b91 | ||
|
|
2d5e922a6d | ||
|
|
41a38ec886 | ||
|
|
b31c00efea | ||
|
|
b48dcfa3f2 | ||
|
|
44baa36b99 | ||
|
|
7fa5982d47 | ||
|
|
fe8d0fa11a | ||
|
|
09b918db86 | ||
|
|
9dbace89be | ||
|
|
aaf65e7bfa | ||
|
|
8eede7ea8d | ||
|
|
1936632cb0 | ||
|
|
0dc931e1ac | ||
|
|
d525b48a2f | ||
|
|
801778c310 | ||
|
|
99505011d1 | ||
|
|
fd036680c2 | ||
|
|
e81cd935cf | ||
|
|
0b5844ce67 | ||
|
|
d6beb16be2 | ||
|
|
2f5a0fb698 | ||
|
|
1b0df04abe | ||
|
|
2ca24a16f0 | ||
|
|
7b285a802b | ||
|
|
f187badb71 | ||
|
|
0e9d75ba68 | ||
|
|
3a6d27b83d | ||
|
|
886e303af1 | ||
|
|
3d23ef4888 | ||
|
|
c0473e4921 | ||
|
|
afc9e91765 | ||
|
|
c1f16a4f59 | ||
|
|
a0f7f34dc5 | ||
|
|
11669d8279 | ||
|
|
9cbffda910 | ||
|
|
59056e656c | ||
|
|
aa6399fdb9 | ||
|
|
1d86f5dec1 | ||
|
|
fbd86e2530 | ||
|
|
9ea1f9a695 | ||
|
|
57b54ee399 | ||
|
|
f2dc0681fe | ||
|
|
3fa49dfcab | ||
|
|
941391ca34 | ||
|
|
2144f7d834 | ||
|
|
61b4e88e01 | ||
|
|
9ee70943ec | ||
|
|
415b6ffa95 | ||
|
|
f4ba2bd785 | ||
|
|
2e5f68754f | ||
|
|
8fdb2abb6f | ||
|
|
ca0fb396f1 | ||
|
|
7967677789 | ||
|
|
36064dca90 | ||
|
|
8bf93709cb | ||
|
|
37373a223b | ||
|
|
d764dded18 | ||
|
|
f352598e45 | ||
|
|
69d6ff3e01 | ||
|
|
6f4634111a | ||
|
|
1f641d75ed | ||
|
|
2994825665 | ||
|
|
9bfd9e8a36 | ||
|
|
dcca28a59c | ||
|
|
db8b1ca5cf | ||
|
|
8cc0d0f285 | ||
|
|
aa1609285d | ||
|
|
b07ab6ea97 | ||
|
|
7bc48c666d | ||
|
|
880ad1e19a | ||
|
|
6ab23e4519 | ||
|
|
88eedea281 | ||
|
|
9a5a4fed3a | ||
|
|
0a3657d2ee | ||
|
|
dc2191285e | ||
|
|
255b9f6bbf | ||
|
|
aa117d49a5 | ||
|
|
b358f1eb3a | ||
|
|
33cc112ca1 | ||
|
|
3c43d880f1 | ||
|
|
5462898935 | ||
|
|
9243d338d1 | ||
|
|
71e9a69ed6 | ||
|
|
220e2dfb8f | ||
|
|
ddc1266374 | ||
|
|
98ecb5233b | ||
|
|
92ca3dc2e7 | ||
|
|
3fa28c8acd | ||
|
|
d9809d7edd | ||
|
|
b11439a176 | ||
|
|
740dc202f7 | ||
|
|
7ac0c4456d | ||
|
|
b4f6ab126d | ||
|
|
a3ea979c2b | ||
|
|
a7fb654a68 | ||
|
|
3f06825a44 | ||
|
|
31853c39bf | ||
|
|
2c49e21a81 | ||
|
|
4361b3efa0 | ||
|
|
281a7b4b88 | ||
|
|
051cb8b528 | ||
|
|
1abcc88171 | ||
|
|
c89bbf80be | ||
|
|
178435832f | ||
|
|
c9cab83bac | ||
|
|
43dd2a9592 | ||
|
|
7977947e0d | ||
|
|
11a56d4a17 | ||
|
|
7b0f613c7f | ||
|
|
75af278861 | ||
|
|
4fd9cd2ea8 | ||
|
|
12c287df89 | ||
|
|
9f1b9aa6eb | ||
|
|
acb1d557e2 | ||
|
|
6a1f8f463d | ||
|
|
9620fe7765 | ||
|
|
a1714cac52 | ||
|
|
5a99ef7ed2 | ||
|
|
3b22e4703f | ||
|
|
0de20a8f1b | ||
|
|
978384ede7 | ||
|
|
df7ff12ed2 | ||
|
|
dd2c89ac93 | ||
|
|
4616c79f6c | ||
|
|
a31170718d | ||
|
|
95099cb036 | ||
|
|
c58bae0b77 | ||
|
|
32242871f7 | ||
|
|
aa5dfa1d6a | ||
|
|
2a6c1d7a60 | ||
|
|
0f0743e3cf | ||
|
|
095766ebb3 | ||
|
|
0dbb88c52b | ||
|
|
c928156702 | ||
|
|
07f40a04df | ||
|
|
e260993b6a | ||
|
|
dc72e6d8ae | ||
|
|
1906e4d5c1 | ||
|
|
3047c25db2 | ||
|
|
c158cf2b64 | ||
|
|
dae1a78a52 | ||
|
|
263bf04a9d | ||
|
|
c035f3d0f5 | ||
|
|
a7e8af65fc | ||
|
|
0592d97fbb | ||
|
|
4dfd86b220 | ||
|
|
d3fd42d864 | ||
|
|
dd1752ce3f | ||
|
|
0f0a149067 | ||
|
|
d170cba0cd | ||
|
|
2680382705 | ||
|
|
0f36384d06 | ||
|
|
ece72ce9e9 | ||
|
|
2bf6e29b40 | ||
|
|
2bd24649ec | ||
|
|
6867652c2c | ||
|
|
63af314368 | ||
|
|
4c5c9c111d | ||
|
|
4826969f23 | ||
|
|
33eb36f266 | ||
|
|
d5cf24d3f0 | ||
|
|
64554e4799 | ||
|
|
b77f939857 | ||
|
|
a43ab4999b | ||
|
|
af096e8c5d | ||
|
|
12498042fc | ||
|
|
0f8fcfccb3 | ||
|
|
0ab4c09e50 | ||
|
|
d348eb8ce7 | ||
|
|
2c1698fa61 | ||
|
|
8c39302594 | ||
|
|
f57e8face9 | ||
|
|
4912e2aa7f | ||
|
|
7243116f55 | ||
|
|
0089d931ac | ||
|
|
0f5a5ac09e | ||
|
|
36d68b006d | ||
|
|
bb1f421687 | ||
|
|
0405f7b17f | ||
|
|
088e0a175a | ||
|
|
cefedeb205 | ||
|
|
b0737bdbd1 | ||
|
|
5f2c8a2dcd | ||
|
|
ff783fce65 | ||
|
|
c638aa4a88 | ||
|
|
b46677e346 | ||
|
|
680b41dc76 | ||
|
|
9065d0ccb2 | ||
|
|
a9fcce1833 | ||
|
|
ab934d840d | ||
|
|
6f6ac98295 | ||
|
|
a2633c8078 | ||
|
|
e6c699dedc | ||
|
|
847eac8262 | ||
|
|
a196672a6b | ||
|
|
3985d42320 | ||
|
|
e138e4b79a | ||
|
|
125e2b8ce2 | ||
|
|
91bc0a0ba3 | ||
|
|
4c55186aed | ||
|
|
62069b97d2 | ||
|
|
2718a5c56b | ||
|
|
90d1d494f8 | ||
|
|
a77c2622cc | ||
|
|
84a0e39c0d | ||
|
|
7386937221 | ||
|
|
fcf8375f2b | ||
|
|
9930477cbe | ||
|
|
4509ec1daf | ||
|
|
a205dfc091 | ||
|
|
184206e717 | ||
|
|
79ff677c52 | ||
|
|
37e3addf89 | ||
|
|
e237de0dea | ||
|
|
92c6611b6f | ||
|
|
bd405ddc83 | ||
|
|
36d702006d | ||
|
|
6dc4199155 | ||
|
|
e8534d47c8 | ||
|
|
555f5a7cbf | ||
|
|
134829d911 | ||
|
|
4e121b297e | ||
|
|
9793de8137 | ||
|
|
a9d72b40fb | ||
|
|
c1f7f8c3d2 | ||
|
|
40e1474d84 | ||
|
|
d9097df01b | ||
|
|
5c074af5a9 | ||
|
|
72551662a0 | ||
|
|
53e7525744 | ||
|
|
5d13259a5d | ||
|
|
2b7edaa4ab | ||
|
|
bf0d81011e | ||
|
|
ef4bb69c1a | ||
|
|
d1818ef206 | ||
|
|
a9223edcd8 | ||
|
|
ec23c6b2f5 | ||
|
|
18d70d796f | ||
|
|
37b854cb64 | ||
|
|
8c06093191 | ||
|
|
0830676a0c | ||
|
|
1cf7b8f7ee | ||
|
|
826e6e7dd4 | ||
|
|
5a0ea39b79 | ||
|
|
373e13ae35 | ||
|
|
76800bfa75 | ||
|
|
04003a98a9 | ||
|
|
0443fb430f | ||
|
|
998f52010f | ||
|
|
de07c04f5c | ||
|
|
01355b9d4b | ||
|
|
9591dc1f6c | ||
|
|
08ba40b253 | ||
|
|
39dc453691 | ||
|
|
e8887435ac | ||
|
|
b0f6987ee6 | ||
|
|
fec73e1418 | ||
|
|
da112737eb | ||
|
|
d40125ea8c | ||
|
|
42422d8f69 | ||
|
|
15e0091f0b | ||
|
|
d45f315845 | ||
|
|
a4a7003f7c | ||
|
|
3e0dc9945d | ||
|
|
ff6251a2bd | ||
|
|
e9222a8285 | ||
|
|
8b7738457f | ||
|
|
1b9deb8e7e | ||
|
|
0ec391f51c | ||
|
|
f77410e1f9 | ||
|
|
d28c2e1efb | ||
|
|
697e850a63 | ||
|
|
87037b9953 | ||
|
|
71f4eaec77 | ||
|
|
7208397612 | ||
|
|
c250f84383 | ||
|
|
2b334d6b69 | ||
|
|
9773dac623 | ||
|
|
1a0bc8e64a | ||
|
|
6271494faa | ||
|
|
f5bfc7ec3c | ||
|
|
bf0848ec8e | ||
|
|
f1445feac7 | ||
|
|
ad5bdcb50f | ||
|
|
bb36ca65c6 | ||
|
|
40a1e1439c | ||
|
|
946beb16f8 | ||
|
|
305f90d37a | ||
|
|
11cf9c92c0 | ||
|
|
7f1e8146d4 | ||
|
|
8ae4d17ca3 | ||
|
|
134ce2e493 | ||
|
|
10e7c3fbdf | ||
|
|
f766404fd9 | ||
|
|
d032d3c8b4 | ||
|
|
5adbc6b98c | ||
|
|
eeb3727004 |
65
.github/ISSUE_TEMPLATE/01-bug-report.yml
vendored
Normal file
65
.github/ISSUE_TEMPLATE/01-bug-report.yml
vendored
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
name: 🐞 Bug report
|
||||||
|
description: Create a report to help us improve
|
||||||
|
|
||||||
|
labels: [bug, needs-triage]
|
||||||
|
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please fill out the sections below to help everyone identify and fix the bug. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
|
||||||
|
- type: dropdown
|
||||||
|
id: affected-version
|
||||||
|
attributes:
|
||||||
|
label: Select the version
|
||||||
|
options:
|
||||||
|
- 2.11.0.1
|
||||||
|
- Git master branch
|
||||||
|
- other or don't know
|
||||||
|
default: 1
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Describe your issue
|
||||||
|
placeholder: When I did X then Y happened.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: steps
|
||||||
|
attributes:
|
||||||
|
label: Steps to reproduce
|
||||||
|
placeholder: |
|
||||||
|
1. Start ...
|
||||||
|
2. Do this
|
||||||
|
3. Do that
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: expected
|
||||||
|
attributes:
|
||||||
|
label: What did you expect?
|
||||||
|
placeholder: I expected this to happen.
|
||||||
|
- type: textarea
|
||||||
|
id: environment
|
||||||
|
attributes:
|
||||||
|
label: Additional Information
|
||||||
|
description: |
|
||||||
|
Additional information you want to provide such as logs, system info, environment, screenshots, etc.
|
||||||
|
placeholder: |
|
||||||
|
Add any other context about the bug here.
|
||||||
|
- type: checkboxes
|
||||||
|
id: checks
|
||||||
|
attributes:
|
||||||
|
label: Extra fields
|
||||||
|
options:
|
||||||
|
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
|
||||||
|
required: true
|
||||||
|
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
|
||||||
|
required: true
|
||||||
|
- label: I'd like to work on this issue
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for reporting this issue! We will get back to you as soon as possible.
|
||||||
49
.github/ISSUE_TEMPLATE/02-feature-request.yml
vendored
Normal file
49
.github/ISSUE_TEMPLATE/02-feature-request.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: ✨ Feature request
|
||||||
|
description: Suggest a feature for this software
|
||||||
|
labels: [enhancement, needs-triage]
|
||||||
|
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please fill out the sections below to properly describe the new software feature you are suggesting. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: "Describe the feature"
|
||||||
|
placeholder: A thing in X that allows to do Y.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: rationale
|
||||||
|
attributes:
|
||||||
|
label: "It should be done because"
|
||||||
|
placeholder: Doing Y is needed for Z.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: alternative
|
||||||
|
attributes:
|
||||||
|
label: "What are the alternatives?"
|
||||||
|
placeholder: We could do A or B instead.
|
||||||
|
- type: textarea
|
||||||
|
id: context
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: Additional information you want to provide such as references to related issues or protocols, the implications on existing use cases, etc.
|
||||||
|
placeholder: |
|
||||||
|
Add any other context about the feature request here.
|
||||||
|
- type: checkboxes
|
||||||
|
id: checks
|
||||||
|
attributes:
|
||||||
|
label: Extra fields
|
||||||
|
options:
|
||||||
|
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
|
||||||
|
required: true
|
||||||
|
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
|
||||||
|
required: true
|
||||||
|
- label: I'd like to work on this issue
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for your suggestion! Let's see together if it can be done.
|
||||||
49
.github/ISSUE_TEMPLATE/03-code-cleanup.yml
vendored
Normal file
49
.github/ISSUE_TEMPLATE/03-code-cleanup.yml
vendored
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
name: 🔧 Code cleanup
|
||||||
|
description: Level up the source code
|
||||||
|
labels: [code-cleanup, needs-triage]
|
||||||
|
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please fill out the sections below to properly describe the code cleanup you are suggesting. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: "Describe the cleanup"
|
||||||
|
placeholder: C in X needs to be changed into D.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: rationale
|
||||||
|
attributes:
|
||||||
|
label: "It should be done because"
|
||||||
|
placeholder: Having D is needed for E.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: alternative
|
||||||
|
attributes:
|
||||||
|
label: "What are the alternatives?"
|
||||||
|
placeholder: We could do A or B instead.
|
||||||
|
- type: textarea
|
||||||
|
id: context
|
||||||
|
attributes:
|
||||||
|
label: Additional context
|
||||||
|
description: Additional information you want to provide such as implications on existing code, how to ensure API/ABI stability, which tests are needed or to be run, related issues, etc.
|
||||||
|
placeholder: |
|
||||||
|
Add any other context about the cleanup here.
|
||||||
|
- type: checkboxes
|
||||||
|
id: checks
|
||||||
|
attributes:
|
||||||
|
label: Extra fields
|
||||||
|
options:
|
||||||
|
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
|
||||||
|
required: true
|
||||||
|
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
|
||||||
|
required: true
|
||||||
|
- label: I'd like to work on this issue
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for looking at the source code! Let's see together how it can be improved.
|
||||||
38
.github/ISSUE_TEMPLATE/04-doc-update.yml
vendored
Normal file
38
.github/ISSUE_TEMPLATE/04-doc-update.yml
vendored
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
name: 🔖 Documentation update
|
||||||
|
description: Make your mark for better documentation
|
||||||
|
|
||||||
|
labels: [documentation, needs-triage]
|
||||||
|
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please fill out the sections below to help others understand our software. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Describe the update
|
||||||
|
placeholder: These things need to be better documented.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: environment
|
||||||
|
attributes:
|
||||||
|
label: Additional Information
|
||||||
|
description: Additional information you want to provide such as tickets related to changes in the software, affected files, screenshots, etc.
|
||||||
|
placeholder: |
|
||||||
|
Add any other context about the update here.
|
||||||
|
- type: checkboxes
|
||||||
|
id: checks
|
||||||
|
attributes:
|
||||||
|
label: Extra fields
|
||||||
|
options:
|
||||||
|
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
|
||||||
|
required: true
|
||||||
|
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
|
||||||
|
required: true
|
||||||
|
- label: I'd like to work on this issue
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for requesting this update! We will get back to you as soon as possible.
|
||||||
43
.github/ISSUE_TEMPLATE/05-org-task.yml
vendored
Normal file
43
.github/ISSUE_TEMPLATE/05-org-task.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
name: ✅ Organizational task
|
||||||
|
description: Create a task for project organization
|
||||||
|
|
||||||
|
labels: [needs-triage, organization]
|
||||||
|
|
||||||
|
body:
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Please fill out the sections below to get organizational things done. If you have a general idea or question then please use the [discussions](https://github.com/orgs/X11Libre/discussions).
|
||||||
|
- type: textarea
|
||||||
|
id: description
|
||||||
|
attributes:
|
||||||
|
label: Describe the task
|
||||||
|
placeholder: These things need to be done.
|
||||||
|
validations:
|
||||||
|
required: true
|
||||||
|
- type: textarea
|
||||||
|
id: rationale
|
||||||
|
attributes:
|
||||||
|
label: "It should be done because"
|
||||||
|
placeholder: Doing Y is needed for Z.
|
||||||
|
- type: textarea
|
||||||
|
id: environment
|
||||||
|
attributes:
|
||||||
|
label: Additional Information
|
||||||
|
description: Additional information you want to provide such as the context for bigger tasks, the implicatons on existing workflows, related issues, etc.
|
||||||
|
placeholder: |
|
||||||
|
Add any other context about the task here.
|
||||||
|
- type: checkboxes
|
||||||
|
id: checks
|
||||||
|
attributes:
|
||||||
|
label: Extra fields
|
||||||
|
options:
|
||||||
|
- label: I have checked the existing [issues](https://github.com/X11Libre/xf86-input-evdev/issues)
|
||||||
|
required: true
|
||||||
|
- label: I have read the [Contributing Guidelines](https://github.com/X11Libre/xserver/blob/master/CONTRIBUTING.md)
|
||||||
|
required: true
|
||||||
|
- label: I'd like to work on this issue
|
||||||
|
- type: markdown
|
||||||
|
attributes:
|
||||||
|
value: |
|
||||||
|
Thanks for adding this task! We will get back to you as soon as possible.
|
||||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: XLibre Community Support
|
||||||
|
url: https://github.com/orgs/X11Libre/discussions
|
||||||
|
about: Please ask and answer questions here.
|
||||||
|
- name: Mailing List
|
||||||
|
url: https://www.freelists.org/list/xlibre
|
||||||
|
about: You can join the discussions on our mailing list.
|
||||||
50
.github/workflows/build.yml
vendored
Normal file
50
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
ubuntu:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
xserver-version: [ master, xlibre-xserver-25.1.0, xlibre-xserver-25.0.0.18 ]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: X11Libre/action-build-driver/target/ubuntu@v0.3.7
|
||||||
|
with:
|
||||||
|
xserver-version: ${{ matrix.xserver-version }}
|
||||||
|
|
||||||
|
freebsd:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
xserver-version: [ master, xlibre-xserver-25.1.0, xlibre-xserver-25.0.0.18 ]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: X11Libre/action-build-driver/target/freebsd@v0.3.7
|
||||||
|
with:
|
||||||
|
xserver-version: ${{ matrix.xserver-version }}
|
||||||
|
|
||||||
|
dragonfly:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
# xlibre-xserver-25.0.x not compiling on dragonfly yet
|
||||||
|
xserver-version: [ master, xlibre-xserver-25.1.0 ]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: X11Libre/action-build-driver/target/dragonfly@v0.3.7
|
||||||
|
with:
|
||||||
|
xserver-version: ${{ matrix.xserver-version }}
|
||||||
|
|
||||||
|
# Not supported on NetBSD
|
||||||
|
|
||||||
|
release-notes:
|
||||||
|
name: Release pushed tag
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
if: ${{ startsWith(github.ref, 'refs/tags/xlibre-') }}
|
||||||
|
needs: [ ubuntu, freebsd, dragonfly ]
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
steps:
|
||||||
|
- uses: X11Libre/action-build-driver/release@v0.3.7
|
||||||
75
.gitignore
vendored
75
.gitignore
vendored
@@ -1,25 +1,80 @@
|
|||||||
Makefile
|
#
|
||||||
Makefile.in
|
# X.Org module default exclusion patterns
|
||||||
ChangeLog
|
# The next section if for module specific patterns
|
||||||
xf86-input-evdev-*.tar.bz2
|
#
|
||||||
xf86-input-evdev-*.tar.gz
|
# Do not edit the following section
|
||||||
*.la
|
# GNU Build System (Autotools)
|
||||||
*.lo
|
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
autom4te.cache
|
autom4te.cache/
|
||||||
|
autoscan.log
|
||||||
|
ChangeLog
|
||||||
compile
|
compile
|
||||||
config.guess
|
config.guess
|
||||||
config.h
|
config.h
|
||||||
config.h.in
|
config.h.in
|
||||||
config.log
|
config.log
|
||||||
|
config-ml.in
|
||||||
|
config.py
|
||||||
config.status
|
config.status
|
||||||
|
config.status.lineno
|
||||||
config.sub
|
config.sub
|
||||||
configure
|
configure
|
||||||
|
configure.scan
|
||||||
depcomp
|
depcomp
|
||||||
|
.deps/
|
||||||
|
INSTALL
|
||||||
install-sh
|
install-sh
|
||||||
|
.libs/
|
||||||
libtool
|
libtool
|
||||||
|
libtool.m4
|
||||||
ltmain.sh
|
ltmain.sh
|
||||||
|
lt~obsolete.m4
|
||||||
|
ltoptions.m4
|
||||||
|
ltsugar.m4
|
||||||
|
ltversion.m4
|
||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
mdate-sh
|
||||||
missing
|
missing
|
||||||
stamp-h1
|
mkinstalldirs
|
||||||
.*.swp
|
*.pc
|
||||||
|
py-compile
|
||||||
|
stamp-h?
|
||||||
|
symlink-tree
|
||||||
|
texinfo.tex
|
||||||
|
ylwrap
|
||||||
|
|
||||||
|
# Do not edit the following section
|
||||||
|
# Edit Compile Debug Document Distribute
|
||||||
*~
|
*~
|
||||||
|
*.[0-9]
|
||||||
|
*.[0-9]x
|
||||||
|
*.bak
|
||||||
|
*.bin
|
||||||
|
core
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
*-ISO*.bdf
|
||||||
|
*-JIS*.bdf
|
||||||
|
*-KOI8*.bdf
|
||||||
|
*.kld
|
||||||
|
*.ko
|
||||||
|
*.ko.cmd
|
||||||
|
*.lai
|
||||||
|
*.l[oa]
|
||||||
|
*.[oa]
|
||||||
|
*.obj
|
||||||
|
*.patch
|
||||||
|
*.so
|
||||||
|
*.pcf.gz
|
||||||
|
*.pdb
|
||||||
|
*.tar.bz2
|
||||||
|
*.tar.gz
|
||||||
|
#
|
||||||
|
# Add & Override patterns for xf86-input-evdev
|
||||||
|
#
|
||||||
|
# Edit the following section as needed
|
||||||
|
# For example, !report.pc overrides *.pc. See 'man gitignore'
|
||||||
|
#
|
||||||
|
man/evdev.4
|
||||||
|
man/evdev.man
|
||||||
|
|||||||
40
10-evdev.conf
Normal file
40
10-evdev.conf
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# Catch-all evdev loader for udev-based systems
|
||||||
|
# We don't simply match on any device since that also adds accelerometers
|
||||||
|
# and other devices that we don't really want to use. The list below
|
||||||
|
# matches everything but joysticks.
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev pointer catchall"
|
||||||
|
MatchIsPointer "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev keyboard catchall"
|
||||||
|
MatchIsKeyboard "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev touchpad catchall"
|
||||||
|
MatchIsTouchpad "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev tablet catchall"
|
||||||
|
MatchIsTablet "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev touchscreen catchall"
|
||||||
|
MatchIsTouchscreen "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
73
COPYING
73
COPYING
@@ -1,12 +1,69 @@
|
|||||||
This is a stub file. This package has not yet had its complete licensing
|
Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
||||||
information compiled. Please see the individual source files for details on
|
Copyright 1993 by David Dawes <dawes@xfree86.org>
|
||||||
your rights to use and modify this software.
|
Copyright 2002 by SuSE Linux AG, Author: Egbert Eich
|
||||||
|
Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||||
|
Copyright 2002 by Paul Elliott
|
||||||
|
Copyright © 2008 University of South Australia
|
||||||
|
Copyright 2008 by Chris Salch
|
||||||
|
Copyright © 2008 Red Hat, Inc.
|
||||||
|
|
||||||
Please submit updated COPYING files to the Xorg bugzilla:
|
Permission to use, copy, modify, distribute, and sell this software
|
||||||
|
and its documentation for any purpose is hereby granted without
|
||||||
|
fee, provided that the above copyright notice appear in all copies
|
||||||
|
and that both that copyright notice and this permission notice
|
||||||
|
appear in supporting documentation, and that the name of the authors
|
||||||
|
not be used in advertising or publicity pertaining to distribution of the
|
||||||
|
software without specific, written prior permission. The authors make no
|
||||||
|
representations about the suitability of this software for any
|
||||||
|
purpose. It is provided "as is" without express or implied
|
||||||
|
warranty.
|
||||||
|
|
||||||
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
|
THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
|
NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
All licensing questions regarding this software should be directed at the
|
Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||||
Xorg mailing list:
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||||
|
and/or sell copies of the Software, and to permit persons to whom the
|
||||||
|
Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||||
|
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
|
DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
Copyright 2005 Adam Jackson.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||||
|
license, and/or sell copies of the Software, and to permit persons to whom
|
||||||
|
the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
http://lists.freedesktop.org/mailman/listinfo/xorg
|
|
||||||
|
|||||||
20
Makefile.am
20
Makefile.am
@@ -18,16 +18,24 @@
|
|||||||
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign
|
|
||||||
|
# During distcheck, system locations (as provided by pkg-config) may
|
||||||
|
# not be writable; provide instead relative locations.
|
||||||
|
DISTCHECK_CONFIGURE_FLAGS = --with-xorg-module-dir='$${libdir}/xorg/modules'
|
||||||
|
|
||||||
SUBDIRS = src man
|
SUBDIRS = src man
|
||||||
|
MAINTAINERCLEANFILES = ChangeLog INSTALL
|
||||||
|
|
||||||
EXTRA_DIST=ChangeLog
|
dist_xorgconf_DATA = 10-evdev.conf
|
||||||
|
|
||||||
CLEANFILES=ChangeLog
|
.PHONY: ChangeLog INSTALL
|
||||||
|
|
||||||
.PHONY: ChangeLog
|
INSTALL:
|
||||||
|
$(INSTALL_CMD)
|
||||||
|
|
||||||
ChangeLog:
|
ChangeLog:
|
||||||
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
|
$(CHANGELOG_CMD)
|
||||||
|
|
||||||
dist-hook: ChangeLog
|
dist-hook: ChangeLog INSTALL
|
||||||
|
|
||||||
|
EXTRA_DIST = README.md
|
||||||
|
|||||||
8
README.md
Normal file
8
README.md
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
xf86-input-evdev - Generic Linux input driver for the XLibre X server
|
||||||
|
---------------------------------------------------------------------
|
||||||
|
|
||||||
|
The primary development code repository can be found at:
|
||||||
|
|
||||||
|
https://github.com/X11Libre/xf86-input-evdev
|
||||||
|
|
||||||
|
Please submit bug reports and requests to merge patches there.
|
||||||
13
autogen.sh
13
autogen.sh
@@ -1,12 +1,17 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
srcdir=`dirname $0`
|
srcdir=`dirname "$0"`
|
||||||
test -z "$srcdir" && srcdir=.
|
test -z "$srcdir" && srcdir=.
|
||||||
|
|
||||||
ORIGDIR=`pwd`
|
ORIGDIR=`pwd`
|
||||||
cd $srcdir
|
cd "$srcdir"
|
||||||
|
|
||||||
autoreconf -v --install || exit 1
|
autoreconf -v --install || exit 1
|
||||||
cd $ORIGDIR || exit $?
|
cd "$ORIGDIR" || exit $?
|
||||||
|
|
||||||
$srcdir/configure --enable-maintainer-mode "$@"
|
git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
|
||||||
|
git config --local format.subjectPrefix "PATCH xf86-input-evdev"
|
||||||
|
|
||||||
|
if test -z "$NOCONFIGURE"; then
|
||||||
|
exec "$srcdir"/configure "$@"
|
||||||
|
fi
|
||||||
|
|||||||
90
configure.ac
90
configure.ac
@@ -20,74 +20,46 @@
|
|||||||
#
|
#
|
||||||
# Process this file with autoconf to produce a configure script
|
# Process this file with autoconf to produce a configure script
|
||||||
|
|
||||||
AC_PREREQ(2.57)
|
# Initialize Autoconf
|
||||||
AC_INIT([xf86-input-evdev],
|
AC_PREREQ([2.60])
|
||||||
1.2.0,
|
AC_INIT([xlibre-xf86-input-evdev],
|
||||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
[25.0.0],
|
||||||
xf86-input-evdev)
|
[https://github.com/X11Libre/xf86-input-evdev/issues],
|
||||||
|
[xlibre-xf86-input-evdev])
|
||||||
AC_CONFIG_SRCDIR([Makefile.am])
|
AC_CONFIG_SRCDIR([Makefile.am])
|
||||||
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CONFIG_AUX_DIR(.)
|
AC_CONFIG_AUX_DIR(.)
|
||||||
AM_INIT_AUTOMAKE([dist-bzip2])
|
|
||||||
|
|
||||||
AM_MAINTAINER_MODE
|
# Initialize Automake
|
||||||
|
AM_INIT_AUTOMAKE([foreign dist-xz])
|
||||||
|
|
||||||
DRIVER_NAME=evdev
|
# Initialize libtool
|
||||||
AC_SUBST([DRIVER_NAME])
|
|
||||||
|
|
||||||
AM_CONFIG_HEADER([config.h])
|
|
||||||
|
|
||||||
# Checks for programs.
|
|
||||||
AC_DISABLE_STATIC
|
AC_DISABLE_STATIC
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
AC_PROG_CC
|
|
||||||
|
|
||||||
AH_TOP([#include "xorg-server.h"])
|
# Initialize X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
|
||||||
|
m4_ifndef([XORG_MACROS_VERSION],
|
||||||
|
[m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
|
||||||
|
XORG_MACROS_VERSION(1.8)
|
||||||
|
XORG_DEFAULT_OPTIONS
|
||||||
|
|
||||||
#AC_DEFINE(XFree86LOADER,1,[Stub define for loadable drivers])
|
# Obtain compiler/linker options from server and required extensions
|
||||||
#
|
PKG_CHECK_MODULES(XORG, [xorg-server >= 25.0.0] xproto [inputproto >= 2.1.99.3])
|
||||||
#AC_ARG_ENABLE(XINPUT, AS_HELP_STRING([--enable-xinput],
|
PKG_CHECK_MODULES(UDEV, libudev,
|
||||||
# [Build XInput support (default: yes)]),
|
[HAVE_UDEV=yes], [HAVE_UDEV=no])
|
||||||
# [XINPUT=$enableval],[XINPUT=yes])
|
AS_IF([test "$HAVE_UDEV" = "yes"],
|
||||||
#AM_CONDITIONAL(XINPUT, test "x$XINPUT" = "xyes")
|
[AC_DEFINE([HAVE_LIBUDEV], [1], [Define if libudev is available])])
|
||||||
#if test "x$XINPUT" = "xyes" ; then
|
|
||||||
# AC_DEFINE(XINPUT,1,[Enable XInput support])
|
|
||||||
#fi
|
|
||||||
#
|
|
||||||
#AC_ARG_ENABLE(XKB, AS_HELP_STRING([--enable-xkb],
|
|
||||||
# [Build XKB support (default: yes)]),
|
|
||||||
# [XKB=$enableval],[XKB=yes])
|
|
||||||
#AM_CONDITIONAL(XKB, test "x$XKB" = "xyes")
|
|
||||||
#if test "x$XKB" = "xyes" ; then
|
|
||||||
# AC_DEFINE(XKB,1,[Enable XKB support])
|
|
||||||
#fi
|
|
||||||
|
|
||||||
AC_ARG_WITH(xorg-module-dir,
|
PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
|
||||||
AC_HELP_STRING([--with-xorg-module-dir=DIR],
|
PKG_CHECK_MODULES(MTDEV, mtdev)
|
||||||
[Default xorg module directory [[default=$libdir/xorg/modules]]]),
|
|
||||||
[moduledir="$withval"],
|
|
||||||
[moduledir="$libdir/xorg/modules"])
|
|
||||||
inputdir=${moduledir}/input
|
|
||||||
AC_SUBST(inputdir)
|
|
||||||
|
|
||||||
# Checks for extensions
|
# Define a configure option for an alternate input module directory
|
||||||
#XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
|
PKG_PROG_PKG_CONFIG([0.25])
|
||||||
XORG_DRIVER_CHECK_EXT(XKB, kbproto)
|
xlibre_input_drivers_dir=`$PKG_CONFIG --variable=input_drivers_dir xlibre-server`
|
||||||
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
|
AC_SUBST(xlibre_input_drivers_dir)
|
||||||
|
|
||||||
# Checks for pkg-config packages
|
xorgconfdir=`$PKG_CONFIG --variable=sysconfigdir xorg-server`
|
||||||
PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES)
|
AC_SUBST(xorgconfdir)
|
||||||
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
|
|
||||||
|
|
||||||
CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src'
|
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile man/evdev.man])
|
||||||
AC_SUBST([CFLAGS])
|
AC_OUTPUT
|
||||||
|
|
||||||
# Checks for libraries.
|
|
||||||
|
|
||||||
# Checks for header files.
|
|
||||||
AC_HEADER_STDC
|
|
||||||
|
|
||||||
XORG_MANPAGE_SECTIONS
|
|
||||||
XORG_RELEASE_VERSION
|
|
||||||
|
|
||||||
AC_OUTPUT([Makefile src/Makefile man/Makefile])
|
|
||||||
|
|||||||
92
include/evdev-properties.h
Normal file
92
include/evdev-properties.h
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2008 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software
|
||||||
|
* and its documentation for any purpose is hereby granted without
|
||||||
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
|
* and that both that copyright notice and this permission notice
|
||||||
|
* appear in supporting documentation, and that the name of Red Hat
|
||||||
|
* not be used in advertising or publicity pertaining to distribution
|
||||||
|
* of the software without specific, written prior permission. Red
|
||||||
|
* Hat makes no representations about the suitability of this software
|
||||||
|
* for any purpose. It is provided "as is" without express or implied
|
||||||
|
* warranty.
|
||||||
|
*
|
||||||
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
|
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Peter Hutterer (peter.hutterer@redhat.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _EVDEV_PROPERTIES_H_
|
||||||
|
#define _EVDEV_PROPERTIES_H_
|
||||||
|
|
||||||
|
/* Middle mouse button emulation */
|
||||||
|
/* BOOL */
|
||||||
|
#define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
|
||||||
|
/* CARD32 */
|
||||||
|
#define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
|
||||||
|
/* CARD8 */
|
||||||
|
#define EVDEV_PROP_MIDBUTTON_BUTTON "Evdev Middle Button Button"
|
||||||
|
|
||||||
|
/* Wheel emulation */
|
||||||
|
/* BOOL */
|
||||||
|
#define EVDEV_PROP_WHEEL "Evdev Wheel Emulation"
|
||||||
|
/* CARD8, 4 values [x up, x down, y up, y down], 0 to disable a value*/
|
||||||
|
#define EVDEV_PROP_WHEEL_AXES "Evdev Wheel Emulation Axes"
|
||||||
|
/* CARD16 */
|
||||||
|
#define EVDEV_PROP_WHEEL_INERTIA "Evdev Wheel Emulation Inertia"
|
||||||
|
/* CARD16 */
|
||||||
|
#define EVDEV_PROP_WHEEL_TIMEOUT "Evdev Wheel Emulation Timeout"
|
||||||
|
/* CARD8, value range 0-32, 0 to always scroll */
|
||||||
|
#define EVDEV_PROP_WHEEL_BUTTON "Evdev Wheel Emulation Button"
|
||||||
|
|
||||||
|
/* Drag lock */
|
||||||
|
/* CARD8, either 1 value or pairs, value range 0-32, 0 to disable a value*/
|
||||||
|
#define EVDEV_PROP_DRAGLOCK "Evdev Drag Lock Buttons"
|
||||||
|
|
||||||
|
/* Axis inversion */
|
||||||
|
/* BOOL, 2 values [x, y], 1 inverts axis */
|
||||||
|
#define EVDEV_PROP_INVERT_AXES "Evdev Axis Inversion"
|
||||||
|
|
||||||
|
/* Run-time calibration */
|
||||||
|
/* CARD32, 4 values [minx, maxx, miny, maxy], or no values for unset */
|
||||||
|
#define EVDEV_PROP_CALIBRATION "Evdev Axis Calibration"
|
||||||
|
|
||||||
|
/* Swap x and y axis. */
|
||||||
|
/* BOOL */
|
||||||
|
#define EVDEV_PROP_SWAP_AXES "Evdev Axes Swap"
|
||||||
|
|
||||||
|
/* BOOL */
|
||||||
|
#define EVDEV_PROP_THIRDBUTTON "Evdev Third Button Emulation"
|
||||||
|
/* CARD32 */
|
||||||
|
#define EVDEV_PROP_THIRDBUTTON_TIMEOUT "Evdev Third Button Emulation Timeout"
|
||||||
|
/* CARD8 */
|
||||||
|
#define EVDEV_PROP_THIRDBUTTON_BUTTON "Evdev Third Button Emulation Button"
|
||||||
|
/* CARD32 */
|
||||||
|
#define EVDEV_PROP_THIRDBUTTON_THRESHOLD "Evdev Third Button Emulation Threshold"
|
||||||
|
|
||||||
|
/* CARD8, 1 value,
|
||||||
|
This property is initialized on devices that have multimedia keys on the
|
||||||
|
function keys. The value of the property selects the default behaviour
|
||||||
|
for the function keys. The behaviour of the fn key (if any exists) is
|
||||||
|
hardware specific. On some hardware, fn may toggle the other set of
|
||||||
|
functions available on the keys.
|
||||||
|
|
||||||
|
0 send functions keys by default, fn may toggle to multimedia keys
|
||||||
|
1 send multimedia keys by default, fn may toggle to function keys
|
||||||
|
*/
|
||||||
|
#define EVDEV_PROP_FUNCTION_KEYS "Evdev Function Keys"
|
||||||
|
|
||||||
|
/* Smooth scroll */
|
||||||
|
/* INT32, 3 values (vertical, horizontal, dial) */
|
||||||
|
#define EVDEV_PROP_SCROLL_DISTANCE "Evdev Scrolling Distance"
|
||||||
|
|
||||||
|
#endif
|
||||||
3
man/.gitignore
vendored
3
man/.gitignore
vendored
@@ -1,3 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
evdev.4
|
|
||||||
@@ -1,59 +1,7 @@
|
|||||||
# $Id$
|
|
||||||
#
|
|
||||||
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
|
||||||
#
|
|
||||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
|
||||||
# documentation for any purpose is hereby granted without fee, provided that
|
|
||||||
# the above copyright notice appear in all copies and that both that
|
|
||||||
# copyright notice and this permission notice appear in supporting
|
|
||||||
# documentation.
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included
|
|
||||||
# in all copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
||||||
# IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
||||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
||||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
||||||
# OTHER DEALINGS IN THE SOFTWARE.
|
|
||||||
#
|
|
||||||
# Except as contained in this notice, the name of the copyright holders shall
|
|
||||||
# not be used in advertising or otherwise to promote the sale, use or
|
|
||||||
# other dealings in this Software without prior written authorization
|
|
||||||
# from the copyright holders.
|
|
||||||
#
|
|
||||||
|
|
||||||
drivermandir = $(DRIVER_MAN_DIR)
|
drivermandir = $(DRIVER_MAN_DIR)
|
||||||
|
driverman_DATA = evdev.$(DRIVER_MAN_SUFFIX)
|
||||||
driverman_PRE = @DRIVER_NAME@.man
|
|
||||||
|
|
||||||
driverman_DATA = $(driverman_PRE:man=@DRIVER_MAN_SUFFIX@)
|
|
||||||
|
|
||||||
EXTRA_DIST = @DRIVER_NAME@.man
|
|
||||||
|
|
||||||
CLEANFILES = $(driverman_DATA)
|
CLEANFILES = $(driverman_DATA)
|
||||||
|
|
||||||
SED = sed
|
|
||||||
|
|
||||||
# Strings to replace in man pages
|
|
||||||
XORGRELSTRING = @PACKAGE_STRING@
|
|
||||||
XORGMANNAME = X Version 11
|
|
||||||
|
|
||||||
MAN_SUBSTS = \
|
|
||||||
-e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
|
|
||||||
-e 's|__xorgversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \
|
|
||||||
-e 's|__xservername__|Xorg|g' \
|
|
||||||
-e 's|__xconfigfile__|xorg.conf|g' \
|
|
||||||
-e 's|__projectroot__|$(prefix)|g' \
|
|
||||||
-e 's|__appmansuffix__|$(APP_MAN_SUFFIX)|g' \
|
|
||||||
-e 's|__drivermansuffix__|$(DRIVER_MAN_SUFFIX)|g' \
|
|
||||||
-e 's|__adminmansuffix__|$(ADMIN_MAN_SUFFIX)|g' \
|
|
||||||
-e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' \
|
|
||||||
-e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g'
|
|
||||||
|
|
||||||
SUFFIXES = .$(DRIVER_MAN_SUFFIX) .man
|
|
||||||
|
|
||||||
.man.$(DRIVER_MAN_SUFFIX):
|
.man.$(DRIVER_MAN_SUFFIX):
|
||||||
sed $(MAN_SUBSTS) < $< > $@
|
cp $< $@
|
||||||
|
|||||||
337
man/evdev.man
337
man/evdev.man
@@ -1,337 +0,0 @@
|
|||||||
.\" shorthand for double quote that works everywhere.
|
|
||||||
.ds q \N'34'
|
|
||||||
.TH EVDEV __drivermansuffix__ __vendorversion__
|
|
||||||
.SH NAME
|
|
||||||
evdev \- Generic Linux input driver
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.nf
|
|
||||||
.B "Section \*qInputDevice\*q"
|
|
||||||
.BI " Identifier \*q" devname \*q
|
|
||||||
.B " Driver \*qevdev\*q"
|
|
||||||
.BI " Option \*qDevice\*q \*q" devpath \*q
|
|
||||||
\ \ ...
|
|
||||||
.B EndSection
|
|
||||||
.fi
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.B evdev
|
|
||||||
is an __xservername__ input driver for Linux's generic event devices. It
|
|
||||||
therefore supports all input devices that the kernel knows about, including
|
|
||||||
most mice and keyboards.
|
|
||||||
.PP
|
|
||||||
The
|
|
||||||
.B evdev
|
|
||||||
driver can serve as both a pointer and a keyboard input device, and may be
|
|
||||||
used as both the core keyboard and the core pointer. Multiple input devices
|
|
||||||
are supported by multiple instances of this driver, with one Load
|
|
||||||
directive for evdev in the Module section of your __xconfigfile__ for each
|
|
||||||
input device that will use this driver.
|
|
||||||
.PP
|
|
||||||
.SH SUPPORTED HARDWARE
|
|
||||||
In general, any input device that the kernel has a driver for can be accessed
|
|
||||||
through the
|
|
||||||
.B evdev
|
|
||||||
driver. See the Linux kernel documentation for a complete list.
|
|
||||||
.PP
|
|
||||||
.SH CONFIGURATION DETAILS
|
|
||||||
Please refer to __xconfigfile__(__filemansuffix__) for general configuration
|
|
||||||
details and for options that can be used with all input drivers. This
|
|
||||||
section only covers configuration details specific to this driver.
|
|
||||||
.PP
|
|
||||||
.SH BASIC CONFIGURATIONS
|
|
||||||
Most users of this driver will probably be quite happy with the following for
|
|
||||||
all QWERTY keyboards:
|
|
||||||
.PP
|
|
||||||
.nf
|
|
||||||
.B "Section \*qInputDevice\*q"
|
|
||||||
.BI " Identifier \*q" keyboard \*q
|
|
||||||
.B " Driver \*qevdev\*q"
|
|
||||||
.BI " Option \*qevBits\*q \*q" "+1" \*q
|
|
||||||
.BI " Option \*qkeyBits\*q \*q" "~1\-255 ~352\-511" \*q
|
|
||||||
.BI " Option \*qPass\*q \*q" "3" \*q
|
|
||||||
\ \ ...
|
|
||||||
.B EndSection
|
|
||||||
.fi
|
|
||||||
.PP
|
|
||||||
And the following for all mice:
|
|
||||||
.PP
|
|
||||||
.nf
|
|
||||||
.B "Section \*qInputDevice\*q"
|
|
||||||
.BI " Identifier \*q" mouse \*q
|
|
||||||
.B " Driver \*qevdev\*q"
|
|
||||||
.BI " Option \*qevBits\*q \*q" "+1\-2" \*q
|
|
||||||
.BI " Option \*qkeyBits\*q \*q" "~272\-287" \*q
|
|
||||||
.BI " Option \*qrelBits\*q \*q" "~0\-2 ~6 ~8" \*q
|
|
||||||
.BI " Option \*qPass\*q \*q" "3" \*q
|
|
||||||
\ \ ...
|
|
||||||
.B EndSection
|
|
||||||
.fi
|
|
||||||
.PP
|
|
||||||
To understand what those Bits options do, or for more complex
|
|
||||||
configurations, please see
|
|
||||||
.BR "ADVANCED OPTIONS"
|
|
||||||
below.
|
|
||||||
.PP
|
|
||||||
.SH ADVANCED OPTIONS
|
|
||||||
.SS DEVICE SPECIFICATION
|
|
||||||
For this section you'll want to have knowledge of
|
|
||||||
.B glob (7)
|
|
||||||
and our evil
|
|
||||||
.B "BIT MATCHING SPECIFICATION"
|
|
||||||
stuff.
|
|
||||||
.PP
|
|
||||||
The following driver
|
|
||||||
.B Options
|
|
||||||
control what devices are accepted:
|
|
||||||
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qDevice\*q \*q" string \*q
|
|
||||||
Specifies the device note through which the device can be accessed.
|
|
||||||
At this time ONLY
|
|
||||||
.RI /dev/input/event n ,
|
|
||||||
where
|
|
||||||
.I n
|
|
||||||
is an integer, are matched against this this field.
|
|
||||||
.fi
|
|
||||||
This option uses globbing.
|
|
||||||
.fi
|
|
||||||
Please note that use of this option is strongly discouraged.
|
|
||||||
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qName\*q \*q" string \*q
|
|
||||||
Specifies the device name for the device you wish to use.
|
|
||||||
.fi
|
|
||||||
The device name is generally the only consistent identifier for devices
|
|
||||||
that are commonly unplugged and plugged back into different ports.
|
|
||||||
.fi
|
|
||||||
A list of currently plugged in devices and associated device names can be
|
|
||||||
obtained by typing \*qcat /proc/bus/input/devices\*q, the \*qName\*q field
|
|
||||||
is the value you want for this option.
|
|
||||||
.fi
|
|
||||||
This option uses globbing.
|
|
||||||
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qPhys\*q \*q" string \*q
|
|
||||||
Specifies the device phys string for the device you wish to use.
|
|
||||||
.fi
|
|
||||||
The phys string is generally consistent to the USB port a device is plugged
|
|
||||||
into.
|
|
||||||
.fi
|
|
||||||
A list of currently plugged in devices and associated device names can be
|
|
||||||
obtained by typing \*qcat /proc/bus/input/devices\*q, the \*qPhys\*q field
|
|
||||||
is the value you want for this option.
|
|
||||||
.fi
|
|
||||||
This option uses globbing.
|
|
||||||
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*q" map "Bits\*q \*q" "bit specifier" \*q
|
|
||||||
Specifies device capability bits which must be set, possibly set, or unset.
|
|
||||||
.fi
|
|
||||||
.IR map "Bits: Where " map
|
|
||||||
is one of
|
|
||||||
.BR ev ", " key ", " rel ", " abs ,
|
|
||||||
.BR msc ", " led ", " snd ", or " ff .
|
|
||||||
.fi
|
|
||||||
The bit specifier format is a string consisting of
|
|
||||||
.RI + n ", \-" n ", and ~" n
|
|
||||||
space-separated specifiers, where
|
|
||||||
.I n
|
|
||||||
is a positive integer or integer range. (The latter given in the format of 2\-6.)
|
|
||||||
.fi
|
|
||||||
+ specifies bits which must be set.
|
|
||||||
.fi
|
|
||||||
\- specifies bits which must not be set.
|
|
||||||
.fi
|
|
||||||
~ is a little more complex, it specifies that at least one of the bits given
|
|
||||||
with ~ for the field in question must be set, but it doesn't matter how many
|
|
||||||
or which of the bits. (It is actually the most useful of the 3 specifiers.)
|
|
||||||
.fi
|
|
||||||
As an example, \*q+0 +3 \-1\-2 ~5\-10\*q requires bits 0 and 3 be set,
|
|
||||||
bits 1 and 2 to not be set, and at least one bit in the range of 5 to
|
|
||||||
10 be set.
|
|
||||||
.fi
|
|
||||||
An annoyingly formatted set of bitmasks for your devices can be obtained
|
|
||||||
by typing \*qcat /proc/bus/input/devices\*q, and
|
|
||||||
.B /usr/include/linux/input.h
|
|
||||||
should contain the defines which declare what bits are what for each field.
|
|
||||||
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qbustype\*q \*q" n \*q
|
|
||||||
Specifies the bus ID for the device you wish to use.
|
|
||||||
.fi
|
|
||||||
This is either 0 (the default, matches anything), or the
|
|
||||||
.BI Bus= n
|
|
||||||
field in
|
|
||||||
.B /proc/bus/input/devices
|
|
||||||
for your device.
|
|
||||||
.fi
|
|
||||||
This value depends on what type of bus your device is connected to.
|
|
||||||
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qvendor\*q \*q" n \*q
|
|
||||||
Specifies the vendor ID for the device you wish to use.
|
|
||||||
.fi
|
|
||||||
This is either 0 (the default, matches anything), or the
|
|
||||||
.BI Vendor= n
|
|
||||||
field in
|
|
||||||
.B /proc/bus/input/devices
|
|
||||||
for your device.
|
|
||||||
.fi
|
|
||||||
This value should remain constant barring perhaps firmware updates to the
|
|
||||||
device itself.
|
|
||||||
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qversion\*q \*q" n \*q
|
|
||||||
Specifies the version for the device you wish to use.
|
|
||||||
.fi
|
|
||||||
This is either 0 (the default, matches anything), or the
|
|
||||||
.BI Version= n
|
|
||||||
field in
|
|
||||||
.B /proc/bus/input/devices
|
|
||||||
for your device.
|
|
||||||
.fi
|
|
||||||
This value should remain constant barring perhaps firmware updates to the
|
|
||||||
device itself.
|
|
||||||
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qproduct\*q \*q" n \*q
|
|
||||||
Specifies the product ID for the device you wish to use.
|
|
||||||
.fi
|
|
||||||
This is either 0 (the default, matches anything), or the
|
|
||||||
.BI Product= n
|
|
||||||
field in
|
|
||||||
.B /proc/bus/input/devices
|
|
||||||
for your device.
|
|
||||||
.fi
|
|
||||||
This value should remain constant barring perhaps firmware updates to the
|
|
||||||
device itself.
|
|
||||||
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qPass\*q \*q" n \*q
|
|
||||||
Specifies the order in which evdev will scan for devices.
|
|
||||||
.fi
|
|
||||||
This is in the range of 0 to 3, and is used for the case
|
|
||||||
where more then one evdev input section matches the same device.
|
|
||||||
.fi
|
|
||||||
An input section with a lower pass number will always beat out
|
|
||||||
one with a higher pass number. Order when both sections are
|
|
||||||
the same number is undefined.
|
|
||||||
.fi
|
|
||||||
The default is 0.
|
|
||||||
|
|
||||||
|
|
||||||
.PP
|
|
||||||
.SS RELATIVE AXIS CONFIGURATION
|
|
||||||
The relative axis portion of this driver handle all reported relative axes.
|
|
||||||
.fi
|
|
||||||
The axes are named X, Y, Z, RX, RY, RZ, HWHEEL, DIAL, WHEEL, MISC, 10, 11,
|
|
||||||
12, 13, 14, and 15.
|
|
||||||
.fi
|
|
||||||
The axes are reported to X as valuators, with the default mapping of axes
|
|
||||||
to valuators being the first axes found to the first valuator, the second
|
|
||||||
found to the second valuator, and so on, so that if you have axes X, Y,
|
|
||||||
HWHEEL, and WHEEL, you would have X=0, Y=1, HWHEEL=2, WHEEL=3.
|
|
||||||
.fi
|
|
||||||
If the driver is reporting core events, valuators 0 and 1 are always mapped
|
|
||||||
to x and y coordinates, respectively.
|
|
||||||
.fi
|
|
||||||
The following driver
|
|
||||||
.B Options
|
|
||||||
control the relative axis portion of the driver:
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*q" axis "RelativeAxisMap\*q \*q" n \*q
|
|
||||||
This remaps the axis specified to the specified valuator.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*q" axis "RelativeAxisButtons\*q \*q" "n n" \*q
|
|
||||||
This remaps the axis specified to the specified buttons.
|
|
||||||
.fi
|
|
||||||
Note that the physical buttons are always remapped around \*qfake\*q buttons
|
|
||||||
created by this option, so that if you have physical buttons 1 2 3 4 5,
|
|
||||||
and map the Wheel axis to buttons 4 5, you get buttons 1 2 3
|
|
||||||
.B 4 5
|
|
||||||
6 7, with buttons 6 and 7 being physical buttons 4 and 5.
|
|
||||||
.PP
|
|
||||||
.SS ABSOLUTE AXIS CONFIGURATION
|
|
||||||
The relative axis portion of this driver handle all reported relative axes.
|
|
||||||
.fi
|
|
||||||
The axes are named X, Y, Z, RX, RY, RZ, THROTTLE, RUDDER, WHEEL, GAS, BRAKE,
|
|
||||||
<11\-15>, HAT0X, HAT0Y, HAT1X, HAT1Y, HAT2X, HAT2Y, HAT3X, HAT3Y, PRESSURE,
|
|
||||||
TILT_X, TILT_Y, TOOL_WIDTH, VOLUME, <29\-39>, MISC, <41\-62>.
|
|
||||||
.fi
|
|
||||||
The axes are reported to X as valuators, with the default mapping of axes
|
|
||||||
to valuators being the first axes found to the first valuator, the second
|
|
||||||
found to the second valuator, and so on, so that if you have axes X, Y,
|
|
||||||
TILT_X, and TILT_Y, you would have X=0, Y=1, TILT_X=2, TILT_Y=3.
|
|
||||||
.fi
|
|
||||||
If the driver is reporting core events, valuators 0 and 1 are always mapped
|
|
||||||
to x and y coordinates, respectively.
|
|
||||||
.fi
|
|
||||||
The following driver
|
|
||||||
.B Options
|
|
||||||
control the relative axis portion of the driver:
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*q" axis "AbsoluteAxisMap\*q \*q" n \*q
|
|
||||||
This remaps the axis specified to the specified valuator.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qAbsoluteScreen\*q \*q" n \*q
|
|
||||||
This binds the device to a specific screen, scaling it to
|
|
||||||
the coordinate space of that screen.
|
|
||||||
.fi
|
|
||||||
The number can either be \-1, or a valid screen number.
|
|
||||||
.fi
|
|
||||||
If \-1 or if in relative mode no scaling or screen fixing is done.
|
|
||||||
.fi
|
|
||||||
This is of most use for digitizers, where the screen and the input
|
|
||||||
device are the same surface.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qMode\*q \*q" mode \*q
|
|
||||||
This selects the default mode for the device.
|
|
||||||
.fi
|
|
||||||
Valid values are \*qabsolute\*q and \*qrelative\*q.
|
|
||||||
.fi
|
|
||||||
This can be set at run time per actual device with the xinput utility.
|
|
||||||
.PP
|
|
||||||
.SS BUTTON CONFIGURATION
|
|
||||||
At the moment, the button portion of this driver only handles buttons
|
|
||||||
reported as mouse buttons, that is from BTN_MOUSE to BTN_JOYSTICK \- 1.
|
|
||||||
.fi
|
|
||||||
At this time there are no configuration options for buttons.
|
|
||||||
.SS KEYBOARD CONFIGURATION
|
|
||||||
The keyboard portion of this driver handles all keys reported and requires
|
|
||||||
XKB support.
|
|
||||||
.fi
|
|
||||||
The following driver
|
|
||||||
.B Options
|
|
||||||
control the relative axis portion of the driver:
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qXkbRules\*q \*q" rules \*q
|
|
||||||
specifies which XKB rules file to use for interpreting the
|
|
||||||
.BR XkbModel ,
|
|
||||||
.BR XkbLayout ,
|
|
||||||
.BR XkbVariant ,
|
|
||||||
and
|
|
||||||
.B XkbOptions
|
|
||||||
settings. Default: \*qxorg\*q for most platforms, but \*qxfree98\*q for the
|
|
||||||
Japanese PC-98 platforms.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qXkbModel\*q \*q" modelname \*q
|
|
||||||
specifies the XKB keyboard model name. Default: \*qevdev\*q.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qXkbLayout\*q \*q" layoutname \*q
|
|
||||||
specifies the XKB keyboard layout name. This is usually the country or
|
|
||||||
language type of the keyboard. Default: \*qus\*q.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qXkbVariant\*q \*q" variants \*q
|
|
||||||
specifies the XKB keyboard variant components. These can be used to
|
|
||||||
enhance the keyboard layout details. Default: not set.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qXkbOptions\*q \*q" options \*q
|
|
||||||
specifies the XKB keyboard option components. These can be used to
|
|
||||||
enhance the keyboard behaviour. Default: not set.
|
|
||||||
|
|
||||||
.PP
|
|
||||||
.SH AUTHORS
|
|
||||||
Zephaniah E. Hull.
|
|
||||||
.fi
|
|
||||||
Kristian H\(/ogsberg.
|
|
||||||
.SH "SEE ALSO"
|
|
||||||
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__).
|
|
||||||
369
man/evdev.man.in
Normal file
369
man/evdev.man.in
Normal file
@@ -0,0 +1,369 @@
|
|||||||
|
.\" shorthand for double quote that works everywhere.
|
||||||
|
.ds q \N'34'
|
||||||
|
.TH EVDEV @DRIVER_MAN_SUFFIX@ 2016-11-17 "@PACKAGE_STRING@" "X Version 11"
|
||||||
|
.SH NAME
|
||||||
|
evdev \- Generic Linux input driver for XLibre
|
||||||
|
.SH SYNOPSIS
|
||||||
|
.nf
|
||||||
|
.B "Section \*qInputDevice\*q"
|
||||||
|
.BI " Identifier \*q" devname \*q
|
||||||
|
.B " Driver \*qevdev\*q"
|
||||||
|
.BI " Option \*qDevice\*q \*q" devpath \*q
|
||||||
|
.BI " Option \*qEmulate3Buttons\*q \*q" True \*q
|
||||||
|
.BI " Option \*qEmulate3Timeout\*q \*q" 50 \*q
|
||||||
|
.BI " Option \*qGrabDevice\*q \*q" False \*q
|
||||||
|
\ \ ...
|
||||||
|
.B EndSection
|
||||||
|
.fi
|
||||||
|
.SH DESCRIPTION
|
||||||
|
.B evdev
|
||||||
|
is an XLibre input driver for Linux\'s generic event devices.
|
||||||
|
It therefore supports all input devices that the kernel knows about,
|
||||||
|
including most mice, keyboards, tablets, and touchscreens.
|
||||||
|
.B evdev
|
||||||
|
is the default driver on the major Linux distributions.
|
||||||
|
.PP
|
||||||
|
The
|
||||||
|
.B evdev
|
||||||
|
driver can serve as both a pointer and a keyboard input device.
|
||||||
|
Multiple input devices are supported by multiple instances of this driver,
|
||||||
|
with one InputDevice section of your xorg.conf for each input device
|
||||||
|
that will use this driver.
|
||||||
|
.PP
|
||||||
|
It is recommended that
|
||||||
|
.B evdev
|
||||||
|
devices are configured through the
|
||||||
|
.B InputClass
|
||||||
|
directive (refer to
|
||||||
|
.BR xorg.conf (__filemansuffix__))
|
||||||
|
instead of manual per-device configuration.
|
||||||
|
Devices configured in the
|
||||||
|
.BR xorg.conf (__filemansuffix__)
|
||||||
|
are not hot-plug capable.
|
||||||
|
.SH SUPPORTED HARDWARE
|
||||||
|
In general, any input device that the kernel has a driver for can be accessed
|
||||||
|
through the
|
||||||
|
.B evdev
|
||||||
|
driver.
|
||||||
|
See the Linux kernel documentation for a complete list.
|
||||||
|
.SH CONFIGURATION DETAILS
|
||||||
|
Please refer to
|
||||||
|
.BR xorg.conf (__filemansuffix__)
|
||||||
|
for general configuration details and
|
||||||
|
for options that can be used with all input drivers.
|
||||||
|
This section only covers configuration details specific to this driver.
|
||||||
|
.PP
|
||||||
|
The following driver
|
||||||
|
.B Options
|
||||||
|
are supported:
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qButtonMapping\*q \*q" string \*q
|
||||||
|
Sets the button mapping for this device.
|
||||||
|
The mapping is a space-separated list of button mappings
|
||||||
|
that correspond in order to the physical buttons on the device
|
||||||
|
(i.e. the first number is the mapping for button 1, etc.).
|
||||||
|
The default mapping is "1 2 3 ... 32".
|
||||||
|
A mapping of 0 deactivates the button.
|
||||||
|
Multiple buttons can have the same mapping.
|
||||||
|
For example, a left-handed mouse with deactivated scroll-wheel would use a
|
||||||
|
mapping of "3 2 1 0 0".
|
||||||
|
Invalid mappings are ignored and the default mapping is used.
|
||||||
|
Buttons not specified in the user's mapping use the default mapping.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qDevice\*q \*q" string \*q
|
||||||
|
Specifies the device through which the device can be accessed.
|
||||||
|
This will generally be of the form \*q/dev/input/eventX\*q,
|
||||||
|
where X is some integer.
|
||||||
|
The mapping from device node to hardware is system-dependent.
|
||||||
|
Property: "Device Node" (read-only).
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
|
||||||
|
Sets \*qdrag lock buttons\*q that simulate holding a button down, so
|
||||||
|
that low dexterity people do not have to hold a button down at the
|
||||||
|
same time they move a mouse cursor.
|
||||||
|
Button numbers occur in pairs,
|
||||||
|
with the lock button number occurring first,
|
||||||
|
followed by the button number that is the target of the lock button.
|
||||||
|
Property: "Evdev
|
||||||
|
Drag Lock Buttons".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qDragLockButtons\*q \*q" "M1" \*q
|
||||||
|
Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q
|
||||||
|
indicating that the next button pressed is to be \*qdrag locked\*q.
|
||||||
|
Property: "Evdev Drag Lock Buttons".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q
|
||||||
|
Enable/disable the emulation of the third (middle) mouse button for mice
|
||||||
|
which only have two physical buttons.
|
||||||
|
The third button is emulated by pressing both buttons simultaneously.
|
||||||
|
Default: off.
|
||||||
|
Property: "Evdev Middle Button Emulation".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
|
||||||
|
Sets the timeout (in milliseconds) that the driver waits before deciding
|
||||||
|
if two buttons were pressed "simultaneously" when 3 button emulation is enabled.
|
||||||
|
Default: 50.
|
||||||
|
Property: "Evdev Middle Button Timeout".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulate3Button\*q \*q" integer \*q
|
||||||
|
Specifies the physical button number to be emitted if middle button emulation
|
||||||
|
is triggered.
|
||||||
|
Default: 2.
|
||||||
|
Property: "Evdev Middle Button Button".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateWheel\*q \*q" boolean \*q
|
||||||
|
Enable/disable "wheel" emulation.
|
||||||
|
Wheel emulation means emulating button press/release events
|
||||||
|
when the mouse is moved while a specific real button is pressed.
|
||||||
|
Wheel button events (typically buttons 4 and 5) are usually used for scrolling.
|
||||||
|
Wheel emulation is useful for getting wheel-like behaviour with trackballs.
|
||||||
|
It can also be useful for mice with 4 or more buttons but no wheel.
|
||||||
|
See the description of the
|
||||||
|
.BR EmulateWheelButton ,
|
||||||
|
.BR EmulateWheelInertia ,
|
||||||
|
.BR EmulateWheelTimeout ,
|
||||||
|
.BR XAxisMapping ,
|
||||||
|
and
|
||||||
|
.B YAxisMapping
|
||||||
|
options.
|
||||||
|
Default: off.
|
||||||
|
Property: "Evdev Wheel Emulation".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q
|
||||||
|
Specifies which button must be held down to enable wheel emulation mode.
|
||||||
|
While this button is down, X and/or Y pointer movement will generate button
|
||||||
|
press/release events as specified for the
|
||||||
|
.B XAxisMapping
|
||||||
|
and
|
||||||
|
.B YAxisMapping
|
||||||
|
settings.
|
||||||
|
If the button is 0 and
|
||||||
|
.B EmulateWheel
|
||||||
|
is on, any motion of the device is converted into wheel events.
|
||||||
|
Default: 4.
|
||||||
|
Property: "Evdev Wheel Emulation Button".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateWheelInertia\*q \*q" integer \*q
|
||||||
|
Specifies how far (in pixels) the pointer must move to generate button
|
||||||
|
press/release events in wheel emulation mode.
|
||||||
|
Default: 10.
|
||||||
|
Property: "Evdev Wheel Emulation Inertia".
|
||||||
|
.IP
|
||||||
|
This value must be set for any device does not resemble a standard mouse.
|
||||||
|
Specifically, on absolute devices such as tablets the value should be set to
|
||||||
|
a reasonable fraction of the expected movement to avoid excess scroll events.
|
||||||
|
.IP
|
||||||
|
.B WARNING:
|
||||||
|
the name \*qinertia\*q is a misnomer.
|
||||||
|
This option defines the distance required to generate one scroll event
|
||||||
|
similar to the
|
||||||
|
.B VertScrollDelta
|
||||||
|
and
|
||||||
|
.B HorizScrollDelta
|
||||||
|
options.
|
||||||
|
It does not enable inertia in the physical sense,
|
||||||
|
scrolling stops immediately once the movement has stopped.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
|
||||||
|
Specifies the time in milliseconds the
|
||||||
|
.B EmulateWheelButton
|
||||||
|
must be pressed before wheel emulation is started.
|
||||||
|
If the
|
||||||
|
.B EmulateWheelButton
|
||||||
|
is released before this timeout,
|
||||||
|
the original button press/release event is sent.
|
||||||
|
Default: 200.
|
||||||
|
Property: "Evdev Wheel Emulation Timeout".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateThirdButton\*q \*q" boolean \*q
|
||||||
|
Enable third button emulation.
|
||||||
|
Third button emulation emits a right button event (by default)
|
||||||
|
by pressing and holding the first button.
|
||||||
|
The first button must be held down for the configured timeout and
|
||||||
|
must not move more than the configured threshold for the emulation to activate.
|
||||||
|
Otherwise, the first button event is posted as normal.
|
||||||
|
Default: off.
|
||||||
|
Property: "Evdev Third Button Emulation".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateThirdButtonTimeout\*q \*q" integer \*q
|
||||||
|
Specifies the timeout in milliseconds between the initial button press and
|
||||||
|
the generation of the emulated button event.
|
||||||
|
Default: 1000.
|
||||||
|
Property: "Evdev Third Button Emulation Timeout".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateThirdButtonButton\*q \*q" integer \*q
|
||||||
|
Specifies the physical button number to be emitted if third button emulation
|
||||||
|
is triggered.
|
||||||
|
Default: 3.
|
||||||
|
Property: "Evdev Third Button Button".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateThirdButtonMoveThreshold\*q \*q" integer \*q
|
||||||
|
Specifies the maximum move fuzz in device coordinates for third button
|
||||||
|
emulation.
|
||||||
|
If the device moves by more than this threshold before the third
|
||||||
|
button emulation is triggered, the emulation is cancelled and a first button
|
||||||
|
event is generated as normal.
|
||||||
|
Default: 20.
|
||||||
|
Property: "Evdev Third Button Emulation Threshold".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qGrabDevice\*q \*q" boolean \*q
|
||||||
|
Force a grab on the event device.
|
||||||
|
Doing so will ensure that no other driver
|
||||||
|
can initialise the same device and it will also stop the device from sending
|
||||||
|
events to /dev/kbd or /dev/input/mice.
|
||||||
|
Events from this device will not be sent to virtual devices
|
||||||
|
(e.g. rfkill or the Macintosh mouse button emulation).
|
||||||
|
Default: disabled.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qInvertX\*q \*q" Bool \*q
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qInvertY\*q \*q" Bool \*q
|
||||||
|
Invert the given axis.
|
||||||
|
Default: off.
|
||||||
|
Property: "Evdev Axis Inversion".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qIgnoreRelativeAxes\*q \*q" Bool \*q
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qIgnoreAbsoluteAxes\*q \*q" Bool \*q
|
||||||
|
Ignore the specified type of axis.
|
||||||
|
Default: unset.
|
||||||
|
The X server cannot deal with devices that have both relative and absolute axes.
|
||||||
|
Evdev tries to guess which axes to ignore given the device type and
|
||||||
|
disables absolute axes for mice and relative axes for tablets, touchscreens,
|
||||||
|
and touchpad.
|
||||||
|
These options allow to forcibly disable an axis type.
|
||||||
|
Mouse wheel axes are exempt and will work even if relative axes are ignored.
|
||||||
|
No property, this configuration must be set in the configuration.
|
||||||
|
.br
|
||||||
|
If either option is set to False, the driver will not ignore the specified
|
||||||
|
axes regardless of the presence of other axes.
|
||||||
|
This may trigger buggy behavior and events from this axis are always forwarded.
|
||||||
|
Users are discouraged from setting this option.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qCalibration\*q \*q" "min-x max-x min-y max-y" \*q
|
||||||
|
Calibrates the X and Y axes for devices that need to scale to a different
|
||||||
|
coordinate system than reported to the X server.
|
||||||
|
This feature is required for devices that need to scale to
|
||||||
|
a different coordinate system than originally reported by the kernel
|
||||||
|
(e.g. touchscreens).
|
||||||
|
The scaling to the custom coordinate system is done in-driver and
|
||||||
|
the X server is unaware of the transformation.
|
||||||
|
Property: "Evdev Axis Calibration".
|
||||||
|
.TP 7
|
||||||
|
.B Option \*qMode\*q \*qRelative\*q\fP|\fP\*qAbsolute\*q
|
||||||
|
Sets the mode of the device if device has absolute axes.
|
||||||
|
The default value for touchpads is relative, for other absolute.
|
||||||
|
This option has no effect on devices without absolute axes.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qSwapAxes\*q \*q" Bool \*q
|
||||||
|
Swap x/y axes.
|
||||||
|
Default: off.
|
||||||
|
Property: "Evdev Axes Swap".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q
|
||||||
|
Specifies which buttons are mapped to motion in the X direction in wheel
|
||||||
|
emulation mode.
|
||||||
|
Button number
|
||||||
|
.I N1
|
||||||
|
is mapped to the negative X axis motion and button number
|
||||||
|
.I N2
|
||||||
|
is mapped to the positive X axis motion.
|
||||||
|
Default: no mapping.
|
||||||
|
Property: "Evdev Wheel Emulation Axes".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qYAxisMapping\*q \*q" "N1 N2" \*q
|
||||||
|
Specifies which buttons are mapped to motion in the Y direction in wheel
|
||||||
|
emulation mode.
|
||||||
|
Button number
|
||||||
|
.I N1
|
||||||
|
is mapped to the negative Y axis motion and button number
|
||||||
|
.I N2
|
||||||
|
is mapped to the positive Y axis motion.
|
||||||
|
Default: "4 5".
|
||||||
|
Property: "Evdev Wheel Emulation Axes".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qTypeName\*q" \*q"type"\*q
|
||||||
|
Specify the X Input 1.x type (see
|
||||||
|
.BR XListInputDevices (__libmansuffix__)).
|
||||||
|
There is rarely a need to use this option, evdev will guess the device type
|
||||||
|
based on the device's capabilities.
|
||||||
|
This option is provided for devices that need quirks.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qVertScrollDelta\*q \*q" integer \*q
|
||||||
|
The amount of motion considered one unit of scrolling vertically.
|
||||||
|
Default: "1".
|
||||||
|
Property: "Evdev Scrolling Distance".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qHorizScrollDelta\*q \*q" integer \*q
|
||||||
|
The amount of motion considered one unit of scrolling horizontally.
|
||||||
|
Default: "1".
|
||||||
|
Property: "Evdev Scrolling Distance".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qDialDelta\*q \*q" integer \*q
|
||||||
|
The amount of motion considered one unit of turning the dial.
|
||||||
|
Default: "1".
|
||||||
|
Property: "Evdev Scrolling Distance".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qResolution\*q \*q" integer \*q
|
||||||
|
Sets the resolution of the device in dots per inch.
|
||||||
|
The resolution is used to scale relative motion events from mouse devices to
|
||||||
|
1000 DPI resolution.
|
||||||
|
This can be used to make high resolution mice less sensitive without turning off
|
||||||
|
acceleration.
|
||||||
|
If set to 0 no scaling will be performed.
|
||||||
|
Default: "0".
|
||||||
|
.SH SUPPORTED PROPERTIES
|
||||||
|
The following properties are provided by the
|
||||||
|
.B evdev
|
||||||
|
driver.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Axis Calibration"
|
||||||
|
4 32-bit values, order min-x, max-x, min-y, max-y or 0 values to disable
|
||||||
|
in-driver axis calibration.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Axis Inversion"
|
||||||
|
2 boolean values (8 bit, 0 or 1), order X, Y.
|
||||||
|
1 inverts the axis.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Axes Swap"
|
||||||
|
1 boolean value (8 bit, 0 or 1).
|
||||||
|
1 swaps x/y axes.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Drag Lock Buttons"
|
||||||
|
8-bit. Either 1 value or pairs of values.
|
||||||
|
Value range 0-32, 0 disables a value.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Middle Button Emulation"
|
||||||
|
1 boolean value (8 bit, 0 or 1).
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Middle Button Timeout"
|
||||||
|
1 16-bit positive value.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Middle Button Button"
|
||||||
|
1 8-bit value, allowed range 0-32, 0 disables the button.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Wheel Emulation"
|
||||||
|
1 boolean value (8 bit, 0 or 1).
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Wheel Emulation Axes"
|
||||||
|
4 8-bit values, order X up, X down, Y up, Y down.
|
||||||
|
0 disables a value.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Wheel Emulation Button"
|
||||||
|
1 8-bit value, allowed range 0-32, 0 disables the button.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Wheel Emulation Inertia"
|
||||||
|
1 16-bit positive value.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Wheel Emulation Timeout"
|
||||||
|
1 16-bit positive value.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Scrolling Distance"
|
||||||
|
3 32-bit values: vertical, horizontal and dial.
|
||||||
|
.SH AUTHORS
|
||||||
|
Kristian Høgsberg, Peter Hutterer
|
||||||
|
.SH "SEE ALSO"
|
||||||
|
.BR XLibre (@APP_MAN_SUFFIX@),
|
||||||
|
.BR xorg.conf (@FILE_MAN_SUFFIX@),
|
||||||
|
.BR Xserver (@APP_MAN_SUFFIX@),
|
||||||
|
.BR X (@MISC_MAN_SUFFIX@)
|
||||||
6
src/.gitignore
vendored
6
src/.gitignore
vendored
@@ -1,6 +0,0 @@
|
|||||||
.deps
|
|
||||||
.libs
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
*.la
|
|
||||||
*.lo
|
|
||||||
@@ -24,9 +24,20 @@
|
|||||||
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
|
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
|
||||||
# _ladir passes a dummy rpath to libtool so the thing will actually link
|
# _ladir passes a dummy rpath to libtool so the thing will actually link
|
||||||
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
||||||
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
|
|
||||||
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
|
|
||||||
@DRIVER_NAME@_drv_la_CFLAGS = -Wall
|
|
||||||
@DRIVER_NAME@_drv_ladir = @inputdir@
|
|
||||||
|
|
||||||
@DRIVER_NAME@_drv_la_SOURCES = evdev.c evdev.h evdev_axes.c evdev_btn.c evdev_key.c
|
AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
|
||||||
|
AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBEVDEV_CFLAGS)
|
||||||
|
|
||||||
|
evdev_drv_la_LTLIBRARIES = evdev_drv.la
|
||||||
|
evdev_drv_la_LDFLAGS = -module -avoid-version
|
||||||
|
evdev_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS) $(LIBEVDEV_LIBS)
|
||||||
|
evdev_drv_ladir = @xlibre_input_drivers_dir@
|
||||||
|
|
||||||
|
evdev_drv_la_SOURCES = evdev.c \
|
||||||
|
evdev.h \
|
||||||
|
emuMB.c \
|
||||||
|
emuThird.c \
|
||||||
|
emuWheel.c \
|
||||||
|
draglock.c \
|
||||||
|
apple.c \
|
||||||
|
axis_labels.h
|
||||||
|
|||||||
311
src/apple.c
Normal file
311
src/apple.c
Normal file
@@ -0,0 +1,311 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software
|
||||||
|
* and its documentation for any purpose is hereby granted without
|
||||||
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
|
* and that both that copyright notice and this permission notice
|
||||||
|
* appear in supporting documentation, and that the name of Red Hat
|
||||||
|
* not be used in advertising or publicity pertaining to distribution
|
||||||
|
* of the software without specific, written prior permission. Red
|
||||||
|
* Hat makes no representations about the suitability of this software
|
||||||
|
* for any purpose. It is provided "as is" without express or implied
|
||||||
|
* warranty.
|
||||||
|
*
|
||||||
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
|
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Peter Hutterer (peter.hutterer@redhat.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <evdev.h>
|
||||||
|
#include <evdev-properties.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <exevents.h>
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
|
/* Apple-specific controls.
|
||||||
|
*
|
||||||
|
* On Apple keyboards, the multimedia function keys are overlaid with the F
|
||||||
|
* keys. F1 is also BrightnessDown, F10 is Mute, etc. The kernel provides a
|
||||||
|
* tweak to enable/disable this.
|
||||||
|
*
|
||||||
|
* /sys/module/hid_apple/parameters/fnmode
|
||||||
|
* 0 .. keyboard sends Fx keys, fn is disabled
|
||||||
|
* 1 .. keyboard sends multimedia keys, fn sends Fx keys
|
||||||
|
* 2 .. keyboard sends Fx keys, fn sends multimedia keys
|
||||||
|
*
|
||||||
|
* We only handle 1 and 2, don't care about 0. If fnmode is found to be on
|
||||||
|
* 0, we force it to 2 instead.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* In this file: fkeymode refers to the evdev-specific enums and parameters,
|
||||||
|
* fnmode refers to the fnmode parameter exposed by the kernel. fnmode is
|
||||||
|
* apple-specific */
|
||||||
|
#define FNMODE_PATH "/sys/module/hid_apple/parameters/fnmode"
|
||||||
|
|
||||||
|
/* Taken from the kernel */
|
||||||
|
#define USB_VENDOR_ID_APPLE 0x05ac
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_MINI_ANSI 0x021d
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_MINI_ISO 0x021e
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_MINI_JIS 0x021f
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
|
||||||
|
|
||||||
|
static int EvdevAppleGetProperty (DeviceIntPtr dev, Atom property);
|
||||||
|
static int EvdevAppleSetProperty(DeviceIntPtr dev, Atom atom,
|
||||||
|
XIPropertyValuePtr val, BOOL checkonly);
|
||||||
|
|
||||||
|
static Atom prop_fkeymode;
|
||||||
|
static Bool fnmode_readonly; /* set if we can only read fnmode */
|
||||||
|
|
||||||
|
struct product_table
|
||||||
|
{
|
||||||
|
unsigned int vendor;
|
||||||
|
unsigned int product;
|
||||||
|
} apple_keyboard_table[] = {
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS},
|
||||||
|
{ 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return TRUE if the device matches a product in the given product table,
|
||||||
|
* FALSE otherwise
|
||||||
|
*/
|
||||||
|
static Bool product_check(const struct product_table *t, int vendor, int product)
|
||||||
|
{
|
||||||
|
while (t->vendor)
|
||||||
|
{
|
||||||
|
if (vendor == t->vendor && product == t->product)
|
||||||
|
return TRUE;
|
||||||
|
t++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 0 on success, -1 otherwise (check errno)
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
set_fnmode(enum fkeymode fkeymode)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
char mode;
|
||||||
|
int bytes_written;
|
||||||
|
|
||||||
|
if (fkeymode == FKEYMODE_UNKNOWN)
|
||||||
|
{
|
||||||
|
errno = EINVAL; /* silly you */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fd = open(FNMODE_PATH, O_WRONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
mode = (fkeymode == FKEYMODE_FKEYS) ? '2' : '1';
|
||||||
|
|
||||||
|
bytes_written = write(fd, &mode, 1);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
return (bytes_written == 1) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current value of fnmode. If fnmode is found to be on 0, we set it
|
||||||
|
* to 2 in the process. Yes, quite daring, I know. I live on the edge.
|
||||||
|
*
|
||||||
|
* @return The current setting of fnmode or FKEYMODE_UNKNOWN on error (check
|
||||||
|
* errno)
|
||||||
|
*/
|
||||||
|
static enum fkeymode
|
||||||
|
get_fnmode(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
char retvalue;
|
||||||
|
|
||||||
|
fd = open(FNMODE_PATH, O_RDWR);
|
||||||
|
if (fd < 0 && errno == EACCES)
|
||||||
|
{
|
||||||
|
fnmode_readonly = TRUE;
|
||||||
|
fd = open(FNMODE_PATH, O_RDONLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fd < 0)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
if (read(fd, &retvalue, 1) != 1)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
if (retvalue != '0' && retvalue != '1' && retvalue != '2')
|
||||||
|
{
|
||||||
|
xf86Msg(X_ERROR, "Invalid fnmode value: %c\n", retvalue);
|
||||||
|
errno = EINVAL;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
/* we don't want 0, switch to 2 */
|
||||||
|
if (retvalue == '0')
|
||||||
|
{
|
||||||
|
if (fnmode_readonly)
|
||||||
|
xf86Msg(X_WARNING, "fnmode is disabled and read-only. Fn key will"
|
||||||
|
"not toggle to multimedia keys.\n");
|
||||||
|
else
|
||||||
|
set_fnmode(FKEYMODE_FKEYS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return retvalue == '1' ? FKEYMODE_MMKEYS : FKEYMODE_FKEYS;
|
||||||
|
|
||||||
|
err:
|
||||||
|
if (fd >= 0)
|
||||||
|
close(fd);
|
||||||
|
return FKEYMODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the property value to fkeymode. If the property doesn't exist,
|
||||||
|
* initialize it.
|
||||||
|
*/
|
||||||
|
static void set_fkeymode_property(InputInfoPtr pInfo, enum fkeymode fkeymode)
|
||||||
|
{
|
||||||
|
DeviceIntPtr dev = pInfo->dev;
|
||||||
|
BOOL init = FALSE;
|
||||||
|
char data;
|
||||||
|
|
||||||
|
switch(fkeymode)
|
||||||
|
{
|
||||||
|
case FKEYMODE_FKEYS: data = 0; break;
|
||||||
|
case FKEYMODE_MMKEYS: data = 1; break;
|
||||||
|
case FKEYMODE_UNKNOWN:
|
||||||
|
xf86IDrvMsg(pInfo, X_ERROR, "Failed to get fnmode (%s)\n", strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prop_fkeymode) {
|
||||||
|
init = TRUE;
|
||||||
|
prop_fkeymode = MakeAtom(EVDEV_PROP_FUNCTION_KEYS, strlen(EVDEV_PROP_FUNCTION_KEYS), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't send an event if we're initializing the property */
|
||||||
|
XIChangeDeviceProperty(dev, prop_fkeymode, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1, &data, !init);
|
||||||
|
|
||||||
|
if (init)
|
||||||
|
{
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_fkeymode, FALSE);
|
||||||
|
XIRegisterPropertyHandler(dev, EvdevAppleSetProperty, EvdevAppleGetProperty, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a client reads the property state.
|
||||||
|
* Update with current kernel state, it may have changed behind our back.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
EvdevAppleGetProperty (DeviceIntPtr dev, Atom property)
|
||||||
|
{
|
||||||
|
if (property == prop_fkeymode)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
enum fkeymode fkeymode;
|
||||||
|
|
||||||
|
fkeymode = get_fnmode();
|
||||||
|
if (fkeymode != pEvdev->fkeymode) {
|
||||||
|
/* set internal copy first, so we don't write to the file in
|
||||||
|
* SetProperty handler */
|
||||||
|
pEvdev->fkeymode = fkeymode;
|
||||||
|
set_fkeymode_property(pInfo, fkeymode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
EvdevAppleSetProperty(DeviceIntPtr dev, Atom atom,
|
||||||
|
XIPropertyValuePtr val, BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
if (atom == prop_fkeymode)
|
||||||
|
{
|
||||||
|
CARD8 v = *(CARD8*)val->data;
|
||||||
|
|
||||||
|
if (val->format != 8 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (fnmode_readonly)
|
||||||
|
return BadAccess;
|
||||||
|
|
||||||
|
if (v > 1)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
if ((!v && pEvdev->fkeymode != FKEYMODE_FKEYS) ||
|
||||||
|
(v && pEvdev->fkeymode != FKEYMODE_MMKEYS))
|
||||||
|
{
|
||||||
|
pEvdev->fkeymode = v ? FKEYMODE_MMKEYS : FKEYMODE_FKEYS;
|
||||||
|
set_fnmode(pEvdev->fkeymode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EvdevAppleInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
enum fkeymode fkeymode;
|
||||||
|
|
||||||
|
if (!product_check(apple_keyboard_table,
|
||||||
|
libevdev_get_id_vendor(pEvdev->dev),
|
||||||
|
libevdev_get_id_product(pEvdev->dev)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
fkeymode = get_fnmode();
|
||||||
|
pEvdev->fkeymode = fkeymode;
|
||||||
|
set_fkeymode_property(pInfo, fkeymode);
|
||||||
|
}
|
||||||
196
src/axis_labels.h
Normal file
196
src/axis_labels.h
Normal file
@@ -0,0 +1,196 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2004-2008 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software
|
||||||
|
* and its documentation for any purpose is hereby granted without
|
||||||
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
|
* and that both that copyright notice and this permission notice
|
||||||
|
* appear in supporting documentation, and that the name of Red Hat
|
||||||
|
* not be used in advertising or publicity pertaining to distribution
|
||||||
|
* of the software without specific, written prior permission. Red
|
||||||
|
* Hat makes no representations about the suitability of this software
|
||||||
|
* for any purpose. It is provided "as is" without express or implied
|
||||||
|
* warranty.
|
||||||
|
*
|
||||||
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
|
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#include <xserver-properties.h>
|
||||||
|
|
||||||
|
#ifndef AXIS_LABELS
|
||||||
|
#define AXIS_LABELS
|
||||||
|
|
||||||
|
/* Aligned with linux/input.h.
|
||||||
|
Note that there are holes in the ABS_ range, these are simply replaced with
|
||||||
|
MISC here */
|
||||||
|
static const char* abs_labels[] = {
|
||||||
|
AXIS_LABEL_PROP_ABS_X, /* 0x00 */
|
||||||
|
AXIS_LABEL_PROP_ABS_Y, /* 0x01 */
|
||||||
|
AXIS_LABEL_PROP_ABS_Z, /* 0x02 */
|
||||||
|
AXIS_LABEL_PROP_ABS_RX, /* 0x03 */
|
||||||
|
AXIS_LABEL_PROP_ABS_RY, /* 0x04 */
|
||||||
|
AXIS_LABEL_PROP_ABS_RZ, /* 0x05 */
|
||||||
|
AXIS_LABEL_PROP_ABS_THROTTLE, /* 0x06 */
|
||||||
|
AXIS_LABEL_PROP_ABS_RUDDER, /* 0x07 */
|
||||||
|
AXIS_LABEL_PROP_ABS_WHEEL, /* 0x08 */
|
||||||
|
AXIS_LABEL_PROP_ABS_GAS, /* 0x09 */
|
||||||
|
AXIS_LABEL_PROP_ABS_BRAKE, /* 0x0a */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT0X, /* 0x10 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT0Y, /* 0x11 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT1X, /* 0x12 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT1Y, /* 0x13 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT2X, /* 0x14 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT2Y, /* 0x15 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT3X, /* 0x16 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT3Y, /* 0x17 */
|
||||||
|
AXIS_LABEL_PROP_ABS_PRESSURE, /* 0x18 */
|
||||||
|
AXIS_LABEL_PROP_ABS_DISTANCE, /* 0x19 */
|
||||||
|
AXIS_LABEL_PROP_ABS_TILT_X, /* 0x1a */
|
||||||
|
AXIS_LABEL_PROP_ABS_TILT_Y, /* 0x1b */
|
||||||
|
AXIS_LABEL_PROP_ABS_TOOL_WIDTH, /* 0x1c */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_VOLUME /* 0x20 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, /* 0x30 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, /* 0x31 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, /* 0x32 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR, /* 0x33 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_ORIENTATION, /* 0x34 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_POSITION_X, /* 0x35 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_POSITION_Y, /* 0x36 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE, /* 0x37 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_BLOB_ID, /* 0x38 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, /* 0x39 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_PRESSURE, /* 0x3a */
|
||||||
|
#ifdef AXIS_LABEL_PROP_ABS_MT_DISTANCE
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_DISTANCE, /* 0x3b */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOOL_X, /* 0x3c */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOOL_Y, /* 0x3d */
|
||||||
|
#endif /* AXIS_LABEL_PROP_ABS_MT_DISTANCE */
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* rel_labels[] = {
|
||||||
|
AXIS_LABEL_PROP_REL_X,
|
||||||
|
AXIS_LABEL_PROP_REL_Y,
|
||||||
|
AXIS_LABEL_PROP_REL_Z,
|
||||||
|
AXIS_LABEL_PROP_REL_RX,
|
||||||
|
AXIS_LABEL_PROP_REL_RY,
|
||||||
|
AXIS_LABEL_PROP_REL_RZ,
|
||||||
|
AXIS_LABEL_PROP_REL_HWHEEL,
|
||||||
|
AXIS_LABEL_PROP_REL_DIAL,
|
||||||
|
AXIS_LABEL_PROP_REL_WHEEL,
|
||||||
|
AXIS_LABEL_PROP_REL_MISC
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* btn_labels[][16] = {
|
||||||
|
{ /* BTN_MISC group offset 0x100*/
|
||||||
|
BTN_LABEL_PROP_BTN_0, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_1, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_2, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_3, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_4, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_5, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_6, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_7, /* 0x07 */
|
||||||
|
BTN_LABEL_PROP_BTN_8, /* 0x08 */
|
||||||
|
BTN_LABEL_PROP_BTN_9 /* 0x09 */
|
||||||
|
},
|
||||||
|
{ /* BTN_MOUSE group offset 0x110 */
|
||||||
|
BTN_LABEL_PROP_BTN_LEFT, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_RIGHT, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_MIDDLE, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_SIDE, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_EXTRA, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_FORWARD, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_BACK, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_TASK /* 0x07 */
|
||||||
|
},
|
||||||
|
{ /* BTN_JOYSTICK group offset 0x120 */
|
||||||
|
BTN_LABEL_PROP_BTN_TRIGGER, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_THUMB, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_THUMB2, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOP, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOP2, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_PINKIE, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE2, /* 0x07 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE3, /* 0x08 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE4, /* 0x09 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE5, /* 0x0a */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE6, /* 0x0b */
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
BTN_LABEL_PROP_BTN_DEAD /* 0x0f */
|
||||||
|
},
|
||||||
|
{ /* BTN_GAMEPAD group offset 0x130 */
|
||||||
|
BTN_LABEL_PROP_BTN_A, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_B, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_C, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_X, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_Y, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_Z, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_TL, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_TR, /* 0x07 */
|
||||||
|
BTN_LABEL_PROP_BTN_TL2, /* 0x08 */
|
||||||
|
BTN_LABEL_PROP_BTN_TR2, /* 0x09 */
|
||||||
|
BTN_LABEL_PROP_BTN_SELECT, /* 0x0a */
|
||||||
|
BTN_LABEL_PROP_BTN_START, /* 0x0b */
|
||||||
|
BTN_LABEL_PROP_BTN_MODE, /* 0x0c */
|
||||||
|
BTN_LABEL_PROP_BTN_THUMBL, /* 0x0d */
|
||||||
|
BTN_LABEL_PROP_BTN_THUMBR /* 0x0e */
|
||||||
|
},
|
||||||
|
{ /* BTN_DIGI group offset 0x140 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_PEN, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_RUBBER, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_BRUSH, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_PENCIL, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_FINGER, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_MOUSE, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_LENS, /* 0x07 */
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
BTN_LABEL_PROP_BTN_TOUCH, /* 0x0a */
|
||||||
|
BTN_LABEL_PROP_BTN_STYLUS, /* 0x0b */
|
||||||
|
BTN_LABEL_PROP_BTN_STYLUS2, /* 0x0c */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP, /* 0x0d */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP /* 0x0e */
|
||||||
|
},
|
||||||
|
{ /* BTN_WHEEL group offset 0x150 */
|
||||||
|
BTN_LABEL_PROP_BTN_GEAR_DOWN, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_GEAR_UP /* 0x01 */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
316
src/draglock.c
Normal file
316
src/draglock.c
Normal file
@@ -0,0 +1,316 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
||||||
|
* Copyright 1993 by David Dawes <dawes@xfree86.org>
|
||||||
|
* Copyright 2002 by SuSE Linux AG, Author: Egbert Eich
|
||||||
|
* Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||||
|
* Copyright 2002 by Paul Elliott
|
||||||
|
* (Ported from xf86-input-mouse, above copyrights taken from there)
|
||||||
|
* Copyright © 2008 University of South Australia
|
||||||
|
* Copyright 2008 by Chris Salch
|
||||||
|
* Copyright 2008 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software
|
||||||
|
* and its documentation for any purpose is hereby granted without
|
||||||
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
|
* and that both that copyright notice and this permission notice
|
||||||
|
* appear in supporting documentation, and that the name of the authors
|
||||||
|
* not be used in advertising or publicity pertaining to distribution of the
|
||||||
|
* software without specific, written prior permission. The authors make no
|
||||||
|
* representations about the suitability of this software for any
|
||||||
|
* purpose. It is provided "as is" without express or implied
|
||||||
|
* warranty.
|
||||||
|
*
|
||||||
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
|
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Draglock code */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "evdev.h"
|
||||||
|
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <exevents.h>
|
||||||
|
|
||||||
|
#include <evdev-properties.h>
|
||||||
|
|
||||||
|
static Atom prop_dlock = 0; /* Drag lock buttons. */
|
||||||
|
|
||||||
|
void EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button);
|
||||||
|
|
||||||
|
|
||||||
|
/* Setup and configuration code */
|
||||||
|
void
|
||||||
|
EvdevDragLockPreInit(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
char *option_string = NULL;
|
||||||
|
int meta_button = 0;
|
||||||
|
int lock_button = 0;
|
||||||
|
char *next_num = NULL;
|
||||||
|
char *end_str = NULL;
|
||||||
|
BOOL pairs = FALSE;
|
||||||
|
|
||||||
|
option_string = xf86CheckStrOption(pInfo->options, "DragLockButtons",NULL);
|
||||||
|
|
||||||
|
if (!option_string)
|
||||||
|
return;
|
||||||
|
|
||||||
|
next_num = option_string;
|
||||||
|
|
||||||
|
/* Loop until we hit the end of our option string */
|
||||||
|
while (next_num != NULL) {
|
||||||
|
lock_button = 0;
|
||||||
|
meta_button = strtol(next_num, &end_str, 10);
|
||||||
|
|
||||||
|
/* check to see if we found anything */
|
||||||
|
if (next_num != end_str) {
|
||||||
|
/* setup for the next number */
|
||||||
|
next_num = end_str;
|
||||||
|
} else {
|
||||||
|
/* we have nothing more to parse, drop out of the loop */
|
||||||
|
next_num = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for a button to lock if we have a meta button */
|
||||||
|
if (meta_button != 0 && next_num != NULL ) {
|
||||||
|
lock_button = strtol(next_num, &end_str, 10);
|
||||||
|
|
||||||
|
/* check to see if we found anything */
|
||||||
|
if (next_num != end_str) {
|
||||||
|
/* setup for the next number */
|
||||||
|
next_num = end_str;
|
||||||
|
} else {
|
||||||
|
/* we have nothing more to parse, drop out of the loop */
|
||||||
|
next_num = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ok, let the user know what we found on this look */
|
||||||
|
if (meta_button != 0) {
|
||||||
|
if (lock_button == 0) {
|
||||||
|
if (!pairs) {
|
||||||
|
/* We only have a meta button */
|
||||||
|
pEvdev->dragLock.meta = meta_button;
|
||||||
|
|
||||||
|
xf86IDrvMsg(pInfo, X_CONFIG, "DragLockButtons : "
|
||||||
|
"%i as meta\n", meta_button);
|
||||||
|
} else {
|
||||||
|
xf86IDrvMsg(pInfo, X_ERROR, "DragLockButtons : "
|
||||||
|
"Incomplete pair specifying button pairs %s\n",
|
||||||
|
option_string);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* Do bounds checking to make sure we don't crash */
|
||||||
|
if ((meta_button <= EVDEV_MAXBUTTONS) && (meta_button >= 0 ) &&
|
||||||
|
(lock_button <= EVDEV_MAXBUTTONS) && (lock_button >= 0)) {
|
||||||
|
|
||||||
|
xf86IDrvMsg(pInfo, X_CONFIG,
|
||||||
|
"DragLockButtons : %i -> %i\n",
|
||||||
|
meta_button, lock_button);
|
||||||
|
|
||||||
|
pEvdev->dragLock.lock_pair[meta_button - 1] = lock_button;
|
||||||
|
pairs=TRUE;
|
||||||
|
} else {
|
||||||
|
/* Let the user know something was wrong
|
||||||
|
with this pair of buttons */
|
||||||
|
xf86IDrvMsg(pInfo, X_CONFIG,"DragLockButtons : "
|
||||||
|
"Invalid button pair %i -> %i\n",
|
||||||
|
meta_button, lock_button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xf86IDrvMsg(pInfo, X_ERROR, "Found DragLockButtons "
|
||||||
|
"with invalid lock button string : '%s'\n",
|
||||||
|
option_string);
|
||||||
|
|
||||||
|
/* This should be the case anyhow, just make sure */
|
||||||
|
next_num = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for end of string, to avoid annoying error */
|
||||||
|
if (next_num != NULL && *next_num == '\0')
|
||||||
|
next_num = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
free(option_string);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Updates DragLock button state and fires button event messges */
|
||||||
|
void
|
||||||
|
EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
BOOL state = 0;
|
||||||
|
|
||||||
|
/* update button state */
|
||||||
|
state = pEvdev->dragLock.lock_state[button - 1] ? FALSE : TRUE;
|
||||||
|
pEvdev->dragLock.lock_state[button - 1] = state;
|
||||||
|
|
||||||
|
EvdevQueueButtonEvent(pInfo, button, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter button presses looking for either a meta button or the
|
||||||
|
* control of a button pair.
|
||||||
|
*
|
||||||
|
* @param button button number (1 for left, 3 for right)
|
||||||
|
* @param value TRUE if button press, FALSE if release
|
||||||
|
*
|
||||||
|
* @return TRUE if the event was swallowed here, FALSE otherwise.
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
|
||||||
|
if (button == 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Do we have a single meta key or
|
||||||
|
several button pairings? */
|
||||||
|
if (pEvdev->dragLock.meta != 0) {
|
||||||
|
|
||||||
|
if (pEvdev->dragLock.meta == button) {
|
||||||
|
|
||||||
|
/* setup up for button lock */
|
||||||
|
if (value)
|
||||||
|
pEvdev->dragLock.meta_state = TRUE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
} else if (pEvdev->dragLock.meta_state) { /* waiting to lock */
|
||||||
|
|
||||||
|
pEvdev->dragLock.meta_state = FALSE;
|
||||||
|
|
||||||
|
EvdevDragLockLockButton(pInfo, button);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
} else if (pEvdev->dragLock.lock_pair[button - 1] && value) {
|
||||||
|
/* A meta button in a meta/lock pair was pressed */
|
||||||
|
EvdevDragLockLockButton(pInfo, pEvdev->dragLock.lock_pair[button - 1]);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Eat events for buttons that are locked */
|
||||||
|
if (pEvdev->dragLock.lock_state[button - 1])
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the drag lock property.
|
||||||
|
* If only one value is supplied, then this is used as the meta button.
|
||||||
|
* If more than one value is supplied, then each value is the drag lock button
|
||||||
|
* for the pair. 0 disables a pair.
|
||||||
|
* i.e. to set bt 3 to draglock button 1, supply 0,0,1
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
|
BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
if (atom == prop_dlock)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (val->format != 8 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
/* Don't allow changes while a lock is active */
|
||||||
|
if (pEvdev->dragLock.meta)
|
||||||
|
{
|
||||||
|
if (pEvdev->dragLock.meta_state)
|
||||||
|
return BadAccess;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
for (i = 0; i < EVDEV_MAXBUTTONS; i++)
|
||||||
|
if (pEvdev->dragLock.lock_state[i])
|
||||||
|
return BadValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val->size == 0)
|
||||||
|
return BadMatch;
|
||||||
|
else if (val->size == 1)
|
||||||
|
{
|
||||||
|
int meta = *((CARD8*)val->data);
|
||||||
|
if (meta > EVDEV_MAXBUTTONS)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
pEvdev->dragLock.meta = meta;
|
||||||
|
memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair));
|
||||||
|
}
|
||||||
|
} else if ((val->size % 2) == 0)
|
||||||
|
{
|
||||||
|
CARD8* vals = (CARD8*)val->data;
|
||||||
|
|
||||||
|
for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i++)
|
||||||
|
if (vals[i] > EVDEV_MAXBUTTONS)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
pEvdev->dragLock.meta = 0;
|
||||||
|
memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair));
|
||||||
|
|
||||||
|
for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i += 2)
|
||||||
|
pEvdev->dragLock.lock_pair[vals[i] - 1] = vals[i + 1];
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
return BadMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise property for drag lock buttons setting.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
EvdevDragLockInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
if (!dev->button) /* don't init prop for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
prop_dlock = MakeAtom(EVDEV_PROP_DRAGLOCK, strlen(EVDEV_PROP_DRAGLOCK), TRUE);
|
||||||
|
if (pEvdev->dragLock.meta)
|
||||||
|
{
|
||||||
|
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1, &pEvdev->dragLock.meta,
|
||||||
|
FALSE);
|
||||||
|
} else {
|
||||||
|
int highest = 0;
|
||||||
|
int i;
|
||||||
|
CARD8 pair[EVDEV_MAXBUTTONS] = {0};
|
||||||
|
|
||||||
|
for (i = 0; i < EVDEV_MAXBUTTONS; i++)
|
||||||
|
{
|
||||||
|
if (pEvdev->dragLock.lock_pair[i])
|
||||||
|
highest = i;
|
||||||
|
pair[i] = pEvdev->dragLock.lock_pair[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8, PropModeReplace,
|
||||||
|
highest + 1, pair, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_dlock, FALSE);
|
||||||
|
|
||||||
|
XIRegisterPropertyHandler(dev, EvdevDragLockSetProperty, NULL, NULL);
|
||||||
|
}
|
||||||
426
src/emuMB.c
Normal file
426
src/emuMB.c
Normal file
@@ -0,0 +1,426 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
||||||
|
* Copyright 1993 by David Dawes <dawes@xfree86.org>
|
||||||
|
* Copyright 2002 by SuSE Linux AG, Author: Egbert Eich
|
||||||
|
* Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||||
|
* Copyright 2002 by Paul Elliott
|
||||||
|
* (Ported from xf86-input-mouse, above copyrights taken from there)
|
||||||
|
* Copyright © 2008 University of South Australia
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software
|
||||||
|
* and its documentation for any purpose is hereby granted without
|
||||||
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
|
* and that both that copyright notice and this permission notice
|
||||||
|
* appear in supporting documentation, and that the name of the authors
|
||||||
|
* not be used in advertising or publicity pertaining to distribution of the
|
||||||
|
* software without specific, written prior permission. The authors make no
|
||||||
|
* representations about the suitability of this software for any
|
||||||
|
* purpose. It is provided "as is" without express or implied
|
||||||
|
* warranty.
|
||||||
|
*
|
||||||
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
|
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Middle mouse button emulation code. */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "evdev.h"
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <exevents.h>
|
||||||
|
|
||||||
|
#include <evdev-properties.h>
|
||||||
|
|
||||||
|
static Atom prop_mbemu = 0; /* Middle button emulation on/off property */
|
||||||
|
static Atom prop_mbtimeout = 0; /* Middle button timeout property */
|
||||||
|
static Atom prop_mbbuton = 0; /* Middle button target button property */
|
||||||
|
/*
|
||||||
|
* Lets create a simple finite-state machine for 3 button emulation:
|
||||||
|
*
|
||||||
|
* We track buttons 1 and 3 (left and right). There are 11 states:
|
||||||
|
* 0 ground - initial state
|
||||||
|
* 1 delayed left - left pressed, waiting for right
|
||||||
|
* 2 delayed right - right pressed, waiting for left
|
||||||
|
* 3 pressed middle - right and left pressed, emulated middle sent
|
||||||
|
* 4 pressed left - left pressed and sent
|
||||||
|
* 5 pressed right - right pressed and sent
|
||||||
|
* 6 released left - left released after emulated middle
|
||||||
|
* 7 released right - right released after emulated middle
|
||||||
|
* 8 repressed left - left pressed after released left
|
||||||
|
* 9 repressed right - right pressed after released right
|
||||||
|
* 10 pressed both - both pressed, not emulating middle
|
||||||
|
*
|
||||||
|
* At each state, we need handlers for the following events
|
||||||
|
* 0: no buttons down
|
||||||
|
* 1: left button down
|
||||||
|
* 2: right button down
|
||||||
|
* 3: both buttons down
|
||||||
|
* 4: emulate3Timeout passed without a button change
|
||||||
|
* Note that button events are not deltas, they are the set of buttons being
|
||||||
|
* pressed now. It's possible (ie, mouse hardware does it) to go from (eg)
|
||||||
|
* left down to right down without anything in between, so all cases must be
|
||||||
|
* handled.
|
||||||
|
*
|
||||||
|
* a handler consists of three values:
|
||||||
|
* 0: action1
|
||||||
|
* 1: action2
|
||||||
|
* 2: new emulation state
|
||||||
|
*
|
||||||
|
* action > 0: ButtonPress
|
||||||
|
* action = 0: nothing
|
||||||
|
* action < 0: ButtonRelease
|
||||||
|
*
|
||||||
|
* The comment preceeding each section is the current emulation state.
|
||||||
|
* The comments to the right are of the form
|
||||||
|
* <button state> (<events>) -> <new emulation state>
|
||||||
|
* which should be read as
|
||||||
|
* If the buttons are in <button state>, generate <events> then go to
|
||||||
|
* <new emulation state>.
|
||||||
|
*/
|
||||||
|
static signed char stateTab[11][5][3] = {
|
||||||
|
/* 0 ground */
|
||||||
|
{
|
||||||
|
{ 0, 0, 0 }, /* nothing -> ground (no change) */
|
||||||
|
{ 0, 0, 1 }, /* left -> delayed left */
|
||||||
|
{ 0, 0, 2 }, /* right -> delayed right */
|
||||||
|
{ 2, 0, 3 }, /* left & right (middle press) -> pressed middle */
|
||||||
|
{ 0, 0, -1 } /* timeout N/A */
|
||||||
|
},
|
||||||
|
/* 1 delayed left */
|
||||||
|
{
|
||||||
|
{ 1, -1, 0 }, /* nothing (left event) -> ground */
|
||||||
|
{ 0, 0, 1 }, /* left -> delayed left (no change) */
|
||||||
|
{ 1, -1, 2 }, /* right (left event) -> delayed right */
|
||||||
|
{ 2, 0, 3 }, /* left & right (middle press) -> pressed middle */
|
||||||
|
{ 1, 0, 4 }, /* timeout (left press) -> pressed left */
|
||||||
|
},
|
||||||
|
/* 2 delayed right */
|
||||||
|
{
|
||||||
|
{ 3, -3, 0 }, /* nothing (right event) -> ground */
|
||||||
|
{ 3, -3, 1 }, /* left (right event) -> delayed left (no change) */
|
||||||
|
{ 0, 0, 2 }, /* right -> delayed right (no change) */
|
||||||
|
{ 2, 0, 3 }, /* left & right (middle press) -> pressed middle */
|
||||||
|
{ 3, 0, 5 }, /* timeout (right press) -> pressed right */
|
||||||
|
},
|
||||||
|
/* 3 pressed middle */
|
||||||
|
{
|
||||||
|
{ -2, 0, 0 }, /* nothing (middle release) -> ground */
|
||||||
|
{ 0, 0, 7 }, /* left -> released right */
|
||||||
|
{ 0, 0, 6 }, /* right -> released left */
|
||||||
|
{ 0, 0, 3 }, /* left & right -> pressed middle (no change) */
|
||||||
|
{ 0, 0, -1 }, /* timeout N/A */
|
||||||
|
},
|
||||||
|
/* 4 pressed left */
|
||||||
|
{
|
||||||
|
{ -1, 0, 0 }, /* nothing (left release) -> ground */
|
||||||
|
{ 0, 0, 4 }, /* left -> pressed left (no change) */
|
||||||
|
{ -1, 0, 2 }, /* right (left release) -> delayed right */
|
||||||
|
{ 3, 0, 10 }, /* left & right (right press) -> pressed both */
|
||||||
|
{ 0, 0, -1 }, /* timeout N/A */
|
||||||
|
},
|
||||||
|
/* 5 pressed right */
|
||||||
|
{
|
||||||
|
{ -3, 0, 0 }, /* nothing (right release) -> ground */
|
||||||
|
{ -3, 0, 1 }, /* left (right release) -> delayed left */
|
||||||
|
{ 0, 0, 5 }, /* right -> pressed right (no change) */
|
||||||
|
{ 1, 0, 10 }, /* left & right (left press) -> pressed both */
|
||||||
|
{ 0, 0, -1 }, /* timeout N/A */
|
||||||
|
},
|
||||||
|
/* 6 released left */
|
||||||
|
{
|
||||||
|
{ -2, 0, 0 }, /* nothing (middle release) -> ground */
|
||||||
|
{ -2, 0, 1 }, /* left (middle release) -> delayed left */
|
||||||
|
{ 0, 0, 6 }, /* right -> released left (no change) */
|
||||||
|
{ 1, 0, 8 }, /* left & right (left press) -> repressed left */
|
||||||
|
{ 0, 0, -1 }, /* timeout N/A */
|
||||||
|
},
|
||||||
|
/* 7 released right */
|
||||||
|
{
|
||||||
|
{ -2, 0, 0 }, /* nothing (middle release) -> ground */
|
||||||
|
{ 0, 0, 7 }, /* left -> released right (no change) */
|
||||||
|
{ -2, 0, 2 }, /* right (middle release) -> delayed right */
|
||||||
|
{ 3, 0, 9 }, /* left & right (right press) -> repressed right */
|
||||||
|
{ 0, 0, -1 }, /* timeout N/A */
|
||||||
|
},
|
||||||
|
/* 8 repressed left */
|
||||||
|
{
|
||||||
|
{ -2, -1, 0 }, /* nothing (middle release, left release) -> ground */
|
||||||
|
{ -2, 0, 4 }, /* left (middle release) -> pressed left */
|
||||||
|
{ -1, 0, 6 }, /* right (left release) -> released left */
|
||||||
|
{ 0, 0, 8 }, /* left & right -> repressed left (no change) */
|
||||||
|
{ 0, 0, -1 }, /* timeout N/A */
|
||||||
|
},
|
||||||
|
/* 9 repressed right */
|
||||||
|
{
|
||||||
|
{ -2, -3, 0 }, /* nothing (middle release, right release) -> ground */
|
||||||
|
{ -3, 0, 7 }, /* left (right release) -> released right */
|
||||||
|
{ -2, 0, 5 }, /* right (middle release) -> pressed right */
|
||||||
|
{ 0, 0, 9 }, /* left & right -> repressed right (no change) */
|
||||||
|
{ 0, 0, -1 }, /* timeout N/A */
|
||||||
|
},
|
||||||
|
/* 10 pressed both */
|
||||||
|
{
|
||||||
|
{ -1, -3, 0 }, /* nothing (left release, right release) -> ground */
|
||||||
|
{ -3, 0, 4 }, /* left (right release) -> pressed left */
|
||||||
|
{ -1, 0, 5 }, /* right (left release) -> pressed right */
|
||||||
|
{ 0, 0, 10 }, /* left & right -> pressed both (no change) */
|
||||||
|
{ 0, 0, -1 }, /* timeout N/A */
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
EvdevMBEmuTimer(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
int id;
|
||||||
|
int mapped_id;
|
||||||
|
|
||||||
|
input_lock();
|
||||||
|
|
||||||
|
pEvdev->emulateMB.pending = FALSE;
|
||||||
|
if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
|
||||||
|
mapped_id = abs(id);
|
||||||
|
if (mapped_id == 2)
|
||||||
|
mapped_id = pEvdev->emulateMB.button;
|
||||||
|
EvdevPostButtonEvent(pInfo, mapped_id,
|
||||||
|
(id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
|
||||||
|
pEvdev->emulateMB.state =
|
||||||
|
stateTab[pEvdev->emulateMB.state][4][2];
|
||||||
|
} else {
|
||||||
|
xf86IDrvMsg(pInfo, X_ERROR, "Got unexpected buttonTimer in state %d\n",
|
||||||
|
pEvdev->emulateMB.state);
|
||||||
|
}
|
||||||
|
|
||||||
|
input_unlock();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emulate a middle button on button press.
|
||||||
|
*
|
||||||
|
* @param code button number (1 for left, 3 for right)
|
||||||
|
* @param press TRUE if press, FALSE if release.
|
||||||
|
*
|
||||||
|
* @return TRUE if event was swallowed by middle mouse button emulation, FALSE
|
||||||
|
* otherwise.
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
int id;
|
||||||
|
int mapped_id;
|
||||||
|
int *btstate;
|
||||||
|
int ret = FALSE;
|
||||||
|
|
||||||
|
if (!pEvdev->emulateMB.enabled)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
/* don't care about other buttons */
|
||||||
|
if (button != 1 && button != 3)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
btstate = &pEvdev->emulateMB.buttonstate;
|
||||||
|
if (press)
|
||||||
|
*btstate |= (button == 1) ? 0x1 : 0x2;
|
||||||
|
else
|
||||||
|
*btstate &= (button == 1) ? ~0x1 : ~0x2;
|
||||||
|
|
||||||
|
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0)
|
||||||
|
{
|
||||||
|
mapped_id = abs(id);
|
||||||
|
if (mapped_id == 2)
|
||||||
|
mapped_id = pEvdev->emulateMB.button;
|
||||||
|
EvdevQueueButtonEvent(pInfo, mapped_id, (id >= 0));
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0)
|
||||||
|
{
|
||||||
|
EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0));
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEvdev->emulateMB.state =
|
||||||
|
stateTab[pEvdev->emulateMB.state][*btstate][2];
|
||||||
|
|
||||||
|
if (stateTab[pEvdev->emulateMB.state][4][0] != 0) {
|
||||||
|
pEvdev->emulateMB.expires = GetTimeInMillis () + pEvdev->emulateMB.timeout;
|
||||||
|
pEvdev->emulateMB.pending = TRUE;
|
||||||
|
ret = TRUE;
|
||||||
|
} else {
|
||||||
|
pEvdev->emulateMB.pending = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void EvdevMBEmuWakeupHandler(void *data, int i)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = (InputInfoPtr)data;
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
int ms;
|
||||||
|
|
||||||
|
if (pEvdev->emulateMB.pending)
|
||||||
|
{
|
||||||
|
ms = pEvdev->emulateMB.expires - GetTimeInMillis();
|
||||||
|
if (ms <= 0)
|
||||||
|
EvdevMBEmuTimer(pInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void EvdevMBEmuBlockHandler(void *data, void *waitTime)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = (InputInfoPtr) data;
|
||||||
|
EvdevPtr pEvdev= (EvdevPtr) pInfo->private;
|
||||||
|
int ms;
|
||||||
|
|
||||||
|
if (pEvdev->emulateMB.pending)
|
||||||
|
{
|
||||||
|
ms = pEvdev->emulateMB.expires - GetTimeInMillis ();
|
||||||
|
if (ms <= 0)
|
||||||
|
ms = 0;
|
||||||
|
AdjustWaitForDelay (waitTime, ms);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
int bt;
|
||||||
|
|
||||||
|
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
|
||||||
|
"Emulate3Buttons",
|
||||||
|
FALSE);
|
||||||
|
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
|
||||||
|
"Emulate3Timeout", 50);
|
||||||
|
bt = xf86SetIntOption(pInfo->options, "Emulate3Button", 2);
|
||||||
|
if (bt < 0 || bt > EVDEV_MAXBUTTONS) {
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid Emulate3Button value: %d\n",
|
||||||
|
bt);
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Middle button emulation disabled.\n");
|
||||||
|
|
||||||
|
pEvdev->emulateMB.enabled = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEvdev->emulateMB.button = bt;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EvdevMBEmuOn(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
if (!pInfo->dev->button) /* don't init for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
|
EvdevMBEmuWakeupHandler,
|
||||||
|
(void*)pInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
if (!pInfo->dev->button) /* don't cleanup for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
|
EvdevMBEmuWakeupHandler,
|
||||||
|
(void*)pInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
|
BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
int bt;
|
||||||
|
|
||||||
|
if (atom == prop_mbemu)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateMB.enabled = *((BOOL*)val->data);
|
||||||
|
} else if (atom == prop_mbtimeout)
|
||||||
|
{
|
||||||
|
if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateMB.timeout = *((CARD32*)val->data);
|
||||||
|
} else if (atom == prop_mbbuton)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
bt = *((CARD8*)val->data);
|
||||||
|
|
||||||
|
if (bt < 0 || bt > EVDEV_MAXBUTTONS)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateMB.button = bt;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise property for MB emulation on/off.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
EvdevMBEmuInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (!dev->button) /* don't init prop for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
prop_mbemu = MakeAtom(EVDEV_PROP_MIDBUTTON, strlen(EVDEV_PROP_MIDBUTTON), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_mbemu, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateMB.enabled,
|
||||||
|
FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_mbemu, FALSE);
|
||||||
|
|
||||||
|
prop_mbtimeout = MakeAtom(EVDEV_PROP_MIDBUTTON_TIMEOUT,
|
||||||
|
strlen(EVDEV_PROP_MIDBUTTON_TIMEOUT),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_mbtimeout, XA_INTEGER, 32, PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateMB.timeout, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
|
||||||
|
|
||||||
|
prop_mbbuton = MakeAtom(EVDEV_PROP_MIDBUTTON_BUTTON,
|
||||||
|
strlen(EVDEV_PROP_MIDBUTTON_BUTTON),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_mbbuton, XA_INTEGER, 8, PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateMB.button, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_mbbuton, FALSE);
|
||||||
|
|
||||||
|
XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
|
||||||
|
}
|
||||||
412
src/emuThird.c
Normal file
412
src/emuThird.c
Normal file
@@ -0,0 +1,412 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2011 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software
|
||||||
|
* and its documentation for any purpose is hereby granted without
|
||||||
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
|
* and that both that copyright notice and this permission notice
|
||||||
|
* appear in supporting documentation, and that the name of the authors
|
||||||
|
* not be used in advertising or publicity pertaining to distribution of the
|
||||||
|
* software without specific, written prior permission. The authors make no
|
||||||
|
* representations about the suitability of this software for any
|
||||||
|
* purpose. It is provided "as is" without express or implied
|
||||||
|
* warranty.
|
||||||
|
*
|
||||||
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
|
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Right mouse button emulation code.
|
||||||
|
* Emulates a right button event if the first button is held down for a
|
||||||
|
* timeout. If the device moves more than a certain amount before the
|
||||||
|
* timeout is over, the emulation is cancelled and a normal button event is
|
||||||
|
* generated.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "evdev.h"
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <exevents.h>
|
||||||
|
|
||||||
|
#include <evdev-properties.h>
|
||||||
|
|
||||||
|
/* Threshold (in device coordinates) for devices to cancel emulation */
|
||||||
|
#define DEFAULT_MOVE_THRESHOLD 20
|
||||||
|
|
||||||
|
static Atom prop_3bemu; /* Right button emulation on/off property */
|
||||||
|
static Atom prop_3btimeout; /* Right button timeout property */
|
||||||
|
static Atom prop_3bbutton; /* Right button target physical button */
|
||||||
|
static Atom prop_3bthreshold; /* Right button move cancellation threshold */
|
||||||
|
|
||||||
|
/* State machine for 3rd button emulation */
|
||||||
|
enum EmulationState {
|
||||||
|
EM3B_OFF, /* no event */
|
||||||
|
EM3B_PENDING, /* timer pending */
|
||||||
|
EM3B_EMULATING /* in emulation */
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
Evdev3BEmuPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
int absolute = Relative;
|
||||||
|
|
||||||
|
/* if we cancel, emit the button down event at our start position,
|
||||||
|
* not at the current position. Only for absolute devices though. For
|
||||||
|
* relative events, this may be a bit iffy since pointer accel may shoot
|
||||||
|
* us back more than we moved and confuse the user.
|
||||||
|
*/
|
||||||
|
if (emu3B->flags & EVDEV_ABSOLUTE_EVENTS)
|
||||||
|
absolute = Absolute;
|
||||||
|
|
||||||
|
xf86PostButtonEventP(pInfo->dev, absolute, button,
|
||||||
|
(act == BUTTON_PRESS) ? 1 : 0, 0,
|
||||||
|
(absolute ? 2 : 0), emu3B->startpos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timer function. Post a button down event to the server.
|
||||||
|
*
|
||||||
|
* @param arg The InputInfoPtr for this device.
|
||||||
|
*/
|
||||||
|
CARD32
|
||||||
|
Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, void *arg)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = (InputInfoPtr)arg;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
input_lock();
|
||||||
|
emu3B->state = EM3B_EMULATING;
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_PRESS);
|
||||||
|
input_unlock();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel all emulation, reset the timer and reset deltas.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
Evdev3BCancel(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
if (emu3B->state != EM3B_OFF)
|
||||||
|
{
|
||||||
|
TimerCancel(emu3B->timer);
|
||||||
|
emu3B->state = EM3B_OFF;
|
||||||
|
memset(emu3B->delta, 0, sizeof(emu3B->delta));
|
||||||
|
}
|
||||||
|
|
||||||
|
emu3B->flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emulate a third button on button press. Note that emulation only triggers
|
||||||
|
* on button 1.
|
||||||
|
*
|
||||||
|
* Return TRUE if event was swallowed by middle mouse button emulation,
|
||||||
|
* FALSE otherwise.
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
Evdev3BEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
int ret = FALSE;
|
||||||
|
|
||||||
|
if (!emu3B->enabled)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (press)
|
||||||
|
emu3B->buttonstate |= button;
|
||||||
|
else
|
||||||
|
emu3B->buttonstate &= ~button;
|
||||||
|
|
||||||
|
/* Any other button pressed? Cancel timer */
|
||||||
|
if (button != 1)
|
||||||
|
{
|
||||||
|
switch (emu3B->state)
|
||||||
|
{
|
||||||
|
case EM3B_PENDING:
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
break;
|
||||||
|
case EM3B_EMULATING:
|
||||||
|
/* We're emulating and now the user pressed a different
|
||||||
|
* button. Just release the emulating one, tell the user to
|
||||||
|
* not do that and get on with life */
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't emulate if any other button is down */
|
||||||
|
if ((emu3B->buttonstate & ~0x1) != 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
/* Release event → cancel, send press and release now. */
|
||||||
|
if (!press)
|
||||||
|
{
|
||||||
|
switch(emu3B->state)
|
||||||
|
{
|
||||||
|
case EM3B_PENDING:
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
break;
|
||||||
|
case EM3B_EMULATING:
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
ret = TRUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (press && emu3B->state == EM3B_OFF)
|
||||||
|
{
|
||||||
|
emu3B->state = EM3B_PENDING;
|
||||||
|
emu3B->timer = TimerSet(emu3B->timer, 0, emu3B->timeout,
|
||||||
|
Evdev3BEmuTimer, pInfo);
|
||||||
|
ret = TRUE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle absolute x/y motion. If the motion is above the threshold, cancel
|
||||||
|
* emulation.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
int cancel = FALSE;
|
||||||
|
int axis = 0;
|
||||||
|
|
||||||
|
if (emu3B->state != EM3B_PENDING)
|
||||||
|
{
|
||||||
|
if (valuator_mask_isset(vals, 0))
|
||||||
|
emu3B->startpos[0] = valuator_mask_get(vals, 0);
|
||||||
|
if (valuator_mask_isset(vals, 1))
|
||||||
|
emu3B->startpos[1] = valuator_mask_get(vals, 1);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((emu3B->flags & EVDEV_ABSOLUTE_EVENTS) == 0)
|
||||||
|
emu3B->flags |= EVDEV_ABSOLUTE_EVENTS;
|
||||||
|
|
||||||
|
while (axis <= 1 && !cancel)
|
||||||
|
{
|
||||||
|
if (valuator_mask_isset(vals, axis))
|
||||||
|
{
|
||||||
|
double delta = valuator_mask_get_double(vals, axis) - emu3B->startpos[axis];
|
||||||
|
if (fabs(delta) > emu3B->threshold)
|
||||||
|
cancel = TRUE;
|
||||||
|
}
|
||||||
|
axis++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cancel)
|
||||||
|
{
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle relative x/y motion. If the motion is above the threshold, cancel
|
||||||
|
* emulation.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
if (emu3B->state != EM3B_PENDING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
emu3B->delta[0] += dx;
|
||||||
|
emu3B->delta[1] += dy;
|
||||||
|
emu3B->flags |= EVDEV_RELATIVE_EVENTS;
|
||||||
|
|
||||||
|
if (fabs(emu3B->delta[0]) > emu3B->threshold ||
|
||||||
|
fabs(emu3B->delta[1]) > emu3B->threshold)
|
||||||
|
{
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Evdev3BEmuPreInit(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
emu3B->enabled = xf86SetBoolOption(pInfo->options,
|
||||||
|
"EmulateThirdButton",
|
||||||
|
FALSE);
|
||||||
|
emu3B->timeout = xf86SetIntOption(pInfo->options,
|
||||||
|
"EmulateThirdButtonTimeout",
|
||||||
|
1000);
|
||||||
|
emu3B->button = xf86SetIntOption(pInfo->options,
|
||||||
|
"EmulateThirdButtonButton",
|
||||||
|
3);
|
||||||
|
/* FIXME: this should be auto-configured based on axis ranges */
|
||||||
|
emu3B->threshold = xf86SetIntOption(pInfo->options,
|
||||||
|
"EmulateThirdButtonMoveThreshold",
|
||||||
|
DEFAULT_MOVE_THRESHOLD);
|
||||||
|
/* allocate now so we don't allocate in the signal handler */
|
||||||
|
emu3B->timer = TimerSet(NULL, 0, 0, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Evdev3BEmuOn(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
/* This function just exists for symmetry in evdev.c */
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Evdev3BEmuFinalize(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
TimerFree(emu3B->timer);
|
||||||
|
emu3B->timer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
Evdev3BEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
|
BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
if (atom == prop_3bemu)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
emu3B->enabled = *((BOOL*)val->data);
|
||||||
|
|
||||||
|
} else if (atom == prop_3btimeout)
|
||||||
|
{
|
||||||
|
if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
emu3B->timeout = *((CARD32*)val->data);
|
||||||
|
|
||||||
|
} else if (atom == prop_3bbutton)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
emu3B->button = *((CARD8*)val->data);
|
||||||
|
} else if (atom == prop_3bthreshold)
|
||||||
|
{
|
||||||
|
if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
emu3B->threshold = *((CARD32*)val->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise properties for third button emulation
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Evdev3BEmuInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (!dev->button) /* don't init prop for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* third button emulation on/off */
|
||||||
|
prop_3bemu = MakeAtom(EVDEV_PROP_THIRDBUTTON, strlen(EVDEV_PROP_THIRDBUTTON), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_3bemu, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&emu3B->enabled,
|
||||||
|
FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_3bemu, FALSE);
|
||||||
|
|
||||||
|
/* third button emulation timeout */
|
||||||
|
prop_3btimeout = MakeAtom(EVDEV_PROP_THIRDBUTTON_TIMEOUT,
|
||||||
|
strlen(EVDEV_PROP_THIRDBUTTON_TIMEOUT),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_3btimeout, XA_INTEGER, 32, PropModeReplace, 1,
|
||||||
|
&emu3B->timeout, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_3btimeout, FALSE);
|
||||||
|
|
||||||
|
/* third button emulation button to be triggered */
|
||||||
|
prop_3bbutton = MakeAtom(EVDEV_PROP_THIRDBUTTON_BUTTON,
|
||||||
|
strlen(EVDEV_PROP_THIRDBUTTON_BUTTON),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_3bbutton, XA_INTEGER, 8, PropModeReplace, 1,
|
||||||
|
&emu3B->button, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_3bbutton, FALSE);
|
||||||
|
|
||||||
|
/* third button emulation movement threshold */
|
||||||
|
prop_3bthreshold = MakeAtom(EVDEV_PROP_THIRDBUTTON_THRESHOLD,
|
||||||
|
strlen(EVDEV_PROP_THIRDBUTTON_THRESHOLD),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_3bthreshold, XA_INTEGER, 32, PropModeReplace, 1,
|
||||||
|
&emu3B->threshold, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_3bthreshold, FALSE);
|
||||||
|
|
||||||
|
XIRegisterPropertyHandler(dev, Evdev3BEmuSetProperty, NULL, NULL);
|
||||||
|
}
|
||||||
471
src/emuWheel.c
Normal file
471
src/emuWheel.c
Normal file
@@ -0,0 +1,471 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
||||||
|
* Copyright 1993 by David Dawes <dawes@xfree86.org>
|
||||||
|
* Copyright 2002 by SuSE Linux AG, Author: Egbert Eich
|
||||||
|
* Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||||
|
* Copyright 2002 by Paul Elliott
|
||||||
|
* (Ported from xf86-input-mouse, above copyrights taken from there)
|
||||||
|
* Copyright 2008 by Chris Salch
|
||||||
|
* Copyright © 2008 Red Hat, Inc.
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, distribute, and sell this software
|
||||||
|
* and its documentation for any purpose is hereby granted without
|
||||||
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
|
* and that both that copyright notice and this permission notice
|
||||||
|
* appear in supporting documentation, and that the name of the authors
|
||||||
|
* not be used in advertising or publicity pertaining to distribution of the
|
||||||
|
* software without specific, written prior permission. The authors make no
|
||||||
|
* representations about the suitability of this software for any
|
||||||
|
* purpose. It is provided "as is" without express or implied
|
||||||
|
* warranty.
|
||||||
|
*
|
||||||
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
|
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Mouse wheel emulation code. */
|
||||||
|
#include "config.h"
|
||||||
|
#include "evdev.h"
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <exevents.h>
|
||||||
|
|
||||||
|
#include <evdev-properties.h>
|
||||||
|
|
||||||
|
#define WHEEL_NOT_CONFIGURED 0
|
||||||
|
|
||||||
|
static Atom prop_wheel_emu = 0;
|
||||||
|
static Atom prop_wheel_axismap = 0;
|
||||||
|
static Atom prop_wheel_inertia = 0;
|
||||||
|
static Atom prop_wheel_timeout = 0;
|
||||||
|
static Atom prop_wheel_button = 0;
|
||||||
|
|
||||||
|
/* Local Function Prototypes */
|
||||||
|
static int EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value);
|
||||||
|
|
||||||
|
/* Filter mouse button events */
|
||||||
|
BOOL
|
||||||
|
EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
int ms;
|
||||||
|
|
||||||
|
/* Has wheel emulation been configured to be enabled? */
|
||||||
|
if (!pEvdev->emulateWheel.enabled)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Check for EmulateWheelButton */
|
||||||
|
if (pEvdev->emulateWheel.button == button) {
|
||||||
|
pEvdev->emulateWheel.button_state = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
/* Start the timer when the button is pressed */
|
||||||
|
pEvdev->emulateWheel.expires = pEvdev->emulateWheel.timeout +
|
||||||
|
GetTimeInMillis();
|
||||||
|
else {
|
||||||
|
ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
|
||||||
|
if (ms > 0) {
|
||||||
|
/*
|
||||||
|
* If the button is released early enough emit the button
|
||||||
|
* press/release events
|
||||||
|
*/
|
||||||
|
EvdevQueueButtonClicks(pInfo, button, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't care about this event */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter mouse wheel events */
|
||||||
|
BOOL
|
||||||
|
EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
WheelAxisPtr pAxis = NULL;
|
||||||
|
int value = pEv->value;
|
||||||
|
|
||||||
|
/* Has wheel emulation been configured to be enabled? */
|
||||||
|
if (!pEvdev->emulateWheel.enabled)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Handle our motion events if the emuWheel button is pressed
|
||||||
|
* wheel button of 0 means always emulate wheel.
|
||||||
|
*/
|
||||||
|
if (pEvdev->emulateWheel.button_state || !pEvdev->emulateWheel.button) {
|
||||||
|
/* Just return if the timeout hasn't expired yet */
|
||||||
|
if (pEvdev->emulateWheel.button)
|
||||||
|
{
|
||||||
|
int ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
|
||||||
|
if (ms > 0)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(pEv->type == EV_ABS) {
|
||||||
|
int axis = pEvdev->abs_axis_map[pEv->code];
|
||||||
|
int oldValue;
|
||||||
|
|
||||||
|
if (axis > -1 && valuator_mask_fetch(pEvdev->old_vals, axis, &oldValue)) {
|
||||||
|
valuator_mask_set(pEvdev->abs_vals, axis, value);
|
||||||
|
value -= oldValue; /* make value into a differential measurement */
|
||||||
|
} else
|
||||||
|
value = 0; /* avoid a jump on the first touch */
|
||||||
|
}
|
||||||
|
|
||||||
|
switch(pEv->code) {
|
||||||
|
|
||||||
|
/* ABS_X has the same value as REL_X, so this case catches both */
|
||||||
|
case REL_X:
|
||||||
|
pAxis = &(pEvdev->emulateWheel.X);
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* ABS_Y has the same value as REL_Y, so this case catches both */
|
||||||
|
case REL_Y:
|
||||||
|
pAxis = &(pEvdev->emulateWheel.Y);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
|
||||||
|
wheel.
|
||||||
|
*/
|
||||||
|
if (pAxis)
|
||||||
|
EvdevWheelEmuInertia(pInfo, pAxis, value);
|
||||||
|
|
||||||
|
/* Eat motion events while emulateWheel button pressed. */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Simulate inertia for our emulated mouse wheel.
|
||||||
|
Returns the number of wheel events generated.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
int button;
|
||||||
|
int inertia;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
/* if this axis has not been configured, just eat the motion */
|
||||||
|
if (!axis->up_button)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
axis->traveled_distance += value;
|
||||||
|
|
||||||
|
if (axis->traveled_distance < 0) {
|
||||||
|
button = axis->up_button;
|
||||||
|
inertia = -pEvdev->emulateWheel.inertia;
|
||||||
|
} else {
|
||||||
|
button = axis->down_button;
|
||||||
|
inertia = pEvdev->emulateWheel.inertia;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Produce button press events for wheel motion */
|
||||||
|
while(abs(axis->traveled_distance) > pEvdev->emulateWheel.inertia) {
|
||||||
|
axis->traveled_distance -= inertia;
|
||||||
|
EvdevQueueButtonClicks(pInfo, button, 1);
|
||||||
|
rc++;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handle button mapping here to avoid code duplication,
|
||||||
|
returns true if a button mapping was found. */
|
||||||
|
static BOOL
|
||||||
|
EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis,
|
||||||
|
const char *axis_name)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
char *option_string;
|
||||||
|
|
||||||
|
pAxis->up_button = WHEEL_NOT_CONFIGURED;
|
||||||
|
|
||||||
|
/* Check to see if there is configuration for this axis */
|
||||||
|
option_string = xf86SetStrOption(pInfo->options, axis_name, NULL);
|
||||||
|
if (option_string) {
|
||||||
|
int up_button = 0;
|
||||||
|
int down_button = 0;
|
||||||
|
char *msg = NULL;
|
||||||
|
|
||||||
|
if ((sscanf(option_string, "%d %d", &up_button, &down_button) == 2) &&
|
||||||
|
((up_button > 0) && (up_button <= EVDEV_MAXBUTTONS)) &&
|
||||||
|
((down_button > 0) && (down_button <= EVDEV_MAXBUTTONS))) {
|
||||||
|
|
||||||
|
msg = strdup("buttons XX and YY");
|
||||||
|
if (msg)
|
||||||
|
sprintf(msg, "buttons %d and %d", up_button, down_button);
|
||||||
|
|
||||||
|
pAxis->up_button = up_button;
|
||||||
|
pAxis->down_button = down_button;
|
||||||
|
|
||||||
|
/* Update the number of buttons if needed */
|
||||||
|
if (up_button > pEvdev->num_buttons) pEvdev->num_buttons = up_button;
|
||||||
|
if (down_button > pEvdev->num_buttons) pEvdev->num_buttons = down_button;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid %s value:\"%s\"\n",
|
||||||
|
axis_name, option_string);
|
||||||
|
}
|
||||||
|
free(option_string);
|
||||||
|
|
||||||
|
/* Clean up and log what happened */
|
||||||
|
if (msg) {
|
||||||
|
xf86IDrvMsg(pInfo, X_CONFIG, "%s: %s\n", axis_name, msg);
|
||||||
|
free(msg);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup the basic configuration options used by mouse wheel emulation */
|
||||||
|
void
|
||||||
|
EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
int wheelButton;
|
||||||
|
int inertia;
|
||||||
|
int timeout;
|
||||||
|
|
||||||
|
if (xf86SetBoolOption(pInfo->options, "EmulateWheel", FALSE)) {
|
||||||
|
pEvdev->emulateWheel.enabled = TRUE;
|
||||||
|
} else
|
||||||
|
pEvdev->emulateWheel.enabled = FALSE;
|
||||||
|
|
||||||
|
wheelButton = xf86SetIntOption(pInfo->options, "EmulateWheelButton", 4);
|
||||||
|
|
||||||
|
if ((wheelButton < 0) || (wheelButton > EVDEV_MAXBUTTONS)) {
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelButton value: %d\n",
|
||||||
|
wheelButton);
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Wheel emulation disabled.\n");
|
||||||
|
|
||||||
|
pEvdev->emulateWheel.enabled = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEvdev->emulateWheel.button = wheelButton;
|
||||||
|
|
||||||
|
inertia = xf86SetIntOption(pInfo->options, "EmulateWheelInertia", 10);
|
||||||
|
|
||||||
|
if (inertia <= 0) {
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelInertia value: %d\n",
|
||||||
|
inertia);
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Using built-in inertia value.\n");
|
||||||
|
|
||||||
|
inertia = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEvdev->emulateWheel.inertia = inertia;
|
||||||
|
|
||||||
|
timeout = xf86SetIntOption(pInfo->options, "EmulateWheelTimeout", 200);
|
||||||
|
|
||||||
|
if (timeout < 0) {
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelTimeout value: %d\n",
|
||||||
|
timeout);
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Using built-in timeout value.\n");
|
||||||
|
|
||||||
|
timeout = 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEvdev->emulateWheel.timeout = timeout;
|
||||||
|
|
||||||
|
/* Configure the Y axis or default it */
|
||||||
|
if (!EvdevWheelEmuHandleButtonMap(pInfo, &(pEvdev->emulateWheel.Y),
|
||||||
|
"YAxisMapping")) {
|
||||||
|
/* Default the Y axis to sane values */
|
||||||
|
pEvdev->emulateWheel.Y.up_button = 4;
|
||||||
|
pEvdev->emulateWheel.Y.down_button = 5;
|
||||||
|
|
||||||
|
/* Simpler to check just the largest value in this case */
|
||||||
|
/* XXX: we should post this to the server */
|
||||||
|
if (5 > pEvdev->num_buttons)
|
||||||
|
pEvdev->num_buttons = 5;
|
||||||
|
|
||||||
|
/* Display default Configuration */
|
||||||
|
xf86IDrvMsg(pInfo, X_CONFIG, "YAxisMapping: buttons %d and %d\n",
|
||||||
|
pEvdev->emulateWheel.Y.up_button,
|
||||||
|
pEvdev->emulateWheel.Y.down_button);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This axis should default to an unconfigured state as most people
|
||||||
|
are not going to expect a Horizontal wheel. */
|
||||||
|
EvdevWheelEmuHandleButtonMap(pInfo, &(pEvdev->emulateWheel.X),
|
||||||
|
"XAxisMapping");
|
||||||
|
|
||||||
|
/* Used by the inertia code */
|
||||||
|
pEvdev->emulateWheel.X.traveled_distance = 0;
|
||||||
|
pEvdev->emulateWheel.Y.traveled_distance = 0;
|
||||||
|
|
||||||
|
xf86IDrvMsg(pInfo, X_CONFIG,
|
||||||
|
"EmulateWheelButton: %d, "
|
||||||
|
"EmulateWheelInertia: %d, "
|
||||||
|
"EmulateWheelTimeout: %d\n",
|
||||||
|
pEvdev->emulateWheel.button, inertia, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
|
BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
if (atom == prop_wheel_emu)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
pEvdev->emulateWheel.enabled = *((BOOL*)val->data);
|
||||||
|
/* Don't enable with zero inertia, otherwise we may get stuck in an
|
||||||
|
* infinite loop */
|
||||||
|
if (pEvdev->emulateWheel.inertia <= 0)
|
||||||
|
{
|
||||||
|
pEvdev->emulateWheel.inertia = 10;
|
||||||
|
/* We may get here before the property is actually enabled */
|
||||||
|
if (prop_wheel_inertia)
|
||||||
|
XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER,
|
||||||
|
16, PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.inertia, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (atom == prop_wheel_button)
|
||||||
|
{
|
||||||
|
int bt;
|
||||||
|
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
bt = *((CARD8*)val->data);
|
||||||
|
|
||||||
|
if (bt < 0 || bt >= EVDEV_MAXBUTTONS)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateWheel.button = bt;
|
||||||
|
} else if (atom == prop_wheel_axismap)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 4 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
pEvdev->emulateWheel.X.up_button = *((CARD8*)val->data);
|
||||||
|
pEvdev->emulateWheel.X.down_button = *(((CARD8*)val->data) + 1);
|
||||||
|
pEvdev->emulateWheel.Y.up_button = *(((CARD8*)val->data) + 2);
|
||||||
|
pEvdev->emulateWheel.Y.down_button = *(((CARD8*)val->data) + 3);
|
||||||
|
}
|
||||||
|
} else if (atom == prop_wheel_inertia)
|
||||||
|
{
|
||||||
|
int inertia;
|
||||||
|
|
||||||
|
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
inertia = *((CARD16*)val->data);
|
||||||
|
|
||||||
|
if (inertia <= 0)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateWheel.inertia = inertia;
|
||||||
|
} else if (atom == prop_wheel_timeout)
|
||||||
|
{
|
||||||
|
int timeout;
|
||||||
|
|
||||||
|
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
timeout = *((CARD16*)val->data);
|
||||||
|
|
||||||
|
if (timeout < 0)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateWheel.timeout = timeout;
|
||||||
|
}
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EvdevWheelEmuInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
int rc = TRUE;
|
||||||
|
char vals[4];
|
||||||
|
|
||||||
|
if (!dev->button) /* don't init prop for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
prop_wheel_emu = MakeAtom(EVDEV_PROP_WHEEL, strlen(EVDEV_PROP_WHEEL), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_emu, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.enabled, FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_emu, FALSE);
|
||||||
|
|
||||||
|
vals[0] = pEvdev->emulateWheel.X.up_button;
|
||||||
|
vals[1] = pEvdev->emulateWheel.X.down_button;
|
||||||
|
vals[2] = pEvdev->emulateWheel.Y.up_button;
|
||||||
|
vals[3] = pEvdev->emulateWheel.Y.down_button;
|
||||||
|
|
||||||
|
prop_wheel_axismap = MakeAtom(EVDEV_PROP_WHEEL_AXES, strlen(EVDEV_PROP_WHEEL_AXES), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_axismap, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 4, vals, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_axismap, FALSE);
|
||||||
|
|
||||||
|
prop_wheel_inertia = MakeAtom(EVDEV_PROP_WHEEL_INERTIA, strlen(EVDEV_PROP_WHEEL_INERTIA), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER, 16,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.inertia, FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_inertia, FALSE);
|
||||||
|
|
||||||
|
prop_wheel_timeout = MakeAtom(EVDEV_PROP_WHEEL_TIMEOUT, strlen(EVDEV_PROP_WHEEL_TIMEOUT), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.timeout, FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_timeout, FALSE);
|
||||||
|
|
||||||
|
prop_wheel_button = MakeAtom(EVDEV_PROP_WHEEL_BUTTON, strlen(EVDEV_PROP_WHEEL_BUTTON), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_button, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.button, FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_button, FALSE);
|
||||||
|
|
||||||
|
XIRegisterPropertyHandler(dev, EvdevWheelEmuSetProperty, NULL, NULL);
|
||||||
|
}
|
||||||
3322
src/evdev.c
3322
src/evdev.c
File diff suppressed because it is too large
Load Diff
482
src/evdev.h
482
src/evdev.h
@@ -1,272 +1,294 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright © 2006-2007 Zephaniah E. Hull
|
* Copyright © 2004-2008 Red Hat, Inc.
|
||||||
* Copyright © 2004 Red Hat, Inc.
|
* Copyright © 2008 University of South Australia
|
||||||
*
|
*
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
* Permission to use, copy, modify, distribute, and sell this software
|
||||||
* copy of this software and associated documentation files (the "Soft-
|
* and its documentation for any purpose is hereby granted without
|
||||||
* ware"), to deal in the Software without restriction, including without
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
* limitation the rights to use, copy, modify, merge, publish, distribute,
|
* and that both that copyright notice and this permission notice
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
* appear in supporting documentation, and that the name of Red Hat
|
||||||
* Software is furnished to do so, provided that the above copyright
|
* not be used in advertising or publicity pertaining to distribution
|
||||||
* notice(s) and this permission notice appear in all copies of the Soft-
|
* of the software without specific, written prior permission. Red
|
||||||
* ware and that both the above copyright notice(s) and this permission
|
* Hat makes no representations about the suitability of this software
|
||||||
* notice appear in supporting documentation.
|
* for any purpose. It is provided "as is" without express or implied
|
||||||
|
* warranty.
|
||||||
*
|
*
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||||
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
|
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||||
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
|
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||||
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
|
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
|
|
||||||
* MANCE OF THIS SOFTWARE.
|
|
||||||
*
|
|
||||||
* Except as contained in this notice, the name of a copyright holder shall
|
|
||||||
* not be used in advertising or otherwise to promote the sale, use or
|
|
||||||
* other dealings in this Software without prior written authorization of
|
|
||||||
* the copyright holder.
|
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Zephaniah E. Hull (warp@aehallh.com)
|
* Kristian Høgsberg (krh@redhat.com)
|
||||||
* Kristian Høgsberg (krh@redhat.com)
|
* Adam Jackson (ajax@redhat.com)
|
||||||
|
* Peter Hutterer (peter@cs.unisa.edu.au)
|
||||||
|
* Oliver McFadden (oliver.mcfadden@nokia.com)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __EVDEV_H
|
|
||||||
#define __EVDEV_H
|
|
||||||
|
|
||||||
#define _XF86_ANSIC_H
|
|
||||||
#define XF86_LIBC_H
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
|
||||||
|
#ifndef EVDEV_H
|
||||||
|
#define EVDEV_H
|
||||||
|
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <errno.h>
|
#include <sys/types.h>
|
||||||
#include <string.h>
|
|
||||||
#include <unistd.h>
|
/* Tolerate prior #include <linux/input.h> */
|
||||||
#include <stdio.h>
|
#undef BUS_NONE
|
||||||
#include <stdlib.h>
|
#undef BUS_PCI
|
||||||
#include <stdarg.h>
|
#undef BUS_SBUS
|
||||||
|
#undef BUS_PLATFORM
|
||||||
|
#undef BUS_USB
|
||||||
|
|
||||||
|
#include <xorg-server.h>
|
||||||
#include <xf86Xinput.h>
|
#include <xf86Xinput.h>
|
||||||
|
#include <xf86_OSproc.h>
|
||||||
|
#include <xkbstr.h>
|
||||||
|
|
||||||
#ifndef BITS_PER_LONG
|
#include <mtdev.h>
|
||||||
#define BITS_PER_LONG (sizeof(unsigned long) * 8)
|
|
||||||
|
#include <libevdev/libevdev.h>
|
||||||
|
|
||||||
|
#ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */
|
||||||
|
#define EV_CNT (EV_MAX+1)
|
||||||
|
#endif
|
||||||
|
#ifndef KEY_CNT
|
||||||
|
#define KEY_CNT (KEY_MAX+1)
|
||||||
|
#endif
|
||||||
|
#ifndef REL_CNT
|
||||||
|
#define REL_CNT (REL_MAX+1)
|
||||||
|
#endif
|
||||||
|
#ifndef ABS_CNT
|
||||||
|
#define ABS_CNT (ABS_MAX+1)
|
||||||
|
#endif
|
||||||
|
#ifndef LED_CNT
|
||||||
|
#define LED_CNT (LED_MAX+1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1)
|
#define EVDEV_MAXBUTTONS 32
|
||||||
#define LONG(x) ((x)/BITS_PER_LONG)
|
#define EVDEV_MAXQUEUE 32
|
||||||
#define MASK(x) (1UL << ((x) & (BITS_PER_LONG - 1)))
|
|
||||||
|
|
||||||
#ifndef test_bit
|
/* evdev flags */
|
||||||
#define test_bit(bit, array) (!!(array[LONG(bit)] & MASK(bit)))
|
#define EVDEV_KEYBOARD_EVENTS (1 << 0)
|
||||||
#endif
|
#define EVDEV_BUTTON_EVENTS (1 << 1)
|
||||||
#ifndef set_bit
|
#define EVDEV_RELATIVE_EVENTS (1 << 2)
|
||||||
#define set_bit(bit, array) (array[LONG(bit)] |= MASK(bit))
|
#define EVDEV_ABSOLUTE_EVENTS (1 << 3)
|
||||||
#endif
|
#define EVDEV_TOUCHPAD (1 << 4)
|
||||||
#ifndef clear_bit
|
#define EVDEV_INITIALIZED (1 << 5) /* WheelInit etc. called already? */
|
||||||
#define clear_bit(bit, array) (array[LONG(bit)] &= ~MASK(bit))
|
#define EVDEV_TOUCHSCREEN (1 << 6)
|
||||||
|
#define EVDEV_CALIBRATED (1 << 7) /* run-time calibrated? */
|
||||||
|
#define EVDEV_TABLET (1 << 8) /* device looks like a tablet? */
|
||||||
|
#define EVDEV_UNIGNORE_ABSOLUTE (1 << 9) /* explicitly unignore abs axes */
|
||||||
|
#define EVDEV_UNIGNORE_RELATIVE (1 << 10) /* explicitly unignore rel axes */
|
||||||
|
#define EVDEV_RELATIVE_MODE (1 << 11) /* Force relative events for devices with absolute axes */
|
||||||
|
|
||||||
|
#ifndef MAX_VALUATORS
|
||||||
|
#define MAX_VALUATORS 36
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef XI_PROP_DEVICE_NODE
|
||||||
|
#define XI_PROP_DEVICE_NODE "Device Node"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <X11/extensions/XKB.h>
|
#define LONG_BITS (sizeof(long) * 8)
|
||||||
#include <X11/extensions/XKBstr.h>
|
|
||||||
|
|
||||||
/*
|
/* Number of longs needed to hold the given number of bits */
|
||||||
* At the moment, ABS_MAX is larger then REL_MAX.
|
#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
|
||||||
* As they are the only two providors of axes, ABS_MAX is it.
|
|
||||||
*/
|
|
||||||
#define AXES_MAX ABS_MAX
|
|
||||||
|
|
||||||
|
#define DEFAULT_MOUSE_DPI 1000.0
|
||||||
|
|
||||||
#define BTN_MAX 96
|
/* Function key mode */
|
||||||
|
enum fkeymode {
|
||||||
|
FKEYMODE_UNKNOWN = 0,
|
||||||
|
FKEYMODE_FKEYS, /* function keys send function keys */
|
||||||
|
FKEYMODE_MMKEYS, /* function keys send multimedia keys */
|
||||||
|
};
|
||||||
|
|
||||||
struct _evdevDevice;
|
enum SlotState {
|
||||||
|
SLOTSTATE_OPEN = 8,
|
||||||
|
SLOTSTATE_CLOSE,
|
||||||
|
SLOTSTATE_UPDATE,
|
||||||
|
SLOTSTATE_EMPTY,
|
||||||
|
};
|
||||||
|
|
||||||
/*
|
enum ButtonAction {
|
||||||
* FIXME: The mode option here is a kludge.
|
BUTTON_RELEASE = 0,
|
||||||
* It can be 0 (rel mode), 1 (abs mode), or -1 (input side has no clue).
|
BUTTON_PRESS = 1
|
||||||
*
|
};
|
||||||
* Worse, it arguably shouldn't even be the sender that decides here.
|
|
||||||
* And only the Axes targets and sources care at all right now.
|
/* axis specific data for wheel emulation */
|
||||||
*/
|
typedef struct {
|
||||||
typedef void (*evdev_map_func_f)(InputInfoPtr pInfo, int value, int mode, void *map_data);
|
int up_button;
|
||||||
|
int down_button;
|
||||||
|
int traveled_distance;
|
||||||
|
} WheelAxis, *WheelAxisPtr;
|
||||||
|
|
||||||
|
/* Event queue used to defer keyboard/button events until EV_SYN time. */
|
||||||
|
typedef struct {
|
||||||
|
enum {
|
||||||
|
EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */
|
||||||
|
EV_QUEUE_BTN, /* xf86PostButtonEvent() */
|
||||||
|
EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */
|
||||||
|
EV_QUEUE_TOUCH, /*xf86PostTouchEvent() */
|
||||||
|
} type;
|
||||||
|
union {
|
||||||
|
int key; /* May be either a key code or button number. */
|
||||||
|
unsigned int touch; /* Touch ID */
|
||||||
|
} detail;
|
||||||
|
int val; /* State of the key/button/touch; pressed or released. */
|
||||||
|
ValuatorMask *touchMask;
|
||||||
|
} EventQueueRec, *EventQueuePtr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned long ev[NBITS(EV_MAX)];
|
struct libevdev *dev;
|
||||||
unsigned long key[NBITS(KEY_MAX)];
|
|
||||||
unsigned long rel[NBITS(REL_MAX)];
|
|
||||||
unsigned long abs[NBITS(ABS_MAX)];
|
|
||||||
unsigned long msc[NBITS(MSC_MAX)];
|
|
||||||
unsigned long led[NBITS(LED_MAX)];
|
|
||||||
unsigned long snd[NBITS(SND_MAX)];
|
|
||||||
unsigned long ff[NBITS(FF_MAX)];
|
|
||||||
} evdevBitsRec, *evdevBitsPtr;
|
|
||||||
|
|
||||||
#define EV_BTN_B_PRESENT (1<<0)
|
char *device;
|
||||||
|
int grabDevice; /* grab the event device? */
|
||||||
|
|
||||||
typedef struct {
|
int num_vals; /* number of valuators */
|
||||||
int real_buttons;
|
int num_mt_vals; /* number of multitouch valuators */
|
||||||
int buttons;
|
int abs_axis_map[ABS_CNT]; /* Map evdev ABS_* to index */
|
||||||
int b_flags[BTN_MAX];
|
int rel_axis_map[REL_CNT]; /* Map evdev REL_* to index */
|
||||||
void *b_map_data[ABS_MAX];
|
ValuatorMask *abs_vals; /* values for absolute axis */
|
||||||
evdev_map_func_f b_map[BTN_MAX];
|
ValuatorMask *rel_vals; /* values for relative axis */
|
||||||
void (*callback[BTN_MAX])(InputInfoPtr pInfo, int button, int value);
|
ValuatorMask *old_vals; /* old absolute values for calculating relative motion */
|
||||||
} evdevBtnRec, *evdevBtnPtr;
|
ValuatorMask *prox; /* last absolute values set while not in proximity */
|
||||||
|
ValuatorMask *mt_mask;
|
||||||
|
ValuatorMask **last_mt_vals;
|
||||||
|
int cur_slot;
|
||||||
|
struct slot {
|
||||||
|
int dirty;
|
||||||
|
enum SlotState state;
|
||||||
|
} *slots;
|
||||||
|
struct mtdev *mtdev;
|
||||||
|
BOOL fake_mt;
|
||||||
|
|
||||||
#define EV_ABS_V_PRESENT (1<<0)
|
int flags;
|
||||||
#define EV_ABS_V_M_AUTO (1<<1)
|
int in_proximity; /* device in proximity */
|
||||||
#define EV_ABS_V_M_REL (1<<2)
|
int use_proximity; /* using the proximity bit? */
|
||||||
#define EV_ABS_V_INVERT (1<<3)
|
int num_buttons; /* number of buttons */
|
||||||
#define EV_ABS_V_RESET (1<<4)
|
BOOL swap_axes;
|
||||||
#define EV_ABS_V_USE_TOUCH (1<<5)
|
BOOL invert_x;
|
||||||
|
BOOL invert_y;
|
||||||
|
int resolution;
|
||||||
|
|
||||||
#define EV_ABS_USE_TOUCH (1<<0)
|
unsigned int abs_queued, rel_queued, prox_queued;
|
||||||
#define EV_ABS_TOUCH (1<<1)
|
|
||||||
#define EV_ABS_UPDATED (1<<2)
|
|
||||||
|
|
||||||
typedef struct {
|
/* Middle mouse button emulation */
|
||||||
int flags;
|
struct {
|
||||||
int axes;
|
BOOL enabled;
|
||||||
int v[ABS_MAX];
|
BOOL pending; /* timer waiting? */
|
||||||
int v_flags[ABS_MAX];
|
int buttonstate; /* phys. button state */
|
||||||
void *v_map_data[ABS_MAX];
|
int state; /* state machine (see bt3emu.c) */
|
||||||
evdev_map_func_f v_map[ABS_MAX];
|
Time expires; /* time of expiry */
|
||||||
} evdevAbsRec, *evdevAbsPtr;
|
Time timeout;
|
||||||
|
uint8_t button; /* phys button to emit */
|
||||||
|
} emulateMB;
|
||||||
|
/* Third mouse button emulation */
|
||||||
|
struct emulate3B {
|
||||||
|
BOOL enabled;
|
||||||
|
BOOL state; /* current state */
|
||||||
|
Time timeout; /* timeout until third button press */
|
||||||
|
int buttonstate; /* phys. button state */
|
||||||
|
int button; /* phys button to emit */
|
||||||
|
int threshold; /* move threshold in dev coords */
|
||||||
|
OsTimerPtr timer;
|
||||||
|
double delta[2]; /* delta x/y, accumulating */
|
||||||
|
int startpos[2]; /* starting pos for abs devices */
|
||||||
|
int flags; /* remember if we had rel or abs movement */
|
||||||
|
} emulate3B;
|
||||||
|
struct {
|
||||||
|
int meta; /* meta key to lock any button */
|
||||||
|
BOOL meta_state; /* meta_button state */
|
||||||
|
unsigned int lock_pair[EVDEV_MAXBUTTONS]; /* specify a meta/lock pair */
|
||||||
|
BOOL lock_state[EVDEV_MAXBUTTONS]; /* state of any locked buttons */
|
||||||
|
} dragLock;
|
||||||
|
struct {
|
||||||
|
BOOL enabled;
|
||||||
|
int button;
|
||||||
|
int button_state;
|
||||||
|
int inertia;
|
||||||
|
WheelAxis X;
|
||||||
|
WheelAxis Y;
|
||||||
|
Time expires; /* time of expiry */
|
||||||
|
Time timeout;
|
||||||
|
} emulateWheel;
|
||||||
|
struct {
|
||||||
|
int vert_delta;
|
||||||
|
int horiz_delta;
|
||||||
|
int dial_delta;
|
||||||
|
} smoothScroll;
|
||||||
|
/* run-time calibration */
|
||||||
|
struct {
|
||||||
|
int min_x;
|
||||||
|
int max_x;
|
||||||
|
int min_y;
|
||||||
|
int max_y;
|
||||||
|
} calibration;
|
||||||
|
|
||||||
#define EV_REL_V_PRESENT (1<<0)
|
unsigned char btnmap[32]; /* config-file specified button mapping */
|
||||||
#define EV_REL_V_INVERT (1<<1)
|
|
||||||
#define EV_REL_UPDATED (1<<0)
|
|
||||||
|
|
||||||
typedef struct {
|
int reopen_attempts; /* max attempts to re-open after read failure */
|
||||||
int flags;
|
int reopen_left; /* number of attempts left to re-open the device */
|
||||||
int v_flags[REL_MAX];
|
OsTimerPtr reopen_timer;
|
||||||
int v[REL_MAX];
|
|
||||||
int axes;
|
|
||||||
void *v_map_data[REL_MAX];
|
|
||||||
evdev_map_func_f v_map[REL_MAX];
|
|
||||||
} evdevRelRec, *evdevRelPtr;
|
|
||||||
|
|
||||||
#define EV_AXES_V_M_ABS (1<<0)
|
/* minor/major number */
|
||||||
#define EV_AXES_V_M_REL (1<<1)
|
dev_t min_maj;
|
||||||
#define EV_AXES_V_PRESENT (1<<2)
|
|
||||||
#define EV_AXES_V_UPDATED (1<<3)
|
|
||||||
|
|
||||||
#define EV_AXES_V_M_MASK (EV_AXES_V_M_ABS | EV_AXES_V_M_REL)
|
/* Event queue used to defer keyboard/button events until EV_SYN time. */
|
||||||
|
int num_queue;
|
||||||
|
EventQueueRec queue[EVDEV_MAXQUEUE];
|
||||||
|
|
||||||
#define EV_AXES_UPDATED (1<<0)
|
enum fkeymode fkeymode;
|
||||||
|
|
||||||
typedef struct {
|
char *type_name;
|
||||||
int axes;
|
} EvdevRec, *EvdevPtr;
|
||||||
int flags;
|
|
||||||
int v_flags[AXES_MAX];
|
|
||||||
int v_min[AXES_MAX];
|
|
||||||
int v_max[AXES_MAX];
|
|
||||||
int v[AXES_MAX];
|
|
||||||
int rotation;
|
|
||||||
float rot_sin, rot_cos;
|
|
||||||
int x, y;
|
|
||||||
} evdevAxesRec, *evdevAxesPtr;
|
|
||||||
|
|
||||||
typedef struct {
|
/* Event posting functions */
|
||||||
char *xkb_rules;
|
void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
|
||||||
char *xkb_model;
|
void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
|
||||||
char *xkb_layout;
|
void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
|
||||||
char *xkb_variant;
|
void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch,
|
||||||
char *xkb_options;
|
ValuatorMask *mask, uint16_t type);
|
||||||
XkbComponentNamesRec xkbnames;
|
void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act);
|
||||||
} evdevKeyRec, *evdevKeyPtr;
|
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
|
||||||
|
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo);
|
||||||
|
void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo);
|
||||||
|
unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code);
|
||||||
|
|
||||||
typedef struct _evdevState {
|
/* Middle Button emulation */
|
||||||
Bool can_grab;
|
int EvdevMBEmuTimer(InputInfoPtr);
|
||||||
Bool sync;
|
BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
|
||||||
|
void EvdevMBEmuWakeupHandler(void *data, int i);
|
||||||
|
void EvdevMBEmuBlockHandler(void *data, void *waitTime);
|
||||||
|
void EvdevMBEmuPreInit(InputInfoPtr);
|
||||||
|
void EvdevMBEmuOn(InputInfoPtr);
|
||||||
|
void EvdevMBEmuFinalize(InputInfoPtr);
|
||||||
|
|
||||||
evdevBtnPtr btn;
|
/* Third button emulation */
|
||||||
evdevAbsPtr abs;
|
CARD32 Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, void *arg);
|
||||||
evdevRelPtr rel;
|
BOOL Evdev3BEmuFilterEvent(InputInfoPtr, int, BOOL);
|
||||||
evdevKeyPtr key;
|
void Evdev3BEmuPreInit(InputInfoPtr pInfo);
|
||||||
evdevAxesPtr axes;
|
void Evdev3BEmuOn(InputInfoPtr);
|
||||||
} evdevStateRec, *evdevStatePtr;
|
void Evdev3BEmuFinalize(InputInfoPtr);
|
||||||
|
void Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy);
|
||||||
|
void Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals);
|
||||||
|
|
||||||
typedef struct _evdevDevice {
|
/* Mouse Wheel emulation */
|
||||||
const char *device;
|
void EvdevWheelEmuPreInit(InputInfoPtr pInfo);
|
||||||
|
BOOL EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value);
|
||||||
|
BOOL EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv);
|
||||||
|
|
||||||
evdevBitsRec bits;
|
/* Draglock code */
|
||||||
|
void EvdevDragLockPreInit(InputInfoPtr pInfo);
|
||||||
|
BOOL EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value);
|
||||||
|
|
||||||
evdevStateRec state;
|
void EvdevMBEmuInitProperty(DeviceIntPtr);
|
||||||
} evdevDeviceRec, *evdevDevicePtr;
|
void Evdev3BEmuInitProperty(DeviceIntPtr);
|
||||||
|
void EvdevWheelEmuInitProperty(DeviceIntPtr);
|
||||||
int EvdevBtnInit (DeviceIntPtr device);
|
void EvdevDragLockInitProperty(DeviceIntPtr);
|
||||||
int EvdevBtnOn (DeviceIntPtr device);
|
void EvdevAppleInitProperty(DeviceIntPtr);
|
||||||
int EvdevBtnOff (DeviceIntPtr device);
|
#endif
|
||||||
int EvdevBtnNew0(InputInfoPtr pInfo);
|
|
||||||
int EvdevBtnNew1(InputInfoPtr pInfo);
|
|
||||||
void EvdevBtnProcess (InputInfoPtr pInfo, struct input_event *ev);
|
|
||||||
void EvdevBtnPostFakeClicks(InputInfoPtr pInfo, int button, int count);
|
|
||||||
int EvdevBtnFind (InputInfoPtr pInfo, const char *button);
|
|
||||||
int EvdevBtnExists (InputInfoPtr pInfo, int button);
|
|
||||||
|
|
||||||
int EvdevAxesInit (DeviceIntPtr device);
|
|
||||||
int EvdevAxesOn (DeviceIntPtr device);
|
|
||||||
int EvdevAxesOff (DeviceIntPtr device);
|
|
||||||
int EvdevAxesNew0(InputInfoPtr pInfo);
|
|
||||||
int EvdevAxesNew1(InputInfoPtr pInfo);
|
|
||||||
void EvdevAxesAbsProcess (InputInfoPtr pInfo, struct input_event *ev);
|
|
||||||
void EvdevAxesRelProcess (InputInfoPtr pInfo, struct input_event *ev);
|
|
||||||
void EvdevAxesSynRep (InputInfoPtr pInfo);
|
|
||||||
void EvdevAxesSynCfg (InputInfoPtr pInfo);
|
|
||||||
|
|
||||||
int EvdevKeyInit (DeviceIntPtr device);
|
|
||||||
int EvdevKeyNew (InputInfoPtr pInfo);
|
|
||||||
int EvdevKeyOn (DeviceIntPtr device);
|
|
||||||
int EvdevKeyOff (DeviceIntPtr device);
|
|
||||||
void EvdevKeyProcess (InputInfoPtr pInfo, struct input_event *ev);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Option handling stuff.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct evdev_option_token_s {
|
|
||||||
const char *str;
|
|
||||||
struct evdev_option_token_s *chain;
|
|
||||||
struct evdev_option_token_s *next;
|
|
||||||
} evdev_option_token_t;
|
|
||||||
|
|
||||||
typedef Bool (*evdev_parse_opt_func_f)(InputInfoPtr pInfo, const char *name, evdev_option_token_t *token, int *flags);
|
|
||||||
typedef Bool (*evdev_parse_map_func_f)(InputInfoPtr pInfo,
|
|
||||||
const char *name,
|
|
||||||
evdev_option_token_t *option,
|
|
||||||
void **map_data, evdev_map_func_f *map_func);
|
|
||||||
|
|
||||||
evdev_option_token_t *EvdevTokenize (const char *option, const char *tokens);
|
|
||||||
void EvdevFreeTokens (evdev_option_token_t *token);
|
|
||||||
Bool EvdevParseMapToRelAxis (InputInfoPtr pInfo,
|
|
||||||
const char *name,
|
|
||||||
evdev_option_token_t *option,
|
|
||||||
void **map_data, evdev_map_func_f *map_func);
|
|
||||||
Bool EvdevParseMapToAbsAxis (InputInfoPtr pInfo,
|
|
||||||
const char *name,
|
|
||||||
evdev_option_token_t *option,
|
|
||||||
void **map_data, evdev_map_func_f *map_func);
|
|
||||||
Bool
|
|
||||||
EvdevParseMapToButton (InputInfoRec *pInfo,
|
|
||||||
const char *name,
|
|
||||||
evdev_option_token_t *option,
|
|
||||||
void **map_data, evdev_map_func_f *map_func);
|
|
||||||
Bool
|
|
||||||
EvdevParseMapToButtons (InputInfoRec *pInfo,
|
|
||||||
const char *name,
|
|
||||||
evdev_option_token_t *option,
|
|
||||||
void **map_data, evdev_map_func_f *map_func);
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
char *name;
|
|
||||||
evdev_parse_map_func_f func;
|
|
||||||
} evdev_map_parsers_t;
|
|
||||||
|
|
||||||
extern evdev_map_parsers_t evdev_map_parsers[];
|
|
||||||
Bool EvdevParseMapOption (InputInfoRec *pInfo, char *option, char *def, void **map_data, evdev_map_func_f *map_func);
|
|
||||||
|
|
||||||
#endif /* __EVDEV_H */
|
|
||||||
|
|||||||
930
src/evdev_axes.c
930
src/evdev_axes.c
@@ -1,930 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2006-2007 Zephaniah E. Hull
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Soft-
|
|
||||||
* ware"), to deal in the Software without restriction, including without
|
|
||||||
* limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, provided that the above copyright
|
|
||||||
* notice(s) and this permission notice appear in all copies of the Soft-
|
|
||||||
* ware and that both the above copyright notice(s) and this permission
|
|
||||||
* notice appear in supporting documentation.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
|
||||||
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
|
|
||||||
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
|
|
||||||
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
|
|
||||||
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
|
|
||||||
* MANCE OF THIS SOFTWARE.
|
|
||||||
*
|
|
||||||
* Except as contained in this notice, the name of a copyright holder shall
|
|
||||||
* not be used in advertising or otherwise to promote the sale, use or
|
|
||||||
* other dealings in this Software without prior written authorization of
|
|
||||||
* the copyright holder.
|
|
||||||
*
|
|
||||||
* Author: Zephaniah E. Hull (warp@aehallh.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
#include <X11/XF86keysym.h>
|
|
||||||
#include <X11/extensions/XIproto.h>
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#include "evdev.h"
|
|
||||||
|
|
||||||
#include <xf86.h>
|
|
||||||
|
|
||||||
#include <xf86Module.h>
|
|
||||||
#include <mipointer.h>
|
|
||||||
|
|
||||||
|
|
||||||
#include <xf86_OSproc.h>
|
|
||||||
|
|
||||||
#undef DEBUG
|
|
||||||
|
|
||||||
static char *rel_axis_names[] = {
|
|
||||||
"X",
|
|
||||||
"Y",
|
|
||||||
"Z",
|
|
||||||
"RX",
|
|
||||||
"RY",
|
|
||||||
"RZ",
|
|
||||||
"HWHEEL",
|
|
||||||
"DIAL",
|
|
||||||
"WHEEL",
|
|
||||||
"MISC",
|
|
||||||
"10",
|
|
||||||
"11",
|
|
||||||
"12",
|
|
||||||
"13",
|
|
||||||
"14",
|
|
||||||
"15",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static char *abs_axis_names[] = {
|
|
||||||
"X",
|
|
||||||
"Y",
|
|
||||||
"Z",
|
|
||||||
"RX",
|
|
||||||
"RY",
|
|
||||||
"RZ",
|
|
||||||
"THROTTLE",
|
|
||||||
"RUDDER",
|
|
||||||
"WHEEL",
|
|
||||||
"GAS",
|
|
||||||
"BRAKE",
|
|
||||||
"11",
|
|
||||||
"12",
|
|
||||||
"13",
|
|
||||||
"14",
|
|
||||||
"15",
|
|
||||||
"HAT0X",
|
|
||||||
"HAT0Y",
|
|
||||||
"HAT1X",
|
|
||||||
"HAT1Y",
|
|
||||||
"HAT2X",
|
|
||||||
"HAT2Y",
|
|
||||||
"HAT3X",
|
|
||||||
"HAT3Y",
|
|
||||||
"PRESSURE",
|
|
||||||
"TILT_X",
|
|
||||||
"TILT_Y",
|
|
||||||
"TOOL_WIDTH",
|
|
||||||
"VOLUME",
|
|
||||||
"29",
|
|
||||||
"30",
|
|
||||||
"31",
|
|
||||||
"32",
|
|
||||||
"33",
|
|
||||||
"34",
|
|
||||||
"35",
|
|
||||||
"36",
|
|
||||||
"37",
|
|
||||||
"38",
|
|
||||||
"39",
|
|
||||||
"MISC",
|
|
||||||
"41",
|
|
||||||
"42",
|
|
||||||
"43",
|
|
||||||
"44",
|
|
||||||
"45",
|
|
||||||
"46",
|
|
||||||
"47",
|
|
||||||
"48",
|
|
||||||
"49",
|
|
||||||
"50",
|
|
||||||
"51",
|
|
||||||
"52",
|
|
||||||
"53",
|
|
||||||
"54",
|
|
||||||
"55",
|
|
||||||
"56",
|
|
||||||
"57",
|
|
||||||
"58",
|
|
||||||
"59",
|
|
||||||
"60",
|
|
||||||
"61",
|
|
||||||
"62",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static void EvdevAxesTouchCallback (InputInfoPtr pInfo, int button, int value);
|
|
||||||
|
|
||||||
void
|
|
||||||
EvdevAxesMapAxis (InputInfoPtr pInfo, int value, int mode, void *map_data)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
evdevAxesPtr axes = state->axes;
|
|
||||||
long map = (long) map_data;
|
|
||||||
|
|
||||||
if (map >= AXES_MAX || !axes || !(axes->v_flags[map] & (EV_AXES_V_M_ABS | EV_AXES_V_M_REL)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
axes->v[map] = value;
|
|
||||||
if (mode == 0) {
|
|
||||||
axes->v_flags[map] &= ~EV_AXES_V_M_ABS;
|
|
||||||
axes->v_flags[map] |= EV_AXES_V_M_REL;
|
|
||||||
} else if (mode == 1) {
|
|
||||||
axes->v_flags[map] &= ~EV_AXES_V_M_REL;
|
|
||||||
axes->v_flags[map] |= EV_AXES_V_M_ABS;
|
|
||||||
}
|
|
||||||
axes->v_flags[map] |= EV_AXES_V_UPDATED;
|
|
||||||
axes->flags |= EV_AXES_UPDATED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
EvdevParseRelOptions (InputInfoPtr pInfo, const char *name, evdev_option_token_t *option, int *flags)
|
|
||||||
{
|
|
||||||
if (!option)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (; option; option = option->next) {
|
|
||||||
if (!strcasecmp (option->str, "invert"))
|
|
||||||
*flags |= EV_REL_V_INVERT;
|
|
||||||
else
|
|
||||||
xf86Msg(X_ERROR, "%s: %s unknown relative option '%s'.\n", pInfo->name, name, option->str);
|
|
||||||
|
|
||||||
}
|
|
||||||
*flags |= EV_REL_V_PRESENT;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
EvdevParseAbsOptions (InputInfoPtr pInfo, const char *name, evdev_option_token_t *option, int *flags)
|
|
||||||
{
|
|
||||||
if (!option)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
for (; option; option = option->next) {
|
|
||||||
if (!strcasecmp (option->str, "invert"))
|
|
||||||
*flags |= EV_ABS_V_INVERT;
|
|
||||||
else if (!strcasecmp (option->str, "use_touch"))
|
|
||||||
*flags |= EV_ABS_V_USE_TOUCH;
|
|
||||||
else if (!strcasecmp (option->str, "mode_auto"))
|
|
||||||
*flags |= EV_ABS_V_M_AUTO;
|
|
||||||
else if (!strcasecmp (option->str, "mode_rel"))
|
|
||||||
*flags |= EV_ABS_V_M_REL;
|
|
||||||
else
|
|
||||||
xf86Msg(X_ERROR, "%s: %s unknown absolute option '%s'.\n", pInfo->name, name, option->str);
|
|
||||||
|
|
||||||
}
|
|
||||||
*flags |= EV_ABS_V_PRESENT;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
EvdevParseMapToRelAxis (InputInfoPtr pInfo,
|
|
||||||
const char *name,
|
|
||||||
evdev_option_token_t *option,
|
|
||||||
void **map_data, evdev_map_func_f *map_func)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
evdevAxesPtr axes = state->axes;
|
|
||||||
long i;
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
i = strtol (option->str, NULL, 0);
|
|
||||||
if (errno) {
|
|
||||||
for (i = 0; rel_axis_names[i]; i++) {
|
|
||||||
if (!strcmp (option->str, rel_axis_names[i]))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!rel_axis_names[i])
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if ((i < 0) || (i > AXES_MAX))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (axes->v_flags[i] & EV_AXES_V_PRESENT)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
axes->v_flags[i] = EV_AXES_V_M_REL | EV_AXES_V_PRESENT;
|
|
||||||
|
|
||||||
*map_data = (void *) i;
|
|
||||||
*map_func = EvdevAxesMapAxis;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
EvdevParseMapToAbsAxis (InputInfoPtr pInfo,
|
|
||||||
const char *name,
|
|
||||||
evdev_option_token_t *option,
|
|
||||||
void **map_data, evdev_map_func_f *map_func)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
evdevAxesPtr axes = state->axes;
|
|
||||||
long i;
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
i = strtol (option->str, NULL, 0);
|
|
||||||
if (errno) {
|
|
||||||
for (i = 0; abs_axis_names[i]; i++) {
|
|
||||||
if (!strcmp (option->str, abs_axis_names[i]))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (!abs_axis_names[i]) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: No axis named '%s'.\n", pInfo->name, name, option->str);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((i < 0) || (i > AXES_MAX)) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Axis %ld out of range.\n", pInfo->name, name, i);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (axes->v_flags[i] & EV_AXES_V_PRESENT) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Axis %ld already claimed.\n", pInfo->name, name, i);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
option = option->next;
|
|
||||||
if (!option) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: No min.\n", pInfo->name, name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
axes->v_min[i] = strtol (option->str, NULL, 0);
|
|
||||||
if (errno) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Unable to parse '%s' as min. (%s)\n", pInfo->name, name, option->str, strerror(errno));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
option = option->next;
|
|
||||||
if (!option) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: No max.\n", pInfo->name, name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
axes->v_max[i] = strtol (option->str, NULL, 0);
|
|
||||||
if (errno) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Unable to parse '%s' as max. (%s)\n", pInfo->name, name, option->str, strerror(errno));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
axes->v_flags[i] = EV_AXES_V_M_ABS | EV_AXES_V_PRESENT;
|
|
||||||
|
|
||||||
*map_data = (void *) i;
|
|
||||||
*map_func = EvdevAxesMapAxis;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Bool
|
|
||||||
EvdevConvert(InputInfoPtr pInfo, int first, int num, int v0, int v1, int v2,
|
|
||||||
int v3, int v4, int v5, int *x, int *y)
|
|
||||||
{
|
|
||||||
if (first == 0) {
|
|
||||||
*x = v0;
|
|
||||||
*y = v1;
|
|
||||||
return TRUE;
|
|
||||||
} else
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Rotation and rep code, this is a mess and much of it needs to live in mi/
|
|
||||||
* after a cleanup.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
EvdevAxesDoRotation (InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
evdevAxesPtr axes = state->axes;
|
|
||||||
DeviceIntPtr dev = pInfo->dev;
|
|
||||||
AbsoluteClassRec *dabs = dev->absolute;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Rotation.
|
|
||||||
* Cache the sine and cosine results so we're not doing it every time.
|
|
||||||
*/
|
|
||||||
if (dabs->rotation != axes->rotation || (axes->rot_cos == axes->rot_sin)) {
|
|
||||||
axes->rotation = dabs->rotation % 360;
|
|
||||||
axes->rot_cos = cos ( ((float) axes->rotation) * (M_PI/180));
|
|
||||||
axes->rot_sin = sin ( ((float) axes->rotation) * (M_PI/180));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (axes->rotation) {
|
|
||||||
float x = axes->v[0], y = axes->v[1];
|
|
||||||
axes->v[0] = (x * axes->rot_cos) - (y * axes->rot_sin);
|
|
||||||
axes->v[1] = (y * axes->rot_cos) + (x * axes->rot_sin);
|
|
||||||
|
|
||||||
axes->v_flags[0] |= EV_AXES_V_UPDATED;
|
|
||||||
axes->v_flags[1] |= EV_AXES_V_UPDATED;
|
|
||||||
#if DEBUG
|
|
||||||
xf86Msg(X_ERROR, "%s %d (%s): rotation=%d, cos=%f, sin=%f, x=%f, y=%f, v[0]=%d, v[1]=%d\n", __FILE__, __LINE__, __FUNCTION__,
|
|
||||||
axes->rotation, axes->rot_cos, axes->rot_sin, x, y, axes->v[0], axes->v[1]);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Cx - raw data from touch screen
|
|
||||||
* Sxhigh - scaled highest dimension
|
|
||||||
* (remember, this is of rows - 1 because of 0 origin)
|
|
||||||
* Sxlow - scaled lowest dimension
|
|
||||||
* Rxhigh - highest raw value from touch screen calibration
|
|
||||||
* Rxlow - lowest raw value from touch screen calibration
|
|
||||||
*
|
|
||||||
* This function is the same for X or Y coordinates.
|
|
||||||
* You may have to reverse the high and low values to compensate for
|
|
||||||
* different orgins on the touch screen vs X.
|
|
||||||
*/
|
|
||||||
|
|
||||||
_X_EXPORT int
|
|
||||||
EvdevScaleAxis(int Cx,
|
|
||||||
int Sxlow,
|
|
||||||
int Sxhigh,
|
|
||||||
int Rxlow,
|
|
||||||
int Rxhigh)
|
|
||||||
{
|
|
||||||
int X;
|
|
||||||
int dSx = Sxhigh - Sxlow;
|
|
||||||
int dRx = Rxhigh - Rxlow;
|
|
||||||
|
|
||||||
/* This is +, because Cx is negitive, so we're really subtracting. */
|
|
||||||
if (Cx < 0)
|
|
||||||
Cx = Rxhigh + Cx;
|
|
||||||
|
|
||||||
dSx = Sxhigh - Sxlow;
|
|
||||||
if (dRx) {
|
|
||||||
X = ((dSx * (Cx - Rxlow)) / dRx) + Sxlow;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
X = 0;
|
|
||||||
ErrorF ("Divide by Zero in evdevScaleAxis");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (X < Sxlow)
|
|
||||||
X = Sxlow;
|
|
||||||
if (X > Sxhigh)
|
|
||||||
X = Sxhigh;
|
|
||||||
|
|
||||||
return (X);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
EvdevAxesSynRep (InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
evdevAxesPtr axes = state->axes;
|
|
||||||
DeviceIntPtr dev = pInfo->dev;
|
|
||||||
AbsoluteClassRec *dabs = dev->absolute;
|
|
||||||
|
|
||||||
int i, start, run, mode;
|
|
||||||
|
|
||||||
if (!axes || !(axes->flags & EV_AXES_UPDATED))
|
|
||||||
return;
|
|
||||||
|
|
||||||
start = 0;
|
|
||||||
mode = 0;
|
|
||||||
run = 0;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This handles most, but not all, of the ABS_CALIB and ABS_AREA
|
|
||||||
* additions to XInput 1.0.
|
|
||||||
*
|
|
||||||
* Note, we do this if both X and Y are set to absolute, or a more
|
|
||||||
* limited subset if both X and Y are relative, we don't do anything
|
|
||||||
* if we lack X or Y, or if they are not both set to both be ABS or REL.
|
|
||||||
*/
|
|
||||||
if (axes->axes >= 2 && dabs) {
|
|
||||||
if ((axes->v_flags[0] & EV_AXES_V_M_ABS) &&
|
|
||||||
(axes->v_flags[1] & EV_AXES_V_M_ABS) &&
|
|
||||||
((axes->v_flags[0] & EV_AXES_V_UPDATED) ||
|
|
||||||
(axes->v_flags[1] & EV_AXES_V_UPDATED))
|
|
||||||
) {
|
|
||||||
int width, height, min_x, max_x, min_y, max_y;
|
|
||||||
|
|
||||||
if (axes->v_flags[0] & EV_AXES_V_UPDATED) axes->x = axes->v[0];
|
|
||||||
else axes->v[0] = axes->x;
|
|
||||||
if (axes->v_flags[1] & EV_AXES_V_UPDATED) axes->y = axes->v[1];
|
|
||||||
else axes->v[1] = axes->y;
|
|
||||||
|
|
||||||
if (dabs->width > 0)
|
|
||||||
width = dabs->width;
|
|
||||||
else
|
|
||||||
width = screenInfo.screens[dabs->screen]->width;
|
|
||||||
|
|
||||||
if (dabs->height > 0)
|
|
||||||
height = dabs->height;
|
|
||||||
else
|
|
||||||
height = screenInfo.screens[dabs->screen]->height;
|
|
||||||
|
|
||||||
if (dabs->flip_x)
|
|
||||||
axes->v[0] = dabs->max_x - axes->v[0];
|
|
||||||
if (dabs->flip_y)
|
|
||||||
axes->v[1] = dabs->max_y - axes->v[1];
|
|
||||||
|
|
||||||
/*
|
|
||||||
* In some cases we need to swap width and height.
|
|
||||||
* This depends on the rotation.
|
|
||||||
*/
|
|
||||||
if ( (axes->rotation >= 45 && axes->rotation < 135) ||
|
|
||||||
(axes->rotation >= 225 && axes->rotation < 315)) {
|
|
||||||
min_x = dabs->min_y;
|
|
||||||
max_x = dabs->max_y;
|
|
||||||
min_y = dabs->min_x;
|
|
||||||
max_y = dabs->max_x;
|
|
||||||
} else {
|
|
||||||
min_x = dabs->min_x;
|
|
||||||
max_x = dabs->max_x;
|
|
||||||
min_y = dabs->min_y;
|
|
||||||
max_y = dabs->max_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
EvdevAxesDoRotation (pInfo);
|
|
||||||
|
|
||||||
axes->v[0] = EvdevScaleAxis (axes->v[0], 0, width, min_x, max_x);
|
|
||||||
axes->v[1] = EvdevScaleAxis (axes->v[1], 0, height, min_y, max_y);
|
|
||||||
|
|
||||||
axes->v[0] += dabs->offset_x;
|
|
||||||
axes->v[1] += dabs->offset_y;
|
|
||||||
|
|
||||||
xf86XInputSetScreen (pInfo, dabs->screen, axes->v[0], axes->v[1]);
|
|
||||||
} else if ((axes->v_flags[0] & EV_AXES_V_M_REL) &&
|
|
||||||
(axes->v_flags[1] & EV_AXES_V_M_REL) &&
|
|
||||||
((axes->v_flags[0] & EV_AXES_V_UPDATED) ||
|
|
||||||
(axes->v_flags[1] & EV_AXES_V_UPDATED))
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (axes->v_flags[0] & EV_AXES_V_UPDATED) axes->x = axes->v[0];
|
|
||||||
else axes->v[0] = axes->x;
|
|
||||||
if (axes->v_flags[1] & EV_AXES_V_UPDATED) axes->y = axes->v[1];
|
|
||||||
else axes->v[1] = axes->y;
|
|
||||||
|
|
||||||
if (dabs->flip_x)
|
|
||||||
axes->v[0] = -axes->v[0];
|
|
||||||
if (dabs->flip_y)
|
|
||||||
axes->v[1] = -axes->v[1];
|
|
||||||
|
|
||||||
EvdevAxesDoRotation (pInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
xf86Msg(X_ERROR, "%s %d (%s): v[0]=%d%s%s, v[1]=%d%s%s, v[2]=%d%s%s\n", __FILE__, __LINE__, __FUNCTION__,
|
|
||||||
axes->v[0],
|
|
||||||
axes->v_flags[0] & EV_AXES_V_M_ABS ? "!" : "",
|
|
||||||
axes->v_flags[0] & EV_AXES_V_UPDATED ? "*" : "",
|
|
||||||
axes->v[1],
|
|
||||||
axes->v_flags[1] & EV_AXES_V_M_ABS ? "!" : "",
|
|
||||||
axes->v_flags[1] & EV_AXES_V_UPDATED ? "*" : "",
|
|
||||||
axes->v[2],
|
|
||||||
axes->v_flags[2] & EV_AXES_V_M_ABS ? "!" : "",
|
|
||||||
axes->v_flags[2] & EV_AXES_V_UPDATED ? "*" : "");
|
|
||||||
#endif
|
|
||||||
for (i = 0; i < axes->axes; i++) {
|
|
||||||
if (axes->v_flags[i] & EV_AXES_V_UPDATED) {
|
|
||||||
if (run) {
|
|
||||||
if (mode != (axes->v_flags[i] & EV_AXES_V_M_MASK)) {
|
|
||||||
mode = (mode == EV_AXES_V_M_ABS);
|
|
||||||
#if DEBUG
|
|
||||||
xf86Msg(X_ERROR, "%s %d (%s): mode=%d, start=%d, i - start=%d\n", __FILE__, __LINE__, __FUNCTION__,
|
|
||||||
mode, start, i - start);
|
|
||||||
#endif
|
|
||||||
xf86PostMotionEventP (pInfo->dev, mode, start, i - start, axes->v + start);
|
|
||||||
start = i;
|
|
||||||
mode = axes->v_flags[i] & EV_AXES_V_M_MASK;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
start = i;
|
|
||||||
mode = axes->v_flags[i] & EV_AXES_V_M_MASK;
|
|
||||||
}
|
|
||||||
run = 1;
|
|
||||||
axes->v_flags[i] &= ~EV_AXES_V_UPDATED;
|
|
||||||
} else if (run) {
|
|
||||||
mode = (mode == EV_AXES_V_M_ABS);
|
|
||||||
xf86PostMotionEventP (pInfo->dev, mode, start, i - start, axes->v + start);
|
|
||||||
run = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (run) {
|
|
||||||
mode = (mode == EV_AXES_V_M_ABS);
|
|
||||||
xf86PostMotionEventP (pInfo->dev, mode, start, i - start, axes->v + start);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* End rotation and rep code, this is a mess and much of it needs to live in mi/
|
|
||||||
* after a cleanup.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
EvdevAxesSynCfg (InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
/* EvdevAxesAbsSynCfg (pInfo);*/
|
|
||||||
/* EvdevAxesRelSynCfg (pInfo);*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
EvdevAxesAbsProcess (InputInfoPtr pInfo, struct input_event *ev)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
evdevAbsRec *abs = state->abs;
|
|
||||||
int value, v_flags, is_rel;
|
|
||||||
|
|
||||||
if (ev->code >= ABS_MAX || !abs->v_map[ev->code])
|
|
||||||
return;
|
|
||||||
|
|
||||||
value = ev->value;
|
|
||||||
v_flags = abs->v_flags[ev->code];
|
|
||||||
|
|
||||||
if ((v_flags & EV_ABS_V_USE_TOUCH) && !(state->abs->flags & EV_ABS_TOUCH))
|
|
||||||
return;
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (v_flags & EV_ABS_V_INVERT)
|
|
||||||
value = -value;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (v_flags & EV_ABS_V_M_REL)
|
|
||||||
is_rel = 1;
|
|
||||||
else if ((v_flags & EV_ABS_V_M_AUTO) && pInfo->dev->valuator->mode == Relative)
|
|
||||||
is_rel = 1;
|
|
||||||
else
|
|
||||||
is_rel = 0;
|
|
||||||
|
|
||||||
if (is_rel) {
|
|
||||||
if ((v_flags & EV_ABS_V_RESET) && value != abs->v[ev->code]) {
|
|
||||||
abs->v_flags[ev->code] &= ~EV_ABS_V_RESET;
|
|
||||||
} else
|
|
||||||
abs->v_map[ev->code](pInfo, value - abs->v[ev->code], 0, abs->v_map_data[ev->code]);
|
|
||||||
|
|
||||||
abs->v[ev->code] = value;
|
|
||||||
} else
|
|
||||||
abs->v_map[ev->code](pInfo, value, 1, abs->v_map_data[ev->code]);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
EvdevAxesRelProcess (InputInfoPtr pInfo, struct input_event *ev)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
evdevRelRec *rel = state->rel;
|
|
||||||
int value, v_flags;
|
|
||||||
|
|
||||||
if (ev->code >= REL_MAX || !rel->v_map[ev->code])
|
|
||||||
return;
|
|
||||||
|
|
||||||
value = ev->value;
|
|
||||||
v_flags = rel->v_flags[ev->code];
|
|
||||||
|
|
||||||
if (v_flags & EV_REL_V_INVERT)
|
|
||||||
value = -value;
|
|
||||||
|
|
||||||
rel->v_map[ev->code](pInfo, value, 0, rel->v_map_data[ev->code]);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevAxesOn (DeviceIntPtr device)
|
|
||||||
{
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevAxesOff (DeviceIntPtr device)
|
|
||||||
{
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
EvdevAxisAbsNew(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
evdevStateRec *state = &pEvdev->state;
|
|
||||||
evdevAbsRec *abs;
|
|
||||||
struct input_absinfo absinfo;
|
|
||||||
char option[128], value[128];
|
|
||||||
const char *s;
|
|
||||||
int i, j, real_axes;
|
|
||||||
evdev_option_token_t *tokens;
|
|
||||||
|
|
||||||
real_axes = 0;
|
|
||||||
for (i = 0; i < ABS_MAX; i++)
|
|
||||||
if (test_bit (i, pEvdev->bits.abs))
|
|
||||||
real_axes++;
|
|
||||||
|
|
||||||
if (!real_axes)
|
|
||||||
return !Success;
|
|
||||||
|
|
||||||
state->abs = abs = Xcalloc (sizeof (evdevAbsRec));
|
|
||||||
|
|
||||||
xf86Msg(X_INFO, "%s: Found %d absolute axes.\n", pInfo->name, real_axes);
|
|
||||||
xf86Msg(X_INFO, "%s: Configuring as pointer.\n", pInfo->name);
|
|
||||||
pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |
|
|
||||||
XI86_CONFIGURED;
|
|
||||||
pInfo->type_name = XI_MOUSE;
|
|
||||||
pInfo->conversion_proc = EvdevConvert;
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < ABS_MAX; i++) {
|
|
||||||
if (!test_bit (i, pEvdev->bits.abs))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (ioctl (pInfo->fd, EVIOCGABS(i), &absinfo) < 0) {
|
|
||||||
xf86Msg(X_ERROR, "ioctl EVIOCGABS failed: %s\n", strerror(errno));
|
|
||||||
return !Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(option, sizeof(option), "Abs%sMapTo", abs_axis_names[i]);
|
|
||||||
snprintf(value, sizeof(value), "AbsAxis %d %d %d", j, absinfo.minimum, absinfo.maximum);
|
|
||||||
|
|
||||||
EvdevParseMapOption (pInfo, option, value, &abs->v_map_data[i], &abs->v_map[i]);
|
|
||||||
|
|
||||||
snprintf(option, sizeof(option), "Abs%sOptions", abs_axis_names[i]);
|
|
||||||
if (i == ABS_X || i == ABS_Y)
|
|
||||||
s = xf86SetStrOption(pInfo->options, option, "use_touch mode_auto");
|
|
||||||
else
|
|
||||||
s = xf86SetStrOption(pInfo->options, option, "");
|
|
||||||
if (s[0]) {
|
|
||||||
tokens = EvdevTokenize (s, " ");
|
|
||||||
if (!EvdevParseAbsOptions (pInfo, option, tokens, &abs->v_flags[i]))
|
|
||||||
xf86Msg (X_ERROR, "%s: Unable to parse '%s' as absolute options.\n", pInfo->name, s);
|
|
||||||
EvdevFreeTokens (tokens);
|
|
||||||
}
|
|
||||||
abs->v_flags[i] |= EV_ABS_V_PRESENT;
|
|
||||||
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
|
|
||||||
state->abs->axes = real_axes;
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
EvdevAxisAbsNew1(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
if (!state->abs)
|
|
||||||
return !Success;
|
|
||||||
|
|
||||||
xf86Msg(X_CONFIG, "%s: Configuring %d absolute axes.\n", pInfo->name,
|
|
||||||
state->abs->axes);
|
|
||||||
|
|
||||||
{
|
|
||||||
int btn;
|
|
||||||
|
|
||||||
s = xf86SetStrOption(pInfo->options, "AbsoluteTouch", "DIGI_Touch");
|
|
||||||
btn = EvdevBtnFind (pInfo, s);
|
|
||||||
if (btn != -1) {
|
|
||||||
if (EvdevBtnExists (pInfo, btn)) {
|
|
||||||
state->abs->flags |= EV_ABS_USE_TOUCH;
|
|
||||||
xf86Msg(X_ERROR, "%s: Button: %d.\n", pInfo->name, btn);
|
|
||||||
xf86Msg(X_ERROR, "%s: state->btn: %p.\n", pInfo->name, state->btn);
|
|
||||||
state->btn->callback[btn] = &EvdevAxesTouchCallback;
|
|
||||||
} else {
|
|
||||||
xf86Msg(X_ERROR, "%s: AbsoluteTouch: '%s' does not exist.\n", pInfo->name, s);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
xf86Msg(X_ERROR, "%s: AbsoluteTouch: '%s' is not a valid button name.\n", pInfo->name, s);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
EvdevAxisRelNew(InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
evdevRelPtr rel;
|
|
||||||
char *s, option[128], value[128];
|
|
||||||
int i, j, real_axes;
|
|
||||||
evdev_option_token_t *tokens;
|
|
||||||
|
|
||||||
real_axes = 0;
|
|
||||||
for (i = 0; i < REL_MAX; i++)
|
|
||||||
if (test_bit (i, pEvdev->bits.rel))
|
|
||||||
real_axes++;
|
|
||||||
|
|
||||||
if (!real_axes && (!state->abs || state->abs->axes < 2))
|
|
||||||
return !Success;
|
|
||||||
|
|
||||||
state->rel = rel = Xcalloc (sizeof (evdevRelRec));
|
|
||||||
|
|
||||||
xf86Msg(X_INFO, "%s: Found %d relative axes.\n", pInfo->name,
|
|
||||||
real_axes);
|
|
||||||
xf86Msg(X_INFO, "%s: Configuring as pointer.\n", pInfo->name);
|
|
||||||
pInfo->flags |= XI86_POINTER_CAPABLE | XI86_SEND_DRAG_EVENTS |
|
|
||||||
XI86_CONFIGURED;
|
|
||||||
pInfo->type_name = XI_MOUSE;
|
|
||||||
pInfo->conversion_proc = EvdevConvert;
|
|
||||||
|
|
||||||
for (i = 0, j = 0; i < REL_MAX; i++) {
|
|
||||||
if (!test_bit (i, pEvdev->bits.rel))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
snprintf(option, sizeof(option), "Rel%sMapTo", rel_axis_names[i]);
|
|
||||||
if (i == REL_WHEEL || i == REL_Z)
|
|
||||||
snprintf(value, sizeof(value), "Buttons 4 5 1");
|
|
||||||
else if (i == REL_HWHEEL)
|
|
||||||
snprintf(value, sizeof(value), "Buttons 6 7 1");
|
|
||||||
else
|
|
||||||
snprintf(value, sizeof(value), "RelAxis %d", j);
|
|
||||||
|
|
||||||
EvdevParseMapOption (pInfo, option, value, &rel->v_map_data[i], &rel->v_map[i]);
|
|
||||||
|
|
||||||
snprintf(option, sizeof(option), "Rel%sOptions", rel_axis_names[i]);
|
|
||||||
s = xf86SetStrOption(pInfo->options, option, "");
|
|
||||||
if (s[0]) {
|
|
||||||
tokens = EvdevTokenize (s, " ");
|
|
||||||
if (!EvdevParseRelOptions (pInfo, option, tokens, &rel->v_flags[i]))
|
|
||||||
xf86Msg (X_ERROR, "%s: Unable to parse '%s' as relative options.\n", pInfo->name, s);
|
|
||||||
EvdevFreeTokens (tokens);
|
|
||||||
}
|
|
||||||
rel->v_flags[i] |= EV_REL_V_PRESENT;
|
|
||||||
|
|
||||||
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevAxesNew0 (InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
int ret = Success;
|
|
||||||
|
|
||||||
state->axes = Xcalloc (sizeof (evdevAxesRec));
|
|
||||||
if (EvdevAxisAbsNew(pInfo) != Success)
|
|
||||||
ret = !Success;
|
|
||||||
if (EvdevAxisRelNew(pInfo) != Success)
|
|
||||||
ret = !Success;
|
|
||||||
if (!state->abs && !state->rel) {
|
|
||||||
Xfree (state->axes);
|
|
||||||
state->axes = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevAxesNew1 (InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
evdevStateRec *state = &pEvdev->state;
|
|
||||||
evdevAxesRec *axes = state->axes;
|
|
||||||
int i, ret = Success;
|
|
||||||
|
|
||||||
if (!state->axes)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
for (i = 0; i < AXES_MAX; i++)
|
|
||||||
if (axes->v_flags[i] & EV_AXES_V_PRESENT)
|
|
||||||
axes->axes = i + 1;
|
|
||||||
|
|
||||||
if (EvdevAxisAbsNew1(pInfo) != Success)
|
|
||||||
ret = !Success;
|
|
||||||
if (!state->abs && !state->rel) {
|
|
||||||
Xfree (state->axes);
|
|
||||||
state->axes = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
EvdevPtrCtrlProc(DeviceIntPtr device, PtrCtrl *ctrl)
|
|
||||||
{
|
|
||||||
/* Nothing to do, dix handles all settings */
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevAxesInit (DeviceIntPtr device)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo = device->public.devicePrivate;
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
evdevAxesRec *axes = state->axes;
|
|
||||||
AbsoluteClassRec *dev_abs;
|
|
||||||
int i;
|
|
||||||
const char *s;
|
|
||||||
|
|
||||||
if (!axes || !axes->axes)
|
|
||||||
return Success;
|
|
||||||
|
|
||||||
xf86Msg(X_CONFIG, "%s: %d valuators.\n", pInfo->name,
|
|
||||||
axes->axes);
|
|
||||||
|
|
||||||
if (!InitValuatorClassDeviceStruct(device, axes->axes,
|
|
||||||
GetMotionHistory,
|
|
||||||
GetMotionHistorySize(),
|
|
||||||
0))
|
|
||||||
return !Success;
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This has to go in Init, because until now there is no valuator struct
|
|
||||||
* allocated.
|
|
||||||
*/
|
|
||||||
s = xf86SetStrOption(pInfo->options, "Mode", "Absolute");
|
|
||||||
if (!strcasecmp(s, "Absolute")) {
|
|
||||||
pInfo->dev->valuator->mode = Absolute;
|
|
||||||
xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s);
|
|
||||||
} else if (!strcasecmp(s, "Relative")) {
|
|
||||||
pInfo->dev->valuator->mode = Relative;
|
|
||||||
xf86Msg(X_CONFIG, "%s: Configuring in %s mode.\n", pInfo->name, s);
|
|
||||||
} else {
|
|
||||||
pInfo->dev->valuator->mode = Absolute;
|
|
||||||
xf86Msg(X_CONFIG, "%s: Unknown Mode: %s.\n", pInfo->name, s);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Yes, we want to do this for relative devices too.
|
|
||||||
* Some of the settings are useful for both.
|
|
||||||
*/
|
|
||||||
if ((axes->v_flags[0] & EV_AXES_V_PRESENT) &&
|
|
||||||
(axes->v_flags[1] & EV_AXES_V_PRESENT) &&
|
|
||||||
InitAbsoluteClassDeviceStruct (device)) {
|
|
||||||
dev_abs = device->absolute;
|
|
||||||
if (axes->v_min[0] != axes->v_max[1] && axes->v_min[1] != axes->v_max[1]) {
|
|
||||||
device->absolute->min_x = axes->v_min[0];
|
|
||||||
device->absolute->max_x = axes->v_max[0];
|
|
||||||
device->absolute->min_y = axes->v_min[1];
|
|
||||||
device->absolute->max_y = axes->v_max[1];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < axes->axes; i++) {
|
|
||||||
xf86InitValuatorAxisStruct(device, i, -1, -1, 1, 1, 1);
|
|
||||||
|
|
||||||
xf86InitValuatorDefaults(device, i);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!InitPtrFeedbackClassDeviceStruct(device, EvdevPtrCtrlProc))
|
|
||||||
return !Success;
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
EvdevAxesTouchCallback (InputInfoPtr pInfo, int button, int value)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
#if DEBUG
|
|
||||||
xf86Msg(X_INFO, "%s: Touch callback; %d.\n", pInfo->name, value);
|
|
||||||
#endif
|
|
||||||
if (state->abs->flags & EV_ABS_USE_TOUCH) {
|
|
||||||
if (value) {
|
|
||||||
state->abs->flags |= EV_ABS_TOUCH;
|
|
||||||
for (i = 0; i < ABS_MAX; i++)
|
|
||||||
if (state->abs->v_flags[i] & EV_ABS_V_USE_TOUCH)
|
|
||||||
state->abs->v_flags[i] |= EV_ABS_V_RESET;
|
|
||||||
} else
|
|
||||||
state->abs->flags &= ~EV_ABS_TOUCH;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
477
src/evdev_btn.c
477
src/evdev_btn.c
@@ -1,477 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2006-2007 Zephaniah E. Hull
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Soft-
|
|
||||||
* ware"), to deal in the Software without restriction, including without
|
|
||||||
* limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, provided that the above copyright
|
|
||||||
* notice(s) and this permission notice appear in all copies of the Soft-
|
|
||||||
* ware and that both the above copyright notice(s) and this permission
|
|
||||||
* notice appear in supporting documentation.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
|
||||||
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
|
|
||||||
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
|
|
||||||
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
|
|
||||||
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
|
|
||||||
* MANCE OF THIS SOFTWARE.
|
|
||||||
*
|
|
||||||
* Except as contained in this notice, the name of a copyright holder shall
|
|
||||||
* not be used in advertising or otherwise to promote the sale, use or
|
|
||||||
* other dealings in this Software without prior written authorization of
|
|
||||||
* the copyright holder.
|
|
||||||
*
|
|
||||||
* Author: Zephaniah E. Hull (warp@aehallh.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "evdev.h"
|
|
||||||
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
#include <X11/XF86keysym.h>
|
|
||||||
#include <X11/extensions/XIproto.h>
|
|
||||||
|
|
||||||
#include <linux/input.h>
|
|
||||||
|
|
||||||
#include <misc.h>
|
|
||||||
#include <xf86.h>
|
|
||||||
#include <xf86str.h>
|
|
||||||
#include <xf86_OSproc.h>
|
|
||||||
#include <xf86Xinput.h>
|
|
||||||
#include <exevents.h>
|
|
||||||
#include <mipointer.h>
|
|
||||||
|
|
||||||
#include <xf86Module.h>
|
|
||||||
|
|
||||||
static char *button_names[] = {
|
|
||||||
"MISC_0",
|
|
||||||
"MISC_1",
|
|
||||||
"MISC_2",
|
|
||||||
"MISC_3",
|
|
||||||
"MISC_4",
|
|
||||||
"MISC_5",
|
|
||||||
"MISC_6",
|
|
||||||
"MISC_7",
|
|
||||||
"MISC_8",
|
|
||||||
"MISC_9",
|
|
||||||
"MISC_10",
|
|
||||||
"MISC_11",
|
|
||||||
"MISC_12",
|
|
||||||
"MISC_13",
|
|
||||||
"MISC_14",
|
|
||||||
"MISC_15",
|
|
||||||
"MOUSE_LEFT",
|
|
||||||
"MOUSE_RIGHT",
|
|
||||||
"MOUSE_MIDDLE",
|
|
||||||
"MOUSE_SIDE",
|
|
||||||
"MOUSE_EXTRA",
|
|
||||||
"MOUSE_FORWARD",
|
|
||||||
"MOUSE_BACK",
|
|
||||||
"MOUSE_TASK",
|
|
||||||
"MOUSE_8",
|
|
||||||
"MOUSE_9",
|
|
||||||
"MOUSE_10",
|
|
||||||
"MOUSE_12",
|
|
||||||
"MOUSE_13",
|
|
||||||
"MOUSE_14",
|
|
||||||
"MOUSE_15",
|
|
||||||
"JOY_TRIGGER",
|
|
||||||
"JOY_THUMB",
|
|
||||||
"JOY_THUMB2",
|
|
||||||
"JOY_TOP",
|
|
||||||
"JOY_TOP2",
|
|
||||||
"JOY_PINKIE",
|
|
||||||
"JOY_BASE",
|
|
||||||
"JOY_BASE2",
|
|
||||||
"JOY_BASE3",
|
|
||||||
"JOY_BASE4",
|
|
||||||
"JOY_BASE5",
|
|
||||||
"JOY_BASE6",
|
|
||||||
"JOY_12",
|
|
||||||
"JOY_13",
|
|
||||||
"JOY_14",
|
|
||||||
"JOY_DEAD",
|
|
||||||
"GAME_A",
|
|
||||||
"GAME_B",
|
|
||||||
"GAME_C",
|
|
||||||
"GAME_X",
|
|
||||||
"GAME_Y",
|
|
||||||
"GAME_Z",
|
|
||||||
"GAME_TL",
|
|
||||||
"GAME_TR",
|
|
||||||
"GAME_TL2",
|
|
||||||
"GAME_TR2",
|
|
||||||
"GAME_SELECT",
|
|
||||||
"GAME_START",
|
|
||||||
"GAME_MODE",
|
|
||||||
"GAME_THUMBL",
|
|
||||||
"GAME_THUMBR",
|
|
||||||
"GAME_15",
|
|
||||||
"DIGI_TOOL_PEN",
|
|
||||||
"DIGI_TOOL_RUBBER",
|
|
||||||
"DIGI_TOOL_BRUSH",
|
|
||||||
"DIGI_TOOL_PENCIL",
|
|
||||||
"DIGI_TOOL_AIRBRUSH",
|
|
||||||
"DIGI_TOOL_FINGER",
|
|
||||||
"DIGI_TOOL_MOUSE",
|
|
||||||
"DIGI_TOOL_LENS",
|
|
||||||
"DIGI_8",
|
|
||||||
"DIGI_9",
|
|
||||||
"DIGI_TOUCH",
|
|
||||||
"DIGI_STYLUS",
|
|
||||||
"DIGI_STYLUS2",
|
|
||||||
"DIGI_TOOL_DOUBLETAP",
|
|
||||||
"DIGI_TOOL_TRIPLETAP",
|
|
||||||
"DIGI_15",
|
|
||||||
"WHEEL_GEAR_UP",
|
|
||||||
"WHEEL_GEAR_DOWN",
|
|
||||||
"WHEEL_2",
|
|
||||||
"WHEEL_3",
|
|
||||||
"WHEEL_4",
|
|
||||||
"WHEEL_5",
|
|
||||||
"WHEEL_6",
|
|
||||||
"WHEEL_7",
|
|
||||||
"WHEEL_8",
|
|
||||||
"WHEEL_9",
|
|
||||||
"WHEEL_10",
|
|
||||||
"WHEEL_11",
|
|
||||||
"WHEEL_12",
|
|
||||||
"WHEEL_13",
|
|
||||||
"WHEEL_14",
|
|
||||||
"WHEEL_15",
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
|
||||||
EvdevBtnPostFakeClicks(InputInfoRec *pInfo, int button, int count)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, button, 1, 0, 0);
|
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, button, 0, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
EvdevMapButton (InputInfoRec *pInfo, int value, int mode, void *map_data)
|
|
||||||
{
|
|
||||||
long button = (long) map_data;
|
|
||||||
|
|
||||||
xf86PostButtonEvent (pInfo->dev, 0, button, value, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
EvdevParseMapToButton (InputInfoRec *pInfo,
|
|
||||||
const char *name,
|
|
||||||
evdev_option_token_t *option,
|
|
||||||
void **map_data, evdev_map_func_f *map_func)
|
|
||||||
{
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
evdevStateRec *state = &pEvdev->state;
|
|
||||||
evdevBtnRec *btn = state->btn;
|
|
||||||
int button;
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
button = strtol (option->str, NULL, 0);
|
|
||||||
if (errno)
|
|
||||||
button = EvdevBtnFind (pInfo, option->str);
|
|
||||||
if ((button < 0) || (button > BTN_MAX)) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Button %d out of range.\n", pInfo->name, name, button);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (btn->b_flags[button] & EV_BTN_B_PRESENT) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Button %d already claimed.\n", pInfo->name, name, button);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
btn->b_flags[button] = EV_BTN_B_PRESENT;
|
|
||||||
|
|
||||||
*map_data = (void *) button;
|
|
||||||
*map_func = EvdevMapButton;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int button_plus;
|
|
||||||
int button_minus;
|
|
||||||
int step;
|
|
||||||
int count;
|
|
||||||
} MapButtons_t;
|
|
||||||
|
|
||||||
static void
|
|
||||||
EvdevMapButtons (InputInfoRec *pInfo, int value, int mode, void *map_data)
|
|
||||||
{
|
|
||||||
MapButtons_t *map = map_data;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!map)
|
|
||||||
return;
|
|
||||||
|
|
||||||
map->count += value;
|
|
||||||
i = map->count / map->step;
|
|
||||||
if (i) {
|
|
||||||
map->count -= i * map->step;
|
|
||||||
if (i > 0)
|
|
||||||
EvdevBtnPostFakeClicks (pInfo, map->button_plus, i);
|
|
||||||
else
|
|
||||||
EvdevBtnPostFakeClicks (pInfo, map->button_minus, -i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bool
|
|
||||||
EvdevParseMapToButtons (InputInfoRec *pInfo,
|
|
||||||
const char *name,
|
|
||||||
evdev_option_token_t *option,
|
|
||||||
void **map_data, evdev_map_func_f *map_func)
|
|
||||||
{
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
evdevStateRec *state = &pEvdev->state;
|
|
||||||
evdevBtnRec *btn = state->btn;
|
|
||||||
int btn_plus, btn_minus;
|
|
||||||
MapButtons_t *map;
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
btn_plus = strtol (option->str, NULL, 0);
|
|
||||||
if (errno)
|
|
||||||
btn_plus = EvdevBtnFind (pInfo, option->str);
|
|
||||||
if ((btn_plus < 0) || (btn_plus > BTN_MAX)) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Button %d out of range.\n", pInfo->name, name, btn_plus);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (btn->b_flags[btn_plus] & EV_BTN_B_PRESENT) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Button %d already claimed.\n", pInfo->name, name, btn_plus);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
option = option->next;
|
|
||||||
if (!option) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: No button minus.\n", pInfo->name, name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
errno = 0;
|
|
||||||
btn_minus = strtol (option->str, NULL, 0);
|
|
||||||
if (errno)
|
|
||||||
btn_minus = EvdevBtnFind (pInfo, option->str);
|
|
||||||
if ((btn_minus < 0) || (btn_minus > BTN_MAX)) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Button %d out of range.\n", pInfo->name, name, btn_minus);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (btn->b_flags[btn_minus] & EV_BTN_B_PRESENT) {
|
|
||||||
xf86Msg (X_ERROR, "%s: %s: Button %d already claimed.\n", pInfo->name, name, btn_minus);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
errno = 0;
|
|
||||||
|
|
||||||
btn->b_flags[btn_plus] = EV_BTN_B_PRESENT;
|
|
||||||
btn->b_flags[btn_minus] = EV_BTN_B_PRESENT;
|
|
||||||
|
|
||||||
map = calloc(1, sizeof (MapButtons_t));
|
|
||||||
map->button_plus = btn_plus;
|
|
||||||
map->button_minus = btn_minus;
|
|
||||||
map->step = 1;
|
|
||||||
|
|
||||||
*map_data = (void *) map;
|
|
||||||
*map_func = EvdevMapButtons;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevBtnInit (DeviceIntRec *device)
|
|
||||||
{
|
|
||||||
InputInfoRec *pInfo = device->public.devicePrivate;
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
CARD8 *map;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (!pEvdev->state.btn)
|
|
||||||
return Success;
|
|
||||||
|
|
||||||
map = Xcalloc (sizeof (CARD8) * (pEvdev->state.btn->buttons + 1));
|
|
||||||
|
|
||||||
for (i = 0; i <= pEvdev->state.btn->buttons; i++)
|
|
||||||
map[i] = i;
|
|
||||||
|
|
||||||
xf86Msg(X_CONFIG, "%s: Registering %d buttons.\n", pInfo->name,
|
|
||||||
pEvdev->state.btn->buttons);
|
|
||||||
if (!InitButtonClassDeviceStruct (device, pEvdev->state.btn->buttons, map)) {
|
|
||||||
pEvdev->state.btn->buttons = 0;
|
|
||||||
|
|
||||||
return !Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
Xfree (map);
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevBtnOn (DeviceIntRec *device)
|
|
||||||
{
|
|
||||||
InputInfoRec *pInfo = device->public.devicePrivate;
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
int i, blocked;
|
|
||||||
|
|
||||||
if (!pEvdev->state.btn)
|
|
||||||
return Success;
|
|
||||||
|
|
||||||
blocked = xf86BlockSIGIO ();
|
|
||||||
for (i = 1; i <= pEvdev->state.btn->buttons; i++)
|
|
||||||
xf86PostButtonEvent (device, 0, i, 0, 0, 0);
|
|
||||||
xf86UnblockSIGIO (blocked);
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevBtnOff (DeviceIntRec *device)
|
|
||||||
{
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevBtnNew0(InputInfoRec *pInfo)
|
|
||||||
{
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
evdevStateRec *state = &pEvdev->state;
|
|
||||||
|
|
||||||
state->btn = Xcalloc (sizeof (evdevBtnRec));
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevBtnNew1(InputInfoRec *pInfo)
|
|
||||||
{
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
evdevStateRec *state = &pEvdev->state;
|
|
||||||
evdevBtnRec *btn = state->btn;
|
|
||||||
char option[128], value[128];
|
|
||||||
int i, b, j, target;
|
|
||||||
|
|
||||||
if (!btn)
|
|
||||||
return !Success;
|
|
||||||
|
|
||||||
for (i = 0; i < BTN_MAX; i++) {
|
|
||||||
b = i + BTN_MISC;
|
|
||||||
if (!test_bit (b, pEvdev->bits.key))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
btn->real_buttons++;
|
|
||||||
|
|
||||||
snprintf(option, sizeof(option), "Button%sMapTo", button_names[i]);
|
|
||||||
|
|
||||||
if (b >= BTN_DIGI && b < BTN_WHEEL)
|
|
||||||
target = -1;
|
|
||||||
else if (b == BTN_RIGHT)
|
|
||||||
target = 3;
|
|
||||||
else if (b == BTN_MIDDLE)
|
|
||||||
target = 2;
|
|
||||||
else if (b >= BTN_MOUSE && b < BTN_JOYSTICK)
|
|
||||||
target = 1 + i - (BTN_MOUSE - BTN_MISC);
|
|
||||||
else if (b >= BTN_MISC && b < BTN_MOUSE)
|
|
||||||
target = 1 + i + (BTN_MOUSE - BTN_MISC);
|
|
||||||
else
|
|
||||||
target = 1 + i;
|
|
||||||
|
|
||||||
if (btn->b_flags[target] & EV_BTN_B_PRESENT) {
|
|
||||||
for (j = target; j < BTN_MAX; j++)
|
|
||||||
if (!(btn->b_flags[j] & EV_BTN_B_PRESENT)) {
|
|
||||||
target = j;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (target > 0)
|
|
||||||
snprintf (value, sizeof (value), "Button %d", target);
|
|
||||||
else
|
|
||||||
snprintf (value, sizeof (value), "null");
|
|
||||||
|
|
||||||
EvdevParseMapOption (pInfo, option, value, &btn->b_map_data[i], &btn->b_map[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state->btn->real_buttons)
|
|
||||||
xf86Msg(X_INFO, "%s: Found %d mouse buttons\n", pInfo->name, state->btn->real_buttons);
|
|
||||||
|
|
||||||
for (i = 0; i < BTN_MAX; i++)
|
|
||||||
if (btn->b_flags[i] & EV_BTN_B_PRESENT)
|
|
||||||
btn->buttons = i + 1;
|
|
||||||
|
|
||||||
if (state->btn->buttons)
|
|
||||||
xf86Msg(X_INFO, "%s: Configured %d mouse buttons.\n", pInfo->name, state->btn->buttons);
|
|
||||||
else {
|
|
||||||
Xfree (state->btn);
|
|
||||||
state->btn = NULL;
|
|
||||||
return !Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
pInfo->flags |= XI86_SEND_DRAG_EVENTS | XI86_CONFIGURED;
|
|
||||||
/*
|
|
||||||
* FIXME: Mouse may not be accurate.
|
|
||||||
* Check buttons to see if we're actually a joystick or something.
|
|
||||||
*/
|
|
||||||
pInfo->type_name = XI_MOUSE;
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
EvdevBtnProcess (InputInfoRec *pInfo, struct input_event *ev)
|
|
||||||
{
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
evdevStateRec *state = &pEvdev->state;
|
|
||||||
int button;
|
|
||||||
|
|
||||||
if (!state->btn)
|
|
||||||
return;
|
|
||||||
|
|
||||||
button = ev->code;
|
|
||||||
|
|
||||||
button -= BTN_MISC;
|
|
||||||
|
|
||||||
if (state->btn->callback[button])
|
|
||||||
state->btn->callback[button](pInfo, button, ev->value);
|
|
||||||
|
|
||||||
if (state->btn->b_map[button])
|
|
||||||
state->btn->b_map[button](pInfo, ev->value, -1, state->btn->b_map_data[button]);
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevBtnFind (InputInfoRec *pInfo, const char *button)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; button_names[i]; i++)
|
|
||||||
if (!strcasecmp(button, button_names[i]))
|
|
||||||
return i + 1;
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevBtnExists (InputInfoRec *pInfo, int button)
|
|
||||||
{
|
|
||||||
evdevDeviceRec *pEvdev = pInfo->private;
|
|
||||||
|
|
||||||
xf86Msg(X_INFO, "%s: Checking button %s (%d)\n", pInfo->name, button_names[button], button);
|
|
||||||
|
|
||||||
button += BTN_MISC;
|
|
||||||
|
|
||||||
xf86Msg(X_INFO, "%s: Checking bit %d\n", pInfo->name, button);
|
|
||||||
return test_bit(button, pEvdev->bits.key);
|
|
||||||
}
|
|
||||||
549
src/evdev_key.c
549
src/evdev_key.c
@@ -1,549 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright © 2006-2007 Zephaniah E. Hull
|
|
||||||
* Copyright © 2004 Red Hat, Inc.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
||||||
* copy of this software and associated documentation files (the "Soft-
|
|
||||||
* ware"), to deal in the Software without restriction, including without
|
|
||||||
* limitation the rights to use, copy, modify, merge, publish, distribute,
|
|
||||||
* and/or sell copies of the Software, and to permit persons to whom the
|
|
||||||
* Software is furnished to do so, provided that the above copyright
|
|
||||||
* notice(s) and this permission notice appear in all copies of the Soft-
|
|
||||||
* ware and that both the above copyright notice(s) and this permission
|
|
||||||
* notice appear in supporting documentation.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
||||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
|
|
||||||
* ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY
|
|
||||||
* RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN
|
|
||||||
* THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSE-
|
|
||||||
* QUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
|
|
||||||
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
|
||||||
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFOR-
|
|
||||||
* MANCE OF THIS SOFTWARE.
|
|
||||||
*
|
|
||||||
* Except as contained in this notice, the name of a copyright holder shall
|
|
||||||
* not be used in advertising or otherwise to promote the sale, use or
|
|
||||||
* other dealings in this Software without prior written authorization of
|
|
||||||
* the copyright holder.
|
|
||||||
*
|
|
||||||
* Authors:
|
|
||||||
* Zephaniah E. Hull (warp@aehallh.com),
|
|
||||||
* Kristian Høgsberg (krh@redhat.com)
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "evdev.h"
|
|
||||||
|
|
||||||
#include <X11/keysym.h>
|
|
||||||
#include <X11/XF86keysym.h>
|
|
||||||
#include <X11/extensions/XIproto.h>
|
|
||||||
|
|
||||||
#include <linux/input.h>
|
|
||||||
|
|
||||||
#include <misc.h>
|
|
||||||
#include <xf86.h>
|
|
||||||
#include <xf86str.h>
|
|
||||||
#include <xf86_OSproc.h>
|
|
||||||
#include <xf86Xinput.h>
|
|
||||||
#include <exevents.h>
|
|
||||||
#include <mipointer.h>
|
|
||||||
|
|
||||||
#include <xf86Module.h>
|
|
||||||
|
|
||||||
#include <X11/extensions/XKB.h>
|
|
||||||
#include <X11/extensions/XKBstr.h>
|
|
||||||
#include <X11/extensions/XKBsrv.h>
|
|
||||||
|
|
||||||
|
|
||||||
#define ArrayLength(a) (sizeof(a) / (sizeof((a)[0])))
|
|
||||||
|
|
||||||
#define MIN_KEYCODE 8
|
|
||||||
#define GLYPHS_PER_KEY 2
|
|
||||||
#define AltMask Mod1Mask
|
|
||||||
#define NumLockMask Mod2Mask
|
|
||||||
#define AltLangMask Mod3Mask
|
|
||||||
#define KanaMask Mod4Mask
|
|
||||||
#define ScrollLockMask Mod5Mask
|
|
||||||
|
|
||||||
#define CAPSFLAG 1
|
|
||||||
#define NUMFLAG 2
|
|
||||||
#define SCROLLFLAG 4
|
|
||||||
#define MODEFLAG 8
|
|
||||||
#define COMPOSEFLAG 16
|
|
||||||
|
|
||||||
/* FIXME: this map works with evdev keyboards, but all the xkb maps
|
|
||||||
* probably don't. The easiest is to remap the event keycodes. */
|
|
||||||
|
|
||||||
static KeySym map[] = {
|
|
||||||
/* 0x00 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x01 */ XK_Escape, NoSymbol,
|
|
||||||
/* 0x02 */ XK_1, XK_exclam,
|
|
||||||
/* 0x03 */ XK_2, XK_at,
|
|
||||||
/* 0x04 */ XK_3, XK_numbersign,
|
|
||||||
/* 0x05 */ XK_4, XK_dollar,
|
|
||||||
/* 0x06 */ XK_5, XK_percent,
|
|
||||||
/* 0x07 */ XK_6, XK_asciicircum,
|
|
||||||
/* 0x08 */ XK_7, XK_ampersand,
|
|
||||||
/* 0x09 */ XK_8, XK_asterisk,
|
|
||||||
/* 0x0a */ XK_9, XK_parenleft,
|
|
||||||
/* 0x0b */ XK_0, XK_parenright,
|
|
||||||
/* 0x0c */ XK_minus, XK_underscore,
|
|
||||||
/* 0x0d */ XK_equal, XK_plus,
|
|
||||||
/* 0x0e */ XK_BackSpace, NoSymbol,
|
|
||||||
/* 0x0f */ XK_Tab, XK_ISO_Left_Tab,
|
|
||||||
/* 0x10 */ XK_Q, NoSymbol,
|
|
||||||
/* 0x11 */ XK_W, NoSymbol,
|
|
||||||
/* 0x12 */ XK_E, NoSymbol,
|
|
||||||
/* 0x13 */ XK_R, NoSymbol,
|
|
||||||
/* 0x14 */ XK_T, NoSymbol,
|
|
||||||
/* 0x15 */ XK_Y, NoSymbol,
|
|
||||||
/* 0x16 */ XK_U, NoSymbol,
|
|
||||||
/* 0x17 */ XK_I, NoSymbol,
|
|
||||||
/* 0x18 */ XK_O, NoSymbol,
|
|
||||||
/* 0x19 */ XK_P, NoSymbol,
|
|
||||||
/* 0x1a */ XK_bracketleft, XK_braceleft,
|
|
||||||
/* 0x1b */ XK_bracketright,XK_braceright,
|
|
||||||
/* 0x1c */ XK_Return, NoSymbol,
|
|
||||||
/* 0x1d */ XK_Control_L, NoSymbol,
|
|
||||||
/* 0x1e */ XK_A, NoSymbol,
|
|
||||||
/* 0x1f */ XK_S, NoSymbol,
|
|
||||||
/* 0x20 */ XK_D, NoSymbol,
|
|
||||||
/* 0x21 */ XK_F, NoSymbol,
|
|
||||||
/* 0x22 */ XK_G, NoSymbol,
|
|
||||||
/* 0x23 */ XK_H, NoSymbol,
|
|
||||||
/* 0x24 */ XK_J, NoSymbol,
|
|
||||||
/* 0x25 */ XK_K, NoSymbol,
|
|
||||||
/* 0x26 */ XK_L, NoSymbol,
|
|
||||||
/* 0x27 */ XK_semicolon, XK_colon,
|
|
||||||
/* 0x28 */ XK_quoteright, XK_quotedbl,
|
|
||||||
/* 0x29 */ XK_quoteleft, XK_asciitilde,
|
|
||||||
/* 0x2a */ XK_Shift_L, NoSymbol,
|
|
||||||
/* 0x2b */ XK_backslash, XK_bar,
|
|
||||||
/* 0x2c */ XK_Z, NoSymbol,
|
|
||||||
/* 0x2d */ XK_X, NoSymbol,
|
|
||||||
/* 0x2e */ XK_C, NoSymbol,
|
|
||||||
/* 0x2f */ XK_V, NoSymbol,
|
|
||||||
/* 0x30 */ XK_B, NoSymbol,
|
|
||||||
/* 0x31 */ XK_N, NoSymbol,
|
|
||||||
/* 0x32 */ XK_M, NoSymbol,
|
|
||||||
/* 0x33 */ XK_comma, XK_less,
|
|
||||||
/* 0x34 */ XK_period, XK_greater,
|
|
||||||
/* 0x35 */ XK_slash, XK_question,
|
|
||||||
/* 0x36 */ XK_Shift_R, NoSymbol,
|
|
||||||
/* 0x37 */ XK_KP_Multiply, NoSymbol,
|
|
||||||
/* 0x38 */ XK_Alt_L, XK_Meta_L,
|
|
||||||
/* 0x39 */ XK_space, NoSymbol,
|
|
||||||
/* 0x3a */ XK_Caps_Lock, NoSymbol,
|
|
||||||
/* 0x3b */ XK_F1, NoSymbol,
|
|
||||||
/* 0x3c */ XK_F2, NoSymbol,
|
|
||||||
/* 0x3d */ XK_F3, NoSymbol,
|
|
||||||
/* 0x3e */ XK_F4, NoSymbol,
|
|
||||||
/* 0x3f */ XK_F5, NoSymbol,
|
|
||||||
/* 0x40 */ XK_F6, NoSymbol,
|
|
||||||
/* 0x41 */ XK_F7, NoSymbol,
|
|
||||||
/* 0x42 */ XK_F8, NoSymbol,
|
|
||||||
/* 0x43 */ XK_F9, NoSymbol,
|
|
||||||
/* 0x44 */ XK_F10, NoSymbol,
|
|
||||||
/* 0x45 */ XK_Num_Lock, NoSymbol,
|
|
||||||
/* 0x46 */ XK_Scroll_Lock, NoSymbol,
|
|
||||||
/* These KP keys should have the KP_7 keysyms in the numlock
|
|
||||||
* modifer... ? */
|
|
||||||
/* 0x47 */ XK_KP_Home, XK_KP_7,
|
|
||||||
/* 0x48 */ XK_KP_Up, XK_KP_8,
|
|
||||||
/* 0x49 */ XK_KP_Prior, XK_KP_9,
|
|
||||||
/* 0x4a */ XK_KP_Subtract, NoSymbol,
|
|
||||||
/* 0x4b */ XK_KP_Left, XK_KP_4,
|
|
||||||
/* 0x4c */ XK_KP_Begin, XK_KP_5,
|
|
||||||
/* 0x4d */ XK_KP_Right, XK_KP_6,
|
|
||||||
/* 0x4e */ XK_KP_Add, NoSymbol,
|
|
||||||
/* 0x4f */ XK_KP_End, XK_KP_1,
|
|
||||||
/* 0x50 */ XK_KP_Down, XK_KP_2,
|
|
||||||
/* 0x51 */ XK_KP_Next, XK_KP_3,
|
|
||||||
/* 0x52 */ XK_KP_Insert, XK_KP_0,
|
|
||||||
/* 0x53 */ XK_KP_Delete, XK_KP_Decimal,
|
|
||||||
/* 0x54 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x55 */ XK_F13, NoSymbol,
|
|
||||||
/* 0x56 */ XK_less, XK_greater,
|
|
||||||
/* 0x57 */ XK_F11, NoSymbol,
|
|
||||||
/* 0x58 */ XK_F12, NoSymbol,
|
|
||||||
/* 0x59 */ XK_F14, NoSymbol,
|
|
||||||
/* 0x5a */ XK_F15, NoSymbol,
|
|
||||||
/* 0x5b */ XK_F16, NoSymbol,
|
|
||||||
/* 0x5c */ XK_F17, NoSymbol,
|
|
||||||
/* 0x5d */ XK_F18, NoSymbol,
|
|
||||||
/* 0x5e */ XK_F19, NoSymbol,
|
|
||||||
/* 0x5f */ XK_F20, NoSymbol,
|
|
||||||
/* 0x60 */ XK_KP_Enter, NoSymbol,
|
|
||||||
/* 0x61 */ XK_Control_R, NoSymbol,
|
|
||||||
/* 0x62 */ XK_KP_Divide, NoSymbol,
|
|
||||||
/* 0x63 */ XK_Print, XK_Sys_Req,
|
|
||||||
/* 0x64 */ XK_Alt_R, XK_Meta_R,
|
|
||||||
/* 0x65 */ NoSymbol, NoSymbol, /* KEY_LINEFEED */
|
|
||||||
/* 0x66 */ XK_Home, NoSymbol,
|
|
||||||
/* 0x67 */ XK_Up, NoSymbol,
|
|
||||||
/* 0x68 */ XK_Prior, NoSymbol,
|
|
||||||
/* 0x69 */ XK_Left, NoSymbol,
|
|
||||||
/* 0x6a */ XK_Right, NoSymbol,
|
|
||||||
/* 0x6b */ XK_End, NoSymbol,
|
|
||||||
/* 0x6c */ XK_Down, NoSymbol,
|
|
||||||
/* 0x6d */ XK_Next, NoSymbol,
|
|
||||||
/* 0x6e */ XK_Insert, NoSymbol,
|
|
||||||
/* 0x6f */ XK_Delete, NoSymbol,
|
|
||||||
/* 0x70 */ NoSymbol, NoSymbol, /* KEY_MACRO */
|
|
||||||
/* 0x71 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x72 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x73 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x74 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x75 */ XK_KP_Equal, NoSymbol,
|
|
||||||
/* 0x76 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x77 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x78 */ XK_F21, NoSymbol,
|
|
||||||
/* 0x79 */ XK_F22, NoSymbol,
|
|
||||||
/* 0x7a */ XK_F23, NoSymbol,
|
|
||||||
/* 0x7b */ XK_F24, NoSymbol,
|
|
||||||
/* 0x7c */ XK_KP_Separator, NoSymbol,
|
|
||||||
/* 0x7d */ XK_Meta_L, NoSymbol,
|
|
||||||
/* 0x7e */ XK_Meta_R, NoSymbol,
|
|
||||||
/* 0x7f */ XK_Multi_key, NoSymbol,
|
|
||||||
/* 0x80 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x81 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x82 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x83 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x84 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x85 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x86 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x87 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x88 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x89 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x8a */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x8b */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x8c */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x8d */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x8e */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x8f */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x90 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x91 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x92 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x93 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x94 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x95 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x96 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x97 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x98 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x99 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x9a */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x9b */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x9c */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x9d */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x9e */ NoSymbol, NoSymbol,
|
|
||||||
/* 0x9f */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa0 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa1 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa2 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa3 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa4 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa5 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa6 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa7 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa8 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xa9 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xaa */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xab */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xac */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xad */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xae */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xaf */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb0 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb1 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb2 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb3 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb4 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb5 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb6 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb7 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb8 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xb9 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xba */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xbb */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xbc */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xbd */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xbe */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xbf */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc0 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc1 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc2 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc3 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc4 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc5 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc6 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc7 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc8 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xc9 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xca */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xcb */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xcc */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xcd */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xce */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xcf */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd0 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd1 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd2 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd3 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd4 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd5 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd6 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd7 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd8 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xd9 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xda */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xdb */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xdc */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xdd */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xde */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xdf */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe0 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe1 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe2 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe3 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe4 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe5 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe6 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe7 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe8 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xe9 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xea */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xeb */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xec */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xed */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xee */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xef */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xf0 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xf1 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xf2 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xf3 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xf4 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xf5 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xf6 */ NoSymbol, NoSymbol,
|
|
||||||
/* 0xf7 */ NoSymbol, NoSymbol,
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
EvdevKbdCtrl(DeviceIntPtr device, KeybdCtrl *ctrl)
|
|
||||||
{
|
|
||||||
static struct { int xbit, code; } bits[] = {
|
|
||||||
{ CAPSFLAG, LED_CAPSL },
|
|
||||||
{ NUMFLAG, LED_NUML },
|
|
||||||
{ SCROLLFLAG, LED_SCROLLL },
|
|
||||||
{ MODEFLAG, LED_KANA },
|
|
||||||
{ COMPOSEFLAG, LED_COMPOSE }
|
|
||||||
};
|
|
||||||
|
|
||||||
InputInfoPtr pInfo;
|
|
||||||
struct input_event ev[ArrayLength(bits)];
|
|
||||||
int i;
|
|
||||||
|
|
||||||
pInfo = device->public.devicePrivate;
|
|
||||||
for (i = 0; i < ArrayLength(bits); i++) {
|
|
||||||
ev[i].type = EV_LED;
|
|
||||||
ev[i].code = bits[i].code;
|
|
||||||
ev[i].value = (ctrl->leds & bits[i].xbit) > 0;
|
|
||||||
}
|
|
||||||
write(pInfo->fd, ev, sizeof(ev));
|
|
||||||
|
|
||||||
if (device->key && device->key->xkbInfo && device->key->xkbInfo->desc
|
|
||||||
&& device->key->xkbInfo->desc->ctrls) {
|
|
||||||
XkbControlsRec *ctrls = device->key->xkbInfo->desc->ctrls;
|
|
||||||
|
|
||||||
ev[0].type = EV_REP;
|
|
||||||
ev[0].code = REP_DELAY;
|
|
||||||
ev[0].value = ctrls->repeat_delay;
|
|
||||||
|
|
||||||
ev[1].type = EV_REP;
|
|
||||||
ev[1].code = REP_PERIOD;
|
|
||||||
ev[1].value = ctrls->repeat_interval;
|
|
||||||
|
|
||||||
write(pInfo->fd, ev, sizeof(ev[0]) * 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevKeyInit (DeviceIntPtr device)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo = device->public.devicePrivate;
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
KeySymsRec keySyms;
|
|
||||||
CARD8 modMap[MAP_LENGTH];
|
|
||||||
KeySym sym;
|
|
||||||
int i, j;
|
|
||||||
|
|
||||||
static struct { KeySym keysym; CARD8 mask; } modifiers[] = {
|
|
||||||
{ XK_Shift_L, ShiftMask },
|
|
||||||
{ XK_Shift_R, ShiftMask },
|
|
||||||
{ XK_Control_L, ControlMask },
|
|
||||||
{ XK_Control_R, ControlMask },
|
|
||||||
{ XK_Caps_Lock, LockMask },
|
|
||||||
{ XK_Alt_L, AltMask },
|
|
||||||
{ XK_Alt_R, AltMask },
|
|
||||||
{ XK_Num_Lock, NumLockMask },
|
|
||||||
{ XK_Scroll_Lock, ScrollLockMask },
|
|
||||||
{ XK_Mode_switch, AltLangMask }
|
|
||||||
};
|
|
||||||
|
|
||||||
/* TODO:
|
|
||||||
* Ctrl-Alt-Backspace and other Ctrl-Alt-stuff should work
|
|
||||||
* XKB, let's try without the #ifdef nightmare
|
|
||||||
* Get keyboard repeat under control (right now caps lock repeats!)
|
|
||||||
*/
|
|
||||||
|
|
||||||
pInfo = device->public.devicePrivate;
|
|
||||||
|
|
||||||
/* Compute the modifier map */
|
|
||||||
memset(modMap, 0, sizeof modMap);
|
|
||||||
|
|
||||||
for (i = 0; i < ArrayLength(map) / GLYPHS_PER_KEY; i++) {
|
|
||||||
sym = map[i * GLYPHS_PER_KEY];
|
|
||||||
for (j = 0; j < ArrayLength(modifiers); j++) {
|
|
||||||
if (modifiers[j].keysym == sym)
|
|
||||||
modMap[i + MIN_KEYCODE] = modifiers[j].mask;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
keySyms.map = map;
|
|
||||||
keySyms.mapWidth = GLYPHS_PER_KEY;
|
|
||||||
keySyms.minKeyCode = MIN_KEYCODE;
|
|
||||||
keySyms.maxKeyCode = MIN_KEYCODE + ArrayLength(map) / GLYPHS_PER_KEY - 1;
|
|
||||||
|
|
||||||
|
|
||||||
XkbSetRulesDflts (state->key->xkb_rules, state->key->xkb_model,
|
|
||||||
state->key->xkb_layout, state->key->xkb_variant,
|
|
||||||
state->key->xkb_options);
|
|
||||||
|
|
||||||
XkbInitKeyboardDeviceStruct (device, &state->key->xkbnames, &keySyms, modMap,
|
|
||||||
NULL, EvdevKbdCtrl);
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
SetXkbOption(InputInfoPtr pInfo, char *name, char *value, char **option)
|
|
||||||
{
|
|
||||||
char *s;
|
|
||||||
|
|
||||||
if ((s = xf86SetStrOption(pInfo->options, name, value))) {
|
|
||||||
if (!s[0]) {
|
|
||||||
xfree(s);
|
|
||||||
*option = NULL;
|
|
||||||
} else {
|
|
||||||
*option = s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevKeyNew (InputInfoPtr pInfo)
|
|
||||||
{
|
|
||||||
evdevDevicePtr pEvdev = pInfo->private;
|
|
||||||
evdevStatePtr state = &pEvdev->state;
|
|
||||||
int i, keys = 0;
|
|
||||||
|
|
||||||
for (i = 0; i <= 0xF7; i++)
|
|
||||||
if (test_bit (i, pEvdev->bits.key)) {
|
|
||||||
keys = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!keys)
|
|
||||||
return !Success;
|
|
||||||
|
|
||||||
state->key = Xcalloc (sizeof (evdevKeyRec));
|
|
||||||
|
|
||||||
pInfo->type_name = XI_KEYBOARD;
|
|
||||||
|
|
||||||
pInfo->flags |= XI86_KEYBOARD_CAPABLE | XI86_CONFIGURED;
|
|
||||||
|
|
||||||
SetXkbOption (pInfo, "xkb_rules", NULL, &state->key->xkb_rules);
|
|
||||||
if (!state->key->xkb_rules)
|
|
||||||
SetXkbOption (pInfo, "XkbRules", __XKBDEFRULES__,
|
|
||||||
&state->key->xkb_rules);
|
|
||||||
SetXkbOption (pInfo, "xkb_model", NULL, &state->key->xkb_model);
|
|
||||||
if (!state->key->xkb_model)
|
|
||||||
SetXkbOption (pInfo, "XkbModel", "evdev", &state->key->xkb_model);
|
|
||||||
SetXkbOption (pInfo, "xkb_layout", NULL, &state->key->xkb_layout);
|
|
||||||
if (!state->key->xkb_layout)
|
|
||||||
SetXkbOption (pInfo, "XkbLayout", "us", &state->key->xkb_layout);
|
|
||||||
SetXkbOption (pInfo, "xkb_variant", NULL, &state->key->xkb_variant);
|
|
||||||
if (!state->key->xkb_variant)
|
|
||||||
SetXkbOption (pInfo, "XkbVariant", NULL, &state->key->xkb_variant);
|
|
||||||
SetXkbOption (pInfo, "xkb_options", NULL, &state->key->xkb_options);
|
|
||||||
if (!state->key->xkb_options)
|
|
||||||
SetXkbOption (pInfo, "XkbOptions", NULL, &state->key->xkb_options);
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevKeyOn (DeviceIntPtr device)
|
|
||||||
{
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevKeyOff (DeviceIntPtr device)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
|
||||||
KeyClassRec *keyc = device->key;
|
|
||||||
KeySym *map = keyc->curKeySyms.map;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A bit of a hack, vaguely stolen from xf86-input-keyboard.
|
|
||||||
*
|
|
||||||
* Don't leave any keys in the down state if we are getting turned
|
|
||||||
* off, as they are likely to be released before we are turned back
|
|
||||||
* on.
|
|
||||||
* (For example, if the user switches VTs, or if we are unplugged.)
|
|
||||||
*/
|
|
||||||
for (i = keyc->curKeySyms.minKeyCode, map = keyc->curKeySyms.map;
|
|
||||||
i < keyc->curKeySyms.maxKeyCode;
|
|
||||||
i++, map += keyc->curKeySyms.mapWidth)
|
|
||||||
if ((keyc->down[i >> 3] & (1 << (i & 7))))
|
|
||||||
{
|
|
||||||
switch (*map) {
|
|
||||||
/* Don't release the lock keys */
|
|
||||||
case XK_Caps_Lock:
|
|
||||||
case XK_Shift_Lock:
|
|
||||||
case XK_Num_Lock:
|
|
||||||
case XK_Scroll_Lock:
|
|
||||||
case XK_Kana_Lock:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
xf86PostKeyboardEvent(device, i, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
EvdevKeyProcess (InputInfoPtr pInfo, struct input_event *ev)
|
|
||||||
{
|
|
||||||
int keycode = ev->code + MIN_KEYCODE;
|
|
||||||
|
|
||||||
/* filter repeat events for chording keys */
|
|
||||||
if (ev->value == 2) {
|
|
||||||
DeviceIntPtr device = pInfo->dev;
|
|
||||||
KeyClassRec *keyc = device->key;
|
|
||||||
KbdFeedbackClassRec *kbdfeed = device->kbdfeed;
|
|
||||||
int num = keycode >> 3;
|
|
||||||
int bit = 1 << (keycode & 7);
|
|
||||||
|
|
||||||
if (keyc->modifierMap[keycode] ||
|
|
||||||
!(kbdfeed->ctrl.autoRepeats[num] & bit))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
xf86PostKeyboardEvent(pInfo->dev, keycode, ev->value);
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user