Compare commits
1311 Commits
eekboard-0
...
squeekboar
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3af10285b7 | ||
|
|
53997abc46 | ||
|
|
34765be22e | ||
|
|
8b4c643d3e | ||
|
|
358b25c431 | ||
|
|
2749fdb686 | ||
|
|
8e7909e877 | ||
|
|
afaacd3f68 | ||
|
|
6a164d8119 | ||
|
|
3c45e3e53c | ||
|
|
cdf263d984 | ||
|
|
2ddfcfaff0 | ||
|
|
a901c85bcb | ||
|
|
fdbbe8f126 | ||
|
|
f284627beb | ||
|
|
d45724c462 | ||
|
|
93d0dcdc99 | ||
|
|
b252f7659b | ||
|
|
af6ad1fce6 | ||
|
|
4ee8a91dfe | ||
|
|
6d5f793718 | ||
|
|
59f6173282 | ||
|
|
3aec821f92 | ||
|
|
3ac4caa3b9 | ||
|
|
80ac591535 | ||
|
|
579ba8ab87 | ||
|
|
5a262242a3 | ||
|
|
034570bfa0 | ||
|
|
1abca0a44e | ||
|
|
23693521b7 | ||
|
|
bb18e60754 | ||
|
|
35bc163107 | ||
|
|
0179507254 | ||
|
|
0c7e77a05f | ||
|
|
317d8a58dc | ||
|
|
89b3ab9a81 | ||
|
|
8690808a29 | ||
|
|
be4ac32477 | ||
|
|
5068f36d9d | ||
|
|
8c48e96f50 | ||
|
|
f15619287a | ||
|
|
eb5c28e77f | ||
|
|
7fb34feaf8 | ||
|
|
20a6cf52ac | ||
|
|
c566d8853e | ||
|
|
0beddc6856 | ||
|
|
0adde1004f | ||
|
|
9b271a6919 | ||
|
|
1db561d33a | ||
|
|
3170a0b615 | ||
|
|
9571adb107 | ||
|
|
f834f174d8 | ||
|
|
3c0b142c4f | ||
|
|
4f28e3413a | ||
|
|
291be9fa79 | ||
|
|
fd5d060eee | ||
|
|
cffe07521e | ||
|
|
36af546362 | ||
|
|
0da848a5a0 | ||
|
|
8c9ae98bda | ||
|
|
7cc8eecd26 | ||
|
|
ef025509ba | ||
|
|
3f6bb7f60b | ||
|
|
d7ee2f4c3c | ||
|
|
98f14d3e81 | ||
|
|
02ec745856 | ||
|
|
6ac17bfde5 | ||
|
|
d8cb6ab383 | ||
|
|
db52a842b2 | ||
|
|
ad8c918e1a | ||
|
|
8191324e46 | ||
|
|
6777f1b4b7 | ||
|
|
0bfaa8cd7a | ||
|
|
238900f01a | ||
|
|
e47ec16293 | ||
|
|
6fe08967f6 | ||
|
|
71d2df8b2a | ||
|
|
8024998a4b | ||
|
|
ea4bf3de29 | ||
|
|
87d368878b | ||
|
|
55584e27fa | ||
|
|
9f88660d99 | ||
|
|
c096698ec1 | ||
|
|
3aaaed3bae | ||
|
|
f1c76a0ca4 | ||
|
|
b78c3ad131 | ||
|
|
b6dfb20fec | ||
|
|
7d18f81a30 | ||
|
|
959f5fbfc9 | ||
|
|
c2ad03af97 | ||
|
|
47c4119ab7 | ||
|
|
e71e843eff | ||
|
|
6e90c9a833 | ||
|
|
1134d92357 | ||
|
|
62009762f9 | ||
|
|
a58a18b63b | ||
|
|
95022c1ac7 | ||
|
|
7760b50963 | ||
|
|
85b79a5f8f | ||
|
|
e080d4351e | ||
|
|
dcd4dbf931 | ||
|
|
ea0926147f | ||
|
|
ce223e04e6 | ||
|
|
ddd1c1b16b | ||
|
|
0f1f6531da | ||
|
|
c917a1f818 | ||
|
|
afe8fd64f4 | ||
|
|
bd3b27eceb | ||
|
|
35ad61890e | ||
|
|
1b1fbed7de | ||
|
|
264d30d884 | ||
|
|
38d8290b59 | ||
|
|
254b65681a | ||
|
|
fbb3824a3d | ||
|
|
24126ad4f3 | ||
|
|
869a0af67f | ||
|
|
5281d96460 | ||
|
|
8f7f6c05c0 | ||
|
|
01fe433612 | ||
|
|
63e55ff5c4 | ||
|
|
8d4d50cfca | ||
|
|
dde659dbd3 | ||
|
|
788a39f144 | ||
|
|
43e2b7b803 | ||
|
|
3fb0a3a959 | ||
|
|
bdef7b3516 | ||
|
|
57d36e476b | ||
|
|
0b5aa1ba7c | ||
|
|
55410a005c | ||
|
|
1290fd4a1e | ||
|
|
c99efc430c | ||
|
|
ce6c9cbea3 | ||
|
|
4cdfc30c29 | ||
|
|
3b6c19401c | ||
|
|
29231f7e31 | ||
|
|
76b8a61d0a | ||
|
|
d62abc2f12 | ||
|
|
8f61a26fb4 | ||
|
|
8fd63cea80 | ||
|
|
162b828c4c | ||
|
|
ac58b675ef | ||
|
|
a048722a94 | ||
|
|
a74be1b299 | ||
|
|
89b56ddccf | ||
|
|
8ab3a2b8d3 | ||
|
|
f56c5e3879 | ||
|
|
8eda2cd04d | ||
|
|
cfd2bff1aa | ||
|
|
02501aee9e | ||
|
|
70056b68a7 | ||
|
|
b36c48daa3 | ||
|
|
9e078be603 | ||
|
|
ac68d5d0a8 | ||
|
|
b45edcd4fe | ||
|
|
dc2bc46167 | ||
|
|
9cd439767e | ||
|
|
212e55d7cf | ||
|
|
31fdde4da9 | ||
|
|
10bad4ebe3 | ||
|
|
da5a83f367 | ||
|
|
ef38fd3e64 | ||
|
|
46d3312c86 | ||
|
|
cb8d2b01af | ||
|
|
3f3e33c853 | ||
|
|
aa3dc96986 | ||
|
|
aee981d9c0 | ||
|
|
3bede84a2d | ||
|
|
e14d411150 | ||
|
|
f91f000df1 | ||
|
|
18f8443a9f | ||
|
|
746d842dd4 | ||
|
|
185efb1c2a | ||
|
|
a31f9b5e04 | ||
|
|
94aec87b5d | ||
|
|
854a9bb22e | ||
|
|
477a883885 | ||
|
|
b3a63042cb | ||
|
|
d53a683285 | ||
|
|
27a99e2973 | ||
|
|
53c64010e8 | ||
|
|
7f704bcd61 | ||
|
|
1e08adb26b | ||
|
|
75bbb17881 | ||
|
|
58c8556058 | ||
|
|
1c56de8698 | ||
|
|
0eb0a6e8fd | ||
|
|
9b5e0109a7 | ||
|
|
a1b811aada | ||
|
|
1b424bd663 | ||
|
|
938ba53a38 | ||
|
|
1e609f4550 | ||
|
|
e33f591a1f | ||
|
|
456af0f1ef | ||
|
|
b6d25da7c2 | ||
|
|
288d2247da | ||
|
|
e5eb9f0fd3 | ||
|
|
908aa20036 | ||
|
|
60f1ca1408 | ||
|
|
5ef687a722 | ||
|
|
86ed9a7a01 | ||
|
|
4fee2fad01 | ||
|
|
35ba8ad81c | ||
|
|
0985724b19 | ||
|
|
7aff7977fc | ||
|
|
55bb263a12 | ||
|
|
32b85e75db | ||
|
|
3935375d1b | ||
|
|
97dd2b1096 | ||
|
|
de7211d1a5 | ||
|
|
26380ab987 | ||
|
|
f898b75b9d | ||
|
|
e513cb9b54 | ||
|
|
6fd7ab7405 | ||
|
|
15833323ae | ||
|
|
653462721b | ||
|
|
2889e50507 | ||
|
|
6b15f69e00 | ||
|
|
231982d7f7 | ||
|
|
3bea256ca5 | ||
|
|
4c0f23c5c1 | ||
|
|
27d54fb38a | ||
|
|
3b6999f6ef | ||
|
|
de43d67638 | ||
|
|
2fca71aa53 | ||
|
|
7870791fef | ||
|
|
83f9b580ef | ||
|
|
54f9e61b6a | ||
|
|
94b7ba1ccc | ||
|
|
e7d30d933f | ||
|
|
150fb3cf6a | ||
|
|
169f33c67a | ||
|
|
0f5c5ef10f | ||
|
|
6e183ccb13 | ||
|
|
af0137a4fc | ||
|
|
bb3c26b0d8 | ||
|
|
6dcea4599f | ||
|
|
d32749d533 | ||
|
|
36306f2eea | ||
|
|
34a4c6ffb5 | ||
|
|
74e75d2dae | ||
|
|
a3e421db3d | ||
|
|
241e5c0fc6 | ||
|
|
28e0c26671 | ||
|
|
7d0070a155 | ||
|
|
9093226abe | ||
|
|
45dc51f08f | ||
|
|
b486dc8afd | ||
|
|
e70a64a47e | ||
|
|
225b243446 | ||
|
|
db994da531 | ||
|
|
d47aff357b | ||
|
|
96c2c2dd1f | ||
|
|
c8cc5b1997 | ||
|
|
edb28cb859 | ||
|
|
b07689939b | ||
|
|
6072e5768a | ||
|
|
fe8d66a635 | ||
|
|
c8658b00e3 | ||
|
|
0989771a3b | ||
|
|
9c2acde826 | ||
|
|
2352e31f01 | ||
|
|
8e654346a2 | ||
|
|
015ba79f65 | ||
|
|
d6aa54f30c | ||
|
|
fd0d8d4244 | ||
|
|
c725cd7f14 | ||
|
|
0922d4a87a | ||
|
|
51562d5185 | ||
|
|
ed8b6eec28 | ||
|
|
e9c236a682 | ||
|
|
04a47ad0af | ||
|
|
99c577be60 | ||
|
|
db8340181f | ||
|
|
4f18ffd34e | ||
|
|
4306ec9c1e | ||
|
|
31c12e5182 | ||
|
|
521796a46d | ||
|
|
a187221d3f | ||
|
|
583b546e81 | ||
|
|
aa9523338f | ||
|
|
0ed66e0eab | ||
|
|
6523275b6a | ||
|
|
b9e9ca368a | ||
|
|
c4886e362a | ||
|
|
fc5f671e57 | ||
|
|
035ecd6df1 | ||
|
|
26d1a6047c | ||
|
|
60a89b6c3f | ||
|
|
b84c402c4a | ||
|
|
2579d2fea9 | ||
|
|
c75ed9b230 | ||
|
|
789e8b6bff | ||
|
|
633d15c438 | ||
|
|
baabcb1400 | ||
|
|
c16bbb9e7f | ||
|
|
623181cc34 | ||
|
|
76b5104fb7 | ||
|
|
6c0a642abf | ||
|
|
132435a9c8 | ||
|
|
521bcfc484 | ||
|
|
3413021d30 | ||
|
|
ffc64c6d56 | ||
|
|
79672f3a2d | ||
|
|
e1d5731466 | ||
|
|
09deef2d6c | ||
|
|
83907af456 | ||
|
|
878b7ed18e | ||
|
|
e6f3b9e5be | ||
|
|
75992ff13f | ||
|
|
2d7dddd505 | ||
|
|
afe0ed1674 | ||
|
|
b9ab4288d7 | ||
|
|
d816cc261a | ||
|
|
2e2ae96114 | ||
|
|
ec7e7c3f8b | ||
|
|
4a61ab269b | ||
|
|
5551ed2bd2 | ||
|
|
0da02aab21 | ||
|
|
1ae8d072a6 | ||
|
|
531a87825c | ||
|
|
4b5bb2a507 | ||
|
|
e61a3a6fe8 | ||
|
|
087da5cd9e | ||
|
|
1a5f7dd907 | ||
|
|
d38c030ee6 | ||
|
|
2042ddf08e | ||
|
|
1cf242a9df | ||
|
|
9aa0f14494 | ||
|
|
a9c7d688fd | ||
|
|
d2e5cdef4e | ||
|
|
607f5ed877 | ||
|
|
bd63ae5615 | ||
|
|
79b66f81ec | ||
|
|
e1c57fa9f0 | ||
|
|
a64bff6aab | ||
|
|
4e9a8e4afe | ||
|
|
c9a580dc07 | ||
|
|
f479a36dbe | ||
|
|
a7e7e8fb74 | ||
|
|
e56f1c6392 | ||
|
|
7caf2ef86d | ||
|
|
86b72d2723 | ||
|
|
c4b3a0aaaa | ||
|
|
de9c93610b | ||
|
|
7a06ac1ee7 | ||
|
|
f50f8e95b1 | ||
|
|
2e201b67a7 | ||
|
|
524040cf00 | ||
|
|
77d4f45d13 | ||
|
|
0d33179727 | ||
|
|
4f8de42598 | ||
|
|
3689727fc1 | ||
|
|
fffd82b9be | ||
|
|
6fc351d2e8 | ||
|
|
5630cf31f1 | ||
|
|
0c83101b3f | ||
|
|
fc683de434 | ||
|
|
b70afbe9eb | ||
|
|
996f681e5c | ||
|
|
eb118d67fc | ||
|
|
725b36ba79 | ||
|
|
1471a61993 | ||
|
|
94a76eedfd | ||
|
|
8566257a01 | ||
|
|
f60917e466 | ||
|
|
407ec97672 | ||
|
|
636ed0267d | ||
|
|
3154125ce0 | ||
|
|
62496aa18e | ||
|
|
0b98c2cbe6 | ||
|
|
bc82b59e47 | ||
|
|
277393387c | ||
|
|
007ff5c366 | ||
|
|
699e785340 | ||
|
|
6081dc240a | ||
|
|
b2e9216920 | ||
|
|
7972cb17cd | ||
|
|
73d2505c89 | ||
|
|
bdde8a127e | ||
|
|
8cf39394c5 | ||
|
|
ecf6957a6e | ||
|
|
d858005a68 | ||
|
|
6309fa8a48 | ||
|
|
fb8e2ec4e7 | ||
|
|
91d7cc1118 | ||
|
|
a072755cee | ||
|
|
1cfec4de50 | ||
|
|
cc3f2315a7 | ||
|
|
f745223796 | ||
|
|
25a2e95890 | ||
|
|
f371b14e89 | ||
|
|
0b6935e50c | ||
|
|
fb93e25833 | ||
|
|
ad86cb531a | ||
|
|
53b89aae45 | ||
|
|
b76e43679e | ||
|
|
077ca8fad2 | ||
|
|
377521c108 | ||
|
|
23d5f18d4a | ||
|
|
c8adb45ab5 | ||
|
|
18163e3ecc | ||
|
|
a18beca50c | ||
|
|
04b721aed9 | ||
|
|
45f9353164 | ||
|
|
5abe6ed6be | ||
|
|
38f81e45f4 | ||
|
|
c1482c2377 | ||
|
|
6bbd8f6006 | ||
|
|
cbdd72a4b6 | ||
|
|
f7d30b0df3 | ||
|
|
3e35b7441e | ||
|
|
754e79103a | ||
|
|
d6b59d16fd | ||
|
|
a6e220a2ae | ||
|
|
0b59262e95 | ||
|
|
593946779e | ||
|
|
537ded4b58 | ||
|
|
25a6a00f0f | ||
|
|
8298a1412b | ||
|
|
47eb25d07f | ||
|
|
0057c80b2e | ||
|
|
da88831689 | ||
|
|
7b6c6e51b3 | ||
|
|
42b2b3b8f6 | ||
|
|
64680664e3 | ||
|
|
87dd9b4374 | ||
|
|
c7d5e8d152 | ||
|
|
4cd15c074e | ||
|
|
9bfdabdf57 | ||
|
|
9375bc212b | ||
|
|
3829b52127 | ||
|
|
f852cab0f9 | ||
|
|
f53babcd68 | ||
|
|
016c1086e6 | ||
|
|
f7dd4c84b1 | ||
|
|
c1c0cb6b31 | ||
|
|
e5858bf698 | ||
|
|
b8389f6736 | ||
|
|
6c1c979414 | ||
|
|
43df82355a | ||
|
|
d8b26040f9 | ||
|
|
bdf29bf57b | ||
|
|
24358c39a6 | ||
|
|
504285c08f | ||
|
|
b7eb4026f6 | ||
|
|
ad5e4f58bb | ||
|
|
3085a10507 | ||
|
|
b5f0aa423b | ||
|
|
9344a13bed | ||
|
|
c8bc2c424f | ||
|
|
46fa6d4500 | ||
|
|
6002774f95 | ||
|
|
f7f208883c | ||
|
|
5523b00442 | ||
|
|
c81fdb18de | ||
|
|
778543c719 | ||
|
|
18b8972029 | ||
|
|
fa31f8eee1 | ||
|
|
98a2e33d78 | ||
|
|
58d01bf502 | ||
|
|
8326bd7016 | ||
|
|
d5f8b0d83b | ||
|
|
e70a898af5 | ||
|
|
df249646bc | ||
|
|
35ff93258e | ||
|
|
c58d034494 | ||
|
|
8f1de46381 | ||
|
|
1846a67e83 | ||
|
|
35ac14806c | ||
|
|
4aee4915d9 | ||
|
|
5eeaa1c693 | ||
|
|
9b2fcf89e8 | ||
|
|
e801a68f0d | ||
|
|
ffc5628637 | ||
|
|
306aa89d06 | ||
|
|
236415cde4 | ||
|
|
d49e0eaa1b | ||
|
|
107399a531 | ||
|
|
99a7786dc3 | ||
|
|
d8f48cc48b | ||
|
|
2f0beb6d3a | ||
|
|
3ab3627ffe | ||
|
|
70895999c2 | ||
|
|
ce311e1bf1 | ||
|
|
e9cf572a3c | ||
|
|
943b2ad9f3 | ||
|
|
f86bbb09f8 | ||
|
|
1246776328 | ||
|
|
ea15f69e73 | ||
|
|
2e22bb5431 | ||
|
|
a9a6e1d2b5 | ||
|
|
7e939c36cc | ||
|
|
c5d2d76ab1 | ||
|
|
622ba6e38a | ||
|
|
fad06348a7 | ||
|
|
a6ee303123 | ||
|
|
4b66add65f | ||
|
|
79dce7c4c3 | ||
|
|
aff71e0e33 | ||
|
|
9b10f56ba6 | ||
|
|
2391947b34 | ||
|
|
e903150971 | ||
|
|
7495ec9bbb | ||
|
|
e25d5a84b2 | ||
|
|
88ade4df1b | ||
|
|
00c3903672 | ||
|
|
c801b17ba0 | ||
|
|
9ec8d62f3f | ||
|
|
b1edcfcb1b | ||
|
|
54b0f59935 | ||
|
|
531b09f296 | ||
|
|
e5b6d66d60 | ||
|
|
a045810af6 | ||
|
|
d68a8fef9a | ||
|
|
9162d4291f | ||
|
|
93d7699aa7 | ||
|
|
6eb63f6a4c | ||
|
|
f6d4ca0387 | ||
|
|
7b41466a77 | ||
|
|
18c25084db | ||
|
|
a5875402ef | ||
|
|
f3ed1ba247 | ||
|
|
633d69baca | ||
|
|
dbc8cc14bc | ||
|
|
c65583b911 | ||
|
|
3d518b5757 | ||
|
|
bfa72d7f61 | ||
|
|
373713ba54 | ||
|
|
068c325ee2 | ||
|
|
3b076e5e64 | ||
|
|
07d6e3a0f2 | ||
|
|
7690ef9a1a | ||
|
|
9974c385e5 | ||
|
|
8dafad80b1 | ||
|
|
93e9b2dde9 | ||
|
|
c3a54595ea | ||
|
|
95ef52fe42 | ||
|
|
c638c40a09 | ||
|
|
83d48d24ce | ||
|
|
d807e43929 | ||
|
|
0a112be956 | ||
|
|
078efa2a6e | ||
|
|
5827827008 | ||
|
|
9c61d8de72 | ||
|
|
f72ddc8129 | ||
|
|
7e9c3b40bb | ||
|
|
a8371af9c0 | ||
|
|
4e11d071d9 | ||
|
|
a7140705c4 | ||
|
|
69986132b4 | ||
|
|
3c97a3a592 | ||
|
|
268dda4da0 | ||
|
|
45f58a97b9 | ||
|
|
bdbbaf6099 | ||
|
|
839968dc84 | ||
|
|
fbdc5f4a93 | ||
|
|
e5648a82a3 | ||
|
|
38133d326b | ||
|
|
cc00fcb5c9 | ||
|
|
53f7a14717 | ||
|
|
922495ca06 | ||
|
|
e5e2e08ff4 | ||
|
|
c7c410210b | ||
|
|
cb7c214aa0 | ||
|
|
6f5f49729c | ||
|
|
94c9442de1 | ||
|
|
8c044d0852 | ||
|
|
1f0cc0a5f3 | ||
|
|
5693ce3df7 | ||
|
|
bcf04ab11e | ||
|
|
086f6bd772 | ||
|
|
d0fa444a0e | ||
|
|
cd81aeb286 | ||
|
|
7db33bc92e | ||
|
|
fb6c501e44 | ||
|
|
ce7b398f7b | ||
|
|
4d8d3a8109 | ||
|
|
a183cf8b63 | ||
|
|
f834edcf94 | ||
|
|
17802a9408 | ||
|
|
ac1aad881c | ||
|
|
928110a92d | ||
|
|
f6479fafe2 | ||
|
|
62b1c2ba84 | ||
|
|
c0ac5e540f | ||
|
|
fb5ec5557b | ||
|
|
74d94e6792 | ||
|
|
63f4c6b4da | ||
|
|
2774c1c988 | ||
|
|
469b0c0a9a | ||
|
|
2ddd217737 | ||
|
|
c4e8e34ad6 | ||
|
|
4dc18c0af4 | ||
|
|
55c6911b87 | ||
|
|
9bf0da5409 | ||
|
|
7d5b2dd1de | ||
|
|
6091632e40 | ||
|
|
44110fd4d9 | ||
|
|
74d76ebfeb | ||
|
|
760bc138b0 | ||
|
|
2a4763d4f3 | ||
|
|
4b92f205ef | ||
|
|
a5668fa1db | ||
|
|
de39256377 | ||
|
|
f53709c83d | ||
|
|
8ad0192e55 | ||
|
|
791e454cb6 | ||
|
|
c85638be4d | ||
|
|
a61b1fdf06 | ||
|
|
07c25d1d91 | ||
|
|
83dafd87a4 | ||
|
|
25a8733957 | ||
|
|
c529e9ed9c | ||
|
|
d6a8a85b5e | ||
|
|
3a945535f7 | ||
|
|
0fc4374193 | ||
|
|
e350b4ab92 | ||
|
|
626527ee09 | ||
|
|
c4a462c385 | ||
|
|
706a04dbfc | ||
|
|
7fd51af4de | ||
|
|
c1af9b2ba4 | ||
|
|
5efb4cc58d | ||
|
|
4b2977d601 | ||
|
|
2f1c1c2fb1 | ||
|
|
f47ef09a1f | ||
|
|
47041b0fac | ||
|
|
b6111b5e00 | ||
|
|
b8a2b2d7c8 | ||
|
|
0765ea1b86 | ||
|
|
64223704e0 | ||
|
|
8c14763ea4 | ||
|
|
10cd93022a | ||
|
|
d006aede6a | ||
|
|
b57e1ce660 | ||
|
|
1b59c4dad3 | ||
|
|
189c721d7e | ||
|
|
1ff1592f24 | ||
|
|
7f5f310bf0 | ||
|
|
f999861228 | ||
|
|
a571bd7dca | ||
|
|
3d0d28fa01 | ||
|
|
4c54b49ef5 | ||
|
|
eb940bcf52 | ||
|
|
be0e773879 | ||
|
|
056e07e80e | ||
|
|
83b36d07d0 | ||
|
|
89aaf05aff | ||
|
|
2f87fd46fb | ||
|
|
e04276ee38 | ||
|
|
05c3061f08 | ||
|
|
c33006bcbc | ||
|
|
4bf4500ae1 | ||
|
|
e2944ff4a7 | ||
|
|
f79b5dadbb | ||
|
|
4d44129b04 | ||
|
|
b3e1d84e6c | ||
|
|
6702edaa9d | ||
|
|
a3a6e5933a | ||
|
|
66ec95ebb0 | ||
|
|
a944bf85b8 | ||
|
|
1d1829f664 | ||
|
|
094aa872ce | ||
|
|
eaf925e30b | ||
|
|
722d3d1ad4 | ||
|
|
b69b3e9409 | ||
|
|
ae5eaeec93 | ||
|
|
c393eb20be | ||
|
|
0e8715b4ff | ||
|
|
b09c812579 | ||
|
|
d6f7c271e2 | ||
|
|
f1d97e396b | ||
|
|
abf8f4daa8 | ||
|
|
aba242301d | ||
|
|
7a52080940 | ||
|
|
c3ffe6ab8b | ||
|
|
851a9185c0 | ||
|
|
c1e1ddb73f | ||
|
|
d530c1d6d6 | ||
|
|
43579b51f0 | ||
|
|
3d1133cdb5 | ||
|
|
e27af9fd24 | ||
|
|
a7c6597246 | ||
|
|
fd6d873c01 | ||
|
|
89dee04cdf | ||
|
|
3b0a073964 | ||
|
|
a129863a4d | ||
|
|
5b700f7dfc | ||
|
|
d982bcb5e4 | ||
|
|
61a5e8d4fd | ||
|
|
cb641bd221 | ||
|
|
2f6e9a1756 | ||
|
|
51b183a0f3 | ||
|
|
d071bb04af | ||
|
|
14887f9c99 | ||
|
|
654909261e | ||
|
|
ab2a27345d | ||
|
|
484eb3303c | ||
|
|
319d64e1e5 | ||
|
|
60250ca5e5 | ||
|
|
d729bb3a89 | ||
|
|
4dc55635d7 | ||
|
|
4af49ef7b6 | ||
|
|
3a42e66504 | ||
|
|
250b196b81 | ||
|
|
9ba1987cab | ||
|
|
909b1e2a28 | ||
|
|
e46af41abf | ||
|
|
17671a3b08 | ||
|
|
b8eb7752e7 | ||
|
|
5e92f45111 | ||
|
|
baf848c791 | ||
|
|
737d57c1f4 | ||
|
|
9985ad7ee1 | ||
|
|
025b55e1a2 | ||
|
|
14fbabe8d7 | ||
|
|
b746f7a70e | ||
|
|
0d3b003aac | ||
|
|
9428927879 | ||
|
|
511b2f7186 | ||
|
|
d8c83e3c65 | ||
|
|
050fd6f3ba | ||
|
|
72d6a8d4e1 | ||
|
|
30d35216f6 | ||
|
|
bcd0d40912 | ||
|
|
4b8a6bbbe0 | ||
|
|
47026b669b | ||
|
|
752dc467a8 | ||
|
|
bde45b262a | ||
|
|
fc338f5723 | ||
|
|
346ed453ef | ||
|
|
664f05edba | ||
|
|
edcff44f4b | ||
|
|
42ee5d2ddb | ||
|
|
54e421d7e6 | ||
|
|
9e5629d1e0 | ||
|
|
c0fdffac28 | ||
|
|
e94e64d204 | ||
|
|
e503e35b84 | ||
|
|
752592a3d8 | ||
|
|
2e6d194a6f | ||
|
|
63dfb07b51 | ||
|
|
02525056d6 | ||
|
|
8292429648 | ||
|
|
765c496068 | ||
|
|
d6feec8010 | ||
|
|
f1fbb37547 | ||
|
|
5a6386dd24 | ||
|
|
0809db9e32 | ||
|
|
15a3315854 | ||
|
|
82d1f256b2 | ||
|
|
e7ba2a0eb0 | ||
|
|
eff0449b3a | ||
|
|
3b9e066ec8 | ||
|
|
260ab42b9e | ||
|
|
a3d745edd0 | ||
|
|
40a92fe730 | ||
|
|
e30bb23711 | ||
|
|
292c1d08d8 | ||
|
|
be56447614 | ||
|
|
70fda8ba64 | ||
|
|
5cc407986b | ||
|
|
53af829f46 | ||
|
|
53065a6d95 | ||
|
|
862cfdb55d | ||
|
|
b065b16bf1 | ||
|
|
6ff33b48d1 | ||
|
|
d04020f79c | ||
|
|
6b15072764 | ||
|
|
f261115ac4 | ||
|
|
116f130c4c | ||
|
|
cad1b02482 | ||
|
|
09fe69f63a | ||
|
|
8ecd81d51c | ||
|
|
8f71b010cc | ||
|
|
b817c6189d | ||
|
|
a00d41930d | ||
|
|
caee942796 | ||
|
|
d3410fdc61 | ||
|
|
8087c3e5d4 | ||
|
|
10bd0ea09e | ||
|
|
5803222e68 | ||
|
|
a243fce1ae | ||
|
|
c8059ebf50 | ||
|
|
ce2d270e7c | ||
|
|
0c945bdc7e | ||
|
|
60ec684853 | ||
|
|
b159625e62 | ||
|
|
e212262f29 | ||
|
|
c71167d893 | ||
|
|
2d4e4c7a13 | ||
|
|
695f8df5b8 | ||
|
|
2e822cb6a6 | ||
|
|
f2a90935a3 | ||
|
|
cee741eca0 | ||
|
|
b5b59e77d6 | ||
|
|
cce883808e | ||
|
|
8faae7ef08 | ||
|
|
4538ef38a1 | ||
|
|
ee12d02402 | ||
|
|
7050fa41a0 | ||
|
|
4a346211b8 | ||
|
|
4df2ecc8ae | ||
|
|
03995ec6b2 | ||
|
|
6059146b42 | ||
|
|
30811ae656 | ||
|
|
b8015bbef5 | ||
|
|
157d7c57fd | ||
|
|
03963036d1 | ||
|
|
5099f7db88 | ||
|
|
ab8cd246bf | ||
|
|
528981f913 | ||
|
|
3fd5eb789c | ||
|
|
9c09777c09 | ||
|
|
7298d320e0 | ||
|
|
39154fa5ad | ||
|
|
6db99bee25 | ||
|
|
ee0505c100 | ||
|
|
1943749cb6 | ||
|
|
5763ed20bf | ||
|
|
7eead1c1ff | ||
|
|
048e08b59a | ||
|
|
523bd9b788 | ||
|
|
f442733b33 | ||
|
|
a6fe5bd859 | ||
|
|
32a1d23c2a | ||
|
|
06644945cf | ||
|
|
1774a2c23e | ||
|
|
668b974dd7 | ||
|
|
4427f81dd9 | ||
|
|
9490428535 | ||
|
|
8d70eedc5f | ||
|
|
74550d2424 | ||
|
|
148d8e7524 | ||
|
|
aca9a4dcb6 | ||
|
|
953c35bdac | ||
|
|
596b33f149 | ||
|
|
ef3ea618d2 | ||
|
|
362b210a31 | ||
|
|
15f7b0ecff | ||
|
|
f72e9f5293 | ||
|
|
0d93f31eea | ||
|
|
f1af125d24 | ||
|
|
a6c08bee7b | ||
|
|
c2d2c8660f | ||
|
|
db3538af64 | ||
|
|
04ac7fb19e | ||
|
|
53e853fbc9 | ||
|
|
747ce4e00b | ||
|
|
5f6eb76d7f | ||
|
|
3777620574 | ||
|
|
b02ae1b7cc | ||
|
|
88816018d8 | ||
|
|
06e7e2afac | ||
|
|
ce2c4ed0f4 | ||
|
|
099ca60975 | ||
|
|
43ab623fac | ||
|
|
bcc9a8fd60 | ||
|
|
6fb96ea5d6 | ||
|
|
2f64b3ee13 | ||
|
|
d4a78e5dc7 | ||
|
|
71033f5739 | ||
|
|
17444509fe | ||
|
|
42baa22cdc | ||
|
|
f07de8cd3b | ||
|
|
0772898b83 | ||
|
|
828b2d66d1 | ||
|
|
8ab4fb7946 | ||
|
|
e91a059f0f | ||
|
|
093d83ed89 | ||
|
|
5c0381e4f0 | ||
|
|
657c6f8e35 | ||
|
|
4bb984daf3 | ||
|
|
e46a3f89ed | ||
|
|
6843cd62dd | ||
|
|
52ffc77fdd | ||
|
|
158542ec0a | ||
|
|
360da8a3c9 | ||
|
|
65d1186317 | ||
|
|
b7b4d68a9a | ||
|
|
952f70b433 | ||
|
|
74de8e5056 | ||
|
|
9d88c1c5da | ||
|
|
a6bde78168 | ||
|
|
bb85885e5d | ||
|
|
dd085be73d | ||
|
|
f576310cdf | ||
|
|
70e1c98987 | ||
|
|
4f03aa82fe | ||
|
|
383c93a415 | ||
|
|
860fbe8ede | ||
|
|
39900bd987 | ||
|
|
5c09147551 | ||
|
|
f0929a9bd8 | ||
|
|
786496b3c4 | ||
|
|
e5f5c8273e | ||
|
|
ca250699ef | ||
|
|
7f41af3ee7 | ||
|
|
260dc3fddd | ||
|
|
052c40cc26 | ||
|
|
1b5bab9c18 | ||
|
|
6a7b256676 | ||
|
|
0e135129e2 | ||
|
|
7af6bf13ed | ||
|
|
91ed49b65a | ||
|
|
84f614528f | ||
|
|
7c0e29fc86 | ||
|
|
1f9e4bd576 | ||
|
|
fc0a577dfb | ||
|
|
69d16ddce5 | ||
|
|
984813b154 | ||
|
|
b6beeedc26 | ||
|
|
55f7a0d0dc | ||
|
|
7919cc191e | ||
|
|
db0c5088b7 | ||
|
|
cc4b9a6b45 | ||
|
|
f4e33a4ad4 | ||
|
|
0e0fe9ed51 | ||
|
|
20c1f8cbe3 | ||
|
|
f2ee3b4966 | ||
|
|
57a072746e | ||
|
|
497f21a5bd | ||
|
|
099c242ad7 | ||
|
|
109eff420c | ||
|
|
0896096a70 | ||
|
|
2d2aea009e | ||
|
|
0425b4e094 | ||
|
|
15c0a9dadf | ||
|
|
e09c563cd8 | ||
|
|
218a4a50f6 | ||
|
|
9ab228e8f0 | ||
|
|
b30db118f2 | ||
|
|
cccb4f45cd | ||
|
|
54c9d6e35d | ||
|
|
da7d11e387 | ||
|
|
d9073183a7 | ||
|
|
78480f7577 | ||
|
|
1dbf0d70da | ||
|
|
44ee2a9913 | ||
|
|
a3a5a51f74 | ||
|
|
1ae4426ec8 | ||
|
|
270760bd16 | ||
|
|
5bb20e44fb | ||
|
|
26a2ab725e | ||
|
|
9d73b89a4e | ||
|
|
606f335496 | ||
|
|
fe9a02e514 | ||
|
|
f76a835e33 | ||
|
|
e199add701 | ||
|
|
a744096dd7 | ||
|
|
51a18849c0 | ||
|
|
bd303ef10b | ||
|
|
1e9ec77b65 | ||
|
|
4b409de5ba | ||
|
|
66cea3a0b5 | ||
|
|
0add617834 | ||
|
|
70b0d95d9b | ||
|
|
cae9c89b64 | ||
|
|
a9d9274e78 | ||
|
|
2211fb6b1e | ||
|
|
34569679f0 | ||
|
|
816e1f0d51 | ||
|
|
de62d74ac5 | ||
|
|
d71c79f268 | ||
|
|
ee948cb2ae | ||
|
|
ba59a850d1 | ||
|
|
b7999842a9 | ||
|
|
2dd0ae47db | ||
|
|
926d9346e1 | ||
|
|
ac8764b9b7 | ||
|
|
4cf3f24fbc | ||
|
|
0691766a31 | ||
|
|
77c00a10da | ||
|
|
8c407ae482 | ||
|
|
8d2d612547 | ||
|
|
80dc26b7f4 | ||
|
|
fbe7b9ec1a | ||
|
|
048fccd6e0 | ||
|
|
638d41e0b6 | ||
|
|
4271eb6b3e | ||
|
|
d25bfd8ba7 | ||
|
|
0739fbf464 | ||
|
|
d1b38f8eb2 | ||
|
|
e6d17fa4cb | ||
|
|
d62b8b49a2 | ||
|
|
149dd7dc8b | ||
|
|
0177f96795 | ||
|
|
ec56773dc6 | ||
|
|
881bf34ec4 | ||
|
|
6787308061 | ||
|
|
0cd01bf165 | ||
|
|
132ae3899f | ||
|
|
72f84fa4ef | ||
|
|
16d81f3f71 | ||
|
|
42a0ea148b | ||
|
|
2021311a4e | ||
|
|
b64e91dffa | ||
|
|
57bb7030fb | ||
|
|
425fe7829b | ||
|
|
aa88315924 | ||
|
|
39a59fb049 | ||
|
|
e0993a5e55 | ||
|
|
4eb59ba7ed | ||
|
|
cc9fb31e61 | ||
|
|
c44ebecfb2 | ||
|
|
f60e1d763e | ||
|
|
5c3cb477ef | ||
|
|
5fd4005967 | ||
|
|
76d1b8f7fb | ||
|
|
2bbc65958a | ||
|
|
cbdd0fd2ba | ||
|
|
2f7aa77c11 | ||
|
|
bed39570ff | ||
|
|
8bc3b204b4 | ||
|
|
fa030ebcbb | ||
|
|
af365024b7 | ||
|
|
c742877b77 | ||
|
|
ace4391b79 | ||
|
|
627cbf2898 | ||
|
|
baae80fa41 | ||
|
|
9be07710dd | ||
|
|
163e005561 | ||
|
|
d8e691d3f5 | ||
|
|
85a1a6ba24 | ||
|
|
828a59b298 | ||
|
|
f1b91c0223 | ||
|
|
cadb0f18a9 | ||
|
|
2a8d7cf0a8 | ||
|
|
c9b54ba87f | ||
|
|
d57ae91995 | ||
|
|
dd86b132ce | ||
|
|
3967558bae | ||
|
|
668ce51f3c | ||
|
|
1db2a4aeea | ||
|
|
e20425f385 | ||
|
|
a20224f969 | ||
|
|
d66318a031 | ||
|
|
37c2579253 | ||
|
|
23ab2a343f | ||
|
|
e6dfc595ab | ||
|
|
98e15d7741 | ||
|
|
38b226b46f | ||
|
|
c53b4d398e | ||
|
|
fbcf6b6c65 | ||
|
|
09c95b20da | ||
|
|
a7f81c3cfb | ||
|
|
a66256f390 | ||
|
|
8b7da18641 | ||
|
|
a9c0356611 | ||
|
|
b25a9a5407 | ||
|
|
8b632356e9 | ||
|
|
b8a01d794e | ||
|
|
cfd33921a1 | ||
|
|
979aa010b9 | ||
|
|
de064ba0c0 | ||
|
|
ff200d9562 | ||
|
|
a8148683d3 | ||
|
|
838a15d31a | ||
|
|
2d66bf24fb | ||
|
|
64bc7cc955 | ||
|
|
362f8ec0cb | ||
|
|
d99a40df94 | ||
|
|
ab08955a5f | ||
|
|
577fcd7f9e | ||
|
|
7da92bf04c | ||
|
|
f7caf6fe49 | ||
|
|
d111edd76a | ||
|
|
b2657c06a8 | ||
|
|
fccf9e8805 | ||
|
|
7fc80705dd | ||
|
|
9007f31c0a | ||
|
|
18f8e5b98b | ||
|
|
0087f74178 | ||
|
|
639ad8df91 | ||
|
|
e8af3dacf1 | ||
|
|
5d42fb8294 | ||
|
|
4440a2f1ac | ||
|
|
c9cee89d7e | ||
|
|
1c3d20ad6f | ||
|
|
40862fcf12 | ||
|
|
110b25a64b | ||
|
|
f1a44ddebb | ||
|
|
fc00d86c7e | ||
|
|
4a822fe52c | ||
|
|
6587f00c2a | ||
|
|
3b77502b97 | ||
|
|
d7554b9735 | ||
|
|
798df5c136 | ||
|
|
22c70976db | ||
|
|
3eeb7cd8ab | ||
|
|
7ef245d739 | ||
|
|
9a6b3b3e2d | ||
|
|
715c9ca022 | ||
|
|
5f57ea7fe6 | ||
|
|
37b2e60e99 | ||
|
|
95024543cc | ||
|
|
3f1abe8350 | ||
|
|
50895d08e1 | ||
|
|
6747e07166 | ||
|
|
994d0a9a7e | ||
|
|
3f7562809e | ||
|
|
5fd8477a21 | ||
|
|
faa5d60bea | ||
|
|
02d41b8dfe | ||
|
|
caf105cbd9 | ||
|
|
2c067482de | ||
|
|
bf8d119a0e | ||
|
|
3f83b578de | ||
|
|
16fe4a3565 | ||
|
|
abf16370ad | ||
|
|
a93b84c32e | ||
|
|
267f983ca1 | ||
|
|
50e9f3186a | ||
|
|
d25114b370 | ||
|
|
12cc310e38 | ||
|
|
bf2b9c968d | ||
|
|
4a0cda72a2 | ||
|
|
e3e3b60f1e | ||
|
|
ddfc0422b4 | ||
|
|
42bf50f6a3 | ||
|
|
47428b8959 | ||
|
|
0965ed680d | ||
|
|
8f8139e7dc | ||
|
|
c3e10343b4 | ||
|
|
3aa2e6f425 | ||
|
|
66bfa4da1d | ||
|
|
d09ca88101 | ||
|
|
453429f860 | ||
|
|
fdd9c3d0ee | ||
|
|
22a51a2813 | ||
|
|
89c5c46dbb | ||
|
|
ab43010a98 | ||
|
|
7916930160 | ||
|
|
11026923bd | ||
|
|
2d50b96881 | ||
|
|
23d1819f40 | ||
|
|
b631f54a54 | ||
|
|
453c3fee79 | ||
|
|
d7c9626df9 | ||
|
|
c7a2be629f | ||
|
|
a2c9aa6742 | ||
|
|
56abc55bb2 | ||
|
|
d2fc32f2a7 | ||
|
|
b221010800 | ||
|
|
8537c42756 | ||
|
|
aae296696d | ||
|
|
74eb0f3c35 | ||
|
|
68b0d64fee | ||
|
|
fd6035c54a | ||
|
|
a1dd32b121 | ||
|
|
c9c9a3297b | ||
|
|
0422352139 | ||
|
|
4b590dc05d | ||
|
|
0f33ced9bc | ||
|
|
2831d58dcd | ||
|
|
eb646ff769 | ||
|
|
aed12cd831 | ||
|
|
30d88ceb78 | ||
|
|
f66d20972d | ||
|
|
7055f5fa50 | ||
|
|
6bbbe27c9a | ||
|
|
5cb5e057e7 | ||
|
|
134faacb5e | ||
|
|
b2ad88bd01 | ||
|
|
e999883c58 | ||
|
|
6258476713 | ||
|
|
53b96d3f44 | ||
|
|
da4552c61c | ||
|
|
8b563740f5 | ||
|
|
6137b7e1f5 | ||
|
|
a7b276c3c4 | ||
|
|
6a063c9d76 | ||
|
|
ac71ea0035 | ||
|
|
879c50a6b8 | ||
|
|
4e1ad08e90 | ||
|
|
45b18c7ada | ||
|
|
ca5873022a | ||
|
|
b004a92e8a | ||
|
|
e6df7d90fe | ||
|
|
4ff254df97 | ||
|
|
0c77bd45f2 | ||
|
|
880ba76bd8 | ||
|
|
327817e7ea | ||
|
|
2c98207799 | ||
|
|
6c2ef567c4 | ||
|
|
4f9b504d90 | ||
|
|
b811796bbc | ||
|
|
4008706bb0 | ||
|
|
20acd11425 | ||
|
|
b36e2f09de | ||
|
|
d29e83e5f6 | ||
|
|
0dd37a39b9 | ||
|
|
b22858f9cf | ||
|
|
4accb1e952 | ||
|
|
5e4a6b2c8e | ||
|
|
79986e47b6 | ||
|
|
45cd7958d0 | ||
|
|
7bdc984933 | ||
|
|
76f3ef75d5 | ||
|
|
13e4d1cdb3 | ||
|
|
70df392647 | ||
|
|
ae857f5981 | ||
|
|
cb49214667 | ||
|
|
48e64f1c32 | ||
|
|
9b1a53510e | ||
|
|
c6aa173202 | ||
|
|
907fc3f872 | ||
|
|
406a59277f | ||
|
|
f094466d64 | ||
|
|
af8274f305 | ||
|
|
420b8014f8 | ||
|
|
9e5fa977a5 | ||
|
|
fe101ff0e8 | ||
|
|
0ba067aa15 | ||
|
|
192cab67e9 | ||
|
|
fa08da847a | ||
|
|
81d40c829d | ||
|
|
6e978cae63 | ||
|
|
a0167c4cc2 | ||
|
|
cab893b4aa | ||
|
|
8399acda83 | ||
|
|
12550f4bc3 | ||
|
|
2ec76cad54 | ||
|
|
47602652e4 | ||
|
|
158ddf2269 | ||
|
|
71d5259f85 | ||
|
|
1ddf39b3da | ||
|
|
8b9981970d | ||
|
|
4accc5e2ac | ||
|
|
dc4e802bd1 | ||
|
|
7b368057e3 | ||
|
|
2ea6fa9611 | ||
|
|
125fd4c65c | ||
|
|
cf4d1109d3 | ||
|
|
c7c6d06907 | ||
|
|
384d43bb80 | ||
|
|
29c55b6ca3 | ||
|
|
910b0be5a5 | ||
|
|
706fa6310b | ||
|
|
248699d771 | ||
|
|
6343e37bc1 | ||
|
|
f562e8c212 | ||
|
|
8ff00226e2 | ||
|
|
c72c75083c | ||
|
|
862a54eac3 | ||
|
|
12bc18e1ba | ||
|
|
f045bd0d50 | ||
|
|
dfe06468ed | ||
|
|
3fda8da1a5 | ||
|
|
d0a5715f8c | ||
|
|
6b83bb8503 | ||
|
|
69f1dba96a | ||
|
|
dcbdd7ff63 | ||
|
|
9b28a011e7 | ||
|
|
350598dc55 | ||
|
|
ae9df021c2 | ||
|
|
d7cb78ecf5 | ||
|
|
ef2e9acf1e | ||
|
|
7f52069e41 | ||
|
|
9a5c0d9cdc | ||
|
|
551fb17e02 | ||
|
|
b5b9864033 | ||
|
|
a2d2ef3a5e | ||
|
|
b09a586357 | ||
|
|
70f3bc5308 | ||
|
|
8bc7b754bc | ||
|
|
3d5160455a | ||
|
|
983cc22761 | ||
|
|
6d80e4cacb | ||
|
|
1c5a271177 | ||
|
|
e4891ccf6b | ||
|
|
48bfc7485f | ||
|
|
2e297ab1ef | ||
|
|
828fc553b4 | ||
|
|
08e1a6c69a | ||
|
|
039ea44520 | ||
|
|
65c1abbe27 | ||
|
|
0ab5a0f114 | ||
|
|
94219bd31e | ||
|
|
7c2457e659 | ||
|
|
a156453301 | ||
|
|
c2e53ec9a9 | ||
|
|
687b2a83b4 | ||
|
|
a1f7d628bb | ||
|
|
789ee66836 | ||
|
|
9ec42b66f3 | ||
|
|
b2b44a0810 | ||
|
|
59076afcb5 | ||
|
|
5ab24250bc | ||
|
|
273b0653da | ||
|
|
b583cfb9f6 | ||
|
|
84cdf6ec78 | ||
|
|
4623d78e0d | ||
|
|
89cc9ffa46 | ||
|
|
27ddc144e0 | ||
|
|
6e54383d1d | ||
|
|
e955bb11fa | ||
|
|
f08c926945 | ||
|
|
fdb083bb12 | ||
|
|
e604e6af22 | ||
|
|
9aabdc0812 | ||
|
|
a388d9e6e1 | ||
|
|
4dab7af44d | ||
|
|
60a0c199eb | ||
|
|
de7f31f067 | ||
|
|
ae4e29a968 | ||
|
|
f50a8a98f4 | ||
|
|
b3903bcc7f | ||
|
|
bc38ac837b | ||
|
|
c2c1a79046 | ||
|
|
b902e759cb |
61
.gitignore
vendored
61
.gitignore
vendored
@@ -1,54 +1,9 @@
|
||||
*.la
|
||||
*.lo
|
||||
*.loT
|
||||
*.o
|
||||
*.so
|
||||
.zanata-cache/
|
||||
_build
|
||||
TAGS
|
||||
tags
|
||||
vgdump
|
||||
*.swp
|
||||
*~
|
||||
Makefile
|
||||
Makefile.in
|
||||
.deps
|
||||
.libs
|
||||
INSTALL
|
||||
aclocal.m4
|
||||
autom4te.cache
|
||||
compile
|
||||
config.guess
|
||||
config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.rpath
|
||||
config.status
|
||||
config.sub
|
||||
configure
|
||||
depcomp
|
||||
install-sh
|
||||
libtool
|
||||
ltmain.sh
|
||||
missing
|
||||
stamp-h1
|
||||
libkeyactor*.tar.*
|
||||
mkinstalldirs
|
||||
m4/*.m4
|
||||
gtk-doc.make
|
||||
eek/eek-special-keysym-labels.h
|
||||
eek/eek-unicode-keysym-labels.h
|
||||
eek/eek-keyname-keysym-labels.h
|
||||
eek/*.pc
|
||||
tests/eek-simple-test
|
||||
tests/eek-xkb-test
|
||||
src/eekboard
|
||||
docs/reference/eek/*.stamp
|
||||
docs/reference/eek/*.txt
|
||||
!/docs/reference/eek/eek-sections.txt
|
||||
docs/reference/eek/xml
|
||||
docs/reference/eek/html
|
||||
docs/reference/eek/eek.signals
|
||||
docs/reference/eek/eek.args
|
||||
docs/reference/eek/eek.hierarchy
|
||||
docs/reference/eek/eek.interfaces
|
||||
docs/reference/eek/eek.prerequisites
|
||||
po/*.gmo
|
||||
po/Makefile.in.in
|
||||
po/POTFILES
|
||||
po/stamp-it
|
||||
|
||||
\#*#
|
||||
.\#*
|
||||
|
||||
56
.gitlab-ci.yml
Normal file
56
.gitlab-ci.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
image: debian:buster
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
|
||||
.tags: &tags
|
||||
tags:
|
||||
- librem5
|
||||
|
||||
before_script:
|
||||
- apt-get -y update
|
||||
- apt-get -y install wget ca-certificates gnupg
|
||||
- echo "deb http://ci.puri.sm/ scratch librem5" > /etc/apt/sources.list.d/ci.list
|
||||
- wget -O- https://ci.puri.sm/ci-repo.key | apt-key add -
|
||||
- apt-get -y update
|
||||
- apt-get -y build-dep .
|
||||
|
||||
build_meson:
|
||||
<<: *tags
|
||||
stage: build
|
||||
artifacts:
|
||||
paths:
|
||||
- _build
|
||||
expire_in: 3h
|
||||
script:
|
||||
- meson . _build/ -Ddepdatadir=/usr/share
|
||||
- ninja -C _build install
|
||||
|
||||
build_deb:
|
||||
<<: *tags
|
||||
stage: build
|
||||
artifacts:
|
||||
paths:
|
||||
- "*.deb"
|
||||
script:
|
||||
- apt-get -y install devscripts
|
||||
- debuild -i -us -uc -b
|
||||
- cp ../*.deb .
|
||||
|
||||
test_lintian:
|
||||
<<: *tags
|
||||
stage: test
|
||||
dependencies:
|
||||
- build_deb
|
||||
script:
|
||||
- apt-get -y install lintian
|
||||
- lintian *.deb
|
||||
|
||||
test:
|
||||
<<: *tags
|
||||
stage: test
|
||||
needs:
|
||||
- build_meson
|
||||
script:
|
||||
- ninja -C _build test
|
||||
7
AUTHORS
7
AUTHORS
@@ -1,6 +1,5 @@
|
||||
eekboard is written by Daiki Ueno <ueno@unixuser.org>
|
||||
squeekboard is written by Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> on behlf of Purism, SPC.
|
||||
eekboard was written by Daiki Ueno <ueno@unixuser.org>
|
||||
|
||||
Cairo keyboard drawing functions are borrowed from the libgnomekbd
|
||||
library by Sergey V. Udaltsov <svu@gnome.org>. See the comments in
|
||||
eek/eek-drawing.c for detail.
|
||||
For more details, see the debian/copyright file.
|
||||
|
||||
|
||||
476
Cargo.lock
generated
Normal file
476
Cargo.lock
generated
Normal file
@@ -0,0 +1,476 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "aho-corasick"
|
||||
version = "0.7.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "atk-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "bitflags"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "cairo-rs"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cairo-sys-rs"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cc"
|
||||
version = "1.0.45"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "dtoa"
|
||||
version = "0.4.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "fragile"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "gdk"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk-pixbuf"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk-pixbuf-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gdk-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gio"
|
||||
version = "0.5.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gio-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glib"
|
||||
version = "0.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "glib-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gobject-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "gtk-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"atk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "lazy_static"
|
||||
version = "1.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "libc"
|
||||
version = "0.2.62"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "linked-hash-map"
|
||||
version = "0.5.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "maplit"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "memchr"
|
||||
version = "2.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "memmap"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pango"
|
||||
version = "0.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pango-sys"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pkg-config"
|
||||
version = "0.3.16"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "proc-macro2"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "quote"
|
||||
version = "1.0.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.1.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "regex-syntax"
|
||||
version = "0.6.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "rs"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gtk 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xkbcommon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.101"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_yaml"
|
||||
version = "0.8.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "1.0.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "thread_local"
|
||||
version = "0.3.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "unicode-xid"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "utf8-ranges"
|
||||
version = "1.0.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "xkbcommon"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "yaml-rust"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[metadata]
|
||||
"checksum aho-corasick 0.7.6 (registry+https://github.com/rust-lang/crates.io-index)" = "58fb5e95d83b38284460a5fda7d6470aa0b8844d283a0b614b8535e880800d2d"
|
||||
"checksum atk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "c7017e53393e713212aed7aea336b6553be4927f58c37070a56c2fe3d107e489"
|
||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||
"checksum cairo-rs 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dd940f0d609699e343ef71c4af5f66423afbf30d666f796dabd8fd15229cf5b6"
|
||||
"checksum cairo-sys-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d25596627380be4381247dba06c69ad05ca21b3b065bd9827e416882ac41dcd2"
|
||||
"checksum cc 1.0.45 (registry+https://github.com/rust-lang/crates.io-index)" = "4fc9a35e1f4290eb9e5fc54ba6cf40671ed2a2514c3eeb2b2a908dda2ea5a1be"
|
||||
"checksum dtoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "ea57b42383d091c85abcc2706240b94ab2a8fa1fc81c10ff23c4de06e2a90b5e"
|
||||
"checksum fragile 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "05f8140122fa0d5dcb9fc8627cfce2b37cc1500f752636d46ea28bc26785c2f9"
|
||||
"checksum gdk 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcc52c7244046df9d959df87289f1fc5cca23f9f850bab0c967963e2ecb83a96"
|
||||
"checksum gdk-pixbuf 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc3aa730cb4df3de5d9fed59f43afdf9e5fb2d3d10bfcbd04cec031435ce87f5"
|
||||
"checksum gdk-pixbuf-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08284f16ce4d909b10d785a763ba190e222d2c1557b29908bf0a661e27a8ac3b"
|
||||
"checksum gdk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "108548ebf5329b551f2b97ab356908d14627905abb74b936c3372de1535aee81"
|
||||
"checksum gio 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "29a44b051990573448edc80b1995237f8b97b5734d2aec05105b9242aa10af11"
|
||||
"checksum gio-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6975ada29f7924dc1c90b30ed3b32d777805a275556c05e420da4fbdc22eb250"
|
||||
"checksum glib 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7a333edf5b9f1411c246ef14e7881b087255f04c56dbef48c64a0cb039b4b340"
|
||||
"checksum glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3573351e846caed9f11207b275cd67bc07f0c2c94fb628e5d7c92ca056c7882d"
|
||||
"checksum gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "08475e4a08f27e6e2287005950114735ed61cec2cb8c1187682a5aec8c69b715"
|
||||
"checksum gtk 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56a6b30f194f09a17bb7ffa95c3ecdb405abd3b75ff981f831b1f6d18fe115ff"
|
||||
"checksum gtk-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d487d333a4b87072e6bf9f2e55befa0ebef01b9496c2e263c0f4a1ff3d6c04b1"
|
||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||
"checksum libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)" = "34fcd2c08d2f832f376f4173a231990fa5aef4e99fb569867318a227ef4c06ba"
|
||||
"checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83"
|
||||
"checksum maplit 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d"
|
||||
"checksum memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "88579771288728879b57485cc7d6b07d648c9f0141eb955f8ab7f9d45394468e"
|
||||
"checksum memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b"
|
||||
"checksum pango 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4c2cb169402a3eb1ba034a7cc7d95b8b1c106e9be5ba4be79a5a93dc1a2795f4"
|
||||
"checksum pango-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6eb49268e69dd0c1da5d3001a61aac08e2e9d2bfbe4ae4b19b9963c998f6453"
|
||||
"checksum pkg-config 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)" = "72d5370d90f49f70bd033c3d75e87fc529fbfff9d6f7cccef07d6170079d91ea"
|
||||
"checksum proc-macro2 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "afdc77cc74ec70ed262262942ebb7dac3d479e9e5cfa2da1841c0806f6cdabcc"
|
||||
"checksum quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "053a8c8bcc71fcce321828dc897a98ab9760bef03a4fc36693c231e5b3216cfe"
|
||||
"checksum regex 1.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "d9d8297cc20bbb6184f8b45ff61c8ee6a9ac56c156cec8e38c3e5084773c44ad"
|
||||
"checksum regex-syntax 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)" = "11a7e20d1cce64ef2fed88b66d347f88bd9babb82845b2b858f3edbf59a4f716"
|
||||
"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd"
|
||||
"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e"
|
||||
"checksum serde_yaml 0.8.9 (registry+https://github.com/rust-lang/crates.io-index)" = "38b08a9a90e5260fe01c6480ec7c811606df6d3a660415808c3c3fa8ed95b582"
|
||||
"checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf"
|
||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||
"checksum unicode-xid 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
|
||||
"checksum utf8-ranges 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b4ae116fef2b7fea257ed6440d3cfcff7f190865f170cdad00bb6465bf18ecba"
|
||||
"checksum winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8093091eeb260906a183e6ae1abdba2ef5ef2257a21801128899c3fc699229c6"
|
||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
"checksum xkbcommon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fda0ea5f7ddabd51deeeda7799bee06274112f577da7dd3d954b8eda731b2fce"
|
||||
"checksum yaml-rust 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "65923dd1784f44da1d2c3dbbc5e822045628c590ba72123e1c73d3c230c4434d"
|
||||
39
Cargo.toml
Normal file
39
Cargo.toml
Normal file
@@ -0,0 +1,39 @@
|
||||
[package]
|
||||
name = "rs"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
bitflags = "1.0.*"
|
||||
clap = "2.32.*"
|
||||
maplit = "1.0.*"
|
||||
regex = "1.1.*"
|
||||
serde = { version = "1.0.*", features = ["derive"] }
|
||||
serde_yaml = "0.8.*"
|
||||
xkbcommon = { version = "0.4.*", features = ["wayland"] }
|
||||
|
||||
[dependencies.gio]
|
||||
version = ""
|
||||
features = ["v2_44"]
|
||||
|
||||
[dependencies.glib]
|
||||
version = ""
|
||||
features = ["v2_44"]
|
||||
|
||||
[dependencies.glib-sys]
|
||||
version = ""
|
||||
features = ["v2_44"]
|
||||
|
||||
|
||||
[dependencies.gtk]
|
||||
version = "0.5.*"
|
||||
features = ["v3_22"]
|
||||
|
||||
[dependencies.gtk-sys]
|
||||
version = ""
|
||||
features = ["v3_22"]
|
||||
|
||||
|
||||
[lib]
|
||||
name = "rs"
|
||||
path = "src/lib.rs"
|
||||
crate-type = ["staticlib", "rlib"]
|
||||
128
HACKING.md
Normal file
128
HACKING.md
Normal file
@@ -0,0 +1,128 @@
|
||||
Hacking
|
||||
=======
|
||||
|
||||
This document describes the standards for modifying and maintaining the *squeekboard* project.
|
||||
|
||||
Development environment
|
||||
-----------------------
|
||||
|
||||
*Squeekboard* is regularly built and tested on [the develpment environment](https://developer.puri.sm/Librem5/Development_Environment.html).
|
||||
|
||||
Recent Fedora releases are likely to be tested as well.
|
||||
|
||||
### Dependencies
|
||||
|
||||
On a Debian based system run
|
||||
|
||||
```sh
|
||||
sudo apt-get -y install build-essential
|
||||
sudo apt-get -y build-dep .
|
||||
```
|
||||
|
||||
For an explicit list of dependencies check the `Build-Depends` entry in the
|
||||
[debian/control][] file.
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
Most common testing is done in CI. Occasionally, and for each release, do perform manual tests to make sure that
|
||||
|
||||
- the application draws correctly
|
||||
- it shows when relevant
|
||||
- it changes layouts
|
||||
- it changes views
|
||||
|
||||
Testing with an application:
|
||||
|
||||
```
|
||||
python3 tests/entry.py
|
||||
```
|
||||
|
||||
Testing visibility:
|
||||
|
||||
```
|
||||
$ busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b true
|
||||
$ busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 SetVisible b false
|
||||
```
|
||||
|
||||
Testing layouts:
|
||||
|
||||
Layouts can be selected using the GNOME Settings application.
|
||||
|
||||
```
|
||||
# define all available layouts. First one is currently selected.
|
||||
$ gsettings set org.gnome.desktop.input-sources sources "[('xkb', 'us'), ('xkb', 'de')]"
|
||||
```
|
||||
|
||||
Coding
|
||||
------
|
||||
|
||||
Code submitted should roughly match the style of surrounding code. Things that will *not* be accepted are ones that often lead to errors:
|
||||
|
||||
- skipping brackets `{}` after every `if()`, `else`, and similar
|
||||
|
||||
Bad example:
|
||||
|
||||
```
|
||||
if (foo)
|
||||
bar();
|
||||
```
|
||||
|
||||
Good example:
|
||||
|
||||
```
|
||||
if (foo) {
|
||||
bar();
|
||||
}
|
||||
```
|
||||
|
||||
- mixing tabs and spaces in the same block of code (or config)
|
||||
|
||||
Strongly encouraged:
|
||||
|
||||
- don't make lines too long. If it's longer than ~80 characters, it's probably unreadable already, and the code needs to be clarified;
|
||||
- put operators in the beginning of a continuation line
|
||||
|
||||
Bad example:
|
||||
|
||||
```
|
||||
foobar = verylongexpression +
|
||||
anotherverylongexpression +
|
||||
yetanotherexpression;
|
||||
```
|
||||
|
||||
Good example:
|
||||
|
||||
```
|
||||
foobar = verylongexpression
|
||||
+ anotherverylongexpression
|
||||
+ yetanotherexpression;
|
||||
```
|
||||
|
||||
- use `///` for documentation comments in front of definitions and `/*! ... */` for documentation comments in the beginning of modules (see [Rust doc-comments](https://doc.rust-lang.org/reference/comments.html#doc-comments))
|
||||
|
||||
If in doubt, check [PEP8](https://github.com/rust-dev-tools/fmt-rfcs/blob/master/guide/guide.md), the [kernel coding style](https://www.kernel.org/doc/html/v4.10/process/coding-style.html), or the [Rust style guide](https://github.com/rust-dev-tools/fmt-rfcs/blob/master/guide/guide.md).
|
||||
|
||||
Maintenance
|
||||
-----------
|
||||
|
||||
Squeekboard uses Rust & Cargo for some of its dependencies.
|
||||
|
||||
Use the `cargo.sh` script for maintaining the Cargo part of the build. The script takes the usual Cargo commands, after the first 2 positionsl arguments: source directory, and output artifact. So, `cargo test` becomes:
|
||||
|
||||
```
|
||||
cd build_dir
|
||||
sh /source_path/cargo.sh test
|
||||
```
|
||||
|
||||
### Cargo dependencies
|
||||
|
||||
Dependencies must be specified in `Cargo.toml` with 2 numbers: "major.minor". Since bugfix version number is meant to not affect the interface, this allows for safe updates.
|
||||
|
||||
`Cargo.lock` is used for remembering the revisions of all Rust dependencies. It should be updated often, preferably with each bugfix revision, and in a commit on its own:
|
||||
|
||||
```
|
||||
cd build_dir
|
||||
sh /source_path/cargo.sh update
|
||||
ninja test
|
||||
```
|
||||
20
Makefile.am
20
Makefile.am
@@ -1,20 +0,0 @@
|
||||
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
# Copyright (C) 2010 Red Hat, Inc.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
SUBDIRS = eek src tests docs po
|
||||
29
README
29
README
@@ -1,29 +0,0 @@
|
||||
eekboard - a virtual keyboard for GNOME -*- outline -*-
|
||||
|
||||
eekboard is a virtual keyboard software package which ships with a
|
||||
standalone virtual keyboard application ("eekboard"), and a library to
|
||||
create keyboard-like UI ("libeek").
|
||||
|
||||
* Requirements
|
||||
|
||||
* GLib2, GTK2, Cairo, Pango, Libxklavier...
|
||||
* Clutter (optional)
|
||||
* Clutter-Gtk (optional)
|
||||
|
||||
* How to test
|
||||
|
||||
If you build from git repo:
|
||||
|
||||
$ git clone git://github.com/ueno/eekboard.git
|
||||
$ cd eekboard
|
||||
$ ./autogen.sh --prefix=/usr --enable-gtk-doc
|
||||
|
||||
Otherwise start from here:
|
||||
|
||||
$ ./configure
|
||||
$ make
|
||||
$ sudo make install
|
||||
$ eekboard
|
||||
|
||||
*NOTE* some version combination of Clutter & Clutter-Gtk does not
|
||||
cooperate well. Try "EEKBOARD_DISABLE_CLUTTER=1 eekboard"
|
||||
59
README.md
Normal file
59
README.md
Normal file
@@ -0,0 +1,59 @@
|
||||
*squeekboard* - a Wayland virtual keyboard
|
||||
========================================
|
||||
|
||||
*Squeekboard* is a virtual keyboard supporting Wayland, built primarily for the *Librem 5* phone.
|
||||
|
||||
It squeaks because some Rust got inside.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
### Present
|
||||
|
||||
- GTK3
|
||||
- Custom yaml-defined keyboards
|
||||
- DBus interface to show and hide
|
||||
- Use Wayland input method protocol to show and hide
|
||||
- Use Wayland virtual keyboard protocol
|
||||
|
||||
### Temporarily dropped
|
||||
|
||||
- A settings interface
|
||||
|
||||
### TODO
|
||||
|
||||
- Use Wayland input method protocol
|
||||
- Pick up DBus interface files from /usr/share
|
||||
|
||||
Building
|
||||
--------
|
||||
|
||||
### Dependencies
|
||||
|
||||
See `.gitlab-ci.yml`.
|
||||
|
||||
### Build from git repo
|
||||
|
||||
```
|
||||
$ git clone https://source.puri.sm/Librem5/squeekboard.git
|
||||
$ cd squeekboard
|
||||
$ mkdir ../build
|
||||
$ meson ../build/
|
||||
$ cd ../build
|
||||
$ ninja test
|
||||
$ ninja install
|
||||
```
|
||||
|
||||
Running
|
||||
-------
|
||||
|
||||
```
|
||||
$ phoc # if no compatible Wayland compositor is running yet
|
||||
$ cd ../build/
|
||||
$ src/squeekboard
|
||||
```
|
||||
|
||||
Developing
|
||||
----------
|
||||
|
||||
See `HACKING.md`
|
||||
12
TODO
12
TODO
@@ -1,12 +0,0 @@
|
||||
- packaging
|
||||
-- GIR
|
||||
-- .spec
|
||||
-- debian
|
||||
-- add more tests
|
||||
|
||||
- eekboard
|
||||
-- a11y
|
||||
|
||||
- libeek
|
||||
-- matchbox-keyboard layout engine
|
||||
-- delay initialization of XKB and XKL layouts
|
||||
24
autogen.sh
24
autogen.sh
@@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Run this to generate all the initial makefiles, etc.
|
||||
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
PKG_NAME="eekboard"
|
||||
|
||||
(test -f $srcdir/configure.ac \
|
||||
&& test -f $srcdir/README ) || {
|
||||
echo -n "**Error**: Directory "\`$srcdir\'" does not look like the"
|
||||
echo " top-level $PKG_NAME directory"
|
||||
exit 1
|
||||
}
|
||||
|
||||
which gnome-autogen.sh || {
|
||||
echo "You need to install gnome-common from the GNOME CVS"
|
||||
exit 1
|
||||
}
|
||||
|
||||
ACLOCAL_FLAGS="$ACLOCAL_FLAGS -I m4"
|
||||
REQUIRED_AUTOMAKE_VERSION=1.8
|
||||
|
||||
. gnome-autogen.sh
|
||||
17
cargo.sh
Executable file
17
cargo.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script manages Cargo operations
|
||||
# while keeping the artifact directory within the build tree
|
||||
# instead of the source tree
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_PATH="$(realpath "$0")"
|
||||
SOURCE_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
|
||||
CARGO_TARGET_DIR="$(pwd)"
|
||||
export CARGO_TARGET_DIR
|
||||
|
||||
cd "$SOURCE_DIR"
|
||||
cargo "$@"
|
||||
|
||||
34
cargo_build.sh
Executable file
34
cargo_build.sh
Executable file
@@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script manages Cargo builds
|
||||
# while keeping the artifact directory within the build tree
|
||||
# instead of the source tree
|
||||
|
||||
set -e
|
||||
|
||||
SCRIPT_PATH="$(realpath "$0")"
|
||||
SOURCE_DIR="$(dirname "$SCRIPT_PATH")"
|
||||
|
||||
RELEASE=""
|
||||
BINARY_DIR="debug"
|
||||
if [ "${1}" = "--release" ]; then
|
||||
shift
|
||||
BINARY_DIR="release"
|
||||
RELEASE="--release"
|
||||
fi
|
||||
|
||||
if [ "${1}" = "--rename" ]; then
|
||||
shift
|
||||
FILENAME="${1}"
|
||||
shift
|
||||
fi
|
||||
OUT_PATH="$(realpath "${1}")"
|
||||
shift
|
||||
OUT_BASENAME="$(basename "${OUT_PATH}")"
|
||||
FILENAME="${FILENAME:-"${OUT_BASENAME}"}"
|
||||
|
||||
sh "$SOURCE_DIR"/cargo.sh build $RELEASE "$@"
|
||||
|
||||
if [ -n "${OUT_PATH}" ]; then
|
||||
cp -a ./"${BINARY_DIR}"/"${FILENAME}" "${OUT_PATH}"
|
||||
fi
|
||||
106
configure.ac
106
configure.ac
@@ -1,106 +0,0 @@
|
||||
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
# Copyright (C) 2010 Red Hat, Inc.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
AC_INIT([eekboard], [0.0.1], [ueno@unixuser.org])
|
||||
AC_CONFIG_SRCDIR([configure.ac])
|
||||
AC_PREREQ(2.63)
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_PROG_CC_C_O
|
||||
AC_CONFIG_MACRO_DIR([m4])
|
||||
LT_INIT
|
||||
IT_PROG_INTLTOOL([0.35.0])
|
||||
|
||||
PKG_CHECK_MODULES([GLIB2], [glib-2.0], ,
|
||||
[AC_MSG_ERROR([GLib2 not found])])
|
||||
PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0], ,
|
||||
[AC_MSG_ERROR([GObject2 not found])])
|
||||
PKG_CHECK_MODULES([CAIRO], [cairo], ,
|
||||
[AC_MSG_ERROR([Cairo not found])])
|
||||
PKG_CHECK_MODULES([PANGO], [pango], ,
|
||||
[AC_MSG_ERROR([Pango not found])])
|
||||
PKG_CHECK_MODULES([GTK2], [gtk+-2.0 gdk-2.0], ,
|
||||
[AC_MSG_ERROR([GTK2 not found])])
|
||||
PKG_CHECK_MODULES([XKB], [x11], ,
|
||||
[AC_MSG_ERROR([XKB support not found])])
|
||||
PKG_CHECK_MODULES([LIBXKLAVIER], [libxklavier x11], ,
|
||||
[AC_MSG_ERROR([Libxklavier not found])])
|
||||
PKG_CHECK_MODULES([LIBFAKEKEY], [libfakekey], ,
|
||||
[AC_MSG_ERROR([libfakekey not found])])
|
||||
|
||||
AC_MSG_CHECKING([whether you enable eekboard])
|
||||
AC_ARG_ENABLE(eekboard,
|
||||
AS_HELP_STRING([--enable-eekboard=no/yes],
|
||||
[Build standalone application "ekboard" default=yes]),,
|
||||
enable_eekboard=yes)
|
||||
AC_MSG_RESULT($enable_eekboard)
|
||||
AM_CONDITIONAL(ENABLE_EEKBOARD, [test x$enable_eekboard = xyes])
|
||||
|
||||
AC_MSG_CHECKING([whether you enable Clutter])
|
||||
AC_ARG_ENABLE(clutter,
|
||||
AS_HELP_STRING([--enable-clutter=no/yes],
|
||||
[Enable Clutter user interface default=yes]),,
|
||||
enable_clutter=yes)
|
||||
AC_MSG_RESULT($enable_clutter)
|
||||
|
||||
if test x$enable_clutter = xyes; then
|
||||
PKG_CHECK_MODULES([CLUTTER], [clutter-1.0], ,
|
||||
[AC_MSG_ERROR([Clutter not found -- install it or add --disable-clutter])])
|
||||
AC_DEFINE([HAVE_CLUTTER], [1], [Define if Clutter is found])
|
||||
PKG_CHECK_MODULES([CLUTTER_GTK], [clutter-gtk-0.90],
|
||||
[enable_clutter_gtk=yes])
|
||||
if test x$enable_clutter_gtk = xno; then
|
||||
PKG_CHECK_MODULES([CLUTTER_GTK], [clutter-gtk-0.10],
|
||||
[enable_clutter_gtk=yes])
|
||||
fi
|
||||
if test x$enable_clutter_gtk = xyes; then
|
||||
AC_DEFINE([HAVE_CLUTTER_GTK], [1], [Define if Clutter-Gtk is found])
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(HAVE_CLUTTER, [test x$enable_clutter = xyes])
|
||||
AM_CONDITIONAL(HAVE_CLUTTER_GTK, [test x$enable_clutter_gtk = xyes])
|
||||
|
||||
GTK_DOC_CHECK([1.14],[--flavour no-tmpl])
|
||||
|
||||
EEK_API_VERSION=0.1
|
||||
AC_SUBST(EEK_API_VERSION)
|
||||
|
||||
dnl to re-generate eek/*-keysym-labels.txt
|
||||
AC_CHECK_PROGS([PYTHON], [python])
|
||||
|
||||
dnl define GETTEXT_* variables
|
||||
GETTEXT_PACKAGE=$PACKAGE
|
||||
AC_SUBST(GETTEXT_PACKAGE)
|
||||
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Define to the read-only architecture-independent data directory.])
|
||||
AM_GLIB_GNU_GETTEXT
|
||||
AM_GLIB_DEFINE_LOCALEDIR(EEKBOARD_LOCALEDIR)
|
||||
|
||||
AC_CONFIG_HEADERS([eek/config.h])
|
||||
AC_CONFIG_FILES([Makefile
|
||||
eek/Makefile
|
||||
src/Makefile
|
||||
tests/Makefile
|
||||
docs/Makefile
|
||||
docs/reference/Makefile
|
||||
docs/reference/eek/Makefile
|
||||
po/Makefile.in
|
||||
eek/libeek.pc
|
||||
eek/libeek-clutter.pc
|
||||
eek/libeek-gtk.pc
|
||||
eek/libeek-xkb.pc
|
||||
eek/libeek-xkl.pc])
|
||||
AC_OUTPUT
|
||||
20
data/dbus/sm.puri.OSK0.xml
Normal file
20
data/dbus/sm.puri.OSK0.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
|
||||
"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
|
||||
<node xmlns:doc="http://www.freedesktop.org/dbus/1.0/doc.dtd">
|
||||
<interface name="sm.puri.OSK0">
|
||||
<method name="SetVisible">
|
||||
<arg name="visible" type="b" direction="in"/>
|
||||
<doc:doc><doc:description>
|
||||
Switch keyboard visibility
|
||||
</doc:description></doc:doc>
|
||||
</method>
|
||||
<method name="GetVisible">
|
||||
<arg name="visible" type="b" direction="out"/>
|
||||
<doc:doc><doc:description>
|
||||
Get keyboard visibility
|
||||
</doc:description></doc:doc>
|
||||
</method>
|
||||
<property name="Visible" type="b" access="read">
|
||||
</property>
|
||||
</interface>
|
||||
</node>
|
||||
10
data/icons/key-enter.svg
Normal file
10
data/icons/key-enter.svg
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"
|
||||
version="1.1" viewBox="0 0 24 24">
|
||||
|
||||
<path d="M 24,1 L 24,10 C 24,15 20,17 17,17 L 7,17 L 10,20 L 10,23
|
||||
L 7,23 L 0,15 L 7,7 L 10,7 L 10,10 L 7,13 L 17,13
|
||||
C 19,13 20,12 20,10 L 20,1 Z"
|
||||
stroke="none" fill="black" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 388 B |
8
data/icons/key-shift.svg
Normal file
8
data/icons/key-shift.svg
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" height="16" width="16"
|
||||
version="1.1" viewBox="0 0 24 24">
|
||||
|
||||
<path d="M 12,2 L 22,14 L 16,14 L 16,22 L 8,22 L 8,14 L 2,14 Z"
|
||||
stroke="none" fill="black" />
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 279 B |
52
data/icons/keyboard-mode-symbolic.svg
Normal file
52
data/icons/keyboard-mode-symbolic.svg
Normal file
@@ -0,0 +1,52 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
id="svg4043"
|
||||
version="1.1"
|
||||
viewBox="0 0 4.2333331 4.2333093"
|
||||
height="4.2333093mm"
|
||||
width="4.2333331mm">
|
||||
<defs
|
||||
id="defs4037" />
|
||||
<metadata
|
||||
id="metadata4040">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
transform="translate(-86.329776,-68.097636)"
|
||||
id="layer1">
|
||||
<g
|
||||
style="stroke-width:1.00004983;fill:#2e3436;fill-opacity:1"
|
||||
transform="matrix(0.99990029,0,0,1,-7.1823833,-1.8799927)"
|
||||
id="g842">
|
||||
<g
|
||||
style="stroke-width:1.00004983;fill:#2e3436;fill-opacity:1"
|
||||
id="g836">
|
||||
<path
|
||||
id="path5166"
|
||||
d="m 95.636719,69.978516 c -1.165869,0 -2.115235,0.949365 -2.115235,2.115234 0,1.165869 0.949366,2.117188 2.115235,2.117188 1.165869,0 2.117187,-0.951319 2.117187,-2.117188 0,-1.165869 -0.951318,-2.115234 -2.117187,-2.115234 z m 0,0.529296 c 0.879886,0 1.58789,0.706052 1.58789,1.585938 0,0.879886 -0.708004,1.587891 -1.58789,1.587891 -0.879886,0 -1.585938,-0.708005 -1.585938,-1.587891 0,-0.879886 0.706052,-1.585937 1.585938,-1.585938 z"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.52919304;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
</g>
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26459652;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 95.636719,70.109375 c -0.144398,0 -0.27248,0.07793 -0.373047,0.189453 -0.100567,0.111521 -0.18209,0.261405 -0.25,0.439453 -0.135821,0.356096 -0.214844,0.830395 -0.214844,1.355469 0,0.525074 0.07902,1.001326 0.214844,1.357422 0.06791,0.178048 0.149433,0.327932 0.25,0.439453 0.100567,0.111521 0.228649,0.1875 0.373047,0.1875 0.144397,0 0.27248,-0.07598 0.373047,-0.1875 0.100566,-0.111521 0.182089,-0.261405 0.25,-0.439453 0.135821,-0.356096 0.216797,-0.832348 0.216796,-1.357422 0,-0.525074 -0.08097,-0.999373 -0.216796,-1.355469 -0.06791,-0.178048 -0.149434,-0.327932 -0.25,-0.439453 -0.100567,-0.111521 -0.22865,-0.189453 -0.373047,-0.189453 z m 0,0.265625 c 0.05067,0 0.109272,0.02564 0.177734,0.101562 0.06846,0.07592 0.139293,0.198356 0.199219,0.355469 0.119851,0.314227 0.197266,0.763915 0.197266,1.261719 0,0.497804 -0.07742,0.949446 -0.197266,1.263672 -0.05993,0.157113 -0.130756,0.279549 -0.199219,0.355469 -0.06846,0.07592 -0.12706,0.101562 -0.177734,0.101562 -0.05067,0 -0.107319,-0.02564 -0.175781,-0.101562 -0.06846,-0.07592 -0.139294,-0.198356 -0.199219,-0.355469 C 95.141867,73.043196 95.0625,72.591554 95.0625,72.09375 c 0,-0.497804 0.07937,-0.947492 0.199219,-1.261719 0.05993,-0.157113 0.130756,-0.279549 0.199219,-0.355469 C 95.5294,70.400643 95.586045,70.375 95.636719,70.375 Z"
|
||||
id="circle5168" />
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#2e3436;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.26459652;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 93.697266,71.962891 v 0.263671 h 3.96875 v -0.263671 z"
|
||||
id="path5170" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6.6 KiB |
89
data/keyboards/de.yaml
Normal file
89
data/keyboards/de.yaml
Normal file
@@ -0,0 +1,89 @@
|
||||
# Maintained by: Mark Müller <markmueller86@gmail.com>
|
||||
---
|
||||
bounds: { x: 0, y: 1, width: 360, height: 208 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 35.33, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 52.67, height: 52 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 99.67, height: 52 }
|
||||
special:
|
||||
bounds: { x: 0, y: 0, width: 35.33, height: 52 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "q w e r t z u i o p"
|
||||
- "a s d f g h j k l"
|
||||
- "Shift_L y x c v b n m BackSpace"
|
||||
- "show_numbers show_eschars preferences space , . Return"
|
||||
upper:
|
||||
- "Q W E R T Z U I O P"
|
||||
- "A S D F G H J K L"
|
||||
- "Shift_L Y X C V B N M BackSpace"
|
||||
- "show_numbers show_eschars preferences space ! ? Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "@ # € % & - _ + ( )"
|
||||
- "show_symbols , \" ' : = < > BackSpace"
|
||||
- "show_letters show_eschars preferences space , . Return"
|
||||
symbols:
|
||||
- "~ ` ´ | · √ µ ÷ × ¶"
|
||||
- "© ® £ $ ¥ ^ ° * { }"
|
||||
- "show_numbers \\ / § π τ [ ] BackSpace"
|
||||
- "show_letters show_eschars preferences space , . Return"
|
||||
eschars:
|
||||
- "ä è é ö ü Ä È É Ö Ü"
|
||||
- "à â ê î ô À Â È Î Ô"
|
||||
- "show_numbers « » ç Ç æ œ ß BackSpace"
|
||||
- "show_letters show_eschars preferences space „ “ Return"
|
||||
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "special"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: "abc"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
show_eschars:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "eschars"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "äÄ"
|
||||
space:
|
||||
outline: "spaceline"
|
||||
label: " "
|
||||
text: " "
|
||||
Return:
|
||||
outline: "altline"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
88
data/keyboards/de_wide.yaml
Normal file
88
data/keyboards/de_wide.yaml
Normal file
@@ -0,0 +1,88 @@
|
||||
# Maintained by: Mark Müller <markmueller86@gmail.com>
|
||||
---
|
||||
bounds: { x: 0, y: 1, width: 540, height: 168 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 48, height: 42 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 81, height: 42 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 108, height: 42 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 216, height: 42 }
|
||||
special:
|
||||
bounds: { x: 0, y: 0, width: 48, height: 42 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "q w e r t z u i o p ü"
|
||||
- "a s d f g h j k l ö ä"
|
||||
- "Shift_L y x c v b n m BackSpace"
|
||||
- "show_numbers preferences space , . Return"
|
||||
upper:
|
||||
- "Q W E R T Z U I O P Ü"
|
||||
- "A S D F G H J K L Ö Ä"
|
||||
- "Shift_L Y X C V B N M BackSpace"
|
||||
- "show_numbers preferences space ! ? Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "@ # % & - _ + ( ) ß"
|
||||
- "show_symbols , \" ' : = < > BackSpace"
|
||||
- "show_letters preferences space , . Return"
|
||||
symbols:
|
||||
- "~ ` ´ · © ® ÷ × ¶"
|
||||
- "€ £ $ ¥ ^ ° * { } |"
|
||||
- "show_numbers \\ / § π τ [ ] BackSpace"
|
||||
- "show_letters preferences space , . Return"
|
||||
eschars:
|
||||
- "ä è é ö ü Ä È É Ö Ü"
|
||||
- "à â ê î ô À Â È Î Ô"
|
||||
- "show_numbers « » ç Ç æ œ ß BackSpace"
|
||||
- "show_letters preferences space „ “ Return"
|
||||
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "special"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: "abc"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
show_eschars:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "eschars"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "äÄ"
|
||||
space:
|
||||
outline: "spaceline"
|
||||
text: " "
|
||||
Return:
|
||||
outline: "altline"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
198
data/keyboards/el.yaml
Normal file
198
data/keyboards/el.yaml
Normal file
@@ -0,0 +1,198 @@
|
||||
# Greek layout created by Antonis Tsolomitis
|
||||
# University of the Aegean, Department of Mathematics, atsol@aegean.gr
|
||||
# Sep 2019
|
||||
---
|
||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 32, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
outline7:
|
||||
bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 150.5853, height: 52 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "; ς ε ρ τ υ θ ι ο π !"
|
||||
- "α σ δ φ γ η ξ κ λ show_accented"
|
||||
- "Shift_L ζ χ ψ ω β ν μ , BackSpace"
|
||||
- "show_numbers preferences space period Return"
|
||||
upper:
|
||||
- ": EuroSign Ε Ρ Τ Υ Θ Ι Ο Π"
|
||||
- "Α Σ Δ Φ Γ Η Ξ Κ Λ show_accented"
|
||||
- "Shift_L Ζ Χ Ψ Ω Β Ν Μ · BackSpace"
|
||||
- "show_numbers preferences space « » Return"
|
||||
accented:
|
||||
- "ά έ ή ί ό ύ ώ ϊ ϋ ΐ"
|
||||
- "ΰ Ά Έ Ή Ί Ό Ύ Ώ Ϊ show_base"
|
||||
- "Ϋ Ϗ ϐ ϑ ϕ ϖ ϗ – — BackSpace"
|
||||
- "show_numbers preferences space quoteleft quoteright Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "at numbersign dollar percent ampersand minus underscore plus parenleft parenright"
|
||||
- "show_symbols comma quotedbl quoteright colon semicolon exclam question BackSpace"
|
||||
- "show_letters preferences space period Return"
|
||||
symbols:
|
||||
- "asciitilde quoteleft bar U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
|
||||
- "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree asterisk braceleft braceright"
|
||||
- "show_numbers backslash slash less greater equal bracketleft bracketright BackSpace"
|
||||
- "show_letters preferences space period Return"
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "altline"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: "ΑΒΓ"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
show_accented:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "accented"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "άΐ"
|
||||
show_base:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: "αι"
|
||||
period:
|
||||
outline: "altline"
|
||||
text: "."
|
||||
space:
|
||||
outline: spaceline
|
||||
text: " "
|
||||
Return:
|
||||
outline: "wide"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
aring:
|
||||
text: "å"
|
||||
Aring:
|
||||
text: "Å"
|
||||
oslash:
|
||||
text: "ø"
|
||||
Oslash:
|
||||
text: "Ø"
|
||||
ae:
|
||||
text: "æ"
|
||||
AE:
|
||||
text: "Æ"
|
||||
asterisk:
|
||||
text: "*"
|
||||
asciitilde:
|
||||
text: "~"
|
||||
quoteleft:
|
||||
text: "`"
|
||||
bar:
|
||||
text: "|"
|
||||
U00B7:
|
||||
text: "·"
|
||||
squareroot:
|
||||
text: "√"
|
||||
Greek_pi:
|
||||
text: "π"
|
||||
division:
|
||||
text: "÷"
|
||||
multiply:
|
||||
text: "×"
|
||||
paragraph:
|
||||
text: "¶"
|
||||
Greek_tau:
|
||||
text: "τ"
|
||||
copyright:
|
||||
text: "©"
|
||||
numbersign:
|
||||
text: "#"
|
||||
U00AE:
|
||||
text: "®"
|
||||
at:
|
||||
text: "@"
|
||||
dollar:
|
||||
text: "$"
|
||||
U00A3:
|
||||
text: "£"
|
||||
percent:
|
||||
text: "%"
|
||||
EuroSign:
|
||||
text: "€"
|
||||
ampersand:
|
||||
text: "&"
|
||||
U00A5:
|
||||
text: "¥"
|
||||
minus:
|
||||
text: "-"
|
||||
asciicircum:
|
||||
text: "^"
|
||||
underscore:
|
||||
text: "_"
|
||||
degree:
|
||||
text: "°"
|
||||
plus:
|
||||
text: "+"
|
||||
equal:
|
||||
text: "="
|
||||
parenleft:
|
||||
text: "("
|
||||
parenright:
|
||||
text: ")"
|
||||
braceleft:
|
||||
text: "{"
|
||||
braceright:
|
||||
text: "}"
|
||||
comma:
|
||||
text: ","
|
||||
backslash:
|
||||
text: "\\"
|
||||
slash:
|
||||
text: "/"
|
||||
quotedbl:
|
||||
text: "\""
|
||||
quoteright:
|
||||
text: "'"
|
||||
less:
|
||||
text: "<"
|
||||
greater:
|
||||
text: ">"
|
||||
colon:
|
||||
text: ":"
|
||||
semicolon:
|
||||
text: ";"
|
||||
exclam:
|
||||
text: "!"
|
||||
question:
|
||||
text: "?"
|
||||
bracketleft:
|
||||
text: "["
|
||||
bracketright:
|
||||
text: "]"
|
||||
|
||||
94
data/keyboards/es.yaml
Normal file
94
data/keyboards/es.yaml
Normal file
@@ -0,0 +1,94 @@
|
||||
---
|
||||
bounds: { x: 0, y: 1, width: 360, height: 210 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 35.33, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 52.67, height: 52 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 99.67, height: 52 }
|
||||
special:
|
||||
bounds: { x: 0, y: 0, width: 44, height: 52 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "q w e r t y u i o p"
|
||||
- "a s d f g h j k l ñ"
|
||||
- "Shift_L z x c v b n m BackSpace"
|
||||
- "show_numbers show_eschars preferences space ? period Return"
|
||||
upper:
|
||||
- "Q W E R T Y U I O P"
|
||||
- "A S D F G H J K L Ñ"
|
||||
- "Shift_L Z X C V B N M BackSpace"
|
||||
- "show_numbers show_eschars preferences space ¿ period Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "@ # € % & - _ + ( )"
|
||||
- "show_symbols , \" ' colon ; ! = BackSpace"
|
||||
- "show_letters show_eschars preferences space ? period Return"
|
||||
symbols:
|
||||
- "~ ` | · √ π τ ÷ × ¶"
|
||||
- "© ® £ $ ¥ ^ ° * { }"
|
||||
- "show_numbers \\ / < > = [ ] BackSpace"
|
||||
- "show_letters show_eschars preferences space ? period Return"
|
||||
eschars:
|
||||
- "á é í ó ú Á É Í Ó Ú"
|
||||
- "à è ì ò ù À È Ì Ò Ù"
|
||||
- "show_numbers ü ç ï Ü Ç Ï ¡ BackSpace"
|
||||
- "show_letters show_eschars preferences space « » Return"
|
||||
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "default"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: "abc"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
show_eschars:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "eschars"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "áÁ"
|
||||
|
||||
period:
|
||||
outline: "default"
|
||||
text: "."
|
||||
space:
|
||||
outline: "spaceline"
|
||||
text: " "
|
||||
Return:
|
||||
outline: "altline"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
colon:
|
||||
text: ":"
|
||||
|
||||
178
data/keyboards/fi.yaml
Normal file
178
data/keyboards/fi.yaml
Normal file
@@ -0,0 +1,178 @@
|
||||
---
|
||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 32, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
outline7:
|
||||
bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 150.5853, height: 52 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "q w e r t y u i o p å"
|
||||
- "a s d f g h j k l ö ä"
|
||||
- "Shift_L z x c v b n m BackSpace"
|
||||
- "show_numbers preferences space . Return"
|
||||
upper:
|
||||
- "Q W E R T Y U I O P Å"
|
||||
- "A S D F G H J K L Ö Ä"
|
||||
- "Shift_L Z X C V B N M BackSpace"
|
||||
- "show_numbers preferences space . Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "at numbersign dollar percent ampersand minus underscore plus parenleft parenright"
|
||||
- "show_symbols comma quotedbl quoteright colon semicolon exclam question BackSpace"
|
||||
- "show_letters preferences space . Return"
|
||||
symbols:
|
||||
- "asciitilde quoteleft bar U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
|
||||
- "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree asterisk braceleft braceright"
|
||||
- "show_numbers backslash slash less greater equal bracketleft bracketright BackSpace"
|
||||
- "show_letters preferences space . Return"
|
||||
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "altline"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: "ABC"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
".":
|
||||
outline: altline
|
||||
space:
|
||||
outline: spaceline
|
||||
text: " "
|
||||
Return:
|
||||
outline: "wide"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
aring:
|
||||
text: "å"
|
||||
Aring:
|
||||
text: "Å"
|
||||
ouml:
|
||||
text: "ö"
|
||||
Ouml:
|
||||
text: "Ö"
|
||||
auml:
|
||||
text: "ä"
|
||||
Auml:
|
||||
text: "Ä"
|
||||
asterisk:
|
||||
text: "*"
|
||||
asciitilde:
|
||||
text: "~"
|
||||
quoteleft:
|
||||
text: "`"
|
||||
bar:
|
||||
text: "|"
|
||||
U00B7:
|
||||
text: "·"
|
||||
squareroot:
|
||||
text: "√"
|
||||
Greek_pi:
|
||||
text: "π"
|
||||
division:
|
||||
text: "÷"
|
||||
multiply:
|
||||
text: "×"
|
||||
paragraph:
|
||||
text: "¶"
|
||||
Greek_tau:
|
||||
text: "τ"
|
||||
copyright:
|
||||
text: "©"
|
||||
numbersign:
|
||||
text: "#"
|
||||
U00AE:
|
||||
text: "®"
|
||||
at:
|
||||
text: "@"
|
||||
dollar:
|
||||
text: "$"
|
||||
U00A3:
|
||||
text: "£"
|
||||
percent:
|
||||
text: "%"
|
||||
EuroSign:
|
||||
text: "€"
|
||||
ampersand:
|
||||
text: "&"
|
||||
U00A5:
|
||||
text: "¥"
|
||||
minus:
|
||||
text: "-"
|
||||
asciicircum:
|
||||
text: "^"
|
||||
underscore:
|
||||
text: "_"
|
||||
degree:
|
||||
text: "°"
|
||||
plus:
|
||||
text: "+"
|
||||
equal:
|
||||
text: "="
|
||||
parenleft:
|
||||
text: "("
|
||||
parenright:
|
||||
text: ")"
|
||||
braceleft:
|
||||
text: "{"
|
||||
braceright:
|
||||
text: "}"
|
||||
comma:
|
||||
text: ","
|
||||
backslash:
|
||||
text: "\\"
|
||||
slash:
|
||||
text: "/"
|
||||
quotedbl:
|
||||
text: "\""
|
||||
quoteright:
|
||||
text: "'"
|
||||
less:
|
||||
text: "<"
|
||||
greater:
|
||||
text: ">"
|
||||
colon:
|
||||
text: ":"
|
||||
semicolon:
|
||||
text: ";"
|
||||
exclam:
|
||||
text: "!"
|
||||
question:
|
||||
text: "?"
|
||||
bracketleft:
|
||||
text: "["
|
||||
bracketright:
|
||||
text: "]"
|
||||
|
||||
99
data/keyboards/it.yaml
Normal file
99
data/keyboards/it.yaml
Normal file
@@ -0,0 +1,99 @@
|
||||
# Italian layout created by Antonio Pandolfo
|
||||
# 03 october 2019
|
||||
---
|
||||
bounds: { x: 0, y: 1, width: 360, height: 210 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 35.33, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 52.67, height: 52 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 99.67, height: 52 }
|
||||
special:
|
||||
bounds: { x: 0, y: 0, width: 44, height: 52 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "q w e r t y u i o p"
|
||||
- "a s d f g h j k l"
|
||||
- "Shift_L z x c v b n m BackSpace"
|
||||
- "show_numbers show_eschars preferences space , period Return"
|
||||
upper:
|
||||
- "Q W E R T Y U I O P"
|
||||
- "A S D F G H J K L"
|
||||
- "Shift_L Z X C V B N M BackSpace"
|
||||
- "show_numbers show_eschars preferences space ? period Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "@ # € % & - _ + ( )"
|
||||
- "show_symbols , \" ' colon ; ! ? BackSpace"
|
||||
- "show_letters show_eschars preferences space ? period Return"
|
||||
symbols:
|
||||
- "~ ` | · √ π τ ÷ × ¶"
|
||||
- "© ® £ $ ¥ ^ ° * { }"
|
||||
- "show_numbers \\ / < > = [ ] BackSpace"
|
||||
- "show_letters show_eschars preferences space ? period Return"
|
||||
eschars:
|
||||
- "á é í ó ú Á É Í Ó Ú"
|
||||
- "à è ì ò « » ù ! { }"
|
||||
- "show_numbers \\ / < > = [ ] BackSpace"
|
||||
- "show_letters show_eschars preferences space « » Return"
|
||||
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "default"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_numbers_from_symbols:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: "abc"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
show_eschars:
|
||||
action:
|
||||
set_view: "eschars"
|
||||
outline: "altline"
|
||||
label: "àè"
|
||||
period:
|
||||
outline: "default"
|
||||
label: "."
|
||||
space:
|
||||
outline: "spaceline"
|
||||
label: " "
|
||||
Return:
|
||||
outline: "altline"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
colon:
|
||||
label: ":"
|
||||
"\"":
|
||||
keysym: "quotedbl"
|
||||
532
data/keyboards/jp+kana.yaml
Normal file
532
data/keyboards/jp+kana.yaml
Normal file
@@ -0,0 +1,532 @@
|
||||
# Maintained by: Mark Müller <markmueller86@gmail.com>
|
||||
---
|
||||
bounds: { x: 0, y: 1, width: 360, height: 208 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
default-wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
special:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
|
||||
views:
|
||||
base: # hiragana
|
||||
- "preferences _a ka sa BackSpace"
|
||||
- "Left ta na ha Right"
|
||||
- "カタカナ ma ya ra space"
|
||||
- "switch2roman symbols wa punct Return"
|
||||
_a:
|
||||
- "preferences dummykey _a dummykey BackSpace"
|
||||
- "あ い う え お"
|
||||
- "ぁ ぃ ぅ ぇ ぉ" # 2 code points each
|
||||
- "dummykey dummykey ゔ dummykey dummykey"
|
||||
ka:
|
||||
- "preferences dummykey ka dummykey BackSpace"
|
||||
- "か き く け こ"
|
||||
- "が ぎ ぐ げ ご"
|
||||
- "ゕ dummykey dummykey ゖ dummykey"
|
||||
sa:
|
||||
- "preferences dummykey sa dummykey BackSpace"
|
||||
- "さ し す せ そ"
|
||||
- "ざ じ ず ぜ ぞ"
|
||||
ta:
|
||||
- "preferences dummykey ta dummykey BackSpace"
|
||||
- "た ち つ て と"
|
||||
- "だ ぢ づ で ど"
|
||||
- "dummykey dummykey っ dummykey dummykey"
|
||||
na:
|
||||
- "preferences dummykey na dummykey BackSpace"
|
||||
- "な に ぬ ね の"
|
||||
ha:
|
||||
- "preferences dummykey ha dummykey BackSpace"
|
||||
- "は ひ ふ へ ほ"
|
||||
- "ば び ぶ べ ぼ"
|
||||
- "ぱ ぴ ぷ ぺ ぽ"
|
||||
ma:
|
||||
- "preferences dummykey ma dummykey BackSpace"
|
||||
- "ま み む め も"
|
||||
ya:
|
||||
- "preferences dummykey ya dummykey BackSpace"
|
||||
- "や dummykey ゆ dummykey よ"
|
||||
- "ゃ dummykey ゅ dummykey ょ"
|
||||
ra:
|
||||
- "preferences dummykey ra dummykey BackSpace"
|
||||
- "ら り る れ ろ"
|
||||
wa:
|
||||
- "preferences dummykey wa dummykey BackSpace"
|
||||
- "わ ゐ dummykey ゑ を"
|
||||
- "ゎ dummykey ん dummykey dummykey"
|
||||
symbols:
|
||||
- "preferences dummykey symbols dummykey BackSpace"
|
||||
- "「 」 ( ) §"
|
||||
- "【 】 < > ="
|
||||
- "+ * & % $ "
|
||||
punct:
|
||||
- "preferences dummykey punct dummykey BackSpace"
|
||||
- "。 、 ? ! ー"
|
||||
|
||||
- ": ; ・ 〜 …"
|
||||
- "♪ ” ’ ゙ ゚"
|
||||
|
||||
#a あア かカ さサ たタ なナ はハ まマ やヤ らラ わワ
|
||||
#i いイ きキ しシ ちチ にニ ひヒ みミ ※ りリ ゐヰ
|
||||
#u うウ くク すス つツ ぬヌ ふフ むム ゆユ るル ※
|
||||
#e えエ けケ せセ てテ ねネ へヘ めメ ※ れレ ゑヱ
|
||||
#o おオ こコ そソ とト のノ ほホ もモ よヨ ろロ をヲ
|
||||
|
||||
# g z d b p n
|
||||
#a が ガ ざ ザ だ ダ ば バ ぱ パ ん ン
|
||||
#i ぎ ギ じ ジ ぢ ヂ び ビ ぴ ピ
|
||||
#u ぐ グ ず ズ づ ヅ ぶ ブ ぷ プ
|
||||
#e げ ゲ ぜ ゼ で デ べ ベ ぺ ペ
|
||||
#o ご ゴ ぞ ゾ ど ド ぼ ボ ぽ ポ
|
||||
|
||||
カタカナ: # katakana
|
||||
- "preferences _A KA SA BackSpace"
|
||||
- "Left TA NA HA Right"
|
||||
- "ひらがな MA YA RA space"
|
||||
- "switch2roman SYMBOLS WA PUNCT Return"
|
||||
_A:
|
||||
- "preferences DUMMYKEY _A DUMMYKEY BackSpace"
|
||||
- "ア イ ウ エ オ"
|
||||
- "ァ ィ ゥ ェ ォ"
|
||||
- "DUMMYKEY DUMMYKEY ヴ DUMMYKEY DUMMYKEY"
|
||||
KA:
|
||||
- "preferences DUMMYKEY KA DUMMYKEY BackSpace"
|
||||
- "カ キ ク ケ コ"
|
||||
- "ガ ギ グ ゲ ゴ"
|
||||
- "ヵ DUMMYKEY ㇰ ヶ DUMMYKEY"
|
||||
SA:
|
||||
- "preferences DUMMYKEY SA DUMMYKEY BackSpace"
|
||||
- "サ シ ス セ ソ"
|
||||
- "ザ ジ ズ ゼ ゾ"
|
||||
- "DUMMYKEY ㇱ ㇲ DUMMYKEY DUMMYKEY"
|
||||
TA:
|
||||
- "preferences DUMMYKEY TA DUMMYKEY BackSpace"
|
||||
- "タ チ ツ テ ト"
|
||||
- "ダ ヂ ヅ デ ド"
|
||||
- "DUMMYKEY DUMMYKEY ッ DUMMYKEY ㇳ"
|
||||
NA:
|
||||
- "preferences DUMMYKEY NA DUMMYKEY BackSpace"
|
||||
- "ナ ニ ヌ ネ ノ"
|
||||
- "DUMMYKEY DUMMYKEY ㇴ DUMMYKEY DUMMYKEY"
|
||||
HA:
|
||||
- "preferences DUMMYKEY HA DUMMYKEY BackSpace"
|
||||
- "ハ ヒ フ ヘ ホ"
|
||||
- "バ ビ ブ ベ ボ"
|
||||
- "パ ピ プ ペ ポ"
|
||||
MA:
|
||||
- "preferences DUMMYKEY MA DUMMYKEY BackSpace"
|
||||
- "マ ミ ム メ モ"
|
||||
- "DUMMYKEY DUMMYKEY ㇺ DUMMYKEY DUMMYKEY"
|
||||
YA:
|
||||
- "preferences DUMMYKEY YA DUMMYKEY BackSpace"
|
||||
- "ヤ DUMMYKEY ユ DUMMYKEY ヨ"
|
||||
- "ャ DUMMYKEY ュ DUMMYKEY ョ"
|
||||
RA:
|
||||
- "preferences DUMMYKEY RA DUMMYKEY BackSpace"
|
||||
- "ラ リ ル レ ロ"
|
||||
- "ㇻ ㇼ ㇽ ㇾ ㇿ"
|
||||
WA:
|
||||
- "preferences DUMMYKEY WA DUMMYKEY BackSpace"
|
||||
- "ワ ヰ DUMMYKEY ヱ ヲ"
|
||||
- "ヮ ヸ ン ヹ ヺ"
|
||||
# numbers view
|
||||
numbers:
|
||||
- "preferences 1 2 3 BackSpace"
|
||||
- "Left 4 5 6 Right"
|
||||
- "roman 7 8 9 space"
|
||||
- "switch2kana * 0 # Return"
|
||||
# Roman alphabet view
|
||||
roman:
|
||||
- "preferences RSYM1 ABC DEF BackSpace"
|
||||
- "Left GHI JKL MNO Right"
|
||||
- "ひらがな PQRS TUV WXYZ space"
|
||||
- "switch2num RSYM2 RSYM3 RSYM4 Return"
|
||||
RSYM1:
|
||||
- "preferences dummykey RSYM1 dummykey BackSpace"
|
||||
- "@ # $ § :"
|
||||
- "| € ¥ £ 1"
|
||||
ABC:
|
||||
- "preferences dummykey ABC dummykey BackSpace"
|
||||
- "A B C Ä ç"
|
||||
- "a b c ä 2"
|
||||
DEF:
|
||||
- "preferences dummykey DEF dummykey BackSpace"
|
||||
- "D E F dummykey"
|
||||
- "d e f 3"
|
||||
GHI:
|
||||
- "preferences dummykey GHI dummykey BackSpace"
|
||||
- "G H I dummykey"
|
||||
- "g h i 4"
|
||||
JKL:
|
||||
- "preferences dummykey JKL dummykey BackSpace"
|
||||
- "J K L dummykey"
|
||||
- "j k l 5"
|
||||
MNO:
|
||||
- "preferences dummykey MNO dummykey BackSpace"
|
||||
- "M N O Ö dummykey"
|
||||
- "m n o ö 6"
|
||||
PQRS:
|
||||
- "preferences dummykey PQRS dummykey BackSpace"
|
||||
- "P Q R S ß"
|
||||
- "p q r s 7"
|
||||
TUV:
|
||||
- "preferences dummykey TUV dummykey BackSpace"
|
||||
- "T U V Ü dummykey"
|
||||
- "t u v ü 8"
|
||||
WXYZ:
|
||||
- "preferences dummykey WXYZ dummykey BackSpace"
|
||||
- "W X Y Z dummykey"
|
||||
- "w x y z 9"
|
||||
RSYM2:
|
||||
- "preferences dummykey RSYM2 dummykey BackSpace"
|
||||
- "( ) ' \" ~"
|
||||
- "[ ] { } _"
|
||||
RSYM3:
|
||||
- "preferences dummykey RSYM3 dummykey BackSpace"
|
||||
- "+ - * / ="
|
||||
- "< > ^ ° 0"
|
||||
RSYM4:
|
||||
- "preferences dummykey RSYM4 dummykey BackSpace"
|
||||
- ", . ? ! ;"
|
||||
- "\\ ´ ` · ¶"
|
||||
|
||||
buttons:
|
||||
# following 4 buttons use the corresponding xkb name as keysym
|
||||
BackSpace:
|
||||
outline: "wide"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
Return:
|
||||
outline: "wide"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
Left:
|
||||
outline: "wide"
|
||||
label: "←"
|
||||
keysym: "Left"
|
||||
Right:
|
||||
outline: "wide"
|
||||
label: "→"
|
||||
keysym: "Right"
|
||||
# special button "preferences" is handled in the code
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "special"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
# space button using text tag for ideographic space
|
||||
space:
|
||||
outline: "default-wide"
|
||||
label: "␣"
|
||||
text: " "
|
||||
# switch to number view
|
||||
numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "wide"
|
||||
label: "123"
|
||||
# switch to latin characters
|
||||
roman:
|
||||
action:
|
||||
set_view: "roman"
|
||||
outline: "wide"
|
||||
label: "ᴀʙᴄ"
|
||||
# toggle button with 3 different states
|
||||
switch2roman: # switch from kana to latin characters view
|
||||
action:
|
||||
set_view: "roman"
|
||||
outline: "wide"
|
||||
label: "あᴀ₁"
|
||||
switch2num: # switch from latin characters to numbers view
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "wide"
|
||||
label: "ぁA₁"
|
||||
switch2kana: # switch from numbers to hiragana view
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "wide"
|
||||
label: "ぁᴀ1"
|
||||
# Buttons for katakana and symbols
|
||||
ひらがな:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "wide"
|
||||
label: "あさ"
|
||||
_a:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "_a"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "あ"
|
||||
ka:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "ka"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "か"
|
||||
sa:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "sa"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "さ"
|
||||
ta:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "ta"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "た"
|
||||
na:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "na"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "な"
|
||||
ha:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "ha"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "は"
|
||||
ma:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "ma"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "ま"
|
||||
ya:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "ya"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "や"
|
||||
ra:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "ra"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "ら"
|
||||
wa:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "wa"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "わ"
|
||||
dummykey:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: ""
|
||||
# buttons available on different views like symbols and punct should go
|
||||
# back to their corresponding view
|
||||
symbols:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "symbols"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "()"
|
||||
punct:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "punct"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
label: "。"
|
||||
# Buttons for katakana and symbols
|
||||
カタカナ:
|
||||
action:
|
||||
set_view: "カタカナ"
|
||||
outline: "wide"
|
||||
label: "アサ"
|
||||
_A:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "_A"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "ア"
|
||||
KA:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "KA"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "カ"
|
||||
SA:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "SA"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "サ"
|
||||
TA:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "TA"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "タ"
|
||||
NA:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "NA"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "ナ"
|
||||
HA:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "HA"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "ハ"
|
||||
MA:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "MA"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "マ"
|
||||
YA:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "YA"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "ヤ"
|
||||
RA:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "RA"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "ラ"
|
||||
WA:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "WA"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "ワ"
|
||||
DUMMYKEY:
|
||||
action:
|
||||
set_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: ""
|
||||
SYMBOLS:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "symbols"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "()"
|
||||
PUNCT:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "punct"
|
||||
unlock_view: "カタカナ"
|
||||
outline: "altline"
|
||||
label: "。"
|
||||
# Buttons for Latin charachters
|
||||
RSYM1:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "RSYM1"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "@#"
|
||||
ABC:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "ABC"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "ᴀʙᴄ"
|
||||
DEF:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "DEF"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "ᴅᴇꜰ"
|
||||
GHI:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "GHI"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "ɢʜɪ"
|
||||
JKL:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "JKL"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "ᴊᴋʟ"
|
||||
MNO:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "MNO"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "ᴍɴᴏ"
|
||||
PQRS:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "PQRS"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "ᴘǫʀs"
|
||||
TUV:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "TUV"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "ᴛᴜᴠ"
|
||||
WXYZ:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "WXYZ"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "ᴡxʏᴢ"
|
||||
RSYM2:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "RSYM2"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "()"
|
||||
RSYM3:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "RSYM3"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: "+-"
|
||||
RSYM4:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "RSYM4"
|
||||
unlock_view: "roman"
|
||||
outline: "altline"
|
||||
label: ",.?"
|
||||
106
data/keyboards/no.yaml
Normal file
106
data/keyboards/no.yaml
Normal file
@@ -0,0 +1,106 @@
|
||||
---
|
||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 32, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
outline7:
|
||||
bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 150.5853, height: 52 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "q w e r t y u i o p å"
|
||||
- "a s d f g h j k l ø æ"
|
||||
- "Shift_L z x c v b n m BackSpace"
|
||||
- "show_numbers preferences space . Return"
|
||||
upper:
|
||||
- "Q W E R T Y U I O P Å"
|
||||
- "A S D F G H J K L Ø Æ"
|
||||
- "Shift_L Z X C V B N M BackSpace"
|
||||
- "show_numbers preferences space . Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "@ # $ % & - _ + ( )"
|
||||
- "show_symbols , \" ' : ; ! ? BackSpace"
|
||||
- "show_letters preferences space . Return"
|
||||
symbols:
|
||||
- "~ ` | U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
|
||||
- "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree * { }"
|
||||
- "show_numbers \\ / < > = [ ] BackSpace"
|
||||
- "show_letters preferences space . Return"
|
||||
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "altline"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: "ABC"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
".":
|
||||
outline: altline
|
||||
space:
|
||||
outline: spaceline
|
||||
text: " "
|
||||
Return:
|
||||
outline: "wide"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
U00B7:
|
||||
text: "·"
|
||||
squareroot:
|
||||
text: "√"
|
||||
Greek_pi:
|
||||
text: "π"
|
||||
division:
|
||||
text: "÷"
|
||||
multiply:
|
||||
text: "×"
|
||||
paragraph:
|
||||
text: "¶"
|
||||
Greek_tau:
|
||||
text: "τ"
|
||||
copyright:
|
||||
text: "©"
|
||||
U00AE:
|
||||
text: "®"
|
||||
U00A3:
|
||||
text: "£"
|
||||
EuroSign:
|
||||
text: "€"
|
||||
U00A5:
|
||||
text: "¥"
|
||||
asciicircum:
|
||||
text: "^"
|
||||
degree:
|
||||
text: "°"
|
||||
|
||||
45
data/keyboards/number.yaml
Normal file
45
data/keyboards/number.yaml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 37.46341, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
|
||||
outline7:
|
||||
bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 120.5853, height: 52 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "1 2 3 parenleft parenright"
|
||||
- "4 5 6 numbersign asterisk"
|
||||
- "7 8 9 plus minus"
|
||||
- "BackSpace 0 space Return"
|
||||
|
||||
buttons:
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
space:
|
||||
outline: spaceline
|
||||
text: " "
|
||||
Return:
|
||||
outline: outline7
|
||||
icon: "key-enter"
|
||||
keysym: "BackSpace"
|
||||
asterisk:
|
||||
text: "*"
|
||||
numbersign:
|
||||
text: "#"
|
||||
minus:
|
||||
text: "-"
|
||||
plus:
|
||||
text: "+"
|
||||
parenleft:
|
||||
text: "("
|
||||
parenright:
|
||||
text: ")"
|
||||
|
||||
166
data/keyboards/se.yaml
Normal file
166
data/keyboards/se.yaml
Normal file
@@ -0,0 +1,166 @@
|
||||
---
|
||||
bounds: { x: 0, y: 0.33, width: 360, height: 210 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 32, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 48.39024, height: 52 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
outline7:
|
||||
bounds: { x: 0, y: 0, width: 88.97561, height: 52 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 150.5853, height: 52 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "q w e r t y u i o p å"
|
||||
- "a s d f g h j k l ö ä"
|
||||
- "Shift_L z x c v b n m BackSpace"
|
||||
- "show_numbers preferences space . Return"
|
||||
upper:
|
||||
- "Q W E R T Y U I O P Å"
|
||||
- "A S D F G H J K L Ö Ä"
|
||||
- "Shift_L Z X C V B N M BackSpace"
|
||||
- "show_numbers preferences space . Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "at numbersign dollar percent ampersand minus underscore plus parenleft parenright"
|
||||
- "show_symbols comma quotedbl quoteright colon semicolon exclam question BackSpace"
|
||||
- "show_letters preferences space . Return"
|
||||
symbols:
|
||||
- "asciitilde quoteleft bar U00B7 squareroot Greek_pi Greek_tau division multiply paragraph"
|
||||
- "copyright U00AE U00A3 EuroSign U00A5 asciicircum degree asterisk braceleft braceright"
|
||||
- "show_numbers backslash slash less greater equal bracketleft bracketright BackSpace"
|
||||
- "show_letters preferences space . Return"
|
||||
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "altline"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "altline"
|
||||
label: "ABC"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
".":
|
||||
outline: altline
|
||||
space:
|
||||
outline: spaceline
|
||||
text: " "
|
||||
Return:
|
||||
outline: "wide"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
asterisk:
|
||||
text: "*"
|
||||
asciitilde:
|
||||
text: "~"
|
||||
quoteleft:
|
||||
text: "`"
|
||||
bar:
|
||||
text: "|"
|
||||
U00B7:
|
||||
text: "·"
|
||||
squareroot:
|
||||
text: "√"
|
||||
Greek_pi:
|
||||
text: "π"
|
||||
division:
|
||||
text: "÷"
|
||||
multiply:
|
||||
text: "×"
|
||||
paragraph:
|
||||
text: "¶"
|
||||
Greek_tau:
|
||||
text: "τ"
|
||||
copyright:
|
||||
text: "©"
|
||||
numbersign:
|
||||
text: "#"
|
||||
U00AE:
|
||||
text: "®"
|
||||
at:
|
||||
text: "@"
|
||||
dollar:
|
||||
text: "$"
|
||||
U00A3:
|
||||
text: "£"
|
||||
percent:
|
||||
text: "%"
|
||||
EuroSign:
|
||||
text: "€"
|
||||
ampersand:
|
||||
text: "&"
|
||||
U00A5:
|
||||
text: "¥"
|
||||
minus:
|
||||
text: "-"
|
||||
asciicircum:
|
||||
text: "^"
|
||||
underscore:
|
||||
text: "_"
|
||||
degree:
|
||||
text: "°"
|
||||
plus:
|
||||
text: "+"
|
||||
equal:
|
||||
text: "="
|
||||
parenleft:
|
||||
text: "("
|
||||
parenright:
|
||||
text: ")"
|
||||
braceleft:
|
||||
text: "{"
|
||||
braceright:
|
||||
text: "}"
|
||||
comma:
|
||||
text: ","
|
||||
backslash:
|
||||
text: "\\"
|
||||
slash:
|
||||
text: "/"
|
||||
quotedbl:
|
||||
text: "\""
|
||||
quoteright:
|
||||
text: "'"
|
||||
less:
|
||||
text: "<"
|
||||
greater:
|
||||
text: ">"
|
||||
colon:
|
||||
text: ":"
|
||||
semicolon:
|
||||
text: ";"
|
||||
exclam:
|
||||
text: "!"
|
||||
question:
|
||||
text: "?"
|
||||
bracketleft:
|
||||
text: "["
|
||||
bracketright:
|
||||
text: "]"
|
||||
|
||||
85
data/keyboards/us.yaml
Normal file
85
data/keyboards/us.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
---
|
||||
bounds: { x: 0, y: 1, width: 360, height: 208 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 35.33, height: 52 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 52.67, height: 52 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 62, height: 52 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 142, height: 52 }
|
||||
special:
|
||||
bounds: { x: 0, y: 0, width: 44, height: 52 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "q w e r t y u i o p"
|
||||
- "a s d f g h j k l"
|
||||
- "Shift_L z x c v b n m BackSpace"
|
||||
- "show_numbers preferences space period Return"
|
||||
upper:
|
||||
- "Q W E R T Y U I O P"
|
||||
- "A S D F G H J K L"
|
||||
- "Shift_L Z X C V B N M BackSpace"
|
||||
- "show_numbers preferences space period Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "@ # $ % & - _ + ( )"
|
||||
- "show_symbols , \" ' colon ; ! ? BackSpace"
|
||||
- "show_letters preferences space period Return"
|
||||
symbols:
|
||||
- "~ ` | · √ π τ ÷ × ¶"
|
||||
- "© ® £ € ¥ ^ ° * { }"
|
||||
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
|
||||
- "show_letters preferences space period Return"
|
||||
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "special"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "wide"
|
||||
label: "123"
|
||||
show_numbers_from_symbols:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "wide"
|
||||
label: "ABC"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
period:
|
||||
outline: "special"
|
||||
text: "."
|
||||
space:
|
||||
outline: "spaceline"
|
||||
text: " "
|
||||
Return:
|
||||
outline: "wide"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
colon:
|
||||
text: ":"
|
||||
85
data/keyboards/us_wide.yaml
Normal file
85
data/keyboards/us_wide.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
---
|
||||
bounds: { x: 0, y: 1, width: 540, height: 168 }
|
||||
|
||||
outlines:
|
||||
default:
|
||||
bounds: { x: 0, y: 0, width: 54, height: 42 }
|
||||
altline:
|
||||
bounds: { x: 0, y: 0, width: 81, height: 42 }
|
||||
wide:
|
||||
bounds: { x: 0, y: 0, width: 108, height: 42 }
|
||||
spaceline:
|
||||
bounds: { x: 0, y: 0, width: 216, height: 42 }
|
||||
special:
|
||||
bounds: { x: 0, y: 0, width: 54, height: 42 }
|
||||
|
||||
views:
|
||||
base:
|
||||
- "q w e r t y u i o p"
|
||||
- "a s d f g h j k l"
|
||||
- "Shift_L z x c v b n m BackSpace"
|
||||
- "show_numbers preferences space . Return"
|
||||
upper:
|
||||
- "Q W E R T Y U I O P"
|
||||
- "A S D F G H J K L"
|
||||
- "Shift_L Z X C V B N M BackSpace"
|
||||
- "show_numbers preferences space . Return"
|
||||
numbers:
|
||||
- "1 2 3 4 5 6 7 8 9 0"
|
||||
- "@ # $ % & - _ + ( )"
|
||||
- "show_symbols , \" ' colon ; ! ? BackSpace"
|
||||
- "show_letters preferences space . Return"
|
||||
symbols:
|
||||
- "~ ` | · √ π τ ÷ × ¶"
|
||||
- "© ® £ € ¥ ^ ° * { }"
|
||||
- "show_numbers_from_symbols \\ / < > = [ ] BackSpace"
|
||||
- "show_letters preferences space . Return"
|
||||
|
||||
buttons:
|
||||
Shift_L:
|
||||
action:
|
||||
locking:
|
||||
lock_view: "upper"
|
||||
unlock_view: "base"
|
||||
outline: "altline"
|
||||
icon: "key-shift"
|
||||
BackSpace:
|
||||
outline: "altline"
|
||||
icon: "edit-clear-symbolic"
|
||||
keysym: "BackSpace"
|
||||
preferences:
|
||||
action: "show_prefs"
|
||||
outline: "special"
|
||||
icon: "keyboard-mode-symbolic"
|
||||
show_numbers:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "wide"
|
||||
label: "123"
|
||||
show_numbers_from_symbols:
|
||||
action:
|
||||
set_view: "numbers"
|
||||
outline: "altline"
|
||||
label: "123"
|
||||
show_letters:
|
||||
action:
|
||||
set_view: "base"
|
||||
outline: "wide"
|
||||
label: "ABC"
|
||||
show_symbols:
|
||||
action:
|
||||
set_view: "symbols"
|
||||
outline: "altline"
|
||||
label: "*/="
|
||||
".":
|
||||
outline: "special"
|
||||
text: "."
|
||||
space:
|
||||
outline: "spaceline"
|
||||
text: " "
|
||||
Return:
|
||||
outline: "wide"
|
||||
icon: "key-enter"
|
||||
keysym: "Return"
|
||||
colon:
|
||||
text: ":"
|
||||
8
data/langs/de-DE.txt
Normal file
8
data/langs/de-DE.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
us Englisch (US)
|
||||
de Deutsch
|
||||
el Griechisch
|
||||
es Spanisch
|
||||
it Italienisch
|
||||
jp+kana Japanisch (Kana)
|
||||
no Norwegisch
|
||||
|
||||
10
data/langs/en-US.txt
Normal file
10
data/langs/en-US.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
us English (US)
|
||||
de German
|
||||
el Greek
|
||||
es Spanish
|
||||
fi Finnish
|
||||
it Italian
|
||||
jp+kana Japanese (kana)
|
||||
no Norwegian
|
||||
se Swedish
|
||||
|
||||
7
data/langs/es-ES.txt
Normal file
7
data/langs/es-ES.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
us Inglés (EE.UU.)
|
||||
de Alemán
|
||||
el Griego
|
||||
es Español
|
||||
it Italiano
|
||||
jp+kana Japonés (Kana)
|
||||
no Noruego
|
||||
8
data/langs/ja-JP.txt
Normal file
8
data/langs/ja-JP.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
us 英語 (US)
|
||||
de ドイツ語
|
||||
el ギリシャ語
|
||||
es スペイン語
|
||||
it イタリア語
|
||||
jp+kana 日本語 (かな)
|
||||
nb ノルウェー語
|
||||
|
||||
9
data/langs/pl-PL.txt
Normal file
9
data/langs/pl-PL.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
us angielski (USA)
|
||||
de niemiecki
|
||||
el grecki
|
||||
es hiszpański
|
||||
fi fiński
|
||||
it włoski
|
||||
jp+kana japoński (kana)
|
||||
no norweski
|
||||
se szwedzki
|
||||
19
data/meson.build
Normal file
19
data/meson.build
Normal file
@@ -0,0 +1,19 @@
|
||||
gnome = import('gnome')
|
||||
|
||||
squeekboard_resources = gnome.compile_resources(
|
||||
'squeekboard-resources',
|
||||
'squeekboard.gresources.xml',
|
||||
|
||||
c_name: 'squeekboard',
|
||||
)
|
||||
|
||||
desktop_file = 'sm.puri.Squeekboard.desktop'
|
||||
|
||||
i18n.merge_file('desktop',
|
||||
input: desktop_file + '.in',
|
||||
output: desktop_file,
|
||||
po_dir: '../po',
|
||||
install: true,
|
||||
install_dir: join_paths(datadir, 'applications'),
|
||||
type: 'desktop'
|
||||
)
|
||||
19
data/popup.ui
Normal file
19
data/popup.ui
Normal file
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.22.1 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.16"/>
|
||||
<object class="GtkPopoverMenu" id="main_menu">
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="submenu">main</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
9
data/sm.puri.Squeekboard.desktop.in
Normal file
9
data/sm.puri.Squeekboard.desktop.in
Normal file
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Squeekboard
|
||||
GenericName=Squeekboard Virtual Keyboard
|
||||
Comment=Virtual Keyboard
|
||||
Exec=squeekboard
|
||||
Terminal=false
|
||||
Type=Application
|
||||
NoDisplay=true
|
||||
Categories=GTK;Utility;
|
||||
11
data/squeekboard.gresources.xml
Normal file
11
data/squeekboard.gresources.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/sm/puri/squeekboard">
|
||||
<file compressed="true">style.css</file>
|
||||
<file compressed="true">style-Adwaita:dark.css</file>
|
||||
<file compressed="true" preprocess="xml-stripblanks">popup.ui</file>
|
||||
<file>icons/key-enter.svg</file>
|
||||
<file>icons/key-shift.svg</file>
|
||||
<file>icons/keyboard-mode-symbolic.svg</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
46
data/style-Adwaita:dark.css
Normal file
46
data/style-Adwaita:dark.css
Normal file
@@ -0,0 +1,46 @@
|
||||
sq_view {
|
||||
background-color: rgba(0, 0, 0, 255);
|
||||
color: #ffffff;
|
||||
font-family: cantarell, sans-serif;
|
||||
}
|
||||
|
||||
sq_view sq_button {
|
||||
color: #deddda;
|
||||
background: #464448;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: #5e5c64;
|
||||
border-radius: 3px;
|
||||
margin: 4px 2px 4px 2px;
|
||||
}
|
||||
|
||||
sq_view.wide sq_button {
|
||||
margin: 1px 1px 1px 1px;
|
||||
}
|
||||
|
||||
sq_button:active {
|
||||
background: #747077;
|
||||
border-color: #96949d;
|
||||
}
|
||||
|
||||
sq_button.altline,
|
||||
sq_button.special,
|
||||
sq_button.wide {
|
||||
background: #2b292f;
|
||||
border-color: #3e3a44;
|
||||
}
|
||||
|
||||
sq_button.locked {
|
||||
background: #ffffff;
|
||||
color: #2b292f;
|
||||
}
|
||||
|
||||
#Return {
|
||||
background: #1c71d8;
|
||||
border-color: #1a5fb4;
|
||||
}
|
||||
|
||||
#Return:active {
|
||||
background: #1c71d8;
|
||||
border-color: #3584e4;
|
||||
}
|
||||
49
data/style.css
Normal file
49
data/style.css
Normal file
@@ -0,0 +1,49 @@
|
||||
sq_view {
|
||||
background-color: @theme_base_color; /*rgba(0, 0, 0, 255);*/
|
||||
color: @theme_text_color; /*#ffffff;*/
|
||||
font-family: cantarell, sans-serif;
|
||||
}
|
||||
|
||||
sq_view sq_button {
|
||||
color: @theme_fg_color; /*#deddda;*/
|
||||
background: mix(@theme_bg_color, @theme_base_color, -0.5); /* #464448; */
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-color: @borders; /* #5e5c64;*/
|
||||
border-radius: 3px;
|
||||
margin: 4px 2px 4px 2px;
|
||||
}
|
||||
|
||||
sq_view.wide sq_button {
|
||||
margin: 1px 1px 1px 1px;
|
||||
}
|
||||
|
||||
sq_button:active,
|
||||
sq_button.altline:active,
|
||||
sq_button.special:active,
|
||||
sq_button.wide:active {
|
||||
background: mix(@theme_bg_color, @theme_selected_bg_color, 0.4);/* #747077; */
|
||||
border-color: mix(@borders, @theme_selected_fg_color, 0.5);/* #96949d; */
|
||||
}
|
||||
|
||||
sq_button.altline,
|
||||
sq_button.special,
|
||||
sq_button.wide {
|
||||
background: mix(@theme_bg_color, @theme_base_color, 0.5); /*#2b292f;*/
|
||||
border-color: @borders; /* #3e3a44; */
|
||||
}
|
||||
|
||||
sq_button.locked {
|
||||
background: @theme_fg_color; /*#ffffff;*/
|
||||
color: @theme_bg_color; /*#2b292f;*/
|
||||
}
|
||||
|
||||
#Return {
|
||||
background: @theme_selected_bg_color; /* #1c71d8; */
|
||||
border-color: @borders; /*#1a5fb4;*/
|
||||
}
|
||||
|
||||
#Return:active {
|
||||
background: mix(@theme_selected_bg_color, @theme_bg_color, 0.4); /*#1c71d8;*/
|
||||
border-color: @borders; /*#3584e4;*/
|
||||
}
|
||||
12
debian/cargo/config
vendored
Normal file
12
debian/cargo/config
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# When modifying this file, consider instead
|
||||
# to take advantage of the method that Cargo packagers use
|
||||
# to set up all the necessary stuff automatically:
|
||||
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=907629#30
|
||||
|
||||
[source.crates-io]
|
||||
registry = 'https://github.com/rust-lang/crates.io-index'
|
||||
replace-with = 'vendored-sources'
|
||||
|
||||
[source.vendored-sources]
|
||||
directory = '/usr/share/cargo/registry'
|
||||
|
||||
63
debian/changelog
vendored
Normal file
63
debian/changelog
vendored
Normal file
@@ -0,0 +1,63 @@
|
||||
squeekboard (1.4.0) amber-phone; urgency=medium
|
||||
|
||||
* "text" property in layouts
|
||||
* Adjusts to user's color scheme
|
||||
|
||||
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Mon, 02 Dec 2019 19:37:01 +0000
|
||||
|
||||
squeekboard (1.3.2) amber-phone; urgency=medium
|
||||
|
||||
* Make sure all key presses get accepted by the compositor
|
||||
|
||||
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Tue, 26 Nov 2019 15:36:27 +0000
|
||||
|
||||
squeekboard (1.3.1) amber-phone; urgency=medium
|
||||
|
||||
* Update and fix layouts and languages
|
||||
* Make tests less likely to fail
|
||||
|
||||
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Wed, 20 Nov 2019 22:10:48 +0000
|
||||
|
||||
squeekboard (1.3.0) amber-phone; urgency=medium
|
||||
|
||||
* Language selection popup
|
||||
* Swedish and Finnish layouts
|
||||
|
||||
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Sat, 16 Nov 2019 15:38:14 +0000
|
||||
|
||||
squeekboard (1.2.2) amber-phone; urgency=medium
|
||||
|
||||
* Landscape mode
|
||||
|
||||
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Wed, 30 Oct 2019 12:38:39 +0000
|
||||
|
||||
squeekboard (1.2.1) amber-phone; urgency=medium
|
||||
|
||||
* Use different distribution
|
||||
|
||||
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Tue, 08 Oct 2019 10:56:10 +0000
|
||||
|
||||
squeekboard (1.2.0) unstable; urgency=medium
|
||||
|
||||
* Use Cargo-based dependencies
|
||||
|
||||
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Tue, 24 Sep 2019 10:42:15 +0000
|
||||
|
||||
squeekboard (1.1.0) unstable; urgency=medium
|
||||
|
||||
* Use new keyboard layout format
|
||||
|
||||
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Mon, 02 Sep 2019 10:12:02 +0000
|
||||
|
||||
|
||||
squeekboard (1.0.10) unstable; urgency=medium
|
||||
|
||||
* Use a shared DBus definition
|
||||
|
||||
-- Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm> Tue, 02 Jul 2019 20:12:02 +0000
|
||||
|
||||
squeekboard (1.0.9) unstable; urgency=medium
|
||||
|
||||
* Initial release.
|
||||
|
||||
-- David Boddie <david.boddie@puri.sm> Tue, 25 Jun 2019 19:33:00 +0200
|
||||
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@@ -0,0 +1 @@
|
||||
10
|
||||
53
debian/control
vendored
Normal file
53
debian/control
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
Source: squeekboard
|
||||
Section: x11
|
||||
Priority: optional
|
||||
Maintainer: Dorota Czaplejewicz <dorota.czaplejewicz@puri.sm>
|
||||
Build-Depends:
|
||||
cargo,
|
||||
debhelper (>= 10),
|
||||
meson (>=0.51.0),
|
||||
ninja-build,
|
||||
pkg-config,
|
||||
libglib2.0-dev,
|
||||
libgtk-3-dev,
|
||||
libcroco3-dev,
|
||||
librust-bitflags-1-dev (>= 1.0),
|
||||
librust-clap-2+default-dev (>= 2.32),
|
||||
librust-gio+v2-44-dev,
|
||||
librust-glib+v2-44-dev,
|
||||
librust-glib-sys-dev,
|
||||
librust-gtk+v3-22-dev (>= 0.5),
|
||||
librust-gtk-sys-dev,
|
||||
librust-maplit-1-dev (>= 1.0),
|
||||
librust-regex-1-dev (>= 1.1),
|
||||
librust-serde-derive-1-dev (>= 1.0),
|
||||
librust-serde-yaml-0.8-dev (>= 0.8),
|
||||
librust-xkbcommon-0.4+wayland-dev (>= 0.4),
|
||||
libwayland-dev (>= 1.16),
|
||||
rustc,
|
||||
wayland-protocols (>= 1.14),
|
||||
# for running the tests
|
||||
xvfb,
|
||||
xauth,
|
||||
Standards-Version: 4.1.3
|
||||
Homepage: https://source.puri.sm/Librem5/squeekboard
|
||||
|
||||
Package: squeekboard
|
||||
Architecture: linux-any
|
||||
Depends:
|
||||
# for the Adwaita-dark theme
|
||||
gnome-themes-extra-data,
|
||||
${shlibs:Depends}
|
||||
${misc:Depends}
|
||||
Description: On-screen keyboard for Wayland
|
||||
Virtual keyboard supporting Wayland, built primarily for the Librem 5 phone.
|
||||
|
||||
Package: squeekboard-devel
|
||||
Architecture: linux-any
|
||||
Depends:
|
||||
${shlibs:Depends}
|
||||
${misc:Depends}
|
||||
Description: Resources for making Squeekboard layouts
|
||||
Tools for creating Squeekboard layouts:
|
||||
.
|
||||
* squeekboard-test-layout
|
||||
195
debian/copyright
vendored
Normal file
195
debian/copyright
vendored
Normal file
@@ -0,0 +1,195 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: squeekboard
|
||||
Source: https://source.puri.sm/Librem5/squeekboard
|
||||
|
||||
Files: *
|
||||
Copyright: 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
2010-2011 Red Hat, Inc.
|
||||
2019 Purism SPC
|
||||
License: GPL-3+
|
||||
|
||||
Files: cargo.sh
|
||||
Copyright: 2019 Bart Ribbers <bribbers@disroot.org>
|
||||
2019 Purism SPC
|
||||
License: GPL-3+
|
||||
|
||||
Files: data/style.css
|
||||
data/squeekboard.gresources.xml
|
||||
data/meson.build
|
||||
src/meson.build
|
||||
src/imservice.c
|
||||
Copyright: 2019 Purism SPC
|
||||
2019 Squeekboard Contributors
|
||||
License: GPL-3+
|
||||
|
||||
Files: data/keyboards/de.yaml
|
||||
Copyright: 2019 Mark Müller <markmueller86@gmail.com>
|
||||
License: GPL-3+
|
||||
|
||||
Files: data/keyboards/el.yaml
|
||||
Copyright: 2019 Antonis Tsolomitis
|
||||
2019 Purism SPC
|
||||
License: GPL-3+
|
||||
|
||||
Files: data/keyboards/es.yaml
|
||||
Copyright: 2019 Purism SPC
|
||||
2019 uzanto <miguejim@mailbox.org>
|
||||
License: GPL-3+
|
||||
|
||||
Files: data/keyboards/fi.yaml
|
||||
Copyright: 2019 uzanto <miguejim@mailbox.org>
|
||||
License: GPL-3+
|
||||
|
||||
Files: data/keyboards/it.yaml
|
||||
Copyright: 2019 Antonio Pandolfo <ant.pandolfo@gmail.com>
|
||||
2019 Purism SPC
|
||||
License: GPL-3+
|
||||
|
||||
Files: data/keyboards/ja+kana.yaml
|
||||
Copyright: 2019 Mark Müller <markmueller86@gmail.com>
|
||||
License: GPL-3+
|
||||
|
||||
Files: data/keyboards/se.yaml
|
||||
Copyright: 2019 Andreas Rönnquist <andreas@ronnquist.net>
|
||||
2019 Purism SPC
|
||||
License: GPL-3+
|
||||
|
||||
Files: eek/eek-layout.h
|
||||
eek/eek-layout.c
|
||||
eek/eek-element.c
|
||||
eek/eek-gtk-keyboard.c
|
||||
eek/eek-gtk-keyboard.h
|
||||
eek/eek.c
|
||||
eek/eek-xml-layout.h
|
||||
eek/eek-xml-layout.c
|
||||
eek/eek-renderer.h
|
||||
eek/eek-element.h
|
||||
eek/eek-renderer.c
|
||||
eekboard/eekboard-service.c
|
||||
eekboard/eekboard-service.h
|
||||
Copyright: 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
2010-2011 Red Hat, Inc.
|
||||
2018-2019 Purism SPC
|
||||
2019 Squeekboard Contributors
|
||||
License: GPL-3+
|
||||
|
||||
Files: eek/eek-keyboard.c
|
||||
eek/eek-types.h
|
||||
eek/eek-types.c
|
||||
eek/eek-keyboard.h
|
||||
eek/eek.h
|
||||
src/server-main.c
|
||||
src/server-context-service.h
|
||||
Copyright: 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
2010-2011 Red Hat, Inc.
|
||||
2019 Purism SPC
|
||||
License: LGPL-2+
|
||||
|
||||
Files: eek/layersurface.c
|
||||
src/wayland.c
|
||||
src/key-emitter.c
|
||||
meson.build
|
||||
src/meson.build
|
||||
po/meson.build
|
||||
Copyright: 2018-2019 Purism SPC
|
||||
License: GPL-3+
|
||||
|
||||
Files: eekboard/keymap.c
|
||||
Copyright: 2000 Red Hat, Inc.
|
||||
2019 Purism, SPC
|
||||
License: LGPL-2+
|
||||
|
||||
Files: eekboard/eekboard-context-service.c
|
||||
Copyright: 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
2010-2011 Red Hat, Inc.
|
||||
2019 Purism, SPC
|
||||
2019 David Heidelberg <david@ixit.cz>
|
||||
2019 Piotr Tworek <tworaz@tworaz.net>
|
||||
2019 Squeekboard Contributors
|
||||
License: GPL-3+
|
||||
|
||||
Files: eekboard/eekboard-context-service.h
|
||||
Copyright: 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
2010-2011 Red Hat, Inc.
|
||||
License: GPL-3+
|
||||
|
||||
Files: po/POTFILES.skip
|
||||
po/LINGUAS
|
||||
po/ja.po
|
||||
po/POTFILES.in
|
||||
Copyright: 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
License: LGPL-2+
|
||||
Comment:
|
||||
Only the po/ja.po file contains a license, but these are all grouped together.
|
||||
|
||||
Files: protocols/wlr-layer-shell-unstable-v1.xml
|
||||
Copyright: 2017 Drew DeVault
|
||||
License: X11
|
||||
|
||||
Files: src/resources.rs
|
||||
Copyright: 2019 Andreas Rönnquist <andreas@ronnquist.net>
|
||||
2019 Mark Müller <markmueller86@gmail.com>
|
||||
2019 Purism SPC
|
||||
License: GPL-3+
|
||||
|
||||
Files: src/server-context-service.c
|
||||
Copyright: 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
2010-2011 Red Hat, Inc.
|
||||
2019 Purism SPC
|
||||
2019 Squeekboard Contributors
|
||||
License: GPL-3+
|
||||
|
||||
Files: tests/meson.build
|
||||
Copyright: 2019 Purism SPC
|
||||
2019 Mark Müller <markmueller86@gmail.com>
|
||||
License: GPL-3+
|
||||
|
||||
License: GPL-3+
|
||||
This package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
|
||||
|
||||
License: LGPL-2+
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
.
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
License: X11
|
||||
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 copyright holders not be used in
|
||||
advertising or publicity pertaining to distribution of the software
|
||||
without specific, written prior permission. The copyright holders make
|
||||
no representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied warranty.
|
||||
.
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS 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.
|
||||
15
debian/rules
vendored
Executable file
15
debian/rules
vendored
Executable file
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
export CARGO_HOME = $(CURDIR)/debian/cargo
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
|
||||
%:
|
||||
dh $@ --builddirectory=_build --buildsystem=meson
|
||||
|
||||
# The Debian version of linked-hash-map doesn't provide any hash,
|
||||
# causing Cargo to refuse to build with a crates.io copy
|
||||
build-arch:
|
||||
rm Cargo.lock
|
||||
dh $@ --builddirectory=_build --buildsystem=meson
|
||||
|
||||
override_dh_autoreconf:
|
||||
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@@ -0,0 +1 @@
|
||||
3.0 (native)
|
||||
1
debian/squeekboard-devel.install
vendored
Normal file
1
debian/squeekboard-devel.install
vendored
Normal file
@@ -0,0 +1 @@
|
||||
usr/bin/squeekboard-test-layout /usr/bin
|
||||
2
debian/squeekboard.install
vendored
Normal file
2
debian/squeekboard.install
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
tools/squeekboard-restyled usr/bin
|
||||
usr/bin/squeekboard /usr/bin
|
||||
2
debian/squeekboard.lintian-overrides
vendored
Normal file
2
debian/squeekboard.lintian-overrides
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# yaml-rust 0.4.3 shares some roots with libyaml, including the string which lintian checks, creating a false positive
|
||||
squeekboard binary: embedded-library usr/bin/squeekboard: libyaml
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
# Copyright (C) 2010 Red Hat, Inc.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
SUBDIRS = reference
|
||||
@@ -1,19 +0,0 @@
|
||||
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
# Copyright (C) 2010 Red Hat, Inc.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
SUBDIRS = eek
|
||||
@@ -1,135 +0,0 @@
|
||||
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
# Copyright (C) 2010 Red Hat, Inc.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
## Process this file with automake to produce Makefile.in
|
||||
|
||||
# We require automake 1.6 at least.
|
||||
AUTOMAKE_OPTIONS = 1.6
|
||||
|
||||
# This is a blank Makefile.am for using gtk-doc.
|
||||
# Copy this to your project's API docs directory and modify the variables to
|
||||
# suit your project. See the GTK+ Makefiles in gtk+/docs/reference for examples
|
||||
# of using the various options.
|
||||
|
||||
# The name of the module, e.g. 'glib'.
|
||||
DOC_MODULE=eek
|
||||
|
||||
# Uncomment for versioned docs and specify the version of the module, e.g. '2'.
|
||||
#DOC_MODULE_VERSION=2
|
||||
|
||||
|
||||
# The top-level SGML file. You can change this if you want to.
|
||||
DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.sgml
|
||||
|
||||
# The directory containing the source code. Relative to $(srcdir).
|
||||
# gtk-doc will search all .c & .h files beneath here for inline comments
|
||||
# documenting the functions and macros.
|
||||
# e.g. DOC_SOURCE_DIR=../../../gtk
|
||||
DOC_SOURCE_DIR=../../../eek
|
||||
|
||||
# Extra options to pass to gtkdoc-scangobj. Not normally needed.
|
||||
SCANGOBJ_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-scan.
|
||||
# e.g. SCAN_OPTIONS=--deprecated-guards="GTK_DISABLE_DEPRECATED"
|
||||
SCAN_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-mkdb.
|
||||
# e.g. MKDB_OPTIONS=--sgml-mode --output-format=xml
|
||||
MKDB_OPTIONS=--sgml-mode --output-format=xml
|
||||
|
||||
# Extra options to supply to gtkdoc-mktmpl
|
||||
# e.g. MKTMPL_OPTIONS=--only-section-tmpl
|
||||
MKTMPL_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-mkhtml
|
||||
MKHTML_OPTIONS=
|
||||
|
||||
# Extra options to supply to gtkdoc-fixref. Not normally needed.
|
||||
# e.g. FIXXREF_OPTIONS=--extra-dir=../gdk-pixbuf/html --extra-dir=../gdk/html
|
||||
FIXXREF_OPTIONS=
|
||||
|
||||
# Used for dependencies. The docs will be rebuilt if any of these change.
|
||||
# e.g. HFILE_GLOB=$(top_srcdir)/gtk/*.h
|
||||
# e.g. CFILE_GLOB=$(top_srcdir)/gtk/*.c
|
||||
HFILE_GLOB=$(top_srcdir)/eek/*.h
|
||||
CFILE_GLOB=$(top_srcdir)/eek/*.c
|
||||
|
||||
# Extra header to include when scanning, which are not under DOC_SOURCE_DIR
|
||||
# e.g. EXTRA_HFILES=$(top_srcdir}/contrib/extra.h
|
||||
EXTRA_HFILES=
|
||||
|
||||
# Header files to ignore when scanning. Use base file name, no paths
|
||||
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
|
||||
IGNORE_HFILES= eek-private.h \
|
||||
eek-drawing.h \
|
||||
eek-clutter-key.h \
|
||||
eek-clutter-section.h \
|
||||
eek-clutter-key-actor.h \
|
||||
eek-clutter-drawing-context.h \
|
||||
config.h
|
||||
|
||||
# Images to copy into HTML directory.
|
||||
# e.g. HTML_IMAGES=$(top_srcdir)/gtk/stock-icons/stock_about_24.png
|
||||
HTML_IMAGES=
|
||||
|
||||
# Extra SGML files that are included by $(DOC_MAIN_SGML_FILE).
|
||||
# e.g. content_files=running.sgml building.sgml changes-2.0.sgml
|
||||
content_files=eek-overview.xml
|
||||
|
||||
# SGML files where gtk-doc abbrevations (#GtkWidget) are expanded
|
||||
# These files must be listed here *and* in content_files
|
||||
# e.g. expand_content_files=running.sgml
|
||||
expand_content_files=eek-overview.xml
|
||||
|
||||
# CFLAGS and LDFLAGS for compiling gtkdoc-scangobj with your library.
|
||||
# Only needed if you are using gtkdoc-scangobj to dynamically query widget
|
||||
# signals and properties.
|
||||
# e.g. GTKDOC_CFLAGS=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
|
||||
# e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
|
||||
GTKDOC_CFLAGS = $(GOBJECT2_CFLAGS)
|
||||
GTKDOC_LIBS = $(top_srcdir)/eek/libeek.la \
|
||||
$(top_srcdir)/eek/libeek-gtk.la \
|
||||
$(top_srcdir)/eek/libeek-xkb.la \
|
||||
$(top_srcdir)/eek/libeek-xkl.la \
|
||||
$(GOBJECT2_LIBS) \
|
||||
$(XKB_LIBS)
|
||||
|
||||
if HAVE_CLUTTER
|
||||
GTKDOC_LIBS += $(top_srcdir)/eek/libeek-clutter.la $(CLUTTER_LIBS)
|
||||
endif
|
||||
|
||||
# This includes the standard gtk-doc make rules, copied by gtkdocize.
|
||||
include $(top_srcdir)/gtk-doc.make
|
||||
|
||||
# Other files to distribute
|
||||
# e.g. EXTRA_DIST += version.xml.in
|
||||
EXTRA_DIST +=
|
||||
|
||||
# Files not to distribute
|
||||
# for --rebuild-types in $(SCAN_OPTIONS), e.g. $(DOC_MODULE).types
|
||||
# for --rebuild-sections in $(SCAN_OPTIONS) e.g. $(DOC_MODULE)-sections.txt
|
||||
#DISTCLEANFILES +=
|
||||
|
||||
# Comment this out if you want your docs-status tested during 'make check'
|
||||
if ENABLE_GTK_DOC
|
||||
#TESTS_ENVIRONMENT = cd $(srcsrc) &&
|
||||
#TESTS = $(GTKDOC_CHECK)
|
||||
endif
|
||||
|
||||
-include $(top_srcdir)/gtk-doc.mk
|
||||
@@ -1,74 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
|
||||
[
|
||||
<!ENTITY % local.common.attrib "xmlns:xi CDATA #FIXED 'http://www.w3.org/2003/XInclude'">
|
||||
]>
|
||||
<book id="index">
|
||||
<bookinfo>
|
||||
<title>libeek Reference Manual</title>
|
||||
<releaseinfo>
|
||||
for libeek 0.0.1.
|
||||
</releaseinfo>
|
||||
<copyright>
|
||||
<year>2010</year>
|
||||
<holder>Daiki Ueno</holder>
|
||||
</copyright>
|
||||
|
||||
<copyright>
|
||||
<year>2010</year>
|
||||
<holder>Red Hat, Inc.</holder>
|
||||
</copyright>
|
||||
|
||||
<legalnotice>
|
||||
<para>
|
||||
Permission is granted to copy, distribute and/or modify this
|
||||
document under the terms of the GNU Free Documentation License,
|
||||
Version 1.3 or any later version published by the Free Software
|
||||
Foundation; with no Invariant Sections, no Front-Cover Texts and
|
||||
no Back-Cover Texts. A copy of the license is included in the
|
||||
section entitled "GNU Free Documentation License".
|
||||
</para>
|
||||
</legalnotice>
|
||||
</bookinfo>
|
||||
|
||||
<xi:include href="xml/eek-overview.xml"/>
|
||||
<part id="apireference">
|
||||
<title>API Manual</title>
|
||||
<chapter>
|
||||
<title>Base Classes, Interfaces, and Utilities</title>
|
||||
<xi:include href="xml/eek-element.xml"/>
|
||||
<xi:include href="xml/eek-container.xml"/>
|
||||
<xi:include href="xml/eek-keyboard.xml"/>
|
||||
<xi:include href="xml/eek-section.xml"/>
|
||||
<xi:include href="xml/eek-key.xml"/>
|
||||
<xi:include href="xml/eek-layout.xml"/>
|
||||
<xi:include href="xml/eek-types.xml"/>
|
||||
<xi:include href="xml/eek-keysym.xml"/>
|
||||
</chapter>
|
||||
<chapter>
|
||||
<title>Clutter Keyboard</title>
|
||||
<xi:include href="xml/eek-clutter-keyboard.xml"/>
|
||||
</chapter>
|
||||
<chapter>
|
||||
<title>GTK Keyboard</title>
|
||||
<xi:include href="xml/eek-gtk-keyboard.xml"/>
|
||||
</chapter>
|
||||
<chapter>
|
||||
<title>Libxklavier Layout Engine</title>
|
||||
<xi:include href="xml/eek-xkl-layout.xml"/>
|
||||
</chapter>
|
||||
<chapter>
|
||||
<title>XKB Layout Engine</title>
|
||||
<xi:include href="xml/eek-xkb-layout.xml"/>
|
||||
</chapter>
|
||||
<chapter id="object-tree">
|
||||
<title>Object Hierarchy</title>
|
||||
<xi:include href="xml/tree_index.sgml"/>
|
||||
</chapter>
|
||||
<index id="api-index-full">
|
||||
<title>API Index</title>
|
||||
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>
|
||||
</index>
|
||||
</part>
|
||||
</book>
|
||||
@@ -1,60 +0,0 @@
|
||||
<part id="eek-overview">
|
||||
<title>Usage Overview</title>
|
||||
<partintro>
|
||||
|
||||
<para>libeek is a library to create keyboard-like user interface.
|
||||
Since it is designed as simple as possible, it provides only two
|
||||
kinds of objects. One is <emphasis>keyboard element</emphasis>
|
||||
(derived from #EekElement) and another is <emphasis>keyboard
|
||||
layout engine</emphasis> (which implements the #EekLayout
|
||||
interface).</para>
|
||||
|
||||
<para>A keyboard element represents either a keyboard
|
||||
(#EekKeyboard), a section (#EekSection), or a key (#EekKey). Each
|
||||
element implements the Builder design pattern so that it can be
|
||||
converted into a UI widget (#ClutterActor, #GtkDrawingArea,
|
||||
aso).</para>
|
||||
|
||||
<para>A layout engine arranges keyboard elements using information
|
||||
from external configuration mechanisms (libxklavier, XKB,
|
||||
matchbox-keyboard layouts in XML, aso)</para>
|
||||
|
||||
<para>Here is a sample code which creates a keyboard-like #ClutterActor using the system keyboard layout using libxklavier:</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
EekKeyboard *keyboard;
|
||||
EekLayout *layout;
|
||||
|
||||
/* Create a keyboard layout using libxklavier configuration. */
|
||||
layout = eek_xkl_layout_new ();
|
||||
|
||||
/* Create a keyboard implemented as ClutterActor. */
|
||||
keyboard = eek_clutter_keyboard_new ();
|
||||
|
||||
/* Apply the layout to the keyboard. */
|
||||
eek_keyboard_set_layout (keyboard, layout);
|
||||
|
||||
clutter_group_add (CLUTTER_GROUP(stage),
|
||||
eek_clutter_keyboard_get_actor (EEK_CLUTTER_KEYBOARD(keyboard)));
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
|
||||
<para>One of the most interesting features of libeek is that UI
|
||||
backends can be switched easily. For example, to create a
|
||||
keyboard-like #GtkWidget instead of #ClutterActor, all you need is
|
||||
to replace eek_clutter_keyboard_new() with eek_gtk_keyboard_new()
|
||||
and eek_clutter_keyboard_get_actor() with
|
||||
eek_gtk_keyboard_get_widget().</para>
|
||||
|
||||
<para>There is logical represention (model) of keyboard distinct from the UI widget (view). More precisely, a keyboard is represented as a tree of #EekElement -- #EekKeyboard contains one or more #EekSection's and #EekSection contains one or more #EekKey's. Each element can be event source when user events on the UI widget occurs. For example, with the following code, when a user pushed a key widget with keycode 0x38 assigned, on_a_pressed will be called.</para>
|
||||
<informalexample>
|
||||
<programlisting>
|
||||
/* Find a key element in the logical keyboard. */
|
||||
EekKey *key = eek_keyboard_find_key_by_keycode (keyboard, 0x38);
|
||||
g_signal_connect (key, "pressed", on_a_pressed);
|
||||
</programlisting>
|
||||
</informalexample>
|
||||
<para>In this way, application developers do not need to know the differences between the underlying UI widgets after creation.</para>
|
||||
</partintro>
|
||||
</part>
|
||||
@@ -1,243 +0,0 @@
|
||||
<SECTION>
|
||||
<FILE>eek-keyboard</FILE>
|
||||
<TITLE>EekKeyboard</TITLE>
|
||||
EekKeyboardClass
|
||||
EekKeyboardPrivate
|
||||
EekKeyboard
|
||||
eek_keyboard_set_keysym_index
|
||||
eek_keyboard_get_keysym_index
|
||||
eek_keyboard_create_section
|
||||
eek_keyboard_set_layout
|
||||
eek_keyboard_realize
|
||||
eek_keyboard_find_key_by_keycode
|
||||
<SUBSECTION Standard>
|
||||
EEK_KEYBOARD
|
||||
EEK_IS_KEYBOARD
|
||||
EEK_TYPE_KEYBOARD
|
||||
eek_keyboard_get_type
|
||||
EEK_KEYBOARD_CLASS
|
||||
EEK_IS_KEYBOARD_CLASS
|
||||
EEK_KEYBOARD_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-layout</FILE>
|
||||
<TITLE>EekLayout</TITLE>
|
||||
EekLayoutIface
|
||||
EekLayout
|
||||
eek_layout_apply
|
||||
eek_layout_get_group
|
||||
<SUBSECTION Standard>
|
||||
EEK_LAYOUT
|
||||
EEK_IS_LAYOUT
|
||||
EEK_TYPE_LAYOUT
|
||||
eek_layout_get_type
|
||||
EEK_LAYOUT_GET_IFACE
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-gtk-keyboard</FILE>
|
||||
<TITLE>EekGtkKeyboard</TITLE>
|
||||
EekGtkKeyboard
|
||||
EekGtkKeyboardClass
|
||||
EekGtkKeyboardPrivate
|
||||
eek_gtk_keyboard_new
|
||||
eek_gtk_keyboard_get_widget
|
||||
<SUBSECTION Standard>
|
||||
EEK_GTK_KEYBOARD
|
||||
EEK_IS_GTK_KEYBOARD
|
||||
EEK_TYPE_GTK_KEYBOARD
|
||||
eek_gtk_keyboard_get_type
|
||||
EEK_GTK_KEYBOARD_CLASS
|
||||
EEK_IS_GTK_KEYBOARD_CLASS
|
||||
EEK_GTK_KEYBOARD_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-section</FILE>
|
||||
<TITLE>EekSection</TITLE>
|
||||
EekSectionClass
|
||||
EekSectionPrivate
|
||||
EekSection
|
||||
eek_section_set_angle
|
||||
eek_section_get_angle
|
||||
eek_section_get_n_rows
|
||||
eek_section_add_row
|
||||
eek_section_get_row
|
||||
eek_section_create_key
|
||||
eek_section_find_key_by_keycode
|
||||
<SUBSECTION Standard>
|
||||
EEK_SECTION
|
||||
EEK_IS_SECTION
|
||||
EEK_TYPE_SECTION
|
||||
eek_section_get_type
|
||||
EEK_SECTION_CLASS
|
||||
EEK_IS_SECTION_CLASS
|
||||
EEK_SECTION_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-container</FILE>
|
||||
<TITLE>EekContainer</TITLE>
|
||||
EekContainerClass
|
||||
EekContainerPrivate
|
||||
EekCallback
|
||||
EekCompareFunc
|
||||
EekContainer
|
||||
eek_container_foreach_child
|
||||
eek_container_find
|
||||
eek_container_find_by_position
|
||||
<SUBSECTION Standard>
|
||||
EEK_CONTAINER
|
||||
EEK_IS_CONTAINER
|
||||
EEK_TYPE_CONTAINER
|
||||
eek_container_get_type
|
||||
EEK_CONTAINER_CLASS
|
||||
EEK_IS_CONTAINER_CLASS
|
||||
EEK_CONTAINER_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-clutter-keyboard</FILE>
|
||||
<TITLE>EekClutterKeyboard</TITLE>
|
||||
EekClutterKeyboard
|
||||
EekClutterKeyboardClass
|
||||
EekClutterKeyboardPrivate
|
||||
eek_clutter_keyboard_new
|
||||
eek_clutter_keyboard_get_actor
|
||||
<SUBSECTION Standard>
|
||||
EEK_CLUTTER_KEYBOARD
|
||||
EEK_IS_CLUTTER_KEYBOARD
|
||||
EEK_TYPE_CLUTTER_KEYBOARD
|
||||
eek_clutter_keyboard_get_type
|
||||
EEK_CLUTTER_KEYBOARD_CLASS
|
||||
EEK_IS_CLUTTER_KEYBOARD_CLASS
|
||||
EEK_CLUTTER_KEYBOARD_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-xkl-layout</FILE>
|
||||
<TITLE>EekXklLayout</TITLE>
|
||||
EekXklLayout
|
||||
EekXklLayoutClass
|
||||
EekXklLayoutPrivate
|
||||
eek_xkl_layout_new
|
||||
eek_xkl_layout_set_config
|
||||
eek_xkl_layout_set_model
|
||||
eek_xkl_layout_set_layouts
|
||||
eek_xkl_layout_set_variants
|
||||
eek_xkl_layout_set_options
|
||||
eek_xkl_layout_get_model
|
||||
eek_xkl_layout_get_layouts
|
||||
eek_xkl_layout_get_variants
|
||||
eek_xkl_layout_get_options
|
||||
<SUBSECTION Standard>
|
||||
EEK_XKL_LAYOUT
|
||||
EEK_IS_XKL_LAYOUT
|
||||
EEK_TYPE_XKL_LAYOUT
|
||||
eek_xkl_layout_get_type
|
||||
EEK_XKL_LAYOUT_CLASS
|
||||
EEK_IS_XKL_LAYOUT_CLASS
|
||||
EEK_XKL_LAYOUT_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-xkb-layout</FILE>
|
||||
<TITLE>EekXkbLayout</TITLE>
|
||||
EekXkbLayout
|
||||
EekXkbLayoutClass
|
||||
EekXkbLayoutPrivate
|
||||
eek_xkb_layout_new
|
||||
eek_xkb_layout_set_names
|
||||
eek_xkb_layout_set_keycodes
|
||||
eek_xkb_layout_set_geometry
|
||||
eek_xkb_layout_set_symbols
|
||||
eek_xkb_layout_get_keycodes
|
||||
eek_xkb_layout_get_geometry
|
||||
eek_xkb_layout_get_symbols
|
||||
<SUBSECTION Standard>
|
||||
EEK_XKB_LAYOUT
|
||||
EEK_IS_XKB_LAYOUT
|
||||
EEK_TYPE_XKB_LAYOUT
|
||||
eek_xkb_layout_get_type
|
||||
EEK_XKB_LAYOUT_CLASS
|
||||
EEK_IS_XKB_LAYOUT_CLASS
|
||||
EEK_XKB_LAYOUT_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-key</FILE>
|
||||
<TITLE>EekKey</TITLE>
|
||||
EekKeyClass
|
||||
EekKeyPrivate
|
||||
EekKey
|
||||
eek_key_set_keycode
|
||||
eek_key_get_keycode
|
||||
eek_key_set_keysyms
|
||||
eek_key_get_keysyms
|
||||
eek_key_get_keysym
|
||||
eek_key_set_index
|
||||
eek_key_get_index
|
||||
eek_key_set_outline
|
||||
eek_key_get_outline
|
||||
eek_key_set_keysym_index
|
||||
eek_key_get_keysym_index
|
||||
<SUBSECTION Standard>
|
||||
EEK_KEY
|
||||
EEK_IS_KEY
|
||||
EEK_TYPE_KEY
|
||||
eek_key_get_type
|
||||
EEK_KEY_CLASS
|
||||
EEK_IS_KEY_CLASS
|
||||
EEK_KEY_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-element</FILE>
|
||||
<TITLE>EekElement</TITLE>
|
||||
EekElementClass
|
||||
EekElementPrivate
|
||||
EekElement
|
||||
eek_element_set_parent
|
||||
eek_element_get_parent
|
||||
eek_element_set_name
|
||||
eek_element_get_name
|
||||
eek_element_set_bounds
|
||||
eek_element_get_bounds
|
||||
eek_element_get_absolute_position
|
||||
<SUBSECTION Standard>
|
||||
EEK_ELEMENT
|
||||
EEK_IS_ELEMENT
|
||||
EEK_TYPE_ELEMENT
|
||||
eek_element_get_type
|
||||
EEK_ELEMENT_CLASS
|
||||
EEK_IS_ELEMENT_CLASS
|
||||
EEK_ELEMENT_GET_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-types</FILE>
|
||||
EekOrientation
|
||||
EekKeysymMatrix
|
||||
EEK_TYPE_KEYSYM_MATRIX
|
||||
eek_keysym_matrix_get_type
|
||||
EekPoint
|
||||
EEK_TYPE_POINT
|
||||
eek_point_get_type
|
||||
EekBounds
|
||||
EEK_TYPE_BOUNDS
|
||||
eek_bounds_get_type
|
||||
eek_bounds_long_side
|
||||
EekOutline
|
||||
EEK_TYPE_OUTLINE
|
||||
eek_outline_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>eek-keysym</FILE>
|
||||
EEK_INVALID_KEYSYM
|
||||
EEK_INVALID_KEYCODE
|
||||
EekKeysymCategory
|
||||
eek_keysym_to_string
|
||||
eek_keysym_get_category
|
||||
</SECTION>
|
||||
147
eek/Makefile.am
147
eek/Makefile.am
@@ -1,147 +0,0 @@
|
||||
# Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
# Copyright (C) 2010 Red Hat, Inc.
|
||||
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2 of
|
||||
# the License, or (at your option) any later version.
|
||||
|
||||
# This library is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this library; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
lib_LTLIBRARIES = \
|
||||
libeek.la \
|
||||
libeek-gtk.la \
|
||||
libeek-xkb.la \
|
||||
libeek-xkl.la
|
||||
|
||||
if HAVE_CLUTTER
|
||||
lib_LTLIBRARIES += libeek-clutter.la
|
||||
endif
|
||||
|
||||
libeek_la_SOURCES = \
|
||||
eek-layout.c \
|
||||
eek-layout.h \
|
||||
eek-element.c \
|
||||
eek-element.h \
|
||||
eek-container.c \
|
||||
eek-container.h \
|
||||
eek-keyboard.c \
|
||||
eek-keyboard.h \
|
||||
eek-section.c \
|
||||
eek-section.h \
|
||||
eek-key.c \
|
||||
eek-key.h \
|
||||
eek-types.h \
|
||||
eek-types.c \
|
||||
eek-keysym.h \
|
||||
eek-keysym.c \
|
||||
eek-special-keysym-labels.h \
|
||||
eek-unicode-keysym-labels.h \
|
||||
eek-keyname-keysym-labels.h
|
||||
|
||||
libeek_la_CFLAGS = $(GOBJECT2_CFLAGS) $(CAIRO_CFLAGS) $(PANGO_CFLAGS)
|
||||
libeek_la_LIBADD = $(GOBJECT2_LIBS) $(CAIRO_LIBS) $(PANGO_LIBS)
|
||||
|
||||
if HAVE_CLUTTER
|
||||
libeek_clutter_la_SOURCES = \
|
||||
eek-clutter-keyboard.c \
|
||||
eek-clutter-keyboard.h \
|
||||
eek-clutter-section.c \
|
||||
eek-clutter-section.h \
|
||||
eek-clutter-key.c \
|
||||
eek-clutter-key.h \
|
||||
eek-clutter-key-actor.c \
|
||||
eek-clutter-key-actor.h \
|
||||
eek-clutter-drawing-context.c \
|
||||
eek-clutter-drawing-context.h \
|
||||
eek-drawing.h \
|
||||
eek-drawing.c \
|
||||
eek-clutter.h
|
||||
|
||||
libeek_clutter_la_CFLAGS = $(CLUTTER_CFLAGS)
|
||||
libeek_clutter_la_LIBADD = libeek.la $(CLUTTER_LIBS)
|
||||
endif
|
||||
|
||||
libeek_gtk_la_SOURCES = \
|
||||
eek-gtk-keyboard.c \
|
||||
eek-gtk-keyboard.h \
|
||||
eek-drawing.h \
|
||||
eek-drawing.c \
|
||||
eek-gtk.h
|
||||
|
||||
libeek_gtk_la_CFLAGS = $(GTK2_CFLAGS)
|
||||
libeek_gtk_la_LIBADD = libeek.la $(GTK2_LIBS)
|
||||
|
||||
libeek_xkb_la_SOURCES = \
|
||||
eek-xkb-layout.h \
|
||||
eek-xkb-layout.c
|
||||
|
||||
libeek_xkb_la_CFLAGS = $(GTK2_CFLAGS) $(XKB_CFLAGS)
|
||||
libeek_xkb_la_LIBADD = libeek.la $(GTK2_LIBS) $(XKB_LIBS)
|
||||
|
||||
libeek_xkl_la_SOURCES = \
|
||||
eek-xkl-layout.h \
|
||||
eek-xkl-layout.c
|
||||
|
||||
libeek_xkl_la_CFLAGS = $(GTK2_CFLAGS) $(LIBXKLAVIER_CFLAGS)
|
||||
libeek_xkl_la_LIBADD = libeek-xkb.la $(GTK2_LIBS) $(LIBXKLAVIER_LIBS)
|
||||
|
||||
eekdir = $(includedir)/eek-$(EEK_API_VERSION)/eek
|
||||
eek_HEADERS = \
|
||||
$(top_srcdir)/eek/eek-element.h \
|
||||
$(top_srcdir)/eek/eek-container.h \
|
||||
$(top_srcdir)/eek/eek-keyboard.h \
|
||||
$(top_srcdir)/eek/eek-section.h \
|
||||
$(top_srcdir)/eek/eek-key.h \
|
||||
$(top_srcdir)/eek/eek-layout.h \
|
||||
$(top_srcdir)/eek/eek-keysym.h \
|
||||
$(top_srcdir)/eek/eek-types.h \
|
||||
$(top_srcdir)/eek/eek-xkb-layout.h \
|
||||
$(top_srcdir)/eek/eek-xkl-layout.h \
|
||||
$(top_srcdir)/eek/eek.h \
|
||||
$(top_srcdir)/eek/eek-xkb.h \
|
||||
$(top_srcdir)/eek/eek-xkl.h
|
||||
|
||||
if HAVE_CLUTTER
|
||||
eek_HEADERS += \
|
||||
$(top_srcdir)/eek/eek-clutter-keyboard.h \
|
||||
$(top_srcdir)/eek/eek-clutter-section.h \
|
||||
$(top_srcdir)/eek/eek-clutter-key.h \
|
||||
$(top_srcdir)/eek/eek-clutter.h
|
||||
endif
|
||||
|
||||
eek-keysym.c: eek-special-keysym-labels.h eek-unicode-keysym-labels.h eek-keyname-keysym-labels.h
|
||||
|
||||
eek-special-keysym-labels.h: special-keysym-labels.txt
|
||||
$(PYTHON) ./gen-keysym-labels.py special_keysym_labels < $< > $@
|
||||
eek-unicode-keysym-labels.h: unicode-keysym-labels.txt
|
||||
$(PYTHON) ./gen-keysym-labels.py unicode_keysym_labels < $< > $@
|
||||
eek-keyname-keysym-labels.h: keyname-keysym-labels.txt
|
||||
$(PYTHON) ./gen-keysym-labels.py keyname_keysym_labels < $< > $@
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libeek.pc \
|
||||
libeek-clutter.pc \
|
||||
libeek-gtk.pc \
|
||||
libeek-xkb.pc \
|
||||
libeek-xkl.pc
|
||||
|
||||
DISTCLEANFILES = \
|
||||
eek-special-keysym-labels.h \
|
||||
eek-unicode-keysym-labels.h \
|
||||
eek-keyname-keysym-labels.h \
|
||||
$(pkgconfig_DATA)
|
||||
|
||||
EXTRA_DIST = \
|
||||
gen-keysym-labels.py \
|
||||
special-keysym-labels.txt \
|
||||
unicode-keysym-labels.txt \
|
||||
keyname-keysym-labels.txt
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-clutter-drawing-context.h"
|
||||
|
||||
G_DEFINE_TYPE (EekClutterDrawingContext, eek_clutter_drawing_context,
|
||||
G_TYPE_INITIALLY_UNOWNED);
|
||||
|
||||
#define EEK_CLUTTER_DRAWING_CONTEXT_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CLUTTER_DRAWING_CONTEXT, EekClutterDrawingContextPrivate))
|
||||
|
||||
struct _EekClutterDrawingContextPrivate
|
||||
{
|
||||
/* outline pointer -> ClutterTexture */
|
||||
GHashTable *outline_textures;
|
||||
|
||||
/* keysym category -> PangoFontDescription * */
|
||||
PangoFontDescription *category_fonts[EEK_KEYSYM_CATEGORY_LAST];
|
||||
};
|
||||
|
||||
static void
|
||||
eek_clutter_drawing_context_dispose (GObject *object)
|
||||
{
|
||||
EekClutterDrawingContextPrivate *priv =
|
||||
EEK_CLUTTER_DRAWING_CONTEXT_GET_PRIVATE(object);
|
||||
if (priv->outline_textures) {
|
||||
g_hash_table_unref (priv->outline_textures);
|
||||
priv->outline_textures = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_drawing_context_finalize (GObject *object)
|
||||
{
|
||||
EekClutterDrawingContextPrivate *priv =
|
||||
EEK_CLUTTER_DRAWING_CONTEXT_GET_PRIVATE(object);
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < EEK_KEYSYM_CATEGORY_LAST; i++)
|
||||
pango_font_description_free (priv->category_fonts[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_drawing_context_class_init (EekClutterDrawingContextClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekClutterDrawingContextPrivate));
|
||||
|
||||
gobject_class->finalize = eek_clutter_drawing_context_finalize;
|
||||
gobject_class->dispose = eek_clutter_drawing_context_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_drawing_context_init (EekClutterDrawingContext *self)
|
||||
{
|
||||
EekClutterDrawingContextPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_CLUTTER_DRAWING_CONTEXT_GET_PRIVATE(self);
|
||||
priv->outline_textures = g_hash_table_new (g_direct_hash, g_direct_equal);
|
||||
memset (priv->category_fonts, 0, sizeof *priv->category_fonts);
|
||||
}
|
||||
|
||||
void
|
||||
eek_clutter_drawing_context_set_outline_texture
|
||||
(EekClutterDrawingContext *context,
|
||||
EekOutline *outline,
|
||||
ClutterActor *texture)
|
||||
{
|
||||
EekClutterDrawingContextPrivate *priv =
|
||||
EEK_CLUTTER_DRAWING_CONTEXT_GET_PRIVATE(context);
|
||||
g_return_if_fail (priv);
|
||||
g_hash_table_insert (context->priv->outline_textures, outline, texture);
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
eek_clutter_drawing_context_get_outline_texture
|
||||
(EekClutterDrawingContext *context,
|
||||
EekOutline *outline)
|
||||
{
|
||||
EekClutterDrawingContextPrivate *priv =
|
||||
EEK_CLUTTER_DRAWING_CONTEXT_GET_PRIVATE(context);
|
||||
g_return_val_if_fail (priv, NULL);
|
||||
return g_hash_table_lookup (context->priv->outline_textures, outline);
|
||||
}
|
||||
|
||||
void
|
||||
eek_clutter_drawing_context_set_category_font
|
||||
(EekClutterDrawingContext *context,
|
||||
EekKeysymCategory category,
|
||||
PangoFontDescription *font)
|
||||
{
|
||||
EekClutterDrawingContextPrivate *priv =
|
||||
EEK_CLUTTER_DRAWING_CONTEXT_GET_PRIVATE(context);
|
||||
g_return_if_fail (priv);
|
||||
priv->category_fonts[category] = pango_font_description_copy (font);
|
||||
}
|
||||
|
||||
PangoFontDescription *
|
||||
eek_clutter_drawing_context_get_category_font
|
||||
(EekClutterDrawingContext *context,
|
||||
EekKeysymCategory category)
|
||||
{
|
||||
EekClutterDrawingContextPrivate *priv =
|
||||
EEK_CLUTTER_DRAWING_CONTEXT_GET_PRIVATE(context);
|
||||
g_return_val_if_fail (priv, NULL);
|
||||
return priv->category_fonts[category];
|
||||
}
|
||||
|
||||
EekClutterDrawingContext *
|
||||
eek_clutter_drawing_context_new (void)
|
||||
{
|
||||
return g_object_new (EEK_TYPE_CLUTTER_DRAWING_CONTEXT, NULL);
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_CLUTTER_DRAWING_CONTEXT_H
|
||||
#define EEK_CLUTTER_DRAWING_CONTEXT_H 1
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include <pango/pango.h>
|
||||
|
||||
#include "eek-keysym.h"
|
||||
#include "eek-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define EEK_TYPE_CLUTTER_DRAWING_CONTEXT (eek_clutter_drawing_context_get_type())
|
||||
#define EEK_CLUTTER_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CLUTTER_DRAWING_CONTEXT, EekClutterDrawingContext))
|
||||
#define EEK_CLUTTER_DRAWING_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CLUTTER_DRAWING_CONTEXT, EekClutterDrawingContextClass))
|
||||
#define EEK_IS_CLUTTER_DRAWING_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CLUTTER_DRAWING_CONTEXT))
|
||||
#define EEK_IS_CLUTTER_DRAWING_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CLUTTER_DRAWING_CONTEXT))
|
||||
#define EEK_CLUTTER_DRAWING_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CLUTTER_DRAWING_CONTEXT, EekClutterDrawingContextClass))
|
||||
|
||||
typedef struct _EekClutterDrawingContext EekClutterDrawingContext;
|
||||
typedef struct _EekClutterDrawingContextClass EekClutterDrawingContextClass;
|
||||
typedef struct _EekClutterDrawingContextPrivate EekClutterDrawingContextPrivate;
|
||||
|
||||
struct _EekClutterDrawingContext
|
||||
{
|
||||
/*< private >*/
|
||||
GInitiallyUnowned parent;
|
||||
|
||||
/*< private >*/
|
||||
EekClutterDrawingContextPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EekClutterDrawingContextClass
|
||||
{
|
||||
/*< private >*/
|
||||
GInitiallyUnownedClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_clutter_drawing_context_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
EekClutterDrawingContext *eek_clutter_drawing_context_new
|
||||
(void);
|
||||
|
||||
void eek_clutter_drawing_context_set_outline_texture
|
||||
(EekClutterDrawingContext *context,
|
||||
EekOutline *outline,
|
||||
ClutterActor *texture);
|
||||
ClutterActor *eek_clutter_drawing_context_get_outline_texture
|
||||
(EekClutterDrawingContext *context,
|
||||
EekOutline *outline);
|
||||
|
||||
void eek_clutter_drawing_context_set_category_font
|
||||
(EekClutterDrawingContext *context,
|
||||
EekKeysymCategory category,
|
||||
PangoFontDescription *fonts);
|
||||
PangoFontDescription *eek_clutter_drawing_context_get_category_font
|
||||
(EekClutterDrawingContext *context,
|
||||
EekKeysymCategory category);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_CLUTTER_DRAWING_CONTEXT_H */
|
||||
@@ -1,375 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <cogl/cogl.h>
|
||||
#include <cogl/cogl-pango.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
#include "eek-clutter-key-actor.h"
|
||||
#include "eek-keysym.h"
|
||||
#include "eek-drawing.h"
|
||||
#include "eek-section.h"
|
||||
#include "eek-keyboard.h"
|
||||
|
||||
#define noKBDRAW_DEBUG
|
||||
|
||||
enum {
|
||||
PRESSED,
|
||||
RELEASED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_TYPE (EekClutterKeyActor, eek_clutter_key_actor,
|
||||
CLUTTER_TYPE_GROUP);
|
||||
|
||||
#define EEK_CLUTTER_KEY_ACTOR_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CLUTTER_KEY_ACTOR, EekClutterKeyActorPrivate))
|
||||
|
||||
struct _EekClutterKeyActorPrivate
|
||||
{
|
||||
EekClutterDrawingContext *context;
|
||||
EekKey *key;
|
||||
ClutterActor *texture;
|
||||
};
|
||||
|
||||
static ClutterActor *get_texture (EekClutterKeyActor *actor);
|
||||
static void draw_key_on_layout (EekClutterKeyActor *actor,
|
||||
PangoLayout *layout);
|
||||
static void key_enlarge (ClutterActor *actor);
|
||||
static void key_shrink (ClutterActor *actor);
|
||||
|
||||
static void
|
||||
eek_clutter_key_actor_real_paint (ClutterActor *self)
|
||||
{
|
||||
EekClutterKeyActorPrivate *priv = EEK_CLUTTER_KEY_ACTOR_GET_PRIVATE (self);
|
||||
PangoLayout *layout;
|
||||
PangoRectangle logical_rect = { 0, };
|
||||
CoglColor color;
|
||||
ClutterGeometry geom;
|
||||
EekBounds bounds;
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(priv->key), &bounds);
|
||||
clutter_actor_set_anchor_point_from_gravity (self,
|
||||
CLUTTER_GRAVITY_CENTER);
|
||||
clutter_actor_set_position (self,
|
||||
bounds.x + bounds.width / 2,
|
||||
bounds.y + bounds.height / 2);
|
||||
|
||||
if (!priv->texture) {
|
||||
priv->texture = get_texture (EEK_CLUTTER_KEY_ACTOR(self));
|
||||
clutter_actor_set_position (priv->texture, 0, 0);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER(self), priv->texture);
|
||||
}
|
||||
|
||||
CLUTTER_ACTOR_CLASS (eek_clutter_key_actor_parent_class)->
|
||||
paint (self);
|
||||
|
||||
/* Draw the label on the key. */
|
||||
layout = clutter_actor_create_pango_layout (self, NULL);
|
||||
draw_key_on_layout (EEK_CLUTTER_KEY_ACTOR(self), layout);
|
||||
pango_layout_get_extents (layout, NULL, &logical_rect);
|
||||
|
||||
/* FIXME: Color should be configurable through a property. */
|
||||
cogl_color_set_from_4ub (&color, 0x80, 0x00, 0x00, 0xff);
|
||||
clutter_actor_get_allocation_geometry (self, &geom);
|
||||
cogl_pango_render_layout
|
||||
(layout,
|
||||
(geom.width - logical_rect.width / PANGO_SCALE) / 2,
|
||||
(geom.height - logical_rect.height / PANGO_SCALE) / 2,
|
||||
&color,
|
||||
0);
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
/* FIXME: This is a workaround for the bug
|
||||
* http://bugzilla.openedhand.com/show_bug.cgi?id=2137 A developer
|
||||
* says this is not a right way to solve the original problem.
|
||||
*/
|
||||
static void
|
||||
eek_clutter_key_actor_real_get_preferred_width (ClutterActor *self,
|
||||
gfloat for_height,
|
||||
gfloat *min_width_p,
|
||||
gfloat *natural_width_p)
|
||||
{
|
||||
PangoLayout *layout;
|
||||
|
||||
/* Draw the label on the key - just to validate the glyph cache. */
|
||||
layout = clutter_actor_create_pango_layout (self, NULL);
|
||||
draw_key_on_layout (EEK_CLUTTER_KEY_ACTOR(self), layout);
|
||||
cogl_pango_ensure_glyph_cache_for_layout (layout);
|
||||
g_object_unref (layout);
|
||||
|
||||
CLUTTER_ACTOR_CLASS (eek_clutter_key_actor_parent_class)->
|
||||
get_preferred_width (self, for_height, min_width_p, natural_width_p);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_actor_real_pressed (EekClutterKeyActor *self)
|
||||
{
|
||||
ClutterActor *actor, *section;
|
||||
|
||||
actor = CLUTTER_ACTOR(self);
|
||||
|
||||
/* Make sure the enlarged key show up on the keys which belong
|
||||
to other sections. */
|
||||
section = clutter_actor_get_parent (actor);
|
||||
clutter_actor_raise_top (section);
|
||||
clutter_actor_raise_top (actor);
|
||||
key_enlarge (actor);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_actor_real_released (EekClutterKeyActor *self)
|
||||
{
|
||||
ClutterActor *actor, *section;
|
||||
|
||||
actor = CLUTTER_ACTOR(self);
|
||||
|
||||
/* Make sure the enlarged key show up on the keys which belong
|
||||
to other sections. */
|
||||
section = clutter_actor_get_parent (actor);
|
||||
clutter_actor_raise_top (section);
|
||||
clutter_actor_raise_top (actor);
|
||||
key_shrink (actor);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_actor_dispose (GObject *object)
|
||||
{
|
||||
EekClutterKeyActorPrivate *priv = EEK_CLUTTER_KEY_ACTOR_GET_PRIVATE(object);
|
||||
|
||||
if (priv->context) {
|
||||
g_object_unref (priv->context);
|
||||
priv->context = NULL;
|
||||
}
|
||||
if (priv->key) {
|
||||
g_object_unref (priv->key);
|
||||
priv->key = NULL;
|
||||
}
|
||||
G_OBJECT_CLASS (eek_clutter_key_actor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_actor_class_init (EekClutterKeyActorClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekClutterKeyActorPrivate));
|
||||
|
||||
actor_class->paint = eek_clutter_key_actor_real_paint;
|
||||
/* FIXME: This is a workaround for the bug
|
||||
* http://bugzilla.openedhand.com/show_bug.cgi?id=2137 A developer
|
||||
* says this is not a right way to solve the original problem.
|
||||
*/
|
||||
actor_class->get_preferred_width =
|
||||
eek_clutter_key_actor_real_get_preferred_width;
|
||||
|
||||
gobject_class->dispose = eek_clutter_key_actor_dispose;
|
||||
|
||||
/* signals */
|
||||
klass->pressed = eek_clutter_key_actor_real_pressed;
|
||||
klass->released = eek_clutter_key_actor_real_released;
|
||||
|
||||
signals[PRESSED] =
|
||||
g_signal_new ("pressed",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(EekClutterKeyActorClass, pressed),
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
signals[RELEASED] =
|
||||
g_signal_new ("released",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(EekClutterKeyActorClass, released),
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
on_button_press_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekClutterKeyActorPrivate *priv =
|
||||
EEK_CLUTTER_KEY_ACTOR_GET_PRIVATE(actor);
|
||||
|
||||
/* priv->key will send back PRESSED event of actor. */
|
||||
g_signal_emit_by_name (priv->key, "pressed");
|
||||
}
|
||||
|
||||
static void
|
||||
on_button_release_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekClutterKeyActorPrivate *priv =
|
||||
EEK_CLUTTER_KEY_ACTOR_GET_PRIVATE(actor);
|
||||
|
||||
/* priv->key will send back RELEASED event of actor. */
|
||||
g_signal_emit_by_name (priv->key, "released");
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_actor_init (EekClutterKeyActor *self)
|
||||
{
|
||||
EekClutterKeyActorPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_CLUTTER_KEY_ACTOR_GET_PRIVATE(self);
|
||||
priv->key = NULL;
|
||||
priv->texture = NULL;
|
||||
|
||||
clutter_actor_set_reactive (CLUTTER_ACTOR(self), TRUE);
|
||||
g_signal_connect (self, "button-press-event",
|
||||
G_CALLBACK (on_button_press_event), NULL);
|
||||
g_signal_connect (self, "button-release-event",
|
||||
G_CALLBACK (on_button_release_event), NULL);
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
eek_clutter_key_actor_new (EekClutterDrawingContext *context, EekKey *key)
|
||||
{
|
||||
EekClutterKeyActor *actor;
|
||||
|
||||
actor = g_object_new (EEK_TYPE_CLUTTER_KEY_ACTOR, NULL);
|
||||
actor->priv->context = context;
|
||||
g_object_ref_sink (actor->priv->context);
|
||||
actor->priv->key = key;
|
||||
g_object_ref_sink (actor->priv->key);
|
||||
return CLUTTER_ACTOR(actor);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
on_key_animate_complete (ClutterAnimation *animation,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterActor *actor = (ClutterActor*)user_data;
|
||||
|
||||
/* reset after effect */
|
||||
clutter_actor_set_opacity (actor, 0xff);
|
||||
clutter_actor_set_scale (actor, 1.0, 1.0);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
key_enlarge (ClutterActor *actor)
|
||||
{
|
||||
clutter_actor_set_scale (actor, 1.0, 1.0);
|
||||
clutter_actor_animate (actor, CLUTTER_EASE_IN_SINE, 150,
|
||||
"scale-x", 1.5,
|
||||
"scale-y", 1.5,
|
||||
NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
key_shrink (ClutterActor *actor)
|
||||
{
|
||||
clutter_actor_set_scale (actor, 1.5, 1.5);
|
||||
clutter_actor_animate (actor, CLUTTER_EASE_OUT_SINE, 150,
|
||||
"scale-x", 1.0,
|
||||
"scale-y", 1.0,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
||||
static ClutterActor *
|
||||
create_texture_for_key (EekKey *key)
|
||||
{
|
||||
ClutterActor *texture;
|
||||
cairo_t *cr;
|
||||
EekOutline *outline;
|
||||
EekBounds bounds;
|
||||
|
||||
outline = eek_key_get_outline (EEK_KEY(key));
|
||||
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
|
||||
|
||||
texture = clutter_cairo_texture_new (bounds.width, bounds.height);
|
||||
cr = clutter_cairo_texture_create (CLUTTER_CAIRO_TEXTURE(texture));
|
||||
eek_draw_outline (cr, outline);
|
||||
cairo_destroy (cr);
|
||||
return texture;
|
||||
}
|
||||
|
||||
static ClutterActor *
|
||||
get_texture (EekClutterKeyActor *actor)
|
||||
{
|
||||
ClutterActor *texture;
|
||||
EekOutline *outline;
|
||||
|
||||
outline = eek_key_get_outline (actor->priv->key);
|
||||
texture =
|
||||
eek_clutter_drawing_context_get_outline_texture (actor->priv->context,
|
||||
outline);
|
||||
if (texture == NULL) {
|
||||
texture = create_texture_for_key (actor->priv->key);
|
||||
eek_clutter_drawing_context_set_outline_texture (actor->priv->context,
|
||||
outline,
|
||||
texture);
|
||||
} else
|
||||
texture = clutter_clone_new (texture);
|
||||
return texture;
|
||||
}
|
||||
|
||||
static void
|
||||
draw_key_on_layout (EekClutterKeyActor *self,
|
||||
PangoLayout *layout)
|
||||
{
|
||||
EekClutterKeyActorPrivate *priv = EEK_CLUTTER_KEY_ACTOR_GET_PRIVATE (self);
|
||||
guint keysym;
|
||||
const gchar *label, *empty_label = "";
|
||||
EekKeysymCategory category;
|
||||
EekBounds bounds;
|
||||
PangoFontDescription *font;
|
||||
|
||||
keysym = eek_key_get_keysym (priv->key);
|
||||
if (keysym == EEK_INVALID_KEYSYM)
|
||||
return;
|
||||
category = eek_keysym_get_category (keysym);
|
||||
if (category == EEK_KEYSYM_CATEGORY_UNKNOWN)
|
||||
return;
|
||||
|
||||
font = eek_clutter_drawing_context_get_category_font (priv->context,
|
||||
category);
|
||||
pango_layout_set_font_description (layout, font);
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(priv->key), &bounds);
|
||||
pango_layout_set_width (layout, PANGO_SCALE * bounds.width);
|
||||
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
|
||||
|
||||
label = eek_keysym_to_string (keysym);
|
||||
if (!label)
|
||||
label = empty_label;
|
||||
eek_draw_text_on_layout (layout, label);
|
||||
if (label != empty_label)
|
||||
g_free ((gpointer)label);
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_CLUTTER_KEY_ACTOR_H
|
||||
#define EEK_CLUTTER_KEY_ACTOR_H 1
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include "eek-clutter-drawing-context.h"
|
||||
#include "eek-key.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define EEK_TYPE_CLUTTER_KEY_ACTOR (eek_clutter_key_actor_get_type())
|
||||
#define EEK_CLUTTER_KEY_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CLUTTER_KEY_ACTOR, EekClutterKeyActor))
|
||||
#define EEK_CLUTTER_KEY_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CLUTTER_KEY_ACTOR, EekClutterKeyActorClass))
|
||||
#define EEK_IS_CLUTTER_KEY_ACTOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CLUTTER_KEY_ACTOR))
|
||||
#define EEK_IS_CLUTTER_KEY_ACTOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CLUTTER_KEY_ACTOR))
|
||||
#define EEK_CLUTTER_KEY_ACTOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CLUTTER_KEY_ACTOR, EekClutterKeyActorClass))
|
||||
|
||||
typedef struct _EekClutterKeyActor EekClutterKeyActor;
|
||||
typedef struct _EekClutterKeyActorClass EekClutterKeyActorClass;
|
||||
typedef struct _EekClutterKeyActorPrivate EekClutterKeyActorPrivate;
|
||||
|
||||
struct _EekClutterKeyActor
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterGroup parent;
|
||||
|
||||
/*< private >*/
|
||||
EekClutterKeyActorPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EekClutterKeyActorClass
|
||||
{
|
||||
/*< private >*/
|
||||
ClutterGroupClass parent_class;
|
||||
|
||||
/* signals */
|
||||
void (* pressed) (EekClutterKeyActor *self);
|
||||
void (* released) (EekClutterKeyActor *self);
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_clutter_key_actor_get_type
|
||||
(void) G_GNUC_CONST;
|
||||
ClutterActor *eek_clutter_key_actor_new (EekClutterDrawingContext *context,
|
||||
EekKey *key);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_CLUTTER_KEY_ACTOR_H */
|
||||
@@ -1,154 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-clutter-key.h"
|
||||
#include "eek-clutter-key-actor.h"
|
||||
|
||||
G_DEFINE_TYPE (EekClutterKey, eek_clutter_key, EEK_TYPE_KEY);
|
||||
|
||||
#define EEK_CLUTTER_KEY_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CLUTTER_KEY, EekClutterKeyPrivate))
|
||||
|
||||
struct _EekClutterKeyPrivate
|
||||
{
|
||||
EekClutterDrawingContext *context;
|
||||
ClutterActor *actor;
|
||||
};
|
||||
|
||||
static void
|
||||
eek_clutter_key_real_set_name (EekElement *self,
|
||||
const gchar *name)
|
||||
{
|
||||
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
|
||||
|
||||
EEK_ELEMENT_CLASS (eek_clutter_key_parent_class)->
|
||||
set_name (self, name);
|
||||
|
||||
if (priv->actor)
|
||||
clutter_actor_set_name (CLUTTER_ACTOR(priv->actor), name);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_real_set_bounds (EekElement *self,
|
||||
EekBounds *bounds)
|
||||
{
|
||||
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(self);
|
||||
|
||||
EEK_ELEMENT_CLASS (eek_clutter_key_parent_class)->
|
||||
set_bounds (self, bounds);
|
||||
|
||||
if (priv->actor) {
|
||||
clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
|
||||
clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_real_pressed (EekKey *key)
|
||||
{
|
||||
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(key);
|
||||
|
||||
if (priv->actor)
|
||||
g_signal_emit_by_name (priv->actor, "pressed");
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_real_released (EekKey *key)
|
||||
{
|
||||
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(key);
|
||||
|
||||
if (priv->actor)
|
||||
g_signal_emit_by_name (priv->actor, "released");
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_dispose (GObject *object)
|
||||
{
|
||||
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(object);
|
||||
|
||||
if (priv->context) {
|
||||
g_object_unref (priv->context);
|
||||
priv->context = NULL;
|
||||
}
|
||||
if (priv->actor) {
|
||||
g_object_unref (priv->actor);
|
||||
priv->actor = NULL;
|
||||
}
|
||||
G_OBJECT_CLASS (eek_clutter_key_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_class_init (EekClutterKeyClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
EekElementClass *element_class = EEK_ELEMENT_CLASS (klass);
|
||||
EekKeyClass *key_class = EEK_KEY_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekClutterKeyPrivate));
|
||||
|
||||
element_class->set_name = eek_clutter_key_real_set_name;
|
||||
element_class->set_bounds = eek_clutter_key_real_set_bounds;
|
||||
gobject_class->dispose = eek_clutter_key_dispose;
|
||||
|
||||
/* signals */
|
||||
key_class->pressed = eek_clutter_key_real_pressed;
|
||||
key_class->released = eek_clutter_key_real_released;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_key_init (EekClutterKey *self)
|
||||
{
|
||||
EekClutterKeyPrivate *priv;
|
||||
priv = self->priv = EEK_CLUTTER_KEY_GET_PRIVATE (self);
|
||||
priv->actor = NULL;
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
eek_clutter_key_get_actor (EekClutterKey *key)
|
||||
{
|
||||
EekClutterKeyPrivate *priv = EEK_CLUTTER_KEY_GET_PRIVATE(key);
|
||||
|
||||
if (!priv->actor) {
|
||||
g_return_val_if_fail (priv->context, NULL);
|
||||
priv->actor = eek_clutter_key_actor_new (priv->context, EEK_KEY(key));
|
||||
g_object_ref_sink (priv->actor);
|
||||
}
|
||||
return priv->actor;
|
||||
}
|
||||
|
||||
EekKey *
|
||||
eek_clutter_key_new (EekClutterDrawingContext *context, gint column, gint row)
|
||||
{
|
||||
EekClutterKey *key;
|
||||
|
||||
g_return_val_if_fail (context, NULL);
|
||||
key = g_object_new (EEK_TYPE_CLUTTER_KEY,
|
||||
"column", column,
|
||||
"row", row,
|
||||
NULL);
|
||||
key->priv->context = context;
|
||||
g_object_ref_sink (key->priv->context);
|
||||
return EEK_KEY(key);
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_CLUTTER_KEY_H
|
||||
#define EEK_CLUTTER_KEY_H 1
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include "eek-clutter-drawing-context.h"
|
||||
#include "eek-key.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define EEK_TYPE_CLUTTER_KEY (eek_clutter_key_get_type())
|
||||
#define EEK_CLUTTER_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CLUTTER_KEY, EekClutterKey))
|
||||
#define EEK_CLUTTER_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CLUTTER_KEY, EekClutterKeyClass))
|
||||
#define EEK_IS_CLUTTER_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CLUTTER_KEY))
|
||||
#define EEK_IS_CLUTTER_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CLUTTER_KEY))
|
||||
#define EEK_CLUTTER_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CLUTTER_KEY, EekClutterKeyClass))
|
||||
|
||||
typedef struct _EekClutterKey EekClutterKey;
|
||||
typedef struct _EekClutterKeyClass EekClutterKeyClass;
|
||||
typedef struct _EekClutterKeyPrivate EekClutterKeyPrivate;
|
||||
|
||||
struct _EekClutterKey
|
||||
{
|
||||
/*< private >*/
|
||||
EekKey parent;
|
||||
|
||||
/*< private >*/
|
||||
EekClutterKeyPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EekClutterKeyClass
|
||||
{
|
||||
/*< private >*/
|
||||
EekKeyClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_clutter_key_get_type (void) G_GNUC_CONST;
|
||||
EekKey * eek_clutter_key_new (EekClutterDrawingContext *context,
|
||||
gint column,
|
||||
gint row);
|
||||
ClutterActor *eek_clutter_key_get_actor (EekClutterKey *key);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_CLUTTER_KEY_H */
|
||||
@@ -1,316 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:eek-clutter-keyboard
|
||||
* @short_description: #EekKeyboard that can be converted into a #ClutterActor
|
||||
*/
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-clutter-keyboard.h"
|
||||
#include "eek-clutter-drawing-context.h"
|
||||
#include "eek-keyboard.h"
|
||||
#include "eek-drawing.h"
|
||||
|
||||
G_DEFINE_TYPE (EekClutterKeyboard, eek_clutter_keyboard, EEK_TYPE_KEYBOARD);
|
||||
|
||||
#define EEK_CLUTTER_KEYBOARD_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CLUTTER_KEYBOARD, EekClutterKeyboardPrivate))
|
||||
|
||||
|
||||
struct _EekClutterKeyboardPrivate
|
||||
{
|
||||
EekClutterDrawingContext *context;
|
||||
ClutterActor *actor;
|
||||
|
||||
guint key_press_event_handler;
|
||||
guint key_release_event_handler;
|
||||
};
|
||||
|
||||
static void
|
||||
eek_clutter_keyboard_real_set_name (EekElement *self,
|
||||
const gchar *name)
|
||||
{
|
||||
EekClutterKeyboardPrivate *priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(self);
|
||||
|
||||
EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
|
||||
set_name (self, name);
|
||||
|
||||
if (priv->actor)
|
||||
clutter_actor_set_name (priv->actor, name);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_keyboard_real_set_bounds (EekElement *self,
|
||||
EekBounds *bounds)
|
||||
{
|
||||
EekClutterKeyboardPrivate *priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(self);
|
||||
|
||||
EEK_ELEMENT_CLASS (eek_clutter_keyboard_parent_class)->
|
||||
set_bounds (self, bounds);
|
||||
|
||||
if (priv->actor) {
|
||||
clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
|
||||
clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
key_pressed_event (EekSection *section,
|
||||
EekKey *key,
|
||||
EekKeyboard *keyboard)
|
||||
{
|
||||
g_signal_emit_by_name (keyboard, "key-pressed", key);
|
||||
}
|
||||
|
||||
static void
|
||||
key_released_event (EekSection *section,
|
||||
EekKey *key,
|
||||
EekKeyboard *keyboard)
|
||||
{
|
||||
g_signal_emit_by_name (keyboard, "key-released", key);
|
||||
}
|
||||
|
||||
static EekSection *
|
||||
eek_clutter_keyboard_real_create_section (EekKeyboard *self)
|
||||
{
|
||||
EekClutterKeyboardPrivate *priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(self);
|
||||
EekSection *section;
|
||||
ClutterActor *actor;
|
||||
|
||||
if (!priv->context) {
|
||||
priv->context = eek_clutter_drawing_context_new ();
|
||||
g_object_ref_sink (G_OBJECT(priv->context));
|
||||
}
|
||||
|
||||
section = eek_clutter_section_new (priv->context);
|
||||
g_return_val_if_fail (section, NULL);
|
||||
|
||||
g_signal_connect (section, "key-pressed",
|
||||
G_CALLBACK(key_pressed_event), self);
|
||||
g_signal_connect (section, "key-released",
|
||||
G_CALLBACK(key_released_event), self);
|
||||
|
||||
EEK_CONTAINER_GET_CLASS(self)->add_child (EEK_CONTAINER(self),
|
||||
EEK_ELEMENT(section));
|
||||
|
||||
actor = eek_clutter_keyboard_get_actor (EEK_CLUTTER_KEYBOARD(self));
|
||||
clutter_container_add_actor
|
||||
(CLUTTER_CONTAINER(actor),
|
||||
eek_clutter_section_get_actor (EEK_CLUTTER_SECTION(section)));
|
||||
|
||||
return section;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_keyboard_dispose (GObject *object)
|
||||
{
|
||||
EekClutterKeyboardPrivate *priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(object);
|
||||
|
||||
if (priv->context) {
|
||||
g_object_unref (G_OBJECT(priv->context));
|
||||
priv->context = NULL;
|
||||
}
|
||||
if (priv->actor) {
|
||||
ClutterActor *stage;
|
||||
|
||||
stage = clutter_actor_get_stage (priv->actor);
|
||||
if (stage) {
|
||||
g_signal_handler_disconnect (stage,
|
||||
priv->key_press_event_handler);
|
||||
g_signal_handler_disconnect (stage,
|
||||
priv->key_release_event_handler);
|
||||
}
|
||||
g_object_unref (priv->actor);
|
||||
priv->actor = NULL;
|
||||
}
|
||||
G_OBJECT_CLASS (eek_clutter_keyboard_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_keyboard_class_init (EekClutterKeyboardClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
EekElementClass *element_class = EEK_ELEMENT_CLASS (klass);
|
||||
EekKeyboardClass *keyboard_class = EEK_KEYBOARD_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekClutterKeyboardPrivate));
|
||||
|
||||
keyboard_class->create_section = eek_clutter_keyboard_real_create_section;
|
||||
element_class->set_name = eek_clutter_keyboard_real_set_name;
|
||||
element_class->set_bounds = eek_clutter_keyboard_real_set_bounds;
|
||||
gobject_class->dispose = eek_clutter_keyboard_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_keyboard_init (EekClutterKeyboard *self)
|
||||
{
|
||||
EekClutterKeyboardPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_CLUTTER_KEYBOARD_GET_PRIVATE(self);
|
||||
priv->actor = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_clutter_keyboard_new:
|
||||
*
|
||||
* Create a new #EekClutterKeyboard.
|
||||
*/
|
||||
EekKeyboard*
|
||||
eek_clutter_keyboard_new (void)
|
||||
{
|
||||
return g_object_new (EEK_TYPE_CLUTTER_KEYBOARD, NULL);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_clutter_key_press_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint keycode;
|
||||
EekKey *key;
|
||||
|
||||
keycode = clutter_event_get_key_code (event);
|
||||
key = eek_keyboard_find_key_by_keycode (user_data, keycode);
|
||||
if (key) {
|
||||
g_signal_emit_by_name (key, "pressed", NULL);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_clutter_key_release_event (ClutterActor *actor,
|
||||
ClutterEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
guint keycode;
|
||||
EekKey *key;
|
||||
|
||||
keycode = clutter_event_get_key_code (event);
|
||||
key = eek_keyboard_find_key_by_keycode (user_data, keycode);
|
||||
if (key) {
|
||||
g_signal_emit_by_name (key, "released", NULL);
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_clutter_stage_resize (GObject *object,
|
||||
GParamSpec *param_spec,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterActor *stage = CLUTTER_ACTOR(object);
|
||||
EekClutterKeyboard *keyboard = user_data;
|
||||
GValue value = {0};
|
||||
gfloat width, height, scale;
|
||||
EekBounds bounds;
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||
g_object_get (G_OBJECT(stage), "width", &width, NULL);
|
||||
g_object_get (G_OBJECT(stage), "height", &height, NULL);
|
||||
|
||||
g_value_init (&value, G_TYPE_DOUBLE);
|
||||
|
||||
scale = width > height ? width / bounds.width : height / bounds.height;
|
||||
|
||||
g_value_set_double (&value, scale);
|
||||
g_object_set_property (G_OBJECT (stage),
|
||||
"scale-x",
|
||||
&value);
|
||||
|
||||
g_value_set_double (&value, scale);
|
||||
g_object_set_property (G_OBJECT (stage),
|
||||
"scale-y",
|
||||
&value);
|
||||
}
|
||||
|
||||
static void
|
||||
on_clutter_realize (ClutterActor *actor,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekClutterKeyboard *keyboard = user_data;
|
||||
EekClutterKeyboardPrivate *priv =
|
||||
EEK_CLUTTER_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
ClutterActor *stage;
|
||||
|
||||
stage = clutter_actor_get_stage (priv->actor);
|
||||
priv->key_press_event_handler =
|
||||
g_signal_connect (stage, "key-press-event",
|
||||
G_CALLBACK (on_clutter_key_press_event), keyboard);
|
||||
priv->key_release_event_handler =
|
||||
g_signal_connect (stage, "key-release-event",
|
||||
G_CALLBACK (on_clutter_key_release_event), keyboard);
|
||||
g_signal_connect (stage, "notify::width",
|
||||
G_CALLBACK (on_clutter_stage_resize), keyboard);
|
||||
g_signal_connect (stage, "notify::height",
|
||||
G_CALLBACK (on_clutter_stage_resize), keyboard);
|
||||
}
|
||||
|
||||
static void
|
||||
update_category_fonts (EekClutterKeyboard *keyboard)
|
||||
{
|
||||
EekClutterKeyboardPrivate *priv =
|
||||
EEK_CLUTTER_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
PangoContext *context;
|
||||
PangoLayout *layout;
|
||||
PangoFontDescription *fonts[EEK_KEYSYM_CATEGORY_LAST], *base_font;
|
||||
gint i;
|
||||
|
||||
context = clutter_actor_get_pango_context (priv->actor);
|
||||
layout = pango_layout_new (context);
|
||||
base_font = pango_font_description_from_string ("Sans");
|
||||
pango_layout_set_font_description (layout, base_font);
|
||||
pango_font_description_free (base_font);
|
||||
eek_get_fonts (EEK_KEYBOARD(keyboard),
|
||||
layout,
|
||||
(PangoFontDescription **)&fonts);
|
||||
for (i = 0; i < EEK_KEYSYM_CATEGORY_LAST; i++) {
|
||||
eek_clutter_drawing_context_set_category_font (priv->context,
|
||||
i,
|
||||
fonts[i]);
|
||||
pango_font_description_free (fonts[i]);
|
||||
}
|
||||
g_object_unref (G_OBJECT(layout));
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
eek_clutter_keyboard_get_actor (EekClutterKeyboard *keyboard)
|
||||
{
|
||||
EekClutterKeyboardPrivate *priv =
|
||||
EEK_CLUTTER_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
if (!priv->actor) {
|
||||
priv->actor = clutter_group_new ();
|
||||
g_object_ref_sink (priv->actor);
|
||||
g_signal_connect (priv->actor, "realize",
|
||||
G_CALLBACK (on_clutter_realize), keyboard);
|
||||
g_return_val_if_fail (priv->actor, NULL);
|
||||
|
||||
eek_keyboard_realize (EEK_KEYBOARD(keyboard));
|
||||
update_category_fonts (keyboard);
|
||||
}
|
||||
return priv->actor;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_CLUTTER_KEYBOARD_H
|
||||
#define EEK_CLUTTER_KEYBOARD_H 1
|
||||
|
||||
#include "eek-clutter-section.h"
|
||||
#include "eek-keyboard.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define EEK_TYPE_CLUTTER_KEYBOARD (eek_clutter_keyboard_get_type())
|
||||
#define EEK_CLUTTER_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CLUTTER_KEYBOARD, EekClutterKeyboard))
|
||||
#define EEK_CLUTTER_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CLUTTER_KEYBOARD, EekClutterKeyboardClass))
|
||||
#define EEK_IS_CLUTTER_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CLUTTER_KEYBOARD))
|
||||
#define EEK_IS_CLUTTER_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CLUTTER_KEYBOARD))
|
||||
#define EEK_CLUTTER_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CLUTTER_KEYBOARD, EekClutterKeyboardClass))
|
||||
|
||||
typedef struct _EekClutterKeyboard EekClutterKeyboard;
|
||||
typedef struct _EekClutterKeyboardClass EekClutterKeyboardClass;
|
||||
typedef struct _EekClutterKeyboardPrivate EekClutterKeyboardPrivate;
|
||||
|
||||
struct _EekClutterKeyboard
|
||||
{
|
||||
/*< private >*/
|
||||
EekKeyboard parent;
|
||||
|
||||
EekClutterKeyboardPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EekClutterKeyboardClass
|
||||
{
|
||||
/*< private >*/
|
||||
EekKeyboardClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_clutter_keyboard_get_type (void) G_GNUC_CONST;
|
||||
EekKeyboard *eek_clutter_keyboard_new (void);
|
||||
ClutterActor *eek_clutter_keyboard_get_actor (EekClutterKeyboard *keyboard);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_CLUTTER_KEYBOARD_H */
|
||||
@@ -1,190 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-clutter-section.h"
|
||||
|
||||
G_DEFINE_TYPE (EekClutterSection, eek_clutter_section, EEK_TYPE_SECTION);
|
||||
|
||||
#define EEK_CLUTTER_SECTION_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CLUTTER_SECTION, EekClutterSectionPrivate))
|
||||
|
||||
struct _EekClutterSectionPrivate
|
||||
{
|
||||
EekClutterDrawingContext *context;
|
||||
ClutterActor *actor;
|
||||
};
|
||||
|
||||
static void
|
||||
eek_clutter_section_real_set_name (EekElement *self,
|
||||
const gchar *name)
|
||||
{
|
||||
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
|
||||
|
||||
EEK_ELEMENT_CLASS (eek_clutter_section_parent_class)->
|
||||
set_name (self, name);
|
||||
|
||||
if (priv->actor)
|
||||
clutter_actor_set_name (priv->actor, name);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_section_real_set_bounds (EekElement *self,
|
||||
EekBounds *bounds)
|
||||
{
|
||||
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
|
||||
|
||||
EEK_ELEMENT_CLASS (eek_clutter_section_parent_class)->
|
||||
set_bounds (self, bounds);
|
||||
|
||||
if (priv->actor) {
|
||||
clutter_actor_set_position (priv->actor, bounds->x, bounds->y);
|
||||
clutter_actor_set_size (priv->actor, bounds->width, bounds->height);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_section_real_set_angle (EekSection *self,
|
||||
gint angle)
|
||||
{
|
||||
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
|
||||
|
||||
EEK_SECTION_CLASS (eek_clutter_section_parent_class)->
|
||||
set_angle (self, angle);
|
||||
|
||||
g_return_if_fail (priv->actor);
|
||||
|
||||
clutter_actor_set_rotation (priv->actor,
|
||||
CLUTTER_Z_AXIS,
|
||||
eek_section_get_angle (self),
|
||||
0, 0, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
pressed_event (EekKey *key, gpointer user_data)
|
||||
{
|
||||
g_signal_emit_by_name (user_data, "key-pressed", key);
|
||||
}
|
||||
|
||||
static void
|
||||
released_event (EekKey *key, gpointer user_data)
|
||||
{
|
||||
g_signal_emit_by_name (user_data, "key-released", key);
|
||||
}
|
||||
|
||||
static EekKey *
|
||||
eek_clutter_section_real_create_key (EekSection *self,
|
||||
gint column,
|
||||
gint row)
|
||||
{
|
||||
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(self);
|
||||
EekKey *key;
|
||||
gint num_columns, num_rows;
|
||||
EekOrientation orientation;
|
||||
ClutterActor *actor;
|
||||
|
||||
num_rows = eek_section_get_n_rows (self);
|
||||
g_return_val_if_fail (0 <= row && row < num_rows, NULL);
|
||||
eek_section_get_row (self, row, &num_columns, &orientation);
|
||||
g_return_val_if_fail (column < num_columns, NULL);
|
||||
|
||||
key = eek_clutter_key_new (priv->context, column, row);
|
||||
g_return_val_if_fail (key, NULL);
|
||||
|
||||
g_signal_connect (key, "pressed", G_CALLBACK(pressed_event), self);
|
||||
g_signal_connect (key, "released", G_CALLBACK(released_event), self);
|
||||
|
||||
EEK_CONTAINER_GET_CLASS(self)->add_child (EEK_CONTAINER(self),
|
||||
EEK_ELEMENT(key));
|
||||
|
||||
actor = eek_clutter_section_get_actor (EEK_CLUTTER_SECTION(self));
|
||||
clutter_container_add_actor
|
||||
(CLUTTER_CONTAINER(actor),
|
||||
eek_clutter_key_get_actor (EEK_CLUTTER_KEY(key)));
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_section_dispose (GObject *object)
|
||||
{
|
||||
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(object);
|
||||
|
||||
if (priv->context) {
|
||||
g_object_unref (priv->context);
|
||||
priv->context = NULL;
|
||||
}
|
||||
if (priv->actor) {
|
||||
g_object_unref (priv->actor);
|
||||
priv->actor = NULL;
|
||||
}
|
||||
G_OBJECT_CLASS (eek_clutter_section_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_section_class_init (EekClutterSectionClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
EekElementClass *element_class = EEK_ELEMENT_CLASS (klass);
|
||||
EekSectionClass *section_class = EEK_SECTION_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (EekClutterSectionPrivate));
|
||||
|
||||
section_class->set_angle = eek_clutter_section_real_set_angle;
|
||||
section_class->create_key = eek_clutter_section_real_create_key;
|
||||
element_class->set_name = eek_clutter_section_real_set_name;
|
||||
element_class->set_bounds = eek_clutter_section_real_set_bounds;
|
||||
gobject_class->dispose = eek_clutter_section_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_clutter_section_init (EekClutterSection *self)
|
||||
{
|
||||
EekClutterSectionPrivate *priv;
|
||||
priv = self->priv = EEK_CLUTTER_SECTION_GET_PRIVATE (self);
|
||||
priv->actor = NULL;
|
||||
}
|
||||
|
||||
ClutterActor *
|
||||
eek_clutter_section_get_actor (EekClutterSection *section)
|
||||
{
|
||||
EekClutterSectionPrivate *priv = EEK_CLUTTER_SECTION_GET_PRIVATE(section);
|
||||
if (!priv->actor) {
|
||||
priv->actor = clutter_group_new ();
|
||||
g_object_ref_sink (priv->actor);
|
||||
}
|
||||
return priv->actor;
|
||||
}
|
||||
|
||||
EekSection *
|
||||
eek_clutter_section_new (EekClutterDrawingContext *context)
|
||||
{
|
||||
EekClutterSection *section;
|
||||
|
||||
g_return_val_if_fail (context, NULL);
|
||||
section = g_object_new (EEK_TYPE_CLUTTER_SECTION, NULL);
|
||||
section->priv->context = context;
|
||||
g_object_ref_sink (G_OBJECT(section->priv->context));
|
||||
|
||||
return EEK_SECTION(section);
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_CLUTTER_SECTION_H
|
||||
#define EEK_CLUTTER_SECTION_H 1
|
||||
|
||||
#include "eek-clutter-drawing-context.h"
|
||||
#include "eek-clutter-key.h"
|
||||
#include "eek-section.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define EEK_TYPE_CLUTTER_SECTION (eek_clutter_section_get_type())
|
||||
#define EEK_CLUTTER_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CLUTTER_SECTION, EekClutterSection))
|
||||
#define EEK_CLUTTER_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CLUTTER_SECTION, EekClutterSectionClass))
|
||||
#define EEK_IS_CLUTTER_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CLUTTER_SECTION))
|
||||
#define EEK_IS_CLUTTER_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CLUTTER_SECTION))
|
||||
#define EEK_CLUTTER_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CLUTTER_SECTION, EekClutterSectionClass))
|
||||
|
||||
typedef struct _EekClutterSection EekClutterSection;
|
||||
typedef struct _EekClutterSectionClass EekClutterSectionClass;
|
||||
typedef struct _EekClutterSectionPrivate EekClutterSectionPrivate;
|
||||
|
||||
struct _EekClutterSection
|
||||
{
|
||||
/*< private >*/
|
||||
EekSection parent;
|
||||
|
||||
EekClutterSectionPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EekClutterSectionClass
|
||||
{
|
||||
/*< private >*/
|
||||
EekSectionClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_clutter_section_get_type (void) G_GNUC_CONST;
|
||||
EekSection * eek_clutter_section_new (EekClutterDrawingContext *context);
|
||||
ClutterActor *eek_clutter_section_get_actor (EekClutterSection *section);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_CLUTTER_SECTION_H */
|
||||
@@ -1,270 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:eek-container
|
||||
* @short_description: Base class of a keyboard container
|
||||
*
|
||||
* The #EekContainerClass class represents a keyboard container, which
|
||||
* shall be used to implement #EekKeyboard and #EekSection.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-container.h"
|
||||
|
||||
enum {
|
||||
CHILD_ADDED,
|
||||
CHILD_REMOVED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (EekContainer, eek_container, EEK_TYPE_ELEMENT);
|
||||
|
||||
#define EEK_CONTAINER_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_CONTAINER, EekContainerPrivate))
|
||||
|
||||
|
||||
struct _EekContainerPrivate
|
||||
{
|
||||
GSList *children;
|
||||
};
|
||||
|
||||
static void
|
||||
eek_container_real_add_child (EekContainer *self,
|
||||
EekElement *child)
|
||||
{
|
||||
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(self);
|
||||
|
||||
g_return_if_fail (EEK_IS_ELEMENT(child));
|
||||
g_object_ref_sink (child);
|
||||
|
||||
priv->children = g_slist_prepend (priv->children, child);
|
||||
eek_element_set_parent (child, EEK_ELEMENT(self));
|
||||
}
|
||||
|
||||
static void
|
||||
eek_container_real_remove_child (EekContainer *self,
|
||||
EekElement *child)
|
||||
{
|
||||
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(self);
|
||||
GSList *head;
|
||||
|
||||
g_return_if_fail (EEK_IS_ELEMENT(child));
|
||||
head = g_slist_find (priv->children, child);
|
||||
g_return_if_fail (head);
|
||||
g_object_unref (child);
|
||||
priv->children = g_slist_remove_link (priv->children, head);
|
||||
eek_element_set_parent (child, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_container_real_foreach_child (EekContainer *self,
|
||||
EekCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(self);
|
||||
GSList *head;
|
||||
|
||||
for (head = priv->children; head; head = g_slist_next (head))
|
||||
(*callback) (EEK_ELEMENT(head->data), user_data);
|
||||
}
|
||||
|
||||
static EekElement *
|
||||
eek_container_real_find (EekContainer *self,
|
||||
EekCompareFunc func,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(self);
|
||||
GSList *head;
|
||||
|
||||
head = g_slist_find_custom (priv->children, user_data, (GCompareFunc)func);
|
||||
if (head)
|
||||
return head->data;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_container_dispose (GObject *object)
|
||||
{
|
||||
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(object);
|
||||
GSList *head;
|
||||
|
||||
for (head = priv->children; head; head = g_slist_next (head)) {
|
||||
if (head->data) {
|
||||
g_object_unref (head->data);
|
||||
head->data = NULL;
|
||||
}
|
||||
}
|
||||
G_OBJECT_CLASS(eek_container_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_container_finalize (GObject *object)
|
||||
{
|
||||
EekContainerPrivate *priv = EEK_CONTAINER_GET_PRIVATE(object);
|
||||
|
||||
g_slist_free (priv->children);
|
||||
G_OBJECT_CLASS(eek_container_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_container_class_init (EekContainerClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekContainerPrivate));
|
||||
|
||||
klass->add_child = eek_container_real_add_child;
|
||||
klass->remove_child = eek_container_real_remove_child;
|
||||
klass->foreach_child = eek_container_real_foreach_child;
|
||||
klass->find = eek_container_real_find;
|
||||
|
||||
gobject_class->finalize = eek_container_finalize;
|
||||
gobject_class->dispose = eek_container_dispose;
|
||||
|
||||
/**
|
||||
* EekContainer::child-added:
|
||||
* @container: an #EekContainer
|
||||
* @element: an #EekElement
|
||||
*
|
||||
* The ::child-added signal is emitted each time an element is
|
||||
* added to @container.
|
||||
*/
|
||||
signals[CHILD_ADDED] =
|
||||
g_signal_new ("child-added",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(EekContainerClass, child_added),
|
||||
NULL, NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
EEK_TYPE_ELEMENT);
|
||||
|
||||
/**
|
||||
* EekContainer::child-removed:
|
||||
* @container: an #EekContainer
|
||||
* @element: an #EekElement
|
||||
*
|
||||
* The ::child-removed signal is emitted each time an element is
|
||||
* removed from @container.
|
||||
*/
|
||||
signals[CHILD_REMOVED] =
|
||||
g_signal_new ("child-removed",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(EekContainerClass, child_removed),
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE, 1,
|
||||
EEK_TYPE_ELEMENT);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_container_init (EekContainer *self)
|
||||
{
|
||||
EekContainerPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_CONTAINER_GET_PRIVATE(self);
|
||||
priv->children = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_container_foreach_child:
|
||||
* @container: an #EekContainer
|
||||
* @callback: an #EekCallback
|
||||
* @user_data: additional data passed to @callback
|
||||
*
|
||||
* Enumerate children of @container and run @callback with each child.
|
||||
*/
|
||||
void
|
||||
eek_container_foreach_child (EekContainer *container,
|
||||
EekCallback callback,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_CONTAINER(container));
|
||||
EEK_CONTAINER_GET_CLASS(container)->foreach_child (container,
|
||||
callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_container_find:
|
||||
* @container: an #EekContainer
|
||||
* @func: function to be used to compare two children
|
||||
* @user_data: additional data passed to @func
|
||||
*
|
||||
* Find a child which matches the criteria supplied as @func, in @container.
|
||||
* Returns: an #EekElement or NULL on failure
|
||||
*/
|
||||
EekElement *
|
||||
eek_container_find (EekContainer *container,
|
||||
EekCompareFunc func,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_CONTAINER(container), NULL);
|
||||
return EEK_CONTAINER_GET_CLASS(container)->find (container,
|
||||
func,
|
||||
user_data);
|
||||
}
|
||||
|
||||
struct _FbpData
|
||||
{
|
||||
EekKey *key;
|
||||
gint x, y;
|
||||
};
|
||||
typedef struct _FbpData FbpData;
|
||||
|
||||
static gint
|
||||
compare_element_by_position (EekElement *element, gpointer user_data)
|
||||
{
|
||||
EekBounds bounds;
|
||||
FbpData *data = user_data;
|
||||
|
||||
eek_element_get_bounds (element, &bounds);
|
||||
if (bounds.x <= data->x && bounds.y <= data->y &&
|
||||
data->x <= (bounds.x + bounds.width) &&
|
||||
data->y <= (bounds.y + bounds.height))
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
EekElement *
|
||||
eek_container_find_by_position (EekContainer *container,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
EekBounds bounds;
|
||||
FbpData data;
|
||||
|
||||
g_return_val_if_fail (EEK_IS_CONTAINER(container), NULL);
|
||||
eek_element_get_bounds (EEK_ELEMENT(container), &bounds);
|
||||
data.x = x - bounds.x;
|
||||
data.y = y - bounds.y;
|
||||
return eek_container_find (container,
|
||||
compare_element_by_position,
|
||||
&data);
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_CONTAINER_H
|
||||
#define EEK_CONTAINER_H 1
|
||||
|
||||
#include "eek-element.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEK_TYPE_CONTAINER (eek_container_get_type())
|
||||
#define EEK_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_CONTAINER, EekContainer))
|
||||
#define EEK_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_CONTAINER, EekContainerClass))
|
||||
#define EEK_IS_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_CONTAINER))
|
||||
#define EEK_IS_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_CONTAINER))
|
||||
#define EEK_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_CONTAINER, EekContainerClass))
|
||||
|
||||
typedef struct _EekContainerClass EekContainerClass;
|
||||
typedef struct _EekContainerPrivate EekContainerPrivate;
|
||||
|
||||
typedef void (*EekCallback) (EekElement *element, gpointer user_data);
|
||||
typedef gint (*EekCompareFunc) (EekElement *element, gpointer user_data);
|
||||
|
||||
struct _EekContainer
|
||||
{
|
||||
/*< private >*/
|
||||
EekElement parent;
|
||||
|
||||
EekContainerPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* EekContainerClass:
|
||||
* @foreach_child: virtual function for iterating over the container's children
|
||||
* @find: virtual function for looking up a child
|
||||
* @child_added: class handler for #EekContainer::child-added
|
||||
* @child_removed: class handler for #EekContainer::child-added
|
||||
*/
|
||||
struct _EekContainerClass
|
||||
{
|
||||
/*< private >*/
|
||||
EekElementClass parent_class;
|
||||
|
||||
void (* add_child) (EekContainer *self,
|
||||
EekElement *element);
|
||||
|
||||
void (* remove_child) (EekContainer *self,
|
||||
EekElement *element);
|
||||
|
||||
/*< public >*/
|
||||
void (* foreach_child) (EekContainer *self,
|
||||
EekCallback callback,
|
||||
gpointer user_data);
|
||||
EekElement *(* find) (EekContainer *self,
|
||||
EekCompareFunc func,
|
||||
gpointer user_data);
|
||||
|
||||
/* signals */
|
||||
void (* child_added) (EekContainer *self,
|
||||
EekElement *element);
|
||||
void (* child_removed) (EekContainer *self,
|
||||
EekElement *element);
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_container_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void eek_container_foreach_child (EekContainer *container,
|
||||
EekCallback callback,
|
||||
gpointer user_data);
|
||||
EekElement *eek_container_find (EekContainer *container,
|
||||
EekCompareFunc func,
|
||||
gpointer user_data);
|
||||
EekElement *eek_container_find_by_position (EekContainer *container,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_CONTAINER_H */
|
||||
@@ -1,462 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-keyboard.h"
|
||||
#include "eek-key.h"
|
||||
#include "eek-drawing.h"
|
||||
#include "eek-keysym.h"
|
||||
|
||||
|
||||
void
|
||||
eek_draw_text_on_layout (PangoLayout *layout,
|
||||
const gchar *text)
|
||||
{
|
||||
/* pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER); */
|
||||
pango_layout_set_text (layout, text, -1);
|
||||
}
|
||||
|
||||
struct _GetFontSizeCallbackData
|
||||
{
|
||||
PangoLayout *layout;
|
||||
EekKeysymCategory category;
|
||||
gint minimum_font_size;
|
||||
gint font_size;
|
||||
};
|
||||
typedef struct _GetFontSizeCallbackData GetFontSizeCallbackData;
|
||||
|
||||
static gint
|
||||
get_font_size (const gchar *text,
|
||||
EekBounds *bounds,
|
||||
PangoLayout *layout)
|
||||
{
|
||||
gdouble scale_x, scale_y;
|
||||
const PangoFontDescription *base_font_desc;
|
||||
PangoFontDescription *font_desc;
|
||||
PangoRectangle logical_rect = { 0, };
|
||||
gint font_size;
|
||||
|
||||
layout = pango_layout_copy (layout);
|
||||
base_font_desc = pango_layout_get_font_description (layout);
|
||||
font_desc = pango_font_description_copy (base_font_desc);
|
||||
|
||||
font_size = eek_bounds_long_side (bounds) * PANGO_SCALE;
|
||||
pango_font_description_set_size (font_desc, font_size);
|
||||
pango_layout_set_font_description (layout, font_desc);
|
||||
pango_font_description_free (font_desc);
|
||||
|
||||
eek_draw_text_on_layout (layout, text);
|
||||
pango_layout_get_extents (layout, NULL, &logical_rect);
|
||||
|
||||
scale_x = scale_y = 1.0;
|
||||
if (logical_rect.width > bounds->width * PANGO_SCALE)
|
||||
scale_x = bounds->width * PANGO_SCALE / logical_rect.width;
|
||||
if (logical_rect.height > bounds->height * PANGO_SCALE)
|
||||
scale_y = bounds->height * PANGO_SCALE / logical_rect.height;
|
||||
g_object_unref (layout);
|
||||
return font_size * (scale_x < scale_y ? scale_x : scale_y);
|
||||
}
|
||||
|
||||
static void
|
||||
egf_key_callback (EekElement *element,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekKey *key = EEK_KEY(element);
|
||||
GetFontSizeCallbackData *data = user_data;
|
||||
gdouble font_size;
|
||||
guint keysym;
|
||||
EekBounds bounds;
|
||||
const gchar *label;
|
||||
|
||||
keysym = eek_key_get_keysym (key);
|
||||
if (keysym == EEK_INVALID_KEYSYM ||
|
||||
eek_keysym_get_category (keysym) != data->category)
|
||||
return;
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
|
||||
label = eek_keysym_to_string (keysym);
|
||||
font_size = get_font_size (label, &bounds, data->layout);
|
||||
if (font_size < data->font_size && font_size >= data->minimum_font_size)
|
||||
data->font_size = font_size;
|
||||
}
|
||||
|
||||
static void
|
||||
egf_section_callback (EekElement *element,
|
||||
gpointer user_data)
|
||||
{
|
||||
eek_container_foreach_child (EEK_CONTAINER(element),
|
||||
egf_key_callback,
|
||||
user_data);
|
||||
}
|
||||
|
||||
static PangoFontDescription *
|
||||
get_font_for_category (EekKeyboard *keyboard,
|
||||
EekKeysymCategory category,
|
||||
PangoLayout *layout,
|
||||
gdouble minimum_font_size,
|
||||
gdouble maximum_font_size)
|
||||
{
|
||||
GetFontSizeCallbackData data;
|
||||
PangoFontDescription *font_desc;
|
||||
const PangoFontDescription *base_font_desc;
|
||||
|
||||
data.layout = layout;
|
||||
data.category = category;
|
||||
data.minimum_font_size = minimum_font_size;
|
||||
data.font_size = maximum_font_size;
|
||||
|
||||
eek_container_foreach_child (EEK_CONTAINER(keyboard),
|
||||
egf_section_callback,
|
||||
&data);
|
||||
|
||||
base_font_desc = pango_layout_get_font_description (layout);
|
||||
font_desc = pango_font_description_copy (base_font_desc);
|
||||
pango_font_description_set_size (font_desc, data.font_size);
|
||||
|
||||
return font_desc;
|
||||
}
|
||||
|
||||
void
|
||||
eek_get_fonts (EekKeyboard *keyboard,
|
||||
PangoLayout *layout,
|
||||
PangoFontDescription **fonts)
|
||||
{
|
||||
EekBounds bounds;
|
||||
PangoFontDescription *font_desc;
|
||||
gint font_size;
|
||||
|
||||
/* font for EEK_KEYSYM_CATEGORY_LETTER */
|
||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||
font_desc = get_font_for_category (keyboard,
|
||||
EEK_KEYSYM_CATEGORY_LETTER,
|
||||
layout,
|
||||
0,
|
||||
eek_bounds_long_side (&bounds) *
|
||||
PANGO_SCALE);
|
||||
font_size = pango_font_description_get_size (font_desc);
|
||||
fonts[EEK_KEYSYM_CATEGORY_LETTER] = font_desc;
|
||||
|
||||
/* font for EEK_KEYSYM_CATEGORY_FUNCTION */
|
||||
font_desc = get_font_for_category (keyboard,
|
||||
EEK_KEYSYM_CATEGORY_FUNCTION,
|
||||
layout,
|
||||
font_size * 0.3,
|
||||
font_size);
|
||||
fonts[EEK_KEYSYM_CATEGORY_FUNCTION] = font_desc;
|
||||
|
||||
/* font for EEK_KEYSYM_CATEGORY_KEYNAME */
|
||||
font_desc = get_font_for_category (keyboard,
|
||||
EEK_KEYSYM_CATEGORY_KEYNAME,
|
||||
layout,
|
||||
font_size * 0.3,
|
||||
font_size);
|
||||
fonts[EEK_KEYSYM_CATEGORY_KEYNAME] = font_desc;
|
||||
}
|
||||
|
||||
void
|
||||
eek_draw_outline (cairo_t *cr, EekOutline *outline)
|
||||
{
|
||||
cairo_pattern_t *pat;
|
||||
|
||||
cairo_set_line_width (cr, 1);
|
||||
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
|
||||
|
||||
pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, 256.0);
|
||||
cairo_pattern_add_color_stop_rgba (pat, 1, 0.5, 0.5, 0.5, 1);
|
||||
cairo_pattern_add_color_stop_rgba (pat, 0, 1, 1, 1, 1);
|
||||
|
||||
cairo_set_source (cr, pat);
|
||||
|
||||
eek_draw_rounded_polygon (cr,
|
||||
TRUE,
|
||||
outline->corner_radius,
|
||||
outline->points,
|
||||
outline->num_points);
|
||||
|
||||
cairo_pattern_destroy (pat);
|
||||
|
||||
cairo_set_source_rgba (cr, 0.3, 0.3, 0.3, 0.5);
|
||||
eek_draw_rounded_polygon (cr,
|
||||
FALSE,
|
||||
outline->corner_radius,
|
||||
outline->points,
|
||||
outline->num_points);
|
||||
}
|
||||
|
||||
void
|
||||
eek_draw_key_label (cairo_t *cr,
|
||||
EekKey *key,
|
||||
PangoFontDescription **fonts)
|
||||
{
|
||||
guint keysym;
|
||||
EekKeysymCategory category;
|
||||
const gchar *label;
|
||||
PangoLayout *layout;
|
||||
PangoRectangle logical_rect = { 0, };
|
||||
EekBounds bounds;
|
||||
|
||||
keysym = eek_key_get_keysym (key);
|
||||
if (keysym == EEK_INVALID_KEYSYM)
|
||||
return;
|
||||
|
||||
category = eek_keysym_get_category (keysym);
|
||||
if (category == EEK_KEYSYM_CATEGORY_UNKNOWN)
|
||||
return;
|
||||
|
||||
label = eek_keysym_to_string (keysym);
|
||||
if (!label)
|
||||
return;
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
|
||||
layout = pango_cairo_create_layout (cr);
|
||||
pango_layout_set_font_description (layout, fonts[category]);
|
||||
pango_layout_set_width (layout, PANGO_SCALE * bounds.width);
|
||||
pango_layout_set_ellipsize (layout, PANGO_ELLIPSIZE_END);
|
||||
pango_layout_set_text (layout, label, -1);
|
||||
pango_layout_get_extents (layout, NULL, &logical_rect);
|
||||
cairo_rel_move_to (cr,
|
||||
(bounds.width - logical_rect.width / PANGO_SCALE) / 2,
|
||||
(bounds.height - logical_rect.height / PANGO_SCALE) / 2);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
/*
|
||||
* The functions below are borrowed from
|
||||
* libgnomekbd/gkbd-keyboard-drawing.c.
|
||||
* Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
|
||||
*
|
||||
* length(), point_line_distance(), normal_form(), inverse(), multiply(),
|
||||
* intersect(), rounded_corner(), draw_rounded_polygon()
|
||||
*/
|
||||
|
||||
static gdouble
|
||||
length (gdouble x, gdouble y)
|
||||
{
|
||||
return sqrt (x * x + y * y);
|
||||
}
|
||||
|
||||
static gdouble
|
||||
point_line_distance (gdouble ax, gdouble ay, gdouble nx, gdouble ny)
|
||||
{
|
||||
return ax * nx + ay * ny;
|
||||
}
|
||||
|
||||
static void
|
||||
normal_form (gdouble ax, gdouble ay,
|
||||
gdouble bx, gdouble by,
|
||||
gdouble * nx, gdouble * ny, gdouble * d)
|
||||
{
|
||||
gdouble l;
|
||||
|
||||
*nx = by - ay;
|
||||
*ny = ax - bx;
|
||||
|
||||
l = length (*nx, *ny);
|
||||
|
||||
*nx /= l;
|
||||
*ny /= l;
|
||||
|
||||
*d = point_line_distance (ax, ay, *nx, *ny);
|
||||
}
|
||||
|
||||
static void
|
||||
inverse (gdouble a, gdouble b, gdouble c, gdouble d,
|
||||
gdouble * e, gdouble * f, gdouble * g, gdouble * h)
|
||||
{
|
||||
gdouble det;
|
||||
|
||||
det = a * d - b * c;
|
||||
|
||||
*e = d / det;
|
||||
*f = -b / det;
|
||||
*g = -c / det;
|
||||
*h = a / det;
|
||||
}
|
||||
|
||||
static void
|
||||
multiply (gdouble a, gdouble b, gdouble c, gdouble d,
|
||||
gdouble e, gdouble f, gdouble * x, gdouble * y)
|
||||
{
|
||||
*x = a * e + b * f;
|
||||
*y = c * e + d * f;
|
||||
}
|
||||
|
||||
static void
|
||||
intersect (gdouble n1x, gdouble n1y, gdouble d1,
|
||||
gdouble n2x, gdouble n2y, gdouble d2, gdouble * x, gdouble * y)
|
||||
{
|
||||
gdouble e, f, g, h;
|
||||
|
||||
inverse (n1x, n1y, n2x, n2y, &e, &f, &g, &h);
|
||||
multiply (e, f, g, h, d1, d2, x, y);
|
||||
}
|
||||
|
||||
|
||||
/* draw an angle from the current point to b and then to c,
|
||||
* with a rounded corner of the given radius.
|
||||
*/
|
||||
static void
|
||||
rounded_corner (cairo_t * cr,
|
||||
gdouble bx, gdouble by,
|
||||
gdouble cx, gdouble cy, gdouble radius)
|
||||
{
|
||||
gdouble ax, ay;
|
||||
gdouble n1x, n1y, d1;
|
||||
gdouble n2x, n2y, d2;
|
||||
gdouble pd1, pd2;
|
||||
gdouble ix, iy;
|
||||
gdouble dist1, dist2;
|
||||
gdouble nx, ny, d;
|
||||
gdouble a1x, a1y, c1x, c1y;
|
||||
gdouble phi1, phi2;
|
||||
|
||||
cairo_get_current_point (cr, &ax, &ay);
|
||||
#ifdef KBDRAW_DEBUG
|
||||
printf (" current point: (%f, %f), radius %f:\n", ax, ay,
|
||||
radius);
|
||||
#endif
|
||||
|
||||
/* make sure radius is not too large */
|
||||
dist1 = length (bx - ax, by - ay);
|
||||
dist2 = length (cx - bx, cy - by);
|
||||
|
||||
radius = MIN (radius, MIN (dist1, dist2));
|
||||
|
||||
/* construct normal forms of the lines */
|
||||
normal_form (ax, ay, bx, by, &n1x, &n1y, &d1);
|
||||
normal_form (bx, by, cx, cy, &n2x, &n2y, &d2);
|
||||
|
||||
/* find which side of the line a,b the point c is on */
|
||||
if (point_line_distance (cx, cy, n1x, n1y) < d1)
|
||||
pd1 = d1 - radius;
|
||||
else
|
||||
pd1 = d1 + radius;
|
||||
|
||||
/* find which side of the line b,c the point a is on */
|
||||
if (point_line_distance (ax, ay, n2x, n2y) < d2)
|
||||
pd2 = d2 - radius;
|
||||
else
|
||||
pd2 = d2 + radius;
|
||||
|
||||
/* intersect the parallels to find the center of the arc */
|
||||
intersect (n1x, n1y, pd1, n2x, n2y, pd2, &ix, &iy);
|
||||
|
||||
nx = (bx - ax) / dist1;
|
||||
ny = (by - ay) / dist1;
|
||||
d = point_line_distance (ix, iy, nx, ny);
|
||||
|
||||
/* a1 is the point on the line a-b where the arc starts */
|
||||
intersect (n1x, n1y, d1, nx, ny, d, &a1x, &a1y);
|
||||
|
||||
nx = (cx - bx) / dist2;
|
||||
ny = (cy - by) / dist2;
|
||||
d = point_line_distance (ix, iy, nx, ny);
|
||||
|
||||
/* c1 is the point on the line b-c where the arc ends */
|
||||
intersect (n2x, n2y, d2, nx, ny, d, &c1x, &c1y);
|
||||
|
||||
/* determine the first angle */
|
||||
if (a1x - ix == 0)
|
||||
phi1 = (a1y - iy > 0) ? M_PI_2 : 3 * M_PI_2;
|
||||
else if (a1x - ix > 0)
|
||||
phi1 = atan ((a1y - iy) / (a1x - ix));
|
||||
else
|
||||
phi1 = M_PI + atan ((a1y - iy) / (a1x - ix));
|
||||
|
||||
/* determine the second angle */
|
||||
if (c1x - ix == 0)
|
||||
phi2 = (c1y - iy > 0) ? M_PI_2 : 3 * M_PI_2;
|
||||
else if (c1x - ix > 0)
|
||||
phi2 = atan ((c1y - iy) / (c1x - ix));
|
||||
else
|
||||
phi2 = M_PI + atan ((c1y - iy) / (c1x - ix));
|
||||
|
||||
/* compute the difference between phi2 and phi1 mod 2pi */
|
||||
d = phi2 - phi1;
|
||||
while (d < 0)
|
||||
d += 2 * M_PI;
|
||||
while (d > 2 * M_PI)
|
||||
d -= 2 * M_PI;
|
||||
|
||||
#ifdef KBDRAW_DEBUG
|
||||
printf (" line 1 to: (%f, %f):\n", a1x, a1y);
|
||||
#endif
|
||||
if (!(isnan (a1x) || isnan (a1y)))
|
||||
cairo_line_to (cr, a1x, a1y);
|
||||
|
||||
/* pick the short arc from phi1 to phi2 */
|
||||
if (d < M_PI)
|
||||
cairo_arc (cr, ix, iy, radius, phi1, phi2);
|
||||
else
|
||||
cairo_arc_negative (cr, ix, iy, radius, phi1, phi2);
|
||||
|
||||
#ifdef KBDRAW_DEBUG
|
||||
printf (" line 2 to: (%f, %f):\n", cx, cy);
|
||||
#endif
|
||||
cairo_line_to (cr, cx, cy);
|
||||
}
|
||||
|
||||
void
|
||||
eek_draw_rounded_polygon (cairo_t *cr,
|
||||
gboolean filled,
|
||||
gdouble radius,
|
||||
EekPoint *points,
|
||||
gint num_points)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
cairo_move_to (cr,
|
||||
(gdouble) (points[num_points - 1].x +
|
||||
points[0].x) / 2,
|
||||
(gdouble) (points[num_points - 1].y +
|
||||
points[0].y) / 2);
|
||||
|
||||
|
||||
#ifdef KBDRAW_DEBUG
|
||||
printf (" rounded polygon of radius %f:\n", radius);
|
||||
#endif
|
||||
for (i = 0; i < num_points; i++) {
|
||||
j = (i + 1) % num_points;
|
||||
rounded_corner (cr, (gdouble) points[i].x,
|
||||
(gdouble) points[i].y,
|
||||
(gdouble) (points[i].x + points[j].x) / 2,
|
||||
(gdouble) (points[i].y + points[j].y) / 2,
|
||||
radius);
|
||||
#ifdef KBDRAW_DEBUG
|
||||
printf (" corner (%d, %d) -> (%d, %d):\n",
|
||||
points[i].x, points[i].y, points[j].x,
|
||||
points[j].y);
|
||||
#endif
|
||||
};
|
||||
cairo_close_path (cr);
|
||||
|
||||
if (filled)
|
||||
cairo_fill (cr);
|
||||
else
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#ifndef EEK_DRAWING_H
|
||||
#define EEK_DRAWING_H 1
|
||||
|
||||
#include <pango/pangocairo.h>
|
||||
#include "eek-keyboard.h"
|
||||
#include "eek-keysym.h"
|
||||
#include "eek-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
void eek_draw_text_on_layout (PangoLayout *layout,
|
||||
const gchar *text);
|
||||
|
||||
void eek_get_fonts (EekKeyboard *keyboard,
|
||||
PangoLayout *layout,
|
||||
PangoFontDescription **fonts);
|
||||
|
||||
void eek_draw_outline (cairo_t *cr,
|
||||
EekOutline *outline);
|
||||
|
||||
void eek_draw_key_label (cairo_t *cr,
|
||||
EekKey *key,
|
||||
PangoFontDescription **fonts);
|
||||
|
||||
void eek_draw_rounded_polygon (cairo_t *cr,
|
||||
gboolean filled,
|
||||
gdouble radius,
|
||||
EekPoint *points,
|
||||
gint num_points);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_DRAWING_H */
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -26,108 +26,29 @@
|
||||
* shall be used to implement #EekKeyboard, #EekSection, or #EekKey.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-element.h"
|
||||
#include "eek-container.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_NAME,
|
||||
PROP_BOUNDS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE (EekElement, eek_element, G_TYPE_INITIALLY_UNOWNED);
|
||||
|
||||
#define EEK_ELEMENT_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_ELEMENT, EekElementPrivate))
|
||||
|
||||
|
||||
struct _EekElementPrivate
|
||||
typedef struct _EekElementPrivate
|
||||
{
|
||||
gchar *name;
|
||||
EekBounds bounds;
|
||||
EekElement *parent;
|
||||
};
|
||||
} EekElementPrivate;
|
||||
|
||||
static void
|
||||
eek_element_real_set_parent (EekElement *self,
|
||||
EekElement *parent)
|
||||
{
|
||||
EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(self);
|
||||
|
||||
if (!parent) {
|
||||
g_return_if_fail (priv->parent);
|
||||
/* release self-reference acquired when setting parent */
|
||||
g_object_unref (self);
|
||||
priv->parent = NULL;
|
||||
} else {
|
||||
g_return_if_fail (!priv->parent);
|
||||
g_object_ref_sink (self);
|
||||
priv->parent = parent;
|
||||
}
|
||||
}
|
||||
|
||||
static EekElement *
|
||||
eek_element_real_get_parent (EekElement *self)
|
||||
{
|
||||
EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(self);
|
||||
|
||||
return priv->parent;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_element_real_set_name (EekElement *self,
|
||||
const gchar *name)
|
||||
{
|
||||
EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(self);
|
||||
|
||||
g_free (priv->name);
|
||||
priv->name = g_strdup (name);
|
||||
|
||||
g_object_notify (G_OBJECT(self), "name");
|
||||
}
|
||||
|
||||
static G_CONST_RETURN gchar *
|
||||
eek_element_real_get_name (EekElement *self)
|
||||
{
|
||||
EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(self);
|
||||
|
||||
return priv->name;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_element_real_set_bounds (EekElement *self,
|
||||
EekBounds *bounds)
|
||||
{
|
||||
EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(self);
|
||||
|
||||
priv->bounds = *bounds;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_element_real_get_bounds (EekElement *self,
|
||||
EekBounds *bounds)
|
||||
{
|
||||
EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(self);
|
||||
|
||||
g_return_if_fail (bounds);
|
||||
*bounds = priv->bounds;
|
||||
|
||||
g_object_notify (G_OBJECT(self), "bounds");
|
||||
}
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (EekElement, eek_element, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
eek_element_finalize (GObject *object)
|
||||
{
|
||||
EekElementPrivate *priv = EEK_ELEMENT_GET_PRIVATE(object);
|
||||
|
||||
g_free (priv->name);
|
||||
G_OBJECT_CLASS (eek_element_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -136,15 +57,11 @@ eek_element_set_property (GObject *object,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_ELEMENT(object));
|
||||
EekElement *element = EEK_ELEMENT(object);
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_NAME:
|
||||
eek_element_set_name (EEK_ELEMENT(object),
|
||||
g_value_get_string (value));
|
||||
break;
|
||||
case PROP_BOUNDS:
|
||||
eek_element_set_bounds (EEK_ELEMENT(object),
|
||||
g_value_get_boxed (value));
|
||||
eek_element_set_bounds (element, g_value_get_boxed (value));
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
@@ -158,15 +75,12 @@ eek_element_get_property (GObject *object,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
EekElement *element = EEK_ELEMENT(object);
|
||||
EekBounds bounds;
|
||||
|
||||
g_return_if_fail (EEK_IS_ELEMENT(object));
|
||||
switch (prop_id) {
|
||||
case PROP_NAME:
|
||||
g_value_set_string (value, eek_element_get_name (EEK_ELEMENT(object)));
|
||||
break;
|
||||
case PROP_BOUNDS:
|
||||
eek_element_get_bounds (EEK_ELEMENT(object), &bounds);
|
||||
eek_element_get_bounds (element, &bounds);
|
||||
g_value_set_boxed (value, &bounds);
|
||||
break;
|
||||
default:
|
||||
@@ -181,34 +95,11 @@ eek_element_class_init (EekElementClass *klass)
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekElementPrivate));
|
||||
|
||||
klass->set_parent = eek_element_real_set_parent;
|
||||
klass->get_parent = eek_element_real_get_parent;
|
||||
klass->set_name = eek_element_real_set_name;
|
||||
klass->get_name = eek_element_real_get_name;
|
||||
klass->set_bounds = eek_element_real_set_bounds;
|
||||
klass->get_bounds = eek_element_real_get_bounds;
|
||||
|
||||
/* signals */
|
||||
gobject_class->set_property = eek_element_set_property;
|
||||
gobject_class->get_property = eek_element_get_property;
|
||||
gobject_class->finalize = eek_element_finalize;
|
||||
|
||||
/**
|
||||
* EekElement:name:
|
||||
*
|
||||
* The name of #EekElement.
|
||||
*/
|
||||
pspec = g_param_spec_string ("name",
|
||||
"Name",
|
||||
"Name",
|
||||
NULL,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_NAME,
|
||||
pspec);
|
||||
|
||||
/**
|
||||
* EekElement:bounds:
|
||||
*
|
||||
@@ -227,70 +118,7 @@ eek_element_class_init (EekElementClass *klass)
|
||||
static void
|
||||
eek_element_init (EekElement *self)
|
||||
{
|
||||
EekElementPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_ELEMENT_GET_PRIVATE(self);
|
||||
priv->name = NULL;
|
||||
memset (&priv->bounds, 0, sizeof priv->bounds);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_element_set_parent:
|
||||
* @element: an #EekElement
|
||||
* @parent: an #EekElement
|
||||
*
|
||||
* Set the parent of @element to @parent.
|
||||
*/
|
||||
void
|
||||
eek_element_set_parent (EekElement *element,
|
||||
EekElement *parent)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_ELEMENT(element));
|
||||
g_return_if_fail (EEK_IS_ELEMENT(parent));
|
||||
EEK_ELEMENT_GET_CLASS(element)->set_parent (element, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_element_get_parent:
|
||||
* @element: an #EekElement
|
||||
*
|
||||
* Get the parent of @element.
|
||||
* Returns: an #EekElement if the parent is set
|
||||
*/
|
||||
EekElement *
|
||||
eek_element_get_parent (EekElement *element)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_ELEMENT(element), NULL);
|
||||
return EEK_ELEMENT_GET_CLASS(element)->get_parent (element);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_element_set_name:
|
||||
* @element: an #EekElement
|
||||
* @name: name of @element
|
||||
*
|
||||
* Set the name of @element to @name.
|
||||
*/
|
||||
void
|
||||
eek_element_set_name (EekElement *element,
|
||||
const gchar *name)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_ELEMENT(element));
|
||||
EEK_ELEMENT_GET_CLASS(element)->set_name (element, name);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_element_get_name:
|
||||
* @element: an #EekElement
|
||||
*
|
||||
* Get the name of @element.
|
||||
* Returns: the name of @element or NULL when the name is not set
|
||||
*/
|
||||
G_CONST_RETURN gchar *
|
||||
eek_element_get_name (EekElement *element)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_ELEMENT(element), NULL);
|
||||
return EEK_ELEMENT_GET_CLASS(element)->get_name (element);
|
||||
(void)self;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -307,13 +135,16 @@ eek_element_set_bounds (EekElement *element,
|
||||
EekBounds *bounds)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_ELEMENT(element));
|
||||
EEK_ELEMENT_GET_CLASS(element)->set_bounds (element, bounds);
|
||||
|
||||
EekElementPrivate *priv = eek_element_get_instance_private (element);
|
||||
|
||||
memcpy (&priv->bounds, bounds, sizeof(EekBounds));
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_element_get_bounds:
|
||||
* @element: an #EekElement
|
||||
* @bounds: pointer where bounding box of @element will be stored
|
||||
* @bounds: (out): pointer where bounding box of @element will be stored
|
||||
*
|
||||
* Get the bounding box of @element. Note that if @element has
|
||||
* parent, position of @bounds are relative to the parent. To obtain
|
||||
@@ -324,30 +155,9 @@ eek_element_get_bounds (EekElement *element,
|
||||
EekBounds *bounds)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_ELEMENT(element));
|
||||
EEK_ELEMENT_GET_CLASS(element)->get_bounds (element, bounds);
|
||||
}
|
||||
g_return_if_fail (bounds != NULL);
|
||||
|
||||
/**
|
||||
* eek_element_get_absolute_position:
|
||||
* @element: an #EekElement
|
||||
* @x: pointer where the X coordinate of @element will be stored
|
||||
* @y: pointer where the Y coordinate of @element will be stored
|
||||
*
|
||||
* Compute the absolute position of @element.
|
||||
*/
|
||||
void
|
||||
eek_element_get_absolute_position (EekElement *element,
|
||||
gdouble *x,
|
||||
gdouble *y)
|
||||
{
|
||||
EekBounds bounds;
|
||||
gdouble ax = 0.0, ay = 0.0;
|
||||
EekElementPrivate *priv = eek_element_get_instance_private (element);
|
||||
|
||||
do {
|
||||
eek_element_get_bounds (element, &bounds);
|
||||
ax += bounds.x;
|
||||
ay += bounds.y;
|
||||
} while ((element = eek_element_get_parent (element)) != NULL);
|
||||
*x = ax;
|
||||
*y = ay;
|
||||
memcpy (bounds, &priv->bounds, sizeof(EekBounds));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -17,6 +17,11 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
||||
#error "Only <eek/eek.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef EEK_ELEMENT_H
|
||||
#define EEK_ELEMENT_H 1
|
||||
|
||||
@@ -25,55 +30,20 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define EEK_TYPE_ELEMENT (eek_element_get_type())
|
||||
#define EEK_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_ELEMENT, EekElement))
|
||||
#define EEK_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_ELEMENT, EekElementClass))
|
||||
#define EEK_IS_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_ELEMENT))
|
||||
#define EEK_IS_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_ELEMENT))
|
||||
#define EEK_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_ELEMENT, EekElementClass))
|
||||
|
||||
typedef struct _EekElementClass EekElementClass;
|
||||
typedef struct _EekElementPrivate EekElementPrivate;
|
||||
|
||||
struct _EekElement
|
||||
{
|
||||
/*< private >*/
|
||||
GInitiallyUnowned parent;
|
||||
|
||||
EekElementPrivate *priv;
|
||||
};
|
||||
G_DECLARE_DERIVABLE_TYPE (EekElement, eek_element, EEK, ELEMENT, GObject)
|
||||
|
||||
struct _EekElementClass
|
||||
{
|
||||
/*< private >*/
|
||||
GInitiallyUnownedClass parent_class;
|
||||
void (* set_parent) (EekElement *self,
|
||||
EekElement *parent);
|
||||
EekElement *(* get_parent) (EekElement *self);
|
||||
void (* set_name) (EekElement *self,
|
||||
const gchar *name);
|
||||
|
||||
G_CONST_RETURN gchar *(* get_name) (EekElement *self);
|
||||
|
||||
void (* set_bounds) (EekElement *self,
|
||||
EekBounds *bounds);
|
||||
|
||||
void (* get_bounds) (EekElement *self,
|
||||
EekBounds *bounds);
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
GType eek_element_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void eek_element_set_parent (EekElement *element,
|
||||
EekElement *parent);
|
||||
EekElement *eek_element_get_parent (EekElement *element);
|
||||
void eek_element_set_name (EekElement *element,
|
||||
const gchar *name);
|
||||
|
||||
G_CONST_RETURN gchar *eek_element_get_name (EekElement *element);
|
||||
const gchar *eek_element_get_name (EekElement *element);
|
||||
|
||||
void eek_element_set_bounds (EekElement *element,
|
||||
EekBounds *bounds);
|
||||
@@ -81,9 +51,5 @@ void eek_element_set_bounds (EekElement *element,
|
||||
void eek_element_get_bounds (EekElement *element,
|
||||
EekBounds *bounds);
|
||||
|
||||
void eek_element_get_absolute_position (EekElement *element,
|
||||
gdouble *x,
|
||||
gdouble *y);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_ELEMENT_H */
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -20,471 +20,412 @@
|
||||
|
||||
/**
|
||||
* SECTION:eek-gtk-keyboard
|
||||
* @short_description: #EekKeyboard that can be converted into a #GtkWidget
|
||||
* @short_description: a #GtkWidget displaying #EekKeyboard
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef HAVE_LIBCANBERRA
|
||||
#include <canberra-gtk.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
#include "eek-renderer.h"
|
||||
#include "eek-keyboard.h"
|
||||
|
||||
#include "eek-gtk-keyboard.h"
|
||||
#include "eek-drawing.h"
|
||||
#include "eek-keyboard.h"
|
||||
#include "eek-section.h"
|
||||
#include "eek-key.h"
|
||||
#include "eek-keysym.h"
|
||||
|
||||
G_DEFINE_TYPE (EekGtkKeyboard, eek_gtk_keyboard, EEK_TYPE_KEYBOARD);
|
||||
#include "eekboard/eekboard-context-service.h"
|
||||
#include "src/layout.h"
|
||||
|
||||
#define EEK_GTK_KEYBOARD_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_GTK_KEYBOARD, EekGtkKeyboardPrivate))
|
||||
|
||||
#define SCALE 1.5
|
||||
|
||||
struct _EekGtkKeyboardPrivate
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
/* pixmap of entire keyboard (for expose event) */
|
||||
GdkPixmap *pixmap;
|
||||
|
||||
/* mapping from outline pointer to pixmap */
|
||||
GHashTable *outline_textures;
|
||||
|
||||
/* mapping from outline pointer to large pixmap */
|
||||
GHashTable *large_outline_textures;
|
||||
|
||||
PangoFontDescription *fonts[EEK_KEYSYM_CATEGORY_LAST];
|
||||
|
||||
gdouble scale;
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
static void prepare_keyboard_pixmap (EekGtkKeyboard *keyboard);
|
||||
/* since 2.91.5 GDK_DRAWABLE was removed and gdk_cairo_create takes
|
||||
GdkWindow as the argument */
|
||||
#ifndef GDK_DRAWABLE
|
||||
#define GDK_DRAWABLE(x) (x)
|
||||
#endif
|
||||
|
||||
typedef struct _EekGtkKeyboardPrivate
|
||||
{
|
||||
EekRenderer *renderer;
|
||||
LevelKeyboard *keyboard; // unowned reference; it's kept in server-context (FIXME)
|
||||
|
||||
GdkEventSequence *sequence; // unowned reference
|
||||
} EekGtkKeyboardPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (EekGtkKeyboard, eek_gtk_keyboard, GTK_TYPE_DRAWING_AREA)
|
||||
|
||||
static void render_pressed_button (GtkWidget *widget, struct button_place *place);
|
||||
static void render_released_button (GtkWidget *widget,
|
||||
const struct squeek_button *button);
|
||||
|
||||
static void
|
||||
eek_gtk_keyboard_real_set_keysym_index (EekKeyboard *self,
|
||||
gint group,
|
||||
gint level)
|
||||
eek_gtk_keyboard_real_realize (GtkWidget *self)
|
||||
{
|
||||
gint g, l;
|
||||
gtk_widget_set_events (self,
|
||||
GDK_EXPOSURE_MASK |
|
||||
GDK_KEY_PRESS_MASK |
|
||||
GDK_KEY_RELEASE_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_BUTTON_MOTION_MASK |
|
||||
GDK_TOUCH_MASK);
|
||||
|
||||
eek_keyboard_get_keysym_index (self, &g, &l);
|
||||
EEK_KEYBOARD_CLASS(eek_gtk_keyboard_parent_class)->
|
||||
set_keysym_index (self, group, level);
|
||||
if (g != group || l != level) {
|
||||
EekGtkKeyboard *keyboard = EEK_GTK_KEYBOARD(self);
|
||||
GTK_WIDGET_CLASS (eek_gtk_keyboard_parent_class)->realize (self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
eek_gtk_keyboard_real_draw (GtkWidget *self,
|
||||
cairo_t *cr)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv =
|
||||
EEK_GTK_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
GtkStateType state;
|
||||
eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self));
|
||||
GtkAllocation allocation;
|
||||
gtk_widget_get_allocation (self, &allocation);
|
||||
|
||||
prepare_keyboard_pixmap (keyboard);
|
||||
state = gtk_widget_get_state (GTK_WIDGET (priv->widget));
|
||||
gtk_widget_get_allocation (GTK_WIDGET (priv->widget), &allocation);
|
||||
gdk_draw_drawable (gtk_widget_get_window (priv->widget),
|
||||
gtk_widget_get_style (priv->widget)->fg_gc[state],
|
||||
priv->pixmap,
|
||||
0, 0,
|
||||
0, 0,
|
||||
allocation.width, allocation.height);
|
||||
if (!priv->renderer) {
|
||||
PangoContext *pcontext = gtk_widget_get_pango_context (self);
|
||||
|
||||
priv->renderer = eek_renderer_new (priv->keyboard, pcontext);
|
||||
|
||||
eek_renderer_set_allocation_size (priv->renderer,
|
||||
allocation.width,
|
||||
allocation.height);
|
||||
eek_renderer_set_scale_factor (priv->renderer,
|
||||
gtk_widget_get_scale_factor (self));
|
||||
}
|
||||
|
||||
// render the keyboard without any key activity (TODO: from a cached buffer)
|
||||
eek_renderer_render_keyboard (priv->renderer, cr);
|
||||
// render only a few remaining changes
|
||||
squeek_layout_draw_all_changed(priv->keyboard->layout, EEK_GTK_KEYBOARD(self));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_gtk_keyboard_real_size_allocate (GtkWidget *self,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv =
|
||||
eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self));
|
||||
|
||||
if (priv->renderer)
|
||||
eek_renderer_set_allocation_size (priv->renderer,
|
||||
allocation->width,
|
||||
allocation->height);
|
||||
|
||||
GTK_WIDGET_CLASS (eek_gtk_keyboard_parent_class)->
|
||||
size_allocate (self, allocation);
|
||||
}
|
||||
|
||||
static void depress(EekGtkKeyboard *self,
|
||||
gdouble x, gdouble y, guint32 time)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
squeek_layout_depress(priv->keyboard->layout, priv->keyboard->manager->virtual_keyboard,
|
||||
x, y, eek_renderer_get_transformation(priv->renderer), time, self);
|
||||
}
|
||||
|
||||
static void drag(EekGtkKeyboard *self,
|
||||
gdouble x, gdouble y, guint32 time)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
squeek_layout_drag(priv->keyboard->layout, priv->keyboard->manager->virtual_keyboard,
|
||||
x, y, eek_renderer_get_transformation(priv->renderer), time, self);
|
||||
}
|
||||
|
||||
static void release(EekGtkKeyboard *self, guint32 time)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
squeek_layout_release(priv->keyboard->layout, priv->keyboard->manager->virtual_keyboard, eek_renderer_get_transformation(priv->renderer), time, self);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
eek_gtk_keyboard_real_button_press_event (GtkWidget *self,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
if (event->type == GDK_BUTTON_PRESS && event->button == 1) {
|
||||
depress(EEK_GTK_KEYBOARD(self), event->x, event->y, event->time);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// TODO: this belongs more in gtk_keyboard, with a way to find out which key to re-render
|
||||
static gboolean
|
||||
eek_gtk_keyboard_real_button_release_event (GtkWidget *self,
|
||||
GdkEventButton *event)
|
||||
{
|
||||
if (event->type == GDK_BUTTON_RELEASE && event->button == 1) {
|
||||
// TODO: can the event have different coords than the previous move event?
|
||||
release(EEK_GTK_KEYBOARD(self), event->time);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
eek_gtk_keyboard_leave_event (GtkWidget *self,
|
||||
GdkEventCrossing *event)
|
||||
{
|
||||
if (event->type == GDK_LEAVE_NOTIFY) {
|
||||
// TODO: can the event have different coords than the previous move event?
|
||||
release(EEK_GTK_KEYBOARD(self), event->time);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
eek_gtk_keyboard_real_motion_notify_event (GtkWidget *self,
|
||||
GdkEventMotion *event)
|
||||
{
|
||||
if (event->state & GDK_BUTTON1_MASK) {
|
||||
drag(EEK_GTK_KEYBOARD(self), event->x, event->y, event->time);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Only one touch stream at a time allowed. Others will be completely ignored.
|
||||
static gboolean
|
||||
handle_touch_event (GtkWidget *widget,
|
||||
GdkEventTouch *event)
|
||||
{
|
||||
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (widget);
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
/* For each new touch, release the previous one and record the new event
|
||||
sequence. */
|
||||
if (event->type == GDK_TOUCH_BEGIN) {
|
||||
release(self, event->time);
|
||||
priv->sequence = event->sequence;
|
||||
depress(self, event->x, event->y, event->time);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Only allow the latest touch point to be dragged. */
|
||||
if (event->type == GDK_TOUCH_UPDATE && event->sequence == priv->sequence) {
|
||||
drag(self, event->x, event->y, event->time);
|
||||
}
|
||||
else if (event->type == GDK_TOUCH_END || event->type == GDK_TOUCH_CANCEL) {
|
||||
// TODO: can the event have different coords than the previous update event?
|
||||
/* Only respond to the release of the latest touch point. Previous
|
||||
touches have already been released. */
|
||||
if (event->sequence == priv->sequence) {
|
||||
release(self, event->time);
|
||||
priv->sequence = NULL;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_gtk_keyboard_real_unmap (GtkWidget *self)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv =
|
||||
eek_gtk_keyboard_get_instance_private (EEK_GTK_KEYBOARD (self));
|
||||
|
||||
if (priv->keyboard) {
|
||||
squeek_layout_release_all_only(
|
||||
priv->keyboard->layout, priv->keyboard->manager->virtual_keyboard,
|
||||
gdk_event_get_time(NULL));
|
||||
}
|
||||
|
||||
GTK_WIDGET_CLASS (eek_gtk_keyboard_parent_class)->unmap (self);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_gtk_keyboard_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id) {
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_gtk_keyboard_dispose (GObject *object)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(object);
|
||||
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (object);
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
if (priv->widget) {
|
||||
g_object_unref (priv->widget);
|
||||
priv->widget = NULL;
|
||||
if (priv->renderer) {
|
||||
g_object_unref (priv->renderer);
|
||||
priv->renderer = NULL;
|
||||
priv->renderer = NULL;
|
||||
}
|
||||
|
||||
if (priv->keyboard) {
|
||||
squeek_layout_release_all_only(
|
||||
priv->keyboard->layout, priv->keyboard->manager->virtual_keyboard,
|
||||
gdk_event_get_time(NULL));
|
||||
priv->keyboard = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (eek_gtk_keyboard_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_gtk_keyboard_finalize (GObject *object)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(object);
|
||||
gint i;
|
||||
|
||||
g_hash_table_unref (priv->outline_textures);
|
||||
g_hash_table_unref (priv->large_outline_textures);
|
||||
|
||||
for (i = 0; i < EEK_KEYSYM_CATEGORY_LAST; i++)
|
||||
pango_font_description_free (priv->fonts[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_gtk_keyboard_class_init (EekGtkKeyboardClass *klass)
|
||||
{
|
||||
EekKeyboardClass *keyboard_class = EEK_KEYBOARD_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekGtkKeyboardPrivate));
|
||||
widget_class->realize = eek_gtk_keyboard_real_realize;
|
||||
widget_class->unmap = eek_gtk_keyboard_real_unmap;
|
||||
widget_class->draw = eek_gtk_keyboard_real_draw;
|
||||
widget_class->size_allocate = eek_gtk_keyboard_real_size_allocate;
|
||||
widget_class->button_press_event =
|
||||
eek_gtk_keyboard_real_button_press_event;
|
||||
widget_class->button_release_event =
|
||||
eek_gtk_keyboard_real_button_release_event;
|
||||
widget_class->motion_notify_event =
|
||||
eek_gtk_keyboard_real_motion_notify_event;
|
||||
widget_class->leave_notify_event =
|
||||
eek_gtk_keyboard_leave_event;
|
||||
|
||||
keyboard_class->set_keysym_index = eek_gtk_keyboard_real_set_keysym_index;
|
||||
widget_class->touch_event = handle_touch_event;
|
||||
|
||||
gobject_class->set_property = eek_gtk_keyboard_set_property;
|
||||
gobject_class->dispose = eek_gtk_keyboard_dispose;
|
||||
gobject_class->finalize = eek_gtk_keyboard_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_gtk_keyboard_init (EekGtkKeyboard *self)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_GTK_KEYBOARD_GET_PRIVATE(self);
|
||||
priv->widget = NULL;
|
||||
priv->pixmap = NULL;
|
||||
priv->outline_textures =
|
||||
g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
g_object_unref);
|
||||
priv->large_outline_textures =
|
||||
g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
g_object_unref);
|
||||
memset (priv->fonts, 0, sizeof priv->fonts);
|
||||
priv->scale = 1.0;
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
* eek_gtk_keyboard_new:
|
||||
* @keyboard: an #EekKeyboard
|
||||
*
|
||||
* Create a new #EekGtkKeyboard.
|
||||
* Create a new #GtkWidget displaying @keyboard.
|
||||
* Returns: a #GtkWidget
|
||||
*/
|
||||
EekKeyboard*
|
||||
eek_gtk_keyboard_new (void)
|
||||
{
|
||||
return g_object_new (EEK_TYPE_GTK_KEYBOARD, NULL);
|
||||
}
|
||||
|
||||
struct _DrawingContext
|
||||
{
|
||||
EekGtkKeyboard *keyboard;
|
||||
cairo_t *cr;
|
||||
GdkColor *fg, *bg;
|
||||
};
|
||||
typedef struct _DrawingContext DrawingContext;
|
||||
|
||||
static void
|
||||
prepare_keyboard_pixmap_key_callback (EekElement *element,
|
||||
gpointer user_data)
|
||||
{
|
||||
DrawingContext *context = user_data;
|
||||
EekGtkKeyboardPrivate *priv =
|
||||
EEK_GTK_KEYBOARD_GET_PRIVATE(context->keyboard);
|
||||
EekKey *key = EEK_KEY(element);
|
||||
EekBounds bounds;
|
||||
EekOutline *outline;
|
||||
GdkPixmap *texture;
|
||||
|
||||
eek_element_get_bounds (element, &bounds);
|
||||
|
||||
outline = eek_key_get_outline (key);
|
||||
texture = g_hash_table_lookup (priv->outline_textures, outline);
|
||||
if (!texture) {
|
||||
cairo_t *cr;
|
||||
|
||||
texture =
|
||||
gdk_pixmap_new (gtk_widget_get_window (GTK_WIDGET (priv->widget)),
|
||||
bounds.width, bounds.height, -1);
|
||||
cr = gdk_cairo_create (GDK_DRAWABLE (texture));
|
||||
gdk_cairo_set_source_color (cr, context->bg);
|
||||
cairo_rectangle (cr, 0, 0, bounds.width, bounds.height);
|
||||
gdk_cairo_set_source_color (cr, context->fg);
|
||||
eek_draw_outline (cr, outline);
|
||||
cairo_destroy (cr);
|
||||
g_hash_table_insert (priv->outline_textures, outline, texture);
|
||||
}
|
||||
|
||||
cairo_save (context->cr);
|
||||
cairo_translate (context->cr, bounds.x, bounds.y);
|
||||
|
||||
gdk_cairo_set_source_pixmap (context->cr, texture, 0, 0);
|
||||
cairo_rectangle (context->cr, 0, 0, bounds.width, bounds.height);
|
||||
cairo_fill (context->cr);
|
||||
|
||||
cairo_move_to (context->cr, 0, 0);
|
||||
gdk_cairo_set_source_color (context->cr, context->fg);
|
||||
eek_draw_key_label (context->cr, key, priv->fonts);
|
||||
|
||||
cairo_restore (context->cr);
|
||||
}
|
||||
|
||||
static void
|
||||
prepare_keyboard_pixmap_section_callback (EekElement *element,
|
||||
gpointer user_data)
|
||||
{
|
||||
DrawingContext *context = user_data;
|
||||
EekBounds bounds;
|
||||
|
||||
eek_element_get_bounds (element, &bounds);
|
||||
cairo_save (context->cr);
|
||||
cairo_translate (context->cr,
|
||||
bounds.x,
|
||||
bounds.y);
|
||||
eek_container_foreach_child (EEK_CONTAINER(element),
|
||||
prepare_keyboard_pixmap_key_callback,
|
||||
context);
|
||||
cairo_restore (context->cr);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_context_init (DrawingContext *context, EekGtkKeyboard *keyboard)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = keyboard->priv;
|
||||
GtkStateType state;
|
||||
|
||||
state = gtk_widget_get_state (GTK_WIDGET (priv->widget));
|
||||
context->keyboard = keyboard;
|
||||
context->fg = >k_widget_get_style (GTK_WIDGET (priv->widget))->fg[state];
|
||||
context->bg = >k_widget_get_style (GTK_WIDGET (priv->widget))->bg[state];
|
||||
}
|
||||
|
||||
static void
|
||||
prepare_keyboard_pixmap (EekGtkKeyboard *keyboard)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = keyboard->priv;
|
||||
GtkAllocation allocation;
|
||||
GtkStateType state;
|
||||
DrawingContext context;
|
||||
|
||||
gtk_widget_get_allocation (GTK_WIDGET (priv->widget), &allocation);
|
||||
priv->pixmap =
|
||||
gdk_pixmap_new (gtk_widget_get_window (GTK_WIDGET (priv->widget)),
|
||||
allocation.width, allocation.height, -1);
|
||||
|
||||
/* blank background */
|
||||
state = gtk_widget_get_state (GTK_WIDGET (priv->widget));
|
||||
gdk_draw_rectangle
|
||||
(priv->pixmap,
|
||||
gtk_widget_get_style (GTK_WIDGET(priv->widget))->base_gc[state],
|
||||
TRUE,
|
||||
0, 0, allocation.width, allocation.height);
|
||||
|
||||
/* draw sections on the canvas */
|
||||
drawing_context_init (&context, keyboard);
|
||||
context.cr = gdk_cairo_create (GDK_DRAWABLE (priv->pixmap));
|
||||
cairo_scale (context.cr, priv->scale, priv->scale);
|
||||
eek_container_foreach_child (EEK_CONTAINER(keyboard),
|
||||
prepare_keyboard_pixmap_section_callback,
|
||||
&context);
|
||||
cairo_destroy (context.cr);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekGtkKeyboard *keyboard = user_data;
|
||||
EekGtkKeyboardPrivate *priv =
|
||||
EEK_GTK_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
GtkStateType state = gtk_widget_get_state (widget);
|
||||
|
||||
if (!priv->pixmap) {
|
||||
/* compute font sizes which fit in each key shape */
|
||||
PangoFontDescription *base_font;
|
||||
PangoContext *context;
|
||||
PangoLayout *layout;
|
||||
|
||||
context = gtk_widget_get_pango_context (priv->widget);
|
||||
layout = pango_layout_new (context);
|
||||
base_font = gtk_widget_get_style (priv->widget)->font_desc;
|
||||
pango_layout_set_font_description (layout, base_font);
|
||||
eek_get_fonts (EEK_KEYBOARD(keyboard), layout, priv->fonts);
|
||||
|
||||
prepare_keyboard_pixmap (keyboard);
|
||||
}
|
||||
g_return_val_if_fail (priv->pixmap, FALSE);
|
||||
|
||||
gdk_draw_drawable (gtk_widget_get_window (widget),
|
||||
gtk_widget_get_style (widget)->fg_gc[state],
|
||||
priv->pixmap,
|
||||
event->area.x, event->area.y,
|
||||
event->area.x, event->area.y,
|
||||
event->area.width, event->area.height);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
key_enlarge (EekGtkKeyboard *keyboard, EekKey *key)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv =
|
||||
EEK_GTK_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
EekBounds bounds;
|
||||
EekOutline *outline;
|
||||
gdouble ax, ay;
|
||||
GdkPixmap *pixmap, *texture;
|
||||
DrawingContext context;
|
||||
GtkStateType state;
|
||||
cairo_t *cr;
|
||||
|
||||
drawing_context_init (&context, keyboard);
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
|
||||
eek_element_get_absolute_position (EEK_ELEMENT(key), &ax, &ay);
|
||||
|
||||
outline = eek_key_get_outline (key);
|
||||
texture = g_hash_table_lookup (priv->large_outline_textures, outline);
|
||||
if (!texture) {
|
||||
texture =
|
||||
gdk_pixmap_new (gtk_widget_get_window (GTK_WIDGET (priv->widget)),
|
||||
bounds.width * SCALE, bounds.height * SCALE, -1);
|
||||
cr = gdk_cairo_create (GDK_DRAWABLE (texture));
|
||||
cairo_scale (cr, SCALE, SCALE);
|
||||
gdk_cairo_set_source_color (cr, context.bg);
|
||||
cairo_rectangle (cr, 0, 0, bounds.width, bounds.height);
|
||||
gdk_cairo_set_source_color (cr, context.fg);
|
||||
eek_draw_outline (cr, outline);
|
||||
cairo_destroy (cr);
|
||||
g_hash_table_insert (priv->large_outline_textures, outline, texture);
|
||||
}
|
||||
|
||||
pixmap =
|
||||
gdk_pixmap_new (gtk_widget_get_window (GTK_WIDGET (priv->widget)),
|
||||
bounds.width * SCALE * priv->scale,
|
||||
bounds.height * SCALE * priv->scale, -1);
|
||||
cr = gdk_cairo_create (GDK_DRAWABLE (pixmap));
|
||||
cairo_scale (cr, priv->scale, priv->scale);
|
||||
gdk_cairo_set_source_pixmap (cr, texture, 0, 0);
|
||||
cairo_rectangle (cr, 0, 0, bounds.width * SCALE, bounds.height * SCALE);
|
||||
cairo_fill (cr);
|
||||
|
||||
cairo_move_to (cr, 0, 0);
|
||||
cairo_scale (cr, SCALE, SCALE);
|
||||
gdk_cairo_set_source_color (cr, context.fg);
|
||||
eek_draw_key_label (cr, key, priv->fonts);
|
||||
cairo_destroy (cr);
|
||||
|
||||
state = gtk_widget_get_state (GTK_WIDGET (priv->widget));
|
||||
gdk_draw_drawable (gtk_widget_get_window (priv->widget),
|
||||
gtk_widget_get_style (priv->widget)->fg_gc[state],
|
||||
pixmap,
|
||||
0, 0,
|
||||
(ax - (bounds.width * SCALE - bounds.width) / 2) *
|
||||
priv->scale,
|
||||
(ay - (bounds.height * SCALE - bounds.height) / 2) *
|
||||
priv->scale,
|
||||
bounds.width * SCALE * priv->scale,
|
||||
bounds.height * SCALE * priv->scale);
|
||||
g_object_unref (pixmap);
|
||||
}
|
||||
|
||||
static void
|
||||
key_shrink (EekGtkKeyboard *keyboard, EekKey *key)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv =
|
||||
EEK_GTK_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
EekBounds bounds;
|
||||
gdouble ax, ay;
|
||||
GtkStateType state;
|
||||
|
||||
g_return_if_fail (priv->pixmap);
|
||||
eek_element_get_bounds (EEK_ELEMENT(key), &bounds);
|
||||
eek_element_get_absolute_position (EEK_ELEMENT(key), &ax, &ay);
|
||||
state = gtk_widget_get_state (GTK_WIDGET (priv->widget));
|
||||
|
||||
ax -= (bounds.width * SCALE - bounds.width) / 2;
|
||||
ay -= (bounds.height * SCALE - bounds.height) / 2;
|
||||
|
||||
gdk_draw_drawable (gtk_widget_get_window (priv->widget),
|
||||
gtk_widget_get_style (priv->widget)->fg_gc[state],
|
||||
priv->pixmap,
|
||||
ax * priv->scale, ay * priv->scale,
|
||||
ax * priv->scale, ay * priv->scale,
|
||||
bounds.width * SCALE * priv->scale,
|
||||
bounds.height * SCALE * priv->scale);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
on_button_event (GtkWidget *widget,
|
||||
GdkEventButton *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekElement *keyboard = user_data, *section, *key;
|
||||
EekGtkKeyboardPrivate *priv = EEK_GTK_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
EekBounds bounds;
|
||||
gdouble x, y;
|
||||
|
||||
x = (gdouble)event->x / priv->scale;
|
||||
y = (gdouble)event->y / priv->scale;
|
||||
section = eek_container_find_by_position (EEK_CONTAINER(keyboard), x, y);
|
||||
if (section) {
|
||||
eek_element_get_bounds (keyboard, &bounds);
|
||||
x -= bounds.x;
|
||||
y -= bounds.y;
|
||||
key = eek_container_find_by_position (EEK_CONTAINER(section),
|
||||
x,
|
||||
y);
|
||||
if (key)
|
||||
switch (event->type) {
|
||||
case GDK_BUTTON_PRESS:
|
||||
key_enlarge (EEK_GTK_KEYBOARD(keyboard), EEK_KEY(key));
|
||||
g_signal_emit_by_name (keyboard, "key-pressed", key);
|
||||
return TRUE;
|
||||
case GDK_BUTTON_RELEASE:
|
||||
key_shrink (EEK_GTK_KEYBOARD(keyboard), EEK_KEY(key));
|
||||
g_signal_emit_by_name (keyboard, "key-released", key);
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
static void
|
||||
on_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekGtkKeyboard *keyboard = user_data;
|
||||
EekGtkKeyboardPrivate *priv =
|
||||
EEK_GTK_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
EekBounds bounds;
|
||||
GdkPixmap *pixmap;
|
||||
|
||||
if (priv->pixmap) {
|
||||
pixmap = priv->pixmap;
|
||||
priv->pixmap = NULL;
|
||||
g_object_unref (pixmap);
|
||||
}
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||
priv->scale = allocation->width > allocation->height ?
|
||||
allocation->width / bounds.width :
|
||||
allocation->height / bounds.height;
|
||||
}
|
||||
GtkWidget *
|
||||
eek_gtk_keyboard_get_widget (EekGtkKeyboard *keyboard)
|
||||
eek_gtk_keyboard_new (LevelKeyboard *keyboard)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv =
|
||||
EEK_GTK_KEYBOARD_GET_PRIVATE(keyboard);
|
||||
|
||||
if (!priv->widget) {
|
||||
priv->widget = gtk_drawing_area_new ();
|
||||
g_object_ref_sink (priv->widget);
|
||||
|
||||
gtk_widget_set_double_buffered (priv->widget, FALSE);
|
||||
gtk_widget_set_events (priv->widget,
|
||||
GDK_EXPOSURE_MASK |
|
||||
GDK_KEY_PRESS_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK);
|
||||
g_signal_connect (priv->widget, "expose_event",
|
||||
G_CALLBACK (on_expose_event), keyboard);
|
||||
g_signal_connect (priv->widget, "size-allocate",
|
||||
G_CALLBACK (on_size_allocate), keyboard);
|
||||
g_signal_connect (priv->widget, "button-press-event",
|
||||
G_CALLBACK (on_button_event), keyboard);
|
||||
g_signal_connect (priv->widget, "button-release-event",
|
||||
G_CALLBACK (on_button_event), keyboard);
|
||||
eek_keyboard_realize (EEK_KEYBOARD(keyboard));
|
||||
}
|
||||
return priv->widget;
|
||||
EekGtkKeyboard *ret = EEK_GTK_KEYBOARD(g_object_new (EEK_TYPE_GTK_KEYBOARD, NULL));
|
||||
EekGtkKeyboardPrivate *priv = (EekGtkKeyboardPrivate*)eek_gtk_keyboard_get_instance_private (ret);
|
||||
priv->keyboard = keyboard;
|
||||
return GTK_WIDGET(ret);
|
||||
}
|
||||
|
||||
static void
|
||||
render_pressed_button (GtkWidget *widget,
|
||||
struct button_place *place)
|
||||
{
|
||||
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (widget);
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
cairo_region_t *region = gdk_window_get_clip_region (window);
|
||||
GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
|
||||
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
|
||||
|
||||
eek_renderer_render_button (priv->renderer, cr, place, 1.0, TRUE);
|
||||
/*
|
||||
eek_renderer_render_key (priv->renderer, cr, key, 1.5, TRUE);
|
||||
*/
|
||||
gdk_window_end_draw_frame (window, context);
|
||||
|
||||
cairo_region_destroy (region);
|
||||
}
|
||||
|
||||
void
|
||||
eek_gtk_render_locked_button (EekGtkKeyboard *self, struct button_place place)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
GdkWindow *window = gtk_widget_get_window (GTK_WIDGET(self));
|
||||
cairo_region_t *region = gdk_window_get_clip_region (window);
|
||||
GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
|
||||
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
|
||||
|
||||
eek_renderer_render_button (priv->renderer, cr, &place, 1.0, TRUE);
|
||||
|
||||
gdk_window_end_draw_frame (window, context);
|
||||
|
||||
cairo_region_destroy (region);
|
||||
}
|
||||
|
||||
// TODO: does it really redraw the entire keyboard?
|
||||
static void
|
||||
render_released_button (GtkWidget *widget,
|
||||
const struct squeek_button *button)
|
||||
{
|
||||
(void)button;
|
||||
EekGtkKeyboard *self = EEK_GTK_KEYBOARD (widget);
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
cairo_region_t *region = gdk_window_get_clip_region (window);
|
||||
GdkDrawingContext *context = gdk_window_begin_draw_frame (window, region);
|
||||
cairo_t *cr = gdk_drawing_context_get_cairo_context (context);
|
||||
|
||||
eek_renderer_render_keyboard (priv->renderer, cr);
|
||||
|
||||
gdk_window_end_draw_frame (window, context);
|
||||
|
||||
cairo_region_destroy (region);
|
||||
}
|
||||
|
||||
void
|
||||
eek_gtk_on_button_pressed (struct button_place place,
|
||||
EekGtkKeyboard *self)
|
||||
{
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
/* renderer may have not been set yet if the widget is a popup */
|
||||
if (!priv->renderer)
|
||||
return;
|
||||
|
||||
if (!place.row) {
|
||||
return;
|
||||
}
|
||||
render_pressed_button (GTK_WIDGET(self), &place);
|
||||
gtk_widget_queue_draw (GTK_WIDGET(self));
|
||||
|
||||
#if HAVE_LIBCANBERRA
|
||||
ca_gtk_play_for_widget (widget, 0,
|
||||
CA_PROP_EVENT_ID, "button-pressed",
|
||||
CA_PROP_EVENT_DESCRIPTION, "virtual key pressed",
|
||||
CA_PROP_APPLICATION_ID, "org.fedorahosted.Eekboard",
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
eek_gtk_on_button_released (const struct squeek_button *button,
|
||||
struct squeek_view *view,
|
||||
EekGtkKeyboard *self)
|
||||
{
|
||||
(void)view;
|
||||
EekGtkKeyboardPrivate *priv = eek_gtk_keyboard_get_instance_private (self);
|
||||
|
||||
/* renderer may have not been set yet if the widget is a popup */
|
||||
if (!priv->renderer)
|
||||
return;
|
||||
|
||||
render_released_button (GTK_WIDGET(self), button);
|
||||
gtk_widget_queue_draw (GTK_WIDGET(self));
|
||||
|
||||
#if HAVE_LIBCANBERRA
|
||||
ca_gtk_play_for_widget (widget, 0,
|
||||
CA_PROP_EVENT_ID, "button-released",
|
||||
CA_PROP_EVENT_DESCRIPTION, "virtual key pressed",
|
||||
CA_PROP_APPLICATION_ID, "org.fedorahosted.Eekboard",
|
||||
NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -17,36 +17,27 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
||||
#error "Only <eek/eek-gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef EEK_GTK_KEYBOARD_H
|
||||
#define EEK_GTK_KEYBOARD_H 1
|
||||
|
||||
#include <glib.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "eek-keyboard.h"
|
||||
|
||||
typedef struct _LevelKeyboard LevelKeyboard; // including causes weird bugs
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#define EEK_TYPE_GTK_KEYBOARD (eek_gtk_keyboard_get_type())
|
||||
#define EEK_GTK_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_GTK_KEYBOARD, EekGtkKeyboard))
|
||||
#define EEK_GTK_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_GTK_KEYBOARD, EekGtkKeyboardClass))
|
||||
#define EEK_IS_GTK_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_GTK_KEYBOARD))
|
||||
#define EEK_IS_GTK_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_GTK_KEYBOARD))
|
||||
#define EEK_GTK_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_GTK_KEYBOARD, EekGtkKeyboardClass))
|
||||
|
||||
typedef struct _EekGtkKeyboard EekGtkKeyboard;
|
||||
typedef struct _EekGtkKeyboardClass EekGtkKeyboardClass;
|
||||
typedef struct _EekGtkKeyboardPrivate EekGtkKeyboardPrivate;
|
||||
|
||||
struct _EekGtkKeyboard
|
||||
{
|
||||
/*< private >*/
|
||||
EekKeyboard parent;
|
||||
|
||||
EekGtkKeyboardPrivate *priv;
|
||||
};
|
||||
G_DECLARE_DERIVABLE_TYPE (EekGtkKeyboard, eek_gtk_keyboard, EEK, GTK_KEYBOARD, GtkDrawingArea)
|
||||
|
||||
struct _EekGtkKeyboardClass
|
||||
{
|
||||
/*< private >*/
|
||||
EekKeyboardClass parent_class;
|
||||
GtkDrawingAreaClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
@@ -54,8 +45,7 @@ struct _EekGtkKeyboardClass
|
||||
};
|
||||
|
||||
GType eek_gtk_keyboard_get_type (void) G_GNUC_CONST;
|
||||
EekKeyboard *eek_gtk_keyboard_new (void);
|
||||
GtkWidget *eek_gtk_keyboard_get_widget (EekGtkKeyboard *keyboard);
|
||||
GtkWidget *eek_gtk_keyboard_new (LevelKeyboard *keyboard);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_GTK_KEYBOARD_H */
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_GTK_H
|
||||
#define EEK_GTK_H 1
|
||||
|
||||
#include "eek.h"
|
||||
#include "eek-gtk-keyboard.h"
|
||||
|
||||
#endif /* EEK_GTK_H */
|
||||
693
eek/eek-key.c
693
eek/eek-key.c
@@ -1,693 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:eek-key
|
||||
* @short_description: Base class of a key
|
||||
*
|
||||
* The #EekKeyClass class represents a key.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
#define DEBUG 0
|
||||
#if DEBUG
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
#include "eek-key.h"
|
||||
#include "eek-keysym.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_KEYCODE,
|
||||
PROP_KEYSYMS,
|
||||
PROP_COLUMN,
|
||||
PROP_ROW,
|
||||
PROP_OUTLINE,
|
||||
PROP_GROUP,
|
||||
PROP_LEVEL,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
enum {
|
||||
PRESSED,
|
||||
RELEASED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_TYPE (EekKey, eek_key, EEK_TYPE_ELEMENT);
|
||||
|
||||
#define EEK_KEY_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_KEY, EekKeyPrivate))
|
||||
|
||||
|
||||
struct _EekKeyPrivate
|
||||
{
|
||||
guint keycode;
|
||||
EekKeysymMatrix keysyms;
|
||||
gint column;
|
||||
gint row;
|
||||
EekOutline *outline;
|
||||
gint group;
|
||||
gint level;
|
||||
};
|
||||
|
||||
static void
|
||||
eek_key_real_set_keycode (EekKey *self, guint keycode)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
priv->keycode = keycode;
|
||||
}
|
||||
|
||||
static guint
|
||||
eek_key_real_get_keycode (EekKey *self)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
return priv->keycode;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_real_set_keysyms (EekKey *self,
|
||||
guint *keysyms,
|
||||
gint num_groups,
|
||||
gint num_levels)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
gint num_keysyms = num_groups * num_levels;
|
||||
|
||||
if (num_keysyms > 0) {
|
||||
priv->keysyms.data =
|
||||
g_slice_alloc (num_keysyms * sizeof(guint));
|
||||
memcpy (priv->keysyms.data, keysyms,
|
||||
num_keysyms * sizeof(guint));
|
||||
}
|
||||
priv->keysyms.num_groups = num_groups;
|
||||
priv->keysyms.num_levels = num_levels;
|
||||
|
||||
#if DEBUG
|
||||
{
|
||||
const gchar *name;
|
||||
gint i;
|
||||
|
||||
name = eek_element_get_name (EEK_ELEMENT(self));
|
||||
fprintf (stderr, "%s: ", name);
|
||||
for (i = 0; i < priv->keysyms.num_groups * priv->keysyms.num_levels; i++)
|
||||
fprintf (stderr, "\"%s\" ", eek_keysym_to_string (priv->keysyms.data[i]));
|
||||
fprintf (stderr, "\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_real_get_keysyms (EekKey *self,
|
||||
guint **keysyms,
|
||||
gint *num_groups,
|
||||
gint *num_levels)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
gint num_keysyms = priv->keysyms.num_groups * priv->keysyms.num_levels;
|
||||
|
||||
if (num_groups)
|
||||
*num_groups = priv->keysyms.num_groups;
|
||||
if (num_levels)
|
||||
*num_levels = priv->keysyms.num_levels;
|
||||
if (keysyms && num_keysyms > 0) {
|
||||
*keysyms = g_slice_alloc (num_keysyms * sizeof(guint));
|
||||
memcpy (*keysyms, priv->keysyms.data, num_keysyms * sizeof(guint));
|
||||
}
|
||||
}
|
||||
|
||||
static guint
|
||||
eek_key_real_get_keysym (EekKey *self)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
gint num_keysyms = priv->keysyms.num_groups * priv->keysyms.num_levels;
|
||||
|
||||
if (num_keysyms == 0)
|
||||
return EEK_INVALID_KEYSYM;
|
||||
return priv->keysyms.data[priv->group * priv->keysyms.num_levels +
|
||||
priv->level];
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_real_set_index (EekKey *self,
|
||||
gint column,
|
||||
gint row)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
|
||||
g_return_if_fail (0 <= column);
|
||||
g_return_if_fail (0 <= row);
|
||||
priv->column = column;
|
||||
priv->row = row;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_real_get_index (EekKey *self,
|
||||
gint *column,
|
||||
gint *row)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
|
||||
if (column)
|
||||
*column = priv->column;
|
||||
if (row)
|
||||
*row = priv->row;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_real_set_outline (EekKey *self, EekOutline *outline)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
priv->outline = outline;
|
||||
}
|
||||
|
||||
static EekOutline *
|
||||
eek_key_real_get_outline (EekKey *self)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
return priv->outline;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_real_set_keysym_index (EekKey *self,
|
||||
gint group,
|
||||
gint level)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
|
||||
g_return_if_fail (0 <= group);
|
||||
if (group >= priv->keysyms.num_groups)
|
||||
group = 0;
|
||||
g_return_if_fail (0 <= level);
|
||||
if (level >= priv->keysyms.num_levels)
|
||||
level = 0;
|
||||
priv->group = group;
|
||||
priv->level = level;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_real_get_keysym_index (EekKey *self,
|
||||
gint *group,
|
||||
gint *level)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(self);
|
||||
|
||||
g_return_if_fail (group);
|
||||
g_return_if_fail (level);
|
||||
if (group)
|
||||
*group = priv->group;
|
||||
if (level)
|
||||
*level = priv->level;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_real_pressed (EekKey *key)
|
||||
{
|
||||
g_debug ("pressed %X", eek_key_get_keycode (key));
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_real_released (EekKey *key)
|
||||
{
|
||||
g_debug ("released %X", eek_key_get_keycode (key));
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_finalize (GObject *object)
|
||||
{
|
||||
EekKeyPrivate *priv = EEK_KEY_GET_PRIVATE(object);
|
||||
gint num_keysyms = priv->keysyms.num_groups * priv->keysyms.num_levels;
|
||||
|
||||
g_slice_free1 (num_keysyms * sizeof (guint), priv->keysyms.data);
|
||||
G_OBJECT_CLASS (eek_key_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
EekKeysymMatrix *matrix;
|
||||
gint column, row;
|
||||
gint group, level;
|
||||
|
||||
g_return_if_fail (EEK_IS_KEY(object));
|
||||
switch (prop_id) {
|
||||
case PROP_KEYCODE:
|
||||
eek_key_set_keycode (EEK_KEY(object), g_value_get_uint (value));
|
||||
break;
|
||||
case PROP_KEYSYMS:
|
||||
matrix = g_value_get_boxed (value);
|
||||
eek_key_set_keysyms (EEK_KEY(object),
|
||||
matrix->data,
|
||||
matrix->num_groups,
|
||||
matrix->num_levels);
|
||||
break;
|
||||
case PROP_COLUMN:
|
||||
eek_key_get_index (EEK_KEY(object), &column, &row);
|
||||
eek_key_set_index (EEK_KEY(object), g_value_get_int (value), row);
|
||||
break;
|
||||
case PROP_ROW:
|
||||
eek_key_get_index (EEK_KEY(object), &column, &row);
|
||||
eek_key_set_index (EEK_KEY(object), column, g_value_get_int (value));
|
||||
break;
|
||||
case PROP_OUTLINE:
|
||||
eek_key_set_outline (EEK_KEY(object), g_value_get_pointer (value));
|
||||
break;
|
||||
case PROP_GROUP:
|
||||
eek_key_get_keysym_index (EEK_KEY(object), &group, &level);
|
||||
eek_key_set_keysym_index (EEK_KEY(object), g_value_get_int (value),
|
||||
level);
|
||||
break;
|
||||
case PROP_LEVEL:
|
||||
eek_key_get_keysym_index (EEK_KEY(object), &group, &level);
|
||||
eek_key_set_keysym_index (EEK_KEY(object), group,
|
||||
g_value_get_int (value));
|
||||
break;
|
||||
default:
|
||||
g_object_set_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
EekKeysymMatrix matrix;
|
||||
gint column, row;
|
||||
gint group, level;
|
||||
|
||||
g_return_if_fail (EEK_IS_KEY(object));
|
||||
switch (prop_id) {
|
||||
case PROP_KEYCODE:
|
||||
g_value_set_uint (value, eek_key_get_keycode (EEK_KEY(object)));
|
||||
break;
|
||||
case PROP_KEYSYMS:
|
||||
eek_key_get_keysyms (EEK_KEY(object), &matrix.data, &matrix.num_groups,
|
||||
&matrix.num_levels);
|
||||
g_value_set_boxed (value, &matrix);
|
||||
break;
|
||||
case PROP_COLUMN:
|
||||
eek_key_get_index (EEK_KEY(object), &column, &row);
|
||||
g_value_set_int (value, column);
|
||||
break;
|
||||
case PROP_ROW:
|
||||
eek_key_get_index (EEK_KEY(object), &column, &row);
|
||||
g_value_set_int (value, row);
|
||||
break;
|
||||
case PROP_OUTLINE:
|
||||
g_value_set_pointer (value, eek_key_get_outline (EEK_KEY(object)));
|
||||
break;
|
||||
case PROP_GROUP:
|
||||
eek_key_get_keysym_index (EEK_KEY(object), &group, &level);
|
||||
g_value_set_int (value, group);
|
||||
break;
|
||||
case PROP_LEVEL:
|
||||
eek_key_get_keysym_index (EEK_KEY(object), &group, &level);
|
||||
g_value_set_int (value, level);
|
||||
break;
|
||||
default:
|
||||
g_object_get_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_class_init (EekKeyClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekKeyPrivate));
|
||||
|
||||
klass->get_keycode = eek_key_real_get_keycode;
|
||||
klass->set_keycode = eek_key_real_set_keycode;
|
||||
klass->set_keysyms = eek_key_real_set_keysyms;
|
||||
klass->get_keysyms = eek_key_real_get_keysyms;
|
||||
klass->get_keysym = eek_key_real_get_keysym;
|
||||
klass->set_index = eek_key_real_set_index;
|
||||
klass->get_index = eek_key_real_get_index;
|
||||
klass->set_outline = eek_key_real_set_outline;
|
||||
klass->get_outline = eek_key_real_get_outline;
|
||||
klass->set_keysym_index = eek_key_real_set_keysym_index;
|
||||
klass->get_keysym_index = eek_key_real_get_keysym_index;
|
||||
|
||||
gobject_class->set_property = eek_key_set_property;
|
||||
gobject_class->get_property = eek_key_get_property;
|
||||
gobject_class->finalize = eek_key_finalize;
|
||||
|
||||
/* signals */
|
||||
klass->pressed = eek_key_real_pressed;
|
||||
klass->released = eek_key_real_released;
|
||||
|
||||
/**
|
||||
* EekKey:keycode:
|
||||
*
|
||||
* The keycode of #EekKey.
|
||||
*/
|
||||
pspec = g_param_spec_uint ("keycode",
|
||||
"Keycode",
|
||||
"Keycode of the key",
|
||||
0, G_MAXUINT, 0,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_KEYCODE, pspec);
|
||||
|
||||
/**
|
||||
* EekKey:keysyms:
|
||||
*
|
||||
* The symbol matrix of #EekKey.
|
||||
*/
|
||||
pspec = g_param_spec_boxed ("keysyms",
|
||||
"Keysyms",
|
||||
"Symbol matrix of the key",
|
||||
EEK_TYPE_KEYSYM_MATRIX,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_KEYSYMS, pspec);
|
||||
|
||||
/**
|
||||
* EekKey:column:
|
||||
*
|
||||
* The column index of #EekKey in the parent #EekSection.
|
||||
*/
|
||||
pspec = g_param_spec_int ("column",
|
||||
"Column",
|
||||
"Column index of the key in section",
|
||||
-1, G_MAXINT, -1,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_COLUMN, pspec);
|
||||
|
||||
/**
|
||||
* EekKey:row:
|
||||
*
|
||||
* The row index of #EekKey in the parent #EekSection.
|
||||
*/
|
||||
pspec = g_param_spec_int ("row",
|
||||
"Row",
|
||||
"Row index of the key in section",
|
||||
-1, G_MAXINT, -1,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_ROW, pspec);
|
||||
|
||||
/**
|
||||
* EekKey:outline:
|
||||
*
|
||||
* The pointer to the outline shape of #EekKey.
|
||||
*/
|
||||
/* Use pointer instead of boxed to avoid copy, since we can
|
||||
assume that only a few outline shapes are used in a whole
|
||||
keyboard (unlike keysyms and bounds). */
|
||||
pspec = g_param_spec_pointer ("outline",
|
||||
"Outline",
|
||||
"Pointer to outline shape of the key",
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_OUTLINE, pspec);
|
||||
|
||||
/**
|
||||
* EekKey:group:
|
||||
*
|
||||
* The column index of #EekKey in the symbol matrix #EekKey:keysyms.
|
||||
*/
|
||||
pspec = g_param_spec_int ("group",
|
||||
"Group",
|
||||
"Current group of the key",
|
||||
0, 64, 0,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_GROUP, pspec);
|
||||
|
||||
/**
|
||||
* EekKey:level:
|
||||
*
|
||||
* The row index of #EekKey in the symbol matrix #EekKey:keysyms.
|
||||
*/
|
||||
pspec = g_param_spec_int ("level",
|
||||
"Level",
|
||||
"Current level of the key",
|
||||
0, 3, 0,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_LEVEL, pspec);
|
||||
|
||||
/**
|
||||
* EekKey::pressed:
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* The ::pressed signal is emitted each time @key is shifted to
|
||||
* the pressed state.
|
||||
*/
|
||||
signals[PRESSED] =
|
||||
g_signal_new ("pressed",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(EekKeyClass, pressed),
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
/**
|
||||
* EekKey::released:
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* The ::released signal is emitted each time @key is shifted to
|
||||
* the released state.
|
||||
*/
|
||||
signals[RELEASED] =
|
||||
g_signal_new ("released",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(EekKeyClass, released),
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_key_init (EekKey *self)
|
||||
{
|
||||
EekKeyPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_KEY_GET_PRIVATE(self);
|
||||
priv->keycode = 0;
|
||||
memset (&priv->keysyms, 0, sizeof priv->keysyms);
|
||||
priv->column = priv->row = 0;
|
||||
priv->outline = NULL;
|
||||
priv->group = priv->level = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_set_keycode:
|
||||
* @key: an #EekKey
|
||||
* @keycode: keycode
|
||||
*
|
||||
* Set keycode of @key to @keycode.
|
||||
*/
|
||||
void
|
||||
eek_key_set_keycode (EekKey *key,
|
||||
guint keycode)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEY (key));
|
||||
EEK_KEY_GET_CLASS(key)->set_keycode (key, keycode);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_get_keycode:
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* Get keycode of @key.
|
||||
* Returns: keycode or %EEK_INVALID_KEYCODE on failure
|
||||
*/
|
||||
guint
|
||||
eek_key_get_keycode (EekKey *key)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_KEY (key), EEK_INVALID_KEYCODE);
|
||||
return EEK_KEY_GET_CLASS(key)->get_keycode (key);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_set_keysyms:
|
||||
* @key: an #EekKey
|
||||
* @keysyms: symbol matrix of @key
|
||||
* @num_groups: number of groups (rows) of @keysyms
|
||||
* @num_levels: number of levels (columns) of @keysyms
|
||||
*
|
||||
* Set the symbol matrix of @key to @keysyms. The length of @keysyms
|
||||
* is @num_groups * @num_levels.
|
||||
*/
|
||||
void
|
||||
eek_key_set_keysyms (EekKey *key,
|
||||
guint *keysyms,
|
||||
gint num_groups,
|
||||
gint num_levels)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEY(key));
|
||||
EEK_KEY_GET_CLASS(key)->set_keysyms (key, keysyms, num_groups, num_levels);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_get_keysyms:
|
||||
* @key: an #EekKey
|
||||
* @keysyms: pointer where symbol matrix of @key will be stored
|
||||
* @num_groups: pointer where the number of groups (rows) of @keysyms
|
||||
* will be stored
|
||||
* @num_levels: pointer where the number of levels (columns) of
|
||||
* @keysyms will be stored
|
||||
*
|
||||
* Get the symbol matrix of @key. If either @keysyms, @num_groups, or
|
||||
* @num_levels are NULL, this function does not try to get the value.
|
||||
*/
|
||||
void
|
||||
eek_key_get_keysyms (EekKey *key,
|
||||
guint **keysyms,
|
||||
gint *num_groups,
|
||||
gint *num_levels)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEY(key));
|
||||
EEK_KEY_GET_CLASS(key)->get_keysyms (key, keysyms, num_groups, num_levels);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_get_keysym:
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* Get the current symbol of @key.
|
||||
* Returns: a symbol or %EEK_INVALID_KEYSYM on failure
|
||||
*/
|
||||
guint
|
||||
eek_key_get_keysym (EekKey *key)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_KEY(key), EEK_INVALID_KEYSYM);
|
||||
return EEK_KEY_GET_CLASS(key)->get_keysym (key);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_set_index:
|
||||
* @key: an #EekKey
|
||||
* @column: column index of @key in #EekSection
|
||||
* @row: row index of @key in #EekSection
|
||||
*
|
||||
* Set the index of @key (i.e. logical location of @key in
|
||||
* #EekSection) to @column and @row.
|
||||
*/
|
||||
void
|
||||
eek_key_set_index (EekKey *key,
|
||||
gint column,
|
||||
gint row)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEY(key));
|
||||
EEK_KEY_GET_CLASS(key)->set_index (key, column, row);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_get_index:
|
||||
* @key: an #EekKey
|
||||
* @column: pointer where the column index of @key in #EekSection will be stored
|
||||
* @row: pointer where the row index of @key in #EekSection will be stored
|
||||
*
|
||||
* Get the index of @key (i.e. logical location of @key in
|
||||
* #EekSection).
|
||||
*/
|
||||
void
|
||||
eek_key_get_index (EekKey *key,
|
||||
gint *column,
|
||||
gint *row)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEY(key));
|
||||
EEK_KEY_GET_CLASS(key)->get_index (key, column, row);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_set_outline:
|
||||
* @key: an #EekKey
|
||||
* @outline: outline of @key
|
||||
*
|
||||
* Set the outline shape of @key to @outline.
|
||||
*/
|
||||
void
|
||||
eek_key_set_outline (EekKey *key,
|
||||
EekOutline *outline)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEY(key));
|
||||
EEK_KEY_GET_CLASS(key)->set_outline (key, outline);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_get_outline:
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* Get the outline shape of @key.
|
||||
* Returns: an #EekOutline pointer or NULL on failure
|
||||
*/
|
||||
EekOutline *
|
||||
eek_key_get_outline (EekKey *key)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_KEY (key), NULL);
|
||||
return EEK_KEY_GET_CLASS(key)->get_outline (key);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_set_keysym_index:
|
||||
* @key: an #EekKey
|
||||
* @group: group (row) index of @key
|
||||
* @level: level (column) index of @key
|
||||
*
|
||||
* Set the current group and/or level index of @key in its symbol
|
||||
* matrix to @group and @level.
|
||||
*/
|
||||
void
|
||||
eek_key_set_keysym_index (EekKey *key,
|
||||
gint group,
|
||||
gint level)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEY(key));
|
||||
EEK_KEY_GET_CLASS(key)->set_keysym_index (key, group, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_key_get_keysym_index:
|
||||
* @key: an #EekKey
|
||||
* @group: pointer where group (row) index of @key will be stored
|
||||
* @level: pointer where level (column) index of @key will be stored
|
||||
*
|
||||
* Get the current group and/or level index of @key in its symbol
|
||||
* matrix.
|
||||
*/
|
||||
void
|
||||
eek_key_get_keysym_index (EekKey *key,
|
||||
gint *group,
|
||||
gint *level)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEY(key));
|
||||
EEK_KEY_GET_CLASS(key)->get_keysym_index (key, group, level);
|
||||
}
|
||||
141
eek/eek-key.h
141
eek/eek-key.h
@@ -1,141 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_KEY_H
|
||||
#define EEK_KEY_H 1
|
||||
|
||||
#include <glib-object.h>
|
||||
#include "eek-element.h"
|
||||
#include "eek-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEK_TYPE_KEY (eek_key_get_type())
|
||||
#define EEK_KEY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_KEY, EekKey))
|
||||
#define EEK_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_KEY, EekKeyClass))
|
||||
#define EEK_IS_KEY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_KEY))
|
||||
#define EEK_IS_KEY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_KEY))
|
||||
#define EEK_KEY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_KEY, EekKeyClass))
|
||||
|
||||
typedef struct _EekKeyClass EekKeyClass;
|
||||
typedef struct _EekKeyPrivate EekKeyPrivate;
|
||||
|
||||
struct _EekKey
|
||||
{
|
||||
/*< private >*/
|
||||
EekElement parent;
|
||||
|
||||
EekKeyPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* EekKeyClass:
|
||||
* @set_keycode: virtual function for setting keycode of the key
|
||||
* @get_keycode: virtual function for getting keycode of the key
|
||||
* @set_keysyms: virtual function for setting symbol matrix of the key
|
||||
* @get_keysyms: virtual function for getting symbol matrix of the key
|
||||
* @get_keysym: virtual function for getting the current symbol of the key
|
||||
* @set_index: virtual function for setting position of the key in the
|
||||
* section
|
||||
* @get_index: virtual function for getting position of the key in the
|
||||
* section
|
||||
* @set_outline: virtual function for setting outline shape of the key
|
||||
* @get_outline: virtual function for getting outline shape of the key
|
||||
* @set_keysym_index: virtual function for setting group and level of the key
|
||||
* @get_keysym_index: virtual function for getting group and level of the key
|
||||
* @pressed: class handler for #EekKey::pressed signal
|
||||
* @released: class handler for #EekKey::released signal
|
||||
*/
|
||||
struct _EekKeyClass
|
||||
{
|
||||
/*< private >*/
|
||||
EekElementClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
void (* set_keycode) (EekKey *self,
|
||||
guint keycode);
|
||||
guint (* get_keycode) (EekKey *self);
|
||||
void (* set_keysyms) (EekKey *self,
|
||||
guint *keysyms,
|
||||
gint num_groups,
|
||||
gint num_levels);
|
||||
void (* get_keysyms) (EekKey *self,
|
||||
guint **keysyms,
|
||||
gint *num_groups,
|
||||
gint *num_levels);
|
||||
guint (* get_keysym) (EekKey *self);
|
||||
|
||||
void (* set_index) (EekKey *self,
|
||||
gint column,
|
||||
gint row);
|
||||
void (* get_index) (EekKey *self,
|
||||
gint *column,
|
||||
gint *row);
|
||||
|
||||
void (* set_outline) (EekKey *self,
|
||||
EekOutline *outline);
|
||||
EekOutline *(* get_outline) (EekKey *self);
|
||||
|
||||
void (* set_keysym_index) (EekKey *self,
|
||||
gint group,
|
||||
gint level);
|
||||
void (* get_keysym_index) (EekKey *self,
|
||||
gint *group,
|
||||
gint *level);
|
||||
|
||||
/* signals */
|
||||
void (* pressed) (EekKey *key);
|
||||
void (* released) (EekKey *key);
|
||||
};
|
||||
|
||||
GType eek_key_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void eek_key_set_keycode (EekKey *key,
|
||||
guint keycode);
|
||||
guint eek_key_get_keycode (EekKey *key);
|
||||
void eek_key_set_keysyms (EekKey *key,
|
||||
guint *keysyms,
|
||||
gint num_groups,
|
||||
gint num_levels);
|
||||
void eek_key_get_keysyms (EekKey *key,
|
||||
guint **keysyms,
|
||||
gint *num_groups,
|
||||
gint *num_levels);
|
||||
guint eek_key_get_keysym (EekKey *key);
|
||||
|
||||
void eek_key_set_index (EekKey *key,
|
||||
gint column,
|
||||
gint row);
|
||||
void eek_key_get_index (EekKey *key,
|
||||
gint *column,
|
||||
gint *row);
|
||||
|
||||
void eek_key_set_outline (EekKey *key,
|
||||
EekOutline *outline);
|
||||
EekOutline *eek_key_get_outline (EekKey *key);
|
||||
|
||||
void eek_key_set_keysym_index (EekKey *key,
|
||||
gint group,
|
||||
gint level);
|
||||
void eek_key_get_keysym_index (EekKey *key,
|
||||
gint *group,
|
||||
gint *level);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_KEY_H */
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -27,460 +27,40 @@
|
||||
* of one or more sections of the #EekSectionClass class.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
#include <glib/gprintf.h>
|
||||
|
||||
#include "eek-enumtypes.h"
|
||||
#include "eekboard/eekboard-context-service.h"
|
||||
#include "eekboard/key-emitter.h"
|
||||
#include "keymap.h"
|
||||
#include "src/keyboard.h"
|
||||
|
||||
#include "eek-keyboard.h"
|
||||
#include "eek-section.h"
|
||||
#include "eek-key.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_GROUP,
|
||||
PROP_LEVEL,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
enum {
|
||||
KEY_PRESSED,
|
||||
KEY_RELEASED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_TYPE (EekKeyboard, eek_keyboard, EEK_TYPE_CONTAINER);
|
||||
|
||||
#define EEK_KEYBOARD_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_KEYBOARD, EekKeyboardPrivate))
|
||||
|
||||
|
||||
struct _EekKeyboardPrivate
|
||||
{
|
||||
gint group;
|
||||
gint level;
|
||||
EekLayout *layout;
|
||||
gboolean is_realized;
|
||||
};
|
||||
|
||||
struct keysym_index {
|
||||
gint group;
|
||||
gint level;
|
||||
};
|
||||
|
||||
static void
|
||||
set_keysym_index_for_key (EekElement *element,
|
||||
gpointer user_data)
|
||||
{
|
||||
struct keysym_index *ki;
|
||||
|
||||
g_return_if_fail (EEK_IS_KEY(element));
|
||||
|
||||
ki = user_data;
|
||||
eek_key_set_keysym_index (EEK_KEY(element), ki->group, ki->level);
|
||||
void level_keyboard_deinit(LevelKeyboard *self) {
|
||||
xkb_keymap_unref(self->keymap);
|
||||
close(self->keymap_fd);
|
||||
squeek_layout_free(self->layout);
|
||||
}
|
||||
|
||||
static void
|
||||
set_keysym_index_for_section (EekElement *element,
|
||||
gpointer user_data)
|
||||
{
|
||||
eek_container_foreach_child (EEK_CONTAINER(element),
|
||||
set_keysym_index_for_key,
|
||||
user_data);
|
||||
void level_keyboard_free(LevelKeyboard *self) {
|
||||
level_keyboard_deinit(self);
|
||||
g_free(self);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_keyboard_real_set_keysym_index (EekKeyboard *self,
|
||||
gint group,
|
||||
gint level)
|
||||
{
|
||||
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
|
||||
struct keysym_index ki;
|
||||
|
||||
ki.group = priv->group = group;
|
||||
ki.level = priv->level = level;
|
||||
|
||||
eek_container_foreach_child (EEK_CONTAINER(self),
|
||||
set_keysym_index_for_section,
|
||||
&ki);
|
||||
void level_keyboard_init(LevelKeyboard *self, struct squeek_layout *layout) {
|
||||
self->layout = layout;
|
||||
}
|
||||
|
||||
void
|
||||
eek_keyboard_real_get_keysym_index (EekKeyboard *self,
|
||||
gint *group,
|
||||
gint *level)
|
||||
{
|
||||
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
|
||||
|
||||
g_return_if_fail (group || level);
|
||||
if (group)
|
||||
*group = priv->group;
|
||||
if (level)
|
||||
*level = priv->level;
|
||||
LevelKeyboard *level_keyboard_new(EekboardContextService *manager, struct squeek_layout *layout) {
|
||||
LevelKeyboard *keyboard = g_new0(LevelKeyboard, 1);
|
||||
level_keyboard_init(keyboard, layout);
|
||||
keyboard->manager = manager;
|
||||
return keyboard;
|
||||
}
|
||||
|
||||
static void
|
||||
key_pressed_event (EekSection *section,
|
||||
EekKey *key,
|
||||
EekKeyboard *keyboard)
|
||||
struct squeek_view *level_keyboard_current(LevelKeyboard *keyboard)
|
||||
{
|
||||
g_signal_emit_by_name (keyboard, "key-pressed", key);
|
||||
}
|
||||
|
||||
static void
|
||||
key_released_event (EekSection *section,
|
||||
EekKey *key,
|
||||
EekKeyboard *keyboard)
|
||||
{
|
||||
g_signal_emit_by_name (keyboard, "key-released", key);
|
||||
}
|
||||
|
||||
static EekSection *
|
||||
eek_keyboard_real_create_section (EekKeyboard *self)
|
||||
{
|
||||
EekSection *section;
|
||||
|
||||
section = g_object_new (EEK_TYPE_SECTION, NULL);
|
||||
g_return_val_if_fail (section, NULL);
|
||||
|
||||
g_signal_connect (section, "key-pressed",
|
||||
G_CALLBACK(key_pressed_event), self);
|
||||
g_signal_connect (section, "key-released",
|
||||
G_CALLBACK(key_released_event), self);
|
||||
|
||||
EEK_CONTAINER_GET_CLASS(self)->add_child (EEK_CONTAINER(self),
|
||||
EEK_ELEMENT(section));
|
||||
return section;
|
||||
}
|
||||
|
||||
static void
|
||||
on_group_changed (EekLayout *layout,
|
||||
gint new_group,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekKeyboard *keyboard = user_data;
|
||||
gint group, level;
|
||||
|
||||
eek_keyboard_get_keysym_index (keyboard, &group, &level);
|
||||
eek_keyboard_set_keysym_index (keyboard, new_group, level);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_keyboard_real_set_layout (EekKeyboard *self,
|
||||
EekLayout *layout)
|
||||
{
|
||||
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
|
||||
|
||||
g_return_if_fail (EEK_IS_LAYOUT(layout));
|
||||
priv->layout = layout;
|
||||
g_object_ref_sink (priv->layout);
|
||||
g_signal_connect (priv->layout, "group_changed",
|
||||
G_CALLBACK(on_group_changed), self);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_keyboard_real_realize (EekKeyboard *self)
|
||||
{
|
||||
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(self);
|
||||
|
||||
g_return_if_fail (priv->layout);
|
||||
g_return_if_fail (!priv->is_realized);
|
||||
EEK_LAYOUT_GET_IFACE(priv->layout)->apply (priv->layout, self);
|
||||
/* apply the initial group setting */
|
||||
on_group_changed (priv->layout, eek_layout_get_group (priv->layout), self);
|
||||
priv->is_realized = TRUE;
|
||||
}
|
||||
|
||||
struct _FkbkData {
|
||||
EekKey *key;
|
||||
guint keycode;
|
||||
};
|
||||
typedef struct _FkbkData FkbkData;
|
||||
|
||||
static gint
|
||||
compare_section_by_keycode (EekElement *element, gpointer user_data)
|
||||
{
|
||||
FkbkData *data = user_data;
|
||||
|
||||
data->key = eek_section_find_key_by_keycode (EEK_SECTION(element),
|
||||
data->keycode);
|
||||
if (data->key)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static EekKey *
|
||||
eek_keyboard_real_find_key_by_keycode (EekKeyboard *self,
|
||||
guint keycode)
|
||||
{
|
||||
FkbkData data;
|
||||
|
||||
data.keycode = keycode;
|
||||
if (eek_container_find (EEK_CONTAINER(self),
|
||||
compare_section_by_keycode,
|
||||
&data))
|
||||
return data.key;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_keyboard_dispose (GObject *object)
|
||||
{
|
||||
EekKeyboardPrivate *priv = EEK_KEYBOARD_GET_PRIVATE(object);
|
||||
|
||||
if (priv->layout) {
|
||||
g_object_unref (priv->layout);
|
||||
priv->layout = NULL;
|
||||
}
|
||||
G_OBJECT_CLASS(eek_keyboard_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_keyboard_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
gint group, level;
|
||||
|
||||
g_return_if_fail (EEK_IS_KEYBOARD(object));
|
||||
switch (prop_id) {
|
||||
case PROP_GROUP:
|
||||
eek_keyboard_get_keysym_index (EEK_KEYBOARD(object), &group, &level);
|
||||
eek_keyboard_set_keysym_index (EEK_KEYBOARD(object),
|
||||
g_value_get_int (value),
|
||||
level);
|
||||
break;
|
||||
case PROP_LEVEL:
|
||||
eek_keyboard_get_keysym_index (EEK_KEYBOARD(object), &group, &level);
|
||||
eek_keyboard_set_keysym_index (EEK_KEYBOARD(object),
|
||||
group,
|
||||
g_value_get_int (value));
|
||||
break;
|
||||
default:
|
||||
g_object_set_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_keyboard_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
gint group, level;
|
||||
|
||||
g_return_if_fail (EEK_IS_KEYBOARD(object));
|
||||
switch (prop_id) {
|
||||
case PROP_GROUP:
|
||||
eek_keyboard_get_keysym_index (EEK_KEYBOARD(object), &group, &level);
|
||||
g_value_set_int (value, group);
|
||||
break;
|
||||
case PROP_LEVEL:
|
||||
eek_keyboard_get_keysym_index (EEK_KEYBOARD(object), &level, &level);
|
||||
g_value_set_int (value, level);
|
||||
break;
|
||||
default:
|
||||
g_object_get_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_keyboard_class_init (EekKeyboardClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_type_class_add_private (gobject_class,
|
||||
sizeof (EekKeyboardPrivate));
|
||||
|
||||
klass->set_keysym_index = eek_keyboard_real_set_keysym_index;
|
||||
klass->get_keysym_index = eek_keyboard_real_get_keysym_index;
|
||||
klass->create_section = eek_keyboard_real_create_section;
|
||||
klass->set_layout = eek_keyboard_real_set_layout;
|
||||
klass->realize = eek_keyboard_real_realize;
|
||||
klass->find_key_by_keycode = eek_keyboard_real_find_key_by_keycode;
|
||||
|
||||
gobject_class->get_property = eek_keyboard_get_property;
|
||||
gobject_class->set_property = eek_keyboard_set_property;
|
||||
gobject_class->dispose = eek_keyboard_dispose;
|
||||
|
||||
/**
|
||||
* EekKeyboard:group:
|
||||
*
|
||||
* The group (row) index of symbol matrix of #EekKeyboard.
|
||||
*/
|
||||
pspec = g_param_spec_int ("group",
|
||||
"Group",
|
||||
"Group index of symbol matrix of the keyboard",
|
||||
0, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_GROUP,
|
||||
pspec);
|
||||
|
||||
/**
|
||||
* EekKeyboard:level:
|
||||
*
|
||||
* The level (row) index of symbol matrix of #EekKeyboard.
|
||||
*/
|
||||
pspec = g_param_spec_int ("level",
|
||||
"Level",
|
||||
"Level index of symbol matrix of the keyboard",
|
||||
0, G_MAXINT, 0,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_LEVEL,
|
||||
pspec);
|
||||
|
||||
/**
|
||||
* EekKeyboard::key-pressed:
|
||||
* @keyboard: an #EekKeyboard
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* The ::key-pressed signal is emitted each time a key in @keyboard
|
||||
* is shifted to the pressed state.
|
||||
*/
|
||||
signals[KEY_PRESSED] =
|
||||
g_signal_new ("key-pressed",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
EEK_TYPE_KEY);
|
||||
|
||||
/**
|
||||
* EekKeyboard::key-released:
|
||||
* @keyboard: an #EekKeyboard
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* The ::key-released signal is emitted each time a key in @keyboard
|
||||
* is shifted to the released state.
|
||||
*/
|
||||
signals[KEY_RELEASED] =
|
||||
g_signal_new ("key-released",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
EEK_TYPE_KEY);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_keyboard_init (EekKeyboard *self)
|
||||
{
|
||||
EekKeyboardPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_KEYBOARD_GET_PRIVATE(self);
|
||||
priv->group = priv->level = 0;
|
||||
priv->layout = NULL;
|
||||
priv->is_realized = FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_keyboard_set_keysym_index:
|
||||
* @keyboard: an #EekKeyboard
|
||||
* @group: row index of the symbol matrix of keys on @keyboard
|
||||
* @level: column index of the symbol matrix of keys on @keyboard
|
||||
*
|
||||
* Select a cell of the symbol matrix of each key on @keyboard.
|
||||
*/
|
||||
void
|
||||
eek_keyboard_set_keysym_index (EekKeyboard *keyboard,
|
||||
gint group,
|
||||
gint level)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
|
||||
EEK_KEYBOARD_GET_CLASS(keyboard)->set_keysym_index (keyboard, group, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_keyboard_get_keysym_index:
|
||||
* @keyboard: an #EekKeyboard
|
||||
* @group: a pointer where row index of the symbol matrix of keys on
|
||||
* @keyboard will be stored
|
||||
* @level: a pointer where column index of the symbol matrix of keys
|
||||
* on @keyboard will be stored
|
||||
*
|
||||
* Get the current cell position of the symbol matrix of each key on @keyboard.
|
||||
*/
|
||||
void
|
||||
eek_keyboard_get_keysym_index (EekKeyboard *keyboard,
|
||||
gint *group,
|
||||
gint *level)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
|
||||
EEK_KEYBOARD_GET_CLASS(keyboard)->get_keysym_index (keyboard, group, level);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_keyboard_create_section:
|
||||
* @keyboard: an #EekKeyboard
|
||||
*
|
||||
* Create an #EekSection instance and append it to @keyboard. This
|
||||
* function is rarely called by application but called by #EekLayout
|
||||
* implementation.
|
||||
*/
|
||||
EekSection *
|
||||
eek_keyboard_create_section (EekKeyboard *keyboard)
|
||||
{
|
||||
EekSection *section;
|
||||
g_return_val_if_fail (EEK_IS_KEYBOARD(keyboard), NULL);
|
||||
section = EEK_KEYBOARD_GET_CLASS(keyboard)->create_section (keyboard);
|
||||
return section;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_keyboard_set_layout:
|
||||
* @keyboard: an #EekKeyboard
|
||||
* @layout: an #EekLayout
|
||||
*
|
||||
* Set the layout of @keyboard to @layout. This actually turns
|
||||
* @keyboard to be ready to be drawn on the screen.
|
||||
*/
|
||||
void
|
||||
eek_keyboard_set_layout (EekKeyboard *keyboard,
|
||||
EekLayout *layout)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
|
||||
EEK_KEYBOARD_GET_CLASS(keyboard)->set_layout (keyboard, layout);
|
||||
}
|
||||
|
||||
void
|
||||
eek_keyboard_realize (EekKeyboard *keyboard)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_KEYBOARD(keyboard));
|
||||
EEK_KEYBOARD_GET_CLASS(keyboard)->realize (keyboard);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_keyboard_find_key_by_keycode:
|
||||
* @keyboard: an #EekKeyboard
|
||||
* @keycode: a keycode
|
||||
*
|
||||
* Find an #EekKey whose keycode is @keycode.
|
||||
* Returns: an #EekKey or NULL (if not found)
|
||||
*/
|
||||
EekKey *
|
||||
eek_keyboard_find_key_by_keycode (EekKeyboard *keyboard,
|
||||
guint keycode)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_KEYBOARD(keyboard), NULL);
|
||||
return EEK_KEYBOARD_GET_CLASS(keyboard)->find_key_by_keycode (keyboard,
|
||||
keycode);
|
||||
return squeek_layout_get_current_view(keyboard->layout);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -17,88 +17,42 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
||||
#error "Only <eek/eek.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef EEK_KEYBOARD_H
|
||||
#define EEK_KEYBOARD_H 1
|
||||
|
||||
#include <glib-object.h>
|
||||
#include "eek-container.h"
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
#include "eek-types.h"
|
||||
#include "eek-layout.h"
|
||||
#include "src/layout.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEK_TYPE_KEYBOARD (eek_keyboard_get_type())
|
||||
#define EEK_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_KEYBOARD, EekKeyboard))
|
||||
#define EEK_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_KEYBOARD, EekKeyboardClass))
|
||||
#define EEK_IS_KEYBOARD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_KEYBOARD))
|
||||
#define EEK_IS_KEYBOARD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_KEYBOARD))
|
||||
#define EEK_KEYBOARD_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_KEYBOARD, EekKeyboardClass))
|
||||
/// Keyboard state holder
|
||||
struct _LevelKeyboard {
|
||||
struct squeek_layout *layout; // owned
|
||||
struct xkb_keymap *keymap; // owned
|
||||
int keymap_fd; // keymap formatted as XKB string
|
||||
size_t keymap_len; // length of the data inside keymap_fd
|
||||
|
||||
typedef struct _EekKeyboardClass EekKeyboardClass;
|
||||
typedef struct _EekKeyboardPrivate EekKeyboardPrivate;
|
||||
guint id; // as a key to layout choices
|
||||
|
||||
struct _EekKeyboard
|
||||
{
|
||||
/*< private >*/
|
||||
EekContainer parent;
|
||||
|
||||
EekKeyboardPrivate *priv;
|
||||
EekboardContextService *manager; // unowned reference
|
||||
};
|
||||
typedef struct _LevelKeyboard LevelKeyboard;
|
||||
|
||||
/**
|
||||
* EekKeyboardClass:
|
||||
* @set_keysym_index: virtual function for setting group and level of
|
||||
* the entire keyboard
|
||||
* @get_keysym_index: virtual function for getting group and level of
|
||||
* the entire keyboard
|
||||
* @create_section: virtual function for creating a section
|
||||
* @set_layout: virtual function for setting layout engine
|
||||
* @find_key_by_keycode: virtual function for finding a key in the
|
||||
* keyboard by keycode
|
||||
* @realize: virtual function for applying a layout to the keyboard
|
||||
*/
|
||||
struct _EekKeyboardClass
|
||||
{
|
||||
/*< private >*/
|
||||
EekContainerClass parent_class;
|
||||
gchar * eek_keyboard_get_keymap
|
||||
(LevelKeyboard *keyboard);
|
||||
|
||||
/*< public >*/
|
||||
void (* set_keysym_index) (EekKeyboard *self,
|
||||
gint group,
|
||||
gint level);
|
||||
void (* get_keysym_index) (EekKeyboard *self,
|
||||
gint *group,
|
||||
gint *level);
|
||||
|
||||
EekSection *(* create_section) (EekKeyboard *self);
|
||||
|
||||
void (* set_layout) (EekKeyboard *self,
|
||||
EekLayout *layout);
|
||||
EekKey *(* find_key_by_keycode) (EekKeyboard *self,
|
||||
guint keycode);
|
||||
void (* realize) (EekKeyboard *self);
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_keyboard_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void eek_keyboard_set_keysym_index (EekKeyboard *keyboard,
|
||||
gint group,
|
||||
gint level);
|
||||
void eek_keyboard_get_keysym_index (EekKeyboard *keyboard,
|
||||
gint *group,
|
||||
gint *level);
|
||||
|
||||
EekSection *eek_keyboard_create_section (EekKeyboard *keyboard);
|
||||
|
||||
void eek_keyboard_set_layout (EekKeyboard *keyboard,
|
||||
EekLayout *layout);
|
||||
void eek_keyboard_realize (EekKeyboard *keyboard);
|
||||
EekKey *eek_keyboard_find_key_by_keycode (EekKeyboard *keyboard,
|
||||
guint keycode);
|
||||
struct squeek_view *level_keyboard_current(LevelKeyboard *keyboard);
|
||||
LevelKeyboard *level_keyboard_new(EekboardContextService *manager, struct squeek_layout *layout);
|
||||
void level_keyboard_deinit(LevelKeyboard *self);
|
||||
void level_keyboard_free(LevelKeyboard *self);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_KEYBOARD_H */
|
||||
|
||||
171
eek/eek-keysym.c
171
eek/eek-keysym.c
@@ -1,171 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:eek-keysym
|
||||
* @short_description: Keysym conversion utilities
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
#include "eek-keysym.h"
|
||||
|
||||
struct eek_keysym_label {
|
||||
guint keysym;
|
||||
const gchar *label;
|
||||
EekKeysymCategory category;
|
||||
};
|
||||
|
||||
#include "eek-special-keysym-labels.h"
|
||||
#include "eek-unicode-keysym-labels.h"
|
||||
#include "eek-keyname-keysym-labels.h"
|
||||
|
||||
static G_CONST_RETURN gchar *
|
||||
unichar_to_utf8 (gunichar uc)
|
||||
{
|
||||
if (g_unichar_isgraph (uc)) {
|
||||
gchar *buf;
|
||||
gint len;
|
||||
|
||||
len = g_unichar_to_utf8 (uc, NULL);
|
||||
buf = g_malloc0 (len + 1);
|
||||
g_unichar_to_utf8 (uc, buf);
|
||||
return buf;
|
||||
}
|
||||
return g_strdup ("");
|
||||
}
|
||||
|
||||
static int
|
||||
keysym_label_compare (const void *key0, const void *key1)
|
||||
{
|
||||
const struct eek_keysym_label *entry0 = key0, *entry1 = key1;
|
||||
return (gint)entry0->keysym - (gint)entry1->keysym;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
find_keysym (guint keysym,
|
||||
const gchar **label,
|
||||
EekKeysymCategory *category)
|
||||
{
|
||||
struct eek_keysym_label bsearch_key, *bsearch_val;
|
||||
|
||||
/* First, search special keysyms. */
|
||||
bsearch_key.keysym = keysym;
|
||||
bsearch_val = bsearch (&bsearch_key,
|
||||
special_keysym_labels,
|
||||
G_N_ELEMENTS(special_keysym_labels),
|
||||
sizeof (struct eek_keysym_label),
|
||||
keysym_label_compare);
|
||||
if (bsearch_val) {
|
||||
if (label)
|
||||
*label = g_strdup (bsearch_val->label);
|
||||
if (category)
|
||||
*category = bsearch_val->category;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Check for Latin-1 characters (1:1 mapping) */
|
||||
if ((keysym >= 0x0020 && keysym <= 0x007e) ||
|
||||
(keysym >= 0x00a0 && keysym <= 0x00ff)) {
|
||||
if (label)
|
||||
*label = unichar_to_utf8 (keysym);
|
||||
if (category)
|
||||
*category = EEK_KEYSYM_CATEGORY_LETTER;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Also check for directly encoded 24-bit UCS characters:
|
||||
*/
|
||||
if ((keysym & 0xff000000) == 0x01000000) {
|
||||
if (label)
|
||||
*label = unichar_to_utf8 (keysym & 0x00ffffff);
|
||||
if (category)
|
||||
*category = EEK_KEYSYM_CATEGORY_LETTER;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Search known unicode keysyms. */
|
||||
bsearch_key.keysym = keysym;
|
||||
bsearch_val = bsearch (&bsearch_key,
|
||||
unicode_keysym_labels,
|
||||
G_N_ELEMENTS(unicode_keysym_labels),
|
||||
sizeof (struct eek_keysym_label),
|
||||
keysym_label_compare);
|
||||
if (bsearch_val) {
|
||||
if (label)
|
||||
*label = g_strdup (bsearch_val->label);
|
||||
if (category)
|
||||
*category = bsearch_val->category;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Finally, search keynames. */
|
||||
bsearch_key.keysym = keysym;
|
||||
bsearch_val = bsearch (&bsearch_key,
|
||||
keyname_keysym_labels,
|
||||
G_N_ELEMENTS(keyname_keysym_labels),
|
||||
sizeof (struct eek_keysym_label),
|
||||
keysym_label_compare);
|
||||
if (bsearch_val) {
|
||||
if (label)
|
||||
*label = g_strdup (bsearch_val->label);
|
||||
if (category)
|
||||
*category = bsearch_val->category;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_keysym_to_string:
|
||||
* @keysym: keysym ID
|
||||
*
|
||||
* Return a string representation of @keysym.
|
||||
*/
|
||||
G_CONST_RETURN gchar *
|
||||
eek_keysym_to_string (guint keysym)
|
||||
{
|
||||
const gchar *label;
|
||||
|
||||
if (find_keysym (keysym, &label, NULL))
|
||||
return label;
|
||||
return g_strdup ("");
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_keysym_get_category:
|
||||
* @keysym: keysym ID
|
||||
*
|
||||
* Return a string representation of @keysym.
|
||||
*/
|
||||
EekKeysymCategory
|
||||
eek_keysym_get_category (guint keysym)
|
||||
{
|
||||
EekKeysymCategory category;
|
||||
|
||||
if (find_keysym (keysym, NULL, &category))
|
||||
return category;
|
||||
return EEK_KEYSYM_CATEGORY_UNKNOWN;
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_KEYSYM_H
|
||||
#define EEK_KEYSYM_H 1
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
/**
|
||||
* EEK_INVALID_KEYSYM:
|
||||
*
|
||||
* Pseudo keysym used for error reporting.
|
||||
*/
|
||||
#define EEK_INVALID_KEYSYM ((guint)(-1))
|
||||
|
||||
/**
|
||||
* EEK_INVALID_KEYCODE:
|
||||
*
|
||||
* Pseudo keycode used for error reporting.
|
||||
*/
|
||||
#define EEK_INVALID_KEYCODE ((guint)(-1))
|
||||
|
||||
/**
|
||||
* EekKeysymCategory:
|
||||
* @EEK_KEYSYM_CATEGORY_LETTER: the symbol represents an alphabet letter
|
||||
* @EEK_KEYSYM_CATEGORY_FUNCTION: the symbol represents a function
|
||||
* @EEK_KEYSYM_CATEGORY_KEYNAME: the symbol does not have meaning but
|
||||
* have a name
|
||||
* @EEK_KEYSYM_CATEGORY_UNKNOWN: used for error reporting
|
||||
*
|
||||
* Category of the key symbols.
|
||||
*/
|
||||
typedef enum {
|
||||
EEK_KEYSYM_CATEGORY_LETTER,
|
||||
EEK_KEYSYM_CATEGORY_FUNCTION,
|
||||
EEK_KEYSYM_CATEGORY_KEYNAME,
|
||||
EEK_KEYSYM_CATEGORY_UNKNOWN,
|
||||
EEK_KEYSYM_CATEGORY_LAST = EEK_KEYSYM_CATEGORY_UNKNOWN
|
||||
} EekKeysymCategory;
|
||||
|
||||
G_CONST_RETURN gchar *eek_keysym_to_string (guint keysym);
|
||||
EekKeysymCategory eek_keysym_get_category (guint keysym);
|
||||
|
||||
#endif /* EEK_KEYSYM_H */
|
||||
108
eek/eek-layout.c
108
eek/eek-layout.c
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -20,116 +20,28 @@
|
||||
|
||||
/**
|
||||
* SECTION:eek-layout
|
||||
* @short_description: Base interface of a layout engine
|
||||
* @short_description: Base class of a layout engine
|
||||
*
|
||||
* The #EekLayout class is a base interface of layout engine which
|
||||
* The #EekLayout class is a base class of layout engine which
|
||||
* arranges keyboard elements.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-layout.h"
|
||||
#include "eek-keyboard.h"
|
||||
#include "eekboard/eekboard-context-service.h"
|
||||
#include "eek-xml-layout.h"
|
||||
|
||||
enum {
|
||||
GROUP_CHANGED,
|
||||
CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
G_DEFINE_ABSTRACT_TYPE (EekLayout, eek_layout, G_TYPE_OBJECT)
|
||||
|
||||
static void
|
||||
eek_layout_base_init (gpointer gobject_class)
|
||||
eek_layout_class_init (EekLayoutClass *klass)
|
||||
{
|
||||
static gboolean is_initialized = FALSE;
|
||||
|
||||
if (!is_initialized) {
|
||||
/**
|
||||
* EekLayout::group-changed:
|
||||
* @layout: an #EekLayout that received the signal
|
||||
* @group: group index
|
||||
*
|
||||
* The ::group-changed signal is emitted each time group
|
||||
* configuration of @layout changed.
|
||||
*/
|
||||
signals[GROUP_CHANGED] =
|
||||
g_signal_new ("group-changed",
|
||||
G_TYPE_FROM_INTERFACE(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(EekLayoutIface, group_changed),
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__INT,
|
||||
G_TYPE_NONE, 1,
|
||||
G_TYPE_INT);
|
||||
|
||||
/**
|
||||
* EekLayout::changed:
|
||||
* @layout: an #EekLayout that received the signal
|
||||
*
|
||||
* The ::changed signal is emitted each time @layout changed
|
||||
* and re-layout of #EekKeyboard is needed.
|
||||
*/
|
||||
signals[CHANGED] =
|
||||
g_signal_new ("changed",
|
||||
G_TYPE_FROM_INTERFACE(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
G_STRUCT_OFFSET(EekLayoutIface, changed),
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
is_initialized = TRUE;
|
||||
}
|
||||
klass->create_keyboard = NULL;
|
||||
}
|
||||
|
||||
GType
|
||||
eek_layout_get_type (void)
|
||||
{
|
||||
static GType iface_type = 0;
|
||||
if (iface_type == 0) {
|
||||
static const GTypeInfo info = {
|
||||
sizeof (EekLayoutIface),
|
||||
eek_layout_base_init,
|
||||
NULL,
|
||||
};
|
||||
iface_type = g_type_register_static (G_TYPE_INTERFACE,
|
||||
"EekLayout",
|
||||
&info, 0);
|
||||
}
|
||||
return iface_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_layout_apply:
|
||||
* @layout: an #EekLayout
|
||||
* @keyboard: an #EekKeyboard
|
||||
*
|
||||
* Apply @layout to @keyboard. This function is rarely called by user
|
||||
* programs but called by the subclasses of #EekKeyboard.
|
||||
*/
|
||||
void
|
||||
eek_layout_apply (EekLayout *layout,
|
||||
EekKeyboard *keyboard)
|
||||
eek_layout_init (EekLayout *self)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_LAYOUT(layout));
|
||||
EEK_LAYOUT_GET_IFACE(layout)->apply (layout, keyboard);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_layout_get_group:
|
||||
* @layout: an #EekLayout
|
||||
*
|
||||
* Get the group index from the @layout. This function normally
|
||||
* called after #EekLayout::group-changed signal to change group index
|
||||
* of all the keys in #EekKeyboard at a time.
|
||||
*/
|
||||
gint
|
||||
eek_layout_get_group (EekLayout *layout)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_LAYOUT(layout), -1);
|
||||
return EEK_LAYOUT_GET_IFACE(layout)->get_group (layout);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -18,44 +18,36 @@
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
||||
#error "Only <eek/eek.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef EEK_LAYOUT_H
|
||||
#define EEK_LAYOUT_H 1
|
||||
|
||||
#include <glib-object.h>
|
||||
#include "eek-types.h"
|
||||
#include "src/layout.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEK_TYPE_LAYOUT (eek_layout_get_type())
|
||||
#define EEK_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_LAYOUT, EekLayout))
|
||||
#define EEK_IS_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_LAYOUT))
|
||||
#define EEK_LAYOUT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), EEK_TYPE_LAYOUT, EekLayoutIface))
|
||||
|
||||
typedef struct _EekLayoutIface EekLayoutIface;
|
||||
typedef struct _EekLayout EekLayout;
|
||||
G_DECLARE_DERIVABLE_TYPE (EekLayout, eek_layout, EEK, LAYOUT, GObject)
|
||||
|
||||
/**
|
||||
* EekLayoutIface:
|
||||
* @apply: virtual function for applying the layout to a keyboard
|
||||
* @get_group: virtual function for getting the current group setting
|
||||
* of the layout
|
||||
* @group_changed: class handler for #EekLayout::group-changed signal
|
||||
* @changed: class handler for #EekLayout::changed signal
|
||||
* EekLayoutClass:
|
||||
* @create_keyboard: virtual function for creating a keyboard
|
||||
*/
|
||||
struct _EekLayoutIface
|
||||
struct _EekLayoutClass
|
||||
{
|
||||
/*< private >*/
|
||||
GTypeInterface parent_iface;
|
||||
GObjectClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
void (* apply) (EekLayout *self,
|
||||
EekKeyboard *keyboard);
|
||||
gint (* get_group) (EekLayout *self);
|
||||
|
||||
/* signals */
|
||||
void (* group_changed) (EekLayout *self,
|
||||
gint group);
|
||||
void (* changed) (EekLayout *self);
|
||||
LevelKeyboard* (* create_keyboard) (EekboardContextService *manager,
|
||||
EekLayout *self,
|
||||
gdouble initial_width,
|
||||
gdouble initial_height);
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
@@ -63,9 +55,6 @@ struct _EekLayoutIface
|
||||
};
|
||||
|
||||
GType eek_layout_get_type (void) G_GNUC_CONST;
|
||||
void eek_layout_apply (EekLayout *layout,
|
||||
EekKeyboard *keyboard);
|
||||
gint eek_layout_get_group (EekLayout *layout);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_LAYOUT_H */
|
||||
|
||||
908
eek/eek-renderer.c
Normal file
908
eek/eek-renderer.c
Normal file
@@ -0,0 +1,908 @@
|
||||
/*
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "eek-keyboard.h"
|
||||
#include "eek-renderer.h"
|
||||
#include "src/style.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_PCONTEXT,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
typedef struct _EekRendererPrivate
|
||||
{
|
||||
LevelKeyboard *keyboard; // unowned
|
||||
PangoContext *pcontext; // owned
|
||||
GtkCssProvider *css_provider; // owned
|
||||
GtkStyleContext *view_context; // owned
|
||||
GtkStyleContext *button_context; // TODO: maybe move a copy to each button
|
||||
|
||||
gdouble border_width;
|
||||
|
||||
gdouble allocation_width;
|
||||
gdouble allocation_height;
|
||||
gdouble scale;
|
||||
gint scale_factor; /* the outputs scale factor */
|
||||
gint origin_x;
|
||||
gint origin_y;
|
||||
|
||||
PangoFontDescription *font; // owned reference
|
||||
cairo_surface_t *keyboard_surface;
|
||||
|
||||
} EekRendererPrivate;
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (EekRenderer, eek_renderer, G_TYPE_OBJECT)
|
||||
|
||||
/* eek-keyboard-drawing.c */
|
||||
static void eek_renderer_render_button_label (EekRenderer *self, cairo_t *cr, GtkStyleContext *ctx,
|
||||
const struct squeek_button *button);
|
||||
|
||||
static void invalidate (EekRenderer *renderer);
|
||||
static void render_button (EekRenderer *self,
|
||||
cairo_t *cr, EekBounds view_bounds, struct button_place *place,
|
||||
gboolean pressed, gboolean locked);
|
||||
|
||||
struct _CreateKeyboardSurfaceCallbackData {
|
||||
cairo_t *cr;
|
||||
EekRenderer *renderer;
|
||||
struct squeek_view *view;
|
||||
struct squeek_row *row;
|
||||
};
|
||||
typedef struct _CreateKeyboardSurfaceCallbackData CreateKeyboardSurfaceCallbackData;
|
||||
|
||||
static void
|
||||
create_keyboard_surface_button_callback (struct squeek_button *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
CreateKeyboardSurfaceCallbackData *data = user_data;
|
||||
EekBounds bounds = squeek_button_get_bounds(button);
|
||||
|
||||
cairo_save (data->cr);
|
||||
|
||||
cairo_translate (data->cr, bounds.x, bounds.y);
|
||||
cairo_rectangle (data->cr,
|
||||
0.0,
|
||||
0.0,
|
||||
bounds.width + 100,
|
||||
bounds.height + 100);
|
||||
cairo_clip (data->cr);
|
||||
struct button_place place = {
|
||||
.row = data->row,
|
||||
.button = button,
|
||||
};
|
||||
render_button (data->renderer, data->cr, squeek_view_get_bounds(data->view), &place, FALSE, FALSE);
|
||||
|
||||
cairo_restore (data->cr);
|
||||
}
|
||||
|
||||
static void
|
||||
create_keyboard_surface_row_callback (struct squeek_row *row,
|
||||
gpointer user_data)
|
||||
{
|
||||
CreateKeyboardSurfaceCallbackData *data = user_data;
|
||||
|
||||
EekBounds bounds = squeek_row_get_bounds(row);
|
||||
|
||||
cairo_save (data->cr);
|
||||
cairo_translate (data->cr, bounds.x, bounds.y);
|
||||
|
||||
gint angle = squeek_row_get_angle (row);
|
||||
cairo_rotate (data->cr, angle * G_PI / 180);
|
||||
|
||||
data->row = row;
|
||||
squeek_row_foreach(row, create_keyboard_surface_button_callback, data);
|
||||
|
||||
cairo_restore (data->cr);
|
||||
}
|
||||
|
||||
static void
|
||||
render_keyboard_surface (EekRenderer *renderer, struct squeek_view *view)
|
||||
{
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
||||
|
||||
GdkRGBA color = {0};
|
||||
gtk_style_context_get_color (priv->view_context, GTK_STATE_FLAG_NORMAL, &color);
|
||||
|
||||
EekBounds bounds = squeek_view_get_bounds (level_keyboard_current(priv->keyboard));
|
||||
|
||||
CreateKeyboardSurfaceCallbackData data = {
|
||||
.cr = cairo_create (priv->keyboard_surface),
|
||||
.renderer = renderer,
|
||||
.view = view,
|
||||
};
|
||||
|
||||
/* Paint the background covering the entire widget area */
|
||||
gtk_render_background (priv->view_context,
|
||||
data.cr,
|
||||
0, 0,
|
||||
priv->allocation_width, priv->allocation_height);
|
||||
gtk_render_frame (priv->view_context,
|
||||
data.cr,
|
||||
0, 0,
|
||||
priv->allocation_width, priv->allocation_height);
|
||||
|
||||
cairo_save (data.cr);
|
||||
cairo_scale (data.cr, priv->scale, priv->scale);
|
||||
cairo_translate (data.cr, bounds.x, bounds.y);
|
||||
|
||||
cairo_set_source_rgba (data.cr,
|
||||
color.red,
|
||||
color.green,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
|
||||
/* draw rows */
|
||||
squeek_view_foreach(level_keyboard_current(priv->keyboard),
|
||||
create_keyboard_surface_row_callback,
|
||||
&data);
|
||||
|
||||
cairo_restore (data.cr);
|
||||
|
||||
cairo_destroy (data.cr);
|
||||
}
|
||||
|
||||
static void
|
||||
render_outline (cairo_t *cr,
|
||||
GtkStyleContext *ctx,
|
||||
EekBounds bounds)
|
||||
{
|
||||
GtkBorder margin, border;
|
||||
gtk_style_context_get_margin(ctx, GTK_STATE_FLAG_NORMAL, &margin);
|
||||
gtk_style_context_get_border(ctx, GTK_STATE_FLAG_NORMAL, &border);
|
||||
|
||||
gdouble x = margin.left + border.left;
|
||||
gdouble y = margin.top + border.top;
|
||||
EekBounds position = {
|
||||
.x = x,
|
||||
.y = y,
|
||||
.width = bounds.width - x - (margin.right + border.right),
|
||||
.height = bounds.height - y - (margin.bottom + border.bottom),
|
||||
};
|
||||
gtk_render_background (ctx, cr,
|
||||
position.x, position.y, position.width, position.height);
|
||||
gtk_render_frame (ctx, cr,
|
||||
position.x, position.y, position.width, position.height);
|
||||
}
|
||||
|
||||
static void render_button_in_context(EekRenderer *self,
|
||||
gdouble scale,
|
||||
gint scale_factor,
|
||||
cairo_t *cr,
|
||||
GtkStyleContext *ctx,
|
||||
EekBounds view_bounds,
|
||||
struct button_place *place,
|
||||
gboolean active) {
|
||||
cairo_surface_t *outline_surface = NULL;
|
||||
|
||||
/* render outline */
|
||||
EekBounds bounds = squeek_button_get_bounds(place->button);
|
||||
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
// Outline will be drawn on the outside of the button, so the
|
||||
// surface needs to be bigger than the button
|
||||
outline_surface =
|
||||
cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
(int)ceil(bounds.width) + 10,
|
||||
(int)ceil(bounds.height) + 10);
|
||||
cr = cairo_create (outline_surface);
|
||||
|
||||
/* blank background */
|
||||
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_save (cr);
|
||||
eek_renderer_apply_transformation_for_button (cr, view_bounds, place, 1.0, FALSE);
|
||||
render_outline (cr, ctx, bounds);
|
||||
cairo_restore (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
cairo_set_source_surface (cr, outline_surface, 0.0, 0.0);
|
||||
cairo_surface_destroy(outline_surface);
|
||||
cairo_paint (cr);
|
||||
|
||||
/* render icon (if any) */
|
||||
const char *icon_name = squeek_button_get_icon_name(place->button);
|
||||
|
||||
if (icon_name) {
|
||||
cairo_surface_t *icon_surface =
|
||||
eek_renderer_get_icon_surface (icon_name, 16, scale_factor);
|
||||
if (icon_surface) {
|
||||
gint width = cairo_image_surface_get_width (icon_surface);
|
||||
gint height = cairo_image_surface_get_height (icon_surface);
|
||||
|
||||
cairo_save (cr);
|
||||
cairo_translate (cr,
|
||||
(bounds.width - (double)width / scale_factor) / 2,
|
||||
(bounds.height - (double)height / scale_factor) / 2);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
cairo_clip (cr);
|
||||
/* Draw the shape of the icon using the foreground color */
|
||||
GdkRGBA color = {0};
|
||||
gtk_style_context_get_color (ctx, GTK_STATE_FLAG_NORMAL, &color);
|
||||
|
||||
cairo_set_source_rgba (cr, color.red,
|
||||
color.green,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
cairo_mask_surface (cr, icon_surface, 0.0, 0.0);
|
||||
cairo_surface_destroy(icon_surface);
|
||||
cairo_fill (cr);
|
||||
cairo_restore (cr);
|
||||
return;
|
||||
}
|
||||
}
|
||||
eek_renderer_render_button_label (self, cr, ctx, place->button);
|
||||
}
|
||||
|
||||
static void
|
||||
render_button (EekRenderer *self,
|
||||
cairo_t *cr,
|
||||
EekBounds view_bounds,
|
||||
struct button_place *place,
|
||||
gboolean pressed,
|
||||
gboolean locked)
|
||||
{
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
|
||||
|
||||
GtkStyleContext *ctx = priv->button_context;
|
||||
/* Set the name of the button on the widget path, using the name obtained
|
||||
from the button's symbol. */
|
||||
g_autoptr (GtkWidgetPath) path = NULL;
|
||||
path = gtk_widget_path_copy (gtk_style_context_get_path (ctx));
|
||||
const char *name = squeek_button_get_name(place->button);
|
||||
gtk_widget_path_iter_set_name (path, -1, name);
|
||||
|
||||
/* Update the style context with the updated widget path. */
|
||||
gtk_style_context_set_path (ctx, path);
|
||||
/* Set the state to take into account whether the button is active
|
||||
(pressed) or normal. */
|
||||
gtk_style_context_set_state(ctx,
|
||||
pressed ? GTK_STATE_FLAG_ACTIVE : GTK_STATE_FLAG_NORMAL);
|
||||
const char *outline_name = squeek_button_get_outline_name(place->button);
|
||||
if (locked) {
|
||||
gtk_style_context_add_class(ctx, "locked");
|
||||
}
|
||||
gtk_style_context_add_class(ctx, outline_name);
|
||||
|
||||
render_button_in_context(self, priv->scale, priv->scale_factor, cr, ctx, view_bounds, place, pressed);
|
||||
|
||||
// Save and restore functions don't work if gtk_render_* was used in between
|
||||
gtk_style_context_set_state(ctx, GTK_STATE_FLAG_NORMAL);
|
||||
gtk_style_context_remove_class(ctx, outline_name);
|
||||
if (locked) {
|
||||
gtk_style_context_remove_class(ctx, "locked");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_renderer_apply_transformation_for_key:
|
||||
* @self: The renderer used to render the key
|
||||
* @cr: The Cairo rendering context used for rendering
|
||||
* @key: The key to be transformed
|
||||
* @scale: The factor used to scale the key bounds before rendering
|
||||
* @rotate: Whether to rotate the key by the angle defined for the key's
|
||||
* in its section definition
|
||||
*
|
||||
* Applies a transformation, consisting of scaling and rotation, to the
|
||||
* current rendering context using the bounds for the given key. The scale
|
||||
* factor is separate to the normal scale factor for the keyboard as a whole
|
||||
* and is applied cumulatively. It is typically used to render larger than
|
||||
* normal keys for popups.
|
||||
*/
|
||||
void
|
||||
eek_renderer_apply_transformation_for_button (cairo_t *cr,
|
||||
EekBounds view_bounds,
|
||||
struct button_place *place,
|
||||
gdouble scale,
|
||||
gboolean rotate)
|
||||
{
|
||||
EekBounds bounds, rotated_bounds;
|
||||
gdouble s;
|
||||
|
||||
eek_renderer_get_button_bounds (view_bounds, place, &bounds, FALSE);
|
||||
eek_renderer_get_button_bounds (view_bounds, place, &rotated_bounds, TRUE);
|
||||
|
||||
gint angle = squeek_row_get_angle (place->row);
|
||||
|
||||
cairo_scale (cr, scale, scale);
|
||||
if (rotate) {
|
||||
s = sin (angle * G_PI / 180);
|
||||
if (s < 0)
|
||||
cairo_translate (cr, 0, - bounds.width * s);
|
||||
else
|
||||
cairo_translate (cr, bounds.height * s, 0);
|
||||
cairo_rotate (cr, angle * G_PI / 180);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_renderer_render_button_label (EekRenderer *self,
|
||||
cairo_t *cr,
|
||||
GtkStyleContext *ctx,
|
||||
const struct squeek_button *button)
|
||||
{
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
|
||||
|
||||
const gchar *label = squeek_button_get_label(button);
|
||||
|
||||
if (!label) {
|
||||
return;
|
||||
}
|
||||
|
||||
PangoFontDescription *font;
|
||||
gdouble scale;
|
||||
|
||||
|
||||
if (!priv->font) {
|
||||
const PangoFontDescription *base_font;
|
||||
gdouble size;
|
||||
|
||||
base_font = pango_context_get_font_description (priv->pcontext);
|
||||
// FIXME: Base font size on the same size unit used for button sizing,
|
||||
// and make the default about 1/3 of the current row height
|
||||
size = 30000.0;
|
||||
priv->font = pango_font_description_copy (base_font);
|
||||
pango_font_description_set_size (priv->font, (gint)round(size * 0.6));
|
||||
}
|
||||
|
||||
EekBounds bounds = squeek_button_get_bounds(button);
|
||||
scale = MIN((bounds.width - priv->border_width) / bounds.width,
|
||||
(bounds.height - priv->border_width) / bounds.height);
|
||||
|
||||
font = pango_font_description_copy (priv->font);
|
||||
pango_font_description_set_size (font,
|
||||
(gint)round(pango_font_description_get_size (font) * scale));
|
||||
|
||||
PangoLayout *layout = pango_cairo_create_layout (cr);
|
||||
pango_layout_set_font_description (layout, font);
|
||||
pango_font_description_free (font);
|
||||
|
||||
pango_layout_set_text (layout, label, -1);
|
||||
PangoLayoutLine *line = pango_layout_get_line_readonly(layout, 0);
|
||||
if (line->resolved_dir == PANGO_DIRECTION_RTL) {
|
||||
pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
|
||||
}
|
||||
pango_layout_set_width (layout,
|
||||
PANGO_SCALE * bounds.width * scale);
|
||||
|
||||
PangoRectangle extents = { 0, };
|
||||
pango_layout_get_extents (layout, NULL, &extents);
|
||||
|
||||
cairo_save (cr);
|
||||
cairo_move_to
|
||||
(cr,
|
||||
(bounds.width - (double)extents.width / PANGO_SCALE) / 2,
|
||||
(bounds.height - (double)extents.height / PANGO_SCALE) / 2);
|
||||
|
||||
GdkRGBA color = {0};
|
||||
gtk_style_context_get_color (ctx, GTK_STATE_FLAG_NORMAL, &color);
|
||||
|
||||
cairo_set_source_rgba (cr,
|
||||
color.red,
|
||||
color.green,
|
||||
color.blue,
|
||||
color.alpha);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
cairo_restore (cr);
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
/*
|
||||
* eek_renderer_real_render_key:
|
||||
* @self: The renderer used to render the key
|
||||
* @cr: The Cairo rendering context used for rendering
|
||||
* @key: The key to be transformed
|
||||
* @scale: The factor used to scale the key bounds before rendering
|
||||
* @rotate: Whether to rotate the key by the angle defined for the key's
|
||||
* in its section definition
|
||||
*
|
||||
* Renders a key separately from the normal keyboard rendering.
|
||||
*/
|
||||
static void
|
||||
eek_renderer_real_render_button (EekRenderer *self,
|
||||
cairo_t *cr,
|
||||
struct button_place *place,
|
||||
gdouble scale,
|
||||
gboolean rotate)
|
||||
{
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
|
||||
EekBounds bounds;
|
||||
|
||||
EekBounds view_bounds = squeek_view_get_bounds (level_keyboard_current(priv->keyboard));
|
||||
eek_renderer_get_button_bounds (view_bounds, place, &bounds, rotate);
|
||||
|
||||
cairo_save (cr);
|
||||
/* Because this function is called separately from the keyboard rendering
|
||||
function, the transformation for the context needs to be set up */
|
||||
cairo_translate (cr, priv->origin_x, priv->origin_y);
|
||||
cairo_scale (cr, priv->scale, priv->scale);
|
||||
cairo_translate (cr, bounds.x, bounds.y);
|
||||
|
||||
eek_renderer_apply_transformation_for_button (cr, view_bounds, place, scale, rotate);
|
||||
struct squeek_key *key = squeek_button_get_key(place->button);
|
||||
render_button (
|
||||
self, cr, view_bounds, place,
|
||||
squeek_key_is_pressed(key) != 0,
|
||||
squeek_key_is_locked (key) != 0
|
||||
);
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_renderer_real_render_keyboard (EekRenderer *self,
|
||||
cairo_t *cr)
|
||||
{
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
|
||||
cairo_pattern_t *source;
|
||||
|
||||
g_return_if_fail (priv->keyboard);
|
||||
g_return_if_fail (priv->allocation_width > 0.0);
|
||||
g_return_if_fail (priv->allocation_height > 0.0);
|
||||
|
||||
cairo_save (cr);
|
||||
|
||||
cairo_translate (cr, priv->origin_x, priv->origin_y);
|
||||
|
||||
if (priv->keyboard_surface)
|
||||
cairo_surface_destroy (priv->keyboard_surface);
|
||||
|
||||
priv->keyboard_surface = cairo_surface_create_for_rectangle (
|
||||
cairo_get_target (cr), 0, 0,
|
||||
priv->allocation_width, priv->allocation_height);
|
||||
|
||||
render_keyboard_surface (self, squeek_layout_get_current_view(priv->keyboard->layout));
|
||||
|
||||
cairo_set_source_surface (cr, priv->keyboard_surface, 0.0, 0.0);
|
||||
source = cairo_get_source (cr);
|
||||
cairo_pattern_set_extend (source, CAIRO_EXTEND_PAD);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_restore (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_renderer_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (
|
||||
EEK_RENDERER(object));
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_PCONTEXT:
|
||||
priv->pcontext = g_value_get_object (value);
|
||||
g_object_ref (priv->pcontext);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_renderer_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id) {
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_renderer_dispose (GObject *object)
|
||||
{
|
||||
EekRenderer *self = EEK_RENDERER (object);
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
|
||||
|
||||
if (priv->keyboard) {
|
||||
priv->keyboard = NULL;
|
||||
}
|
||||
if (priv->pcontext) {
|
||||
g_object_unref (priv->pcontext);
|
||||
priv->pcontext = NULL;
|
||||
}
|
||||
|
||||
/* this will release all allocated surfaces and font if any */
|
||||
invalidate (EEK_RENDERER(object));
|
||||
|
||||
G_OBJECT_CLASS (eek_renderer_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_renderer_finalize (GObject *object)
|
||||
{
|
||||
EekRenderer *self = EEK_RENDERER(object);
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
|
||||
|
||||
g_object_unref(priv->css_provider);
|
||||
g_object_unref(priv->view_context);
|
||||
g_object_unref(priv->button_context);
|
||||
pango_font_description_free (priv->font);
|
||||
G_OBJECT_CLASS (eek_renderer_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_renderer_class_init (EekRendererClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
klass->render_button = eek_renderer_real_render_button;
|
||||
klass->render_keyboard = eek_renderer_real_render_keyboard;
|
||||
|
||||
gobject_class->set_property = eek_renderer_set_property;
|
||||
gobject_class->get_property = eek_renderer_get_property;
|
||||
gobject_class->dispose = eek_renderer_dispose;
|
||||
gobject_class->finalize = eek_renderer_finalize;
|
||||
|
||||
pspec = g_param_spec_object ("pango-context",
|
||||
"Pango Context",
|
||||
"Pango Context",
|
||||
PANGO_TYPE_CONTEXT,
|
||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_PCONTEXT,
|
||||
pspec);
|
||||
}
|
||||
|
||||
|
||||
static GType new_type(char *name) {
|
||||
GTypeInfo info = {0};
|
||||
info.class_size = sizeof(GtkWidgetClass);
|
||||
info.instance_size = sizeof(GtkWidget);
|
||||
|
||||
return g_type_register_static(GTK_TYPE_WIDGET, name, &info,
|
||||
G_TYPE_FLAG_ABSTRACT
|
||||
);
|
||||
}
|
||||
|
||||
static GType view_type() {
|
||||
static GType type = 0;
|
||||
if (!type) {
|
||||
type = new_type("sq_view");
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static GType button_type() {
|
||||
static GType type = 0;
|
||||
if (!type) {
|
||||
type = new_type("sq_button");
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_renderer_init (EekRenderer *self)
|
||||
{
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (self);
|
||||
|
||||
priv->keyboard = NULL;
|
||||
priv->pcontext = NULL;
|
||||
priv->border_width = 1.0;
|
||||
priv->allocation_width = 0.0;
|
||||
priv->allocation_height = 0.0;
|
||||
priv->scale = 1.0;
|
||||
priv->scale_factor = 1;
|
||||
priv->font = NULL;
|
||||
priv->keyboard_surface = NULL;
|
||||
|
||||
GtkIconTheme *theme = gtk_icon_theme_get_default ();
|
||||
|
||||
gtk_icon_theme_add_resource_path (theme, "/sm/puri/squeekboard/icons");
|
||||
|
||||
priv->css_provider = squeek_load_style();
|
||||
}
|
||||
|
||||
static void
|
||||
invalidate (EekRenderer *renderer)
|
||||
{
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
||||
|
||||
if (priv->keyboard_surface) {
|
||||
cairo_surface_destroy (priv->keyboard_surface);
|
||||
priv->keyboard_surface = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
EekRenderer *
|
||||
eek_renderer_new (LevelKeyboard *keyboard,
|
||||
PangoContext *pcontext)
|
||||
{
|
||||
EekRenderer *renderer = g_object_new (EEK_TYPE_RENDERER,
|
||||
"pango-context", pcontext,
|
||||
NULL);
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
||||
priv->keyboard = keyboard;
|
||||
|
||||
/* Create a style context for the layout */
|
||||
GtkWidgetPath *path = gtk_widget_path_new();
|
||||
gtk_widget_path_append_type(path, view_type());
|
||||
|
||||
priv->view_context = gtk_style_context_new();
|
||||
gtk_style_context_set_path(priv->view_context, path);
|
||||
gtk_widget_path_unref(path);
|
||||
if (squeek_layout_get_kind(priv->keyboard->layout) == ARRANGEMENT_KIND_WIDE) {
|
||||
gtk_style_context_add_class(priv->view_context, "wide");
|
||||
}
|
||||
gtk_style_context_add_provider (priv->view_context,
|
||||
GTK_STYLE_PROVIDER(priv->css_provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
||||
|
||||
/* Create a style context for the buttons */
|
||||
path = gtk_widget_path_new();
|
||||
gtk_widget_path_append_type(path, view_type());
|
||||
if (squeek_layout_get_kind(priv->keyboard->layout) == ARRANGEMENT_KIND_WIDE) {
|
||||
gtk_widget_path_iter_add_class(path, -1, "wide");
|
||||
}
|
||||
gtk_widget_path_append_type(path, button_type());
|
||||
priv->button_context = gtk_style_context_new ();
|
||||
gtk_style_context_set_path(priv->button_context, path);
|
||||
gtk_widget_path_unref(path);
|
||||
gtk_style_context_set_parent(priv->button_context, priv->view_context);
|
||||
gtk_style_context_set_state (priv->button_context, GTK_STATE_FLAG_NORMAL);
|
||||
gtk_style_context_add_provider (priv->button_context,
|
||||
GTK_STYLE_PROVIDER(priv->css_provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
||||
return renderer;
|
||||
}
|
||||
|
||||
void
|
||||
eek_renderer_set_allocation_size (EekRenderer *renderer,
|
||||
gdouble width,
|
||||
gdouble height)
|
||||
{
|
||||
gdouble scale;
|
||||
|
||||
g_return_if_fail (EEK_IS_RENDERER(renderer));
|
||||
g_return_if_fail (width > 0.0 && height > 0.0);
|
||||
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
||||
|
||||
priv->allocation_width = width;
|
||||
priv->allocation_height = height;
|
||||
|
||||
/* Calculate a scale factor to use when rendering the keyboard into the
|
||||
available space. */
|
||||
EekBounds bounds = squeek_view_get_bounds (level_keyboard_current(priv->keyboard));
|
||||
|
||||
gdouble w = (bounds.x * 2) + bounds.width;
|
||||
gdouble h = (bounds.y * 2) + bounds.height;
|
||||
|
||||
scale = MIN(width / w, height / h);
|
||||
|
||||
priv->scale = scale;
|
||||
/* Set the rendering offset in widget coordinates to center the keyboard */
|
||||
priv->origin_x = (gint)floor((width - (scale * w)) / 2);
|
||||
priv->origin_y = (gint)floor((height - (scale * h)) / 2);
|
||||
invalidate (renderer);
|
||||
}
|
||||
|
||||
void
|
||||
eek_renderer_get_size (EekRenderer *renderer,
|
||||
gdouble *width,
|
||||
gdouble *height)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_RENDERER(renderer));
|
||||
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
||||
|
||||
EekBounds bounds = squeek_view_get_bounds (level_keyboard_current(priv->keyboard));
|
||||
if (width)
|
||||
*width = bounds.width;
|
||||
if (height)
|
||||
*height = bounds.height;
|
||||
}
|
||||
|
||||
void
|
||||
eek_renderer_get_button_bounds (EekBounds view_bounds,
|
||||
struct button_place *place,
|
||||
EekBounds *bounds,
|
||||
gboolean rotate)
|
||||
{
|
||||
gint angle = 0;
|
||||
EekPoint points[4], min, max;
|
||||
|
||||
g_return_if_fail (place);
|
||||
g_return_if_fail (bounds != NULL);
|
||||
|
||||
EekBounds button_bounds = squeek_button_get_bounds(place->button);
|
||||
EekBounds row_bounds = squeek_row_get_bounds (place->row);
|
||||
|
||||
if (!rotate) {
|
||||
button_bounds.x += view_bounds.x + row_bounds.x;
|
||||
button_bounds.y += view_bounds.y + row_bounds.y;
|
||||
*bounds = button_bounds;
|
||||
return;
|
||||
}
|
||||
points[0].x = button_bounds.x;
|
||||
points[0].y = button_bounds.y;
|
||||
points[1].x = points[0].x + button_bounds.width;
|
||||
points[1].y = points[0].y;
|
||||
points[2].x = points[1].x;
|
||||
points[2].y = points[1].y + button_bounds.height;
|
||||
points[3].x = points[0].x;
|
||||
points[3].y = points[2].y;
|
||||
|
||||
if (rotate) {
|
||||
angle = squeek_row_get_angle (place->row);
|
||||
}
|
||||
|
||||
min = points[2];
|
||||
max = points[0];
|
||||
for (unsigned i = 0; i < G_N_ELEMENTS(points); i++) {
|
||||
eek_point_rotate (&points[i], angle);
|
||||
if (points[i].x < min.x)
|
||||
min.x = points[i].x;
|
||||
if (points[i].x > max.x)
|
||||
max.x = points[i].x;
|
||||
if (points[i].y < min.y)
|
||||
min.y = points[i].y;
|
||||
if (points[i].y > max.y)
|
||||
max.y = points[i].y;
|
||||
}
|
||||
bounds->x = view_bounds.x + row_bounds.x + min.x;
|
||||
bounds->y = view_bounds.y + row_bounds.y + min.y;
|
||||
bounds->width = (max.x - min.x);
|
||||
bounds->height = (max.y - min.y);
|
||||
}
|
||||
|
||||
gdouble
|
||||
eek_renderer_get_scale (EekRenderer *renderer)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_RENDERER(renderer), 0);
|
||||
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
||||
|
||||
return priv->scale;
|
||||
}
|
||||
|
||||
void
|
||||
eek_renderer_set_scale_factor (EekRenderer *renderer, gint scale)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_RENDERER(renderer));
|
||||
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
||||
priv->scale_factor = scale;
|
||||
}
|
||||
|
||||
cairo_surface_t *
|
||||
eek_renderer_get_icon_surface (const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale)
|
||||
{
|
||||
GError *error = NULL;
|
||||
cairo_surface_t *surface = gtk_icon_theme_load_surface (gtk_icon_theme_get_default (),
|
||||
icon_name,
|
||||
size,
|
||||
scale,
|
||||
NULL,
|
||||
0,
|
||||
&error);
|
||||
|
||||
if (surface == NULL) {
|
||||
g_warning ("can't get icon surface for %s: %s",
|
||||
icon_name,
|
||||
error->message);
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
return surface;
|
||||
}
|
||||
|
||||
void
|
||||
eek_renderer_render_button (EekRenderer *renderer,
|
||||
cairo_t *cr,
|
||||
struct button_place *place,
|
||||
gdouble scale,
|
||||
gboolean rotate)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_RENDERER(renderer));
|
||||
g_return_if_fail (place);
|
||||
g_return_if_fail (scale >= 0.0);
|
||||
|
||||
EEK_RENDERER_GET_CLASS(renderer)->
|
||||
render_button (renderer, cr, place, scale, rotate);
|
||||
}
|
||||
|
||||
void
|
||||
eek_renderer_render_keyboard (EekRenderer *renderer,
|
||||
cairo_t *cr)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_RENDERER(renderer));
|
||||
EEK_RENDERER_GET_CLASS(renderer)->render_keyboard (renderer, cr);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
sign (EekPoint *p1, EekPoint *p2, EekPoint *p3)
|
||||
{
|
||||
// FIXME: what is this actually checking?
|
||||
return (p1->x - p3->x) * (p2->y - p3->y) -
|
||||
(p2->x - p3->x) * (p1->y - p3->y);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
eek_are_bounds_inside (EekBounds bounds, EekPoint point, EekPoint origin, int32_t angle)
|
||||
{
|
||||
EekPoint points[4];
|
||||
gboolean b1, b2, b3;
|
||||
|
||||
points[0].x = bounds.x;
|
||||
points[0].y = bounds.y;
|
||||
points[1].x = points[0].x + bounds.width;
|
||||
points[1].y = points[0].y;
|
||||
points[2].x = points[1].x;
|
||||
points[2].y = points[1].y + bounds.height;
|
||||
points[3].x = points[0].x;
|
||||
points[3].y = points[2].y;
|
||||
|
||||
for (unsigned i = 0; i < G_N_ELEMENTS(points); i++) {
|
||||
eek_point_rotate (&points[i], angle);
|
||||
points[i].x += origin.x;
|
||||
points[i].y += origin.y;
|
||||
}
|
||||
|
||||
b1 = sign (&point, &points[0], &points[1]) < 0.0;
|
||||
b2 = sign (&point, &points[1], &points[2]) < 0.0;
|
||||
b3 = sign (&point, &points[2], &points[0]) < 0.0;
|
||||
|
||||
if (b1 == b2 && b2 == b3) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
b1 = sign (&point, &points[2], &points[3]) < 0.0;
|
||||
b2 = sign (&point, &points[3], &points[0]) < 0.0;
|
||||
b3 = sign (&point, &points[0], &points[2]) < 0.0;
|
||||
|
||||
if (b1 == b2 && b2 == b3) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct transformation
|
||||
eek_renderer_get_transformation (EekRenderer *renderer) {
|
||||
struct transformation failed = {0};
|
||||
g_return_val_if_fail (EEK_IS_RENDERER(renderer), failed);
|
||||
|
||||
EekRendererPrivate *priv = eek_renderer_get_instance_private (renderer);
|
||||
struct transformation ret = {
|
||||
.origin_x = priv->origin_x,
|
||||
.origin_y = priv->origin_y,
|
||||
.scale = priv->scale,
|
||||
};
|
||||
return ret;
|
||||
}
|
||||
102
eek/eek-renderer.h
Normal file
102
eek/eek-renderer.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#ifndef EEK_RENDERER_H
|
||||
#define EEK_RENDERER_H 1
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <pango/pangocairo.h>
|
||||
|
||||
#include "eek-types.h"
|
||||
#include "src/layout.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEK_TYPE_RENDERER (eek_renderer_get_type())
|
||||
G_DECLARE_DERIVABLE_TYPE (EekRenderer, eek_renderer, EEK, RENDERER, GObject)
|
||||
|
||||
struct _EekRendererClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* render_button) (EekRenderer *self,
|
||||
cairo_t *cr,
|
||||
struct button_place *place,
|
||||
gdouble scale,
|
||||
gboolean rotate);
|
||||
|
||||
void (* render_keyboard) (EekRenderer *self,
|
||||
cairo_t *cr);
|
||||
|
||||
cairo_surface_t *(* get_icon_surface) (EekRenderer *self,
|
||||
const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale);
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[23];
|
||||
};
|
||||
|
||||
GType eek_renderer_get_type (void) G_GNUC_CONST;
|
||||
EekRenderer *eek_renderer_new (LevelKeyboard *keyboard,
|
||||
PangoContext *pcontext);
|
||||
void eek_renderer_set_allocation_size
|
||||
(EekRenderer *renderer,
|
||||
gdouble width,
|
||||
gdouble height);
|
||||
void eek_renderer_get_size (EekRenderer *renderer,
|
||||
gdouble *width,
|
||||
gdouble *height);
|
||||
void eek_renderer_get_button_bounds (EekBounds view_bounds,
|
||||
struct button_place *button,
|
||||
EekBounds *bounds,
|
||||
gboolean rotate);
|
||||
|
||||
gdouble eek_renderer_get_scale (EekRenderer *renderer);
|
||||
void eek_renderer_set_scale_factor (EekRenderer *renderer,
|
||||
gint scale);
|
||||
|
||||
void eek_renderer_render_button (EekRenderer *renderer,
|
||||
cairo_t *cr,
|
||||
struct button_place *place,
|
||||
gdouble scale,
|
||||
gboolean rotate);
|
||||
|
||||
cairo_surface_t *eek_renderer_get_icon_surface(const gchar *icon_name,
|
||||
gint size,
|
||||
gint scale);
|
||||
|
||||
void eek_renderer_render_keyboard (EekRenderer *renderer,
|
||||
cairo_t *cr);
|
||||
void eek_renderer_set_border_width (EekRenderer *renderer,
|
||||
gdouble border_width);
|
||||
void eek_renderer_apply_transformation_for_button
|
||||
(cairo_t *cr,
|
||||
EekBounds view_bounds,
|
||||
struct button_place *place,
|
||||
gdouble scale,
|
||||
gboolean rotate);
|
||||
|
||||
struct transformation
|
||||
eek_renderer_get_transformation (EekRenderer *renderer);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_RENDERER_H */
|
||||
@@ -1,440 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:eek-section
|
||||
* @short_description: Base class of a section
|
||||
* @see_also: #EekKey
|
||||
*
|
||||
* The #EekSectionClass class represents a section, which consists
|
||||
* of one or more keys of the #EekKeyClass class.
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
#include "eek-section.h"
|
||||
#include "eek-key.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ANGLE,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
enum {
|
||||
KEY_PRESSED,
|
||||
KEY_RELEASED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
G_DEFINE_TYPE (EekSection, eek_section, EEK_TYPE_CONTAINER);
|
||||
|
||||
#define EEK_SECTION_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_SECTION, EekSectionPrivate))
|
||||
|
||||
struct _EekRow
|
||||
{
|
||||
gint num_columns;
|
||||
EekOrientation orientation;
|
||||
};
|
||||
|
||||
typedef struct _EekRow EekRow;
|
||||
|
||||
struct _EekSectionPrivate
|
||||
{
|
||||
gint angle;
|
||||
GSList *rows;
|
||||
GSList *keys;
|
||||
};
|
||||
|
||||
static void
|
||||
eek_section_real_set_angle (EekSection *self,
|
||||
gint angle)
|
||||
{
|
||||
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
|
||||
|
||||
priv->angle = angle;
|
||||
|
||||
g_object_notify (G_OBJECT(self), "angle");
|
||||
}
|
||||
|
||||
static gint
|
||||
eek_section_real_get_angle (EekSection *self)
|
||||
{
|
||||
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
|
||||
|
||||
return priv->angle;
|
||||
}
|
||||
|
||||
static gint
|
||||
eek_section_real_get_n_rows (EekSection *self)
|
||||
{
|
||||
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
|
||||
|
||||
return g_slist_length (priv->rows);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_section_real_add_row (EekSection *self,
|
||||
gint num_columns,
|
||||
EekOrientation orientation)
|
||||
{
|
||||
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
|
||||
EekRow *row;
|
||||
|
||||
row = g_slice_new (EekRow);
|
||||
row->num_columns = num_columns;
|
||||
row->orientation = orientation;
|
||||
priv->rows = g_slist_append (priv->rows, row);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_section_real_get_row (EekSection *self,
|
||||
gint index,
|
||||
gint *num_columns,
|
||||
EekOrientation *orientation)
|
||||
{
|
||||
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(self);
|
||||
EekRow *row;
|
||||
|
||||
row = g_slist_nth_data (priv->rows, index);
|
||||
g_return_if_fail (row);
|
||||
if (num_columns)
|
||||
*num_columns = row->num_columns;
|
||||
if (orientation)
|
||||
*orientation = row->orientation;
|
||||
}
|
||||
|
||||
static void
|
||||
pressed_event (EekKey *key, EekSection *section)
|
||||
{
|
||||
g_signal_emit_by_name (section, "key-pressed", key);
|
||||
}
|
||||
|
||||
static void
|
||||
released_event (EekKey *key, EekSection *section)
|
||||
{
|
||||
g_signal_emit_by_name (section, "key-released", key);
|
||||
}
|
||||
|
||||
static EekKey *
|
||||
eek_section_real_create_key (EekSection *self,
|
||||
gint column,
|
||||
gint row)
|
||||
{
|
||||
EekKey *key;
|
||||
gint num_columns, num_rows;
|
||||
EekOrientation orientation;
|
||||
|
||||
num_rows = eek_section_get_n_rows (self);
|
||||
g_return_val_if_fail (0 <= row && row < num_rows, NULL);
|
||||
eek_section_get_row (self, row, &num_columns, &orientation);
|
||||
g_return_val_if_fail (column < num_columns, NULL);
|
||||
|
||||
key = g_object_new (EEK_TYPE_KEY,
|
||||
"column", column,
|
||||
"row", row,
|
||||
NULL);
|
||||
g_return_val_if_fail (key, NULL);
|
||||
|
||||
g_signal_connect (key, "pressed", G_CALLBACK(pressed_event), self);
|
||||
g_signal_connect (key, "released", G_CALLBACK(released_event), self);
|
||||
|
||||
EEK_CONTAINER_GET_CLASS(self)->add_child (EEK_CONTAINER(self),
|
||||
EEK_ELEMENT(key));
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_key_by_keycode (EekElement *element, gpointer user_data)
|
||||
{
|
||||
if (eek_key_get_keycode (EEK_KEY(element)) == (guint)(long)user_data)
|
||||
return 0;
|
||||
return -1;
|
||||
}
|
||||
|
||||
static EekKey *
|
||||
eek_section_real_find_key_by_keycode (EekSection *self,
|
||||
guint keycode)
|
||||
{
|
||||
return (EekKey *)eek_container_find (EEK_CONTAINER(self),
|
||||
compare_key_by_keycode,
|
||||
(gpointer)(long)keycode);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_section_finalize (GObject *object)
|
||||
{
|
||||
EekSectionPrivate *priv = EEK_SECTION_GET_PRIVATE(object);
|
||||
GSList *head;
|
||||
|
||||
for (head = priv->rows; head; head = g_slist_next (head))
|
||||
g_slice_free (EekRow, head->data);
|
||||
g_slist_free (priv->rows);
|
||||
|
||||
G_OBJECT_CLASS (eek_section_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_section_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id) {
|
||||
case PROP_ANGLE:
|
||||
eek_section_set_angle (EEK_SECTION(object),
|
||||
g_value_get_int (value));
|
||||
break;
|
||||
default:
|
||||
g_object_set_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_section_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id) {
|
||||
case PROP_ANGLE:
|
||||
g_value_set_int (value, eek_section_get_angle (EEK_SECTION(object)));
|
||||
break;
|
||||
default:
|
||||
g_object_get_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_section_class_init (EekSectionClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (EekSectionPrivate));
|
||||
|
||||
klass->set_angle = eek_section_real_set_angle;
|
||||
klass->get_angle = eek_section_real_get_angle;
|
||||
klass->get_n_rows = eek_section_real_get_n_rows;
|
||||
klass->add_row = eek_section_real_add_row;
|
||||
klass->get_row = eek_section_real_get_row;
|
||||
klass->create_key = eek_section_real_create_key;
|
||||
klass->find_key_by_keycode = eek_section_real_find_key_by_keycode;
|
||||
|
||||
gobject_class->set_property = eek_section_set_property;
|
||||
gobject_class->get_property = eek_section_get_property;
|
||||
gobject_class->finalize = eek_section_finalize;
|
||||
|
||||
/**
|
||||
* EekSection:angle:
|
||||
*
|
||||
* The rotation angle of #EekSection.
|
||||
*/
|
||||
pspec = g_param_spec_int ("angle",
|
||||
"Angle",
|
||||
"Rotation angle of the section",
|
||||
-360, 360, 0,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ANGLE,
|
||||
pspec);
|
||||
|
||||
/**
|
||||
* EekSection::key-pressed:
|
||||
* @section: an #EekSection
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* The ::key-pressed signal is emitted each time a key in @section
|
||||
* is shifted to the pressed state.
|
||||
*/
|
||||
signals[KEY_PRESSED] =
|
||||
g_signal_new ("key-pressed",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
EEK_TYPE_KEY);
|
||||
|
||||
/**
|
||||
* EekSection::key-released:
|
||||
* @section: an #EekSection
|
||||
* @key: an #EekKey
|
||||
*
|
||||
* The ::key-released signal is emitted each time a key in @section
|
||||
* is shifted to the released state.
|
||||
*/
|
||||
signals[KEY_RELEASED] =
|
||||
g_signal_new ("key-released",
|
||||
G_TYPE_FROM_CLASS(gobject_class),
|
||||
G_SIGNAL_RUN_FIRST,
|
||||
0,
|
||||
NULL,
|
||||
NULL,
|
||||
g_cclosure_marshal_VOID__OBJECT,
|
||||
G_TYPE_NONE,
|
||||
1,
|
||||
EEK_TYPE_KEY);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_section_init (EekSection *self)
|
||||
{
|
||||
EekSectionPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_SECTION_GET_PRIVATE (self);
|
||||
priv->angle = 0;
|
||||
priv->rows = NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_section_set_angle:
|
||||
* @section: an #EekSection
|
||||
* @angle: rotation angle
|
||||
*
|
||||
* Set rotation angle of @section to @angle.
|
||||
*/
|
||||
void
|
||||
eek_section_set_angle (EekSection *section,
|
||||
gint angle)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_SECTION(section));
|
||||
EEK_SECTION_GET_CLASS(section)->set_angle (section, angle);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_section_get_angle:
|
||||
* @section: an #EekSection
|
||||
*
|
||||
* Get rotation angle of @section.
|
||||
*/
|
||||
gint
|
||||
eek_section_get_angle (EekSection *section)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_SECTION(section), -1);
|
||||
return EEK_SECTION_GET_CLASS(section)->get_angle (section);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_section_get_n_rows:
|
||||
* @section: an #EekSection
|
||||
*
|
||||
* Get the number of rows in @section.
|
||||
*/
|
||||
gint
|
||||
eek_section_get_n_rows (EekSection *section)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_SECTION(section), -1);
|
||||
return EEK_SECTION_GET_CLASS(section)->get_n_rows (section);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_section_add_row:
|
||||
* @section: an #EekSection
|
||||
* @num_columns: the number of column in the row
|
||||
* @orientation: #EekOrientation of the row
|
||||
*
|
||||
* Add a row which has @num_columns columns and whose orientation is
|
||||
* @orientation to @section.
|
||||
*/
|
||||
void
|
||||
eek_section_add_row (EekSection *section,
|
||||
gint num_columns,
|
||||
EekOrientation orientation)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_SECTION(section));
|
||||
EEK_SECTION_GET_CLASS(section)->add_row (section,
|
||||
num_columns,
|
||||
orientation);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_section_get_row:
|
||||
* @section: an #EekSection
|
||||
* @index: the index of row
|
||||
* @num_columns: pointer where the number of column in the row will be stored
|
||||
* @orientation: pointer where #EekOrientation of the row will be stored
|
||||
*
|
||||
* Get the information about the @index-th row in @section.
|
||||
*/
|
||||
void
|
||||
eek_section_get_row (EekSection *section,
|
||||
gint index,
|
||||
gint *num_columns,
|
||||
EekOrientation *orientation)
|
||||
{
|
||||
g_return_if_fail (EEK_IS_SECTION(section));
|
||||
EEK_SECTION_GET_CLASS(section)->get_row (section,
|
||||
index,
|
||||
num_columns,
|
||||
orientation);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_section_create_key:
|
||||
* @section: an #EekSection
|
||||
* @column: the column index of the key
|
||||
* @row: the row index of the key
|
||||
*
|
||||
* Create an #EekKey instance and append it to @section. This
|
||||
* function is rarely called by application but called by #EekLayout
|
||||
* implementation.
|
||||
*/
|
||||
EekKey *
|
||||
eek_section_create_key (EekSection *section,
|
||||
gint column,
|
||||
gint row)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_SECTION(section), NULL);
|
||||
return EEK_SECTION_GET_CLASS(section)->create_key (section, column, row);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_section_find_key_by_keycode:
|
||||
* @section: an #EekSection
|
||||
* @keycode: a keycode
|
||||
*
|
||||
* Find an #EekKey whose keycode is @keycode.
|
||||
* Returns: an #EekKey or NULL (if not found)
|
||||
*/
|
||||
EekKey *
|
||||
eek_section_find_key_by_keycode (EekSection *section,
|
||||
guint keycode)
|
||||
{
|
||||
g_return_val_if_fail (EEK_IS_SECTION(section), NULL);
|
||||
return EEK_SECTION_GET_CLASS(section)->find_key_by_keycode (section,
|
||||
keycode);
|
||||
}
|
||||
@@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_SECTION_H
|
||||
#define EEK_SECTION_H 1
|
||||
|
||||
#include <glib-object.h>
|
||||
#include "eek-container.h"
|
||||
#include "eek-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEK_TYPE_SECTION (eek_section_get_type())
|
||||
#define EEK_SECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_SECTION, EekSection))
|
||||
#define EEK_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_SECTION, EekSectionClass))
|
||||
#define EEK_IS_SECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_SECTION))
|
||||
#define EEK_IS_SECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_SECTION))
|
||||
#define EEK_SECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_SECTION, EekSectionClass))
|
||||
|
||||
typedef struct _EekSectionClass EekSectionClass;
|
||||
typedef struct _EekSectionPrivate EekSectionPrivate;
|
||||
|
||||
struct _EekSection
|
||||
{
|
||||
/*< private >*/
|
||||
EekContainer parent;
|
||||
|
||||
EekSectionPrivate *priv;
|
||||
};
|
||||
|
||||
/**
|
||||
* EekSectionClass:
|
||||
* @set_angle: virtual function for setting rotation angle of the section
|
||||
* @get_angle: virtual function for getting rotation angle of the section
|
||||
* @get_n_rows: virtual function for getting the number of rows in the section
|
||||
* @add_row: virtual function for adding a new row to the section
|
||||
* @get_row: virtual function for accessing a row in the section
|
||||
* @create_key: virtual function for creating key in the section
|
||||
* @find_key_by_keycode: virtual function for accessing a key in the
|
||||
* section by keycode
|
||||
*/
|
||||
struct _EekSectionClass
|
||||
{
|
||||
/*< private >*/
|
||||
EekContainerClass parent_class;
|
||||
|
||||
/*< public >*/
|
||||
void (* set_angle) (EekSection *self,
|
||||
gint angle);
|
||||
gint (* get_angle) (EekSection *self);
|
||||
|
||||
gint (* get_n_rows) (EekSection *self);
|
||||
void (* add_row) (EekSection *self,
|
||||
gint num_columns,
|
||||
EekOrientation orientation);
|
||||
void (* get_row) (EekSection *self,
|
||||
gint index,
|
||||
gint *num_columns,
|
||||
EekOrientation *orientation);
|
||||
|
||||
EekKey *(* create_key) (EekSection *self,
|
||||
gint row,
|
||||
gint column);
|
||||
|
||||
EekKey *(* find_key_by_keycode) (EekSection *self,
|
||||
guint keycode);
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_section_get_type (void) G_GNUC_CONST;
|
||||
|
||||
void eek_section_set_angle (EekSection *section,
|
||||
gint angle);
|
||||
gint eek_section_get_angle (EekSection *section);
|
||||
|
||||
gint eek_section_get_n_rows (EekSection *section);
|
||||
void eek_section_add_row (EekSection *section,
|
||||
gint num_columns,
|
||||
EekOrientation orientation);
|
||||
void eek_section_get_row (EekSection *section,
|
||||
gint index,
|
||||
gint *num_columns,
|
||||
EekOrientation *orientation);
|
||||
|
||||
EekKey *eek_section_create_key (EekSection *section,
|
||||
gint column,
|
||||
gint row);
|
||||
|
||||
EekKey *eek_section_find_key_by_keycode (EekSection *section,
|
||||
guint keycode);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_SECTION_H */
|
||||
106
eek/eek-types.c
106
eek/eek-types.c
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -20,115 +20,55 @@
|
||||
|
||||
/**
|
||||
* SECTION:eek-types
|
||||
* @short_description: Miscellaneous types
|
||||
* @title: Miscellaneous Types
|
||||
* @short_description: Miscellaneous types used in Libeek
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "eek-types.h"
|
||||
|
||||
/* EekKeysymMatrix */
|
||||
static EekKeysymMatrix *
|
||||
eek_keysym_matrix_copy (const EekKeysymMatrix *matrix)
|
||||
{
|
||||
return g_slice_dup (EekKeysymMatrix, matrix);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_keysym_matrix_free (EekKeysymMatrix *matrix)
|
||||
{
|
||||
g_slice_free (EekKeysymMatrix, matrix);
|
||||
}
|
||||
|
||||
GType
|
||||
eek_keysym_matrix_get_type (void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
|
||||
if (our_type == 0)
|
||||
our_type =
|
||||
g_boxed_type_register_static ("EekKeysymMatrix",
|
||||
(GBoxedCopyFunc)eek_keysym_matrix_copy,
|
||||
(GBoxedFreeFunc)eek_keysym_matrix_free);
|
||||
return our_type;
|
||||
}
|
||||
|
||||
/* EekPoint */
|
||||
static EekPoint *
|
||||
G_DEFINE_BOXED_TYPE(EekPoint, eek_point, eek_point_copy, eek_point_free);
|
||||
|
||||
EekPoint *
|
||||
eek_point_copy (const EekPoint *point)
|
||||
{
|
||||
return g_slice_dup (EekPoint, point);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
eek_point_free (EekPoint *point)
|
||||
{
|
||||
g_slice_free (EekPoint, point);
|
||||
}
|
||||
|
||||
GType
|
||||
eek_point_get_type (void)
|
||||
void
|
||||
eek_point_rotate (EekPoint *point, gint angle)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
gdouble r, phi;
|
||||
|
||||
if (our_type == 0)
|
||||
our_type =
|
||||
g_boxed_type_register_static ("EekPoint",
|
||||
(GBoxedCopyFunc)eek_point_copy,
|
||||
(GBoxedFreeFunc)eek_point_free);
|
||||
return our_type;
|
||||
phi = atan2 (point->y, point->x);
|
||||
r = sqrt (point->x * point->x + point->y * point->y);
|
||||
phi += angle * M_PI / 180;
|
||||
point->x = r * cos (phi);
|
||||
point->y = r * sin (phi);
|
||||
}
|
||||
|
||||
/* EekBounds */
|
||||
static EekBounds *
|
||||
G_DEFINE_BOXED_TYPE(EekBounds, eek_bounds, eek_bounds_copy, eek_bounds_free);
|
||||
|
||||
EekBounds *
|
||||
eek_bounds_copy (const EekBounds *bounds)
|
||||
{
|
||||
return g_slice_dup (EekBounds, bounds);
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
eek_bounds_free (EekBounds *bounds)
|
||||
{
|
||||
g_slice_free (EekBounds, bounds);
|
||||
}
|
||||
|
||||
GType
|
||||
eek_bounds_get_type (void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
|
||||
if (our_type == 0)
|
||||
our_type =
|
||||
g_boxed_type_register_static ("EekBounds",
|
||||
(GBoxedCopyFunc)eek_bounds_copy,
|
||||
(GBoxedFreeFunc)eek_bounds_free);
|
||||
return our_type;
|
||||
}
|
||||
|
||||
/* EekOutline */
|
||||
static EekOutline *
|
||||
eek_outline_copy (const EekOutline *outline)
|
||||
{
|
||||
return g_slice_dup (EekOutline, outline);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_outline_free (EekOutline *outline)
|
||||
{
|
||||
g_slice_free (EekOutline, outline);
|
||||
}
|
||||
|
||||
GType
|
||||
eek_outline_get_type (void)
|
||||
{
|
||||
static GType our_type = 0;
|
||||
|
||||
if (our_type == 0)
|
||||
our_type =
|
||||
g_boxed_type_register_static ("EekOutline",
|
||||
(GBoxedCopyFunc)eek_outline_copy,
|
||||
(GBoxedFreeFunc)eek_outline_free);
|
||||
return our_type;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
* Copyright (C) 2010-2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010-2011 Red Hat, Inc.
|
||||
* Copyright (C) 2019 Purism, SPC
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
@@ -17,6 +18,11 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
#if !defined(__EEK_H_INSIDE__) && !defined(EEK_COMPILATION)
|
||||
#error "Only <eek/eek.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#ifndef EEK_TYPES_H
|
||||
#define EEK_TYPES_H 1
|
||||
|
||||
@@ -24,45 +30,15 @@
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* EekOrientation:
|
||||
* @EEK_ORIENTATION_VERTICAL: the elements will be arranged vertically
|
||||
* @EEK_ORIENTATION_HORIZONTAL: the elements will be arranged horizontally
|
||||
* @EEK_ORIENTATION_INVALID: used for error reporting
|
||||
*
|
||||
* Orientation of rows in sections. Elements in a row will be
|
||||
* arranged with the specified orientation.
|
||||
*/
|
||||
typedef enum {
|
||||
EEK_ORIENTATION_VERTICAL,
|
||||
EEK_ORIENTATION_HORIZONTAL,
|
||||
EEK_ORIENTATION_INVALID = -1
|
||||
} EekOrientation;
|
||||
#define I_(string) g_intern_static_string (string)
|
||||
|
||||
typedef struct _EekElement EekElement;
|
||||
typedef struct _EekContainer EekContainer;
|
||||
typedef struct _EekKey EekKey;
|
||||
typedef struct _EekSection EekSection;
|
||||
typedef struct _EekKeyboard EekKeyboard;
|
||||
#define EEK_TYPE_POINT (eek_point_get_type ())
|
||||
#define EEK_TYPE_BOUNDS (eek_bounds_get_type ())
|
||||
|
||||
/**
|
||||
* EekKeysymMatrix:
|
||||
* @data: array of keysyms
|
||||
* @num_groups: the number of groups (rows)
|
||||
* @num_levels: the number of levels (columns)
|
||||
*
|
||||
* Symbol matrix of a key.
|
||||
*/
|
||||
struct _EekKeysymMatrix
|
||||
{
|
||||
guint *data;
|
||||
gint num_groups;
|
||||
gint num_levels;
|
||||
};
|
||||
typedef struct _EekKeysymMatrix EekKeysymMatrix;
|
||||
typedef struct _EekBounds EekBounds;
|
||||
|
||||
#define EEK_TYPE_KEYSYM_MATRIX (eek_keysym_matrix_get_type ())
|
||||
GType eek_keysym_matrix_get_type (void) G_GNUC_CONST;
|
||||
typedef struct _EekboardContextService EekboardContextService;
|
||||
typedef struct _LevelKeyboard LevelKeyboard;
|
||||
|
||||
/**
|
||||
* EekPoint:
|
||||
@@ -71,15 +47,19 @@ GType eek_keysym_matrix_get_type (void) G_GNUC_CONST;
|
||||
*
|
||||
* 2D vertex
|
||||
*/
|
||||
typedef struct _EekPoint EekPoint;
|
||||
struct _EekPoint
|
||||
{
|
||||
/*< public >*/
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
};
|
||||
typedef struct _EekPoint EekPoint;
|
||||
|
||||
#define EEK_TYPE_POINT (eek_point_get_type ())
|
||||
GType eek_point_get_type (void) G_GNUC_CONST;
|
||||
EekPoint *eek_point_copy (const EekPoint *point);
|
||||
void eek_point_free (EekPoint *point);
|
||||
void eek_point_rotate (EekPoint *point,
|
||||
gint angle);
|
||||
|
||||
/**
|
||||
* EekBounds:
|
||||
@@ -88,44 +68,25 @@ GType eek_point_get_type (void) G_GNUC_CONST;
|
||||
* @width: width of the box
|
||||
* @height: height of the box
|
||||
*
|
||||
* 2D bounding box
|
||||
* The rectangle containing an element's bounding box.
|
||||
*/
|
||||
struct _EekBounds
|
||||
{
|
||||
/*< public >*/
|
||||
gdouble x;
|
||||
gdouble y;
|
||||
gdouble width;
|
||||
gdouble height;
|
||||
};
|
||||
typedef struct _EekBounds EekBounds;
|
||||
|
||||
#define EEK_TYPE_BOUNDS (eek_bounds_get_type ())
|
||||
GType eek_bounds_get_type (void) G_GNUC_CONST;
|
||||
EekBounds *eek_bounds_copy (const EekBounds *bounds);
|
||||
void eek_bounds_free (EekBounds *bounds);
|
||||
|
||||
G_INLINE_FUNC gdouble
|
||||
eek_bounds_long_side (EekBounds *bounds)
|
||||
{
|
||||
return bounds->width > bounds->height ? bounds->width : bounds->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* EekOutline:
|
||||
* @corner_radius: radius of corners of rounded polygon
|
||||
* @points: an array of points represents a polygon
|
||||
* @num_points: the length of @points
|
||||
*
|
||||
* 2D rounded polygon used to draw key shape
|
||||
*/
|
||||
struct _EekOutline
|
||||
{
|
||||
gdouble corner_radius;
|
||||
EekPoint *points;
|
||||
gint num_points;
|
||||
struct transformation {
|
||||
gdouble origin_x;
|
||||
gdouble origin_y;
|
||||
gdouble scale;
|
||||
};
|
||||
typedef struct _EekOutline EekOutline;
|
||||
|
||||
#define EEK_TYPE_OUTLINE (eek_outline_get_type ())
|
||||
GType eek_outline_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* EEK_TYPES_H */
|
||||
|
||||
@@ -1,845 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2006 Sergey V. Udaltsov <svu@gnome.org>
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:eek-xkb-layout
|
||||
* @short_description: Layout engine using XKB configuration
|
||||
*
|
||||
* The #EekXkbLayout inherits #EekLayout class and arranges keyboard
|
||||
* elements using XKB.
|
||||
*/
|
||||
|
||||
#include <gdk/gdkx.h>
|
||||
#include <X11/XKBlib.h>
|
||||
#include <X11/extensions/XKBgeom.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-xkb-layout.h"
|
||||
#include "eek-keyboard.h"
|
||||
#include "eek-section.h"
|
||||
#include "eek-key.h"
|
||||
#include "eek-keysym.h"
|
||||
|
||||
#define noKBDRAW_DEBUG
|
||||
|
||||
static void eek_layout_iface_init (EekLayoutIface *iface);
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (EekXkbLayout, eek_xkb_layout, G_TYPE_INITIALLY_UNOWNED,
|
||||
G_IMPLEMENT_INTERFACE (EEK_TYPE_LAYOUT,
|
||||
eek_layout_iface_init));
|
||||
|
||||
#define EEK_XKB_LAYOUT_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutPrivate))
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_KEYCODES,
|
||||
PROP_GEOMETRY,
|
||||
PROP_SYMBOLS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
struct _EekXkbLayoutPrivate
|
||||
{
|
||||
/* Configuration names that should synch'ed to the symbolic names
|
||||
in priv->xkb->names. Since we use GLib's memory allocator,
|
||||
don't store any address returned from the X server here. */
|
||||
XkbComponentNamesRec names;
|
||||
|
||||
Display *display;
|
||||
|
||||
/* Actual XKB configuration of DISPLAY. */
|
||||
XkbDescRec *xkb;
|
||||
|
||||
/* Hash table to cache outlines by shape address. */
|
||||
GHashTable *outline_hash;
|
||||
|
||||
gint scale_numerator;
|
||||
gint scale_denominator;
|
||||
};
|
||||
|
||||
static guint
|
||||
find_keycode (EekXkbLayout *layout, gchar *key_name);
|
||||
|
||||
static void
|
||||
get_keyboard (EekXkbLayout *layout);
|
||||
|
||||
static void
|
||||
get_names (EekXkbLayout *layout);
|
||||
|
||||
static void
|
||||
setup_scaling (EekXkbLayout *layout,
|
||||
gdouble width,
|
||||
gdouble height);
|
||||
|
||||
G_INLINE_FUNC gint
|
||||
xkb_to_pixmap_coord (EekXkbLayout *layout,
|
||||
gint n)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = layout->priv;
|
||||
return n * priv->scale_numerator / priv->scale_denominator;
|
||||
}
|
||||
|
||||
G_INLINE_FUNC gdouble
|
||||
xkb_to_pixmap_double (EekXkbLayout *layout,
|
||||
gdouble d)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = layout->priv;
|
||||
return d * priv->scale_numerator / priv->scale_denominator;
|
||||
}
|
||||
|
||||
static void
|
||||
create_key (EekXkbLayout *layout,
|
||||
EekSection *section,
|
||||
gint column,
|
||||
gint row,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
XkbKeyRec *xkbkey)
|
||||
{
|
||||
XkbGeometryRec *xkbgeometry;
|
||||
XkbBoundsRec *xkbbounds;
|
||||
XkbShapeRec *xkbshape;
|
||||
XkbOutlineRec *xkboutline;
|
||||
EekXkbLayoutPrivate *priv = layout->priv;
|
||||
EekKey *key;
|
||||
EekBounds bounds;
|
||||
guint *keysyms = NULL;
|
||||
gchar name[XkbKeyNameLength + 1];
|
||||
EekOutline *outline;
|
||||
KeyCode keycode;
|
||||
gint num_groups, num_levels, num_keysyms;
|
||||
|
||||
xkbgeometry = priv->xkb->geom;
|
||||
xkbshape = &xkbgeometry->shapes[xkbkey->shape_ndx];
|
||||
outline = g_hash_table_lookup (priv->outline_hash, xkbshape);
|
||||
if (outline == NULL) {
|
||||
xkboutline = xkbshape->primary == NULL ? &xkbshape->outlines[0] :
|
||||
xkbshape->primary;
|
||||
|
||||
outline = g_slice_new (EekOutline);
|
||||
outline->corner_radius = xkb_to_pixmap_coord(layout, xkboutline->corner_radius);
|
||||
|
||||
if (xkboutline->num_points <= 2) { /* rectangular */
|
||||
gdouble x1, y1, x2, y2;
|
||||
|
||||
outline->num_points = 4;
|
||||
outline->points = g_slice_alloc0 (sizeof (EekPoint) *
|
||||
outline->num_points);
|
||||
if (xkboutline->num_points == 1) {
|
||||
x1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.x1);
|
||||
y1 = xkb_to_pixmap_coord(layout, xkbshape->bounds.y1);
|
||||
x2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
|
||||
y2 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
|
||||
} else {
|
||||
x1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].x);
|
||||
y1 = xkb_to_pixmap_coord(layout, xkboutline->points[0].y);
|
||||
x2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].x);
|
||||
y2 = xkb_to_pixmap_coord(layout, xkboutline->points[1].y);
|
||||
}
|
||||
outline->points[0].x = outline->points[3].x = x1;
|
||||
outline->points[0].y = outline->points[1].y = y1;
|
||||
outline->points[1].x = outline->points[2].x = x2;
|
||||
outline->points[2].y = outline->points[3].y = y2;
|
||||
} else { /* polygon */
|
||||
gint i;
|
||||
|
||||
outline->num_points = xkboutline->num_points;
|
||||
outline->points = g_new0 (EekPoint, outline->num_points);
|
||||
for (i = 0; i < xkboutline->num_points; i++) {
|
||||
outline->points[i].x = xkb_to_pixmap_coord(layout, xkboutline->points[i].x);
|
||||
outline->points[i].y = xkb_to_pixmap_coord(layout, xkboutline->points[i].y);
|
||||
}
|
||||
}
|
||||
g_hash_table_insert (priv->outline_hash, xkbshape, outline);
|
||||
}
|
||||
|
||||
memset (name, 0, sizeof name);
|
||||
memcpy (name, xkbkey->name.name, sizeof name - 1);
|
||||
|
||||
xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
|
||||
bounds.x = xkb_to_pixmap_coord(layout, xkbbounds->x1 + x);
|
||||
bounds.y = xkb_to_pixmap_coord(layout, xkbbounds->y1 + y);
|
||||
bounds.width = xkb_to_pixmap_coord(layout, xkbbounds->x2 - xkbbounds->x1);
|
||||
bounds.height = xkb_to_pixmap_coord(layout, xkbbounds->y2 - xkbbounds->y1);
|
||||
|
||||
keycode = find_keycode (layout, name);
|
||||
if (keycode == EEK_INVALID_KEYCODE)
|
||||
num_groups = num_levels = 0;
|
||||
else {
|
||||
KeySym keysym;
|
||||
gint i, j;
|
||||
|
||||
num_groups = XkbKeyNumGroups (priv->xkb, keycode);
|
||||
num_levels = XkbKeyGroupsWidth (priv->xkb, keycode);
|
||||
num_keysyms = num_groups * num_levels;
|
||||
keysyms = g_slice_alloc0 (num_keysyms * sizeof(guint));
|
||||
for (i = 0; i < num_groups; i++)
|
||||
for (j = 0; j < num_levels; j++) {
|
||||
keysym = XkbKeySymEntry (priv->xkb, keycode, j, i);
|
||||
keysyms[i * num_levels + j] = keysym;
|
||||
}
|
||||
}
|
||||
|
||||
key = eek_section_create_key (section, column, row);
|
||||
eek_element_set_name (EEK_ELEMENT(key), name);
|
||||
eek_element_set_bounds (EEK_ELEMENT(key), &bounds);
|
||||
eek_key_set_keycode (key, keycode);
|
||||
eek_key_set_keysyms (key, keysyms, num_groups, num_levels);
|
||||
if (keysyms)
|
||||
g_slice_free1 (num_keysyms * sizeof(guint), keysyms);
|
||||
eek_key_set_keysym_index (key, 0, 0);
|
||||
eek_key_set_outline (key, outline);
|
||||
}
|
||||
|
||||
static void
|
||||
create_section (EekXkbLayout *layout,
|
||||
EekKeyboard *keyboard,
|
||||
XkbSectionRec *xkbsection)
|
||||
{
|
||||
XkbGeometryRec *xkbgeometry;
|
||||
EekXkbLayoutPrivate *priv;
|
||||
EekSection *section;
|
||||
EekBounds bounds;
|
||||
gchar *name;
|
||||
gfloat left, top;
|
||||
gint i, j;
|
||||
|
||||
bounds.x = xkb_to_pixmap_coord(layout, xkbsection->left);
|
||||
bounds.y = xkb_to_pixmap_coord(layout, xkbsection->top);
|
||||
bounds.width = xkb_to_pixmap_coord(layout, xkbsection->width);
|
||||
bounds.height = xkb_to_pixmap_coord(layout, xkbsection->height);
|
||||
|
||||
priv = layout->priv;
|
||||
xkbgeometry = priv->xkb->geom;
|
||||
section = eek_keyboard_create_section (keyboard);
|
||||
name = XGetAtomName (priv->display, xkbsection->name);
|
||||
eek_element_set_name (EEK_ELEMENT(section), name);
|
||||
XFree (name);
|
||||
eek_element_set_bounds (EEK_ELEMENT(section), &bounds);
|
||||
eek_section_set_angle (section,
|
||||
/* angle is in tenth of degree */
|
||||
xkbsection->angle / 10);
|
||||
|
||||
for (i = 0; i < xkbsection->num_rows; i++) {
|
||||
XkbRowRec *xkbrow;
|
||||
|
||||
xkbrow = &xkbsection->rows[i];
|
||||
left = xkbrow->left;
|
||||
top = xkbrow->top;
|
||||
eek_section_add_row (section,
|
||||
xkbrow->num_keys,
|
||||
xkbrow->vertical ?
|
||||
EEK_ORIENTATION_VERTICAL :
|
||||
EEK_ORIENTATION_HORIZONTAL);
|
||||
for (j = 0; j < xkbrow->num_keys; j++) {
|
||||
XkbKeyRec *xkbkey;
|
||||
XkbBoundsRec *xkbbounds;
|
||||
|
||||
xkbkey = &xkbrow->keys[j];
|
||||
if (xkbrow->vertical)
|
||||
top += xkbkey->gap;
|
||||
else
|
||||
left += xkbkey->gap;
|
||||
create_key (layout, section, j, i, left, top, xkbkey);
|
||||
xkbbounds = &xkbgeometry->shapes[xkbkey->shape_ndx].bounds;
|
||||
if (xkbrow->vertical)
|
||||
top += xkbbounds->y2 - xkbbounds->y1;
|
||||
else
|
||||
left += xkbbounds->x2 - xkbbounds->x1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
create_keyboard (EekXkbLayout *layout, EekKeyboard *keyboard)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = layout->priv;
|
||||
XkbGeometryRec *xkbgeometry;
|
||||
EekBounds bounds;
|
||||
gint i;
|
||||
|
||||
g_return_if_fail (priv->xkb);
|
||||
g_return_if_fail (priv->xkb->geom);
|
||||
|
||||
xkbgeometry = priv->xkb->geom;
|
||||
|
||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||
setup_scaling (EEK_XKB_LAYOUT(layout), bounds.width, bounds.height);
|
||||
|
||||
bounds.x = bounds.y = 0;
|
||||
bounds.width = xkb_to_pixmap_coord(layout, xkbgeometry->width_mm);
|
||||
bounds.height = xkb_to_pixmap_coord(layout, xkbgeometry->height_mm);
|
||||
|
||||
for (i = 0; i < xkbgeometry->num_sections; i++) {
|
||||
XkbSectionRec *xkbsection;
|
||||
|
||||
xkbsection = &xkbgeometry->sections[i];
|
||||
create_section (layout, keyboard, xkbsection);
|
||||
}
|
||||
eek_element_set_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||
}
|
||||
|
||||
static void
|
||||
outline_free (gpointer data)
|
||||
{
|
||||
EekOutline *outline = data;
|
||||
g_slice_free1 (sizeof (EekPoint) * outline->num_points, outline->points);
|
||||
g_boxed_free (EEK_TYPE_OUTLINE, outline);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkb_layout_real_apply (EekLayout *layout, EekKeyboard *keyboard)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
|
||||
|
||||
g_return_if_fail (priv);
|
||||
if (priv->outline_hash)
|
||||
g_hash_table_unref (priv->outline_hash);
|
||||
priv->outline_hash = g_hash_table_new_full (g_direct_hash,
|
||||
g_direct_equal,
|
||||
NULL,
|
||||
outline_free);
|
||||
create_keyboard (EEK_XKB_LAYOUT(layout), keyboard);
|
||||
}
|
||||
|
||||
static gint
|
||||
compare_component_name (gchar *name0, gchar *name1)
|
||||
{
|
||||
if (name0 && name1)
|
||||
return g_strcmp0 (name0, name1);
|
||||
else if (!name0 && name1)
|
||||
return -1;
|
||||
else if (name0 && !name1)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkb_layout_finalize (GObject *object)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (object);
|
||||
|
||||
g_free (priv->names.keycodes);
|
||||
g_free (priv->names.geometry);
|
||||
g_free (priv->names.symbols);
|
||||
if (priv->outline_hash)
|
||||
g_hash_table_unref (priv->outline_hash);
|
||||
XkbFreeKeyboard (priv->xkb, 0, TRUE); /* free_all = TRUE */
|
||||
G_OBJECT_CLASS (eek_xkb_layout_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkb_layout_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
const gchar *name;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_KEYCODES:
|
||||
name = g_value_get_string (value);
|
||||
eek_xkb_layout_set_keycodes (EEK_XKB_LAYOUT(object), name);
|
||||
break;
|
||||
case PROP_GEOMETRY:
|
||||
name = g_value_get_string (value);
|
||||
eek_xkb_layout_set_geometry (EEK_XKB_LAYOUT(object), name);
|
||||
break;
|
||||
case PROP_SYMBOLS:
|
||||
name = g_value_get_string (value);
|
||||
eek_xkb_layout_set_symbols (EEK_XKB_LAYOUT(object), name);
|
||||
break;
|
||||
default:
|
||||
g_object_set_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkb_layout_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
const gchar *name;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_KEYCODES:
|
||||
name = eek_xkb_layout_get_keycodes (EEK_XKB_LAYOUT(object));
|
||||
g_value_set_string (value, name);
|
||||
break;
|
||||
case PROP_GEOMETRY:
|
||||
name = eek_xkb_layout_get_geometry (EEK_XKB_LAYOUT(object));
|
||||
g_value_set_string (value, name);
|
||||
break;
|
||||
case PROP_SYMBOLS:
|
||||
name = eek_xkb_layout_get_symbols (EEK_XKB_LAYOUT(object));
|
||||
g_value_set_string (value, name);
|
||||
break;
|
||||
default:
|
||||
g_object_get_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
eek_xkb_layout_real_get_group (EekLayout *self)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
|
||||
XkbStateRec state;
|
||||
|
||||
g_return_val_if_fail (XkbGetState (priv->display, XkbUseCoreKbd, &state), -1);
|
||||
return state.group;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_layout_iface_init (EekLayoutIface *iface)
|
||||
{
|
||||
iface->apply = eek_xkb_layout_real_apply;
|
||||
iface->get_group = eek_xkb_layout_real_get_group;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkb_layout_class_init (EekXkbLayoutClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (EekXkbLayoutPrivate));
|
||||
|
||||
gobject_class->finalize = eek_xkb_layout_finalize;
|
||||
gobject_class->set_property = eek_xkb_layout_set_property;
|
||||
gobject_class->get_property = eek_xkb_layout_get_property;
|
||||
|
||||
pspec = g_param_spec_string ("keycodes",
|
||||
"Keycodes",
|
||||
"XKB keycodes component name",
|
||||
NULL,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_KEYCODES, pspec);
|
||||
|
||||
pspec = g_param_spec_string ("geometry",
|
||||
"Geometry",
|
||||
"XKB geometry component name",
|
||||
NULL,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_GEOMETRY, pspec);
|
||||
|
||||
pspec = g_param_spec_string ("symbols",
|
||||
"Symbols",
|
||||
"XKB symbols component name",
|
||||
NULL,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_SYMBOLS, pspec);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkb_layout_init (EekXkbLayout *self)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv;
|
||||
|
||||
priv = self->priv = EEK_XKB_LAYOUT_GET_PRIVATE (self);
|
||||
memset (&priv->names, 0, sizeof priv->names);
|
||||
|
||||
priv->display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
||||
g_return_if_fail (priv->display);
|
||||
|
||||
/* XXX: XkbClientMapMask | XkbIndicatorMapMask | XkbNamesMask |
|
||||
XkbGeometryMask */
|
||||
priv->xkb = XkbGetKeyboard (priv->display,
|
||||
XkbGBN_GeometryMask |
|
||||
XkbGBN_KeyNamesMask |
|
||||
XkbGBN_OtherNamesMask |
|
||||
XkbGBN_SymbolsMask |
|
||||
XkbGBN_IndicatorMapMask,
|
||||
XkbUseCoreKbd);
|
||||
|
||||
if (priv->xkb == NULL) {
|
||||
g_critical ("XkbGetKeyboard failed to get keyboard from the server!");
|
||||
return;
|
||||
}
|
||||
get_names (self);
|
||||
}
|
||||
|
||||
static void
|
||||
get_names (EekXkbLayout *layout)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = layout->priv;
|
||||
gchar *name;
|
||||
|
||||
XkbGetNames (priv->display, XkbAllNamesMask, priv->xkb);
|
||||
|
||||
if (priv->xkb->names->keycodes <= 0)
|
||||
g_warning ("XKB keycodes setting is not loaded properly");
|
||||
else {
|
||||
name = XGetAtomName (priv->display, priv->xkb->names->keycodes);
|
||||
if (!name)
|
||||
g_warning ("Can't get the name of keycodes");
|
||||
else if (!priv->names.keycodes ||
|
||||
g_strcmp0 (name, priv->names.keycodes)) {
|
||||
g_free (priv->names.keycodes);
|
||||
priv->names.keycodes = g_strdup (name);
|
||||
XFree (name);
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->xkb->names->geometry <= 0)
|
||||
g_warning ("XKB geometry setting is not loaded");
|
||||
else {
|
||||
name = XGetAtomName (priv->display, priv->xkb->names->geometry);
|
||||
if (!name)
|
||||
g_warning ("Can't get the name of geometry");
|
||||
else if (!priv->names.geometry ||
|
||||
g_strcmp0 (name, priv->names.geometry)) {
|
||||
g_free (priv->names.geometry);
|
||||
priv->names.geometry = g_strdup (name);
|
||||
XFree (name);
|
||||
}
|
||||
}
|
||||
|
||||
if (priv->xkb->names->symbols <= 0)
|
||||
g_warning ("XKB symbols setting is not loaded");
|
||||
else {
|
||||
name = XGetAtomName (priv->display, priv->xkb->names->symbols);
|
||||
if (!name)
|
||||
g_warning ("Can't get the name of symbols");
|
||||
else if (!priv->names.symbols ||
|
||||
g_strcmp0 (name, priv->names.symbols)) {
|
||||
g_free (priv->names.symbols);
|
||||
priv->names.symbols = g_strdup (name);
|
||||
XFree (name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkb_layout_new:
|
||||
*
|
||||
* Create a new #EekXkbLayout.
|
||||
*/
|
||||
EekLayout *
|
||||
eek_xkb_layout_new (void)
|
||||
{
|
||||
EekXkbLayout *layout;
|
||||
|
||||
layout = g_object_new (EEK_TYPE_XKB_LAYOUT, NULL);
|
||||
g_return_val_if_fail (layout, NULL);
|
||||
|
||||
get_keyboard (layout);
|
||||
if (layout->priv->xkb == NULL) {
|
||||
g_object_unref (layout);
|
||||
return NULL;
|
||||
}
|
||||
return EEK_LAYOUT(layout);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkb_layout_set_names:
|
||||
* @layout: an #EekXkbLayout
|
||||
* @names: XKB component names
|
||||
*
|
||||
* Set the XKB component names to @layout.
|
||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkb_layout_set_names (EekXkbLayout *layout, XkbComponentNamesRec *names)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
|
||||
gboolean is_changed;
|
||||
|
||||
g_return_val_if_fail (priv, FALSE);
|
||||
|
||||
/* keycodes */
|
||||
if (compare_component_name (names->keycodes, priv->names.keycodes) != 0)
|
||||
is_changed = TRUE;
|
||||
g_free (priv->names.keycodes);
|
||||
priv->names.keycodes = g_strdup (names->keycodes);
|
||||
|
||||
/* geometry */
|
||||
if (compare_component_name (names->geometry, priv->names.geometry) != 0)
|
||||
is_changed = TRUE;
|
||||
g_free (priv->names.geometry);
|
||||
priv->names.geometry = g_strdup (names->geometry);
|
||||
|
||||
/* symbols */
|
||||
if (compare_component_name (names->symbols, priv->names.symbols) != 0)
|
||||
is_changed = TRUE;
|
||||
g_free (priv->names.symbols);
|
||||
priv->names.symbols = g_strdup (names->symbols);
|
||||
|
||||
get_keyboard (layout);
|
||||
if (!priv->xkb)
|
||||
return FALSE;
|
||||
|
||||
if (is_changed)
|
||||
g_signal_emit_by_name (layout, "changed");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkb_layout_set_keycodes:
|
||||
* @layout: an #EekXkbLayout
|
||||
* @keycodes: component name for keycodes
|
||||
*
|
||||
* Set the keycodes component (in the XKB terminology).
|
||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkb_layout_set_keycodes (EekXkbLayout *layout, const gchar *keycodes)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
|
||||
XkbComponentNamesRec names;
|
||||
|
||||
g_return_val_if_fail (priv, FALSE);
|
||||
memcpy (&names, &priv->names, sizeof names);
|
||||
names.keycodes = (gchar *)keycodes;
|
||||
return eek_xkb_layout_set_names (layout, &names);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkb_layout_set_geometry:
|
||||
* @layout: an #EekXkbLayout
|
||||
* @geometry: component name for geometry
|
||||
*
|
||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkb_layout_set_geometry (EekXkbLayout *layout, const gchar *geometry)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
|
||||
XkbComponentNamesRec names;
|
||||
|
||||
g_return_val_if_fail (priv, FALSE);
|
||||
memcpy (&names, &priv->names, sizeof names);
|
||||
names.geometry = (gchar *)geometry;
|
||||
return eek_xkb_layout_set_names (layout, &names);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkb_layout_set_symbols:
|
||||
* @layout: an #EekXkbLayout
|
||||
* @symbols: component name for symbols
|
||||
*
|
||||
* Set the symbols component (in the XKB terminology).
|
||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkb_layout_set_symbols (EekXkbLayout *layout, const gchar *symbols)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
|
||||
XkbComponentNamesRec names;
|
||||
|
||||
g_return_val_if_fail (priv, FALSE);
|
||||
memcpy (&names, &priv->names, sizeof names);
|
||||
names.symbols = (gchar *)symbols;
|
||||
return eek_xkb_layout_set_names (layout, &names);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkb_layout_get_keycodes:
|
||||
* @layout: an #EekXkbLayout
|
||||
*
|
||||
* Get the keycodes component name (in the XKB terminology).
|
||||
*/
|
||||
G_CONST_RETURN gchar *
|
||||
eek_xkb_layout_get_keycodes (EekXkbLayout *layout)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
|
||||
|
||||
g_return_val_if_fail (priv, NULL);
|
||||
return priv->names.keycodes;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkb_layout_get_geometry:
|
||||
* @layout: an #EekXkbLayout
|
||||
*
|
||||
* Get the geometry component name (in the XKB terminology).
|
||||
*/
|
||||
G_CONST_RETURN gchar *
|
||||
eek_xkb_layout_get_geometry (EekXkbLayout *layout)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
|
||||
|
||||
g_return_val_if_fail (priv, NULL);
|
||||
return priv->names.geometry;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkb_layout_get_symbols:
|
||||
* @layout: an #EekXkbLayout
|
||||
*
|
||||
* Get the symbols component name (in the XKB terminology).
|
||||
*/
|
||||
G_CONST_RETURN gchar *
|
||||
eek_xkb_layout_get_symbols (EekXkbLayout *layout)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = EEK_XKB_LAYOUT_GET_PRIVATE (layout);
|
||||
|
||||
g_return_val_if_fail (priv, NULL);
|
||||
return priv->names.symbols;
|
||||
}
|
||||
|
||||
static void
|
||||
get_keyboard (EekXkbLayout *layout)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = layout->priv;
|
||||
|
||||
if (priv->xkb)
|
||||
XkbFreeKeyboard (priv->xkb, 0, TRUE); /* free_all = TRUE */
|
||||
priv->xkb = NULL;
|
||||
|
||||
if (priv->names.keycodes &&
|
||||
priv->names.geometry &&
|
||||
priv->names.symbols) {
|
||||
priv->xkb = XkbGetKeyboardByName (priv->display, XkbUseCoreKbd,
|
||||
&priv->names, 0,
|
||||
XkbGBN_GeometryMask |
|
||||
XkbGBN_KeyNamesMask |
|
||||
XkbGBN_OtherNamesMask |
|
||||
XkbGBN_ClientSymbolsMask |
|
||||
XkbGBN_IndicatorMapMask, FALSE);
|
||||
} else {
|
||||
priv->xkb = XkbGetKeyboard (priv->display,
|
||||
XkbGBN_GeometryMask |
|
||||
XkbGBN_KeyNamesMask |
|
||||
XkbGBN_OtherNamesMask |
|
||||
XkbGBN_SymbolsMask |
|
||||
XkbGBN_IndicatorMapMask,
|
||||
XkbUseCoreKbd);
|
||||
get_names (layout);
|
||||
}
|
||||
|
||||
if (priv->xkb == NULL) {
|
||||
g_free (priv->names.keycodes);
|
||||
priv->names.keycodes = NULL;
|
||||
g_free (priv->names.geometry);
|
||||
priv->names.geometry = NULL;
|
||||
g_free (priv->names.symbols);
|
||||
priv->names.symbols = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static guint
|
||||
find_keycode (EekXkbLayout *layout, gchar *key_name)
|
||||
{
|
||||
#define KEYSYM_NAME_MAX_LENGTH 4
|
||||
guint keycode;
|
||||
gint i, j;
|
||||
XkbKeyNamePtr pkey;
|
||||
XkbKeyAliasPtr palias;
|
||||
guint is_name_matched;
|
||||
gchar *src, *dst;
|
||||
EekXkbLayoutPrivate *priv = layout->priv;
|
||||
|
||||
if (!priv->xkb)
|
||||
return EEK_INVALID_KEYCODE;
|
||||
|
||||
#ifdef KBDRAW_DEBUG
|
||||
printf (" looking for keycode for (%c%c%c%c)\n",
|
||||
key_name[0], key_name[1], key_name[2], key_name[3]);
|
||||
#endif
|
||||
|
||||
pkey = priv->xkb->names->keys + priv->xkb->min_key_code;
|
||||
for (keycode = priv->xkb->min_key_code;
|
||||
keycode <= priv->xkb->max_key_code; keycode++) {
|
||||
is_name_matched = 1;
|
||||
src = key_name;
|
||||
dst = pkey->name;
|
||||
for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
|
||||
if ('\0' == *src)
|
||||
break;
|
||||
if (*src++ != *dst++) {
|
||||
is_name_matched = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (is_name_matched) {
|
||||
#ifdef KBDRAW_DEBUG
|
||||
printf (" found keycode %u\n", keycode);
|
||||
#endif
|
||||
return keycode;
|
||||
}
|
||||
pkey++;
|
||||
}
|
||||
|
||||
palias = priv->xkb->names->key_aliases;
|
||||
for (j = priv->xkb->names->num_key_aliases; --j >= 0;) {
|
||||
is_name_matched = 1;
|
||||
src = key_name;
|
||||
dst = palias->alias;
|
||||
for (i = KEYSYM_NAME_MAX_LENGTH; --i >= 0;) {
|
||||
if ('\0' == *src)
|
||||
break;
|
||||
if (*src++ != *dst++) {
|
||||
is_name_matched = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (is_name_matched) {
|
||||
keycode = find_keycode (layout, palias->real);
|
||||
#ifdef KBDRAW_DEBUG
|
||||
printf ("found alias keycode %u\n", keycode);
|
||||
#endif
|
||||
return keycode;
|
||||
}
|
||||
palias++;
|
||||
}
|
||||
|
||||
return EEK_INVALID_KEYCODE;
|
||||
}
|
||||
|
||||
static void
|
||||
setup_scaling (EekXkbLayout *layout,
|
||||
gdouble width,
|
||||
gdouble height)
|
||||
{
|
||||
EekXkbLayoutPrivate *priv = layout->priv;
|
||||
|
||||
g_return_if_fail (priv->xkb);
|
||||
|
||||
g_return_if_fail (priv->xkb->geom->width_mm > 0);
|
||||
g_return_if_fail (priv->xkb->geom->height_mm > 0);
|
||||
|
||||
if (width * priv->xkb->geom->height_mm <
|
||||
height * priv->xkb->geom->width_mm) {
|
||||
priv->scale_numerator = width;
|
||||
priv->scale_denominator = priv->xkb->geom->width_mm;
|
||||
} else {
|
||||
priv->scale_numerator = height;
|
||||
priv->scale_denominator = priv->xkb->geom->height_mm;
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_XKB_LAYOUT_H
|
||||
#define EEK_XKB_LAYOUT_H 1
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/XKBlib.h>
|
||||
#include "eek-layout.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEK_TYPE_XKB_LAYOUT (eek_xkb_layout_get_type())
|
||||
#define EEK_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayout))
|
||||
#define EEK_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
|
||||
#define EEK_IS_XKB_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKB_LAYOUT))
|
||||
#define EEK_IS_XKB_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKB_LAYOUT))
|
||||
#define EEK_XKB_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKB_LAYOUT, EekXkbLayoutClass))
|
||||
|
||||
typedef struct _EekXkbLayout EekXkbLayout;
|
||||
typedef struct _EekXkbLayoutClass EekXkbLayoutClass;
|
||||
typedef struct _EekXkbLayoutPrivate EekXkbLayoutPrivate;
|
||||
|
||||
struct _EekXkbLayout
|
||||
{
|
||||
/*< private >*/
|
||||
GInitiallyUnowned parent;
|
||||
|
||||
EekXkbLayoutPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EekXkbLayoutClass
|
||||
{
|
||||
/*< private >*/
|
||||
GInitiallyUnownedClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_xkb_layout_get_type (void) G_GNUC_CONST;
|
||||
EekLayout *eek_xkb_layout_new (void);
|
||||
|
||||
gboolean eek_xkb_layout_set_names (EekXkbLayout *layout,
|
||||
XkbComponentNamesRec *names);
|
||||
gboolean eek_xkb_layout_set_keycodes
|
||||
(EekXkbLayout *layout,
|
||||
const gchar *keycodes);
|
||||
gboolean eek_xkb_layout_set_geometry
|
||||
(EekXkbLayout *layout,
|
||||
const gchar *geometry);
|
||||
gboolean eek_xkb_layout_set_symbols
|
||||
(EekXkbLayout *layout,
|
||||
const gchar *symbols);
|
||||
|
||||
G_CONST_RETURN gchar *eek_xkb_layout_get_keycodes
|
||||
(EekXkbLayout *layout);
|
||||
G_CONST_RETURN gchar *eek_xkb_layout_get_geometry
|
||||
(EekXkbLayout *layout);
|
||||
G_CONST_RETURN gchar *eek_xkb_layout_get_symbols
|
||||
(EekXkbLayout *layout);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* #ifndef EEK_XKB_LAYOUT_H */
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_XKB_H
|
||||
#define EEK_XKB_H 1
|
||||
|
||||
#include "eek.h"
|
||||
#include "eek-xkb-layout.h"
|
||||
|
||||
#endif /* EEK_XKB_H */
|
||||
@@ -1,635 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:eek-xkl-layout
|
||||
* @short_description: Layout engine using Libxklavier configuration
|
||||
*
|
||||
* The #EekXklLayout is a simple wrapper around #EekXkbLayout class
|
||||
* to use Libxklavier configuration.
|
||||
*/
|
||||
|
||||
#include <libxklavier/xklavier.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif /* HAVE_CONFIG_H */
|
||||
|
||||
#include "eek-xkl-layout.h"
|
||||
|
||||
#define noKBDRAW_DEBUG
|
||||
|
||||
static void eek_layout_iface_init (EekLayoutIface *iface);
|
||||
static EekLayoutIface *parent_layout_iface;
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (EekXklLayout, eek_xkl_layout, EEK_TYPE_XKB_LAYOUT,
|
||||
G_IMPLEMENT_INTERFACE(EEK_TYPE_LAYOUT,
|
||||
eek_layout_iface_init));
|
||||
|
||||
#define EEK_XKL_LAYOUT_GET_PRIVATE(obj) \
|
||||
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutPrivate))
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_MODEL,
|
||||
PROP_LAYOUTS,
|
||||
PROP_VARIANTS,
|
||||
PROP_OPTIONS,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
struct _EekXklLayoutPrivate
|
||||
{
|
||||
XklEngine *engine;
|
||||
XklConfigRec *config;
|
||||
};
|
||||
|
||||
/* from gnome-keyboard-properties-xkbpv.c:
|
||||
* BAD STYLE: Taken from xklavier_private_xkb.h
|
||||
* Any ideas on architectural improvements are WELCOME
|
||||
*/
|
||||
extern gboolean xkl_xkb_config_native_prepare (XklEngine * engine,
|
||||
const XklConfigRec * data,
|
||||
XkbComponentNamesPtr
|
||||
component_names);
|
||||
|
||||
extern void xkl_xkb_config_native_cleanup (XklEngine * engine,
|
||||
XkbComponentNamesPtr
|
||||
component_names);
|
||||
|
||||
static gboolean set_xkb_component_names (EekXklLayout *layout,
|
||||
XklConfigRec *config);
|
||||
|
||||
static gint
|
||||
eek_xkl_layout_real_get_group (EekLayout *self)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (self);
|
||||
XklState *state;
|
||||
|
||||
state = xkl_engine_get_current_state (priv->engine);
|
||||
g_return_val_if_fail (state, -1);
|
||||
return state->group;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_layout_iface_init (EekLayoutIface *iface)
|
||||
{
|
||||
parent_layout_iface = g_type_interface_peek_parent (iface);
|
||||
if (!parent_layout_iface)
|
||||
parent_layout_iface = g_type_default_interface_peek (EEK_TYPE_LAYOUT);
|
||||
iface->get_group = eek_xkl_layout_real_get_group;
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkl_layout_dispose (GObject *object)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (object);
|
||||
|
||||
if (priv->config) {
|
||||
g_object_unref (priv->config);
|
||||
priv->config = NULL;
|
||||
}
|
||||
if (priv->engine) {
|
||||
g_object_unref (priv->engine);
|
||||
priv->engine = NULL;
|
||||
}
|
||||
G_OBJECT_CLASS (eek_xkl_layout_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkl_layout_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MODEL:
|
||||
eek_xkl_layout_set_model (EEK_XKL_LAYOUT(object),
|
||||
g_value_get_string (value));
|
||||
break;
|
||||
case PROP_LAYOUTS:
|
||||
eek_xkl_layout_set_layouts (EEK_XKL_LAYOUT(object),
|
||||
g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_VARIANTS:
|
||||
eek_xkl_layout_set_variants (EEK_XKL_LAYOUT(object),
|
||||
g_value_get_boxed (value));
|
||||
break;
|
||||
case PROP_OPTIONS:
|
||||
eek_xkl_layout_set_options (EEK_XKL_LAYOUT(object),
|
||||
g_value_get_boxed (value));
|
||||
break;
|
||||
default:
|
||||
g_object_set_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkl_layout_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_MODEL:
|
||||
g_value_set_string
|
||||
(value,
|
||||
eek_xkl_layout_get_model (EEK_XKL_LAYOUT(object)));
|
||||
break;
|
||||
case PROP_LAYOUTS:
|
||||
g_value_set_boxed
|
||||
(value,
|
||||
eek_xkl_layout_get_layouts (EEK_XKL_LAYOUT(object)));
|
||||
break;
|
||||
case PROP_VARIANTS:
|
||||
g_value_set_boxed
|
||||
(value,
|
||||
eek_xkl_layout_get_variants (EEK_XKL_LAYOUT(object)));
|
||||
break;
|
||||
case PROP_OPTIONS:
|
||||
g_value_set_boxed
|
||||
(value,
|
||||
eek_xkl_layout_get_options (EEK_XKL_LAYOUT(object)));
|
||||
break;
|
||||
default:
|
||||
g_object_get_property (object,
|
||||
g_param_spec_get_name (pspec),
|
||||
value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
eek_xkl_layout_class_init (EekXklLayoutClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
GParamSpec *pspec;
|
||||
|
||||
g_type_class_add_private (gobject_class, sizeof (EekXklLayoutPrivate));
|
||||
|
||||
gobject_class->dispose = eek_xkl_layout_dispose;
|
||||
gobject_class->set_property = eek_xkl_layout_set_property;
|
||||
gobject_class->get_property = eek_xkl_layout_get_property;
|
||||
|
||||
/**
|
||||
* EekXklLayout:model:
|
||||
*
|
||||
* The libxklavier model name of #EekXklLayout.
|
||||
*/
|
||||
pspec = g_param_spec_string ("model",
|
||||
"Model",
|
||||
"Libxklavier model",
|
||||
NULL,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_MODEL, pspec);
|
||||
|
||||
/**
|
||||
* EekXklLayout:layouts:
|
||||
*
|
||||
* The libxklavier layout names of #EekXklLayout.
|
||||
*/
|
||||
pspec = g_param_spec_boxed ("layouts",
|
||||
"Layouts",
|
||||
"Libxklavier layouts",
|
||||
G_TYPE_STRV,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_LAYOUTS, pspec);
|
||||
|
||||
/**
|
||||
* EekXklLayout:variants:
|
||||
*
|
||||
* The libxklavier variant names of #EekXklLayout.
|
||||
*/
|
||||
pspec = g_param_spec_boxed ("variants",
|
||||
"Variants",
|
||||
"Libxklavier variants",
|
||||
G_TYPE_STRV,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_VARIANTS, pspec);
|
||||
|
||||
/**
|
||||
* EekXklLayout:options:
|
||||
*
|
||||
* The libxklavier option names of #EekXklLayout.
|
||||
*/
|
||||
pspec = g_param_spec_boxed ("options",
|
||||
"Options",
|
||||
"Libxklavier options",
|
||||
G_TYPE_STRV,
|
||||
G_PARAM_READWRITE);
|
||||
g_object_class_install_property (gobject_class, PROP_OPTIONS, pspec);
|
||||
}
|
||||
|
||||
/* Disabled since the current EekXklLayout implementation does not
|
||||
change the server setting. */
|
||||
#if 0
|
||||
static void
|
||||
on_state_changed (XklEngine *xklengine,
|
||||
XklEngineStateChange type,
|
||||
gint value,
|
||||
gboolean restore,
|
||||
gpointer user_data)
|
||||
{
|
||||
EekLayout *layout = user_data;
|
||||
|
||||
if (type == GROUP_CHANGED)
|
||||
g_signal_emit_by_name (layout, "group_changed", value);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
eek_xkl_layout_init (EekXklLayout *self)
|
||||
{
|
||||
EekXklLayoutPrivate *priv;
|
||||
Display *display;
|
||||
|
||||
priv = self->priv = EEK_XKL_LAYOUT_GET_PRIVATE (self);
|
||||
priv->config = xkl_config_rec_new ();
|
||||
|
||||
display = GDK_DISPLAY_XDISPLAY (gdk_display_get_default ());
|
||||
g_return_if_fail (display);
|
||||
|
||||
priv->engine = xkl_engine_get_instance (display);
|
||||
/* Disabled since the current EekXklLayout implementation does not
|
||||
change the server setting. */
|
||||
#if 0
|
||||
g_signal_connect (priv->engine, "X-state-changed",
|
||||
G_CALLBACK(on_state_changed), self);
|
||||
xkl_engine_start_listen (priv->engine, XKLL_TRACK_KEYBOARD_STATE);
|
||||
#endif
|
||||
xkl_config_rec_get_from_server (priv->config, priv->engine);
|
||||
set_xkb_component_names (self, priv->config);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_new:
|
||||
*
|
||||
* Create a new #EekXklLayout.
|
||||
*/
|
||||
EekLayout *
|
||||
eek_xkl_layout_new (void)
|
||||
{
|
||||
return g_object_new (EEK_TYPE_XKL_LAYOUT, NULL);
|
||||
}
|
||||
|
||||
G_INLINE_FUNC void
|
||||
merge_xkl_config_rec (XklConfigRec *dst, XklConfigRec *src)
|
||||
{
|
||||
if (src->model) {
|
||||
g_free (dst->model);
|
||||
dst->model = g_strdup (src->model);
|
||||
}
|
||||
if (src->layouts) {
|
||||
g_strfreev (dst->layouts);
|
||||
dst->layouts = g_strdupv (src->layouts);
|
||||
}
|
||||
if (src->variants) {
|
||||
g_strfreev (dst->variants);
|
||||
dst->variants = g_strdupv (src->variants);
|
||||
}
|
||||
if (src->options) {
|
||||
g_strfreev (dst->options);
|
||||
dst->options = g_strdupv (src->options);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_set_config:
|
||||
* @layout: an #EekXklLayout
|
||||
* @config: Libxklavier configuration
|
||||
*
|
||||
* Reconfigure @layout with @config.
|
||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkl_layout_set_config (EekXklLayout *layout,
|
||||
XklConfigRec *config)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||
XklConfigRec *c;
|
||||
|
||||
g_return_val_if_fail (priv, FALSE);
|
||||
c = xkl_config_rec_new ();
|
||||
merge_xkl_config_rec (c, priv->config);
|
||||
merge_xkl_config_rec (c, config);
|
||||
if (set_xkb_component_names (layout, c)) {
|
||||
g_object_unref (c);
|
||||
merge_xkl_config_rec (priv->config, config);
|
||||
return TRUE;
|
||||
}
|
||||
g_object_unref (c);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_set_model:
|
||||
* @layout: an #EekXklLayout
|
||||
* @model: model name
|
||||
*
|
||||
* Set the model name of @layout configuration (in the Libxklavier terminology).
|
||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkl_layout_set_model (EekXklLayout *layout,
|
||||
const gchar *model)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||
XklConfigRec *config;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (priv, FALSE);
|
||||
config = xkl_config_rec_new ();
|
||||
config->model = (gchar *)model;
|
||||
success = eek_xkl_layout_set_config (layout, config);
|
||||
g_object_unref (config);
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_set_layouts:
|
||||
* @layout: an #EekXklLayout
|
||||
* @layouts: layout names
|
||||
*
|
||||
* Set the layout names of @layout (in the Libxklavier terminology).
|
||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkl_layout_set_layouts (EekXklLayout *layout,
|
||||
gchar **layouts)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||
XklConfigRec *config;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (priv, FALSE);
|
||||
config = xkl_config_rec_new ();
|
||||
config->layouts = layouts;
|
||||
success = eek_xkl_layout_set_config (layout, config);
|
||||
g_object_unref (config);
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_set_variants:
|
||||
* @layout: an #EekXklLayout
|
||||
* @variants: variant names
|
||||
*
|
||||
* Set the variant names of @layout (in the Libxklavier terminology).
|
||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkl_layout_set_variants (EekXklLayout *layout,
|
||||
gchar **variants)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||
XklConfigRec *config;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (priv, FALSE);
|
||||
config = xkl_config_rec_new ();
|
||||
config->variants = variants;
|
||||
success = eek_xkl_layout_set_config (layout, config);
|
||||
g_object_unref (config);
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_set_options:
|
||||
* @layout: an #EekXklLayout
|
||||
* @options: option names
|
||||
*
|
||||
* Set the option names of @layout (in the Libxklavier terminology).
|
||||
* Returns: %TRUE if the component name is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkl_layout_set_options (EekXklLayout *layout,
|
||||
gchar **options)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||
XklConfigRec *config;
|
||||
gboolean success;
|
||||
|
||||
g_return_val_if_fail (priv, FALSE);
|
||||
config = xkl_config_rec_new ();
|
||||
config->options = options;
|
||||
success = eek_xkl_layout_set_config (layout, config);
|
||||
g_object_unref (config);
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_enable_option:
|
||||
* @layout: an #EekXklLayout
|
||||
* @option: option name
|
||||
*
|
||||
* Set the option of @layout (in the Libxklavier terminology).
|
||||
* Returns: %TRUE if the option is successfully set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkl_layout_enable_option (EekXklLayout *layout,
|
||||
const gchar *option)
|
||||
{
|
||||
gchar **options, **_options;
|
||||
gint i, j;
|
||||
|
||||
options = eek_xkl_layout_get_options (layout);
|
||||
for (i = 0; options && options[i]; i++)
|
||||
if (g_strcmp0 (options[i], option) == 0)
|
||||
return TRUE;
|
||||
_options = g_new0 (gchar *, (i + 2));
|
||||
for (j = 0; j < i; j++)
|
||||
_options[j] = g_strdup (options[j]);
|
||||
_options[i] = g_strdup (option);
|
||||
/* eek_xkl_layout_set_options() will free _options and its elements. */
|
||||
return eek_xkl_layout_set_options (layout, _options);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_disable_option:
|
||||
* @layout: an #EekXklLayout
|
||||
* @option: option name
|
||||
*
|
||||
* Unset the option of @layout (in the Libxklavier terminology).
|
||||
* Returns: %TRUE if the option is successfully unset, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkl_layout_disable_option (EekXklLayout *layout,
|
||||
const gchar *option)
|
||||
{
|
||||
gchar **options, **_options;
|
||||
gint i, j, k;
|
||||
|
||||
options = eek_xkl_layout_get_options (layout);
|
||||
if (!options)
|
||||
return TRUE;
|
||||
for (i = 0, k = 0; options[i]; i++)
|
||||
if (g_strcmp0 (options[i], option) == 0)
|
||||
k = i;
|
||||
if (options[k] == NULL)
|
||||
return TRUE;
|
||||
_options = g_new0 (gchar *, i);
|
||||
for (j = 0; j < k; j++)
|
||||
_options[j] = g_strdup (options[j]);
|
||||
for (j = k + 1; j < i; j++)
|
||||
_options[j] = g_strdup (options[j]);
|
||||
/* eek_xkl_layout_set_options() will free _options and its elements. */
|
||||
return eek_xkl_layout_set_options (layout, _options);
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_get_model:
|
||||
* @layout: an #EekXklLayout
|
||||
*
|
||||
* Get the model name of @layout configuration (in the Libxklavier terminology).
|
||||
*/
|
||||
gchar *
|
||||
eek_xkl_layout_get_model (EekXklLayout *layout)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||
|
||||
g_return_val_if_fail (priv, NULL);
|
||||
return priv->config->model;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_get_layouts:
|
||||
* @layout: an #EekXklLayout
|
||||
*
|
||||
* Get the layout names of @layout configuration (in the Libxklavier
|
||||
* terminology).
|
||||
*/
|
||||
gchar **
|
||||
eek_xkl_layout_get_layouts (EekXklLayout *layout)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||
|
||||
g_return_val_if_fail (priv, NULL);
|
||||
return priv->config->layouts;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_get_variants:
|
||||
* @layout: an #EekXklLayout
|
||||
*
|
||||
* Get the variant names of @layout configuration (in the Libxklavier
|
||||
* terminology).
|
||||
*/
|
||||
gchar **
|
||||
eek_xkl_layout_get_variants (EekXklLayout *layout)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||
|
||||
g_return_val_if_fail (priv, NULL);
|
||||
return priv->config->variants;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_get_options:
|
||||
* @layout: an #EekXklLayout
|
||||
*
|
||||
* Get the option names of @layout configuration (in the Libxklavier
|
||||
* terminology).
|
||||
*/
|
||||
gchar **
|
||||
eek_xkl_layout_get_options (EekXklLayout *layout)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = EEK_XKL_LAYOUT_GET_PRIVATE (layout);
|
||||
|
||||
g_return_val_if_fail (priv, NULL);
|
||||
return priv->config->options;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
set_xkb_component_names (EekXklLayout *layout, XklConfigRec *config)
|
||||
{
|
||||
EekXklLayoutPrivate *priv = layout->priv;
|
||||
XkbComponentNamesRec names;
|
||||
gboolean success = FALSE;
|
||||
|
||||
#if DEBUG
|
||||
if (config->layouts) {
|
||||
gint i;
|
||||
|
||||
fprintf (stderr, "layout = ");
|
||||
for (i = 0; config->layouts[i] != NULL; i++)
|
||||
fprintf (stderr, "\"%s\" ", config->layouts[i]);
|
||||
fputc ('\n', stderr);
|
||||
} else
|
||||
fprintf (stderr, "layouts = NULL\n");
|
||||
if (config->variants) {
|
||||
gint i;
|
||||
|
||||
fprintf (stderr, "variant = ");
|
||||
for (i = 0; config->variants[i]; i++)
|
||||
fprintf (stderr, "\"%s\" ", config->variants[i]);
|
||||
fputc ('\n', stderr);
|
||||
} else
|
||||
fprintf (stderr, "variants = NULL\n");
|
||||
if (config->options) {
|
||||
gint i;
|
||||
|
||||
fprintf (stderr, "option = ");
|
||||
for (i = 0; config->options[i]; i++)
|
||||
fprintf (stderr, "\"%s\" ", config->options[i]);
|
||||
fputc ('\n', stderr);
|
||||
} else
|
||||
fprintf (stderr, "options = NULL\n");
|
||||
#endif
|
||||
|
||||
/* Disabled since the current EekXklLayout implementation does not
|
||||
change the server setting. */
|
||||
#if 0
|
||||
xkl_config_rec_activate (priv->engine, config);
|
||||
#endif
|
||||
if (xkl_xkb_config_native_prepare (priv->engine, config, &names)) {
|
||||
success = eek_xkb_layout_set_names (EEK_XKB_LAYOUT(layout), &names);
|
||||
xkl_xkb_config_native_cleanup (priv->engine, &names);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
/**
|
||||
* eek_xkl_layout_get_option:
|
||||
* @layout: an #EekXklLayout
|
||||
* @option: option name
|
||||
*
|
||||
* Tell if the option of @layout (in the Libxklavier terminology) is set.
|
||||
* Returns: %TRUE if the option is set, %FALSE otherwise
|
||||
*/
|
||||
gboolean
|
||||
eek_xkl_layout_get_option (EekXklLayout *layout,
|
||||
const gchar *option)
|
||||
{
|
||||
gchar **options;
|
||||
gint i;
|
||||
|
||||
options = eek_xkl_layout_get_options (layout);
|
||||
for (i = 0; options && options[i]; i++)
|
||||
if (g_strcmp0 (options[i], option) == 0)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -1,84 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_XKL_LAYOUT_H
|
||||
#define EEK_XKL_LAYOUT_H 1
|
||||
|
||||
#include "eek-xkb-layout.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define EEK_TYPE_XKL_LAYOUT (eek_xkl_layout_get_type())
|
||||
#define EEK_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayout))
|
||||
#define EEK_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
|
||||
#define EEK_IS_XKL_LAYOUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EEK_TYPE_XKL_LAYOUT))
|
||||
#define EEK_IS_XKL_LAYOUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EEK_TYPE_XKL_LAYOUT))
|
||||
#define EEK_XKL_LAYOUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EEK_TYPE_XKL_LAYOUT, EekXklLayoutClass))
|
||||
|
||||
typedef struct _EekXklLayout EekXklLayout;
|
||||
typedef struct _EekXklLayoutClass EekXklLayoutClass;
|
||||
typedef struct _EekXklLayoutPrivate EekXklLayoutPrivate;
|
||||
|
||||
struct _EekXklLayout
|
||||
{
|
||||
/*< private >*/
|
||||
EekXkbLayout parent;
|
||||
|
||||
EekXklLayoutPrivate *priv;
|
||||
};
|
||||
|
||||
struct _EekXklLayoutClass
|
||||
{
|
||||
/*< private >*/
|
||||
EekXkbLayoutClass parent_class;
|
||||
|
||||
/*< private >*/
|
||||
/* padding */
|
||||
gpointer pdummy[24];
|
||||
};
|
||||
|
||||
GType eek_xkl_layout_get_type (void) G_GNUC_CONST;
|
||||
|
||||
EekLayout *eek_xkl_layout_new (void);
|
||||
|
||||
gboolean eek_xkl_layout_set_config (EekXklLayout *layout,
|
||||
XklConfigRec *config);
|
||||
|
||||
gboolean eek_xkl_layout_set_model (EekXklLayout *layout,
|
||||
const gchar *model);
|
||||
gboolean eek_xkl_layout_set_layouts (EekXklLayout *layout,
|
||||
gchar **layouts);
|
||||
gboolean eek_xkl_layout_set_variants (EekXklLayout *layout,
|
||||
gchar **variants);
|
||||
gboolean eek_xkl_layout_set_options (EekXklLayout *layout,
|
||||
gchar **options);
|
||||
gboolean eek_xkl_layout_enable_option (EekXklLayout *layout,
|
||||
const gchar *option);
|
||||
gboolean eek_xkl_layout_disable_option (EekXklLayout *layout,
|
||||
const gchar *option);
|
||||
|
||||
gchar *eek_xkl_layout_get_model (EekXklLayout *layout);
|
||||
gchar **eek_xkl_layout_get_layouts (EekXklLayout *layout);
|
||||
gchar **eek_xkl_layout_get_variants (EekXklLayout *layout);
|
||||
gchar **eek_xkl_layout_get_options (EekXklLayout *layout);
|
||||
gboolean eek_xkl_layout_get_option (EekXklLayout *layout,
|
||||
const gchar *option);
|
||||
|
||||
G_END_DECLS
|
||||
#endif /* #ifndef EEK_XKL_LAYOUT_H */
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2010 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public License
|
||||
* as published by the Free Software Foundation; either version 2 of
|
||||
* the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
* 02110-1301 USA
|
||||
*/
|
||||
#ifndef EEK_XKL_H
|
||||
#define EEK_XKL_H 1
|
||||
|
||||
#include "eek.h"
|
||||
#include "eek-xkl-layout.h"
|
||||
|
||||
#endif /* EEK_XKL_H */
|
||||
40
eek/eek-xml-layout.c
Normal file
40
eek/eek-xml-layout.c
Normal file
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (C) 2011 Daiki Ueno <ueno@unixuser.org>
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:eek-xml-layout
|
||||
* @short_description: Layout engine which loads layout information from XML
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "eek-keyboard.h"
|
||||
#include "src/keyboard.h"
|
||||
#include "src/layout.h"
|
||||
|
||||
#include "eek-xml-layout.h"
|
||||
|
||||
LevelKeyboard *
|
||||
eek_xml_layout_real_create_keyboard (const char *keyboard_type,
|
||||
EekboardContextService *manager,
|
||||
enum squeek_arrangement_kind t)
|
||||
{
|
||||
struct squeek_layout *layout = squeek_load_layout(keyboard_type, t);
|
||||
squeek_layout_place_contents(layout);
|
||||
return level_keyboard_new(manager, layout);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user