Compare commits
739 Commits
gtk3-ci
...
wip/carlos
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
208e292df1 | ||
|
|
548e5138fc | ||
|
|
6b8d95d9c4 | ||
|
|
faec8d29b0 | ||
|
|
4b88a769d2 | ||
|
|
6704e986a0 | ||
|
|
d55b44df50 | ||
|
|
6496cd7c55 | ||
|
|
6f3ce4de24 | ||
|
|
034aff4306 | ||
|
|
af5f93377a | ||
|
|
abd858fb69 | ||
|
|
09e02a772e | ||
|
|
c850aa9733 | ||
|
|
5a1c7e4a54 | ||
|
|
e324f0fad0 | ||
|
|
5978531963 | ||
|
|
bc111bf958 | ||
|
|
074d78bd9b | ||
|
|
2e604709df | ||
|
|
6c265c131f | ||
|
|
06adde5c6b | ||
|
|
a2616d83e8 | ||
|
|
92bc79fd51 | ||
|
|
ef67fab737 | ||
|
|
9acb7f0eed | ||
|
|
c678cdab5a | ||
|
|
91f6b3b5bc | ||
|
|
696915a951 | ||
|
|
2e07c55241 | ||
|
|
0f0848191e | ||
|
|
4b0d3f44e1 | ||
|
|
4f794d3acb | ||
|
|
3252ef5dd7 | ||
|
|
0c9bbbe90e | ||
|
|
bb62d9e4b0 | ||
|
|
579220a762 | ||
|
|
575a4ca281 | ||
|
|
4b7f2905d6 | ||
|
|
c7758046eb | ||
|
|
e64112de64 | ||
|
|
05f385c8ee | ||
|
|
8a2b529ca3 | ||
|
|
0c92417178 | ||
|
|
543d232b51 | ||
|
|
4398d63566 | ||
|
|
dc022a67b0 | ||
|
|
60fa895ae3 | ||
|
|
7bb3fe25aa | ||
|
|
6c5bba94fd | ||
|
|
667b2726f5 | ||
|
|
1d3588ba48 | ||
|
|
16317cec12 | ||
|
|
f3991c0164 | ||
|
|
b07d9c5f92 | ||
|
|
be51a8c18c | ||
|
|
11c86f9cb3 | ||
|
|
87c0821a30 | ||
|
|
03f2bade19 | ||
|
|
a3825f2085 | ||
|
|
8b2a89041a | ||
|
|
52da5fe4f2 | ||
|
|
307be1e495 | ||
|
|
9b3ca86b7c | ||
|
|
da55f15156 | ||
|
|
b13fe4895f | ||
|
|
aae4a6065c | ||
|
|
1555ecad11 | ||
|
|
292b4dd605 | ||
|
|
4766e2f858 | ||
|
|
e3fe8c3dd1 | ||
|
|
d3e1ce7dbc | ||
|
|
63ad2c958d | ||
|
|
849cc3d7f5 | ||
|
|
8d8c933eb4 | ||
|
|
2363f4c30b | ||
|
|
5d45722362 | ||
|
|
cef6520836 | ||
|
|
0fbbeb0c82 | ||
|
|
b97519bb6e | ||
|
|
60b3f628a6 | ||
|
|
37deba9557 | ||
|
|
89cefd037f | ||
|
|
c9efadacd1 | ||
|
|
df724f5c75 | ||
|
|
44bb21c7aa | ||
|
|
73e705a49b | ||
|
|
2316dfe394 | ||
|
|
9597b5a703 | ||
|
|
0be0a14225 | ||
|
|
7fafec21b6 | ||
|
|
88f03d3a26 | ||
|
|
edc399e5cf | ||
|
|
908a331fa8 | ||
|
|
3083e98254 | ||
|
|
7dc1a28c8c | ||
|
|
3ce5b34ade | ||
|
|
5677fbb64d | ||
|
|
e7f29e764f | ||
|
|
5563bfe7d9 | ||
|
|
cd00e69ce3 | ||
|
|
fe1d297680 | ||
|
|
67a31633d8 | ||
|
|
3d54f973ce | ||
|
|
678e1fcd47 | ||
|
|
e848414f89 | ||
|
|
961a1376cd | ||
|
|
72a389ef12 | ||
|
|
3566fa7bb0 | ||
|
|
c2a155f767 | ||
|
|
0d95f4d854 | ||
|
|
21e2f41a26 | ||
|
|
06d5973851 | ||
|
|
ebfa94f360 | ||
|
|
5279e9a922 | ||
|
|
3958a019bb | ||
|
|
7e97268592 | ||
|
|
d857edf09c | ||
|
|
787bc3d993 | ||
|
|
28cb025190 | ||
|
|
c7429e8aad | ||
|
|
e0562f192f | ||
|
|
9581e9e31b | ||
|
|
090c72b3c3 | ||
|
|
06c4841e22 | ||
|
|
c6fc3a8953 | ||
|
|
07e964e9fc | ||
|
|
9bcb03ab48 | ||
|
|
fb0f03640a | ||
|
|
a13c307fa4 | ||
|
|
adf513c7fc | ||
|
|
623d562933 | ||
|
|
c8f30be91d | ||
|
|
7c2c3e7880 | ||
|
|
2611ee14b5 | ||
|
|
a54a01d1e2 | ||
|
|
d3f629bfa8 | ||
|
|
8e673d5798 | ||
|
|
115de303b0 | ||
|
|
2d6040e2a3 | ||
|
|
5a8e4da2a8 | ||
|
|
d6b5f89a1c | ||
|
|
6777a547ca | ||
|
|
b191f89305 | ||
|
|
2fc8841416 | ||
|
|
598f536c51 | ||
|
|
fc778e2bd3 | ||
|
|
2d010c9b84 | ||
|
|
a10f35c613 | ||
|
|
5f5ef704fc | ||
|
|
3d19b8f49c | ||
|
|
a80b0f34e3 | ||
|
|
1743887fa7 | ||
|
|
b4a8247191 | ||
|
|
eeee7bed1d | ||
|
|
b24b95db15 | ||
|
|
e1f25b7244 | ||
|
|
b319add04b | ||
|
|
3abbfef66e | ||
|
|
fcf7c4d0c7 | ||
|
|
d8be2a8b85 | ||
|
|
f5958fa473 | ||
|
|
c23b675daf | ||
|
|
59a2fc4f5a | ||
|
|
4a125e73a2 | ||
|
|
2de69cd3cc | ||
|
|
305fcd0713 | ||
|
|
7564c2f2e4 | ||
|
|
769997b0bc | ||
|
|
5ea0034943 | ||
|
|
4c513e3e19 | ||
|
|
f3ad63e206 | ||
|
|
593e610415 | ||
|
|
f894f5cc13 | ||
|
|
17417a82a5 | ||
|
|
5ed97f3a02 | ||
|
|
34579d71cc | ||
|
|
153357cd36 | ||
|
|
14cd78a016 | ||
|
|
109fbdbac9 | ||
|
|
2c08eb6d16 | ||
|
|
ca64a308eb | ||
|
|
d0ee02fae7 | ||
|
|
c7d14244b1 | ||
|
|
e1c4e55880 | ||
|
|
7b79fcee45 | ||
|
|
ac6990ef51 | ||
|
|
0aa4bab539 | ||
|
|
224db78409 | ||
|
|
7658e07beb | ||
|
|
1faba58ccc | ||
|
|
775ec67a44 | ||
|
|
d67ba3ea65 | ||
|
|
50634d450e | ||
|
|
9bab8e8751 | ||
|
|
7adc24d3a6 | ||
|
|
047da80c3b | ||
|
|
882967d3ce | ||
|
|
cea0722e72 | ||
|
|
03823128c4 | ||
|
|
7b35ed8c35 | ||
|
|
ecaaccb064 | ||
|
|
30d9d1968c | ||
|
|
65aa476414 | ||
|
|
03d177cf64 | ||
|
|
dfa235aa5d | ||
|
|
d722e59aac | ||
|
|
32dbcd9352 | ||
|
|
3a474556b8 | ||
|
|
249274c677 | ||
|
|
ae83a61e67 | ||
|
|
826573ccce | ||
|
|
dbff32ec5c | ||
|
|
2f1f47d257 | ||
|
|
06781985e4 | ||
|
|
5b0a7b3a33 | ||
|
|
1ecdaa646f | ||
|
|
2f4d50c723 | ||
|
|
4b8bb4608c | ||
|
|
aa34f6ad7c | ||
|
|
f9be670522 | ||
|
|
d77bcb9028 | ||
|
|
d29c8e290c | ||
|
|
e12ce70385 | ||
|
|
442f34b4de | ||
|
|
20becd782f | ||
|
|
feb8bfa0bf | ||
|
|
59a38fcb69 | ||
|
|
190e285c23 | ||
|
|
a9a9a0d1c5 | ||
|
|
57a2f7b4a3 | ||
|
|
1f895719b3 | ||
|
|
37326e4a32 | ||
|
|
8cff3b84f7 | ||
|
|
578c30792a | ||
|
|
9daec23033 | ||
|
|
5f729ea437 | ||
|
|
ae7cc0417f | ||
|
|
468bf81307 | ||
|
|
551101c65c | ||
|
|
110ed7ff8a | ||
|
|
2afe3e9223 | ||
|
|
de99dd7eb6 | ||
|
|
34be97d855 | ||
|
|
1de436684c | ||
|
|
847e89d31f | ||
|
|
f9eb140e62 | ||
|
|
3aff755048 | ||
|
|
2e358f3c43 | ||
|
|
c00a8e98a3 | ||
|
|
2a6e8bda8d | ||
|
|
31a3b1b4c5 | ||
|
|
ff65c95aee | ||
|
|
f086eafe57 | ||
|
|
bb73038a27 | ||
|
|
2b95ec40c6 | ||
|
|
203c20d7ad | ||
|
|
ff5f77f273 | ||
|
|
fc0b8f9d9c | ||
|
|
1e284c601c | ||
|
|
5e7ce7ea75 | ||
|
|
69d0ff4567 | ||
|
|
3944daf3c0 | ||
|
|
b45cea301e | ||
|
|
14dfe929f2 | ||
|
|
b9a52ecfdf | ||
|
|
feb444402e | ||
|
|
9ed463b488 | ||
|
|
33450700dc | ||
|
|
62f251574f | ||
|
|
59eebd6f6d | ||
|
|
ca82cde6dd | ||
|
|
9b054f4a1b | ||
|
|
f31a7acab5 | ||
|
|
a0d87662f7 | ||
|
|
c302f4d379 | ||
|
|
3c4efd13c1 | ||
|
|
9676db4dbf | ||
|
|
a132c8dc8e | ||
|
|
cae5b99537 | ||
|
|
6ffdfff9ee | ||
|
|
b18d4fc346 | ||
|
|
7e27fb6d56 | ||
|
|
8f96885af8 | ||
|
|
51ee41ee43 | ||
|
|
e743b36cfc | ||
|
|
96a108ed4e | ||
|
|
da633dcc52 | ||
|
|
86646679f1 | ||
|
|
df4eeff6f2 | ||
|
|
64304b0b68 | ||
|
|
c5159e3184 | ||
|
|
280429bac8 | ||
|
|
98df2dbd05 | ||
|
|
4a72ac0516 | ||
|
|
802b24a640 | ||
|
|
162aec7802 | ||
|
|
9823a0f6c9 | ||
|
|
b8524504f4 | ||
|
|
c1933cfd09 | ||
|
|
1142f06af5 | ||
|
|
bb4e87bf35 | ||
|
|
37256cb76b | ||
|
|
7f12099ead | ||
|
|
88141f1483 | ||
|
|
7146a6dddb | ||
|
|
dbce29a0ae | ||
|
|
031098a43d | ||
|
|
dc4cb562b7 | ||
|
|
2e086c74e7 | ||
|
|
e884ba7f39 | ||
|
|
2802d359e5 | ||
|
|
d54b10b366 | ||
|
|
d4993c4b22 | ||
|
|
ae49f89cf3 | ||
|
|
ce3e293a18 | ||
|
|
8d83dec044 | ||
|
|
d4953c77c3 | ||
|
|
237f277641 | ||
|
|
59e454f01e | ||
|
|
0b4cf9c65f | ||
|
|
82b710688b | ||
|
|
387a13f0ab | ||
|
|
e5542c3210 | ||
|
|
d85c3c1e94 | ||
|
|
d830d985c1 | ||
|
|
4c0aa2afca | ||
|
|
d6af59612c | ||
|
|
be59b514ca | ||
|
|
2e5b767c01 | ||
|
|
f511f94aa2 | ||
|
|
3187fe8ebc | ||
|
|
f5c8e0d96d | ||
|
|
c3d1320343 | ||
|
|
5c5dcd58b5 | ||
|
|
6ea0f8facc | ||
|
|
0c1e5b4ee5 | ||
|
|
ad50d2cfc4 | ||
|
|
1398c6dfa4 | ||
|
|
ab9f241cc5 | ||
|
|
1f5d6a01f5 | ||
|
|
ca79073014 | ||
|
|
0b6f5c6f55 | ||
|
|
e2c2a332e6 | ||
|
|
245977e525 | ||
|
|
e03c75bac7 | ||
|
|
4ff58cc63f | ||
|
|
462df7e61a | ||
|
|
1285619bcf | ||
|
|
d6f5ac5603 | ||
|
|
d133f94f8f | ||
|
|
e216d9c6ad | ||
|
|
79050004b0 | ||
|
|
e5ea8f5483 | ||
|
|
0ab1a9fa44 | ||
|
|
cb0cc42651 | ||
|
|
b36cfb5bdc | ||
|
|
7539de2320 | ||
|
|
8de91f1053 | ||
|
|
45c14f74b4 | ||
|
|
d4457d1f7f | ||
|
|
0ba15df57c | ||
|
|
e09ac67698 | ||
|
|
e6a93326bf | ||
|
|
fb474fb612 | ||
|
|
d12dc993d1 | ||
|
|
6414b8c45f | ||
|
|
19b467aa01 | ||
|
|
e089e53b24 | ||
|
|
bad1a7fd0c | ||
|
|
51a8193c16 | ||
|
|
94fb82137f | ||
|
|
49408e8f9f | ||
|
|
77d359cdc3 | ||
|
|
590b9b8c86 | ||
|
|
09078762ac | ||
|
|
352c2ec7b8 | ||
|
|
4b37c2e446 | ||
|
|
980ece9a4b | ||
|
|
1ce9e379d9 | ||
|
|
4a4f2d8264 | ||
|
|
4920b5064d | ||
|
|
26ddb07066 | ||
|
|
574b49ed95 | ||
|
|
6697b0d069 | ||
|
|
092c5304a9 | ||
|
|
c3fc6025b1 | ||
|
|
1406348be4 | ||
|
|
46e3d20057 | ||
|
|
9bcf1d0238 | ||
|
|
b69111d8e6 | ||
|
|
f71316c850 | ||
|
|
9186b6d6b0 | ||
|
|
55719afcbf | ||
|
|
e063947a16 | ||
|
|
a42eed0231 | ||
|
|
f4fd92d8e8 | ||
|
|
2ebd43cba9 | ||
|
|
2724f36527 | ||
|
|
569a183828 | ||
|
|
620dcf3364 | ||
|
|
eb9cd3857d | ||
|
|
0bfb995bff | ||
|
|
932340a989 | ||
|
|
ca0156e9a7 | ||
|
|
6d75b4fc53 | ||
|
|
6bd382ad23 | ||
|
|
a1b3d1a2a7 | ||
|
|
53f61f3778 | ||
|
|
74c0d9140c | ||
|
|
268336c21a | ||
|
|
49e983b06e | ||
|
|
0f97196d84 | ||
|
|
18c792d6f8 | ||
|
|
675a97d58e | ||
|
|
8127494e52 | ||
|
|
670f4f22fe | ||
|
|
e27d2702a8 | ||
|
|
dfe33897db | ||
|
|
90c20b185b | ||
|
|
4d7c8d68bc | ||
|
|
455de5d6d3 | ||
|
|
99c9f4c1fa | ||
|
|
dd32ff018a | ||
|
|
019643bad0 | ||
|
|
a031ac067e | ||
|
|
f712387325 | ||
|
|
1eaf9e5f63 | ||
|
|
7222bdde57 | ||
|
|
007d27fa40 | ||
|
|
01609de587 | ||
|
|
83ee122fad | ||
|
|
55302dbb38 | ||
|
|
7876018755 | ||
|
|
e3c332fa10 | ||
|
|
faa831f2f6 | ||
|
|
1a915f06cf | ||
|
|
6754195580 | ||
|
|
25f9406e69 | ||
|
|
9fc428f2e7 | ||
|
|
a05dd813da | ||
|
|
08b30d6fe2 | ||
|
|
84f55d38dd | ||
|
|
75b5e079cf | ||
|
|
d742f9331c | ||
|
|
420ca31f0b | ||
|
|
73da901cd3 | ||
|
|
dd16fac0c7 | ||
|
|
1b2af2891f | ||
|
|
050c21c24f | ||
|
|
7b45de941b | ||
|
|
8d84449941 | ||
|
|
f61d4b4e70 | ||
|
|
dcb42d3b25 | ||
|
|
59a2bff8e2 | ||
|
|
720360b07a | ||
|
|
9b39e37fee | ||
|
|
38104755a2 | ||
|
|
7abf0f1e2d | ||
|
|
0a37c32a72 | ||
|
|
9f121a211d | ||
|
|
c823b5ddba | ||
|
|
97175f8fa1 | ||
|
|
c5b1bdc0fe | ||
|
|
f8e2234ce5 | ||
|
|
38bbd9593b | ||
|
|
a3cc62c285 | ||
|
|
c3bf10d19a | ||
|
|
0b6a3166ed | ||
|
|
066bc5986d | ||
|
|
e8b09df8d2 | ||
|
|
1571f8078a | ||
|
|
510cbef15a | ||
|
|
99c9a14bc8 | ||
|
|
b8003807b0 | ||
|
|
8e1bd64e05 | ||
|
|
5aa56aa7f5 | ||
|
|
c2c4f74923 | ||
|
|
f8daa6bc70 | ||
|
|
5b07ccd0a7 | ||
|
|
ae4d299499 | ||
|
|
8798325489 | ||
|
|
9e34028742 | ||
|
|
258f859e8d | ||
|
|
9d3e4fd402 | ||
|
|
03c65b93e6 | ||
|
|
db975bd2a8 | ||
|
|
4e27a4ea1d | ||
|
|
346cadeddb | ||
|
|
f60c485117 | ||
|
|
19550c28f9 | ||
|
|
c4949b553d | ||
|
|
675a2d13b9 | ||
|
|
f4d9953b9c | ||
|
|
6db94a0b77 | ||
|
|
9bf6faf639 | ||
|
|
4434a17d08 | ||
|
|
c65f63b647 | ||
|
|
79d981aac9 | ||
|
|
2791f5b466 | ||
|
|
e68bb27df2 | ||
|
|
e12b2c417e | ||
|
|
0fbda366e8 | ||
|
|
106d332c71 | ||
|
|
c42c11583d | ||
|
|
8c131b32b1 | ||
|
|
c8e12ead08 | ||
|
|
8a541c08fb | ||
|
|
dfed5f6a11 | ||
|
|
96dd794fd1 | ||
|
|
73a436362a | ||
|
|
7343b8d817 | ||
|
|
dbf47b652e | ||
|
|
b97a6e62a3 | ||
|
|
4fac1a4862 | ||
|
|
70ba844c3c | ||
|
|
bc0b9f7628 | ||
|
|
c971d6ea1f | ||
|
|
dac09a8e23 | ||
|
|
11f224f4b0 | ||
|
|
a1be7cdbd7 | ||
|
|
82d96aebe1 | ||
|
|
c14ba5937f | ||
|
|
e50e14af82 | ||
|
|
787d9a5a15 | ||
|
|
3c29bf7491 | ||
|
|
dc8e5c7f8b | ||
|
|
0a986fc885 | ||
|
|
04e983383f | ||
|
|
7ae6e0101c | ||
|
|
affb3de829 | ||
|
|
24d7a7ad0b | ||
|
|
4729cb779e | ||
|
|
c8837a8de5 | ||
|
|
283cccbe9f | ||
|
|
a7bf6322e3 | ||
|
|
1d5f9b6917 | ||
|
|
3c068ef135 | ||
|
|
2becb3dd29 | ||
|
|
55f5177fe0 | ||
|
|
037b68ab8e | ||
|
|
b45d5ef3f5 | ||
|
|
7e4e371466 | ||
|
|
fbfa136bbb | ||
|
|
434845dbe5 | ||
|
|
967511be61 | ||
|
|
43c7a82461 | ||
|
|
066e78c9b3 | ||
|
|
08f47fee16 | ||
|
|
afe4cd482e | ||
|
|
3fed768db4 | ||
|
|
8c52b431bb | ||
|
|
d9ffbf0576 | ||
|
|
b0953b92ba | ||
|
|
819f9afa31 | ||
|
|
7a0bc5af7f | ||
|
|
c5fbab6bad | ||
|
|
f4301b77fa | ||
|
|
a3f27dfd89 | ||
|
|
73ce9c2e81 | ||
|
|
fd27c7c444 | ||
|
|
a51807fc1e | ||
|
|
3c35a78769 | ||
|
|
ae7cb7a3bf | ||
|
|
531b0ab300 | ||
|
|
7cc604b9e5 | ||
|
|
f3a65c9b32 | ||
|
|
dec97a6541 | ||
|
|
cfa2d1abf7 | ||
|
|
d9fb6b5ca2 | ||
|
|
696b534570 | ||
|
|
38db4a5a65 | ||
|
|
6f62c5b575 | ||
|
|
d823a54b5d | ||
|
|
e06daa58c3 | ||
|
|
1880e22229 | ||
|
|
bd28581471 | ||
|
|
82470cd40d | ||
|
|
b4972f573c | ||
|
|
c97c409c50 | ||
|
|
989e2ccc46 | ||
|
|
e09e62d585 | ||
|
|
033f0d11bf | ||
|
|
668eb318c7 | ||
|
|
449cbe153b | ||
|
|
9b8e5a05f5 | ||
|
|
d14c8cf9a4 | ||
|
|
4571de5772 | ||
|
|
62f449d7d5 | ||
|
|
476ef76de6 | ||
|
|
48de81b63e | ||
|
|
2ee3d5392b | ||
|
|
0f2a33cc9c | ||
|
|
2ce622f057 | ||
|
|
76083d76af | ||
|
|
132060db21 | ||
|
|
c7f2ae1b16 | ||
|
|
24a0e72ae9 | ||
|
|
5c4938e479 | ||
|
|
322b51cded | ||
|
|
b46bc98d44 | ||
|
|
da5be1fdea | ||
|
|
bc18438cb0 | ||
|
|
e3c0fcf7d5 | ||
|
|
73cb96ddb9 | ||
|
|
1cb59f44ab | ||
|
|
a55a286b15 | ||
|
|
18e7b814f2 | ||
|
|
e073076119 | ||
|
|
5d58156134 | ||
|
|
c38fa4fa5c | ||
|
|
5201d77b0b | ||
|
|
aedf692e0c | ||
|
|
5dfd86ebe7 | ||
|
|
9e41f687a0 | ||
|
|
61356caa06 | ||
|
|
4300f1f91d | ||
|
|
d26dc4ae44 | ||
|
|
bd45a00fa3 | ||
|
|
793a9d45e1 | ||
|
|
43295bdcc4 | ||
|
|
43e12dab7b | ||
|
|
c4535fdf85 | ||
|
|
d2c3272eb7 | ||
|
|
90c4b6492f | ||
|
|
b7bf42e778 | ||
|
|
e849667be6 | ||
|
|
424016d66c | ||
|
|
a4f55d4986 | ||
|
|
1b33a5a3a7 | ||
|
|
36111270aa | ||
|
|
6e0cfd3e55 | ||
|
|
5671f0a284 | ||
|
|
a7e63bea6c | ||
|
|
94b3c334e5 | ||
|
|
efb0addb62 | ||
|
|
988da215c8 | ||
|
|
551a57ed7f | ||
|
|
b7366b5b53 | ||
|
|
5e8d8b9ade | ||
|
|
4726f3d5d3 | ||
|
|
91ef7515de | ||
|
|
317f6c0910 | ||
|
|
6a3d521466 | ||
|
|
1363246d44 | ||
|
|
0b6560fac4 | ||
|
|
d4c3870286 | ||
|
|
4bdf9a1e70 | ||
|
|
1909977a67 | ||
|
|
655a783891 | ||
|
|
a4596becc4 | ||
|
|
7015bb3efd | ||
|
|
d2c762cc66 | ||
|
|
04d429b743 | ||
|
|
0b21dcfe08 | ||
|
|
7c939d78c2 | ||
|
|
8a2b82897d | ||
|
|
e95c365cf0 | ||
|
|
a32cb7133b | ||
|
|
967966cdee | ||
|
|
06d67b6abf | ||
|
|
f15ce01e2b | ||
|
|
e48516679c | ||
|
|
65a6c4c361 | ||
|
|
b51c468c0f | ||
|
|
2e7d02f1ce | ||
|
|
dc4fe780f7 | ||
|
|
d682cdb078 | ||
|
|
ff7a42b8bc | ||
|
|
4b1805c306 | ||
|
|
03c00e4944 | ||
|
|
cb05b16414 | ||
|
|
b9fe9c736a | ||
|
|
3dd8861fbf | ||
|
|
753066598f | ||
|
|
3da8c1bfdc | ||
|
|
f8ee974628 | ||
|
|
f36120757f | ||
|
|
bc178b711f | ||
|
|
5dad87cfb9 | ||
|
|
0f8f607e4c | ||
|
|
282aada13a | ||
|
|
47002bf0cd | ||
|
|
3d47c7edc1 | ||
|
|
bc350f37f5 | ||
|
|
b55e2e1df9 | ||
|
|
43baf643d4 | ||
|
|
21b8ae10b8 | ||
|
|
425a10de11 | ||
|
|
d0ef660ff6 | ||
|
|
506e06589b | ||
|
|
1d75d5aa2f | ||
|
|
645d596f9d | ||
|
|
3e967d731a | ||
|
|
167fd07e01 | ||
|
|
fbd6366edd | ||
|
|
23d0bdd46d | ||
|
|
0d0834f87c | ||
|
|
676997e0af | ||
|
|
633d5d1b84 | ||
|
|
f620f43353 | ||
|
|
eb6e1f694a | ||
|
|
6aead84d7a | ||
|
|
5b984c1e53 | ||
|
|
7660ca2579 | ||
|
|
ac52631e8a | ||
|
|
5b30a52bbd | ||
|
|
a5294ce55f | ||
|
|
553372ffb7 | ||
|
|
f672d6ee3b | ||
|
|
ba3417667f | ||
|
|
50fa002a19 | ||
|
|
f0718c7d95 | ||
|
|
e74c2e42cf | ||
|
|
ce64ab5449 | ||
|
|
8df3b21a51 | ||
|
|
08431a127a | ||
|
|
3f068d1138 | ||
|
|
6f0e5b0b56 | ||
|
|
fe27a6ea3b | ||
|
|
1301770dcb | ||
|
|
1551b6d386 | ||
|
|
a6f94696e2 | ||
|
|
c389aadff9 | ||
|
|
37eda498f2 | ||
|
|
7d2df52336 | ||
|
|
5d27e5415d | ||
|
|
625773fba4 | ||
|
|
7d79ae7b07 | ||
|
|
5817779656 | ||
|
|
5f5ce08ba4 | ||
|
|
223f033780 | ||
|
|
50e0ae3cf3 | ||
|
|
a8f6cada88 | ||
|
|
7f488e3e1d | ||
|
|
059d2144b2 | ||
|
|
902302a174 | ||
|
|
f98ca7683c | ||
|
|
479fb0549c |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -103,3 +103,4 @@ doc/reference/meta.types
|
|||||||
.dirstamp
|
.dirstamp
|
||||||
**/tags.*
|
**/tags.*
|
||||||
build/
|
build/
|
||||||
|
subprojects/sysprof/
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
image: registry.gitlab.gnome.org/gnome/mutter/master:v3
|
image: registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- review
|
- review
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
|
- coverage
|
||||||
|
|
||||||
check-commit-log:
|
check-commit-log:
|
||||||
stage: review
|
stage: review
|
||||||
@@ -16,8 +17,9 @@ check-commit-log:
|
|||||||
|
|
||||||
build-mutter:
|
build-mutter:
|
||||||
stage: build
|
stage: build
|
||||||
|
needs: []
|
||||||
script:
|
script:
|
||||||
- meson . build -Dbuildtype=debugoptimized -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
- meson . build -Dbuildtype=debugoptimized -Db_coverage=true -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||||
- ninja -C build
|
- ninja -C build
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
artifacts:
|
artifacts:
|
||||||
@@ -30,28 +32,28 @@ build-mutter:
|
|||||||
|
|
||||||
build-without-opengl-and-glx:
|
build-without-opengl-and-glx:
|
||||||
stage: build
|
stage: build
|
||||||
|
needs: []
|
||||||
script:
|
script:
|
||||||
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
- meson . build -Dbuildtype=debugoptimized -Dopengl=false -Dglx=false -Degl_device=true -Dwayland_eglstream=true --werror --prefix /usr
|
||||||
- ninja -C build
|
- ninja -C build
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 day
|
|
||||||
paths:
|
paths:
|
||||||
- build
|
- build/meson-logs
|
||||||
only:
|
only:
|
||||||
- merge_requests
|
- merge_requests
|
||||||
- /^.*$/
|
- /^.*$/
|
||||||
|
|
||||||
build-without-native-backend-and-wayland:
|
build-without-native-backend-and-wayland:
|
||||||
stage: build
|
stage: build
|
||||||
|
needs: []
|
||||||
script:
|
script:
|
||||||
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
|
- meson . build -Dbuildtype=debugoptimized -Dnative_backend=false -Dudev=false -Dwayland=false -Dcore_tests=false --werror --prefix /usr
|
||||||
- ninja -C build
|
- ninja -C build
|
||||||
- ninja -C build install
|
- ninja -C build install
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 day
|
|
||||||
paths:
|
paths:
|
||||||
- build
|
- build/meson-logs
|
||||||
only:
|
only:
|
||||||
- merge_requests
|
- merge_requests
|
||||||
- /^.*$/
|
- /^.*$/
|
||||||
@@ -60,13 +62,13 @@ test-mutter:
|
|||||||
stage: test
|
stage: test
|
||||||
dependencies:
|
dependencies:
|
||||||
- build-mutter
|
- build-mutter
|
||||||
|
needs: ["build-mutter"]
|
||||||
variables:
|
variables:
|
||||||
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
|
XDG_RUNTIME_DIR: "$CI_PROJECT_DIR/runtime-dir"
|
||||||
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
|
GSETTINGS_SCHEMA_DIR: "$CI_PROJECT_DIR/build/data"
|
||||||
G_SLICE: "always-malloc"
|
G_SLICE: "always-malloc"
|
||||||
MALLOC_CHECK_: "3"
|
MALLOC_CHECK_: "3"
|
||||||
NO_AT_BRIDGE: "1"
|
NO_AT_BRIDGE: "1"
|
||||||
MALLOC_PERTURB_: "123"
|
|
||||||
script:
|
script:
|
||||||
- dconf update
|
- dconf update
|
||||||
- mkdir -m 700 $XDG_RUNTIME_DIR
|
- mkdir -m 700 $XDG_RUNTIME_DIR
|
||||||
@@ -74,14 +76,36 @@ test-mutter:
|
|||||||
- >
|
- >
|
||||||
dbus-run-session -- xvfb-run -s '+iglx -noreset'
|
dbus-run-session -- xvfb-run -s '+iglx -noreset'
|
||||||
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
|
meson test -C build --no-rebuild -t 10 --verbose --no-stdsplit --print-errorlogs --wrap catchsegv
|
||||||
|
artifacts:
|
||||||
|
expire_in: 1 day
|
||||||
|
paths:
|
||||||
|
- build
|
||||||
only:
|
only:
|
||||||
- merge_requests
|
- merge_requests
|
||||||
- /^.*$/
|
- /^.*$/
|
||||||
|
|
||||||
|
test-mutter-coverage:
|
||||||
|
stage: coverage
|
||||||
|
dependencies:
|
||||||
|
- test-mutter
|
||||||
|
needs: ["test-mutter"]
|
||||||
|
script:
|
||||||
|
- ninja -C build coverage
|
||||||
|
- cat build/meson-logs/coverage.txt
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- build/meson-logs
|
||||||
|
when: manual
|
||||||
|
except:
|
||||||
|
refs:
|
||||||
|
- tags
|
||||||
|
- master
|
||||||
|
|
||||||
can-build-gnome-shell:
|
can-build-gnome-shell:
|
||||||
stage: test
|
stage: test
|
||||||
dependencies:
|
dependencies:
|
||||||
- build-mutter
|
- build-mutter
|
||||||
|
needs: ["build-mutter"]
|
||||||
before_script:
|
before_script:
|
||||||
- meson install --no-rebuild -C build
|
- meson install --no-rebuild -C build
|
||||||
script:
|
script:
|
||||||
|
|||||||
@@ -1,32 +1,28 @@
|
|||||||
# Rebuild and push with
|
# Rebuild and push with
|
||||||
#
|
#
|
||||||
# cd .gitlab-ci/
|
# cd .gitlab-ci/
|
||||||
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v3 .
|
# podman build --format docker --no-cache -t registry.gitlab.gnome.org/gnome/mutter/master:v4 .
|
||||||
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v3
|
# podman push registry.gitlab.gnome.org/gnome/mutter/master:v4
|
||||||
#
|
#
|
||||||
|
|
||||||
FROM fedora:31
|
FROM fedora:32
|
||||||
|
|
||||||
RUN dnf -y update && dnf -y upgrade && \
|
RUN dnf -y update && dnf -y upgrade && \
|
||||||
dnf install -y 'dnf-command(builddep)' && \
|
dnf install -y 'dnf-command(builddep)' && \
|
||||||
dnf install -y 'dnf-command(copr)' && \
|
dnf install -y 'dnf-command(copr)' && \
|
||||||
dnf copr enable -y fmuellner/gnome-shell-ci && \
|
|
||||||
dnf copr enable -y jadahl/mutter-ci && \
|
dnf copr enable -y jadahl/mutter-ci && \
|
||||||
dnf -y update && dnf -y upgrade && \
|
|
||||||
|
|
||||||
dnf builddep -y mutter && \
|
dnf builddep -y mutter --setopt=install_weak_deps=False && \
|
||||||
|
|
||||||
# Until Fedora catches up with new build-deps
|
|
||||||
dnf install -y 'pkgconfig(graphene-gobject-1.0)' 'pkgconfig(sysprof-capture-3)' && \
|
|
||||||
|
|
||||||
# For running unit tests
|
# For running unit tests
|
||||||
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 '*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center && \
|
dnf install -y xorg-x11-server-Xvfb mesa-dri-drivers dbus dbus-x11 \
|
||||||
|
'*/xvfb-run' gdm-lib accountsservice-libs gnome-control-center gcovr \
|
||||||
|
libnma python3-gobject python3-dbusmock \
|
||||||
|
--setopt=install_weak_deps=False && \
|
||||||
|
|
||||||
# GNOME Shell
|
# GNOME Shell
|
||||||
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
|
dnf builddep -y gnome-shell --setopt=install_weak_deps=False && \
|
||||||
dnf remove -y gnome-bluetooth-libs-devel dbus-glib-devel upower-devel python3-devel && \
|
dnf remove -y gnome-bluetooth-libs-devel && \
|
||||||
dnf remove -y --noautoremove mutter mutter-devel && \
|
dnf remove -y --noautoremove mutter mutter-devel && \
|
||||||
|
|
||||||
dnf upgrade -y 'pkgconfig(libpipewire-0.3)' && \
|
|
||||||
|
|
||||||
dnf clean all
|
dnf clean all
|
||||||
|
|||||||
147
NEWS
147
NEWS
@@ -1,45 +1,116 @@
|
|||||||
3.36.1
|
3.37.90
|
||||||
======
|
=======
|
||||||
* Fix hardware cursor on GPU hotplpug [Pekka; !1097]
|
* Fix using NEAREST filter for backgrounds on scaled monitors [Daniel V.; !1346]
|
||||||
* Fix black areas around XWayland windows when resizing [Robert, Olivier; !1091]
|
* Screencast fixes and improvements [Jonas; !1361, !1377, !1391]
|
||||||
* Fix applying wrong scale to monitors on X11 [Jonas; !1118]
|
* Support tap-button-map and tap-drag-lock touchpad settings [Giusy; !1319]
|
||||||
* Fix moving/resizing windows via keyboard on wayland [Alynx; !997]
|
* Fix wine copy & paste [Sebastian; !1369]
|
||||||
* Fix locate-pointer feature interfering with keybindings [Carlos; !1014]
|
* Fix shadows of server-side decorated XWayland windows [Olivier; #1358]
|
||||||
* Add support for middle-click emulation [Andrew; !256]
|
* Replace some loaded terms with more descriptive ones [Olivier; !1396]
|
||||||
* Fix freeze when moving cursor between scaled monitors [Robert; !1125]
|
* Add API to launch trusted wayland clients [Sergio; #741]
|
||||||
* Fix popup misplacement with focus-follows-mouse [Jonas Å.; !1122]
|
* Skip displays with 'non-desktop' property set [Philipp; !1393]
|
||||||
* Fix misplaced cursor in preedit strings [Carlos; !1132]
|
* Invalidate offscreen effect cache on video memory purge [Daniel V.; !1374]
|
||||||
* Support mirroring with proprietary Nvidia driver [Jonas Å.; !1098]
|
* Add wl_shm support for 10 bpc and 16 bpc half float formats [Jonas; !804]
|
||||||
* Support tablets with multiple mode switch buttons in a group [Carlos; !970]
|
* Fixed crashes [Jonas, Erik, Martin; !1365, !1375, #1343]
|
||||||
* Ignore foreground color for color glyphs (emojis) [Carlos; !1148]
|
* Misc. bug fixes and cleanups [Daniel V., Carlos, Olivier, Christian,
|
||||||
* Allow pad mode switches while showing OSD [Carlos; !975]
|
Daniel * G., Jonas, Florian; !1370, !1376, !1385, !1352, !1386, !1390,
|
||||||
* Fix positioning of OSD for display-attached tablets [Carlos; !971]
|
!1388, !1397, !1398, !1401]
|
||||||
* Respect configured RANDR panning on X11 [Jonas Å.; !1085]
|
|
||||||
* Use correct texture filtering with scaled displays [Jonas; !1124]
|
|
||||||
* Fix cursor hotspots in virtual machines [Jonas Å.; !1136]
|
|
||||||
* Fix build with GLES and no GL [Georges; !1151]
|
|
||||||
* Work around Firefox bug when copying images on wayland [Robert; !1141]
|
|
||||||
* Fix wrong cursor rotation on rotated displays [Hans; !1153]
|
|
||||||
* Fix glitches in window screencasts [Georges; !1129]
|
|
||||||
* Fix IM support for deleting surrounding text [Takao, Carlos; #539]
|
|
||||||
* Fix map animation of maximized windows [Robert; !1164]
|
|
||||||
* Fixed crashes [Jonas Å., Carlos, Florian, Robert; !1120, !1121,
|
|
||||||
#917, #1132, #1083, !1147, #1147]
|
|
||||||
* Misc. bug fixes and cleanups [Jonas Å., Olivier, Mart, Sebastian, Corentin,
|
|
||||||
Andre, Daniel, Robert, Carlos, Peter, Georges, Jonas D., Florian, Christian;
|
|
||||||
!1115, !1102, !1104, !1106, !1117, !1119, !1101, !1123, #1124, !1130, !1131,
|
|
||||||
!1133, #1065, !1108, !1144, !1145, !1109, !1059, !1107, !999, !1152, #1128,
|
|
||||||
!1155, !1156, !1158, !1157, #1146, !1161, !1163]
|
|
||||||
|
|
||||||
Contributors:
|
Contributors:
|
||||||
Jonas Dreßler, Olivier Fourdan, Takao Fujiwara, Carlos Garnacho, Andrew Gaul,
|
Jonas Ådahl, Sergio Costas, Olivier Fourdan, Carlos Garnacho,
|
||||||
Hans de Goede, Peter Hutterer, Sebastian Keller, Robert Mader,
|
Christian Hergert, Sebastian Keller, Erik Kurzinger, Giusy Margarita,
|
||||||
Andre Moreira Magalhaes, Florian Müllner, Georges Basile Stavracas Neto,
|
Daniel García Moreno, Florian Müllner, Daniel van Vugt, Martin Whitaker,
|
||||||
Corentin Noël, Pekka Paalanen, Christian Rauch, Mart Raudsepp,
|
Philipp Zabel
|
||||||
Daniel van Vugt, Alynx Zhou, Jonas Ådahl
|
|
||||||
|
|
||||||
Translators:
|
Translators:
|
||||||
Марко Костић [sr], Daniel Șerbănescu [ro]
|
Fabio Tomat [fur], Rafael Fontenelle [pt_BR], Jordi Mas [ca],
|
||||||
|
Yuri Chornoivan [uk], Alexandre Franke [fr]
|
||||||
|
|
||||||
|
3.37.3
|
||||||
|
======
|
||||||
|
* Support custom keyboard layouts in $XDG_CONFIG_HOME/xkb [Peter; !936]
|
||||||
|
* Optimize resource scale computation [Jonas D.; !1196, !1276, !1343]
|
||||||
|
* Allow animating ClutterActor's content property [Georges; !1301]
|
||||||
|
* Implement backgrounds as ClutterContent [Georges; !1302]
|
||||||
|
* Add ClutterAlignContraint:pivot-point property [Jonas D.; !737]
|
||||||
|
* Fix crash on area screenshots with fractional scaling [Sebastian; !1320]
|
||||||
|
* Do not paint textures of fully obscured windows [Robert; !1326]
|
||||||
|
* Use a more appropriate combine function on opaque areas [Daniel; !1331]
|
||||||
|
* Fix remote desktop being broken without screencast session [Olivier; #1307]
|
||||||
|
* Remove more long-deprecated Clutter APIs [Adam, Georges; !1194, !1332]
|
||||||
|
* Drive each monitor by its own frame clock [Jonas Å.; !1285]
|
||||||
|
* Fix copy/paste failures on X11 [Carlos; !1350]
|
||||||
|
* Mipmap background texture rendering [Daniel; !1347]
|
||||||
|
* Plugged memory leaks [Sebastian, Jonas D.; !1293, !1281, !1304]
|
||||||
|
* Misc. bug fixes and cleanups [Jonas Å., Jonas D., Daniel, Corentin, Carlos,
|
||||||
|
Sebastian, Michel, Robert, Florian; !1288, !1289, !1291, !1296, !1292, !1298,
|
||||||
|
!1300, !1303, !1290, !1287, !1306, !1305, !1308, !1313, !1250, !1314, !1267,
|
||||||
|
!1275, !1317, !1270, !1322, !1181, !1282, !1325, !1323, !1240, !1295, !1329,
|
||||||
|
!1333, !1334, !1336, !1341, #1312, !1345, !1349, !1356, #873, !1310, !1357]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Jonas Dreßler, Michel Dänzer, Olivier Fourdan, Carlos Garnacho,
|
||||||
|
Peter Hutterer, Adam Jackson, Sebastian Keller, Robert Mader, Florian Müllner,
|
||||||
|
Georges Basile Stavracas Neto, Corentin Noël, Daniel van Vugt, Jonas Ådahl
|
||||||
|
|
||||||
|
3.37.2
|
||||||
|
======
|
||||||
|
* Fix move-to-center keybinding with multiple monitors [Sergey; #1073]
|
||||||
|
* Fix stuck buttons when a virtual device is destroyed [Carlos; !1239]
|
||||||
|
* Use workarea when centering new windows [Akatsuki; #964]
|
||||||
|
* Limit mipmap levels when rendering background [Daniel; !1003]
|
||||||
|
* Broadcast clipboard/primary offers [Carlos; !1253]
|
||||||
|
* Support primary-selection protocol from wayland-protocols [Carlos; !1255]
|
||||||
|
* Fix monitor screen cast on X11 [Jonas Å.; !1251]
|
||||||
|
* Support a "blank" cursor type [Florian; !1244]
|
||||||
|
* Improve stage view damage tracking [Jonas Å.; !1237]
|
||||||
|
* Implement touch-mode detecation for the X11 backend [Carlos; !1278]
|
||||||
|
* Drop external keyboard detection from touch-mode heuristics [Carlos; !1277]
|
||||||
|
* Optimize actor allocations [Jonas D.; !1247]
|
||||||
|
* Fixed crashes [Daniel, Carlos, Jonas Å., Jonas D.; !1256, !1258, !1217, !1280]
|
||||||
|
* Misc. bug fixes and cleanups [Christian, Jonas D., Olivier, Ting-Wei,
|
||||||
|
Jonas Å., Marco, Corentin, Daniel, Robert, Niels, Florian, Simon; !1231,
|
||||||
|
!1228, !1238, !1229, !1192, !1236, !1171, !1134, #1126, !1234, !1230, !1210,
|
||||||
|
!1242, !1243, !1252, !1113, !1232, !1259, !1245, !1265, !1180, !1261, !788,
|
||||||
|
!1264, !1235, !1218, !1150, !1274, !1271, !1279, !1283, !1272]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Marco Trevisan (Treviño), Akatsuki, Jonas Dreßler, Olivier Fourdan,
|
||||||
|
Carlos Garnacho, Niels De Graef, Ting-Wei Lan, Robert Mader, Simon McVittie,
|
||||||
|
Florian Müllner, Corentin Noël, Christian Rauch, Daniel van Vugt,
|
||||||
|
Sergey Zigachev, Jonas Ådahl
|
||||||
|
|
||||||
|
3.37.1
|
||||||
|
======
|
||||||
|
* Fix screencasting non-maximized windows [Jonas Å.; !1174]
|
||||||
|
* Make window-aliveness checks less aggressive [Jonas Å.; !1182]
|
||||||
|
* Fix stylus coordinates when using screen rotation [Jonas T.; #1118]
|
||||||
|
* Preserve keyboard state on VT switch [Olivier; !1185]
|
||||||
|
* Remove Clutter's drag and drop actions [Jonas D.; !789]
|
||||||
|
* Cancel clicks/gestures actions on disable [Georges; !1188]
|
||||||
|
* Fix various clipboard issues [Carlos; !1186, !1198, !1203, !1204, !1206]
|
||||||
|
* Fix trackball button scrolling [Phillip; #1120]
|
||||||
|
* Fix tiled monitor support [Jonas; !1199]
|
||||||
|
* Support unredirecting fullscreen wayland surfaces [Jonas Å.; !798]
|
||||||
|
* Support area screencasts [Jonas Å.; !1207]
|
||||||
|
* Synchronize shadows to server-side decorations [Olivier; !1214]
|
||||||
|
* Allow inhibiting remote access [Jonas Å.; !1212]
|
||||||
|
* Fix overview key on X11 when using multiple keyboard layouts [Olivier; !1219]
|
||||||
|
* Fixed crashes [Jonas, D., Carlos; !1173, !1183, !1012]
|
||||||
|
* Misc. bug fixes and cleanups [Andre, Georges, Christian, Jonas Å., Andre,
|
||||||
|
Simon, Florian, Carlos, Adam, Marco, Thomas, Elias, Pekka, Jonas D.,
|
||||||
|
Laurent; !1169, !1168, !1166, !1170, !1167, !1172, !1175, !1176, !1184,
|
||||||
|
!1126, !1187, !1191, !1195, !1179, !1200, !1193, !1209, !1213, !1208,
|
||||||
|
#1074, !1223]
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Marco Trevisan (Treviño), Elias Aebi, Thomas Hindoe Paaboel Andersen,
|
||||||
|
Laurent Bigonville, Jonas Dreßler, Olivier Fourdan, Carlos Garnacho,
|
||||||
|
Adam Jackson, Andre Moreira Magalhaes, Simon McVittie, Florian Müllner,
|
||||||
|
Georges Basile Stavracas Neto, Pekka Paalanen, Christian Rauch, Jonas Troeger,
|
||||||
|
Phillip Wood, Jonas Ådahl
|
||||||
|
|
||||||
|
Translators:
|
||||||
|
Dušan Kazik [sk], Christian Kirbach [de]
|
||||||
|
|
||||||
3.36.0
|
3.36.0
|
||||||
======
|
======
|
||||||
|
|||||||
@@ -1,147 +0,0 @@
|
|||||||
/* CALLY - The Clutter Accessibility Implementation Library
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 Igalia, S.L.
|
|
||||||
*
|
|
||||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
|
||||||
*
|
|
||||||
* Based on GailContainer from GAIL
|
|
||||||
* Copyright 2001, 2002, 2003 Sun Microsystems 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., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:cally-group
|
|
||||||
* @Title: CallyGroup
|
|
||||||
* @short_description: Implementation of the ATK interfaces for a #ClutterGroup
|
|
||||||
* @see_also: #ClutterGroup
|
|
||||||
*
|
|
||||||
* #CallyGroup implements the required ATK interfaces of #ClutterGroup
|
|
||||||
* In particular it exposes each of the Clutter actors contained in the
|
|
||||||
* group.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
|
||||||
|
|
||||||
#include "cally-group.h"
|
|
||||||
#include "cally-actor-private.h"
|
|
||||||
|
|
||||||
static gint cally_group_get_n_children (AtkObject *obj);
|
|
||||||
static AtkObject* cally_group_ref_child (AtkObject *obj,
|
|
||||||
gint i);
|
|
||||||
static void cally_group_real_initialize (AtkObject *obj,
|
|
||||||
gpointer data);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (CallyGroup, cally_group, CALLY_TYPE_ACTOR)
|
|
||||||
|
|
||||||
static void
|
|
||||||
cally_group_class_init (CallyGroupClass *klass)
|
|
||||||
{
|
|
||||||
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
|
|
||||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
|
||||||
|
|
||||||
class->get_n_children = cally_group_get_n_children;
|
|
||||||
class->ref_child = cally_group_ref_child;
|
|
||||||
class->initialize = cally_group_real_initialize;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cally_group_init (CallyGroup *group)
|
|
||||||
{
|
|
||||||
/* nothing to do yet */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cally_group_new:
|
|
||||||
* @actor: a #ClutterGroup
|
|
||||||
*
|
|
||||||
* Creates a #CallyGroup for @actor
|
|
||||||
*
|
|
||||||
* Return value: the newly created #CallyGroup
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
AtkObject *
|
|
||||||
cally_group_new (ClutterActor *actor)
|
|
||||||
{
|
|
||||||
GObject *object = NULL;
|
|
||||||
AtkObject *accessible = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GROUP (actor), NULL);
|
|
||||||
|
|
||||||
object = g_object_new (CALLY_TYPE_GROUP, NULL);
|
|
||||||
|
|
||||||
accessible = ATK_OBJECT (object);
|
|
||||||
atk_object_initialize (accessible, actor);
|
|
||||||
|
|
||||||
return accessible;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gint
|
|
||||||
cally_group_get_n_children (AtkObject *obj)
|
|
||||||
{
|
|
||||||
ClutterActor *actor = NULL;
|
|
||||||
gint count = 0;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CALLY_IS_GROUP (obj), count);
|
|
||||||
|
|
||||||
actor = CALLY_GET_CLUTTER_ACTOR (obj);
|
|
||||||
|
|
||||||
if (actor == NULL) /* defunct */
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), count);
|
|
||||||
|
|
||||||
count = clutter_actor_get_n_children (actor);
|
|
||||||
|
|
||||||
return count;
|
|
||||||
}
|
|
||||||
|
|
||||||
static AtkObject*
|
|
||||||
cally_group_ref_child (AtkObject *obj,
|
|
||||||
gint i)
|
|
||||||
{
|
|
||||||
AtkObject *accessible = NULL;
|
|
||||||
ClutterActor *actor = NULL;
|
|
||||||
ClutterActor *child = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CALLY_IS_GROUP (obj), NULL);
|
|
||||||
g_return_val_if_fail ((i >= 0), NULL);
|
|
||||||
|
|
||||||
actor = CALLY_GET_CLUTTER_ACTOR (obj);
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GROUP(actor), NULL);
|
|
||||||
child = clutter_actor_get_child_at_index (actor, i);
|
|
||||||
|
|
||||||
if (!child)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
accessible = clutter_actor_get_accessible (child);
|
|
||||||
|
|
||||||
if (accessible != NULL)
|
|
||||||
g_object_ref (accessible);
|
|
||||||
|
|
||||||
return accessible;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cally_group_real_initialize (AtkObject *obj,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
ATK_OBJECT_CLASS (cally_group_parent_class)->initialize (obj, data);
|
|
||||||
|
|
||||||
obj->role = ATK_ROLE_PANEL;
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/* CALLY - The Clutter Accessibility Implementation Library
|
|
||||||
*
|
|
||||||
* Copyright (C) 2008 Igalia, S.L.
|
|
||||||
*
|
|
||||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
|
||||||
*
|
|
||||||
* Based on GailContainer from GAIL
|
|
||||||
* Copyright 2001, 2002, 2003 Sun Microsystems 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, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CALLY_GROUP_H__
|
|
||||||
#define __CALLY_GROUP_H__
|
|
||||||
|
|
||||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
||||||
#error "Only <cally/cally.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cally/cally-actor.h>
|
|
||||||
#include <clutter/clutter.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CALLY_TYPE_GROUP (cally_group_get_type ())
|
|
||||||
#define CALLY_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_GROUP, CallyGroup))
|
|
||||||
#define CALLY_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_GROUP, CallyGroupClass))
|
|
||||||
#define CALLY_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_GROUP))
|
|
||||||
#define CALLY_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_GROUP))
|
|
||||||
#define CALLY_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_GROUP, CallyGroupClass))
|
|
||||||
|
|
||||||
typedef struct _CallyGroup CallyGroup;
|
|
||||||
typedef struct _CallyGroupClass CallyGroupClass;
|
|
||||||
typedef struct _CallyGroupPrivate CallyGroupPrivate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CallyGroup:
|
|
||||||
*
|
|
||||||
* The <structname>CallyGroup</structname> structure contains only
|
|
||||||
* private data and should be accessed using the provided API
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
struct _CallyGroup
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
CallyActor parent;
|
|
||||||
|
|
||||||
CallyGroupPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CallyGroupClass:
|
|
||||||
*
|
|
||||||
* The <structname>CallyGroupClass</structname> structure contains only
|
|
||||||
* private data
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
struct _CallyGroupClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
CallyActorClass parent_class;
|
|
||||||
|
|
||||||
/* padding for future expansion */
|
|
||||||
gpointer _padding_dummy[8];
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType cally_group_get_type (void) G_GNUC_CONST;
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
AtkObject* cally_group_new (ClutterActor *actor);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CALLY_GROUP_H__ */
|
|
||||||
@@ -1,98 +0,0 @@
|
|||||||
/* CALLY - The Clutter Accessibility Implementation Library
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Igalia, S.L.
|
|
||||||
*
|
|
||||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
|
||||||
*
|
|
||||||
* 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., 59 Temple Place - Suite 330,
|
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:cally-rectangle
|
|
||||||
* @short_description: Implementation of the ATK interfaces for a #ClutterRectangle
|
|
||||||
* @see_also: #ClutterRectangle
|
|
||||||
*
|
|
||||||
* #CallyRectangle implements the required ATK interfaces of #ClutterRectangle
|
|
||||||
*
|
|
||||||
* In particular it sets a proper role for the rectangle.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
|
||||||
|
|
||||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
|
|
||||||
#include "cally-rectangle.h"
|
|
||||||
#include "cally-actor-private.h"
|
|
||||||
|
|
||||||
#include "clutter-color.h"
|
|
||||||
#include "deprecated/clutter-rectangle.h"
|
|
||||||
|
|
||||||
/* AtkObject */
|
|
||||||
static void cally_rectangle_real_initialize (AtkObject *obj,
|
|
||||||
gpointer data);
|
|
||||||
|
|
||||||
G_DEFINE_TYPE (CallyRectangle, cally_rectangle, CALLY_TYPE_ACTOR)
|
|
||||||
|
|
||||||
static void
|
|
||||||
cally_rectangle_class_init (CallyRectangleClass *klass)
|
|
||||||
{
|
|
||||||
/* GObjectClass *gobject_class = G_OBJECT_CLASS (klass); */
|
|
||||||
AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
|
|
||||||
|
|
||||||
class->initialize = cally_rectangle_real_initialize;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cally_rectangle_init (CallyRectangle *rectangle)
|
|
||||||
{
|
|
||||||
/* nothing to do yet */
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* cally_rectangle_new:
|
|
||||||
* @actor: a #ClutterActor
|
|
||||||
*
|
|
||||||
* Creates a new #CallyRectangle for the given @actor. @actor must be
|
|
||||||
* a #ClutterRectangle.
|
|
||||||
*
|
|
||||||
* Return value: the newly created #AtkObject
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
AtkObject*
|
|
||||||
cally_rectangle_new (ClutterActor *actor)
|
|
||||||
{
|
|
||||||
GObject *object = NULL;
|
|
||||||
AtkObject *accessible = NULL;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_RECTANGLE (actor), NULL);
|
|
||||||
|
|
||||||
object = g_object_new (CALLY_TYPE_RECTANGLE, NULL);
|
|
||||||
|
|
||||||
accessible = ATK_OBJECT (object);
|
|
||||||
atk_object_initialize (accessible, actor);
|
|
||||||
|
|
||||||
return accessible;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
cally_rectangle_real_initialize (AtkObject *obj,
|
|
||||||
gpointer data)
|
|
||||||
{
|
|
||||||
ATK_OBJECT_CLASS (cally_rectangle_parent_class)->initialize (obj, data);
|
|
||||||
|
|
||||||
obj->role = ATK_ROLE_IMAGE;
|
|
||||||
}
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
/* CALLY - The Clutter Accessibility Implementation Library
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Igalia, S.L.
|
|
||||||
*
|
|
||||||
* Author: Alejandro Piñeiro Iglesias <apinheiro@igalia.com>
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CALLY_RECTANGLE_H__
|
|
||||||
#define __CALLY_RECTANGLE_H__
|
|
||||||
|
|
||||||
#if !defined(__CALLY_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
||||||
#error "Only <cally/cally.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cally/cally-actor.h>
|
|
||||||
#include <clutter/clutter.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CALLY_TYPE_RECTANGLE (cally_rectangle_get_type ())
|
|
||||||
#define CALLY_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CALLY_TYPE_RECTANGLE, CallyRectangle))
|
|
||||||
#define CALLY_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
|
|
||||||
#define CALLY_IS_RECTANGLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CALLY_TYPE_RECTANGLE))
|
|
||||||
#define CALLY_IS_RECTANGLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CALLY_TYPE_RECTANGLE))
|
|
||||||
#define CALLY_RECTANGLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CALLY_TYPE_RECTANGLE, CallyRectangleClass))
|
|
||||||
|
|
||||||
typedef struct _CallyRectangle CallyRectangle;
|
|
||||||
typedef struct _CallyRectangleClass CallyRectangleClass;
|
|
||||||
typedef struct _CallyRectanglePrivate CallyRectanglePrivate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CallyRectangle:
|
|
||||||
*
|
|
||||||
* The <structname>CallyRectangle</structname> structure contains only private
|
|
||||||
* data and should be accessed using the provided API
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
struct _CallyRectangle
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
CallyActor parent;
|
|
||||||
|
|
||||||
CallyRectanglePrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CallyRectangleClass:
|
|
||||||
*
|
|
||||||
* The <structname>CallyRectangleClass</structname> structure contains
|
|
||||||
* only private data
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
struct _CallyRectangleClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
CallyActorClass parent_class;
|
|
||||||
|
|
||||||
/* padding for future expansion */
|
|
||||||
gpointer _padding_dummy[8];
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType cally_rectangle_get_type (void) G_GNUC_CONST;
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
AtkObject* cally_rectangle_new (ClutterActor *actor);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CALLY_RECTANGLE_H__ */
|
|
||||||
@@ -63,7 +63,7 @@ struct _CallyStagePrivate
|
|||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (CallyStage,
|
G_DEFINE_TYPE_WITH_CODE (CallyStage,
|
||||||
cally_stage,
|
cally_stage,
|
||||||
CALLY_TYPE_GROUP,
|
CALLY_TYPE_ACTOR,
|
||||||
G_ADD_PRIVATE (CallyStage)
|
G_ADD_PRIVATE (CallyStage)
|
||||||
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
|
G_IMPLEMENT_INTERFACE (ATK_TYPE_WINDOW,
|
||||||
cally_stage_window_interface_init));
|
cally_stage_window_interface_init));
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
#error "Only <cally/cally.h> can be included directly."
|
#error "Only <cally/cally.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cally/cally-group.h>
|
#include <cally/cally-actor.h>
|
||||||
#include <clutter/clutter.h>
|
#include <clutter/clutter.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
@@ -52,7 +52,7 @@ typedef struct _CallyStagePrivate CallyStagePrivate;
|
|||||||
struct _CallyStage
|
struct _CallyStage
|
||||||
{
|
{
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
CallyGroup parent;
|
CallyActor parent;
|
||||||
|
|
||||||
CallyStagePrivate *priv;
|
CallyStagePrivate *priv;
|
||||||
};
|
};
|
||||||
@@ -68,7 +68,7 @@ struct _CallyStage
|
|||||||
struct _CallyStageClass
|
struct _CallyStageClass
|
||||||
{
|
{
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
CallyGroupClass parent_class;
|
CallyActorClass parent_class;
|
||||||
|
|
||||||
/* padding for future expansion */
|
/* padding for future expansion */
|
||||||
gpointer _padding_dummy[16];
|
gpointer _padding_dummy[16];
|
||||||
|
|||||||
@@ -36,10 +36,8 @@
|
|||||||
#include "cally.h"
|
#include "cally.h"
|
||||||
|
|
||||||
#include "cally-actor.h"
|
#include "cally-actor.h"
|
||||||
#include "cally-group.h"
|
|
||||||
#include "cally-stage.h"
|
#include "cally-stage.h"
|
||||||
#include "cally-text.h"
|
#include "cally-text.h"
|
||||||
#include "cally-rectangle.h"
|
|
||||||
#include "cally-clone.h"
|
#include "cally-clone.h"
|
||||||
|
|
||||||
#include "cally-factory.h"
|
#include "cally-factory.h"
|
||||||
@@ -52,10 +50,8 @@
|
|||||||
|
|
||||||
/* factories initialization*/
|
/* factories initialization*/
|
||||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
|
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_ACTOR, cally_actor, cally_actor_new)
|
||||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_GROUP, cally_group, cally_group_new)
|
|
||||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_STAGE, cally_stage, cally_stage_new)
|
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_STAGE, cally_stage, cally_stage_new)
|
||||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new)
|
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_TEXT, cally_text, cally_text_new)
|
||||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_RECTANGLE, cally_rectangle, cally_rectangle_new)
|
|
||||||
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
|
CALLY_ACCESSIBLE_FACTORY (CALLY_TYPE_CLONE, cally_clone, cally_clone_new)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -73,10 +69,8 @@ cally_accessibility_init (void)
|
|||||||
{
|
{
|
||||||
/* setting the factories */
|
/* setting the factories */
|
||||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor);
|
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_ACTOR, cally_actor);
|
||||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_GROUP, cally_group);
|
|
||||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_STAGE, cally_stage);
|
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_STAGE, cally_stage);
|
||||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text);
|
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_TEXT, cally_text);
|
||||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_RECTANGLE, cally_rectangle);
|
|
||||||
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone);
|
CALLY_ACTOR_SET_FACTORY (CLUTTER_TYPE_CLONE, cally_clone);
|
||||||
|
|
||||||
/* Initialize the CallyUtility class */
|
/* Initialize the CallyUtility class */
|
||||||
|
|||||||
@@ -26,9 +26,7 @@
|
|||||||
#include "cally-actor.h"
|
#include "cally-actor.h"
|
||||||
#include "cally-clone.h"
|
#include "cally-clone.h"
|
||||||
#include "cally-factory.h"
|
#include "cally-factory.h"
|
||||||
#include "cally-group.h"
|
|
||||||
#include "cally-main.h"
|
#include "cally-main.h"
|
||||||
#include "cally-rectangle.h"
|
|
||||||
#include "cally-root.h"
|
#include "cally-root.h"
|
||||||
#include "cally-stage.h"
|
#include "cally-stage.h"
|
||||||
#include "cally-text.h"
|
#include "cally-text.h"
|
||||||
|
|||||||
@@ -33,28 +33,11 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_ACTION (clutter_action_get_type ())
|
#define CLUTTER_TYPE_ACTION (clutter_action_get_type ())
|
||||||
#define CLUTTER_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTION, ClutterAction))
|
|
||||||
#define CLUTTER_IS_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTION))
|
|
||||||
#define CLUTTER_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTION, ClutterActionClass))
|
|
||||||
#define CLUTTER_IS_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTION))
|
|
||||||
#define CLUTTER_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTION, ClutterActionClass))
|
|
||||||
|
|
||||||
typedef struct _ClutterActionClass ClutterActionClass;
|
CLUTTER_EXPORT
|
||||||
|
G_DECLARE_DERIVABLE_TYPE (ClutterAction, clutter_action,
|
||||||
/**
|
CLUTTER, ACTION, ClutterActorMeta);
|
||||||
* ClutterAction:
|
|
||||||
*
|
|
||||||
* The #ClutterAction structure contains only private data and
|
|
||||||
* should be accessed using the provided API.
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
struct _ClutterAction
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterActorMeta parent_instance;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterActionClass:
|
* ClutterActionClass:
|
||||||
@@ -78,9 +61,6 @@ struct _ClutterActionClass
|
|||||||
void (* _clutter_action8) (void);
|
void (* _clutter_action8) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_action_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
/* ClutterActor API */
|
/* ClutterActor API */
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_add_action (ClutterActor *self,
|
void clutter_actor_add_action (ClutterActor *self,
|
||||||
|
|||||||
@@ -615,6 +615,32 @@ clutter_actor_box_scale (ClutterActorBox *box,
|
|||||||
box->y2 *= scale;
|
box->y2 *= scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_actor_box_is_initialized:
|
||||||
|
* @box: a #ClutterActorBox
|
||||||
|
*
|
||||||
|
* Checks if @box has been initialized, a #ClutterActorBox is uninitialized
|
||||||
|
* if it has a size of -1 at an origin of 0, 0.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the box is uninitialized, %FALSE if it isn't
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
clutter_actor_box_is_initialized (ClutterActorBox *box)
|
||||||
|
{
|
||||||
|
gboolean x1_uninitialized, x2_uninitialized;
|
||||||
|
gboolean y1_uninitialized, y2_uninitialized;
|
||||||
|
|
||||||
|
g_return_val_if_fail (box != NULL, TRUE);
|
||||||
|
|
||||||
|
x1_uninitialized = isinf (box->x1);
|
||||||
|
x2_uninitialized = isinf (box->x2) && signbit (box->x2);
|
||||||
|
y1_uninitialized = isinf (box->y1);
|
||||||
|
y2_uninitialized = isinf (box->y2) && signbit (box->y2);
|
||||||
|
|
||||||
|
return !x1_uninitialized || !x2_uninitialized ||
|
||||||
|
!y1_uninitialized || !y2_uninitialized;
|
||||||
|
}
|
||||||
|
|
||||||
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
|
G_DEFINE_BOXED_TYPE_WITH_CODE (ClutterActorBox, clutter_actor_box,
|
||||||
clutter_actor_box_copy,
|
clutter_actor_box_copy,
|
||||||
clutter_actor_box_free,
|
clutter_actor_box_free,
|
||||||
|
|||||||
@@ -81,24 +81,49 @@ static void
|
|||||||
on_actor_destroy (ClutterActor *actor,
|
on_actor_destroy (ClutterActor *actor,
|
||||||
ClutterActorMeta *meta)
|
ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
meta->priv->actor = NULL;
|
ClutterActorMetaPrivate *priv =
|
||||||
|
clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
priv->actor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
|
clutter_actor_meta_real_set_actor (ClutterActorMeta *meta,
|
||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
{
|
{
|
||||||
if (meta->priv->actor == actor)
|
ClutterActorMetaPrivate *priv =
|
||||||
|
clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
g_warn_if_fail (!priv->actor ||
|
||||||
|
!CLUTTER_ACTOR_IN_PAINT (priv->actor));
|
||||||
|
g_warn_if_fail (!actor || !CLUTTER_ACTOR_IN_PAINT (actor));
|
||||||
|
|
||||||
|
if (priv->actor == actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_clear_signal_handler (&meta->priv->destroy_id, meta->priv->actor);
|
g_clear_signal_handler (&priv->destroy_id, priv->actor);
|
||||||
|
|
||||||
meta->priv->actor = actor;
|
priv->actor = actor;
|
||||||
|
|
||||||
if (meta->priv->actor != NULL)
|
if (priv->actor != NULL)
|
||||||
meta->priv->destroy_id = g_signal_connect (meta->priv->actor, "destroy",
|
priv->destroy_id = g_signal_connect (priv->actor, "destroy",
|
||||||
G_CALLBACK (on_actor_destroy),
|
G_CALLBACK (on_actor_destroy),
|
||||||
meta);
|
meta);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_actor_meta_real_set_enabled (ClutterActorMeta *meta,
|
||||||
|
gboolean is_enabled)
|
||||||
|
{
|
||||||
|
ClutterActorMetaPrivate *priv =
|
||||||
|
clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
g_warn_if_fail (!priv->actor ||
|
||||||
|
!CLUTTER_ACTOR_IN_PAINT (priv->actor));
|
||||||
|
|
||||||
|
priv->is_enabled = is_enabled;
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -131,20 +156,21 @@ clutter_actor_meta_get_property (GObject *gobject,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
|
ClutterActorMetaPrivate *priv =
|
||||||
|
clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_ACTOR:
|
case PROP_ACTOR:
|
||||||
g_value_set_object (value, meta->priv->actor);
|
g_value_set_object (value, priv->actor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_NAME:
|
case PROP_NAME:
|
||||||
g_value_set_string (value, meta->priv->name);
|
g_value_set_string (value, priv->name);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ENABLED:
|
case PROP_ENABLED:
|
||||||
g_value_set_boolean (value, meta->priv->is_enabled);
|
g_value_set_boolean (value, priv->is_enabled);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -156,7 +182,8 @@ clutter_actor_meta_get_property (GObject *gobject,
|
|||||||
static void
|
static void
|
||||||
clutter_actor_meta_finalize (GObject *gobject)
|
clutter_actor_meta_finalize (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterActorMetaPrivate *priv = CLUTTER_ACTOR_META (gobject)->priv;
|
ClutterActorMetaPrivate *priv =
|
||||||
|
clutter_actor_meta_get_instance_private (CLUTTER_ACTOR_META (gobject));
|
||||||
|
|
||||||
if (priv->actor != NULL)
|
if (priv->actor != NULL)
|
||||||
g_clear_signal_handler (&priv->destroy_id, priv->actor);
|
g_clear_signal_handler (&priv->destroy_id, priv->actor);
|
||||||
@@ -172,6 +199,7 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
|
|||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
klass->set_actor = clutter_actor_meta_real_set_actor;
|
klass->set_actor = clutter_actor_meta_real_set_actor;
|
||||||
|
klass->set_enabled = clutter_actor_meta_real_set_enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterActorMeta:actor:
|
* ClutterActorMeta:actor:
|
||||||
@@ -226,9 +254,11 @@ clutter_actor_meta_class_init (ClutterActorMetaClass *klass)
|
|||||||
void
|
void
|
||||||
clutter_actor_meta_init (ClutterActorMeta *self)
|
clutter_actor_meta_init (ClutterActorMeta *self)
|
||||||
{
|
{
|
||||||
self->priv = clutter_actor_meta_get_instance_private (self);
|
ClutterActorMetaPrivate *priv =
|
||||||
self->priv->is_enabled = TRUE;
|
clutter_actor_meta_get_instance_private (self);
|
||||||
self->priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT;
|
|
||||||
|
priv->is_enabled = TRUE;
|
||||||
|
priv->priority = CLUTTER_ACTOR_META_PRIORITY_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -246,13 +276,17 @@ void
|
|||||||
clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
||||||
const gchar *name)
|
const gchar *name)
|
||||||
{
|
{
|
||||||
|
ClutterActorMetaPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
||||||
|
|
||||||
if (g_strcmp0 (meta->priv->name, name) == 0)
|
priv = clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
if (g_strcmp0 (priv->name, name) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_free (meta->priv->name);
|
g_free (priv->name);
|
||||||
meta->priv->name = g_strdup (name);
|
priv->name = g_strdup (name);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]);
|
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_NAME]);
|
||||||
}
|
}
|
||||||
@@ -273,9 +307,13 @@ clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
|||||||
const gchar *
|
const gchar *
|
||||||
clutter_actor_meta_get_name (ClutterActorMeta *meta)
|
clutter_actor_meta_get_name (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
|
ClutterActorMetaPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
|
||||||
|
|
||||||
return meta->priv->name;
|
priv = clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
return priv->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -291,16 +329,17 @@ void
|
|||||||
clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
|
clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
|
||||||
gboolean is_enabled)
|
gboolean is_enabled)
|
||||||
{
|
{
|
||||||
|
ClutterActorMetaPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
||||||
|
|
||||||
|
priv = clutter_actor_meta_get_instance_private (meta);
|
||||||
is_enabled = !!is_enabled;
|
is_enabled = !!is_enabled;
|
||||||
|
|
||||||
if (meta->priv->is_enabled == is_enabled)
|
if (priv->is_enabled == is_enabled)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
meta->priv->is_enabled = is_enabled;
|
CLUTTER_ACTOR_META_GET_CLASS (meta)->set_enabled (meta, is_enabled);
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (meta), obj_props[PROP_ENABLED]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -316,9 +355,13 @@ clutter_actor_meta_set_enabled (ClutterActorMeta *meta,
|
|||||||
gboolean
|
gboolean
|
||||||
clutter_actor_meta_get_enabled (ClutterActorMeta *meta)
|
clutter_actor_meta_get_enabled (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
|
ClutterActorMetaPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), FALSE);
|
||||||
|
|
||||||
return meta->priv->is_enabled;
|
priv = clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
return priv->is_enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -354,40 +397,54 @@ _clutter_actor_meta_set_actor (ClutterActorMeta *meta,
|
|||||||
ClutterActor *
|
ClutterActor *
|
||||||
clutter_actor_meta_get_actor (ClutterActorMeta *meta)
|
clutter_actor_meta_get_actor (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
|
ClutterActorMetaPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), NULL);
|
||||||
|
|
||||||
return meta->priv->actor;
|
priv = clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
return priv->actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_actor_meta_set_priority (ClutterActorMeta *meta,
|
_clutter_actor_meta_set_priority (ClutterActorMeta *meta,
|
||||||
gint priority)
|
gint priority)
|
||||||
{
|
{
|
||||||
|
ClutterActorMetaPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
g_return_if_fail (CLUTTER_IS_ACTOR_META (meta));
|
||||||
|
|
||||||
|
priv = clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
/* This property shouldn't be modified after the actor meta is in
|
/* This property shouldn't be modified after the actor meta is in
|
||||||
use because ClutterMetaGroup doesn't resort the list when it
|
use because ClutterMetaGroup doesn't resort the list when it
|
||||||
changes. If we made the priority public then we could either make
|
changes. If we made the priority public then we could either make
|
||||||
the priority a construct-only property or listen for
|
the priority a construct-only property or listen for
|
||||||
notifications on the property from the ClutterMetaGroup and
|
notifications on the property from the ClutterMetaGroup and
|
||||||
resort. */
|
resort. */
|
||||||
g_return_if_fail (meta->priv->actor == NULL);
|
g_return_if_fail (priv->actor == NULL);
|
||||||
|
|
||||||
meta->priv->priority = priority;
|
priv->priority = priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
_clutter_actor_meta_get_priority (ClutterActorMeta *meta)
|
_clutter_actor_meta_get_priority (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
|
ClutterActorMetaPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), 0);
|
g_return_val_if_fail (CLUTTER_IS_ACTOR_META (meta), 0);
|
||||||
|
|
||||||
return meta->priv->priority;
|
priv = clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
return priv->priority;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_clutter_actor_meta_is_internal (ClutterActorMeta *meta)
|
_clutter_actor_meta_is_internal (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
gint priority = meta->priv->priority;
|
ClutterActorMetaPrivate *priv =
|
||||||
|
clutter_actor_meta_get_instance_private (meta);
|
||||||
|
gint priority = priv->priority;
|
||||||
|
|
||||||
return (priority <= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW ||
|
return (priority <= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_LOW ||
|
||||||
priority >= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH);
|
priority >= CLUTTER_ACTOR_META_PRIORITY_INTERNAL_HIGH);
|
||||||
@@ -434,19 +491,21 @@ void
|
|||||||
_clutter_meta_group_add_meta (ClutterMetaGroup *group,
|
_clutter_meta_group_add_meta (ClutterMetaGroup *group,
|
||||||
ClutterActorMeta *meta)
|
ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
|
ClutterActorMetaPrivate *priv =
|
||||||
|
clutter_actor_meta_get_instance_private (meta);
|
||||||
GList *prev = NULL, *l;
|
GList *prev = NULL, *l;
|
||||||
|
|
||||||
if (meta->priv->actor != NULL)
|
if (priv->actor != NULL)
|
||||||
{
|
{
|
||||||
g_warning ("The meta of type '%s' with name '%s' is "
|
g_warning ("The meta of type '%s' with name '%s' is "
|
||||||
"already attached to actor '%s'",
|
"already attached to actor '%s'",
|
||||||
G_OBJECT_TYPE_NAME (meta),
|
G_OBJECT_TYPE_NAME (meta),
|
||||||
meta->priv->name != NULL
|
priv->name != NULL
|
||||||
? meta->priv->name
|
? priv->name
|
||||||
: "<unknown>",
|
: "<unknown>",
|
||||||
clutter_actor_get_name (meta->priv->actor) != NULL
|
clutter_actor_get_name (priv->actor) != NULL
|
||||||
? clutter_actor_get_name (meta->priv->actor)
|
? clutter_actor_get_name (priv->actor)
|
||||||
: G_OBJECT_TYPE_NAME (meta->priv->actor));
|
: G_OBJECT_TYPE_NAME (priv->actor));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -482,13 +541,16 @@ void
|
|||||||
_clutter_meta_group_remove_meta (ClutterMetaGroup *group,
|
_clutter_meta_group_remove_meta (ClutterMetaGroup *group,
|
||||||
ClutterActorMeta *meta)
|
ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
if (meta->priv->actor != group->actor)
|
ClutterActorMetaPrivate *priv =
|
||||||
|
clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
if (priv->actor != group->actor)
|
||||||
{
|
{
|
||||||
g_warning ("The meta of type '%s' with name '%s' is not "
|
g_warning ("The meta of type '%s' with name '%s' is not "
|
||||||
"attached to the actor '%s'",
|
"attached to the actor '%s'",
|
||||||
G_OBJECT_TYPE_NAME (meta),
|
G_OBJECT_TYPE_NAME (meta),
|
||||||
meta->priv->name != NULL
|
priv->name != NULL
|
||||||
? meta->priv->name
|
? priv->name
|
||||||
: "<unknown>",
|
: "<unknown>",
|
||||||
clutter_actor_get_name (group->actor) != NULL
|
clutter_actor_get_name (group->actor) != NULL
|
||||||
? clutter_actor_get_name (group->actor)
|
? clutter_actor_get_name (group->actor)
|
||||||
@@ -631,8 +693,10 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group,
|
|||||||
for (l = group->meta; l != NULL; l = l->next)
|
for (l = group->meta; l != NULL; l = l->next)
|
||||||
{
|
{
|
||||||
ClutterActorMeta *meta = l->data;
|
ClutterActorMeta *meta = l->data;
|
||||||
|
ClutterActorMetaPrivate *priv =
|
||||||
|
clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
if (g_strcmp0 (meta->priv->name, name) == 0)
|
if (g_strcmp0 (priv->name, name) == 0)
|
||||||
return meta;
|
return meta;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,6 +716,8 @@ _clutter_meta_group_get_meta (ClutterMetaGroup *group,
|
|||||||
const gchar *
|
const gchar *
|
||||||
_clutter_actor_meta_get_debug_name (ClutterActorMeta *meta)
|
_clutter_actor_meta_get_debug_name (ClutterActorMeta *meta)
|
||||||
{
|
{
|
||||||
return meta->priv->name != NULL ? meta->priv->name
|
ClutterActorMetaPrivate *priv =
|
||||||
: G_OBJECT_TYPE_NAME (meta);
|
clutter_actor_meta_get_instance_private (meta);
|
||||||
|
|
||||||
|
return priv->name != NULL ? priv->name : G_OBJECT_TYPE_NAME (meta);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,31 +33,13 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ())
|
#define CLUTTER_TYPE_ACTOR_META (clutter_actor_meta_get_type ())
|
||||||
#define CLUTTER_ACTOR_META(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMeta))
|
|
||||||
#define CLUTTER_IS_ACTOR_META(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_ACTOR_META))
|
|
||||||
#define CLUTTER_ACTOR_META_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass))
|
|
||||||
#define CLUTTER_IS_ACTOR_META_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_ACTOR_META))
|
|
||||||
#define CLUTTER_ACTOR_META_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_ACTOR_META, ClutterActorMetaClass))
|
|
||||||
|
|
||||||
typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
|
CLUTTER_EXPORT
|
||||||
typedef struct _ClutterActorMetaClass ClutterActorMetaClass;
|
G_DECLARE_DERIVABLE_TYPE (ClutterActorMeta, clutter_actor_meta,
|
||||||
|
CLUTTER, ACTOR_META, GInitiallyUnowned);
|
||||||
|
|
||||||
/**
|
typedef struct _ClutterActorMetaPrivate ClutterActorMetaPrivate;
|
||||||
* ClutterActorMeta:
|
|
||||||
*
|
|
||||||
* The #ClutterActorMeta structure contains only
|
|
||||||
* private data and should be accessed using the provided API
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
struct _ClutterActorMeta
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
GInitiallyUnowned parent_instance;
|
|
||||||
|
|
||||||
ClutterActorMetaPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterActorMetaClass:
|
* ClutterActorMetaClass:
|
||||||
@@ -87,6 +69,9 @@ struct _ClutterActorMetaClass
|
|||||||
void (* set_actor) (ClutterActorMeta *meta,
|
void (* set_actor) (ClutterActorMeta *meta,
|
||||||
ClutterActor *actor);
|
ClutterActor *actor);
|
||||||
|
|
||||||
|
void (* set_enabled) (ClutterActorMeta *meta,
|
||||||
|
gboolean is_enabled);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
void (* _clutter_meta1) (void);
|
void (* _clutter_meta1) (void);
|
||||||
void (* _clutter_meta2) (void);
|
void (* _clutter_meta2) (void);
|
||||||
@@ -94,12 +79,8 @@ struct _ClutterActorMetaClass
|
|||||||
void (* _clutter_meta4) (void);
|
void (* _clutter_meta4) (void);
|
||||||
void (* _clutter_meta5) (void);
|
void (* _clutter_meta5) (void);
|
||||||
void (* _clutter_meta6) (void);
|
void (* _clutter_meta6) (void);
|
||||||
void (* _clutter_meta7) (void);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_actor_meta_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
void clutter_actor_meta_set_name (ClutterActorMeta *meta,
|
||||||
const gchar *name);
|
const gchar *name);
|
||||||
|
|||||||
@@ -110,35 +110,12 @@ typedef ClutterActorTraverseVisitFlags (*ClutterTraverseCallback) (ClutterActor
|
|||||||
typedef gboolean (*ClutterForeachCallback) (ClutterActor *actor,
|
typedef gboolean (*ClutterForeachCallback) (ClutterActor *actor,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|
||||||
typedef struct _AnchorCoord AnchorCoord;
|
|
||||||
typedef struct _SizeRequest SizeRequest;
|
typedef struct _SizeRequest SizeRequest;
|
||||||
|
|
||||||
typedef struct _ClutterLayoutInfo ClutterLayoutInfo;
|
typedef struct _ClutterLayoutInfo ClutterLayoutInfo;
|
||||||
typedef struct _ClutterTransformInfo ClutterTransformInfo;
|
typedef struct _ClutterTransformInfo ClutterTransformInfo;
|
||||||
typedef struct _ClutterAnimationInfo ClutterAnimationInfo;
|
typedef struct _ClutterAnimationInfo ClutterAnimationInfo;
|
||||||
|
|
||||||
/* Internal helper struct to represent a point that can be stored in
|
|
||||||
either direct pixel coordinates or as a fraction of the actor's
|
|
||||||
size. It is used for the anchor point, scale center and rotation
|
|
||||||
centers. */
|
|
||||||
struct _AnchorCoord
|
|
||||||
{
|
|
||||||
gboolean is_fractional;
|
|
||||||
|
|
||||||
union
|
|
||||||
{
|
|
||||||
/* Used when is_fractional == TRUE */
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
gdouble x;
|
|
||||||
gdouble y;
|
|
||||||
} fraction;
|
|
||||||
|
|
||||||
/* Use when is_fractional == FALSE */
|
|
||||||
graphene_point3d_t units;
|
|
||||||
} v;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _SizeRequest
|
struct _SizeRequest
|
||||||
{
|
{
|
||||||
guint age;
|
guint age;
|
||||||
@@ -183,24 +160,15 @@ ClutterLayoutInfo * _clutter_actor_peek_layout_info
|
|||||||
|
|
||||||
struct _ClutterTransformInfo
|
struct _ClutterTransformInfo
|
||||||
{
|
{
|
||||||
/* rotation (angle and center) */
|
/* rotation */
|
||||||
gdouble rx_angle;
|
gdouble rx_angle;
|
||||||
AnchorCoord rx_center;
|
|
||||||
|
|
||||||
gdouble ry_angle;
|
gdouble ry_angle;
|
||||||
AnchorCoord ry_center;
|
|
||||||
|
|
||||||
gdouble rz_angle;
|
gdouble rz_angle;
|
||||||
AnchorCoord rz_center;
|
|
||||||
|
|
||||||
/* scaling */
|
/* scaling */
|
||||||
gdouble scale_x;
|
gdouble scale_x;
|
||||||
gdouble scale_y;
|
gdouble scale_y;
|
||||||
gdouble scale_z;
|
gdouble scale_z;
|
||||||
AnchorCoord scale_center;
|
|
||||||
|
|
||||||
/* anchor point */
|
|
||||||
AnchorCoord anchor;
|
|
||||||
|
|
||||||
/* translation */
|
/* translation */
|
||||||
graphene_point3d_t translation;
|
graphene_point3d_t translation;
|
||||||
@@ -313,14 +281,18 @@ void _clutter_actor_detach_clone
|
|||||||
void _clutter_actor_queue_redraw_on_clones (ClutterActor *actor);
|
void _clutter_actor_queue_redraw_on_clones (ClutterActor *actor);
|
||||||
void _clutter_actor_queue_relayout_on_clones (ClutterActor *actor);
|
void _clutter_actor_queue_relayout_on_clones (ClutterActor *actor);
|
||||||
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
|
void _clutter_actor_queue_only_relayout (ClutterActor *actor);
|
||||||
void _clutter_actor_queue_update_resource_scale_recursive (ClutterActor *actor);
|
void clutter_actor_clear_stage_views_recursive (ClutterActor *actor);
|
||||||
|
|
||||||
gboolean _clutter_actor_get_real_resource_scale (ClutterActor *actor,
|
float clutter_actor_get_real_resource_scale (ClutterActor *actor);
|
||||||
float *resource_scale);
|
|
||||||
|
|
||||||
ClutterPaintNode * clutter_actor_create_texture_paint_node (ClutterActor *self,
|
ClutterPaintNode * clutter_actor_create_texture_paint_node (ClutterActor *self,
|
||||||
CoglTexture *texture);
|
CoglTexture *texture);
|
||||||
|
|
||||||
|
void clutter_actor_update_stage_views (ClutterActor *self,
|
||||||
|
int phase);
|
||||||
|
|
||||||
|
void clutter_actor_queue_immediate_relayout (ClutterActor *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_ACTOR_PRIVATE_H__ */
|
#endif /* __CLUTTER_ACTOR_PRIVATE_H__ */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -142,11 +142,6 @@ struct _ClutterActor
|
|||||||
* ClutterActorClass:
|
* ClutterActorClass:
|
||||||
* @show: signal class handler for #ClutterActor::show; it must chain
|
* @show: signal class handler for #ClutterActor::show; it must chain
|
||||||
* up to the parent's implementation
|
* up to the parent's implementation
|
||||||
* @show_all: virtual function for containers and composite actors, to
|
|
||||||
* determine which children should be shown when calling
|
|
||||||
* clutter_actor_show_all() on the actor. Defaults to calling
|
|
||||||
* clutter_actor_show(). This virtual function is deprecated and it
|
|
||||||
* should not be overridden.
|
|
||||||
* @hide: signal class handler for #ClutterActor::hide; it must chain
|
* @hide: signal class handler for #ClutterActor::hide; it must chain
|
||||||
* up to the parent's implementation
|
* up to the parent's implementation
|
||||||
* @hide_all: virtual function for containers and composite actors, to
|
* @hide_all: virtual function for containers and composite actors, to
|
||||||
@@ -175,12 +170,18 @@ struct _ClutterActor
|
|||||||
* @get_preferred_height: virtual function, used when querying the minimum
|
* @get_preferred_height: virtual function, used when querying the minimum
|
||||||
* and natural heights of an actor for a given width; it is used by
|
* and natural heights of an actor for a given width; it is used by
|
||||||
* clutter_actor_get_preferred_height()
|
* clutter_actor_get_preferred_height()
|
||||||
* @allocate: virtual function, used when settings the coordinates of an
|
* @allocate: virtual function, used when setting the coordinates of an
|
||||||
* actor; it is used by clutter_actor_allocate(); it must chain up to
|
* actor; it is used by clutter_actor_allocate(); when overriding this
|
||||||
* the parent's implementation, or call clutter_actor_set_allocation()
|
* function without chaining up, clutter_actor_set_allocation() must be
|
||||||
|
* called and children must be allocated by the implementation, when
|
||||||
|
* chaining up though, those things will be done by the parent's
|
||||||
|
* implementation.
|
||||||
* @apply_transform: virtual function, used when applying the transformations
|
* @apply_transform: virtual function, used when applying the transformations
|
||||||
* to an actor before painting it or when transforming coordinates or
|
* to an actor before painting it or when transforming coordinates or
|
||||||
* the allocation; it must chain up to the parent's implementation
|
* the allocation; if the transformation calculated by this function may
|
||||||
|
* have changed, the cached transformation must be invalidated by calling
|
||||||
|
* clutter_actor_invalidate_transform(); it must chain up to the parent's
|
||||||
|
* implementation
|
||||||
* @parent_set: signal class handler for the #ClutterActor::parent-set
|
* @parent_set: signal class handler for the #ClutterActor::parent-set
|
||||||
* @destroy: signal class handler for #ClutterActor::destroy. It must
|
* @destroy: signal class handler for #ClutterActor::destroy. It must
|
||||||
* chain up to the parent's implementation
|
* chain up to the parent's implementation
|
||||||
@@ -223,7 +224,6 @@ struct _ClutterActorClass
|
|||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
void (* show) (ClutterActor *self);
|
void (* show) (ClutterActor *self);
|
||||||
void (* show_all) (ClutterActor *self);
|
|
||||||
void (* hide) (ClutterActor *self);
|
void (* hide) (ClutterActor *self);
|
||||||
void (* hide_all) (ClutterActor *self);
|
void (* hide_all) (ClutterActor *self);
|
||||||
void (* realize) (ClutterActor *self);
|
void (* realize) (ClutterActor *self);
|
||||||
@@ -253,8 +253,7 @@ struct _ClutterActorClass
|
|||||||
gfloat *min_height_p,
|
gfloat *min_height_p,
|
||||||
gfloat *natural_height_p);
|
gfloat *natural_height_p);
|
||||||
void (* allocate) (ClutterActor *self,
|
void (* allocate) (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box);
|
||||||
ClutterAllocationFlags flags);
|
|
||||||
|
|
||||||
/* transformations */
|
/* transformations */
|
||||||
void (* apply_transform) (ClutterActor *actor,
|
void (* apply_transform) (ClutterActor *actor,
|
||||||
@@ -300,6 +299,9 @@ struct _ClutterActorClass
|
|||||||
gboolean (* touch_event) (ClutterActor *self,
|
gboolean (* touch_event) (ClutterActor *self,
|
||||||
ClutterTouchEvent *event);
|
ClutterTouchEvent *event);
|
||||||
gboolean (* has_accessible) (ClutterActor *self);
|
gboolean (* has_accessible) (ClutterActor *self);
|
||||||
|
void (* resource_scale_changed) (ClutterActor *self);
|
||||||
|
float (* calculate_resource_scale) (ClutterActor *self,
|
||||||
|
int phase);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
/* padding for future expansion */
|
/* padding for future expansion */
|
||||||
@@ -415,38 +417,31 @@ void clutter_actor_get_preferred_size
|
|||||||
gfloat *natural_height_p);
|
gfloat *natural_height_p);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_allocate (ClutterActor *self,
|
void clutter_actor_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box);
|
||||||
ClutterAllocationFlags flags);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_allocate_preferred_size (ClutterActor *self,
|
void clutter_actor_allocate_preferred_size (ClutterActor *self,
|
||||||
ClutterAllocationFlags flags);
|
float x,
|
||||||
|
float y);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_allocate_available_size (ClutterActor *self,
|
void clutter_actor_allocate_available_size (ClutterActor *self,
|
||||||
gfloat x,
|
gfloat x,
|
||||||
gfloat y,
|
gfloat y,
|
||||||
gfloat available_width,
|
gfloat available_width,
|
||||||
gfloat available_height,
|
gfloat available_height);
|
||||||
ClutterAllocationFlags flags);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_allocate_align_fill (ClutterActor *self,
|
void clutter_actor_allocate_align_fill (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box,
|
||||||
gdouble x_align,
|
gdouble x_align,
|
||||||
gdouble y_align,
|
gdouble y_align,
|
||||||
gboolean x_fill,
|
gboolean x_fill,
|
||||||
gboolean y_fill,
|
gboolean y_fill);
|
||||||
ClutterAllocationFlags flags);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_set_allocation (ClutterActor *self,
|
void clutter_actor_set_allocation (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box);
|
||||||
ClutterAllocationFlags flags);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_get_allocation_box (ClutterActor *self,
|
void clutter_actor_get_allocation_box (ClutterActor *self,
|
||||||
ClutterActorBox *box);
|
ClutterActorBox *box);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_get_allocation_vertices (ClutterActor *self,
|
|
||||||
ClutterActor *ancestor,
|
|
||||||
graphene_point3d_t *verts);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
gboolean clutter_actor_has_allocation (ClutterActor *self);
|
gboolean clutter_actor_has_allocation (ClutterActor *self);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_set_size (ClutterActor *self,
|
void clutter_actor_set_size (ClutterActor *self,
|
||||||
@@ -461,6 +456,10 @@ void clutter_actor_set_position
|
|||||||
gfloat x,
|
gfloat x,
|
||||||
gfloat y);
|
gfloat y);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
|
gboolean clutter_actor_get_fixed_position (ClutterActor *self,
|
||||||
|
float *x,
|
||||||
|
float *y);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_get_position (ClutterActor *self,
|
void clutter_actor_get_position (ClutterActor *self,
|
||||||
gfloat *x,
|
gfloat *x,
|
||||||
gfloat *y);
|
gfloat *y);
|
||||||
@@ -600,8 +599,7 @@ gboolean clutter_actor_get_paint_box
|
|||||||
ClutterActorBox *box);
|
ClutterActorBox *box);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_actor_get_resource_scale (ClutterActor *self,
|
float clutter_actor_get_resource_scale (ClutterActor *self);
|
||||||
gfloat *resource_scale);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_actor_has_overlaps (ClutterActor *self);
|
gboolean clutter_actor_has_overlaps (ClutterActor *self);
|
||||||
@@ -815,6 +813,11 @@ void clutter_actor_set_child_transform
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_get_child_transform (ClutterActor *self,
|
void clutter_actor_get_child_transform (ClutterActor *self,
|
||||||
ClutterMatrix *transform);
|
ClutterMatrix *transform);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_actor_get_transformed_extents (ClutterActor *self,
|
||||||
|
graphene_rect_t *rect);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_actor_get_transformed_position (ClutterActor *self,
|
void clutter_actor_get_transformed_position (ClutterActor *self,
|
||||||
gfloat *x,
|
gfloat *x,
|
||||||
@@ -926,6 +929,12 @@ void clutter_actor_pick_box (ClutterActor *self,
|
|||||||
ClutterPickContext *pick_context,
|
ClutterPickContext *pick_context,
|
||||||
const ClutterActorBox *box);
|
const ClutterActorBox *box);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
GList * clutter_actor_peek_stage_views (ClutterActor *self);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_actor_invalidate_transform (ClutterActor *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_ACTOR_H__ */
|
#endif /* __CLUTTER_ACTOR_H__ */
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ struct _ClutterAlignConstraint
|
|||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
ClutterActor *source;
|
ClutterActor *source;
|
||||||
ClutterAlignAxis align_axis;
|
ClutterAlignAxis align_axis;
|
||||||
|
graphene_point_t pivot;
|
||||||
gfloat factor;
|
gfloat factor;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -72,6 +73,7 @@ enum
|
|||||||
|
|
||||||
PROP_SOURCE,
|
PROP_SOURCE,
|
||||||
PROP_ALIGN_AXIS,
|
PROP_ALIGN_AXIS,
|
||||||
|
PROP_PIVOT_POINT,
|
||||||
PROP_FACTOR,
|
PROP_FACTOR,
|
||||||
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
@@ -84,13 +86,11 @@ G_DEFINE_TYPE (ClutterAlignConstraint,
|
|||||||
CLUTTER_TYPE_CONSTRAINT);
|
CLUTTER_TYPE_CONSTRAINT);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
source_position_changed (ClutterActor *actor,
|
source_queue_relayout (ClutterActor *actor,
|
||||||
const ClutterActorBox *allocation,
|
ClutterAlignConstraint *align)
|
||||||
ClutterAllocationFlags flags,
|
|
||||||
ClutterAlignConstraint *align)
|
|
||||||
{
|
{
|
||||||
if (align->actor != NULL)
|
if (align->actor != NULL)
|
||||||
clutter_actor_queue_relayout (align->actor);
|
_clutter_actor_queue_only_relayout (align->actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -135,35 +135,41 @@ clutter_align_constraint_update_allocation (ClutterConstraint *constraint,
|
|||||||
ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (constraint);
|
ClutterAlignConstraint *align = CLUTTER_ALIGN_CONSTRAINT (constraint);
|
||||||
gfloat source_width, source_height;
|
gfloat source_width, source_height;
|
||||||
gfloat actor_width, actor_height;
|
gfloat actor_width, actor_height;
|
||||||
gfloat source_x, source_y;
|
gfloat offset_x_start, offset_y_start;
|
||||||
|
gfloat pivot_x, pivot_y;
|
||||||
|
|
||||||
if (align->source == NULL)
|
if (align->source == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
clutter_actor_box_get_size (allocation, &actor_width, &actor_height);
|
clutter_actor_box_get_size (allocation, &actor_width, &actor_height);
|
||||||
|
|
||||||
clutter_actor_get_position (align->source, &source_x, &source_y);
|
|
||||||
clutter_actor_get_size (align->source, &source_width, &source_height);
|
clutter_actor_get_size (align->source, &source_width, &source_height);
|
||||||
|
|
||||||
|
pivot_x = align->pivot.x == -1.f
|
||||||
|
? align->factor
|
||||||
|
: align->pivot.x;
|
||||||
|
pivot_y = align->pivot.y == -1.f
|
||||||
|
? align->factor
|
||||||
|
: align->pivot.y;
|
||||||
|
|
||||||
|
offset_x_start = pivot_x * -actor_width;
|
||||||
|
offset_y_start = pivot_y * -actor_height;
|
||||||
|
|
||||||
switch (align->align_axis)
|
switch (align->align_axis)
|
||||||
{
|
{
|
||||||
case CLUTTER_ALIGN_X_AXIS:
|
case CLUTTER_ALIGN_X_AXIS:
|
||||||
allocation->x1 = ((source_width - actor_width) * align->factor)
|
allocation->x1 += offset_x_start + (source_width * align->factor);
|
||||||
+ source_x;
|
|
||||||
allocation->x2 = allocation->x1 + actor_width;
|
allocation->x2 = allocation->x1 + actor_width;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_ALIGN_Y_AXIS:
|
case CLUTTER_ALIGN_Y_AXIS:
|
||||||
allocation->y1 = ((source_height - actor_height) * align->factor)
|
allocation->y1 += offset_y_start + (source_height * align->factor);
|
||||||
+ source_y;
|
|
||||||
allocation->y2 = allocation->y1 + actor_height;
|
allocation->y2 = allocation->y1 + actor_height;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_ALIGN_BOTH:
|
case CLUTTER_ALIGN_BOTH:
|
||||||
allocation->x1 = ((source_width - actor_width) * align->factor)
|
allocation->x1 += offset_x_start + (source_width * align->factor);
|
||||||
+ source_x;
|
allocation->y1 += offset_y_start + (source_height * align->factor);
|
||||||
allocation->y1 = ((source_height - actor_height) * align->factor)
|
|
||||||
+ source_y;
|
|
||||||
allocation->x2 = allocation->x1 + actor_width;
|
allocation->x2 = allocation->x1 + actor_width;
|
||||||
allocation->y2 = allocation->y1 + actor_height;
|
allocation->y2 = allocation->y1 + actor_height;
|
||||||
break;
|
break;
|
||||||
@@ -187,7 +193,7 @@ clutter_align_constraint_dispose (GObject *gobject)
|
|||||||
G_CALLBACK (source_destroyed),
|
G_CALLBACK (source_destroyed),
|
||||||
align);
|
align);
|
||||||
g_signal_handlers_disconnect_by_func (align->source,
|
g_signal_handlers_disconnect_by_func (align->source,
|
||||||
G_CALLBACK (source_position_changed),
|
G_CALLBACK (source_queue_relayout),
|
||||||
align);
|
align);
|
||||||
align->source = NULL;
|
align->source = NULL;
|
||||||
}
|
}
|
||||||
@@ -213,6 +219,10 @@ clutter_align_constraint_set_property (GObject *gobject,
|
|||||||
clutter_align_constraint_set_align_axis (align, g_value_get_enum (value));
|
clutter_align_constraint_set_align_axis (align, g_value_get_enum (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_PIVOT_POINT:
|
||||||
|
clutter_align_constraint_set_pivot_point (align, g_value_get_boxed (value));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_FACTOR:
|
case PROP_FACTOR:
|
||||||
clutter_align_constraint_set_factor (align, g_value_get_float (value));
|
clutter_align_constraint_set_factor (align, g_value_get_float (value));
|
||||||
break;
|
break;
|
||||||
@@ -241,6 +251,16 @@ clutter_align_constraint_get_property (GObject *gobject,
|
|||||||
g_value_set_enum (value, align->align_axis);
|
g_value_set_enum (value, align->align_axis);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_PIVOT_POINT:
|
||||||
|
{
|
||||||
|
graphene_point_t point;
|
||||||
|
|
||||||
|
clutter_align_constraint_get_pivot_point (align, &point);
|
||||||
|
|
||||||
|
g_value_set_boxed (value, &point);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_FACTOR:
|
case PROP_FACTOR:
|
||||||
g_value_set_float (value, align->factor);
|
g_value_set_float (value, align->factor);
|
||||||
break;
|
break;
|
||||||
@@ -294,6 +314,30 @@ clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
|
|||||||
CLUTTER_ALIGN_X_AXIS,
|
CLUTTER_ALIGN_X_AXIS,
|
||||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterAlignConstraint:pivot-point:
|
||||||
|
*
|
||||||
|
* The pivot point used by the constraint. The pivot point is the
|
||||||
|
* point in the constraint actor around which the aligning is applied,
|
||||||
|
* with (0, 0) being the top left corner of the actor and (1, 1) the
|
||||||
|
* bottom right corner of the actor.
|
||||||
|
*
|
||||||
|
* For example, setting the pivot point to (0.5, 0.5) and using a factor
|
||||||
|
* of 1 for both axes will align the actors horizontal and vertical
|
||||||
|
* center point with the bottom right corner of the source actor.
|
||||||
|
*
|
||||||
|
* By default, the pivot point is set to (-1, -1), which means it's not
|
||||||
|
* used and the constrained actor will be aligned to always stay inside
|
||||||
|
* the source actor.
|
||||||
|
*/
|
||||||
|
obj_props[PROP_PIVOT_POINT] =
|
||||||
|
g_param_spec_boxed ("pivot-point",
|
||||||
|
P_("Pivot point"),
|
||||||
|
P_("The pivot point"),
|
||||||
|
GRAPHENE_TYPE_POINT,
|
||||||
|
G_PARAM_READWRITE |
|
||||||
|
G_PARAM_STATIC_STRINGS);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterAlignConstraint:factor:
|
* ClutterAlignConstraint:factor:
|
||||||
*
|
*
|
||||||
@@ -326,6 +370,8 @@ clutter_align_constraint_init (ClutterAlignConstraint *self)
|
|||||||
self->actor = NULL;
|
self->actor = NULL;
|
||||||
self->source = NULL;
|
self->source = NULL;
|
||||||
self->align_axis = CLUTTER_ALIGN_X_AXIS;
|
self->align_axis = CLUTTER_ALIGN_X_AXIS;
|
||||||
|
self->pivot.x = -1.f;
|
||||||
|
self->pivot.y = -1.f;
|
||||||
self->factor = 0.0f;
|
self->factor = 0.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -403,15 +449,15 @@ clutter_align_constraint_set_source (ClutterAlignConstraint *align,
|
|||||||
G_CALLBACK (source_destroyed),
|
G_CALLBACK (source_destroyed),
|
||||||
align);
|
align);
|
||||||
g_signal_handlers_disconnect_by_func (old_source,
|
g_signal_handlers_disconnect_by_func (old_source,
|
||||||
G_CALLBACK (source_position_changed),
|
G_CALLBACK (source_queue_relayout),
|
||||||
align);
|
align);
|
||||||
}
|
}
|
||||||
|
|
||||||
align->source = source;
|
align->source = source;
|
||||||
if (align->source != NULL)
|
if (align->source != NULL)
|
||||||
{
|
{
|
||||||
g_signal_connect (align->source, "allocation-changed",
|
g_signal_connect (align->source, "queue-relayout",
|
||||||
G_CALLBACK (source_position_changed),
|
G_CALLBACK (source_queue_relayout),
|
||||||
align);
|
align);
|
||||||
g_signal_connect (align->source, "destroy",
|
g_signal_connect (align->source, "destroy",
|
||||||
G_CALLBACK (source_destroyed),
|
G_CALLBACK (source_destroyed),
|
||||||
@@ -488,6 +534,60 @@ clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align)
|
|||||||
return align->align_axis;
|
return align->align_axis;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_align_constraint_set_pivot_point:
|
||||||
|
* @align: a #ClutterAlignConstraint
|
||||||
|
* @pivot_point: A #GraphenePoint
|
||||||
|
*
|
||||||
|
* Sets the pivot point used by the constraint, the pivot point is the
|
||||||
|
* point in the constraint actor around which the aligning is applied,
|
||||||
|
* with (0, 0) being the top left corner of the actor and (1, 1) the
|
||||||
|
* bottom right corner of the actor.
|
||||||
|
*
|
||||||
|
* If -1 is used, the pivot point is unset and the constrained actor
|
||||||
|
* will be aligned to always stay inside the source actor.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_align_constraint_set_pivot_point (ClutterAlignConstraint *align,
|
||||||
|
const graphene_point_t *pivot_point)
|
||||||
|
{
|
||||||
|
g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
|
||||||
|
g_return_if_fail (pivot_point != NULL);
|
||||||
|
g_return_if_fail (pivot_point->x == -1.f ||
|
||||||
|
(pivot_point->x >= 0.f && pivot_point->x <= 1.f));
|
||||||
|
g_return_if_fail (pivot_point->y == -1.f ||
|
||||||
|
(pivot_point->y >= 0.f && pivot_point->y <= 1.f));
|
||||||
|
|
||||||
|
if (graphene_point_equal (&align->pivot, pivot_point))
|
||||||
|
return;
|
||||||
|
|
||||||
|
align->pivot = *pivot_point;
|
||||||
|
|
||||||
|
if (align->actor != NULL)
|
||||||
|
clutter_actor_queue_relayout (align->actor);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (align), obj_props[PROP_PIVOT_POINT]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_align_constraint_get_pivot_point
|
||||||
|
* @align: a #ClutterAlignConstraint
|
||||||
|
* @pivot_point: (out caller-allocates): return location for a #GraphenePoint
|
||||||
|
*
|
||||||
|
* Gets the pivot point used by the constraint set with
|
||||||
|
* clutter_align_constraint_set_pivot_point(). If no custom pivot
|
||||||
|
* point is set, -1 is set.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align,
|
||||||
|
graphene_point_t *pivot_point)
|
||||||
|
{
|
||||||
|
g_return_if_fail (CLUTTER_IS_ALIGN_CONSTRAINT (align));
|
||||||
|
g_return_if_fail (pivot_point != NULL);
|
||||||
|
|
||||||
|
*pivot_point = align->pivot;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_align_constraint_set_factor:
|
* clutter_align_constraint_set_factor:
|
||||||
* @align: a #ClutterAlignConstraint
|
* @align: a #ClutterAlignConstraint
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ void clutter_align_constraint_set_align_axis (ClutterAlignConstrai
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterAlignAxis clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align);
|
ClutterAlignAxis clutter_align_constraint_get_align_axis (ClutterAlignConstraint *align);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
|
void clutter_align_constraint_set_pivot_point (ClutterAlignConstraint *align,
|
||||||
|
const graphene_point_t *pivot_point);
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_align_constraint_get_pivot_point (ClutterAlignConstraint *align,
|
||||||
|
graphene_point_t *pivot_point);
|
||||||
|
CLUTTER_EXPORT
|
||||||
void clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
|
void clutter_align_constraint_set_factor (ClutterAlignConstraint *align,
|
||||||
gfloat factor);
|
gfloat factor);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
|
|||||||
@@ -27,35 +27,23 @@
|
|||||||
* @short_description: Interface for animatable classes
|
* @short_description: Interface for animatable classes
|
||||||
*
|
*
|
||||||
* #ClutterAnimatable is an interface that allows a #GObject class
|
* #ClutterAnimatable is an interface that allows a #GObject class
|
||||||
* to control how a #ClutterAnimation will animate a property.
|
* to control how an actor will animate a property.
|
||||||
*
|
*
|
||||||
* Each #ClutterAnimatable should implement the
|
* Each #ClutterAnimatable should implement the
|
||||||
* #ClutterAnimatableInterface.interpolate_property() virtual function of the
|
* #ClutterAnimatableInterface.interpolate_property() virtual function of the
|
||||||
* interface to compute the animation state between two values of an interval
|
* interface to compute the animation state between two values of an interval
|
||||||
* depending on a progress factor, expressed as a floating point value.
|
* depending on a progress factor, expressed as a floating point value.
|
||||||
*
|
*
|
||||||
* If a #ClutterAnimatable is animated by a #ClutterAnimation
|
|
||||||
* instance, the #ClutterAnimation will call
|
|
||||||
* clutter_animatable_interpolate_property() passing the name of the
|
|
||||||
* currently animated property; the values interval; and the progress factor.
|
|
||||||
* The #ClutterAnimatable implementation should return the computed value for
|
|
||||||
* the animated
|
|
||||||
* property.
|
|
||||||
*
|
|
||||||
* #ClutterAnimatable is available since Clutter 1.0
|
* #ClutterAnimatable is available since Clutter 1.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
#include "clutter-build-config.h"
|
||||||
|
|
||||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
|
||||||
|
|
||||||
#include "clutter-animatable.h"
|
#include "clutter-animatable.h"
|
||||||
#include "clutter-interval.h"
|
#include "clutter-interval.h"
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
|
|
||||||
#include "deprecated/clutter-animation.h"
|
|
||||||
|
|
||||||
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
|
G_DEFINE_INTERFACE (ClutterAnimatable, clutter_animatable, G_TYPE_OBJECT);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -206,3 +194,25 @@ clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
|
|||||||
else
|
else
|
||||||
return clutter_interval_compute_value (interval, progress, value);
|
return clutter_interval_compute_value (interval, progress, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_animatable_get_actor:
|
||||||
|
* @animatable: a #ClutterAnimatable
|
||||||
|
*
|
||||||
|
* Get animated actor.
|
||||||
|
*
|
||||||
|
* Return value: (transfer none): a #ClutterActor
|
||||||
|
*/
|
||||||
|
ClutterActor *
|
||||||
|
clutter_animatable_get_actor (ClutterAnimatable *animatable)
|
||||||
|
{
|
||||||
|
ClutterAnimatableInterface *iface;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_ANIMATABLE (animatable), NULL);
|
||||||
|
|
||||||
|
iface = CLUTTER_ANIMATABLE_GET_IFACE (animatable);
|
||||||
|
|
||||||
|
g_return_val_if_fail (iface->get_actor, NULL);
|
||||||
|
|
||||||
|
return iface->get_actor (animatable);
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterAnimatableInterface:
|
* ClutterAnimatableInterface:
|
||||||
* @animate_property: virtual function for custom interpolation of a
|
|
||||||
* property. This virtual function is deprecated
|
|
||||||
* @find_property: virtual function for retrieving the #GParamSpec of
|
* @find_property: virtual function for retrieving the #GParamSpec of
|
||||||
* an animatable property
|
* an animatable property
|
||||||
* @get_initial_state: virtual function for retrieving the initial
|
* @get_initial_state: virtual function for retrieving the initial
|
||||||
@@ -52,9 +50,7 @@ G_DECLARE_INTERFACE (ClutterAnimatable, clutter_animatable,
|
|||||||
* animatable property
|
* animatable property
|
||||||
* @interpolate_value: virtual function for interpolating the progress
|
* @interpolate_value: virtual function for interpolating the progress
|
||||||
* of a property
|
* of a property
|
||||||
*
|
* @get_actor: virtual function for getting associated actor
|
||||||
* Base interface for #GObject<!-- -->s that can be animated by a
|
|
||||||
* a #ClutterAnimation.
|
|
||||||
*
|
*
|
||||||
* Since: 1.0
|
* Since: 1.0
|
||||||
*/
|
*/
|
||||||
@@ -64,13 +60,6 @@ struct _ClutterAnimatableInterface
|
|||||||
GTypeInterface parent_iface;
|
GTypeInterface parent_iface;
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
gboolean (* animate_property) (ClutterAnimatable *animatable,
|
|
||||||
ClutterAnimation *animation,
|
|
||||||
const gchar *property_name,
|
|
||||||
const GValue *initial_value,
|
|
||||||
const GValue *final_value,
|
|
||||||
gdouble progress,
|
|
||||||
GValue *value);
|
|
||||||
GParamSpec *(* find_property) (ClutterAnimatable *animatable,
|
GParamSpec *(* find_property) (ClutterAnimatable *animatable,
|
||||||
const gchar *property_name);
|
const gchar *property_name);
|
||||||
void (* get_initial_state) (ClutterAnimatable *animatable,
|
void (* get_initial_state) (ClutterAnimatable *animatable,
|
||||||
@@ -84,6 +73,7 @@ struct _ClutterAnimatableInterface
|
|||||||
ClutterInterval *interval,
|
ClutterInterval *interval,
|
||||||
gdouble progress,
|
gdouble progress,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
|
ClutterActor * (* get_actor) (ClutterAnimatable *animatable);
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
@@ -104,6 +94,9 @@ gboolean clutter_animatable_interpolate_value (ClutterAnimatable *animatable,
|
|||||||
gdouble progress,
|
gdouble progress,
|
||||||
GValue *value);
|
GValue *value);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterActor * clutter_animatable_get_actor (ClutterAnimatable *animatable);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_ANIMATABLE_H__ */
|
#endif /* __CLUTTER_ANIMATABLE_H__ */
|
||||||
|
|||||||
@@ -30,9 +30,7 @@
|
|||||||
|
|
||||||
#ifndef __GI_SCANNER__
|
#ifndef __GI_SCANNER__
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAction, g_object_unref)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActor, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterActorMeta, g_object_unref)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterAlignConstraint, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBackend, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBindConstraint, g_object_unref)
|
||||||
@@ -43,19 +41,15 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBoxLayout, g_object_unref)
|
|||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterBrightnessContrastEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterCanvas, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterChildMeta, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterChildMeta, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClickAction, g_object_unref)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterClone, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterColorizeEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterConstraint, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterContainer, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDeformEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDesaturateEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDragAction, g_object_unref)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterDropAction, g_object_unref)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterEffect, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFixedLayout, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterFlowLayout, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGestureAction, g_object_unref)
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterGridLayout, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterImage, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterImage, g_object_unref)
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (ClutterInputDevice, g_object_unref)
|
||||||
|
|||||||
@@ -53,6 +53,8 @@ struct _ClutterBackend
|
|||||||
gfloat units_per_em;
|
gfloat units_per_em;
|
||||||
gint32 units_serial;
|
gint32 units_serial;
|
||||||
|
|
||||||
|
float fallback_resource_scale;
|
||||||
|
|
||||||
ClutterStageWindow *stage_window;
|
ClutterStageWindow *stage_window;
|
||||||
|
|
||||||
ClutterInputMethod *input_method;
|
ClutterInputMethod *input_method;
|
||||||
@@ -91,6 +93,8 @@ struct _ClutterBackendClass
|
|||||||
|
|
||||||
ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
|
ClutterSeat * (* get_default_seat) (ClutterBackend *backend);
|
||||||
|
|
||||||
|
gboolean (* is_display_server) (ClutterBackend *backend);
|
||||||
|
|
||||||
/* signals */
|
/* signals */
|
||||||
void (* resolution_changed) (ClutterBackend *backend);
|
void (* resolution_changed) (ClutterBackend *backend);
|
||||||
void (* font_changed) (ClutterBackend *backend);
|
void (* font_changed) (ClutterBackend *backend);
|
||||||
@@ -134,6 +138,14 @@ void clutter_set_allowed_drivers (const c
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterStageWindow * clutter_backend_get_stage_window (ClutterBackend *backend);
|
ClutterStageWindow * clutter_backend_get_stage_window (ClutterBackend *backend);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_backend_set_fallback_resource_scale (ClutterBackend *backend,
|
||||||
|
float fallback_resource_scale);
|
||||||
|
|
||||||
|
float clutter_backend_get_fallback_resource_scale (ClutterBackend *backend);
|
||||||
|
|
||||||
|
gboolean clutter_backend_is_display_server (ClutterBackend *backend);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */
|
#endif /* __CLUTTER_BACKEND_PRIVATE_H__ */
|
||||||
|
|||||||
@@ -58,13 +58,6 @@
|
|||||||
|
|
||||||
#include <cogl/cogl.h>
|
#include <cogl/cogl.h>
|
||||||
|
|
||||||
#ifdef CLUTTER_INPUT_X11
|
|
||||||
#include "x11/clutter-backend-x11.h"
|
|
||||||
#endif
|
|
||||||
#ifdef CLUTTER_WINDOWING_EGL
|
|
||||||
#include "egl/clutter-backend-eglnative.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
#ifdef CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||||
#include <cogl/cogl-wayland-server.h>
|
#include <cogl/cogl-wayland-server.h>
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
@@ -422,14 +415,6 @@ clutter_backend_real_get_features (ClutterBackend *backend)
|
|||||||
flags |= CLUTTER_FEATURE_STAGE_STATIC;
|
flags |= CLUTTER_FEATURE_STAGE_STATIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_THROTTLE))
|
|
||||||
{
|
|
||||||
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers throttling");
|
|
||||||
flags |= CLUTTER_FEATURE_SWAP_THROTTLE;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
CLUTTER_NOTE (BACKEND, "Cogl doesn't support swap buffers throttling");
|
|
||||||
|
|
||||||
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT))
|
if (cogl_clutter_winsys_has_feature (COGL_WINSYS_FEATURE_SWAP_BUFFERS_EVENT))
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events");
|
CLUTTER_NOTE (BACKEND, "Cogl supports swap buffers complete events");
|
||||||
@@ -439,23 +424,8 @@ clutter_backend_real_get_features (ClutterBackend *backend)
|
|||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *allowed_backends;
|
|
||||||
|
|
||||||
static ClutterBackend * (* custom_backend_func) (void);
|
static ClutterBackend * (* custom_backend_func) (void);
|
||||||
|
|
||||||
static const struct {
|
|
||||||
const char *name;
|
|
||||||
ClutterBackend * (* create_backend) (void);
|
|
||||||
} available_backends[] = {
|
|
||||||
#ifdef CLUTTER_WINDOWING_X11
|
|
||||||
{ CLUTTER_WINDOWING_X11, clutter_backend_x11_new },
|
|
||||||
#endif
|
|
||||||
#ifdef CLUTTER_WINDOWING_EGL
|
|
||||||
{ CLUTTER_WINDOWING_EGL, clutter_backend_egl_native_new },
|
|
||||||
#endif
|
|
||||||
{ NULL, NULL },
|
|
||||||
};
|
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
|
clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
|
||||||
{
|
{
|
||||||
@@ -465,58 +435,13 @@ clutter_set_custom_backend_func (ClutterBackend *(* func) (void))
|
|||||||
ClutterBackend *
|
ClutterBackend *
|
||||||
_clutter_create_backend (void)
|
_clutter_create_backend (void)
|
||||||
{
|
{
|
||||||
const char *backends_list;
|
|
||||||
ClutterBackend *retval;
|
ClutterBackend *retval;
|
||||||
gboolean allow_any;
|
|
||||||
char **backends;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (custom_backend_func)
|
g_return_val_if_fail (custom_backend_func, NULL);
|
||||||
{
|
|
||||||
retval = custom_backend_func ();
|
|
||||||
|
|
||||||
if (!retval)
|
retval = custom_backend_func ();
|
||||||
g_error ("Failed to create custom backend.");
|
if (!retval)
|
||||||
|
g_error ("Failed to create custom backend.");
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (allowed_backends == NULL)
|
|
||||||
allowed_backends = "*";
|
|
||||||
|
|
||||||
allow_any = strstr (allowed_backends, "*") != NULL;
|
|
||||||
|
|
||||||
backends_list = g_getenv ("CLUTTER_BACKEND");
|
|
||||||
if (backends_list == NULL)
|
|
||||||
backends_list = allowed_backends;
|
|
||||||
|
|
||||||
backends = g_strsplit (backends_list, ",", 0);
|
|
||||||
|
|
||||||
retval = NULL;
|
|
||||||
|
|
||||||
for (i = 0; retval == NULL && backends[i] != NULL; i++)
|
|
||||||
{
|
|
||||||
const char *backend = backends[i];
|
|
||||||
gboolean is_any = g_str_equal (backend, "*");
|
|
||||||
int j;
|
|
||||||
|
|
||||||
for (j = 0; available_backends[j].name != NULL; j++)
|
|
||||||
{
|
|
||||||
if ((is_any && allow_any) ||
|
|
||||||
(is_any && strstr (allowed_backends, available_backends[j].name)) ||
|
|
||||||
g_str_equal (backend, available_backends[j].name))
|
|
||||||
{
|
|
||||||
retval = available_backends[j].create_backend ();
|
|
||||||
if (retval != NULL)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_strfreev (backends);
|
|
||||||
|
|
||||||
if (retval == NULL)
|
|
||||||
g_error ("No default Clutter backend found.");
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@@ -601,6 +526,8 @@ clutter_backend_init (ClutterBackend *self)
|
|||||||
self->units_serial = 1;
|
self->units_serial = 1;
|
||||||
|
|
||||||
self->dummy_onscreen = NULL;
|
self->dummy_onscreen = NULL;
|
||||||
|
|
||||||
|
self->fallback_resource_scale = 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1031,3 +958,22 @@ clutter_backend_get_default_seat (ClutterBackend *backend)
|
|||||||
|
|
||||||
return CLUTTER_BACKEND_GET_CLASS (backend)->get_default_seat (backend);
|
return CLUTTER_BACKEND_GET_CLASS (backend)->get_default_seat (backend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_backend_set_fallback_resource_scale (ClutterBackend *backend,
|
||||||
|
float fallback_resource_scale)
|
||||||
|
{
|
||||||
|
backend->fallback_resource_scale = fallback_resource_scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
float
|
||||||
|
clutter_backend_get_fallback_resource_scale (ClutterBackend *backend)
|
||||||
|
{
|
||||||
|
return backend->fallback_resource_scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
clutter_backend_is_display_server (ClutterBackend *backend)
|
||||||
|
{
|
||||||
|
return CLUTTER_BACKEND_GET_CLASS (backend)->is_display_server (backend);
|
||||||
|
}
|
||||||
|
|||||||
@@ -406,8 +406,7 @@ get_actor_align_factor (ClutterActorAlign alignment)
|
|||||||
static void
|
static void
|
||||||
clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation,
|
const ClutterActorBox *allocation)
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
{
|
||||||
gfloat allocation_x, allocation_y;
|
gfloat allocation_x, allocation_y;
|
||||||
gfloat available_w, available_h;
|
gfloat available_w, available_h;
|
||||||
@@ -515,8 +514,7 @@ clutter_bin_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
|
|
||||||
clutter_actor_allocate_align_fill (child, &child_alloc,
|
clutter_actor_allocate_align_fill (child, &child_alloc,
|
||||||
x_align, y_align,
|
x_align, y_align,
|
||||||
x_fill, y_fill,
|
x_fill, y_fill);
|
||||||
flags);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,12 +38,14 @@
|
|||||||
*
|
*
|
||||||
* |[<!-- language="C" -->
|
* |[<!-- language="C" -->
|
||||||
* // source
|
* // source
|
||||||
* rect[0] = clutter_rectangle_new_with_color (&red_color);
|
* rect[0] = clutter_actor_new ();
|
||||||
|
* clutter_actor_set_background_color (rect[0], &red_color);
|
||||||
* clutter_actor_set_position (rect[0], x_pos, y_pos);
|
* clutter_actor_set_position (rect[0], x_pos, y_pos);
|
||||||
* clutter_actor_set_size (rect[0], 100, 100);
|
* clutter_actor_set_size (rect[0], 100, 100);
|
||||||
*
|
*
|
||||||
* // second rectangle
|
* // second rectangle
|
||||||
* rect[1] = clutter_rectangle_new_with_color (&green_color);
|
* rect[1] = clutter_actor_new ();
|
||||||
|
* clutter_actor_set_background_color (rect[1], &green_color);
|
||||||
* clutter_actor_set_size (rect[1], 100, 100);
|
* clutter_actor_set_size (rect[1], 100, 100);
|
||||||
* clutter_actor_set_opacity (rect[1], 0);
|
* clutter_actor_set_opacity (rect[1], 0);
|
||||||
*
|
*
|
||||||
@@ -53,7 +55,8 @@
|
|||||||
* clutter_actor_add_constraint_with_name (rect[1], "green-y", constraint);
|
* clutter_actor_add_constraint_with_name (rect[1], "green-y", constraint);
|
||||||
*
|
*
|
||||||
* // third rectangle
|
* // third rectangle
|
||||||
* rect[2] = clutter_rectangle_new_with_color (&blue_color);
|
* rect[2] = clutter_actor_new ();
|
||||||
|
* clutter_actor_set_background_color (rect[2], &blue_color);
|
||||||
* clutter_actor_set_size (rect[2], 100, 100);
|
* clutter_actor_set_size (rect[2], 100, 100);
|
||||||
* clutter_actor_set_opacity (rect[2], 0);
|
* clutter_actor_set_opacity (rect[2], 0);
|
||||||
*
|
*
|
||||||
@@ -165,6 +168,9 @@ clutter_bind_constraint_update_preferred_size (ClutterConstraint *constraint,
|
|||||||
bind->coordinate == CLUTTER_BIND_ALL))
|
bind->coordinate == CLUTTER_BIND_ALL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (clutter_actor_contains (bind->source, actor))
|
||||||
|
return;
|
||||||
|
|
||||||
switch (direction)
|
switch (direction)
|
||||||
{
|
{
|
||||||
case CLUTTER_ORIENTATION_HORIZONTAL:
|
case CLUTTER_ORIENTATION_HORIZONTAL:
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -105,64 +105,6 @@ void clutter_box_layout_set_pack_start (ClutterBoxLayou
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_box_layout_get_pack_start (ClutterBoxLayout *layout);
|
gboolean clutter_box_layout_get_pack_start (ClutterBoxLayout *layout);
|
||||||
|
|
||||||
CLUTTER_DEPRECATED_FOR(clutter_box_layout_set_orientation)
|
|
||||||
void clutter_box_layout_set_vertical (ClutterBoxLayout *layout,
|
|
||||||
gboolean vertical);
|
|
||||||
CLUTTER_DEPRECATED_FOR(clutter_box_layout_get_orientation)
|
|
||||||
gboolean clutter_box_layout_get_vertical (ClutterBoxLayout *layout);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_box_layout_pack (ClutterBoxLayout *layout,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gboolean expand,
|
|
||||||
gboolean x_fill,
|
|
||||||
gboolean y_fill,
|
|
||||||
ClutterBoxAlignment x_align,
|
|
||||||
ClutterBoxAlignment y_align);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_box_layout_set_alignment (ClutterBoxLayout *layout,
|
|
||||||
ClutterActor *actor,
|
|
||||||
ClutterBoxAlignment x_align,
|
|
||||||
ClutterBoxAlignment y_align);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_box_layout_get_alignment (ClutterBoxLayout *layout,
|
|
||||||
ClutterActor *actor,
|
|
||||||
ClutterBoxAlignment *x_align,
|
|
||||||
ClutterBoxAlignment *y_align);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_box_layout_set_fill (ClutterBoxLayout *layout,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gboolean x_fill,
|
|
||||||
gboolean y_fill);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_box_layout_get_fill (ClutterBoxLayout *layout,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gboolean *x_fill,
|
|
||||||
gboolean *y_fill);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_box_layout_set_expand (ClutterBoxLayout *layout,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gboolean expand);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
gboolean clutter_box_layout_get_expand (ClutterBoxLayout *layout,
|
|
||||||
ClutterActor *actor);
|
|
||||||
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_box_layout_set_use_animations (ClutterBoxLayout *layout,
|
|
||||||
gboolean animate);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
gboolean clutter_box_layout_get_use_animations (ClutterBoxLayout *layout);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_box_layout_set_easing_mode (ClutterBoxLayout *layout,
|
|
||||||
gulong mode);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
gulong clutter_box_layout_get_easing_mode (ClutterBoxLayout *layout);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_box_layout_set_easing_duration (ClutterBoxLayout *layout,
|
|
||||||
guint msecs);
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
guint clutter_box_layout_get_easing_duration (ClutterBoxLayout *layout);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_BOX_LAYOUT_H__ */
|
#endif /* __CLUTTER_BOX_LAYOUT_H__ */
|
||||||
|
|||||||
@@ -159,7 +159,8 @@ static inline void
|
|||||||
click_action_set_pressed (ClutterClickAction *action,
|
click_action_set_pressed (ClutterClickAction *action,
|
||||||
gboolean is_pressed)
|
gboolean is_pressed)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv = action->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (action);
|
||||||
|
|
||||||
is_pressed = !!is_pressed;
|
is_pressed = !!is_pressed;
|
||||||
|
|
||||||
@@ -174,7 +175,8 @@ static inline void
|
|||||||
click_action_set_held (ClutterClickAction *action,
|
click_action_set_held (ClutterClickAction *action,
|
||||||
gboolean is_held)
|
gboolean is_held)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv = action->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (action);
|
||||||
|
|
||||||
is_held = !!is_held;
|
is_held = !!is_held;
|
||||||
|
|
||||||
@@ -189,7 +191,8 @@ static gboolean
|
|||||||
click_action_emit_long_press (gpointer data)
|
click_action_emit_long_press (gpointer data)
|
||||||
{
|
{
|
||||||
ClutterClickAction *action = data;
|
ClutterClickAction *action = data;
|
||||||
ClutterClickActionPrivate *priv = action->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (action);
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
gboolean result;
|
gboolean result;
|
||||||
|
|
||||||
@@ -213,7 +216,8 @@ click_action_emit_long_press (gpointer data)
|
|||||||
static inline void
|
static inline void
|
||||||
click_action_query_long_press (ClutterClickAction *action)
|
click_action_query_long_press (ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv = action->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (action);
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
gboolean result = FALSE;
|
gboolean result = FALSE;
|
||||||
gint timeout;
|
gint timeout;
|
||||||
@@ -238,6 +242,7 @@ click_action_query_long_press (ClutterClickAction *action)
|
|||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
|
g_clear_handle_id (&priv->long_press_id, g_source_remove);
|
||||||
priv->long_press_id =
|
priv->long_press_id =
|
||||||
clutter_threads_add_timeout (timeout,
|
clutter_threads_add_timeout (timeout,
|
||||||
click_action_emit_long_press,
|
click_action_emit_long_press,
|
||||||
@@ -248,7 +253,8 @@ click_action_query_long_press (ClutterClickAction *action)
|
|||||||
static inline void
|
static inline void
|
||||||
click_action_cancel_long_press (ClutterClickAction *action)
|
click_action_cancel_long_press (ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv = action->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (action);
|
||||||
|
|
||||||
if (priv->long_press_id != 0)
|
if (priv->long_press_id != 0)
|
||||||
{
|
{
|
||||||
@@ -271,7 +277,8 @@ on_event (ClutterActor *actor,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
ClutterClickAction *action)
|
ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv = action->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (action);
|
||||||
gboolean has_button = TRUE;
|
gboolean has_button = TRUE;
|
||||||
|
|
||||||
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
|
if (!clutter_actor_meta_get_enabled (CLUTTER_ACTOR_META (action)))
|
||||||
@@ -341,7 +348,8 @@ on_captured_event (ClutterActor *stage,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
ClutterClickAction *action)
|
ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv = action->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (action);
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
ClutterModifierType modifier_state;
|
ClutterModifierType modifier_state;
|
||||||
gboolean has_button = TRUE;
|
gboolean has_button = TRUE;
|
||||||
@@ -433,7 +441,8 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
|||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta);
|
ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta);
|
||||||
ClutterClickActionPrivate *priv = action->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (action);
|
||||||
|
|
||||||
if (priv->event_id != 0)
|
if (priv->event_id != 0)
|
||||||
{
|
{
|
||||||
@@ -467,13 +476,28 @@ clutter_click_action_set_actor (ClutterActorMeta *meta,
|
|||||||
CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class)->set_actor (meta, actor);
|
CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class)->set_actor (meta, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_click_action_set_enabled (ClutterActorMeta *meta,
|
||||||
|
gboolean is_enabled)
|
||||||
|
{
|
||||||
|
ClutterClickAction *click_action = CLUTTER_CLICK_ACTION (meta);
|
||||||
|
ClutterActorMetaClass *parent_class =
|
||||||
|
CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class);
|
||||||
|
|
||||||
|
if (!is_enabled)
|
||||||
|
clutter_click_action_release (click_action);
|
||||||
|
|
||||||
|
parent_class->set_enabled (meta, is_enabled);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_click_action_set_property (GObject *gobject,
|
clutter_click_action_set_property (GObject *gobject,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@@ -497,7 +521,8 @@ clutter_click_action_get_property (GObject *gobject,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@@ -526,7 +551,8 @@ clutter_click_action_get_property (GObject *gobject,
|
|||||||
static void
|
static void
|
||||||
clutter_click_action_dispose (GObject *gobject)
|
clutter_click_action_dispose (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterClickActionPrivate *priv = CLUTTER_CLICK_ACTION (gobject)->priv;
|
ClutterClickActionPrivate *priv =
|
||||||
|
clutter_click_action_get_instance_private (CLUTTER_CLICK_ACTION (gobject));
|
||||||
|
|
||||||
g_clear_signal_handler (&priv->event_id,
|
g_clear_signal_handler (&priv->event_id,
|
||||||
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
|
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gobject)));
|
||||||
@@ -546,6 +572,7 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
|
|||||||
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||||
|
|
||||||
meta_class->set_actor = clutter_click_action_set_actor;
|
meta_class->set_actor = clutter_click_action_set_actor;
|
||||||
|
meta_class->set_enabled = clutter_click_action_set_enabled;
|
||||||
|
|
||||||
gobject_class->dispose = clutter_click_action_dispose;
|
gobject_class->dispose = clutter_click_action_dispose;
|
||||||
gobject_class->set_property = clutter_click_action_set_property;
|
gobject_class->set_property = clutter_click_action_set_property;
|
||||||
@@ -683,9 +710,11 @@ clutter_click_action_class_init (ClutterClickActionClass *klass)
|
|||||||
static void
|
static void
|
||||||
clutter_click_action_init (ClutterClickAction *self)
|
clutter_click_action_init (ClutterClickAction *self)
|
||||||
{
|
{
|
||||||
self->priv = clutter_click_action_get_instance_private (self);
|
ClutterClickActionPrivate *priv =
|
||||||
self->priv->long_press_threshold = -1;
|
clutter_click_action_get_instance_private (self);
|
||||||
self->priv->long_press_duration = -1;
|
|
||||||
|
priv->long_press_threshold = -1;
|
||||||
|
priv->long_press_duration = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -725,7 +754,7 @@ clutter_click_action_release (ClutterClickAction *action)
|
|||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_CLICK_ACTION (action));
|
||||||
|
|
||||||
priv = action->priv;
|
priv = clutter_click_action_get_instance_private (action);
|
||||||
|
|
||||||
if (!priv->is_held)
|
if (!priv->is_held)
|
||||||
return;
|
return;
|
||||||
@@ -751,9 +780,13 @@ clutter_click_action_release (ClutterClickAction *action)
|
|||||||
guint
|
guint
|
||||||
clutter_click_action_get_button (ClutterClickAction *action)
|
clutter_click_action_get_button (ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
|
ClutterClickActionPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
|
||||||
|
|
||||||
return action->priv->press_button;
|
priv = clutter_click_action_get_instance_private (action);
|
||||||
|
|
||||||
|
return priv->press_button;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -769,9 +802,13 @@ clutter_click_action_get_button (ClutterClickAction *action)
|
|||||||
ClutterModifierType
|
ClutterModifierType
|
||||||
clutter_click_action_get_state (ClutterClickAction *action)
|
clutter_click_action_get_state (ClutterClickAction *action)
|
||||||
{
|
{
|
||||||
|
ClutterClickActionPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_CLICK_ACTION (action), 0);
|
||||||
|
|
||||||
return action->priv->modifier_state;
|
priv = clutter_click_action_get_instance_private (action);
|
||||||
|
|
||||||
|
return priv->modifier_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -789,11 +826,15 @@ clutter_click_action_get_coords (ClutterClickAction *action,
|
|||||||
gfloat *press_x,
|
gfloat *press_x,
|
||||||
gfloat *press_y)
|
gfloat *press_y)
|
||||||
{
|
{
|
||||||
|
ClutterClickActionPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_ACTION (action));
|
||||||
|
|
||||||
|
priv = clutter_click_action_get_instance_private (action);
|
||||||
|
|
||||||
if (press_x != NULL)
|
if (press_x != NULL)
|
||||||
*press_x = action->priv->press_x;
|
*press_x = priv->press_x;
|
||||||
|
|
||||||
if (press_y != NULL)
|
if (press_y != NULL)
|
||||||
*press_y = action->priv->press_y;
|
*press_y = priv->press_y;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,32 +37,13 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ())
|
#define CLUTTER_TYPE_CLICK_ACTION (clutter_click_action_get_type ())
|
||||||
#define CLUTTER_CLICK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickAction))
|
|
||||||
#define CLUTTER_IS_CLICK_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_CLICK_ACTION))
|
|
||||||
#define CLUTTER_CLICK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass))
|
|
||||||
#define CLUTTER_IS_CLICK_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_CLICK_ACTION))
|
|
||||||
#define CLUTTER_CLICK_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_CLICK_ACTION, ClutterClickActionClass))
|
|
||||||
|
|
||||||
typedef struct _ClutterClickAction ClutterClickAction;
|
CLUTTER_EXPORT
|
||||||
typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
|
G_DECLARE_DERIVABLE_TYPE (ClutterClickAction, clutter_click_action,
|
||||||
typedef struct _ClutterClickActionClass ClutterClickActionClass;
|
CLUTTER, CLICK_ACTION, ClutterAction);
|
||||||
|
|
||||||
/**
|
typedef struct _ClutterClickActionPrivate ClutterClickActionPrivate;
|
||||||
* ClutterClickAction:
|
|
||||||
*
|
|
||||||
* The #ClutterClickAction structure contains
|
|
||||||
* only private data and should be accessed using the provided API
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
struct _ClutterClickAction
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterAction parent_instance;
|
|
||||||
|
|
||||||
ClutterClickActionPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterClickActionClass:
|
* ClutterClickActionClass:
|
||||||
@@ -97,9 +78,6 @@ struct _ClutterClickActionClass
|
|||||||
void (* _clutter_click_action7) (void);
|
void (* _clutter_click_action7) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_click_action_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterAction * clutter_click_action_new (void);
|
ClutterAction * clutter_click_action_new (void);
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,8 @@
|
|||||||
struct _ClutterClonePrivate
|
struct _ClutterClonePrivate
|
||||||
{
|
{
|
||||||
ClutterActor *clone_source;
|
ClutterActor *clone_source;
|
||||||
|
float x_scale, y_scale;
|
||||||
|
|
||||||
gulong source_destroy_id;
|
gulong source_destroy_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -122,8 +124,6 @@ static void
|
|||||||
clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
|
clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
|
||||||
{
|
{
|
||||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||||
ClutterActorBox box, source_box;
|
|
||||||
gfloat x_scale, y_scale;
|
|
||||||
|
|
||||||
/* First chain up and apply all the standard ClutterActor
|
/* First chain up and apply all the standard ClutterActor
|
||||||
* transformations... */
|
* transformations... */
|
||||||
@@ -134,21 +134,7 @@ clutter_clone_apply_transform (ClutterActor *self, CoglMatrix *matrix)
|
|||||||
if (priv->clone_source == NULL)
|
if (priv->clone_source == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* get our allocated size */
|
cogl_matrix_scale (matrix, priv->x_scale, priv->y_scale, 1.f);
|
||||||
clutter_actor_get_allocation_box (self, &box);
|
|
||||||
|
|
||||||
/* and get the allocated size of the source */
|
|
||||||
clutter_actor_get_allocation_box (priv->clone_source, &source_box);
|
|
||||||
|
|
||||||
/* We need to scale what the clone-source actor paints to fill our own
|
|
||||||
* allocation...
|
|
||||||
*/
|
|
||||||
x_scale = clutter_actor_box_get_width (&box)
|
|
||||||
/ clutter_actor_box_get_width (&source_box);
|
|
||||||
y_scale = clutter_actor_box_get_height (&box)
|
|
||||||
/ clutter_actor_box_get_height (&source_box);
|
|
||||||
|
|
||||||
cogl_matrix_scale (matrix, x_scale, y_scale, x_scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -240,15 +226,16 @@ clutter_clone_has_overlaps (ClutterActor *actor)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_clone_allocate (ClutterActor *self,
|
clutter_clone_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box)
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
{
|
||||||
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
ClutterClonePrivate *priv = CLUTTER_CLONE (self)->priv;
|
||||||
ClutterActorClass *parent_class;
|
ClutterActorClass *parent_class;
|
||||||
|
ClutterActorBox source_box;
|
||||||
|
float x_scale, y_scale;
|
||||||
|
|
||||||
/* chain up */
|
/* chain up */
|
||||||
parent_class = CLUTTER_ACTOR_CLASS (clutter_clone_parent_class);
|
parent_class = CLUTTER_ACTOR_CLASS (clutter_clone_parent_class);
|
||||||
parent_class->allocate (self, box, flags);
|
parent_class->allocate (self, box);
|
||||||
|
|
||||||
if (priv->clone_source == NULL)
|
if (priv->clone_source == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -258,7 +245,31 @@ clutter_clone_allocate (ClutterActor *self,
|
|||||||
*/
|
*/
|
||||||
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
|
if (clutter_actor_get_parent (priv->clone_source) != NULL &&
|
||||||
!clutter_actor_has_allocation (priv->clone_source))
|
!clutter_actor_has_allocation (priv->clone_source))
|
||||||
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
|
{
|
||||||
|
float x = 0.f;
|
||||||
|
float y = 0.f;
|
||||||
|
|
||||||
|
clutter_actor_get_fixed_position (priv->clone_source, &x, &y);
|
||||||
|
clutter_actor_allocate_preferred_size (priv->clone_source, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
clutter_actor_get_allocation_box (priv->clone_source, &source_box);
|
||||||
|
|
||||||
|
/* We need to scale what the clone-source actor paints to fill our own
|
||||||
|
* allocation...
|
||||||
|
*/
|
||||||
|
x_scale = clutter_actor_box_get_width (box)
|
||||||
|
/ clutter_actor_box_get_width (&source_box);
|
||||||
|
y_scale = clutter_actor_box_get_height (box)
|
||||||
|
/ clutter_actor_box_get_height (&source_box);
|
||||||
|
|
||||||
|
if (!G_APPROX_VALUE (priv->x_scale, x_scale, FLT_EPSILON) ||
|
||||||
|
!G_APPROX_VALUE (priv->y_scale, y_scale, FLT_EPSILON))
|
||||||
|
{
|
||||||
|
priv->x_scale = x_scale;
|
||||||
|
priv->y_scale = y_scale;
|
||||||
|
clutter_actor_invalidate_transform (CLUTTER_ACTOR (self));
|
||||||
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* XXX - this is wrong: ClutterClone cannot clone unparented
|
/* XXX - this is wrong: ClutterClone cannot clone unparented
|
||||||
@@ -273,7 +284,7 @@ clutter_clone_allocate (ClutterActor *self,
|
|||||||
* paint cycle, we can safely give it as much size as it requires
|
* paint cycle, we can safely give it as much size as it requires
|
||||||
*/
|
*/
|
||||||
if (clutter_actor_get_parent (priv->clone_source) == NULL)
|
if (clutter_actor_get_parent (priv->clone_source) == NULL)
|
||||||
clutter_actor_allocate_preferred_size (priv->clone_source, flags);
|
clutter_actor_allocate_preferred_size (priv->clone_source);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,6 +376,9 @@ static void
|
|||||||
clutter_clone_init (ClutterClone *self)
|
clutter_clone_init (ClutterClone *self)
|
||||||
{
|
{
|
||||||
self->priv = clutter_clone_get_instance_private (self);
|
self->priv = clutter_clone_get_instance_private (self);
|
||||||
|
|
||||||
|
self->priv->x_scale = 1.f;
|
||||||
|
self->priv->y_scale = 1.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -9,7 +9,13 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
@CLUTTER_CONFIG_DEFINES@
|
#mesondefine CLUTTER_HAS_WAYLAND_COMPOSITOR_SUPPORT
|
||||||
|
#mesondefine CLUTTER_WINDOWING_X11
|
||||||
|
#mesondefine CLUTTER_INPUT_X11
|
||||||
|
#mesondefine CLUTTER_WINDOWING_GLX
|
||||||
|
#mesondefine CLUTTER_WINDOWING_EGL
|
||||||
|
#mesondefine CLUTTER_INPUT_EVDEV
|
||||||
|
#mesondefine CLUTTER_INPUT_NULL
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|||||||
@@ -160,28 +160,26 @@ constraint_update_preferred_size (ClutterConstraint *constraint,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_constraint_notify (GObject *gobject,
|
clutter_constraint_set_enabled (ClutterActorMeta *meta,
|
||||||
GParamSpec *pspec)
|
gboolean is_enabled)
|
||||||
{
|
{
|
||||||
if (strcmp (pspec->name, "enabled") == 0)
|
ClutterActorMetaClass *parent_class =
|
||||||
{
|
CLUTTER_ACTOR_META_CLASS (clutter_constraint_parent_class);
|
||||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
|
ClutterActor *actor;
|
||||||
ClutterActor *actor = clutter_actor_meta_get_actor (meta);
|
|
||||||
|
|
||||||
if (actor != NULL)
|
actor = clutter_actor_meta_get_actor (meta);
|
||||||
clutter_actor_queue_relayout (actor);
|
if (actor)
|
||||||
}
|
clutter_actor_queue_relayout (actor);
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (clutter_constraint_parent_class)->notify != NULL)
|
parent_class->set_enabled (meta, is_enabled);
|
||||||
G_OBJECT_CLASS (clutter_constraint_parent_class)->notify (gobject, pspec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_constraint_class_init (ClutterConstraintClass *klass)
|
clutter_constraint_class_init (ClutterConstraintClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
ClutterActorMetaClass *actor_meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||||
|
|
||||||
gobject_class->notify = clutter_constraint_notify;
|
actor_meta_class->set_enabled = clutter_constraint_set_enabled;
|
||||||
|
|
||||||
klass->update_allocation = constraint_update_allocation;
|
klass->update_allocation = constraint_update_allocation;
|
||||||
klass->update_preferred_size = constraint_update_preferred_size;
|
klass->update_preferred_size = constraint_update_preferred_size;
|
||||||
|
|||||||
92
clutter/clutter/clutter-damage-history.c
Normal file
92
clutter/clutter/clutter-damage-history.c
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
|
||||||
|
* Copyright (C) 2020 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "clutter-build-config.h"
|
||||||
|
|
||||||
|
#include "clutter-damage-history.h"
|
||||||
|
|
||||||
|
#define DAMAGE_HISTORY_LENGTH 0x10
|
||||||
|
|
||||||
|
struct _ClutterDamageHistory
|
||||||
|
{
|
||||||
|
cairo_region_t *damages[DAMAGE_HISTORY_LENGTH];
|
||||||
|
int index;
|
||||||
|
};
|
||||||
|
|
||||||
|
ClutterDamageHistory *
|
||||||
|
clutter_damage_history_new (void)
|
||||||
|
{
|
||||||
|
ClutterDamageHistory *history;
|
||||||
|
|
||||||
|
history = g_new0 (ClutterDamageHistory, 1);
|
||||||
|
|
||||||
|
return history;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_damage_history_free (ClutterDamageHistory *history)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < G_N_ELEMENTS (history->damages); i++)
|
||||||
|
g_clear_pointer (&history->damages[i], cairo_region_destroy);
|
||||||
|
|
||||||
|
g_free (history);
|
||||||
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
||||||
|
int age)
|
||||||
|
{
|
||||||
|
if (age >= DAMAGE_HISTORY_LENGTH ||
|
||||||
|
age < 1)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!clutter_damage_history_lookup (history, age))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_damage_history_record (ClutterDamageHistory *history,
|
||||||
|
const cairo_region_t *damage)
|
||||||
|
{
|
||||||
|
g_clear_pointer (&history->damages[history->index], cairo_region_destroy);
|
||||||
|
history->damages[history->index] = cairo_region_copy (damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
step_damage_index (int current,
|
||||||
|
int diff)
|
||||||
|
{
|
||||||
|
return (current + diff) & (DAMAGE_HISTORY_LENGTH - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_damage_history_step (ClutterDamageHistory *history)
|
||||||
|
{
|
||||||
|
history->index = step_damage_index (history->index, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const cairo_region_t *
|
||||||
|
clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||||
|
int age)
|
||||||
|
{
|
||||||
|
return history->damages[step_damage_index (history->index, -age)];
|
||||||
|
}
|
||||||
42
clutter/clutter/clutter-damage-history.h
Normal file
42
clutter/clutter/clutter-damage-history.h
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2007,2008,2009,2010,2011 Intel Corporation.
|
||||||
|
* Copyright (C) 2020 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CLUTTER_DAMAGE_HISTORY_H
|
||||||
|
#define CLUTTER_DAMAGE_HISTORY_H
|
||||||
|
|
||||||
|
#include <cairo.h>
|
||||||
|
#include <glib.h>
|
||||||
|
|
||||||
|
typedef struct _ClutterDamageHistory ClutterDamageHistory;
|
||||||
|
|
||||||
|
ClutterDamageHistory * clutter_damage_history_new (void);
|
||||||
|
|
||||||
|
void clutter_damage_history_free (ClutterDamageHistory *history);
|
||||||
|
|
||||||
|
gboolean clutter_damage_history_is_age_valid (ClutterDamageHistory *history,
|
||||||
|
int age);
|
||||||
|
|
||||||
|
void clutter_damage_history_record (ClutterDamageHistory *history,
|
||||||
|
const cairo_region_t *damage);
|
||||||
|
|
||||||
|
void clutter_damage_history_step (ClutterDamageHistory *history);
|
||||||
|
|
||||||
|
const cairo_region_t * clutter_damage_history_lookup (ClutterDamageHistory *history,
|
||||||
|
int age);
|
||||||
|
|
||||||
|
#endif /* CLUTTER_DAMAGE_HISTORY_H */
|
||||||
@@ -128,10 +128,9 @@ clutter_deform_effect_deform_vertex (ClutterDeformEffect *effect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vbo_invalidate (ClutterActor *actor,
|
vbo_invalidate (ClutterActor *actor,
|
||||||
const ClutterActorBox *allocation,
|
GParamSpec *pspec,
|
||||||
ClutterAllocationFlags flags,
|
ClutterDeformEffect *effect)
|
||||||
ClutterDeformEffect *effect)
|
|
||||||
{
|
{
|
||||||
effect->priv->is_dirty = TRUE;
|
effect->priv->is_dirty = TRUE;
|
||||||
}
|
}
|
||||||
@@ -156,7 +155,7 @@ clutter_deform_effect_set_actor (ClutterActorMeta *meta,
|
|||||||
* changes
|
* changes
|
||||||
*/
|
*/
|
||||||
if (actor != NULL)
|
if (actor != NULL)
|
||||||
priv->allocation_id = g_signal_connect (actor, "allocation-changed",
|
priv->allocation_id = g_signal_connect (actor, "notify::allocation",
|
||||||
G_CALLBACK (vbo_invalidate),
|
G_CALLBACK (vbo_invalidate),
|
||||||
meta);
|
meta);
|
||||||
|
|
||||||
|
|||||||
@@ -3,16 +3,7 @@
|
|||||||
|
|
||||||
#define __CLUTTER_DEPRECATED_H_INSIDE__
|
#define __CLUTTER_DEPRECATED_H_INSIDE__
|
||||||
|
|
||||||
#include "deprecated/clutter-actor.h"
|
|
||||||
#include "deprecated/clutter-alpha.h"
|
|
||||||
#include "deprecated/clutter-animation.h"
|
|
||||||
#include "deprecated/clutter-box.h"
|
|
||||||
#include "deprecated/clutter-container.h"
|
#include "deprecated/clutter-container.h"
|
||||||
#include "deprecated/clutter-group.h"
|
|
||||||
#include "deprecated/clutter-rectangle.h"
|
|
||||||
#include "deprecated/clutter-stage.h"
|
|
||||||
#include "deprecated/clutter-state.h"
|
|
||||||
#include "deprecated/clutter-timeline.h"
|
|
||||||
|
|
||||||
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
#undef __CLUTTER_DEPRECATED_H_INSIDE__
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,152 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2010 Intel Corporation.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*
|
|
||||||
* Author:
|
|
||||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CLUTTER_DRAG_ACTION_H__
|
|
||||||
#define __CLUTTER_DRAG_ACTION_H__
|
|
||||||
|
|
||||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
||||||
#error "Only <clutter/clutter.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <clutter/clutter-action.h>
|
|
||||||
#include <clutter/clutter-event.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_DRAG_ACTION (clutter_drag_action_get_type ())
|
|
||||||
#define CLUTTER_DRAG_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DRAG_ACTION, ClutterDragAction))
|
|
||||||
#define CLUTTER_IS_DRAG_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DRAG_ACTION))
|
|
||||||
#define CLUTTER_DRAG_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DRAG_ACTION, ClutterDragActionClass))
|
|
||||||
#define CLUTTER_IS_DRAG_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DRAG_ACTION))
|
|
||||||
#define CLUTTER_DRAG_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DRAG_ACTION, ClutterDragActionClass))
|
|
||||||
|
|
||||||
typedef struct _ClutterDragAction ClutterDragAction;
|
|
||||||
typedef struct _ClutterDragActionPrivate ClutterDragActionPrivate;
|
|
||||||
typedef struct _ClutterDragActionClass ClutterDragActionClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterDragAction:
|
|
||||||
*
|
|
||||||
* The #ClutterDragAction structure contains only
|
|
||||||
* private data and should be accessed using the provided API
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
struct _ClutterDragAction
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterAction parent_instance;
|
|
||||||
|
|
||||||
ClutterDragActionPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterDragActionClass:
|
|
||||||
* @drag_begin: class handler of the #ClutterDragAction::drag-begin signal
|
|
||||||
* @drag_motion: class handler of the #ClutterDragAction::drag-motion signal
|
|
||||||
* @drag_end: class handler of the #ClutterDragAction::drag-end signal
|
|
||||||
* @drag_progress: class handler of the #ClutterDragAction::drag-progress signal
|
|
||||||
*
|
|
||||||
* The #ClutterDragActionClass structure contains
|
|
||||||
* only private data
|
|
||||||
*
|
|
||||||
* Since: 1.4
|
|
||||||
*/
|
|
||||||
struct _ClutterDragActionClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterActionClass parent_class;
|
|
||||||
|
|
||||||
/*< public >*/
|
|
||||||
void (* drag_begin) (ClutterDragAction *action,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gfloat event_x,
|
|
||||||
gfloat event_y,
|
|
||||||
ClutterModifierType modifiers);
|
|
||||||
void (* drag_motion) (ClutterDragAction *action,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gfloat delta_x,
|
|
||||||
gfloat delta_y);
|
|
||||||
void (* drag_end) (ClutterDragAction *action,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gfloat event_x,
|
|
||||||
gfloat event_y,
|
|
||||||
ClutterModifierType modifiers);
|
|
||||||
gboolean (* drag_progress) (ClutterDragAction *action,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gfloat delta_x,
|
|
||||||
gfloat delta_y);
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
void (* _clutter_drag_action1) (void);
|
|
||||||
void (* _clutter_drag_action2) (void);
|
|
||||||
void (* _clutter_drag_action3) (void);
|
|
||||||
void (* _clutter_drag_action4) (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_drag_action_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterAction * clutter_drag_action_new (void);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_drag_action_set_drag_threshold (ClutterDragAction *action,
|
|
||||||
gint x_threshold,
|
|
||||||
gint y_threshold);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_drag_action_get_drag_threshold (ClutterDragAction *action,
|
|
||||||
guint *x_threshold,
|
|
||||||
guint *y_threshold);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_drag_action_set_drag_handle (ClutterDragAction *action,
|
|
||||||
ClutterActor *handle);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterActor * clutter_drag_action_get_drag_handle (ClutterDragAction *action);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_drag_action_set_drag_axis (ClutterDragAction *action,
|
|
||||||
ClutterDragAxis axis);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterDragAxis clutter_drag_action_get_drag_axis (ClutterDragAction *action);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_drag_action_get_press_coords (ClutterDragAction *action,
|
|
||||||
gfloat *press_x,
|
|
||||||
gfloat *press_y);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_drag_action_get_motion_coords (ClutterDragAction *action,
|
|
||||||
gfloat *motion_x,
|
|
||||||
gfloat *motion_y);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
gboolean clutter_drag_action_get_drag_area (ClutterDragAction *action,
|
|
||||||
graphene_rect_t *drag_area);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_drag_action_set_drag_area (ClutterDragAction *action,
|
|
||||||
const graphene_rect_t *drag_area);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_DRAG_ACTION_H__ */
|
|
||||||
@@ -1,527 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Copyright © 2011 Intel Corporation.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*
|
|
||||||
* Author:
|
|
||||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SECTION:clutter-drop-action
|
|
||||||
* @Title: ClutterDropAction
|
|
||||||
* @short_description: An action for drop targets
|
|
||||||
*
|
|
||||||
* #ClutterDropAction is a #ClutterAction that allows a #ClutterActor
|
|
||||||
* implementation to control what happens when an actor dragged using
|
|
||||||
* a #ClutterDragAction crosses the target area or when a dragged actor
|
|
||||||
* is released (or "dropped") on the target area.
|
|
||||||
*
|
|
||||||
* A trivial use of #ClutterDropAction consists in connecting to the
|
|
||||||
* #ClutterDropAction::drop signal and handling the drop from there,
|
|
||||||
* for instance:
|
|
||||||
*
|
|
||||||
* |[<!-- language="C" -->
|
|
||||||
* ClutterAction *action = clutter_drop_action ();
|
|
||||||
*
|
|
||||||
* g_signal_connect (action, "drop", G_CALLBACK (on_drop), NULL);
|
|
||||||
* clutter_actor_add_action (an_actor, action);
|
|
||||||
* ]|
|
|
||||||
*
|
|
||||||
* The #ClutterDropAction::can-drop can be used to control whether the
|
|
||||||
* #ClutterDropAction::drop signal is going to be emitted; returning %FALSE
|
|
||||||
* from a handler connected to the #ClutterDropAction::can-drop signal will
|
|
||||||
* cause the #ClutterDropAction::drop signal to be skipped when the input
|
|
||||||
* device button is released.
|
|
||||||
*
|
|
||||||
* It's important to note that #ClutterDropAction will only work with
|
|
||||||
* actors dragged using #ClutterDragAction.
|
|
||||||
*
|
|
||||||
* See [drop-action.c](https://git.gnome.org/browse/clutter/tree/examples/drop-action.c?h=clutter-1.18)
|
|
||||||
* for an example of how to use #ClutterDropAction.
|
|
||||||
*
|
|
||||||
* #ClutterDropAction is available since Clutter 1.8
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
|
||||||
|
|
||||||
#include "clutter-drop-action.h"
|
|
||||||
|
|
||||||
#include "clutter-actor-meta-private.h"
|
|
||||||
#include "clutter-actor-private.h"
|
|
||||||
#include "clutter-drag-action.h"
|
|
||||||
#include "clutter-main.h"
|
|
||||||
#include "clutter-marshal.h"
|
|
||||||
#include "clutter-stage-private.h"
|
|
||||||
|
|
||||||
struct _ClutterDropActionPrivate
|
|
||||||
{
|
|
||||||
ClutterActor *actor;
|
|
||||||
ClutterActor *stage;
|
|
||||||
|
|
||||||
gulong mapped_id;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct _DropTarget {
|
|
||||||
ClutterActor *stage;
|
|
||||||
|
|
||||||
gulong capture_id;
|
|
||||||
|
|
||||||
GHashTable *actions;
|
|
||||||
|
|
||||||
ClutterDropAction *last_action;
|
|
||||||
} DropTarget;
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
CAN_DROP,
|
|
||||||
OVER_IN,
|
|
||||||
OVER_OUT,
|
|
||||||
DROP,
|
|
||||||
DROP_CANCEL,
|
|
||||||
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
static guint drop_signals[LAST_SIGNAL] = { 0, };
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterDropAction, clutter_drop_action, CLUTTER_TYPE_ACTION)
|
|
||||||
|
|
||||||
static void
|
|
||||||
drop_target_free (gpointer _data)
|
|
||||||
{
|
|
||||||
DropTarget *data = _data;
|
|
||||||
|
|
||||||
g_clear_signal_handler (&data->capture_id, data->stage);
|
|
||||||
g_hash_table_destroy (data->actions);
|
|
||||||
g_free (data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
on_stage_capture (ClutterStage *stage,
|
|
||||||
ClutterEvent *event,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
DropTarget *data = user_data;
|
|
||||||
gfloat event_x, event_y;
|
|
||||||
ClutterActor *actor, *drag_actor;
|
|
||||||
ClutterDropAction *drop_action;
|
|
||||||
ClutterInputDevice *device;
|
|
||||||
gboolean was_reactive;
|
|
||||||
|
|
||||||
switch (clutter_event_type (event))
|
|
||||||
{
|
|
||||||
case CLUTTER_MOTION:
|
|
||||||
case CLUTTER_BUTTON_RELEASE:
|
|
||||||
if (clutter_event_type (event) == CLUTTER_MOTION &&
|
|
||||||
!(clutter_event_get_state (event) & CLUTTER_BUTTON1_MASK))
|
|
||||||
return CLUTTER_EVENT_PROPAGATE;
|
|
||||||
|
|
||||||
if (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE &&
|
|
||||||
clutter_event_get_button (event) != CLUTTER_BUTTON_PRIMARY)
|
|
||||||
return CLUTTER_EVENT_PROPAGATE;
|
|
||||||
|
|
||||||
device = clutter_event_get_device (event);
|
|
||||||
drag_actor = _clutter_stage_get_pointer_drag_actor (stage, device);
|
|
||||||
if (drag_actor == NULL)
|
|
||||||
return CLUTTER_EVENT_PROPAGATE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case CLUTTER_TOUCH_UPDATE:
|
|
||||||
case CLUTTER_TOUCH_END:
|
|
||||||
drag_actor = _clutter_stage_get_touch_drag_actor (stage,
|
|
||||||
clutter_event_get_event_sequence (event));
|
|
||||||
if (drag_actor == NULL)
|
|
||||||
return CLUTTER_EVENT_PROPAGATE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return CLUTTER_EVENT_PROPAGATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_event_get_coords (event, &event_x, &event_y);
|
|
||||||
|
|
||||||
/* get the actor under the cursor, excluding the dragged actor; we
|
|
||||||
* use reactivity because it won't cause any scene invalidation
|
|
||||||
*/
|
|
||||||
was_reactive = clutter_actor_get_reactive (drag_actor);
|
|
||||||
clutter_actor_set_reactive (drag_actor, FALSE);
|
|
||||||
|
|
||||||
actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_REACTIVE,
|
|
||||||
event_x,
|
|
||||||
event_y);
|
|
||||||
if (actor == NULL || actor == CLUTTER_ACTOR (stage))
|
|
||||||
{
|
|
||||||
if (data->last_action != NULL)
|
|
||||||
{
|
|
||||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (data->last_action);
|
|
||||||
|
|
||||||
g_signal_emit (data->last_action, drop_signals[OVER_OUT], 0,
|
|
||||||
clutter_actor_meta_get_actor (meta));
|
|
||||||
|
|
||||||
data->last_action = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
drop_action = g_hash_table_lookup (data->actions, actor);
|
|
||||||
|
|
||||||
if (drop_action == NULL)
|
|
||||||
{
|
|
||||||
if (data->last_action != NULL)
|
|
||||||
{
|
|
||||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (data->last_action);
|
|
||||||
|
|
||||||
g_signal_emit (data->last_action, drop_signals[OVER_OUT], 0,
|
|
||||||
clutter_actor_meta_get_actor (meta));
|
|
||||||
|
|
||||||
data->last_action = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (data->last_action != drop_action)
|
|
||||||
{
|
|
||||||
ClutterActorMeta *meta;
|
|
||||||
|
|
||||||
if (data->last_action != NULL)
|
|
||||||
{
|
|
||||||
meta = CLUTTER_ACTOR_META (data->last_action);
|
|
||||||
|
|
||||||
g_signal_emit (data->last_action, drop_signals[OVER_OUT], 0,
|
|
||||||
clutter_actor_meta_get_actor (meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
meta = CLUTTER_ACTOR_META (drop_action);
|
|
||||||
|
|
||||||
g_signal_emit (drop_action, drop_signals[OVER_IN], 0,
|
|
||||||
clutter_actor_meta_get_actor (meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
data->last_action = drop_action;
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
|
||||||
if (clutter_event_type (event) == CLUTTER_BUTTON_RELEASE ||
|
|
||||||
clutter_event_type (event) == CLUTTER_TOUCH_END)
|
|
||||||
{
|
|
||||||
if (data->last_action != NULL)
|
|
||||||
{
|
|
||||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (data->last_action);
|
|
||||||
gboolean can_drop = FALSE;
|
|
||||||
|
|
||||||
g_signal_emit (data->last_action, drop_signals[CAN_DROP], 0,
|
|
||||||
clutter_actor_meta_get_actor (meta),
|
|
||||||
event_x, event_y,
|
|
||||||
&can_drop);
|
|
||||||
|
|
||||||
if (can_drop)
|
|
||||||
{
|
|
||||||
g_signal_emit (data->last_action, drop_signals[DROP], 0,
|
|
||||||
clutter_actor_meta_get_actor (meta),
|
|
||||||
event_x, event_y);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_signal_emit (data->last_action, drop_signals[DROP_CANCEL], 0,
|
|
||||||
clutter_actor_meta_get_actor (meta),
|
|
||||||
event_x, event_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
data->last_action = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (drag_actor != NULL)
|
|
||||||
clutter_actor_set_reactive (drag_actor, was_reactive);
|
|
||||||
|
|
||||||
return CLUTTER_EVENT_PROPAGATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
drop_action_register (ClutterDropAction *self)
|
|
||||||
{
|
|
||||||
ClutterDropActionPrivate *priv = self->priv;
|
|
||||||
DropTarget *data;
|
|
||||||
|
|
||||||
g_assert (priv->stage != NULL);
|
|
||||||
|
|
||||||
data = g_object_get_data (G_OBJECT (priv->stage), "__clutter_drop_targets");
|
|
||||||
if (data == NULL)
|
|
||||||
{
|
|
||||||
data = g_new0 (DropTarget, 1);
|
|
||||||
|
|
||||||
data->stage = priv->stage;
|
|
||||||
data->actions = g_hash_table_new (NULL, NULL);
|
|
||||||
data->capture_id = g_signal_connect (priv->stage, "captured-event",
|
|
||||||
G_CALLBACK (on_stage_capture),
|
|
||||||
data);
|
|
||||||
g_object_set_data_full (G_OBJECT (priv->stage), "__clutter_drop_targets",
|
|
||||||
data,
|
|
||||||
drop_target_free);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_hash_table_replace (data->actions, priv->actor, self);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
drop_action_unregister (ClutterDropAction *self)
|
|
||||||
{
|
|
||||||
ClutterDropActionPrivate *priv = self->priv;
|
|
||||||
DropTarget *data = NULL;
|
|
||||||
|
|
||||||
if (priv->stage != NULL)
|
|
||||||
data = g_object_get_data (G_OBJECT (priv->stage), "__clutter_drop_targets");
|
|
||||||
|
|
||||||
if (data == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_hash_table_remove (data->actions, priv->actor);
|
|
||||||
if (g_hash_table_size (data->actions) == 0)
|
|
||||||
g_object_set_data (G_OBJECT (data->stage), "__clutter_drop_targets", NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
on_actor_mapped (ClutterActor *actor,
|
|
||||||
GParamSpec *pspec,
|
|
||||||
ClutterDropAction *self)
|
|
||||||
{
|
|
||||||
if (clutter_actor_is_mapped (actor))
|
|
||||||
{
|
|
||||||
if (self->priv->stage == NULL)
|
|
||||||
self->priv->stage = clutter_actor_get_stage (actor);
|
|
||||||
|
|
||||||
drop_action_register (self);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
drop_action_unregister (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_drop_action_set_actor (ClutterActorMeta *meta,
|
|
||||||
ClutterActor *actor)
|
|
||||||
{
|
|
||||||
ClutterDropActionPrivate *priv = CLUTTER_DROP_ACTION (meta)->priv;
|
|
||||||
|
|
||||||
if (priv->actor != NULL)
|
|
||||||
{
|
|
||||||
drop_action_unregister (CLUTTER_DROP_ACTION (meta));
|
|
||||||
|
|
||||||
g_clear_signal_handler (&priv->mapped_id, priv->actor);
|
|
||||||
|
|
||||||
priv->stage = NULL;
|
|
||||||
priv->actor = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->actor = actor;
|
|
||||||
|
|
||||||
if (priv->actor != NULL)
|
|
||||||
{
|
|
||||||
priv->stage = clutter_actor_get_stage (actor);
|
|
||||||
priv->mapped_id = g_signal_connect (actor, "notify::mapped",
|
|
||||||
G_CALLBACK (on_actor_mapped),
|
|
||||||
meta);
|
|
||||||
|
|
||||||
if (priv->stage != NULL)
|
|
||||||
drop_action_register (CLUTTER_DROP_ACTION (meta));
|
|
||||||
}
|
|
||||||
|
|
||||||
CLUTTER_ACTOR_META_CLASS (clutter_drop_action_parent_class)->set_actor (meta, actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
signal_accumulator (GSignalInvocationHint *ihint,
|
|
||||||
GValue *return_accu,
|
|
||||||
const GValue *handler_return,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
gboolean continue_emission;
|
|
||||||
|
|
||||||
continue_emission = g_value_get_boolean (handler_return);
|
|
||||||
g_value_set_boolean (return_accu, continue_emission);
|
|
||||||
|
|
||||||
return continue_emission;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
clutter_drop_action_real_can_drop (ClutterDropAction *action,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gfloat event_x,
|
|
||||||
gfloat event_y)
|
|
||||||
{
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_drop_action_class_init (ClutterDropActionClass *klass)
|
|
||||||
{
|
|
||||||
ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
|
||||||
|
|
||||||
meta_class->set_actor = clutter_drop_action_set_actor;
|
|
||||||
|
|
||||||
klass->can_drop = clutter_drop_action_real_can_drop;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterDropAction::can-drop:
|
|
||||||
* @action: the #ClutterDropAction that emitted the signal
|
|
||||||
* @actor: the #ClutterActor attached to the @action
|
|
||||||
* @event_x: the X coordinate (in stage space) of the drop event
|
|
||||||
* @event_y: the Y coordinate (in stage space) of the drop event
|
|
||||||
*
|
|
||||||
* The ::can-drop signal is emitted when the dragged actor is dropped
|
|
||||||
* on @actor. The return value of the ::can-drop signal will determine
|
|
||||||
* whether or not the #ClutterDropAction::drop signal is going to be
|
|
||||||
* emitted on @action.
|
|
||||||
*
|
|
||||||
* The default implementation of #ClutterDropAction returns %TRUE for
|
|
||||||
* this signal.
|
|
||||||
*
|
|
||||||
* Return value: %TRUE if the drop is accepted, and %FALSE otherwise
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*/
|
|
||||||
drop_signals[CAN_DROP] =
|
|
||||||
g_signal_new (I_("can-drop"),
|
|
||||||
G_TYPE_FROM_CLASS (klass),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (ClutterDropActionClass, can_drop),
|
|
||||||
signal_accumulator, NULL,
|
|
||||||
_clutter_marshal_BOOLEAN__OBJECT_FLOAT_FLOAT,
|
|
||||||
G_TYPE_BOOLEAN, 3,
|
|
||||||
CLUTTER_TYPE_ACTOR,
|
|
||||||
G_TYPE_FLOAT,
|
|
||||||
G_TYPE_FLOAT);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterDropAction::over-in:
|
|
||||||
* @action: the #ClutterDropAction that emitted the signal
|
|
||||||
* @actor: the #ClutterActor attached to the @action
|
|
||||||
*
|
|
||||||
* The ::over-in signal is emitted when the dragged actor crosses
|
|
||||||
* into @actor.
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*/
|
|
||||||
drop_signals[OVER_IN] =
|
|
||||||
g_signal_new (I_("over-in"),
|
|
||||||
G_TYPE_FROM_CLASS (klass),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (ClutterDropActionClass, over_in),
|
|
||||||
NULL, NULL, NULL,
|
|
||||||
G_TYPE_NONE, 1,
|
|
||||||
CLUTTER_TYPE_ACTOR);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterDropAction::over-out:
|
|
||||||
* @action: the #ClutterDropAction that emitted the signal
|
|
||||||
* @actor: the #ClutterActor attached to the @action
|
|
||||||
*
|
|
||||||
* The ::over-out signal is emitted when the dragged actor crosses
|
|
||||||
* outside @actor.
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*/
|
|
||||||
drop_signals[OVER_OUT] =
|
|
||||||
g_signal_new (I_("over-out"),
|
|
||||||
G_TYPE_FROM_CLASS (klass),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (ClutterDropActionClass, over_out),
|
|
||||||
NULL, NULL, NULL,
|
|
||||||
G_TYPE_NONE, 1,
|
|
||||||
CLUTTER_TYPE_ACTOR);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterDropAction::drop:
|
|
||||||
* @action: the #ClutterDropAction that emitted the signal
|
|
||||||
* @actor: the #ClutterActor attached to the @action
|
|
||||||
* @event_x: the X coordinate (in stage space) of the drop event
|
|
||||||
* @event_y: the Y coordinate (in stage space) of the drop event
|
|
||||||
*
|
|
||||||
* The ::drop signal is emitted when the dragged actor is dropped
|
|
||||||
* on @actor. This signal is only emitted if at least an handler of
|
|
||||||
* #ClutterDropAction::can-drop returns %TRUE.
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*/
|
|
||||||
drop_signals[DROP] =
|
|
||||||
g_signal_new (I_("drop"),
|
|
||||||
G_TYPE_FROM_CLASS (klass),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (ClutterDropActionClass, drop),
|
|
||||||
NULL, NULL,
|
|
||||||
_clutter_marshal_VOID__OBJECT_FLOAT_FLOAT,
|
|
||||||
G_TYPE_NONE, 3,
|
|
||||||
CLUTTER_TYPE_ACTOR,
|
|
||||||
G_TYPE_FLOAT,
|
|
||||||
G_TYPE_FLOAT);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterDropAction::drop-cancel:
|
|
||||||
* @action: the #ClutterDropAction that emitted the signal
|
|
||||||
* @actor: the #ClutterActor attached to the @action
|
|
||||||
* @event_x: the X coordinate (in stage space) of the drop event
|
|
||||||
* @event_y: the Y coordinate (in stage space) of the drop event
|
|
||||||
*
|
|
||||||
* The ::drop-cancel signal is emitted when the drop is refused
|
|
||||||
* by an emission of the #ClutterDropAction::can-drop signal.
|
|
||||||
*
|
|
||||||
* After the ::drop-cancel signal is fired the active drag is
|
|
||||||
* terminated.
|
|
||||||
*
|
|
||||||
* Since: 1.12
|
|
||||||
*/
|
|
||||||
drop_signals[DROP_CANCEL] =
|
|
||||||
g_signal_new (I_("drop-cancel"),
|
|
||||||
G_TYPE_FROM_CLASS (klass),
|
|
||||||
G_SIGNAL_RUN_LAST,
|
|
||||||
G_STRUCT_OFFSET (ClutterDropActionClass, drop),
|
|
||||||
NULL, NULL,
|
|
||||||
_clutter_marshal_VOID__OBJECT_FLOAT_FLOAT,
|
|
||||||
G_TYPE_NONE, 3,
|
|
||||||
CLUTTER_TYPE_ACTOR,
|
|
||||||
G_TYPE_FLOAT,
|
|
||||||
G_TYPE_FLOAT);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_drop_action_init (ClutterDropAction *self)
|
|
||||||
{
|
|
||||||
self->priv = clutter_drop_action_get_instance_private (self);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_drop_action_new:
|
|
||||||
*
|
|
||||||
* Creates a new #ClutterDropAction.
|
|
||||||
*
|
|
||||||
* Use clutter_actor_add_action() to add the action to a #ClutterActor.
|
|
||||||
*
|
|
||||||
* Return value: the newly created #ClutterDropAction
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*/
|
|
||||||
ClutterAction *
|
|
||||||
clutter_drop_action_new (void)
|
|
||||||
{
|
|
||||||
return g_object_new (CLUTTER_TYPE_DROP_ACTION, NULL);
|
|
||||||
}
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Copyright © 2011 Intel Corporation.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*
|
|
||||||
* Author:
|
|
||||||
* Emmanuele Bassi <ebassi@linux.intel.com>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CLUTTER_DROP_ACTION_H__
|
|
||||||
#define __CLUTTER_DROP_ACTION_H__
|
|
||||||
|
|
||||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
||||||
#error "Only <clutter/clutter.h> can be directly included."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <clutter/clutter-action.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_DROP_ACTION (clutter_drop_action_get_type ())
|
|
||||||
#define CLUTTER_DROP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_DROP_ACTION, ClutterDropAction))
|
|
||||||
#define CLUTTER_IS_DROP_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_DROP_ACTION))
|
|
||||||
#define CLUTTER_DROP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_DROP_ACTION, ClutterDropActionClass))
|
|
||||||
#define CLUTTER_IS_DROP_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_DROP_ACTION))
|
|
||||||
#define CLUTTER_DROP_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_DROP_ACTION, ClutterDropActionClass))
|
|
||||||
|
|
||||||
typedef struct _ClutterDropAction ClutterDropAction;
|
|
||||||
typedef struct _ClutterDropActionPrivate ClutterDropActionPrivate;
|
|
||||||
typedef struct _ClutterDropActionClass ClutterDropActionClass;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterDropAction:
|
|
||||||
*
|
|
||||||
* The #ClutterDropAction structure contains only
|
|
||||||
* private data and should be accessed using the provided API.
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*/
|
|
||||||
struct _ClutterDropAction
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterAction parent_instance;
|
|
||||||
|
|
||||||
ClutterDropActionPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterDropActionClass:
|
|
||||||
* @can_drop: class handler for the #ClutterDropAction::can-drop signal
|
|
||||||
* @over_in: class handler for the #ClutterDropAction::over-in signal
|
|
||||||
* @over_out: class handler for the #ClutterDropAction::over-out signal
|
|
||||||
* @drop: class handler for the #ClutterDropAction::drop signal
|
|
||||||
*
|
|
||||||
* The #ClutterDropActionClass structure contains
|
|
||||||
* only private data.
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*/
|
|
||||||
struct _ClutterDropActionClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterActionClass parent_class;
|
|
||||||
|
|
||||||
/*< public >*/
|
|
||||||
gboolean (* can_drop) (ClutterDropAction *action,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gfloat event_x,
|
|
||||||
gfloat event_y);
|
|
||||||
|
|
||||||
void (* over_in) (ClutterDropAction *action,
|
|
||||||
ClutterActor *actor);
|
|
||||||
void (* over_out) (ClutterDropAction *action,
|
|
||||||
ClutterActor *actor);
|
|
||||||
|
|
||||||
void (* drop) (ClutterDropAction *action,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gfloat event_x,
|
|
||||||
gfloat event_y);
|
|
||||||
|
|
||||||
/*< private >*/
|
|
||||||
void (*_clutter_drop_action1) (void);
|
|
||||||
void (*_clutter_drop_action2) (void);
|
|
||||||
void (*_clutter_drop_action3) (void);
|
|
||||||
void (*_clutter_drop_action4) (void);
|
|
||||||
void (*_clutter_drop_action5) (void);
|
|
||||||
void (*_clutter_drop_action6) (void);
|
|
||||||
void (*_clutter_drop_action7) (void);
|
|
||||||
void (*_clutter_drop_action8) (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_drop_action_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterAction * clutter_drop_action_new (void);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_DROP_ACTION_H__ */
|
|
||||||
@@ -230,28 +230,26 @@ clutter_effect_real_pick (ClutterEffect *effect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_effect_notify (GObject *gobject,
|
clutter_effect_set_enabled (ClutterActorMeta *meta,
|
||||||
GParamSpec *pspec)
|
gboolean is_enabled)
|
||||||
{
|
{
|
||||||
if (strcmp (pspec->name, "enabled") == 0)
|
ClutterActorMetaClass *parent_class =
|
||||||
{
|
CLUTTER_ACTOR_META_CLASS (clutter_effect_parent_class);
|
||||||
ClutterActorMeta *meta = CLUTTER_ACTOR_META (gobject);
|
ClutterActor *actor;
|
||||||
ClutterActor *actor = clutter_actor_meta_get_actor (meta);
|
|
||||||
|
|
||||||
if (actor != NULL)
|
actor = clutter_actor_meta_get_actor (meta);
|
||||||
clutter_actor_queue_redraw (actor);
|
if (actor)
|
||||||
}
|
clutter_actor_queue_redraw (actor);
|
||||||
|
|
||||||
if (G_OBJECT_CLASS (clutter_effect_parent_class)->notify != NULL)
|
parent_class->set_enabled (meta, is_enabled);
|
||||||
G_OBJECT_CLASS (clutter_effect_parent_class)->notify (gobject, pspec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_effect_class_init (ClutterEffectClass *klass)
|
clutter_effect_class_init (ClutterEffectClass *klass)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
ClutterActorMetaClass *actor_meta_class = CLUTTER_ACTOR_META_CLASS (klass);
|
||||||
|
|
||||||
gobject_class->notify = clutter_effect_notify;
|
actor_meta_class->set_enabled = clutter_effect_set_enabled;
|
||||||
|
|
||||||
klass->pre_paint = clutter_effect_real_pre_paint;
|
klass->pre_paint = clutter_effect_real_pre_paint;
|
||||||
klass->post_paint = clutter_effect_real_post_paint;
|
klass->post_paint = clutter_effect_real_post_paint;
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ typedef enum /*< prefix=CLUTTER_REQUEST >*/
|
|||||||
* @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard for
|
* @CLUTTER_ANIMATION_LAST: last animation mode, used as a guard for
|
||||||
* registered global alpha functions
|
* registered global alpha functions
|
||||||
*
|
*
|
||||||
* The animation modes used by #ClutterAlpha and #ClutterAnimation. This
|
* The animation modes used by #ClutterAnimatable. This
|
||||||
* enumeration can be expanded in later versions of Clutter.
|
* enumeration can be expanded in later versions of Clutter.
|
||||||
*
|
*
|
||||||
* <figure id="easing-modes">
|
* <figure id="easing-modes">
|
||||||
@@ -387,44 +387,6 @@ typedef enum
|
|||||||
CLUTTER_MODIFIER_MASK = 0x5c001fff
|
CLUTTER_MODIFIER_MASK = 0x5c001fff
|
||||||
} ClutterModifierType;
|
} ClutterModifierType;
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterKeyboardA11yFlags:
|
|
||||||
* @CLUTTER_A11Y_KEYBOARD_ENABLED:
|
|
||||||
* @CLUTTER_A11Y_TIMEOUT_ENABLED:
|
|
||||||
* @CLUTTER_A11Y_MOUSE_KEYS_ENABLED:
|
|
||||||
* @CLUTTER_A11Y_SLOW_KEYS_ENABLED:
|
|
||||||
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS:
|
|
||||||
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT:
|
|
||||||
* @CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT:
|
|
||||||
* @CLUTTER_A11Y_BOUNCE_KEYS_ENABLED:
|
|
||||||
* @CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT:
|
|
||||||
* @CLUTTER_A11Y_TOGGLE_KEYS_ENABLED:
|
|
||||||
* @CLUTTER_A11Y_STICKY_KEYS_ENABLED:
|
|
||||||
* @CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF:
|
|
||||||
* @CLUTTER_A11Y_STICKY_KEYS_BEEP:
|
|
||||||
* @CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP:
|
|
||||||
*
|
|
||||||
* Keyboard accessibility features applied to a ClutterInputDevice keyboard.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
CLUTTER_A11Y_KEYBOARD_ENABLED = 1 << 0,
|
|
||||||
CLUTTER_A11Y_TIMEOUT_ENABLED = 1 << 1,
|
|
||||||
CLUTTER_A11Y_MOUSE_KEYS_ENABLED = 1 << 2,
|
|
||||||
CLUTTER_A11Y_SLOW_KEYS_ENABLED = 1 << 3,
|
|
||||||
CLUTTER_A11Y_SLOW_KEYS_BEEP_PRESS = 1 << 4,
|
|
||||||
CLUTTER_A11Y_SLOW_KEYS_BEEP_ACCEPT = 1 << 5,
|
|
||||||
CLUTTER_A11Y_SLOW_KEYS_BEEP_REJECT = 1 << 6,
|
|
||||||
CLUTTER_A11Y_BOUNCE_KEYS_ENABLED = 1 << 7,
|
|
||||||
CLUTTER_A11Y_BOUNCE_KEYS_BEEP_REJECT = 1 << 8,
|
|
||||||
CLUTTER_A11Y_TOGGLE_KEYS_ENABLED = 1 << 9,
|
|
||||||
CLUTTER_A11Y_STICKY_KEYS_ENABLED = 1 << 10,
|
|
||||||
CLUTTER_A11Y_STICKY_KEYS_TWO_KEY_OFF = 1 << 11,
|
|
||||||
CLUTTER_A11Y_STICKY_KEYS_BEEP = 1 << 12,
|
|
||||||
CLUTTER_A11Y_FEATURE_STATE_CHANGE_BEEP = 1 << 13,
|
|
||||||
} ClutterKeyboardA11yFlags;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterPointerA11yFlags:
|
* ClutterPointerA11yFlags:
|
||||||
* @CLUTTER_A11Y_POINTER_ENABLED:
|
* @CLUTTER_A11Y_POINTER_ENABLED:
|
||||||
@@ -554,32 +516,6 @@ typedef enum /*< prefix=CLUTTER_OFFSCREEN_REDIRECT >*/
|
|||||||
CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE = 1 << 2
|
CLUTTER_OFFSCREEN_REDIRECT_ON_IDLE = 1 << 2
|
||||||
} ClutterOffscreenRedirect;
|
} ClutterOffscreenRedirect;
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterAllocationFlags:
|
|
||||||
* @CLUTTER_ALLOCATION_NONE: No flag set
|
|
||||||
* @CLUTTER_ABSOLUTE_ORIGIN_CHANGED: Whether the absolute origin of the
|
|
||||||
* actor has changed; this implies that any ancestor of the actor has
|
|
||||||
* been moved.
|
|
||||||
* @CLUTTER_DELEGATE_LAYOUT: Whether the allocation should be delegated
|
|
||||||
* to the #ClutterLayoutManager instance stored inside the
|
|
||||||
* #ClutterActor:layout-manager property of #ClutterActor. This flag
|
|
||||||
* should only be used if you are subclassing #ClutterActor and
|
|
||||||
* overriding the #ClutterActorClass.allocate() virtual function, but
|
|
||||||
* you wish to use the default implementation of the virtual function
|
|
||||||
* inside #ClutterActor. Added in Clutter 1.10.
|
|
||||||
*
|
|
||||||
* Flags passed to the #ClutterActorClass.allocate() virtual function
|
|
||||||
* and to the clutter_actor_allocate() function.
|
|
||||||
*
|
|
||||||
* Since: 1.0
|
|
||||||
*/
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
CLUTTER_ALLOCATION_NONE = 0,
|
|
||||||
CLUTTER_ABSOLUTE_ORIGIN_CHANGED = 1 << 1,
|
|
||||||
CLUTTER_DELEGATE_LAYOUT = 1 << 2
|
|
||||||
} ClutterAllocationFlags;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterAlignAxis:
|
* ClutterAlignAxis:
|
||||||
* @CLUTTER_ALIGN_X_AXIS: Maintain the alignment on the X axis
|
* @CLUTTER_ALIGN_X_AXIS: Maintain the alignment on the X axis
|
||||||
@@ -883,7 +819,6 @@ typedef enum /*< flags prefix=CLUTTER_EVENT >*/
|
|||||||
* @CLUTTER_STAGE_STATE: Stage state change event
|
* @CLUTTER_STAGE_STATE: Stage state change event
|
||||||
* @CLUTTER_DESTROY_NOTIFY: Destroy notification event
|
* @CLUTTER_DESTROY_NOTIFY: Destroy notification event
|
||||||
* @CLUTTER_CLIENT_MESSAGE: Client message event
|
* @CLUTTER_CLIENT_MESSAGE: Client message event
|
||||||
* @CLUTTER_DELETE: Stage delete event
|
|
||||||
* @CLUTTER_TOUCH_BEGIN: A new touch event sequence has started;
|
* @CLUTTER_TOUCH_BEGIN: A new touch event sequence has started;
|
||||||
* event added in 1.10
|
* event added in 1.10
|
||||||
* @CLUTTER_TOUCH_UPDATE: A touch event sequence has been updated;
|
* @CLUTTER_TOUCH_UPDATE: A touch event sequence has been updated;
|
||||||
@@ -921,7 +856,6 @@ typedef enum /*< prefix=CLUTTER >*/
|
|||||||
CLUTTER_STAGE_STATE,
|
CLUTTER_STAGE_STATE,
|
||||||
CLUTTER_DESTROY_NOTIFY,
|
CLUTTER_DESTROY_NOTIFY,
|
||||||
CLUTTER_CLIENT_MESSAGE,
|
CLUTTER_CLIENT_MESSAGE,
|
||||||
CLUTTER_DELETE,
|
|
||||||
CLUTTER_TOUCH_BEGIN,
|
CLUTTER_TOUCH_BEGIN,
|
||||||
CLUTTER_TOUCH_UPDATE,
|
CLUTTER_TOUCH_UPDATE,
|
||||||
CLUTTER_TOUCH_END,
|
CLUTTER_TOUCH_END,
|
||||||
@@ -934,6 +868,8 @@ typedef enum /*< prefix=CLUTTER >*/
|
|||||||
CLUTTER_PAD_BUTTON_RELEASE,
|
CLUTTER_PAD_BUTTON_RELEASE,
|
||||||
CLUTTER_PAD_STRIP,
|
CLUTTER_PAD_STRIP,
|
||||||
CLUTTER_PAD_RING,
|
CLUTTER_PAD_RING,
|
||||||
|
CLUTTER_DEVICE_ADDED,
|
||||||
|
CLUTTER_DEVICE_REMOVED,
|
||||||
|
|
||||||
CLUTTER_EVENT_LAST /* helper */
|
CLUTTER_EVENT_LAST /* helper */
|
||||||
} ClutterEventType;
|
} ClutterEventType;
|
||||||
@@ -977,7 +913,6 @@ typedef enum
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterFeatureFlags:
|
* ClutterFeatureFlags:
|
||||||
* @CLUTTER_FEATURE_SWAP_THROTTLE: Set if backend throttles buffer swaps.
|
|
||||||
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
|
* @CLUTTER_FEATURE_STAGE_STATIC: Set if stage size if fixed (i.e framebuffer)
|
||||||
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
|
* @CLUTTER_FEATURE_STAGE_CURSOR: Set if stage has a graphical cursor.
|
||||||
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
|
* @CLUTTER_FEATURE_SHADERS_GLSL: Set if the backend supports GLSL shaders.
|
||||||
@@ -992,7 +927,6 @@ typedef enum
|
|||||||
*/
|
*/
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CLUTTER_FEATURE_SWAP_THROTTLE = (1 << 3),
|
|
||||||
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
|
CLUTTER_FEATURE_STAGE_STATIC = (1 << 6),
|
||||||
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
|
CLUTTER_FEATURE_STAGE_CURSOR = (1 << 8),
|
||||||
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
|
CLUTTER_FEATURE_SHADERS_GLSL = (1 << 9),
|
||||||
@@ -1343,8 +1277,6 @@ typedef enum
|
|||||||
* painting the stages
|
* painting the stages
|
||||||
* @CLUTTER_REPAINT_FLAGS_POST_PAINT: Run the repaint function after
|
* @CLUTTER_REPAINT_FLAGS_POST_PAINT: Run the repaint function after
|
||||||
* painting the stages
|
* painting the stages
|
||||||
* @CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD: Ensure that a new frame
|
|
||||||
* is queued after adding the repaint function
|
|
||||||
*
|
*
|
||||||
* Flags to pass to clutter_threads_add_repaint_func_full().
|
* Flags to pass to clutter_threads_add_repaint_func_full().
|
||||||
*
|
*
|
||||||
@@ -1354,7 +1286,6 @@ typedef enum
|
|||||||
{
|
{
|
||||||
CLUTTER_REPAINT_FLAGS_PRE_PAINT = 1 << 0,
|
CLUTTER_REPAINT_FLAGS_PRE_PAINT = 1 << 0,
|
||||||
CLUTTER_REPAINT_FLAGS_POST_PAINT = 1 << 1,
|
CLUTTER_REPAINT_FLAGS_POST_PAINT = 1 << 1,
|
||||||
CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD = 1 << 2
|
|
||||||
} ClutterRepaintFlags;
|
} ClutterRepaintFlags;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1663,12 +1594,6 @@ typedef enum
|
|||||||
CLUTTER_INPUT_DEVICE_PAD_SOURCE_FINGER,
|
CLUTTER_INPUT_DEVICE_PAD_SOURCE_FINGER,
|
||||||
} ClutterInputDevicePadSource;
|
} ClutterInputDevicePadSource;
|
||||||
|
|
||||||
typedef enum
|
|
||||||
{
|
|
||||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
|
|
||||||
CLUTTER_INPUT_DEVICE_MAPPING_RELATIVE,
|
|
||||||
} ClutterInputDeviceMapping;
|
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
CLUTTER_INPUT_CONTENT_HINT_COMPLETION = 1 << 0,
|
CLUTTER_INPUT_CONTENT_HINT_COMPLETION = 1 << 0,
|
||||||
|
|||||||
@@ -407,7 +407,6 @@ clutter_event_get_position (const ClutterEvent *event,
|
|||||||
case CLUTTER_STAGE_STATE:
|
case CLUTTER_STAGE_STATE:
|
||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
case CLUTTER_DELETE:
|
|
||||||
case CLUTTER_EVENT_LAST:
|
case CLUTTER_EVENT_LAST:
|
||||||
case CLUTTER_PROXIMITY_IN:
|
case CLUTTER_PROXIMITY_IN:
|
||||||
case CLUTTER_PROXIMITY_OUT:
|
case CLUTTER_PROXIMITY_OUT:
|
||||||
@@ -415,6 +414,8 @@ clutter_event_get_position (const ClutterEvent *event,
|
|||||||
case CLUTTER_PAD_BUTTON_RELEASE:
|
case CLUTTER_PAD_BUTTON_RELEASE:
|
||||||
case CLUTTER_PAD_STRIP:
|
case CLUTTER_PAD_STRIP:
|
||||||
case CLUTTER_PAD_RING:
|
case CLUTTER_PAD_RING:
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
graphene_point_init (position, 0.f, 0.f);
|
graphene_point_init (position, 0.f, 0.f);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -481,7 +482,6 @@ clutter_event_set_coords (ClutterEvent *event,
|
|||||||
case CLUTTER_STAGE_STATE:
|
case CLUTTER_STAGE_STATE:
|
||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
case CLUTTER_DELETE:
|
|
||||||
case CLUTTER_EVENT_LAST:
|
case CLUTTER_EVENT_LAST:
|
||||||
case CLUTTER_PROXIMITY_IN:
|
case CLUTTER_PROXIMITY_IN:
|
||||||
case CLUTTER_PROXIMITY_OUT:
|
case CLUTTER_PROXIMITY_OUT:
|
||||||
@@ -489,6 +489,8 @@ clutter_event_set_coords (ClutterEvent *event,
|
|||||||
case CLUTTER_PAD_BUTTON_RELEASE:
|
case CLUTTER_PAD_BUTTON_RELEASE:
|
||||||
case CLUTTER_PAD_STRIP:
|
case CLUTTER_PAD_STRIP:
|
||||||
case CLUTTER_PAD_RING:
|
case CLUTTER_PAD_RING:
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_ENTER:
|
case CLUTTER_ENTER:
|
||||||
@@ -1105,7 +1107,6 @@ clutter_event_set_device (ClutterEvent *event,
|
|||||||
case CLUTTER_STAGE_STATE:
|
case CLUTTER_STAGE_STATE:
|
||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
case CLUTTER_DELETE:
|
|
||||||
case CLUTTER_EVENT_LAST:
|
case CLUTTER_EVENT_LAST:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1161,6 +1162,11 @@ clutter_event_set_device (ClutterEvent *event,
|
|||||||
case CLUTTER_PAD_RING:
|
case CLUTTER_PAD_RING:
|
||||||
event->pad_ring.device = device;
|
event->pad_ring.device = device;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
|
event->device.device = device;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1202,7 +1208,6 @@ clutter_event_get_device (const ClutterEvent *event)
|
|||||||
case CLUTTER_STAGE_STATE:
|
case CLUTTER_STAGE_STATE:
|
||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
case CLUTTER_DELETE:
|
|
||||||
case CLUTTER_EVENT_LAST:
|
case CLUTTER_EVENT_LAST:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1258,6 +1263,11 @@ clutter_event_get_device (const ClutterEvent *event)
|
|||||||
case CLUTTER_PAD_RING:
|
case CLUTTER_PAD_RING:
|
||||||
device = event->pad_ring.device;
|
device = event->pad_ring.device;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
|
device = event->device.device;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
@@ -1411,6 +1421,8 @@ clutter_event_copy (const ClutterEvent *event)
|
|||||||
sizeof (gdouble) * n_axes);
|
sizeof (gdouble) * n_axes);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1465,6 +1477,9 @@ clutter_event_free (ClutterEvent *event)
|
|||||||
case CLUTTER_TOUCH_CANCEL:
|
case CLUTTER_TOUCH_CANCEL:
|
||||||
g_free (event->touch.axes);
|
g_free (event->touch.axes);
|
||||||
break;
|
break;
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -1489,40 +1504,17 @@ ClutterEvent *
|
|||||||
clutter_event_get (void)
|
clutter_event_get (void)
|
||||||
{
|
{
|
||||||
ClutterMainContext *context = _clutter_context_get_default ();
|
ClutterMainContext *context = _clutter_context_get_default ();
|
||||||
|
ClutterEvent *event;
|
||||||
|
|
||||||
if (context->events_queue == NULL)
|
event = g_async_queue_try_pop (context->events_queue);
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (g_queue_is_empty (context->events_queue))
|
return event;
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return g_queue_pop_tail (context->events_queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
static gboolean
|
||||||
* clutter_event_peek:
|
spin_context (gpointer data)
|
||||||
*
|
|
||||||
* Returns a pointer to the first event from the event queue but
|
|
||||||
* does not remove it.
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): A #ClutterEvent or NULL if queue empty.
|
|
||||||
*
|
|
||||||
* Since: 0.4
|
|
||||||
*/
|
|
||||||
ClutterEvent *
|
|
||||||
clutter_event_peek (void)
|
|
||||||
{
|
{
|
||||||
ClutterMainContext *context = _clutter_context_get_default ();
|
return G_SOURCE_REMOVE;
|
||||||
|
|
||||||
g_return_val_if_fail (context != NULL, NULL);
|
|
||||||
|
|
||||||
if (context->events_queue == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
if (g_queue_is_empty (context->events_queue))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return g_queue_peek_tail (context->events_queue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1530,21 +1522,9 @@ _clutter_event_push (const ClutterEvent *event,
|
|||||||
gboolean do_copy)
|
gboolean do_copy)
|
||||||
{
|
{
|
||||||
ClutterMainContext *context = _clutter_context_get_default ();
|
ClutterMainContext *context = _clutter_context_get_default ();
|
||||||
ClutterInputDevice *device;
|
|
||||||
|
|
||||||
g_assert (context != NULL);
|
g_assert (context != NULL);
|
||||||
|
|
||||||
if (context->events_queue == NULL)
|
|
||||||
context->events_queue = g_queue_new ();
|
|
||||||
|
|
||||||
/* disabled devices don't propagate events */
|
|
||||||
device = clutter_event_get_device (event);
|
|
||||||
if (device != NULL)
|
|
||||||
{
|
|
||||||
if (!clutter_input_device_get_enabled (device))
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (do_copy)
|
if (do_copy)
|
||||||
{
|
{
|
||||||
ClutterEvent *copy;
|
ClutterEvent *copy;
|
||||||
@@ -1553,7 +1533,8 @@ _clutter_event_push (const ClutterEvent *event,
|
|||||||
event = copy;
|
event = copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
g_queue_push_head (context->events_queue, (gpointer) event);
|
g_async_queue_push (context->events_queue, (gpointer) event);
|
||||||
|
g_idle_add (spin_context, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1590,10 +1571,7 @@ clutter_events_pending (void)
|
|||||||
|
|
||||||
g_return_val_if_fail (context != NULL, FALSE);
|
g_return_val_if_fail (context != NULL, FALSE);
|
||||||
|
|
||||||
if (context->events_queue == NULL)
|
return g_async_queue_length (context->events_queue) > 0;
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return g_queue_is_empty (context->events_queue) == FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1725,7 +1703,6 @@ clutter_event_get_axes (const ClutterEvent *event,
|
|||||||
case CLUTTER_STAGE_STATE:
|
case CLUTTER_STAGE_STATE:
|
||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
case CLUTTER_DELETE:
|
|
||||||
case CLUTTER_ENTER:
|
case CLUTTER_ENTER:
|
||||||
case CLUTTER_LEAVE:
|
case CLUTTER_LEAVE:
|
||||||
case CLUTTER_KEY_PRESS:
|
case CLUTTER_KEY_PRESS:
|
||||||
@@ -1733,6 +1710,8 @@ clutter_event_get_axes (const ClutterEvent *event,
|
|||||||
case CLUTTER_EVENT_LAST:
|
case CLUTTER_EVENT_LAST:
|
||||||
case CLUTTER_PROXIMITY_IN:
|
case CLUTTER_PROXIMITY_IN:
|
||||||
case CLUTTER_PROXIMITY_OUT:
|
case CLUTTER_PROXIMITY_OUT:
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_SCROLL:
|
case CLUTTER_SCROLL:
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ typedef struct _ClutterProximityEvent ClutterProximityEvent;
|
|||||||
typedef struct _ClutterPadButtonEvent ClutterPadButtonEvent;
|
typedef struct _ClutterPadButtonEvent ClutterPadButtonEvent;
|
||||||
typedef struct _ClutterPadStripEvent ClutterPadStripEvent;
|
typedef struct _ClutterPadStripEvent ClutterPadStripEvent;
|
||||||
typedef struct _ClutterPadRingEvent ClutterPadRingEvent;
|
typedef struct _ClutterPadRingEvent ClutterPadRingEvent;
|
||||||
|
typedef struct _ClutterDeviceEvent ClutterDeviceEvent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterAnyEvent:
|
* ClutterAnyEvent:
|
||||||
@@ -544,6 +545,17 @@ struct _ClutterPadRingEvent
|
|||||||
guint32 mode;
|
guint32 mode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct _ClutterDeviceEvent
|
||||||
|
{
|
||||||
|
ClutterEventType type;
|
||||||
|
guint32 time;
|
||||||
|
ClutterEventFlags flags;
|
||||||
|
ClutterStage *stage;
|
||||||
|
ClutterActor *source;
|
||||||
|
|
||||||
|
ClutterInputDevice *device;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterEvent:
|
* ClutterEvent:
|
||||||
*
|
*
|
||||||
@@ -570,6 +582,7 @@ union _ClutterEvent
|
|||||||
ClutterPadButtonEvent pad_button;
|
ClutterPadButtonEvent pad_button;
|
||||||
ClutterPadStripEvent pad_strip;
|
ClutterPadStripEvent pad_strip;
|
||||||
ClutterPadRingEvent pad_ring;
|
ClutterPadRingEvent pad_ring;
|
||||||
|
ClutterDeviceEvent device;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -601,8 +614,6 @@ gboolean clutter_events_pending (void);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterEvent * clutter_event_get (void);
|
ClutterEvent * clutter_event_get (void);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterEvent * clutter_event_peek (void);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_event_put (const ClutterEvent *event);
|
void clutter_event_put (const ClutterEvent *event);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
|
|||||||
@@ -131,8 +131,7 @@ clutter_fixed_layout_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
static void
|
static void
|
||||||
clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
|
clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation,
|
const ClutterActorBox *allocation)
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
{
|
||||||
ClutterActor *child;
|
ClutterActor *child;
|
||||||
|
|
||||||
@@ -140,7 +139,11 @@ clutter_fixed_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
child != NULL;
|
child != NULL;
|
||||||
child = clutter_actor_get_next_sibling (child))
|
child = clutter_actor_get_next_sibling (child))
|
||||||
{
|
{
|
||||||
clutter_actor_allocate_preferred_size (child, flags);
|
float x = 0.f;
|
||||||
|
float y = 0.f;
|
||||||
|
|
||||||
|
clutter_actor_get_fixed_position (child, &x, &y);
|
||||||
|
clutter_actor_allocate_preferred_size (child, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -566,8 +566,7 @@ clutter_flow_layout_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
static void
|
static void
|
||||||
clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation,
|
const ClutterActorBox *allocation)
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
{
|
||||||
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
|
ClutterFlowLayoutPrivate *priv = CLUTTER_FLOW_LAYOUT (manager)->priv;
|
||||||
ClutterActor *actor, *child;
|
ClutterActor *actor, *child;
|
||||||
@@ -729,7 +728,7 @@ clutter_flow_layout_allocate (ClutterLayoutManager *manager,
|
|||||||
child_alloc.y1 = ceil (item_y);
|
child_alloc.y1 = ceil (item_y);
|
||||||
child_alloc.x2 = ceil (child_alloc.x1 + item_width);
|
child_alloc.x2 = ceil (child_alloc.x1 + item_width);
|
||||||
child_alloc.y2 = ceil (child_alloc.y1 + item_height);
|
child_alloc.y2 = ceil (child_alloc.y1 + item_height);
|
||||||
clutter_actor_allocate (child, &child_alloc, flags);
|
clutter_actor_allocate (child, &child_alloc);
|
||||||
|
|
||||||
if (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
|
if (priv->orientation == CLUTTER_FLOW_HORIZONTAL)
|
||||||
item_x = new_x;
|
item_x = new_x;
|
||||||
|
|||||||
550
clutter/clutter/clutter-frame-clock.c
Normal file
550
clutter/clutter/clutter-frame-clock.c
Normal file
@@ -0,0 +1,550 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "clutter-build-config.h"
|
||||||
|
|
||||||
|
#include "clutter/clutter-frame-clock.h"
|
||||||
|
|
||||||
|
#include "clutter/clutter-main.h"
|
||||||
|
#include "clutter/clutter-private.h"
|
||||||
|
#include "clutter/clutter-timeline-private.h"
|
||||||
|
#include "cogl/cogl-trace.h"
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
DESTROY,
|
||||||
|
|
||||||
|
N_SIGNALS
|
||||||
|
};
|
||||||
|
|
||||||
|
static guint signals[N_SIGNALS];
|
||||||
|
|
||||||
|
/* Wait 2ms after vblank before starting to draw next frame */
|
||||||
|
#define SYNC_DELAY_US ms2us (2)
|
||||||
|
|
||||||
|
typedef struct _ClutterFrameListener
|
||||||
|
{
|
||||||
|
const ClutterFrameListenerIface *iface;
|
||||||
|
gpointer user_data;
|
||||||
|
} ClutterFrameListener;
|
||||||
|
|
||||||
|
typedef struct _ClutterClockSource
|
||||||
|
{
|
||||||
|
GSource source;
|
||||||
|
|
||||||
|
ClutterFrameClock *frame_clock;
|
||||||
|
} ClutterClockSource;
|
||||||
|
|
||||||
|
typedef enum _ClutterFrameClockState
|
||||||
|
{
|
||||||
|
CLUTTER_FRAME_CLOCK_STATE_INIT,
|
||||||
|
CLUTTER_FRAME_CLOCK_STATE_IDLE,
|
||||||
|
CLUTTER_FRAME_CLOCK_STATE_SCHEDULED,
|
||||||
|
CLUTTER_FRAME_CLOCK_STATE_DISPATCHING,
|
||||||
|
CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED,
|
||||||
|
} ClutterFrameClockState;
|
||||||
|
|
||||||
|
struct _ClutterFrameClock
|
||||||
|
{
|
||||||
|
GObject parent;
|
||||||
|
|
||||||
|
float refresh_rate;
|
||||||
|
ClutterFrameListener listener;
|
||||||
|
|
||||||
|
GSource *source;
|
||||||
|
|
||||||
|
int64_t frame_count;
|
||||||
|
|
||||||
|
ClutterFrameClockState state;
|
||||||
|
int64_t last_presentation_time_us;
|
||||||
|
|
||||||
|
gboolean is_next_presentation_time_valid;
|
||||||
|
int64_t next_presentation_time_us;
|
||||||
|
|
||||||
|
gboolean pending_reschedule;
|
||||||
|
gboolean pending_reschedule_now;
|
||||||
|
|
||||||
|
int inhibit_count;
|
||||||
|
|
||||||
|
GList *timelines;
|
||||||
|
};
|
||||||
|
|
||||||
|
G_DEFINE_TYPE (ClutterFrameClock, clutter_frame_clock,
|
||||||
|
G_TYPE_OBJECT)
|
||||||
|
|
||||||
|
float
|
||||||
|
clutter_frame_clock_get_refresh_rate (ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
return frame_clock->refresh_rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_frame_clock_add_timeline (ClutterFrameClock *frame_clock,
|
||||||
|
ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
gboolean is_first;
|
||||||
|
|
||||||
|
if (g_list_find (frame_clock->timelines, timeline))
|
||||||
|
return;
|
||||||
|
|
||||||
|
is_first = !frame_clock->timelines;
|
||||||
|
|
||||||
|
frame_clock->timelines = g_list_prepend (frame_clock->timelines, timeline);
|
||||||
|
|
||||||
|
if (is_first)
|
||||||
|
clutter_frame_clock_schedule_update (frame_clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_frame_clock_remove_timeline (ClutterFrameClock *frame_clock,
|
||||||
|
ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
frame_clock->timelines = g_list_remove (frame_clock->timelines, timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
advance_timelines (ClutterFrameClock *frame_clock,
|
||||||
|
int64_t time_us)
|
||||||
|
{
|
||||||
|
GList *timelines;
|
||||||
|
GList *l;
|
||||||
|
|
||||||
|
/* we protect ourselves from timelines being removed during
|
||||||
|
* the advancement by other timelines by copying the list of
|
||||||
|
* timelines, taking a reference on them, iterating over the
|
||||||
|
* copied list and then releasing the reference.
|
||||||
|
*
|
||||||
|
* we cannot simply take a reference on the timelines and still
|
||||||
|
* use the list held by the master clock because the do_tick()
|
||||||
|
* might result in the creation of a new timeline, which gets
|
||||||
|
* added at the end of the list with no reference increase and
|
||||||
|
* thus gets disposed at the end of the iteration.
|
||||||
|
*
|
||||||
|
* this implies that a newly added timeline will not be advanced
|
||||||
|
* by this clock iteration, which is perfectly fine since we're
|
||||||
|
* in its first cycle.
|
||||||
|
*
|
||||||
|
* we also cannot steal the frame clock timelines list because
|
||||||
|
* a timeline might be removed as the direct result of do_tick()
|
||||||
|
* and remove_timeline() would not find the timeline, failing
|
||||||
|
* and leaving a dangling pointer behind.
|
||||||
|
*/
|
||||||
|
|
||||||
|
timelines = g_list_copy (frame_clock->timelines);
|
||||||
|
g_list_foreach (timelines, (GFunc) g_object_ref, NULL);
|
||||||
|
|
||||||
|
for (l = timelines; l; l = l->next)
|
||||||
|
{
|
||||||
|
ClutterTimeline *timeline = l->data;
|
||||||
|
|
||||||
|
_clutter_timeline_do_tick (timeline, time_us / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
g_list_free_full (timelines, g_object_unref);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
maybe_reschedule_update (ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
if (frame_clock->pending_reschedule ||
|
||||||
|
frame_clock->timelines)
|
||||||
|
{
|
||||||
|
frame_clock->pending_reschedule = FALSE;
|
||||||
|
|
||||||
|
if (frame_clock->pending_reschedule_now)
|
||||||
|
{
|
||||||
|
frame_clock->pending_reschedule_now = FALSE;
|
||||||
|
clutter_frame_clock_schedule_update_now (frame_clock);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clutter_frame_clock_schedule_update (frame_clock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
|
||||||
|
ClutterFrameInfo *frame_info)
|
||||||
|
{
|
||||||
|
int64_t presentation_time_us = frame_info->presentation_time;
|
||||||
|
|
||||||
|
if (presentation_time_us > frame_clock->last_presentation_time_us ||
|
||||||
|
((presentation_time_us - frame_clock->last_presentation_time_us) >
|
||||||
|
INT64_MAX / 2))
|
||||||
|
{
|
||||||
|
frame_clock->last_presentation_time_us = presentation_time_us;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_warning_once ("Bogus presentation time %" G_GINT64_FORMAT
|
||||||
|
" travelled back in time, using current time.",
|
||||||
|
presentation_time_us);
|
||||||
|
frame_clock->last_presentation_time_us = g_get_monotonic_time ();
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (frame_clock->state)
|
||||||
|
{
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_INIT:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_IDLE:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
|
||||||
|
g_warn_if_reached ();
|
||||||
|
break;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
|
||||||
|
frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_IDLE;
|
||||||
|
maybe_reschedule_update (frame_clock);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
calculate_next_update_time_us (ClutterFrameClock *frame_clock,
|
||||||
|
int64_t *out_next_update_time_us,
|
||||||
|
int64_t *out_next_presentation_time_us)
|
||||||
|
{
|
||||||
|
int64_t last_presentation_time_us;
|
||||||
|
int64_t now_us;
|
||||||
|
float refresh_rate;
|
||||||
|
int64_t refresh_interval_us;
|
||||||
|
int64_t min_render_time_allowed_us;
|
||||||
|
int64_t max_render_time_allowed_us;
|
||||||
|
int64_t last_next_presentation_time_us;
|
||||||
|
int64_t time_since_last_next_presentation_time_us;
|
||||||
|
int64_t next_presentation_time_us;
|
||||||
|
int64_t next_update_time_us;
|
||||||
|
|
||||||
|
now_us = g_get_monotonic_time ();
|
||||||
|
|
||||||
|
refresh_rate = frame_clock->refresh_rate;
|
||||||
|
refresh_interval_us = (int64_t) (0.5 + G_USEC_PER_SEC / refresh_rate);
|
||||||
|
|
||||||
|
min_render_time_allowed_us = refresh_interval_us / 2;
|
||||||
|
max_render_time_allowed_us = refresh_interval_us - SYNC_DELAY_US;
|
||||||
|
|
||||||
|
if (min_render_time_allowed_us > max_render_time_allowed_us)
|
||||||
|
min_render_time_allowed_us = max_render_time_allowed_us;
|
||||||
|
|
||||||
|
last_presentation_time_us = frame_clock->last_presentation_time_us;
|
||||||
|
next_presentation_time_us = last_presentation_time_us + refresh_interval_us;
|
||||||
|
|
||||||
|
/* Skip ahead to get close to the actual next presentation time. */
|
||||||
|
if (next_presentation_time_us < now_us)
|
||||||
|
{
|
||||||
|
int64_t logical_clock_offset_us;
|
||||||
|
int64_t logical_clock_phase_us;
|
||||||
|
int64_t hw_clock_offset_us;
|
||||||
|
|
||||||
|
logical_clock_offset_us = now_us % refresh_interval_us;
|
||||||
|
logical_clock_phase_us = now_us - logical_clock_offset_us;
|
||||||
|
hw_clock_offset_us = last_presentation_time_us % refresh_interval_us;
|
||||||
|
|
||||||
|
next_presentation_time_us = logical_clock_phase_us + hw_clock_offset_us;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Skip one interval if we got an early presented event. */
|
||||||
|
last_next_presentation_time_us = frame_clock->next_presentation_time_us;
|
||||||
|
time_since_last_next_presentation_time_us =
|
||||||
|
next_presentation_time_us - last_next_presentation_time_us;
|
||||||
|
if (frame_clock->is_next_presentation_time_valid &&
|
||||||
|
time_since_last_next_presentation_time_us < (refresh_interval_us / 2))
|
||||||
|
{
|
||||||
|
next_presentation_time_us =
|
||||||
|
frame_clock->next_presentation_time_us + refresh_interval_us;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (next_presentation_time_us < now_us + min_render_time_allowed_us)
|
||||||
|
next_presentation_time_us += refresh_interval_us;
|
||||||
|
|
||||||
|
next_update_time_us = next_presentation_time_us - max_render_time_allowed_us;
|
||||||
|
|
||||||
|
*out_next_update_time_us = next_update_time_us;
|
||||||
|
*out_next_presentation_time_us = next_presentation_time_us;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_frame_clock_inhibit (ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
frame_clock->inhibit_count++;
|
||||||
|
|
||||||
|
if (frame_clock->inhibit_count == 1)
|
||||||
|
{
|
||||||
|
switch (frame_clock->state)
|
||||||
|
{
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_INIT:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_IDLE:
|
||||||
|
break;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
|
||||||
|
frame_clock->pending_reschedule = TRUE;
|
||||||
|
frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_IDLE;
|
||||||
|
break;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_source_set_ready_time (frame_clock->source, -1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_frame_clock_uninhibit (ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
g_return_if_fail (frame_clock->inhibit_count > 0);
|
||||||
|
|
||||||
|
frame_clock->inhibit_count--;
|
||||||
|
|
||||||
|
if (frame_clock->inhibit_count == 0)
|
||||||
|
maybe_reschedule_update (frame_clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_frame_clock_schedule_update_now (ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
int64_t next_update_time_us = -1;
|
||||||
|
|
||||||
|
if (frame_clock->inhibit_count > 0)
|
||||||
|
{
|
||||||
|
frame_clock->pending_reschedule = TRUE;
|
||||||
|
frame_clock->pending_reschedule_now = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (frame_clock->state)
|
||||||
|
{
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_INIT:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_IDLE:
|
||||||
|
next_update_time_us = g_get_monotonic_time ();
|
||||||
|
break;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
|
||||||
|
return;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
|
||||||
|
frame_clock->pending_reschedule = TRUE;
|
||||||
|
frame_clock->pending_reschedule_now = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_warn_if_fail (next_update_time_us != -1);
|
||||||
|
|
||||||
|
g_source_set_ready_time (frame_clock->source, next_update_time_us);
|
||||||
|
frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_SCHEDULED;
|
||||||
|
frame_clock->is_next_presentation_time_valid = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_frame_clock_schedule_update (ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
int64_t next_update_time_us = -1;
|
||||||
|
|
||||||
|
if (frame_clock->inhibit_count > 0)
|
||||||
|
{
|
||||||
|
frame_clock->pending_reschedule = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (frame_clock->state)
|
||||||
|
{
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_INIT:
|
||||||
|
next_update_time_us = g_get_monotonic_time ();
|
||||||
|
break;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_IDLE:
|
||||||
|
calculate_next_update_time_us (frame_clock,
|
||||||
|
&next_update_time_us,
|
||||||
|
&frame_clock->next_presentation_time_us);
|
||||||
|
frame_clock->is_next_presentation_time_valid = TRUE;
|
||||||
|
break;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
|
||||||
|
return;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
|
||||||
|
frame_clock->pending_reschedule = TRUE;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
g_warn_if_fail (next_update_time_us != -1);
|
||||||
|
|
||||||
|
g_source_set_ready_time (frame_clock->source, next_update_time_us);
|
||||||
|
frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_SCHEDULED;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock,
|
||||||
|
int64_t time_us)
|
||||||
|
{
|
||||||
|
int64_t frame_count;
|
||||||
|
ClutterFrameResult result;
|
||||||
|
|
||||||
|
COGL_TRACE_BEGIN_SCOPED (ClutterFrameCLockDispatch, "Frame Clock (dispatch)");
|
||||||
|
|
||||||
|
g_source_set_ready_time (frame_clock->source, -1);
|
||||||
|
|
||||||
|
frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_DISPATCHING;
|
||||||
|
|
||||||
|
frame_count = frame_clock->frame_count++;
|
||||||
|
|
||||||
|
COGL_TRACE_BEGIN (ClutterFrameClockEvents, "Frame Clock (before frame)");
|
||||||
|
if (frame_clock->listener.iface->before_frame)
|
||||||
|
{
|
||||||
|
frame_clock->listener.iface->before_frame (frame_clock,
|
||||||
|
frame_count,
|
||||||
|
frame_clock->listener.user_data);
|
||||||
|
}
|
||||||
|
COGL_TRACE_END (ClutterFrameClockEvents);
|
||||||
|
|
||||||
|
COGL_TRACE_BEGIN (ClutterFrameClockTimelines, "Frame Clock (timelines)");
|
||||||
|
advance_timelines (frame_clock, time_us);
|
||||||
|
COGL_TRACE_END (ClutterFrameClockTimelines);
|
||||||
|
|
||||||
|
COGL_TRACE_BEGIN (ClutterFrameClockFrame, "Frame Clock (frame)");
|
||||||
|
result = frame_clock->listener.iface->frame (frame_clock,
|
||||||
|
frame_count,
|
||||||
|
time_us,
|
||||||
|
frame_clock->listener.user_data);
|
||||||
|
COGL_TRACE_END (ClutterFrameClockFrame);
|
||||||
|
|
||||||
|
switch (frame_clock->state)
|
||||||
|
{
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_INIT:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED:
|
||||||
|
g_warn_if_reached ();
|
||||||
|
break;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_IDLE:
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_SCHEDULED:
|
||||||
|
break;
|
||||||
|
case CLUTTER_FRAME_CLOCK_STATE_DISPATCHING:
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case CLUTTER_FRAME_RESULT_PENDING_PRESENTED:
|
||||||
|
frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_PENDING_PRESENTED;
|
||||||
|
break;
|
||||||
|
case CLUTTER_FRAME_RESULT_IDLE:
|
||||||
|
frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_IDLE;
|
||||||
|
maybe_reschedule_update (frame_clock);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
frame_clock_source_dispatch (GSource *source,
|
||||||
|
GSourceFunc callback,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
ClutterClockSource *clock_source = (ClutterClockSource *) source;
|
||||||
|
ClutterFrameClock *frame_clock = clock_source->frame_clock;
|
||||||
|
int64_t dispatch_time_us;
|
||||||
|
|
||||||
|
dispatch_time_us = g_source_get_time (source);
|
||||||
|
clutter_frame_clock_dispatch (frame_clock, dispatch_time_us);
|
||||||
|
|
||||||
|
return G_SOURCE_CONTINUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static GSourceFuncs frame_clock_source_funcs = {
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
frame_clock_source_dispatch,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_frame_clock_source (ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
GSource *source;
|
||||||
|
ClutterClockSource *clock_source;
|
||||||
|
g_autofree char *name = NULL;
|
||||||
|
|
||||||
|
source = g_source_new (&frame_clock_source_funcs, sizeof (ClutterClockSource));
|
||||||
|
clock_source = (ClutterClockSource *) source;
|
||||||
|
|
||||||
|
name = g_strdup_printf ("Clutter frame clock (%p)", frame_clock);
|
||||||
|
g_source_set_name (source, name);
|
||||||
|
g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW);
|
||||||
|
g_source_set_can_recurse (source, FALSE);
|
||||||
|
clock_source->frame_clock = frame_clock;
|
||||||
|
|
||||||
|
frame_clock->source = source;
|
||||||
|
g_source_attach (source, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
ClutterFrameClock *
|
||||||
|
clutter_frame_clock_new (float refresh_rate,
|
||||||
|
const ClutterFrameListenerIface *iface,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
ClutterFrameClock *frame_clock;
|
||||||
|
|
||||||
|
g_assert_cmpfloat (refresh_rate, >, 0.0);
|
||||||
|
|
||||||
|
frame_clock = g_object_new (CLUTTER_TYPE_FRAME_CLOCK, NULL);
|
||||||
|
|
||||||
|
frame_clock->listener.iface = iface;
|
||||||
|
frame_clock->listener.user_data = user_data;
|
||||||
|
|
||||||
|
init_frame_clock_source (frame_clock);
|
||||||
|
|
||||||
|
frame_clock->refresh_rate = refresh_rate;
|
||||||
|
|
||||||
|
return frame_clock;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_frame_clock_destroy (ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
g_object_run_dispose (G_OBJECT (frame_clock));
|
||||||
|
g_object_unref (frame_clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_frame_clock_dispose (GObject *object)
|
||||||
|
{
|
||||||
|
ClutterFrameClock *frame_clock = CLUTTER_FRAME_CLOCK (object);
|
||||||
|
|
||||||
|
if (frame_clock->source)
|
||||||
|
{
|
||||||
|
g_signal_emit (frame_clock, signals[DESTROY], 0);
|
||||||
|
g_source_destroy (frame_clock->source);
|
||||||
|
g_clear_pointer (&frame_clock->source, g_source_unref);
|
||||||
|
}
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (clutter_frame_clock_parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_frame_clock_init (ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
frame_clock->state = CLUTTER_FRAME_CLOCK_STATE_INIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_frame_clock_class_init (ClutterFrameClockClass *klass)
|
||||||
|
{
|
||||||
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
|
object_class->dispose = clutter_frame_clock_dispose;
|
||||||
|
|
||||||
|
signals[DESTROY] =
|
||||||
|
g_signal_new (I_("destroy"),
|
||||||
|
G_TYPE_FROM_CLASS (object_class),
|
||||||
|
G_SIGNAL_RUN_LAST,
|
||||||
|
0,
|
||||||
|
NULL, NULL, NULL,
|
||||||
|
G_TYPE_NONE,
|
||||||
|
0);
|
||||||
|
}
|
||||||
87
clutter/clutter/clutter-frame-clock.h
Normal file
87
clutter/clutter/clutter-frame-clock.h
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2019 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef CLUTTER_FRAME_CLOCK_H
|
||||||
|
#define CLUTTER_FRAME_CLOCK_H
|
||||||
|
|
||||||
|
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
||||||
|
#error "Only <clutter/clutter.h> can be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <glib.h>
|
||||||
|
#include <glib-object.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include "clutter/clutter-types.h"
|
||||||
|
|
||||||
|
typedef enum _ClutterFrameResult
|
||||||
|
{
|
||||||
|
CLUTTER_FRAME_RESULT_PENDING_PRESENTED,
|
||||||
|
CLUTTER_FRAME_RESULT_IDLE,
|
||||||
|
} ClutterFrameResult;
|
||||||
|
|
||||||
|
#define CLUTTER_TYPE_FRAME_CLOCK (clutter_frame_clock_get_type ())
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
G_DECLARE_FINAL_TYPE (ClutterFrameClock, clutter_frame_clock,
|
||||||
|
CLUTTER, FRAME_CLOCK,
|
||||||
|
GObject)
|
||||||
|
|
||||||
|
typedef struct _ClutterFrameListenerIface
|
||||||
|
{
|
||||||
|
void (* before_frame) (ClutterFrameClock *frame_clock,
|
||||||
|
int64_t frame_count,
|
||||||
|
gpointer user_data);
|
||||||
|
ClutterFrameResult (* frame) (ClutterFrameClock *frame_clock,
|
||||||
|
int64_t frame_count,
|
||||||
|
int64_t time_us,
|
||||||
|
gpointer user_data);
|
||||||
|
} ClutterFrameListenerIface;
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterFrameClock * clutter_frame_clock_new (float refresh_rate,
|
||||||
|
const ClutterFrameListenerIface *iface,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_frame_clock_destroy (ClutterFrameClock *frame_clock);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock,
|
||||||
|
ClutterFrameInfo *frame_info);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_frame_clock_schedule_update (ClutterFrameClock *frame_clock);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_frame_clock_schedule_update_now (ClutterFrameClock *frame_clock);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_frame_clock_inhibit (ClutterFrameClock *frame_clock);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_frame_clock_uninhibit (ClutterFrameClock *frame_clock);
|
||||||
|
|
||||||
|
void clutter_frame_clock_add_timeline (ClutterFrameClock *frame_clock,
|
||||||
|
ClutterTimeline *timeline);
|
||||||
|
|
||||||
|
void clutter_frame_clock_remove_timeline (ClutterFrameClock *frame_clock,
|
||||||
|
ClutterTimeline *timeline);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
float clutter_frame_clock_get_refresh_rate (ClutterFrameClock *frame_clock);
|
||||||
|
|
||||||
|
#endif /* CLUTTER_FRAME_CLOCK_H */
|
||||||
@@ -157,7 +157,8 @@ G_DEFINE_TYPE_WITH_PRIVATE (ClutterGestureAction, clutter_gesture_action, CLUTTE
|
|||||||
static GesturePoint *
|
static GesturePoint *
|
||||||
gesture_register_point (ClutterGestureAction *action, ClutterEvent *event)
|
gesture_register_point (ClutterGestureAction *action, ClutterEvent *event)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv = action->priv;
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (action);
|
||||||
GesturePoint *point = NULL;
|
GesturePoint *point = NULL;
|
||||||
|
|
||||||
if (priv->points->len >= MAX_GESTURE_POINTS)
|
if (priv->points->len >= MAX_GESTURE_POINTS)
|
||||||
@@ -190,7 +191,8 @@ gesture_find_point (ClutterGestureAction *action,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
gint *position)
|
gint *position)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv = action->priv;
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (action);
|
||||||
GesturePoint *point = NULL;
|
GesturePoint *point = NULL;
|
||||||
ClutterEventType type = clutter_event_type (event);
|
ClutterEventType type = clutter_event_type (event);
|
||||||
ClutterInputDevice *device = clutter_event_get_device (event);
|
ClutterInputDevice *device = clutter_event_get_device (event);
|
||||||
@@ -220,9 +222,10 @@ gesture_find_point (ClutterGestureAction *action,
|
|||||||
static void
|
static void
|
||||||
gesture_unregister_point (ClutterGestureAction *action, gint position)
|
gesture_unregister_point (ClutterGestureAction *action, gint position)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv = action->priv;
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
if (action->priv->points->len == 0)
|
if (priv->points->len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_array_remove_index (priv->points, position);
|
g_array_remove_index (priv->points, position);
|
||||||
@@ -303,7 +306,8 @@ gesture_point_unset (GesturePoint *point)
|
|||||||
static void
|
static void
|
||||||
cancel_gesture (ClutterGestureAction *action)
|
cancel_gesture (ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv = action->priv;
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (action);
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
|
|
||||||
priv->in_gesture = FALSE;
|
priv->in_gesture = FALSE;
|
||||||
@@ -313,14 +317,15 @@ cancel_gesture (ClutterGestureAction *action)
|
|||||||
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
actor = clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (action));
|
||||||
g_signal_emit (action, gesture_signals[GESTURE_CANCEL], 0, actor);
|
g_signal_emit (action, gesture_signals[GESTURE_CANCEL], 0, actor);
|
||||||
|
|
||||||
g_array_set_size (action->priv->points, 0);
|
g_array_set_size (priv->points, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
begin_gesture (ClutterGestureAction *action,
|
begin_gesture (ClutterGestureAction *action,
|
||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv = action->priv;
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (action);
|
||||||
gboolean return_value;
|
gboolean return_value;
|
||||||
|
|
||||||
priv->in_gesture = TRUE;
|
priv->in_gesture = TRUE;
|
||||||
@@ -353,7 +358,8 @@ stage_captured_event_cb (ClutterActor *stage,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
ClutterGestureAction *action)
|
ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv = action->priv;
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (action);
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
gint position;
|
gint position;
|
||||||
float threshold_x, threshold_y;
|
float threshold_x, threshold_y;
|
||||||
@@ -488,7 +494,8 @@ actor_captured_event_cb (ClutterActor *actor,
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
ClutterGestureAction *action)
|
ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv = action->priv;
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (action);
|
||||||
GesturePoint *point G_GNUC_UNUSED;
|
GesturePoint *point G_GNUC_UNUSED;
|
||||||
|
|
||||||
if ((clutter_event_type (event) != CLUTTER_BUTTON_PRESS) &&
|
if ((clutter_event_type (event) != CLUTTER_BUTTON_PRESS) &&
|
||||||
@@ -522,7 +529,8 @@ static void
|
|||||||
clutter_gesture_action_set_actor (ClutterActorMeta *meta,
|
clutter_gesture_action_set_actor (ClutterActorMeta *meta,
|
||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv = CLUTTER_GESTURE_ACTION (meta)->priv;
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (meta));
|
||||||
ClutterActorMetaClass *meta_class =
|
ClutterActorMetaClass *meta_class =
|
||||||
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
|
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
|
||||||
|
|
||||||
@@ -556,6 +564,22 @@ clutter_gesture_action_set_actor (ClutterActorMeta *meta,
|
|||||||
meta_class->set_actor (meta, actor);
|
meta_class->set_actor (meta, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_gesture_action_set_enabled (ClutterActorMeta *meta,
|
||||||
|
gboolean is_enabled)
|
||||||
|
{
|
||||||
|
ClutterActorMetaClass *meta_class =
|
||||||
|
CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);
|
||||||
|
ClutterGestureAction *gesture_action = CLUTTER_GESTURE_ACTION (meta);
|
||||||
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (gesture_action);
|
||||||
|
|
||||||
|
if (!is_enabled && priv->in_gesture)
|
||||||
|
cancel_gesture (gesture_action);
|
||||||
|
|
||||||
|
meta_class->set_enabled (meta, is_enabled);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
default_event_handler (ClutterGestureAction *action,
|
default_event_handler (ClutterGestureAction *action,
|
||||||
ClutterActor *actor)
|
ClutterActor *actor)
|
||||||
@@ -570,6 +594,8 @@ clutter_gesture_action_set_property (GObject *gobject,
|
|||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
|
ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
|
||||||
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (self);
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
@@ -582,11 +608,15 @@ clutter_gesture_action_set_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
||||||
clutter_gesture_action_set_threshold_trigger_distance (self, g_value_get_float (value), self->priv->distance_y);
|
clutter_gesture_action_set_threshold_trigger_distance (self,
|
||||||
|
g_value_get_float (value),
|
||||||
|
priv->distance_y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
|
case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
|
||||||
clutter_gesture_action_set_threshold_trigger_distance (self, self->priv->distance_x, g_value_get_float (value));
|
clutter_gesture_action_set_threshold_trigger_distance (self,
|
||||||
|
priv->distance_x,
|
||||||
|
g_value_get_float (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -601,28 +631,29 @@ clutter_gesture_action_get_property (GObject *gobject,
|
|||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
ClutterGestureAction *self = CLUTTER_GESTURE_ACTION (gobject);
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (gobject));
|
||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_N_TOUCH_POINTS:
|
case PROP_N_TOUCH_POINTS:
|
||||||
g_value_set_int (value, self->priv->requested_nb_points);
|
g_value_set_int (value, priv->requested_nb_points);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_EDGE:
|
case PROP_THRESHOLD_TRIGGER_EDGE:
|
||||||
g_value_set_enum (value, self->priv->edge);
|
g_value_set_enum (value, priv->edge);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
case PROP_THRESHOLD_TRIGGER_DISTANCE_X:
|
||||||
if (self->priv->distance_x > 0.0)
|
if (priv->distance_x > 0.0)
|
||||||
g_value_set_float (value, self->priv->distance_x);
|
g_value_set_float (value, priv->distance_x);
|
||||||
else
|
else
|
||||||
g_value_set_float (value, gesture_get_default_threshold ());
|
g_value_set_float (value, gesture_get_default_threshold ());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
|
case PROP_THRESHOLD_TRIGGER_DISTANCE_Y:
|
||||||
if (self->priv->distance_y > 0.0)
|
if (priv->distance_y > 0.0)
|
||||||
g_value_set_float (value, self->priv->distance_y);
|
g_value_set_float (value, priv->distance_y);
|
||||||
else
|
else
|
||||||
g_value_set_float (value, gesture_get_default_threshold ());
|
g_value_set_float (value, gesture_get_default_threshold ());
|
||||||
break;
|
break;
|
||||||
@@ -636,7 +667,8 @@ clutter_gesture_action_get_property (GObject *gobject,
|
|||||||
static void
|
static void
|
||||||
clutter_gesture_action_finalize (GObject *gobject)
|
clutter_gesture_action_finalize (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterGestureActionPrivate *priv = CLUTTER_GESTURE_ACTION (gobject)->priv;
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (CLUTTER_GESTURE_ACTION (gobject));
|
||||||
|
|
||||||
g_array_unref (priv->points);
|
g_array_unref (priv->points);
|
||||||
|
|
||||||
@@ -654,6 +686,7 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
|
|||||||
gobject_class->get_property = clutter_gesture_action_get_property;
|
gobject_class->get_property = clutter_gesture_action_get_property;
|
||||||
|
|
||||||
meta_class->set_actor = clutter_gesture_action_set_actor;
|
meta_class->set_actor = clutter_gesture_action_set_actor;
|
||||||
|
meta_class->set_enabled = clutter_gesture_action_set_enabled;
|
||||||
|
|
||||||
klass->gesture_begin = default_event_handler;
|
klass->gesture_begin = default_event_handler;
|
||||||
klass->gesture_progress = default_event_handler;
|
klass->gesture_progress = default_event_handler;
|
||||||
@@ -827,13 +860,14 @@ clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
|
|||||||
static void
|
static void
|
||||||
clutter_gesture_action_init (ClutterGestureAction *self)
|
clutter_gesture_action_init (ClutterGestureAction *self)
|
||||||
{
|
{
|
||||||
self->priv = clutter_gesture_action_get_instance_private (self);
|
ClutterGestureActionPrivate *priv =
|
||||||
|
clutter_gesture_action_get_instance_private (self);
|
||||||
|
|
||||||
self->priv->points = g_array_sized_new (FALSE, TRUE, sizeof (GesturePoint), 3);
|
priv->points = g_array_sized_new (FALSE, TRUE, sizeof (GesturePoint), 3);
|
||||||
g_array_set_clear_func (self->priv->points, (GDestroyNotify) gesture_point_unset);
|
g_array_set_clear_func (priv->points, (GDestroyNotify) gesture_point_unset);
|
||||||
|
|
||||||
self->priv->requested_nb_points = 1;
|
priv->requested_nb_points = 1;
|
||||||
self->priv->edge = CLUTTER_GESTURE_TRIGGER_EDGE_NONE;
|
priv->edge = CLUTTER_GESTURE_TRIGGER_EDGE_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -872,16 +906,21 @@ clutter_gesture_action_get_press_coords (ClutterGestureAction *action,
|
|||||||
gfloat *press_x,
|
gfloat *press_x,
|
||||||
gfloat *press_y)
|
gfloat *press_y)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
g_return_if_fail (action->priv->points->len > point);
|
|
||||||
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
g_return_if_fail (priv->points->len > point);
|
||||||
|
|
||||||
if (press_x)
|
if (press_x)
|
||||||
*press_x = g_array_index (action->priv->points,
|
*press_x = g_array_index (priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).press_x;
|
point).press_x;
|
||||||
|
|
||||||
if (press_y)
|
if (press_y)
|
||||||
*press_y = g_array_index (action->priv->points,
|
*press_y = g_array_index (priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).press_y;
|
point).press_y;
|
||||||
}
|
}
|
||||||
@@ -907,16 +946,21 @@ clutter_gesture_action_get_motion_coords (ClutterGestureAction *action,
|
|||||||
gfloat *motion_x,
|
gfloat *motion_x,
|
||||||
gfloat *motion_y)
|
gfloat *motion_y)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
g_return_if_fail (action->priv->points->len > point);
|
|
||||||
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
g_return_if_fail (priv->points->len > point);
|
||||||
|
|
||||||
if (motion_x)
|
if (motion_x)
|
||||||
*motion_x = g_array_index (action->priv->points,
|
*motion_x = g_array_index (priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_motion_x;
|
point).last_motion_x;
|
||||||
|
|
||||||
if (motion_y)
|
if (motion_y)
|
||||||
*motion_y = g_array_index (action->priv->points,
|
*motion_y = g_array_index (priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_motion_y;
|
point).last_motion_y;
|
||||||
}
|
}
|
||||||
@@ -944,15 +988,19 @@ clutter_gesture_action_get_motion_delta (ClutterGestureAction *action,
|
|||||||
gfloat *delta_x,
|
gfloat *delta_x,
|
||||||
gfloat *delta_y)
|
gfloat *delta_y)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
gfloat d_x, d_y;
|
gfloat d_x, d_y;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
||||||
g_return_val_if_fail (action->priv->points->len > point, 0);
|
|
||||||
|
|
||||||
d_x = g_array_index (action->priv->points,
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
g_return_val_if_fail (priv->points->len > point, 0);
|
||||||
|
|
||||||
|
d_x = g_array_index (priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_delta_x;
|
point).last_delta_x;
|
||||||
d_y = g_array_index (action->priv->points,
|
d_y = g_array_index (priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_delta_y;
|
point).last_delta_y;
|
||||||
|
|
||||||
@@ -986,16 +1034,21 @@ clutter_gesture_action_get_release_coords (ClutterGestureAction *action,
|
|||||||
gfloat *release_x,
|
gfloat *release_x,
|
||||||
gfloat *release_y)
|
gfloat *release_y)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
g_return_if_fail (action->priv->points->len > point);
|
|
||||||
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
g_return_if_fail (priv->points->len > point);
|
||||||
|
|
||||||
if (release_x)
|
if (release_x)
|
||||||
*release_x = g_array_index (action->priv->points,
|
*release_x = g_array_index (priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).release_x;
|
point).release_x;
|
||||||
|
|
||||||
if (release_y)
|
if (release_y)
|
||||||
*release_y = g_array_index (action->priv->points,
|
*release_y = g_array_index (priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).release_y;
|
point).release_y;
|
||||||
}
|
}
|
||||||
@@ -1021,16 +1074,20 @@ clutter_gesture_action_get_velocity (ClutterGestureAction *action,
|
|||||||
gfloat *velocity_x,
|
gfloat *velocity_x,
|
||||||
gfloat *velocity_y)
|
gfloat *velocity_y)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
gfloat d_x, d_y, distance, velocity;
|
gfloat d_x, d_y, distance, velocity;
|
||||||
gint64 d_t;
|
gint64 d_t;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
||||||
g_return_val_if_fail (action->priv->points->len > point, 0);
|
|
||||||
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
g_return_val_if_fail (priv->points->len > point, 0);
|
||||||
|
|
||||||
distance = clutter_gesture_action_get_motion_delta (action, point,
|
distance = clutter_gesture_action_get_motion_delta (action, point,
|
||||||
&d_x, &d_y);
|
&d_x, &d_y);
|
||||||
|
|
||||||
d_t = g_array_index (action->priv->points,
|
d_t = g_array_index (priv->points,
|
||||||
GesturePoint,
|
GesturePoint,
|
||||||
point).last_delta_time;
|
point).last_delta_time;
|
||||||
|
|
||||||
@@ -1057,9 +1114,13 @@ clutter_gesture_action_get_velocity (ClutterGestureAction *action,
|
|||||||
gint
|
gint
|
||||||
clutter_gesture_action_get_n_touch_points (ClutterGestureAction *action)
|
clutter_gesture_action_get_n_touch_points (ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
||||||
|
|
||||||
return action->priv->requested_nb_points;
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
return priv->requested_nb_points;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1080,7 +1141,7 @@ clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
|
|||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
g_return_if_fail (nb_points >= 1);
|
g_return_if_fail (nb_points >= 1);
|
||||||
|
|
||||||
priv = action->priv;
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
if (priv->requested_nb_points == nb_points)
|
if (priv->requested_nb_points == nb_points)
|
||||||
return;
|
return;
|
||||||
@@ -1134,9 +1195,13 @@ clutter_gesture_action_set_n_touch_points (ClutterGestureAction *action,
|
|||||||
guint
|
guint
|
||||||
clutter_gesture_action_get_n_current_points (ClutterGestureAction *action)
|
clutter_gesture_action_get_n_current_points (ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), 0);
|
||||||
|
|
||||||
return action->priv->points->len;
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
return priv->points->len;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1154,10 +1219,15 @@ ClutterEventSequence *
|
|||||||
clutter_gesture_action_get_sequence (ClutterGestureAction *action,
|
clutter_gesture_action_get_sequence (ClutterGestureAction *action,
|
||||||
guint point)
|
guint point)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
ClutterGestureActionPrivate *priv;
|
||||||
g_return_val_if_fail (action->priv->points->len > point, NULL);
|
|
||||||
|
|
||||||
return g_array_index (action->priv->points, GesturePoint, point).sequence;
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
||||||
|
|
||||||
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
g_return_val_if_fail (priv->points->len > point, NULL);
|
||||||
|
|
||||||
|
return g_array_index (priv->points, GesturePoint, point).sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1176,10 +1246,15 @@ ClutterInputDevice *
|
|||||||
clutter_gesture_action_get_device (ClutterGestureAction *action,
|
clutter_gesture_action_get_device (ClutterGestureAction *action,
|
||||||
guint point)
|
guint point)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
ClutterGestureActionPrivate *priv;
|
||||||
g_return_val_if_fail (action->priv->points->len > point, NULL);
|
|
||||||
|
|
||||||
return g_array_index (action->priv->points, GesturePoint, point).device;
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
||||||
|
|
||||||
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
g_return_val_if_fail (priv->points->len > point, NULL);
|
||||||
|
|
||||||
|
return g_array_index (priv->points, GesturePoint, point).device;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1199,11 +1274,15 @@ clutter_gesture_action_get_last_event (ClutterGestureAction *action,
|
|||||||
guint point)
|
guint point)
|
||||||
{
|
{
|
||||||
GesturePoint *gesture_point;
|
GesturePoint *gesture_point;
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action), NULL);
|
||||||
g_return_val_if_fail (action->priv->points->len > point, NULL);
|
|
||||||
|
|
||||||
gesture_point = &g_array_index (action->priv->points, GesturePoint, point);
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
g_return_val_if_fail (priv->points->len > point, NULL);
|
||||||
|
|
||||||
|
gesture_point = &g_array_index (priv->points, GesturePoint, point);
|
||||||
|
|
||||||
return gesture_point->last_event;
|
return gesture_point->last_event;
|
||||||
}
|
}
|
||||||
@@ -1240,12 +1319,16 @@ void
|
|||||||
clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
|
clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *action,
|
||||||
ClutterGestureTriggerEdge edge)
|
ClutterGestureTriggerEdge edge)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
|
||||||
if (action->priv->edge == edge)
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
if (priv->edge == edge)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
action->priv->edge = edge;
|
priv->edge = edge;
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_EDGE]);
|
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_EDGE]);
|
||||||
}
|
}
|
||||||
@@ -1264,10 +1347,14 @@ clutter_gesture_action_set_threshold_trigger_edge (ClutterGestureAction *ac
|
|||||||
ClutterGestureTriggerEdge
|
ClutterGestureTriggerEdge
|
||||||
clutter_gesture_action_get_threshold_trigger_edge (ClutterGestureAction *action)
|
clutter_gesture_action_get_threshold_trigger_edge (ClutterGestureAction *action)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action),
|
g_return_val_if_fail (CLUTTER_IS_GESTURE_ACTION (action),
|
||||||
CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
|
CLUTTER_GESTURE_TRIGGER_EDGE_NONE);
|
||||||
|
|
||||||
return action->priv->edge;
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
return priv->edge;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1307,17 +1394,21 @@ clutter_gesture_action_set_threshold_trigger_distance (ClutterGestureAction
|
|||||||
float x,
|
float x,
|
||||||
float y)
|
float y)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
|
||||||
if (fabsf (x - action->priv->distance_x) > FLOAT_EPSILON)
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
|
if (fabsf (x - priv->distance_x) > FLOAT_EPSILON)
|
||||||
{
|
{
|
||||||
action->priv->distance_x = x;
|
priv->distance_x = x;
|
||||||
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_X]);
|
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_X]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fabsf (y - action->priv->distance_y) > FLOAT_EPSILON)
|
if (fabsf (y - priv->distance_y) > FLOAT_EPSILON)
|
||||||
{
|
{
|
||||||
action->priv->distance_y = y;
|
priv->distance_y = y;
|
||||||
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_Y]);
|
g_object_notify_by_pspec (G_OBJECT (action), gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_Y]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1338,19 +1429,23 @@ clutter_gesture_action_get_threshold_trigger_distance (ClutterGestureAction *act
|
|||||||
float *x,
|
float *x,
|
||||||
float *y)
|
float *y)
|
||||||
{
|
{
|
||||||
|
ClutterGestureActionPrivate *priv;
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
g_return_if_fail (CLUTTER_IS_GESTURE_ACTION (action));
|
||||||
|
|
||||||
|
priv = clutter_gesture_action_get_instance_private (action);
|
||||||
|
|
||||||
if (x != NULL)
|
if (x != NULL)
|
||||||
{
|
{
|
||||||
if (action->priv->distance_x > 0.0)
|
if (priv->distance_x > 0.0)
|
||||||
*x = action->priv->distance_x;
|
*x = priv->distance_x;
|
||||||
else
|
else
|
||||||
*x = gesture_get_default_threshold ();
|
*x = gesture_get_default_threshold ();
|
||||||
}
|
}
|
||||||
if (y != NULL)
|
if (y != NULL)
|
||||||
{
|
{
|
||||||
if (action->priv->distance_y > 0.0)
|
if (priv->distance_y > 0.0)
|
||||||
*y = action->priv->distance_y;
|
*y = priv->distance_y;
|
||||||
else
|
else
|
||||||
*y = gesture_get_default_threshold ();
|
*y = gesture_get_default_threshold ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,32 +34,13 @@
|
|||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define CLUTTER_TYPE_GESTURE_ACTION (clutter_gesture_action_get_type ())
|
#define CLUTTER_TYPE_GESTURE_ACTION (clutter_gesture_action_get_type ())
|
||||||
#define CLUTTER_GESTURE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GESTURE_ACTION, ClutterGestureAction))
|
|
||||||
#define CLUTTER_IS_GESTURE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GESTURE_ACTION))
|
|
||||||
#define CLUTTER_GESTURE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GESTURE_ACTION, ClutterGestureActionClass))
|
|
||||||
#define CLUTTER_IS_GESTURE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GESTURE_ACTION))
|
|
||||||
#define CLUTTER_GESTURE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GESTURE_ACTION, ClutterGestureActionClass))
|
|
||||||
|
|
||||||
typedef struct _ClutterGestureAction ClutterGestureAction;
|
CLUTTER_EXPORT
|
||||||
typedef struct _ClutterGestureActionPrivate ClutterGestureActionPrivate;
|
G_DECLARE_DERIVABLE_TYPE (ClutterGestureAction, clutter_gesture_action,
|
||||||
typedef struct _ClutterGestureActionClass ClutterGestureActionClass;
|
CLUTTER, GESTURE_ACTION, ClutterAction);
|
||||||
|
|
||||||
/**
|
typedef struct _ClutterGestureActionPrivate ClutterGestureActionPrivate;
|
||||||
* ClutterGestureAction:
|
|
||||||
*
|
|
||||||
* The #ClutterGestureAction structure contains
|
|
||||||
* only private data and should be accessed using the provided API
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*/
|
|
||||||
struct _ClutterGestureAction
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterAction parent_instance;
|
|
||||||
|
|
||||||
ClutterGestureActionPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterGestureActionClass:
|
* ClutterGestureActionClass:
|
||||||
@@ -101,9 +82,6 @@ struct _ClutterGestureActionClass
|
|||||||
void (* _clutter_gesture_action6) (void);
|
void (* _clutter_gesture_action6) (void);
|
||||||
};
|
};
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_gesture_action_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterAction * clutter_gesture_action_new (void);
|
ClutterAction * clutter_gesture_action_new (void);
|
||||||
|
|
||||||
|
|||||||
@@ -1391,8 +1391,7 @@ allocate_child (ClutterGridRequest *request,
|
|||||||
static void
|
static void
|
||||||
clutter_grid_layout_allocate (ClutterLayoutManager *layout,
|
clutter_grid_layout_allocate (ClutterLayoutManager *layout,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation,
|
const ClutterActorBox *allocation)
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
{
|
||||||
ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (layout);
|
ClutterGridLayout *self = CLUTTER_GRID_LAYOUT (layout);
|
||||||
ClutterOrientation orientation;
|
ClutterOrientation orientation;
|
||||||
@@ -1453,7 +1452,7 @@ clutter_grid_layout_allocate (ClutterLayoutManager *layout,
|
|||||||
child_allocation.x2 = child_allocation.x1 + width;
|
child_allocation.x2 = child_allocation.x1 + width;
|
||||||
child_allocation.y2 = child_allocation.y1 + height;
|
child_allocation.y2 = child_allocation.y1 + height;
|
||||||
|
|
||||||
clutter_actor_allocate (child, &child_allocation, flags);
|
clutter_actor_allocate (child, &child_allocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,96 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006 OpenedHand
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CLUTTER_GROUP_H__
|
|
||||||
#define __CLUTTER_GROUP_H__
|
|
||||||
|
|
||||||
#if !defined(__CLUTTER_H_INSIDE__) && !defined(CLUTTER_COMPILATION)
|
|
||||||
#error "Only <clutter/clutter.h> can be included directly."
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <glib-object.h>
|
|
||||||
#include <clutter/clutter-types.h>
|
|
||||||
#include <clutter/clutter-actor.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_GROUP (clutter_group_get_type ())
|
|
||||||
#define CLUTTER_GROUP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_GROUP, ClutterGroup))
|
|
||||||
#define CLUTTER_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLUTTER_TYPE_GROUP, ClutterGroupClass))
|
|
||||||
#define CLUTTER_IS_GROUP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_GROUP))
|
|
||||||
#define CLUTTER_IS_GROUP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_GROUP))
|
|
||||||
#define CLUTTER_GROUP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_GROUP, ClutterGroupClass))
|
|
||||||
|
|
||||||
/* XXX - ClutterGroup is to be considered fully deprecated; the only
|
|
||||||
* reason we keep this header is because ClutterStage inherits from
|
|
||||||
* ClutterGroup, and thus we need to have a structure definition for
|
|
||||||
* the Stage object to expand.
|
|
||||||
*/
|
|
||||||
|
|
||||||
typedef struct _ClutterGroup ClutterGroup;
|
|
||||||
typedef struct _ClutterGroupClass ClutterGroupClass;
|
|
||||||
typedef struct _ClutterGroupPrivate ClutterGroupPrivate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterGroup:
|
|
||||||
*
|
|
||||||
* The #ClutterGroup structure contains only private data
|
|
||||||
* and should be accessed using the provided API
|
|
||||||
*
|
|
||||||
* Since: 0.2
|
|
||||||
*/
|
|
||||||
struct _ClutterGroup
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterActor parent_instance;
|
|
||||||
|
|
||||||
ClutterGroupPrivate *priv;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterGroupClass:
|
|
||||||
*
|
|
||||||
* The #ClutterGroupClass structure contains only private data
|
|
||||||
*
|
|
||||||
* Since: 0.2
|
|
||||||
*/
|
|
||||||
struct _ClutterGroupClass
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
ClutterActorClass parent_class;
|
|
||||||
|
|
||||||
/* padding for future expansion */
|
|
||||||
void (*_clutter_reserved1) (void);
|
|
||||||
void (*_clutter_reserved2) (void);
|
|
||||||
void (*_clutter_reserved3) (void);
|
|
||||||
void (*_clutter_reserved4) (void);
|
|
||||||
void (*_clutter_reserved5) (void);
|
|
||||||
void (*_clutter_reserved6) (void);
|
|
||||||
};
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
GType clutter_group_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_GROUP_H__ */
|
|
||||||
@@ -61,15 +61,6 @@ typedef struct _ClutterScrollInfo
|
|||||||
guint last_value_valid : 1;
|
guint last_value_valid : 1;
|
||||||
} ClutterScrollInfo;
|
} ClutterScrollInfo;
|
||||||
|
|
||||||
typedef struct _ClutterTouchInfo
|
|
||||||
{
|
|
||||||
ClutterEventSequence *sequence;
|
|
||||||
ClutterActor *actor;
|
|
||||||
|
|
||||||
float current_x;
|
|
||||||
float current_y;
|
|
||||||
} ClutterTouchInfo;
|
|
||||||
|
|
||||||
typedef struct _ClutterPtrA11yData
|
typedef struct _ClutterPtrA11yData
|
||||||
{
|
{
|
||||||
int n_btn_pressed;
|
int n_btn_pressed;
|
||||||
@@ -120,25 +111,18 @@ struct _ClutterInputDevice
|
|||||||
/* the current click count */
|
/* the current click count */
|
||||||
int click_count;
|
int click_count;
|
||||||
|
|
||||||
/* the stage the device is on */
|
|
||||||
ClutterStage *stage;
|
|
||||||
|
|
||||||
/* the current state */
|
/* the current state */
|
||||||
float current_x;
|
|
||||||
float current_y;
|
|
||||||
uint32_t current_time;
|
|
||||||
int current_button_number;
|
int current_button_number;
|
||||||
ClutterModifierType current_state;
|
ClutterModifierType current_state;
|
||||||
|
|
||||||
/* the current touch points states */
|
/* the current touch points targets */
|
||||||
GHashTable *touch_sequences_info;
|
GHashTable *touch_sequence_actors;
|
||||||
|
|
||||||
/* the previous state, used for click count generation */
|
/* the previous state, used for click count generation */
|
||||||
int previous_x;
|
int previous_x;
|
||||||
int previous_y;
|
int previous_y;
|
||||||
uint32_t previous_time;
|
uint32_t previous_time;
|
||||||
int previous_button_number;
|
int previous_button_number;
|
||||||
ClutterModifierType previous_state;
|
|
||||||
|
|
||||||
GArray *axes;
|
GArray *axes;
|
||||||
|
|
||||||
@@ -157,8 +141,6 @@ struct _ClutterInputDevice
|
|||||||
int n_strips;
|
int n_strips;
|
||||||
int n_mode_groups;
|
int n_mode_groups;
|
||||||
|
|
||||||
ClutterInputDeviceMapping mapping_mode;
|
|
||||||
|
|
||||||
guint has_cursor : 1;
|
guint has_cursor : 1;
|
||||||
guint is_enabled : 1;
|
guint is_enabled : 1;
|
||||||
|
|
||||||
@@ -180,33 +162,11 @@ CLUTTER_EXPORT
|
|||||||
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
|
void clutter_input_device_update_from_tool (ClutterInputDevice *device,
|
||||||
ClutterInputDeviceTool *tool);
|
ClutterInputDeviceTool *tool);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterStage * _clutter_input_device_get_stage (ClutterInputDevice *device);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void _clutter_input_device_set_stage (ClutterInputDevice *device,
|
|
||||||
ClutterStage *stage);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void _clutter_input_device_set_coords (ClutterInputDevice *device,
|
|
||||||
ClutterEventSequence *sequence,
|
|
||||||
gfloat x,
|
|
||||||
gfloat y,
|
|
||||||
ClutterStage *stage);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void _clutter_input_device_set_state (ClutterInputDevice *device,
|
|
||||||
ClutterModifierType state);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void _clutter_input_device_set_time (ClutterInputDevice *device,
|
|
||||||
guint32 time_);
|
|
||||||
void _clutter_input_device_set_actor (ClutterInputDevice *device,
|
|
||||||
ClutterEventSequence *sequence,
|
|
||||||
ClutterActor *actor,
|
|
||||||
gboolean emit_crossing);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterActor * clutter_input_device_update (ClutterInputDevice *device,
|
ClutterActor * clutter_input_device_update (ClutterInputDevice *device,
|
||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
gboolean emit_crossing);
|
ClutterStage *stage,
|
||||||
CLUTTER_EXPORT
|
gboolean emit_crossing,
|
||||||
void _clutter_input_device_add_event_sequence (ClutterInputDevice *device,
|
ClutterEvent *for_event);
|
||||||
ClutterEvent *event);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
|
void _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
|
||||||
ClutterEvent *event);
|
ClutterEvent *event);
|
||||||
@@ -214,6 +174,12 @@ CLUTTER_EXPORT
|
|||||||
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
|
void _clutter_input_device_set_n_keys (ClutterInputDevice *device,
|
||||||
guint n_keys);
|
guint n_keys);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
|
void clutter_input_device_set_key (ClutterInputDevice *device,
|
||||||
|
guint index_,
|
||||||
|
guint keyval,
|
||||||
|
ClutterModifierType modifiers);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
|
gboolean _clutter_input_device_translate_axis (ClutterInputDevice *device,
|
||||||
guint index_,
|
guint index_,
|
||||||
gdouble value,
|
gdouble value,
|
||||||
@@ -252,4 +218,9 @@ ClutterInputDeviceTool *
|
|||||||
guint64 serial,
|
guint64 serial,
|
||||||
ClutterInputDeviceToolType type);
|
ClutterInputDeviceToolType type);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
|
||||||
|
guint hardware_keycode,
|
||||||
|
guint *evdev_keycode);
|
||||||
|
|
||||||
#endif /* CLUTTER_INPUT_DEVICE_PRIVATE_H */
|
#endif /* CLUTTER_INPUT_DEVICE_PRIVATE_H */
|
||||||
|
|||||||
@@ -61,7 +61,6 @@ enum
|
|||||||
PROP_DEVICE_MODE,
|
PROP_DEVICE_MODE,
|
||||||
|
|
||||||
PROP_HAS_CURSOR,
|
PROP_HAS_CURSOR,
|
||||||
PROP_ENABLED,
|
|
||||||
|
|
||||||
PROP_N_AXES,
|
PROP_N_AXES,
|
||||||
|
|
||||||
@@ -72,12 +71,10 @@ enum
|
|||||||
PROP_N_RINGS,
|
PROP_N_RINGS,
|
||||||
PROP_N_MODE_GROUPS,
|
PROP_N_MODE_GROUPS,
|
||||||
PROP_DEVICE_NODE,
|
PROP_DEVICE_NODE,
|
||||||
PROP_MAPPING_MODE,
|
|
||||||
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
static void _clutter_input_device_free_touch_info (gpointer data);
|
|
||||||
static void on_cursor_actor_destroy (ClutterActor *actor,
|
static void on_cursor_actor_destroy (ClutterActor *actor,
|
||||||
ClutterInputDevice *device);
|
ClutterInputDevice *device);
|
||||||
static void on_cursor_actor_reactive_changed (ClutterActor *actor,
|
static void on_cursor_actor_reactive_changed (ClutterActor *actor,
|
||||||
@@ -114,7 +111,7 @@ clutter_input_device_dispose (GObject *gobject)
|
|||||||
g_clear_pointer (&device->axes, g_array_unref);
|
g_clear_pointer (&device->axes, g_array_unref);
|
||||||
g_clear_pointer (&device->keys, g_array_unref);
|
g_clear_pointer (&device->keys, g_array_unref);
|
||||||
g_clear_pointer (&device->scroll_info, g_array_unref);
|
g_clear_pointer (&device->scroll_info, g_array_unref);
|
||||||
g_clear_pointer (&device->touch_sequences_info, g_hash_table_unref);
|
g_clear_pointer (&device->touch_sequence_actors, g_hash_table_unref);
|
||||||
|
|
||||||
if (device->cursor_actor)
|
if (device->cursor_actor)
|
||||||
{
|
{
|
||||||
@@ -191,10 +188,6 @@ clutter_input_device_set_property (GObject *gobject,
|
|||||||
self->has_cursor = g_value_get_boolean (value);
|
self->has_cursor = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ENABLED:
|
|
||||||
clutter_input_device_set_enabled (self, g_value_get_boolean (value));
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_VENDOR_ID:
|
case PROP_VENDOR_ID:
|
||||||
self->vendor_id = g_value_dup_string (value);
|
self->vendor_id = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
@@ -219,10 +212,6 @@ clutter_input_device_set_property (GObject *gobject,
|
|||||||
self->node_path = g_value_dup_string (value);
|
self->node_path = g_value_dup_string (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MAPPING_MODE:
|
|
||||||
self->mapping_mode = g_value_get_enum (value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -271,10 +260,6 @@ clutter_input_device_get_property (GObject *gobject,
|
|||||||
g_value_set_uint (value, clutter_input_device_get_n_axes (self));
|
g_value_set_uint (value, clutter_input_device_get_n_axes (self));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ENABLED:
|
|
||||||
g_value_set_boolean (value, self->is_enabled);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PROP_VENDOR_ID:
|
case PROP_VENDOR_ID:
|
||||||
g_value_set_string (value, self->vendor_id);
|
g_value_set_string (value, self->vendor_id);
|
||||||
break;
|
break;
|
||||||
@@ -299,10 +284,6 @@ clutter_input_device_get_property (GObject *gobject,
|
|||||||
g_value_set_string (value, self->node_path);
|
g_value_set_string (value, self->node_path);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_MAPPING_MODE:
|
|
||||||
g_value_set_enum (value, self->mapping_mode);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -402,25 +383,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
|
|||||||
FALSE,
|
FALSE,
|
||||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterInputDevice:enabled:
|
|
||||||
*
|
|
||||||
* Whether the device is enabled.
|
|
||||||
*
|
|
||||||
* A device with the #ClutterInputDevice:device-mode property set
|
|
||||||
* to %CLUTTER_INPUT_MODE_MASTER cannot be disabled.
|
|
||||||
*
|
|
||||||
* A device must be enabled in order to receive events from it.
|
|
||||||
*
|
|
||||||
* Since: 1.6
|
|
||||||
*/
|
|
||||||
obj_props[PROP_ENABLED] =
|
|
||||||
g_param_spec_boolean ("enabled",
|
|
||||||
P_("Enabled"),
|
|
||||||
P_("Whether the device is enabled"),
|
|
||||||
FALSE,
|
|
||||||
CLUTTER_PARAM_READWRITE);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterInputDevice:n-axes:
|
* ClutterInputDevice:n-axes:
|
||||||
*
|
*
|
||||||
@@ -506,14 +468,6 @@ clutter_input_device_class_init (ClutterInputDeviceClass *klass)
|
|||||||
NULL,
|
NULL,
|
||||||
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
|
||||||
|
|
||||||
obj_props[PROP_MAPPING_MODE] =
|
|
||||||
g_param_spec_enum ("mapping-mode",
|
|
||||||
P_("Device mapping mode"),
|
|
||||||
P_("Device mapping mode"),
|
|
||||||
CLUTTER_TYPE_INPUT_DEVICE_MAPPING,
|
|
||||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE,
|
|
||||||
CLUTTER_PARAM_READWRITE);
|
|
||||||
|
|
||||||
gobject_class->dispose = clutter_input_device_dispose;
|
gobject_class->dispose = clutter_input_device_dispose;
|
||||||
gobject_class->set_property = clutter_input_device_set_property;
|
gobject_class->set_property = clutter_input_device_set_property;
|
||||||
gobject_class->get_property = clutter_input_device_get_property;
|
gobject_class->get_property = clutter_input_device_get_property;
|
||||||
@@ -528,91 +482,15 @@ clutter_input_device_init (ClutterInputDevice *self)
|
|||||||
|
|
||||||
self->click_count = 0;
|
self->click_count = 0;
|
||||||
|
|
||||||
self->current_time = self->previous_time = CLUTTER_CURRENT_TIME;
|
self->previous_time = CLUTTER_CURRENT_TIME;
|
||||||
self->current_x = self->previous_x = -1;
|
self->previous_x = -1;
|
||||||
self->current_y = self->previous_y = -1;
|
self->previous_y = -1;
|
||||||
self->current_button_number = self->previous_button_number = -1;
|
self->current_button_number = self->previous_button_number = -1;
|
||||||
self->current_state = self->previous_state = 0;
|
|
||||||
|
|
||||||
self->touch_sequences_info =
|
self->touch_sequence_actors = g_hash_table_new (NULL, NULL);
|
||||||
g_hash_table_new_full (NULL, NULL,
|
|
||||||
NULL, _clutter_input_device_free_touch_info);
|
|
||||||
self->inv_touch_sequence_actors = g_hash_table_new (NULL, NULL);
|
self->inv_touch_sequence_actors = g_hash_table_new (NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClutterTouchInfo *
|
|
||||||
_clutter_input_device_ensure_touch_info (ClutterInputDevice *device,
|
|
||||||
ClutterEventSequence *sequence,
|
|
||||||
ClutterStage *stage)
|
|
||||||
{
|
|
||||||
ClutterTouchInfo *info;
|
|
||||||
|
|
||||||
info = g_hash_table_lookup (device->touch_sequences_info, sequence);
|
|
||||||
|
|
||||||
if (info == NULL)
|
|
||||||
{
|
|
||||||
info = g_slice_new0 (ClutterTouchInfo);
|
|
||||||
info->sequence = sequence;
|
|
||||||
g_hash_table_insert (device->touch_sequences_info, sequence, info);
|
|
||||||
|
|
||||||
if (g_hash_table_size (device->touch_sequences_info) == 1)
|
|
||||||
_clutter_input_device_set_stage (device, stage);
|
|
||||||
}
|
|
||||||
|
|
||||||
return info;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* clutter_input_device_set_coords:
|
|
||||||
* @device: a #ClutterInputDevice
|
|
||||||
* @sequence: a #ClutterEventSequence or NULL
|
|
||||||
* @x: X coordinate of the device
|
|
||||||
* @y: Y coordinate of the device
|
|
||||||
*
|
|
||||||
* Stores the last known coordinates of the device
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_input_device_set_coords (ClutterInputDevice *device,
|
|
||||||
ClutterEventSequence *sequence,
|
|
||||||
gfloat x,
|
|
||||||
gfloat y,
|
|
||||||
ClutterStage *stage)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
|
||||||
|
|
||||||
if (sequence == NULL)
|
|
||||||
{
|
|
||||||
if (device->current_x != x)
|
|
||||||
device->current_x = x;
|
|
||||||
|
|
||||||
if (device->current_y != y)
|
|
||||||
device->current_y = y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ClutterTouchInfo *info;
|
|
||||||
info = _clutter_input_device_ensure_touch_info (device, sequence, stage);
|
|
||||||
info->current_x = x;
|
|
||||||
info->current_y = y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* clutter_input_device_set_state:
|
|
||||||
* @device: a #ClutterInputDevice
|
|
||||||
* @state: a bitmask of modifiers
|
|
||||||
*
|
|
||||||
* Stores the last known modifiers state of the device
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_input_device_set_state (ClutterInputDevice *device,
|
|
||||||
ClutterModifierType state)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
|
||||||
|
|
||||||
device->current_state = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_input_device_get_modifier_state:
|
* clutter_input_device_get_modifier_state:
|
||||||
* @device: a #ClutterInputDevice
|
* @device: a #ClutterInputDevice
|
||||||
@@ -627,83 +505,17 @@ _clutter_input_device_set_state (ClutterInputDevice *device,
|
|||||||
ClutterModifierType
|
ClutterModifierType
|
||||||
clutter_input_device_get_modifier_state (ClutterInputDevice *device)
|
clutter_input_device_get_modifier_state (ClutterInputDevice *device)
|
||||||
{
|
{
|
||||||
|
uint32_t modifiers;
|
||||||
|
ClutterSeat *seat;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
|
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), 0);
|
||||||
|
|
||||||
return device->current_state;
|
seat = clutter_input_device_get_seat (device);
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
if (!clutter_seat_query_state (seat, device, NULL, NULL, &modifiers))
|
||||||
* clutter_input_device_set_time:
|
return 0;
|
||||||
* @device: a #ClutterInputDevice
|
|
||||||
* @time_: the time
|
|
||||||
*
|
|
||||||
* Stores the last known event time of the device
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_input_device_set_time (ClutterInputDevice *device,
|
|
||||||
guint32 time_)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
|
||||||
|
|
||||||
if (device->current_time != time_)
|
return modifiers;
|
||||||
device->current_time = time_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* clutter_input_device_set_stage:
|
|
||||||
* @device: a #ClutterInputDevice
|
|
||||||
* @stage: a #ClutterStage or %NULL
|
|
||||||
*
|
|
||||||
* Stores the stage under the device
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_input_device_set_stage (ClutterInputDevice *device,
|
|
||||||
ClutterStage *stage)
|
|
||||||
{
|
|
||||||
if (device->stage == stage)
|
|
||||||
return;
|
|
||||||
|
|
||||||
device->stage = stage;
|
|
||||||
|
|
||||||
/* we leave the ->cursor_actor in place in order to check
|
|
||||||
* if we left the stage without crossing it again; this way
|
|
||||||
* we can emit a leave event on the cursor actor right before
|
|
||||||
* we emit the leave event on the stage.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* clutter_input_device_get_stage:
|
|
||||||
* @device: a #ClutterInputDevice
|
|
||||||
*
|
|
||||||
* Retrieves the stage currently associated with @device.
|
|
||||||
*
|
|
||||||
* Return value: The stage currently associated with @device.
|
|
||||||
*/
|
|
||||||
ClutterStage *
|
|
||||||
_clutter_input_device_get_stage (ClutterInputDevice *device)
|
|
||||||
{
|
|
||||||
return device->stage;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
_clutter_input_device_free_touch_info (gpointer data)
|
|
||||||
{
|
|
||||||
g_slice_free (ClutterTouchInfo, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static ClutterActor *
|
|
||||||
_clutter_input_device_get_actor (ClutterInputDevice *device,
|
|
||||||
ClutterEventSequence *sequence)
|
|
||||||
{
|
|
||||||
ClutterTouchInfo *info;
|
|
||||||
|
|
||||||
if (sequence == NULL)
|
|
||||||
return device->cursor_actor;
|
|
||||||
|
|
||||||
info = g_hash_table_lookup (device->touch_sequences_info, sequence);
|
|
||||||
|
|
||||||
return info->actor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -717,12 +529,8 @@ _clutter_input_device_associate_actor (ClutterInputDevice *device,
|
|||||||
{
|
{
|
||||||
GList *sequences =
|
GList *sequences =
|
||||||
g_hash_table_lookup (device->inv_touch_sequence_actors, actor);
|
g_hash_table_lookup (device->inv_touch_sequence_actors, actor);
|
||||||
ClutterTouchInfo *info;
|
|
||||||
ClutterStage *stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
|
|
||||||
|
|
||||||
info = _clutter_input_device_ensure_touch_info (device, sequence, stage);
|
|
||||||
info->actor = actor;
|
|
||||||
|
|
||||||
|
g_hash_table_insert (device->touch_sequence_actors, sequence, actor);
|
||||||
g_hash_table_insert (device->inv_touch_sequence_actors,
|
g_hash_table_insert (device->inv_touch_sequence_actors,
|
||||||
actor, g_list_prepend (sequences, sequence));
|
actor, g_list_prepend (sequences, sequence));
|
||||||
}
|
}
|
||||||
@@ -750,13 +558,7 @@ _clutter_input_device_unassociate_actor (ClutterInputDevice *device,
|
|||||||
actor);
|
actor);
|
||||||
|
|
||||||
for (l = sequences; l != NULL; l = l->next)
|
for (l = sequences; l != NULL; l = l->next)
|
||||||
{
|
g_hash_table_remove (device->touch_sequence_actors, l->data);
|
||||||
ClutterTouchInfo *info =
|
|
||||||
g_hash_table_lookup (device->touch_sequences_info, l->data);
|
|
||||||
|
|
||||||
if (info)
|
|
||||||
info->actor = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (sequences);
|
g_list_free (sequences);
|
||||||
g_hash_table_remove (device->inv_touch_sequence_actors, actor);
|
g_hash_table_remove (device->inv_touch_sequence_actors, actor);
|
||||||
@@ -809,17 +611,31 @@ on_cursor_actor_reactive_changed (ClutterActor *actor,
|
|||||||
* - set to %TRUE the :has-pointer property of the new pointer
|
* - set to %TRUE the :has-pointer property of the new pointer
|
||||||
* actor
|
* actor
|
||||||
*/
|
*/
|
||||||
void
|
static void
|
||||||
_clutter_input_device_set_actor (ClutterInputDevice *device,
|
_clutter_input_device_set_actor (ClutterInputDevice *device,
|
||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
ClutterActor *actor,
|
ClutterActor *actor,
|
||||||
gboolean emit_crossing)
|
gboolean emit_crossing,
|
||||||
|
graphene_point_t coords,
|
||||||
|
uint32_t time_)
|
||||||
{
|
{
|
||||||
ClutterActor *old_actor = _clutter_input_device_get_actor (device, sequence);
|
ClutterActor *old_actor = clutter_input_device_get_actor (device, sequence);
|
||||||
|
ClutterStage *stage = NULL;
|
||||||
|
|
||||||
if (old_actor == actor)
|
if (old_actor == actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (emit_crossing)
|
||||||
|
{
|
||||||
|
if (actor)
|
||||||
|
stage = CLUTTER_STAGE (clutter_actor_get_stage (actor));
|
||||||
|
else if (old_actor)
|
||||||
|
stage = CLUTTER_STAGE (clutter_actor_get_stage (old_actor));
|
||||||
|
|
||||||
|
if (!stage)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (old_actor != NULL)
|
if (old_actor != NULL)
|
||||||
{
|
{
|
||||||
ClutterActor *tmp_old_actor;
|
ClutterActor *tmp_old_actor;
|
||||||
@@ -829,12 +645,12 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
|||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
|
|
||||||
event = clutter_event_new (CLUTTER_LEAVE);
|
event = clutter_event_new (CLUTTER_LEAVE);
|
||||||
event->crossing.time = device->current_time;
|
event->crossing.time = time_;
|
||||||
event->crossing.flags = 0;
|
event->crossing.flags = 0;
|
||||||
event->crossing.stage = device->stage;
|
event->crossing.stage = stage;
|
||||||
event->crossing.source = old_actor;
|
event->crossing.source = old_actor;
|
||||||
event->crossing.x = device->current_x;
|
event->crossing.x = coords.x;
|
||||||
event->crossing.y = device->current_y;
|
event->crossing.y = coords.y;
|
||||||
event->crossing.related = actor;
|
event->crossing.related = actor;
|
||||||
event->crossing.sequence = sequence;
|
event->crossing.sequence = sequence;
|
||||||
clutter_event_set_device (event, device);
|
clutter_event_set_device (event, device);
|
||||||
@@ -850,7 +666,7 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* processing the event might have destroyed the actor */
|
/* processing the event might have destroyed the actor */
|
||||||
tmp_old_actor = _clutter_input_device_get_actor (device, sequence);
|
tmp_old_actor = clutter_input_device_get_actor (device, sequence);
|
||||||
_clutter_input_device_unassociate_actor (device,
|
_clutter_input_device_unassociate_actor (device,
|
||||||
old_actor,
|
old_actor,
|
||||||
tmp_old_actor == NULL);
|
tmp_old_actor == NULL);
|
||||||
@@ -866,11 +682,11 @@ _clutter_input_device_set_actor (ClutterInputDevice *device,
|
|||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
|
|
||||||
event = clutter_event_new (CLUTTER_ENTER);
|
event = clutter_event_new (CLUTTER_ENTER);
|
||||||
event->crossing.time = device->current_time;
|
event->crossing.time = time_;
|
||||||
event->crossing.flags = 0;
|
event->crossing.flags = 0;
|
||||||
event->crossing.stage = device->stage;
|
event->crossing.stage = stage;
|
||||||
event->crossing.x = device->current_x;
|
event->crossing.x = coords.x;
|
||||||
event->crossing.y = device->current_y;
|
event->crossing.y = coords.y;
|
||||||
event->crossing.source = actor;
|
event->crossing.source = actor;
|
||||||
event->crossing.related = old_actor;
|
event->crossing.related = old_actor;
|
||||||
event->crossing.sequence = sequence;
|
event->crossing.sequence = sequence;
|
||||||
@@ -921,56 +737,6 @@ clutter_input_device_get_device_id (ClutterInputDevice *device)
|
|||||||
return device->id;
|
return device->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_input_device_set_enabled:
|
|
||||||
* @device: a #ClutterInputDevice
|
|
||||||
* @enabled: %TRUE to enable the @device
|
|
||||||
*
|
|
||||||
* Enables or disables a #ClutterInputDevice.
|
|
||||||
*
|
|
||||||
* Only devices with a #ClutterInputDevice:device-mode property set
|
|
||||||
* to %CLUTTER_INPUT_MODE_SLAVE or %CLUTTER_INPUT_MODE_FLOATING can
|
|
||||||
* be disabled.
|
|
||||||
*
|
|
||||||
* Since: 1.6
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_input_device_set_enabled (ClutterInputDevice *device,
|
|
||||||
gboolean enabled)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
|
||||||
|
|
||||||
enabled = !!enabled;
|
|
||||||
|
|
||||||
if (!enabled && device->device_mode == CLUTTER_INPUT_MODE_MASTER)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (device->is_enabled == enabled)
|
|
||||||
return;
|
|
||||||
|
|
||||||
device->is_enabled = enabled;
|
|
||||||
|
|
||||||
g_object_notify_by_pspec (G_OBJECT (device), obj_props[PROP_ENABLED]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_input_device_get_enabled:
|
|
||||||
* @device: a #ClutterInputDevice
|
|
||||||
*
|
|
||||||
* Retrieves whether @device is enabled.
|
|
||||||
*
|
|
||||||
* Return value: %TRUE if the device is enabled
|
|
||||||
*
|
|
||||||
* Since: 1.6
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
clutter_input_device_get_enabled (ClutterInputDevice *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
|
|
||||||
|
|
||||||
return device->is_enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_input_device_get_coords:
|
* clutter_input_device_get_coords:
|
||||||
* @device: a #ClutterInputDevice
|
* @device: a #ClutterInputDevice
|
||||||
@@ -992,27 +758,14 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
|
|||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
graphene_point_t *point)
|
graphene_point_t *point)
|
||||||
{
|
{
|
||||||
|
ClutterSeat *seat;
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
|
||||||
g_return_val_if_fail (point != NULL, FALSE);
|
g_return_val_if_fail (point != NULL, FALSE);
|
||||||
|
|
||||||
if (sequence == NULL)
|
seat = clutter_input_device_get_seat (device);
|
||||||
{
|
|
||||||
point->x = device->current_x;
|
|
||||||
point->y = device->current_y;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ClutterTouchInfo *info =
|
|
||||||
g_hash_table_lookup (device->touch_sequences_info, sequence);
|
|
||||||
|
|
||||||
if (info == NULL)
|
return clutter_seat_query_state (seat, device, sequence, point, NULL);
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
point->x = info->current_x;
|
|
||||||
point->y = info->current_y;
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1032,29 +785,31 @@ clutter_input_device_get_coords (ClutterInputDevice *device,
|
|||||||
ClutterActor *
|
ClutterActor *
|
||||||
clutter_input_device_update (ClutterInputDevice *device,
|
clutter_input_device_update (ClutterInputDevice *device,
|
||||||
ClutterEventSequence *sequence,
|
ClutterEventSequence *sequence,
|
||||||
gboolean emit_crossing)
|
ClutterStage *stage,
|
||||||
|
gboolean emit_crossing,
|
||||||
|
ClutterEvent *for_event)
|
||||||
{
|
{
|
||||||
ClutterStage *stage;
|
|
||||||
ClutterActor *new_cursor_actor;
|
ClutterActor *new_cursor_actor;
|
||||||
ClutterActor *old_cursor_actor;
|
ClutterActor *old_cursor_actor;
|
||||||
graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
|
graphene_point_t point = GRAPHENE_POINT_INIT (-1.0f, -1.0f);
|
||||||
ClutterInputDeviceType device_type = device->device_type;
|
ClutterInputDeviceType device_type = device->device_type;
|
||||||
|
uint32_t time_;
|
||||||
|
|
||||||
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
|
g_assert (device_type != CLUTTER_KEYBOARD_DEVICE &&
|
||||||
device_type != CLUTTER_PAD_DEVICE);
|
device_type != CLUTTER_PAD_DEVICE);
|
||||||
|
|
||||||
stage = device->stage;
|
if (for_event)
|
||||||
if (G_UNLIKELY (stage == NULL))
|
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (EVENT, "No stage defined for device %d '%s'",
|
clutter_event_get_coords (for_event, &point.x, &point.y);
|
||||||
clutter_input_device_get_device_id (device),
|
time_ = clutter_event_get_time (for_event);
|
||||||
clutter_input_device_get_device_name (device));
|
}
|
||||||
return NULL;
|
else
|
||||||
|
{
|
||||||
|
clutter_input_device_get_coords (device, sequence, &point);
|
||||||
|
time_ = CLUTTER_CURRENT_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
clutter_input_device_get_coords (device, sequence, &point);
|
old_cursor_actor = clutter_input_device_get_actor (device, sequence);
|
||||||
|
|
||||||
old_cursor_actor = _clutter_input_device_get_actor (device, sequence);
|
|
||||||
new_cursor_actor =
|
new_cursor_actor =
|
||||||
_clutter_stage_do_pick (stage, point.x, point.y, CLUTTER_PICK_REACTIVE);
|
_clutter_stage_do_pick (stage, point.x, point.y, CLUTTER_PICK_REACTIVE);
|
||||||
|
|
||||||
@@ -1079,47 +834,34 @@ clutter_input_device_update (ClutterInputDevice *device,
|
|||||||
|
|
||||||
_clutter_input_device_set_actor (device, sequence,
|
_clutter_input_device_set_actor (device, sequence,
|
||||||
new_cursor_actor,
|
new_cursor_actor,
|
||||||
emit_crossing);
|
emit_crossing,
|
||||||
|
point, time_);
|
||||||
|
|
||||||
return new_cursor_actor;
|
return new_cursor_actor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_input_device_get_pointer_actor:
|
* clutter_input_device_get_actor:
|
||||||
* @device: a #ClutterInputDevice of type %CLUTTER_POINTER_DEVICE
|
* @device: a #ClutterInputDevice
|
||||||
|
* @sequence: (allow-none): an optional #ClutterEventSequence
|
||||||
*
|
*
|
||||||
* Retrieves the #ClutterActor underneath the pointer of @device
|
* Retrieves the #ClutterActor underneath the pointer or touchpoint
|
||||||
|
* of @device and @sequence.
|
||||||
*
|
*
|
||||||
* Return value: (transfer none): a pointer to the #ClutterActor or %NULL
|
* Return value: (transfer none): a pointer to the #ClutterActor or %NULL
|
||||||
*
|
*
|
||||||
* Since: 1.2
|
* Since: 1.2
|
||||||
*/
|
*/
|
||||||
ClutterActor *
|
ClutterActor *
|
||||||
clutter_input_device_get_pointer_actor (ClutterInputDevice *device)
|
clutter_input_device_get_actor (ClutterInputDevice *device,
|
||||||
|
ClutterEventSequence *sequence)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
||||||
g_return_val_if_fail (device->device_type == CLUTTER_POINTER_DEVICE, NULL);
|
|
||||||
|
|
||||||
return device->cursor_actor;
|
if (sequence == NULL)
|
||||||
}
|
return device->cursor_actor;
|
||||||
|
|
||||||
/**
|
return g_hash_table_lookup (device->touch_sequence_actors, sequence);
|
||||||
* clutter_input_device_get_pointer_stage:
|
|
||||||
* @device: a #ClutterInputDevice of type %CLUTTER_POINTER_DEVICE
|
|
||||||
*
|
|
||||||
* Retrieves the #ClutterStage underneath the pointer of @device
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): a pointer to the #ClutterStage or %NULL
|
|
||||||
*
|
|
||||||
* Since: 1.2
|
|
||||||
*/
|
|
||||||
ClutterStage *
|
|
||||||
clutter_input_device_get_pointer_stage (ClutterInputDevice *device)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), NULL);
|
|
||||||
g_return_val_if_fail (device->device_type == CLUTTER_POINTER_DEVICE, NULL);
|
|
||||||
|
|
||||||
return device->stage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1180,95 +922,6 @@ clutter_input_device_get_device_mode (ClutterInputDevice *device)
|
|||||||
return device->device_mode;
|
return device->device_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_input_device_update_from_event:
|
|
||||||
* @device: a #ClutterInputDevice
|
|
||||||
* @event: a #ClutterEvent
|
|
||||||
* @update_stage: whether to update the #ClutterStage of the @device
|
|
||||||
* using the stage of the event
|
|
||||||
*
|
|
||||||
* Forcibly updates the state of the @device using a #ClutterEvent
|
|
||||||
*
|
|
||||||
* This function should never be used by applications: it is meant
|
|
||||||
* for integration with embedding toolkits, like clutter-gtk
|
|
||||||
*
|
|
||||||
* Embedding toolkits that disable the event collection inside Clutter
|
|
||||||
* need to use this function to update the state of input devices depending
|
|
||||||
* on a #ClutterEvent that they are going to submit to the event handling code
|
|
||||||
* in Clutter though clutter_do_event(). Since the input devices hold the state
|
|
||||||
* that is going to be used to fill in fields like the #ClutterButtonEvent
|
|
||||||
* click count, or to emit synthesized events like %CLUTTER_ENTER and
|
|
||||||
* %CLUTTER_LEAVE, it is necessary for embedding toolkits to also be
|
|
||||||
* responsible of updating the input device state.
|
|
||||||
*
|
|
||||||
* For instance, this might be the code to translate an embedding toolkit
|
|
||||||
* native motion notification into a Clutter #ClutterMotionEvent and ask
|
|
||||||
* Clutter to process it:
|
|
||||||
*
|
|
||||||
* |[
|
|
||||||
* ClutterEvent c_event;
|
|
||||||
*
|
|
||||||
* translate_native_event_to_clutter (native_event, &c_event);
|
|
||||||
*
|
|
||||||
* clutter_do_event (&c_event);
|
|
||||||
* ]|
|
|
||||||
*
|
|
||||||
* Before letting clutter_do_event() process the event, it is necessary to call
|
|
||||||
* clutter_input_device_update_from_event():
|
|
||||||
*
|
|
||||||
* |[
|
|
||||||
* ClutterEvent c_event;
|
|
||||||
* ClutterDeviceManager *manager;
|
|
||||||
* ClutterInputDevice *device;
|
|
||||||
*
|
|
||||||
* translate_native_event_to_clutter (native_event, &c_event);
|
|
||||||
*
|
|
||||||
* // get the seat
|
|
||||||
* seat = clutter_backend_get_deafult_seat (clutter_get_default_backend ());
|
|
||||||
*
|
|
||||||
* // use the default Core Pointer that Clutter backends register by default
|
|
||||||
* device = clutter_seat_get_pointer (seat);
|
|
||||||
*
|
|
||||||
* // update the state of the input device
|
|
||||||
* clutter_input_device_update_from_event (device, &c_event, FALSE);
|
|
||||||
*
|
|
||||||
* clutter_do_event (&c_event);
|
|
||||||
* ]|
|
|
||||||
*
|
|
||||||
* The @update_stage boolean argument should be used when the input device
|
|
||||||
* enters and leaves a #ClutterStage; it will use the #ClutterStage field
|
|
||||||
* of the passed @event to update the stage associated to the input device.
|
|
||||||
*
|
|
||||||
* Since: 1.2
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_input_device_update_from_event (ClutterInputDevice *device,
|
|
||||||
ClutterEvent *event,
|
|
||||||
gboolean update_stage)
|
|
||||||
{
|
|
||||||
ClutterModifierType event_state;
|
|
||||||
ClutterEventSequence *sequence;
|
|
||||||
ClutterStage *event_stage;
|
|
||||||
gfloat event_x, event_y;
|
|
||||||
guint32 event_time;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
|
||||||
g_return_if_fail (event != NULL);
|
|
||||||
|
|
||||||
event_state = clutter_event_get_state (event);
|
|
||||||
event_time = clutter_event_get_time (event);
|
|
||||||
event_stage = clutter_event_get_stage (event);
|
|
||||||
sequence = clutter_event_get_event_sequence (event);
|
|
||||||
clutter_event_get_coords (event, &event_x, &event_y);
|
|
||||||
|
|
||||||
_clutter_input_device_set_coords (device, sequence, event_x, event_y, event_stage);
|
|
||||||
_clutter_input_device_set_state (device, event_state);
|
|
||||||
_clutter_input_device_set_time (device, event_time);
|
|
||||||
|
|
||||||
if (update_stage)
|
|
||||||
_clutter_input_device_set_stage (device, event_stage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
/*< private >
|
||||||
* clutter_input_device_reset_axes:
|
* clutter_input_device_reset_axes:
|
||||||
* @device: a #ClutterInputDevice
|
* @device: a #ClutterInputDevice
|
||||||
@@ -1649,31 +1302,6 @@ _clutter_input_device_remove_slave (ClutterInputDevice *master,
|
|||||||
master->slaves = g_list_remove (master->slaves, slave);
|
master->slaves = g_list_remove (master->slaves, slave);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*< private >
|
|
||||||
* clutter_input_device_add_sequence:
|
|
||||||
* @device: a #ClutterInputDevice
|
|
||||||
* @sequence: a #ClutterEventSequence
|
|
||||||
*
|
|
||||||
* Start tracking informations related to a touch point (position,
|
|
||||||
* actor underneath the touch point).
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_input_device_add_event_sequence (ClutterInputDevice *device,
|
|
||||||
ClutterEvent *event)
|
|
||||||
{
|
|
||||||
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
|
||||||
ClutterStage *stage;
|
|
||||||
|
|
||||||
if (sequence == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
stage = clutter_event_get_stage (event);
|
|
||||||
if (stage == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
_clutter_input_device_ensure_touch_info (device, sequence, stage);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*< private >
|
/*< private >
|
||||||
* clutter_input_device_remove_sequence:
|
* clutter_input_device_remove_sequence:
|
||||||
* @device: a #ClutterInputDevice
|
* @device: a #ClutterInputDevice
|
||||||
@@ -1686,25 +1314,25 @@ _clutter_input_device_remove_event_sequence (ClutterInputDevice *device,
|
|||||||
ClutterEvent *event)
|
ClutterEvent *event)
|
||||||
{
|
{
|
||||||
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
ClutterEventSequence *sequence = clutter_event_get_event_sequence (event);
|
||||||
ClutterTouchInfo *info =
|
ClutterActor *actor =
|
||||||
g_hash_table_lookup (device->touch_sequences_info, sequence);
|
g_hash_table_lookup (device->touch_sequence_actors, sequence);
|
||||||
|
|
||||||
if (info == NULL)
|
if (actor != NULL)
|
||||||
return;
|
|
||||||
|
|
||||||
if (info->actor != NULL)
|
|
||||||
{
|
{
|
||||||
GList *sequences =
|
GList *sequences =
|
||||||
g_hash_table_lookup (device->inv_touch_sequence_actors, info->actor);
|
g_hash_table_lookup (device->inv_touch_sequence_actors, actor);
|
||||||
|
graphene_point_t point;
|
||||||
|
|
||||||
sequences = g_list_remove (sequences, sequence);
|
sequences = g_list_remove (sequences, sequence);
|
||||||
|
|
||||||
g_hash_table_replace (device->inv_touch_sequence_actors,
|
g_hash_table_replace (device->inv_touch_sequence_actors,
|
||||||
info->actor, sequences);
|
actor, sequences);
|
||||||
_clutter_input_device_set_actor (device, sequence, NULL, TRUE);
|
clutter_event_get_coords (event, &point.x, &point.y);
|
||||||
|
_clutter_input_device_set_actor (device, sequence, NULL, TRUE, point,
|
||||||
|
clutter_event_get_time (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
g_hash_table_remove (device->touch_sequences_info, sequence);
|
g_hash_table_remove (device->touch_sequence_actors, sequence);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2394,43 +2022,6 @@ clutter_input_device_get_device_node (ClutterInputDevice *device)
|
|||||||
return device->node_path;
|
return device->node_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterInputDeviceMapping
|
|
||||||
clutter_input_device_get_mapping_mode (ClutterInputDevice *device)
|
|
||||||
{
|
|
||||||
ClutterInputDeviceType device_type;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device),
|
|
||||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
|
|
||||||
|
|
||||||
device_type = clutter_input_device_get_device_type (device);
|
|
||||||
g_return_val_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
|
|
||||||
device_type == CLUTTER_PEN_DEVICE ||
|
|
||||||
device_type == CLUTTER_ERASER_DEVICE,
|
|
||||||
CLUTTER_INPUT_DEVICE_MAPPING_ABSOLUTE);
|
|
||||||
|
|
||||||
return device->mapping_mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
|
|
||||||
ClutterInputDeviceMapping mapping)
|
|
||||||
{
|
|
||||||
ClutterInputDeviceType device_type;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_INPUT_DEVICE (device));
|
|
||||||
|
|
||||||
device_type = clutter_input_device_get_device_type (device);
|
|
||||||
g_return_if_fail (device_type == CLUTTER_TABLET_DEVICE ||
|
|
||||||
device_type == CLUTTER_PEN_DEVICE ||
|
|
||||||
device_type == CLUTTER_ERASER_DEVICE);
|
|
||||||
|
|
||||||
if (device->mapping_mode == mapping)
|
|
||||||
return;
|
|
||||||
|
|
||||||
device->mapping_mode = mapping;
|
|
||||||
g_object_notify (G_OBJECT (device), "mapping-mode");
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
clutter_input_device_is_grouped (ClutterInputDevice *device,
|
clutter_input_device_is_grouped (ClutterInputDevice *device,
|
||||||
ClutterInputDevice *other_device)
|
ClutterInputDevice *other_device)
|
||||||
|
|||||||
@@ -92,20 +92,14 @@ gboolean clutter_input_device_get_coords (ClutterInputDevi
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device);
|
ClutterModifierType clutter_input_device_get_modifier_state (ClutterInputDevice *device);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterActor * clutter_input_device_get_pointer_actor (ClutterInputDevice *device);
|
ClutterActor * clutter_input_device_get_actor (ClutterInputDevice *device,
|
||||||
CLUTTER_EXPORT
|
ClutterEventSequence *sequence);
|
||||||
ClutterStage * clutter_input_device_get_pointer_stage (ClutterInputDevice *device);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
const gchar * clutter_input_device_get_device_name (ClutterInputDevice *device);
|
const gchar * clutter_input_device_get_device_name (ClutterInputDevice *device);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterInputMode clutter_input_device_get_device_mode (ClutterInputDevice *device);
|
ClutterInputMode clutter_input_device_get_device_mode (ClutterInputDevice *device);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_input_device_get_has_cursor (ClutterInputDevice *device);
|
gboolean clutter_input_device_get_has_cursor (ClutterInputDevice *device);
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_input_device_set_enabled (ClutterInputDevice *device,
|
|
||||||
gboolean enabled);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
gboolean clutter_input_device_get_enabled (ClutterInputDevice *device);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
guint clutter_input_device_get_n_axes (ClutterInputDevice *device);
|
guint clutter_input_device_get_n_axes (ClutterInputDevice *device);
|
||||||
@@ -121,11 +115,6 @@ gboolean clutter_input_device_get_axis_value (ClutterInputDev
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
guint clutter_input_device_get_n_keys (ClutterInputDevice *device);
|
guint clutter_input_device_get_n_keys (ClutterInputDevice *device);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_input_device_set_key (ClutterInputDevice *device,
|
|
||||||
guint index_,
|
|
||||||
guint keyval,
|
|
||||||
ClutterModifierType modifiers);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
gboolean clutter_input_device_get_key (ClutterInputDevice *device,
|
gboolean clutter_input_device_get_key (ClutterInputDevice *device,
|
||||||
guint index_,
|
guint index_,
|
||||||
guint *keyval,
|
guint *keyval,
|
||||||
@@ -136,11 +125,6 @@ ClutterInputDevice * clutter_input_device_get_associated_device (ClutterInput
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
GList * clutter_input_device_get_slave_devices (ClutterInputDevice *device);
|
GList * clutter_input_device_get_slave_devices (ClutterInputDevice *device);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_input_device_update_from_event (ClutterInputDevice *device,
|
|
||||||
ClutterEvent *event,
|
|
||||||
gboolean update_stage);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_input_device_grab (ClutterInputDevice *device,
|
void clutter_input_device_grab (ClutterInputDevice *device,
|
||||||
ClutterActor *actor);
|
ClutterActor *actor);
|
||||||
@@ -160,11 +144,6 @@ CLUTTER_EXPORT
|
|||||||
ClutterActor * clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
|
ClutterActor * clutter_input_device_sequence_get_grabbed_actor (ClutterInputDevice *device,
|
||||||
ClutterEventSequence *sequence);
|
ClutterEventSequence *sequence);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
gboolean clutter_input_device_keycode_to_evdev (ClutterInputDevice *device,
|
|
||||||
guint hardware_keycode,
|
|
||||||
guint *evdev_keycode);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
const gchar * clutter_input_device_get_vendor_id (ClutterInputDevice *device);
|
const gchar * clutter_input_device_get_vendor_id (ClutterInputDevice *device);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
@@ -192,12 +171,6 @@ gint clutter_input_device_get_mode_switch_button_group (Clutt
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
const gchar * clutter_input_device_get_device_node (ClutterInputDevice *device);
|
const gchar * clutter_input_device_get_device_node (ClutterInputDevice *device);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterInputDeviceMapping clutter_input_device_get_mapping_mode (ClutterInputDevice *device);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_input_device_set_mapping_mode (ClutterInputDevice *device,
|
|
||||||
ClutterInputDeviceMapping mapping);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_input_device_is_grouped (ClutterInputDevice *device,
|
gboolean clutter_input_device_is_grouped (ClutterInputDevice *device,
|
||||||
ClutterInputDevice *other_device);
|
ClutterInputDevice *other_device);
|
||||||
|
|||||||
@@ -454,6 +454,7 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
|
|||||||
ClutterInputMethodPrivate *priv;
|
ClutterInputMethodPrivate *priv;
|
||||||
ClutterInputDevice *keyboard;
|
ClutterInputDevice *keyboard;
|
||||||
ClutterSeat *seat;
|
ClutterSeat *seat;
|
||||||
|
ClutterStageManager *stage_manager;
|
||||||
ClutterStage *stage;
|
ClutterStage *stage;
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
|
|
||||||
@@ -464,10 +465,9 @@ clutter_input_method_forward_key (ClutterInputMethod *im,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
seat = clutter_backend_get_default_seat (clutter_get_default_backend ());
|
||||||
|
stage_manager = clutter_stage_manager_get_default ();
|
||||||
|
stage = clutter_stage_manager_get_default_stage (stage_manager);
|
||||||
keyboard = clutter_seat_get_keyboard (seat);
|
keyboard = clutter_seat_get_keyboard (seat);
|
||||||
stage = _clutter_input_device_get_stage (keyboard);
|
|
||||||
if (stage == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
event = clutter_event_new (press ? CLUTTER_KEY_PRESS : CLUTTER_KEY_RELEASE);
|
event = clutter_event_new (press ? CLUTTER_KEY_PRESS : CLUTTER_KEY_RELEASE);
|
||||||
event->key.time = time_;
|
event->key.time = time_;
|
||||||
|
|||||||
@@ -37,9 +37,6 @@
|
|||||||
* any object taking a reference on a #ClutterInterval instance should
|
* any object taking a reference on a #ClutterInterval instance should
|
||||||
* also take ownership of the interval by using g_object_ref_sink().
|
* also take ownership of the interval by using g_object_ref_sink().
|
||||||
*
|
*
|
||||||
* #ClutterInterval is used by #ClutterAnimation to define the
|
|
||||||
* interval of values that an implicit animation should tween over.
|
|
||||||
*
|
|
||||||
* #ClutterInterval can be subclassed to override the validation
|
* #ClutterInterval can be subclassed to override the validation
|
||||||
* and value computation.
|
* and value computation.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -32,8 +32,7 @@
|
|||||||
* it has been paired, and it controls the allocation of its children.
|
* it has been paired, and it controls the allocation of its children.
|
||||||
*
|
*
|
||||||
* Any composite or container #ClutterActor subclass can delegate the
|
* Any composite or container #ClutterActor subclass can delegate the
|
||||||
* layouting of its children to a #ClutterLayoutManager. Clutter provides
|
* layouting of its children to a #ClutterLayoutManager.
|
||||||
* a generic container using #ClutterLayoutManager called #ClutterBox.
|
|
||||||
*
|
*
|
||||||
* Clutter provides some simple #ClutterLayoutManager sub-classes, like
|
* Clutter provides some simple #ClutterLayoutManager sub-classes, like
|
||||||
* #ClutterFlowLayout and #ClutterBinLayout.
|
* #ClutterFlowLayout and #ClutterBinLayout.
|
||||||
@@ -97,7 +96,7 @@
|
|||||||
*
|
*
|
||||||
* |[
|
* |[
|
||||||
* {
|
* {
|
||||||
* "type" : "ClutterBox",
|
* "type" : "ClutterActor",
|
||||||
* "layout-manager" : { "type" : "ClutterGridLayout" },
|
* "layout-manager" : { "type" : "ClutterGridLayout" },
|
||||||
* "children" : [
|
* "children" : [
|
||||||
* {
|
* {
|
||||||
@@ -136,7 +135,6 @@
|
|||||||
|
|
||||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||||
#include "deprecated/clutter-container.h"
|
#include "deprecated/clutter-container.h"
|
||||||
#include "deprecated/clutter-alpha.h"
|
|
||||||
|
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
#include "clutter-layout-manager.h"
|
#include "clutter-layout-manager.h"
|
||||||
@@ -164,7 +162,6 @@ G_DEFINE_ABSTRACT_TYPE (ClutterLayoutManager,
|
|||||||
G_TYPE_INITIALLY_UNOWNED)
|
G_TYPE_INITIALLY_UNOWNED)
|
||||||
|
|
||||||
static GQuark quark_layout_meta = 0;
|
static GQuark quark_layout_meta = 0;
|
||||||
static GQuark quark_layout_alpha = 0;
|
|
||||||
|
|
||||||
static guint manager_signals[LAST_SIGNAL] = { 0, };
|
static guint manager_signals[LAST_SIGNAL] = { 0, };
|
||||||
|
|
||||||
@@ -255,8 +252,7 @@ layout_manager_real_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
static void
|
static void
|
||||||
layout_manager_real_allocate (ClutterLayoutManager *manager,
|
layout_manager_real_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation,
|
const ClutterActorBox *allocation)
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
{
|
||||||
LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED (manager, "allocate");
|
LAYOUT_MANAGER_WARN_NOT_IMPLEMENTED (manager, "allocate");
|
||||||
}
|
}
|
||||||
@@ -301,96 +297,12 @@ layout_manager_real_get_child_meta_type (ClutterLayoutManager *manager)
|
|||||||
return G_TYPE_INVALID;
|
return G_TYPE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX:2.0 - Remove */
|
|
||||||
static ClutterAlpha *
|
|
||||||
layout_manager_real_begin_animation (ClutterLayoutManager *manager,
|
|
||||||
guint duration,
|
|
||||||
gulong mode)
|
|
||||||
{
|
|
||||||
ClutterTimeline *timeline;
|
|
||||||
ClutterAlpha *alpha;
|
|
||||||
|
|
||||||
alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
|
|
||||||
if (alpha != NULL)
|
|
||||||
{
|
|
||||||
clutter_alpha_set_mode (alpha, mode);
|
|
||||||
|
|
||||||
timeline = clutter_alpha_get_timeline (alpha);
|
|
||||||
clutter_timeline_set_duration (timeline, duration);
|
|
||||||
clutter_timeline_rewind (timeline);
|
|
||||||
|
|
||||||
return alpha;
|
|
||||||
};
|
|
||||||
|
|
||||||
timeline = clutter_timeline_new (duration);
|
|
||||||
|
|
||||||
alpha = clutter_alpha_new_full (timeline, mode);
|
|
||||||
|
|
||||||
/* let the alpha take ownership of the timeline */
|
|
||||||
g_object_unref (timeline);
|
|
||||||
|
|
||||||
g_signal_connect_swapped (timeline, "new-frame",
|
|
||||||
G_CALLBACK (clutter_layout_manager_layout_changed),
|
|
||||||
manager);
|
|
||||||
|
|
||||||
g_object_set_qdata_full (G_OBJECT (manager),
|
|
||||||
quark_layout_alpha, alpha,
|
|
||||||
(GDestroyNotify) g_object_unref);
|
|
||||||
|
|
||||||
clutter_timeline_start (timeline);
|
|
||||||
|
|
||||||
return alpha;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX:2.0 - Remove */
|
|
||||||
static gdouble
|
|
||||||
layout_manager_real_get_animation_progress (ClutterLayoutManager *manager)
|
|
||||||
{
|
|
||||||
ClutterAlpha *alpha;
|
|
||||||
|
|
||||||
alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
|
|
||||||
if (alpha == NULL)
|
|
||||||
return 1.0;
|
|
||||||
|
|
||||||
return clutter_alpha_get_alpha (alpha);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* XXX:2.0 - Remove */
|
|
||||||
static void
|
|
||||||
layout_manager_real_end_animation (ClutterLayoutManager *manager)
|
|
||||||
{
|
|
||||||
ClutterTimeline *timeline;
|
|
||||||
ClutterAlpha *alpha;
|
|
||||||
|
|
||||||
alpha = g_object_get_qdata (G_OBJECT (manager), quark_layout_alpha);
|
|
||||||
if (alpha == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
timeline = clutter_alpha_get_timeline (alpha);
|
|
||||||
g_assert (timeline != NULL);
|
|
||||||
|
|
||||||
if (clutter_timeline_is_playing (timeline))
|
|
||||||
clutter_timeline_stop (timeline);
|
|
||||||
|
|
||||||
g_signal_handlers_disconnect_by_func (timeline,
|
|
||||||
G_CALLBACK (clutter_layout_manager_layout_changed),
|
|
||||||
manager);
|
|
||||||
|
|
||||||
g_object_set_qdata (G_OBJECT (manager), quark_layout_alpha, NULL);
|
|
||||||
|
|
||||||
clutter_layout_manager_layout_changed (manager);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
|
clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
|
||||||
{
|
{
|
||||||
quark_layout_meta =
|
quark_layout_meta =
|
||||||
g_quark_from_static_string ("clutter-layout-manager-child-meta");
|
g_quark_from_static_string ("clutter-layout-manager-child-meta");
|
||||||
|
|
||||||
/* XXX:2.0 - Remove */
|
|
||||||
quark_layout_alpha =
|
|
||||||
g_quark_from_static_string ("clutter-layout-manager-alpha");
|
|
||||||
|
|
||||||
klass->get_preferred_width = layout_manager_real_get_preferred_width;
|
klass->get_preferred_width = layout_manager_real_get_preferred_width;
|
||||||
klass->get_preferred_height = layout_manager_real_get_preferred_height;
|
klass->get_preferred_height = layout_manager_real_get_preferred_height;
|
||||||
klass->allocate = layout_manager_real_allocate;
|
klass->allocate = layout_manager_real_allocate;
|
||||||
@@ -398,9 +310,6 @@ clutter_layout_manager_class_init (ClutterLayoutManagerClass *klass)
|
|||||||
klass->get_child_meta_type = layout_manager_real_get_child_meta_type;
|
klass->get_child_meta_type = layout_manager_real_get_child_meta_type;
|
||||||
|
|
||||||
/* XXX:2.0 - Remove */
|
/* XXX:2.0 - Remove */
|
||||||
klass->begin_animation = layout_manager_real_begin_animation;
|
|
||||||
klass->get_animation_progress = layout_manager_real_get_animation_progress;
|
|
||||||
klass->end_animation = layout_manager_real_end_animation;
|
|
||||||
klass->set_container = layout_manager_real_set_container;
|
klass->set_container = layout_manager_real_set_container;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -523,7 +432,6 @@ clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
* @container: the #ClutterContainer using @manager
|
* @container: the #ClutterContainer using @manager
|
||||||
* @allocation: the #ClutterActorBox containing the allocated area
|
* @allocation: the #ClutterActorBox containing the allocated area
|
||||||
* of @container
|
* of @container
|
||||||
* @flags: the allocation flags
|
|
||||||
*
|
*
|
||||||
* Allocates the children of @container given an area
|
* Allocates the children of @container given an area
|
||||||
*
|
*
|
||||||
@@ -534,8 +442,7 @@ clutter_layout_manager_get_preferred_height (ClutterLayoutManager *manager,
|
|||||||
void
|
void
|
||||||
clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation,
|
const ClutterActorBox *allocation)
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
{
|
||||||
ClutterLayoutManagerClass *klass;
|
ClutterLayoutManagerClass *klass;
|
||||||
|
|
||||||
@@ -544,7 +451,7 @@ clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
|||||||
g_return_if_fail (allocation != NULL);
|
g_return_if_fail (allocation != NULL);
|
||||||
|
|
||||||
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
klass = CLUTTER_LAYOUT_MANAGER_GET_CLASS (manager);
|
||||||
klass->allocate (manager, container, allocation, flags);
|
klass->allocate (manager, container, allocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -115,8 +115,7 @@ struct _ClutterLayoutManagerClass
|
|||||||
gfloat *nat_height_p);
|
gfloat *nat_height_p);
|
||||||
void (* allocate) (ClutterLayoutManager *manager,
|
void (* allocate) (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation,
|
const ClutterActorBox *allocation);
|
||||||
ClutterAllocationFlags flags);
|
|
||||||
|
|
||||||
void (* set_container) (ClutterLayoutManager *manager,
|
void (* set_container) (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container);
|
ClutterContainer *container);
|
||||||
@@ -126,15 +125,6 @@ struct _ClutterLayoutManagerClass
|
|||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
ClutterActor *actor);
|
ClutterActor *actor);
|
||||||
|
|
||||||
/* deprecated */
|
|
||||||
ClutterAlpha * (* begin_animation) (ClutterLayoutManager *manager,
|
|
||||||
guint duration,
|
|
||||||
gulong mode);
|
|
||||||
/* deprecated */
|
|
||||||
gdouble (* get_animation_progress) (ClutterLayoutManager *manager);
|
|
||||||
/* deprecated */
|
|
||||||
void (* end_animation) (ClutterLayoutManager *manager);
|
|
||||||
|
|
||||||
void (* layout_changed) (ClutterLayoutManager *manager);
|
void (* layout_changed) (ClutterLayoutManager *manager);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
@@ -167,8 +157,7 @@ void clutter_layout_manager_get_preferred_height (ClutterLayoutMa
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
void clutter_layout_manager_allocate (ClutterLayoutManager *manager,
|
||||||
ClutterContainer *container,
|
ClutterContainer *container,
|
||||||
const ClutterActorBox *allocation,
|
const ClutterActorBox *allocation);
|
||||||
ClutterAllocationFlags flags);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_layout_manager_set_container (ClutterLayoutManager *manager,
|
void clutter_layout_manager_set_container (ClutterLayoutManager *manager,
|
||||||
|
|||||||
@@ -61,20 +61,13 @@
|
|||||||
#include "clutter-input-pointer-a11y-private.h"
|
#include "clutter-input-pointer-a11y-private.h"
|
||||||
#include "clutter-graphene.h"
|
#include "clutter-graphene.h"
|
||||||
#include "clutter-main.h"
|
#include "clutter-main.h"
|
||||||
#include "clutter-master-clock.h"
|
|
||||||
#include "clutter-mutter.h"
|
#include "clutter-mutter.h"
|
||||||
#include "clutter-paint-node-private.h"
|
#include "clutter-paint-node-private.h"
|
||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
#include "clutter-settings-private.h"
|
#include "clutter-settings-private.h"
|
||||||
#include "clutter-stage-manager.h"
|
#include "clutter-stage-manager.h"
|
||||||
#include "clutter-stage-private.h"
|
#include "clutter-stage-private.h"
|
||||||
|
#include "clutter-backend-private.h"
|
||||||
#ifdef CLUTTER_WINDOWING_X11
|
|
||||||
#include "x11/clutter-backend-x11.h"
|
|
||||||
#endif
|
|
||||||
#ifdef CLUTTER_WINDOWING_EGL
|
|
||||||
#include "egl/clutter-backend-eglnative.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cogl/cogl.h>
|
#include <cogl/cogl.h>
|
||||||
#include <cogl-pango/cogl-pango.h>
|
#include <cogl-pango/cogl-pango.h>
|
||||||
@@ -83,17 +76,12 @@
|
|||||||
|
|
||||||
/* main context */
|
/* main context */
|
||||||
static ClutterMainContext *ClutterCntx = NULL;
|
static ClutterMainContext *ClutterCntx = NULL;
|
||||||
G_LOCK_DEFINE_STATIC (ClutterCntx);
|
|
||||||
|
|
||||||
/* main lock and locking/unlocking functions */
|
|
||||||
static GMutex clutter_threads_mutex;
|
|
||||||
|
|
||||||
/* command line options */
|
/* command line options */
|
||||||
static gboolean clutter_is_initialized = FALSE;
|
static gboolean clutter_is_initialized = FALSE;
|
||||||
static gboolean clutter_show_fps = FALSE;
|
static gboolean clutter_show_fps = FALSE;
|
||||||
static gboolean clutter_fatal_warnings = FALSE;
|
static gboolean clutter_fatal_warnings = FALSE;
|
||||||
static gboolean clutter_disable_mipmap_text = FALSE;
|
static gboolean clutter_disable_mipmap_text = FALSE;
|
||||||
static gboolean clutter_use_fuzzy_picking = FALSE;
|
|
||||||
static gboolean clutter_enable_accessibility = TRUE;
|
static gboolean clutter_enable_accessibility = TRUE;
|
||||||
static gboolean clutter_sync_to_vblank = TRUE;
|
static gboolean clutter_sync_to_vblank = TRUE;
|
||||||
|
|
||||||
@@ -101,9 +89,6 @@ static guint clutter_default_fps = 60;
|
|||||||
|
|
||||||
static ClutterTextDirection clutter_text_direction = CLUTTER_TEXT_DIRECTION_LTR;
|
static ClutterTextDirection clutter_text_direction = CLUTTER_TEXT_DIRECTION_LTR;
|
||||||
|
|
||||||
static guint clutter_main_loop_level = 0;
|
|
||||||
static GSList *main_loops = NULL;
|
|
||||||
|
|
||||||
/* debug flags */
|
/* debug flags */
|
||||||
guint clutter_debug_flags = 0;
|
guint clutter_debug_flags = 0;
|
||||||
guint clutter_paint_debug_flags = 0;
|
guint clutter_paint_debug_flags = 0;
|
||||||
@@ -145,12 +130,6 @@ static const GDebugKey clutter_paint_debug_keys[] = {
|
|||||||
{ "damage-region", CLUTTER_DEBUG_PAINT_DAMAGE_REGION },
|
{ "damage-region", CLUTTER_DEBUG_PAINT_DAMAGE_REGION },
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void
|
|
||||||
clutter_threads_init_default (void)
|
|
||||||
{
|
|
||||||
g_mutex_init (&clutter_threads_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ENVIRONMENT_GROUP "Environment"
|
#define ENVIRONMENT_GROUP "Environment"
|
||||||
#define DEBUG_GROUP "Debug"
|
#define DEBUG_GROUP "Debug"
|
||||||
|
|
||||||
@@ -196,16 +175,6 @@ clutter_config_read_from_key_file (GKeyFile *keyfile)
|
|||||||
else
|
else
|
||||||
clutter_disable_mipmap_text = bool_value;
|
clutter_disable_mipmap_text = bool_value;
|
||||||
|
|
||||||
bool_value =
|
|
||||||
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
|
|
||||||
"UseFuzzyPicking",
|
|
||||||
&key_error);
|
|
||||||
|
|
||||||
if (key_error != NULL)
|
|
||||||
g_clear_error (&key_error);
|
|
||||||
else
|
|
||||||
clutter_use_fuzzy_picking = bool_value;
|
|
||||||
|
|
||||||
bool_value =
|
bool_value =
|
||||||
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
|
g_key_file_get_boolean (keyfile, ENVIRONMENT_GROUP,
|
||||||
"EnableAccessibility",
|
"EnableAccessibility",
|
||||||
@@ -460,93 +429,15 @@ clutter_get_text_direction (void)
|
|||||||
return dir;
|
return dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_main_quit:
|
|
||||||
*
|
|
||||||
* Terminates the Clutter mainloop.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_main_quit (void)
|
|
||||||
{
|
|
||||||
if (main_loops == NULL)
|
|
||||||
{
|
|
||||||
g_critical ("Calling clutter_main_quit() without calling clutter_main() "
|
|
||||||
"is not allowed. If you are using another main loop, use the "
|
|
||||||
"appropriate API to terminate it.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLUTTER_NOTE (MISC, "Terminating main loop level %d", clutter_main_loop_level);
|
|
||||||
|
|
||||||
g_main_loop_quit (main_loops->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_main_level:
|
|
||||||
*
|
|
||||||
* Retrieves the depth of the Clutter mainloop.
|
|
||||||
*
|
|
||||||
* Return value: The level of the mainloop.
|
|
||||||
*/
|
|
||||||
gint
|
|
||||||
clutter_main_level (void)
|
|
||||||
{
|
|
||||||
return clutter_main_loop_level;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_main:
|
|
||||||
*
|
|
||||||
* Starts the Clutter mainloop.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_main (void)
|
|
||||||
{
|
|
||||||
GMainLoop *loop;
|
|
||||||
|
|
||||||
if (!_clutter_context_is_initialized ())
|
|
||||||
{
|
|
||||||
g_warning ("Called clutter_main() but Clutter wasn't initialised. "
|
|
||||||
"You must call clutter_init() first.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
clutter_main_loop_level++;
|
|
||||||
|
|
||||||
CLUTTER_NOTE (MISC, "Entering main loop level %d", clutter_main_loop_level);
|
|
||||||
|
|
||||||
loop = g_main_loop_new (NULL, TRUE);
|
|
||||||
main_loops = g_slist_prepend (main_loops, loop);
|
|
||||||
|
|
||||||
if (g_main_loop_is_running (main_loops->data))
|
|
||||||
{
|
|
||||||
_clutter_threads_release_lock ();
|
|
||||||
g_main_loop_run (loop);
|
|
||||||
_clutter_threads_acquire_lock ();
|
|
||||||
}
|
|
||||||
|
|
||||||
main_loops = g_slist_remove (main_loops, loop);
|
|
||||||
|
|
||||||
g_main_loop_unref (loop);
|
|
||||||
|
|
||||||
CLUTTER_NOTE (MISC, "Leaving main loop level %d", clutter_main_loop_level);
|
|
||||||
|
|
||||||
clutter_main_loop_level--;
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_clutter_threads_dispatch (gpointer data)
|
_clutter_threads_dispatch (gpointer data)
|
||||||
{
|
{
|
||||||
ClutterThreadsDispatch *dispatch = data;
|
ClutterThreadsDispatch *dispatch = data;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
_clutter_threads_acquire_lock ();
|
|
||||||
|
|
||||||
if (!g_source_is_destroyed (g_main_current_source ()))
|
if (!g_source_is_destroyed (g_main_current_source ()))
|
||||||
ret = dispatch->func (dispatch->data);
|
ret = dispatch->func (dispatch->data);
|
||||||
|
|
||||||
_clutter_threads_release_lock ();
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -771,40 +662,6 @@ clutter_threads_add_timeout (guint interval,
|
|||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_threads_acquire_lock (void)
|
|
||||||
{
|
|
||||||
g_mutex_lock (&clutter_threads_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_threads_release_lock (void)
|
|
||||||
{
|
|
||||||
/* we need to trylock here, in case the lock hasn't been acquired; on
|
|
||||||
* various systems trying to release a mutex that hasn't been acquired
|
|
||||||
* will cause a run-time error. trylock() will either fail, in which
|
|
||||||
* case we can release the lock we own; or it will succeeds, in which
|
|
||||||
* case we need to release the lock we just acquired. so we ignore the
|
|
||||||
* returned value.
|
|
||||||
*
|
|
||||||
* see: https://bugs.gnome.org/679439
|
|
||||||
*/
|
|
||||||
g_mutex_trylock (&clutter_threads_mutex);
|
|
||||||
g_mutex_unlock (&clutter_threads_mutex);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_context_lock (void)
|
|
||||||
{
|
|
||||||
G_LOCK (ClutterCntx);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_context_unlock (void)
|
|
||||||
{
|
|
||||||
G_UNLOCK (ClutterCntx);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_clutter_context_is_initialized (void)
|
_clutter_context_is_initialized (void)
|
||||||
{
|
{
|
||||||
@@ -814,8 +671,8 @@ _clutter_context_is_initialized (void)
|
|||||||
return ClutterCntx->is_initialized;
|
return ClutterCntx->is_initialized;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClutterMainContext *
|
ClutterMainContext *
|
||||||
clutter_context_get_default_unlocked (void)
|
_clutter_context_get_default (void)
|
||||||
{
|
{
|
||||||
if (G_UNLIKELY (ClutterCntx == NULL))
|
if (G_UNLIKELY (ClutterCntx == NULL))
|
||||||
{
|
{
|
||||||
@@ -840,26 +697,14 @@ clutter_context_get_default_unlocked (void)
|
|||||||
ctx->settings = clutter_settings_get_default ();
|
ctx->settings = clutter_settings_get_default ();
|
||||||
_clutter_settings_set_backend (ctx->settings, ctx->backend);
|
_clutter_settings_set_backend (ctx->settings, ctx->backend);
|
||||||
|
|
||||||
|
ctx->events_queue = g_async_queue_new ();
|
||||||
|
|
||||||
ctx->last_repaint_id = 1;
|
ctx->last_repaint_id = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ClutterCntx;
|
return ClutterCntx;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterMainContext *
|
|
||||||
_clutter_context_get_default (void)
|
|
||||||
{
|
|
||||||
ClutterMainContext *retval;
|
|
||||||
|
|
||||||
_clutter_context_lock ();
|
|
||||||
|
|
||||||
retval = clutter_context_get_default_unlocked ();
|
|
||||||
|
|
||||||
_clutter_context_unlock ();
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
clutter_arg_direction_cb (const char *key,
|
clutter_arg_direction_cb (const char *key,
|
||||||
const char *value,
|
const char *value,
|
||||||
@@ -990,9 +835,6 @@ static GOptionEntry clutter_args[] = {
|
|||||||
{ "clutter-disable-mipmapped-text", 0, 0, G_OPTION_ARG_NONE,
|
{ "clutter-disable-mipmapped-text", 0, 0, G_OPTION_ARG_NONE,
|
||||||
&clutter_disable_mipmap_text,
|
&clutter_disable_mipmap_text,
|
||||||
N_("Disable mipmapping on text"), NULL },
|
N_("Disable mipmapping on text"), NULL },
|
||||||
{ "clutter-use-fuzzy-picking", 0, 0, G_OPTION_ARG_NONE,
|
|
||||||
&clutter_use_fuzzy_picking,
|
|
||||||
N_("Use 'fuzzy' picking"), NULL },
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
#ifdef CLUTTER_ENABLE_DEBUG
|
||||||
{ "clutter-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_debug_cb,
|
{ "clutter-debug", 0, 0, G_OPTION_ARG_CALLBACK, clutter_arg_debug_cb,
|
||||||
N_("Clutter debugging flags to set"), "FLAGS" },
|
N_("Clutter debugging flags to set"), "FLAGS" },
|
||||||
@@ -1074,10 +916,6 @@ pre_parse_hook (GOptionContext *context,
|
|||||||
if (env_string)
|
if (env_string)
|
||||||
clutter_disable_mipmap_text = TRUE;
|
clutter_disable_mipmap_text = TRUE;
|
||||||
|
|
||||||
env_string = g_getenv ("CLUTTER_FUZZY_PICK");
|
|
||||||
if (env_string)
|
|
||||||
clutter_use_fuzzy_picking = TRUE;
|
|
||||||
|
|
||||||
return _clutter_backend_pre_parse (backend, error);
|
return _clutter_backend_pre_parse (backend, error);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1736,6 +1574,11 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
ClutterEvent *event)
|
ClutterEvent *event)
|
||||||
{
|
{
|
||||||
ClutterInputDevice *device = clutter_event_get_device (event);
|
ClutterInputDevice *device = clutter_event_get_device (event);
|
||||||
|
ClutterMainContext *clutter_context;
|
||||||
|
ClutterBackend *backend;
|
||||||
|
|
||||||
|
clutter_context = _clutter_context_get_default ();
|
||||||
|
backend = clutter_context->backend;
|
||||||
|
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
@@ -1780,7 +1623,9 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
|
|
||||||
emit_crossing_event (event, device);
|
emit_crossing_event (event, device);
|
||||||
|
|
||||||
actor = clutter_input_device_update (device, NULL, FALSE);
|
actor = clutter_input_device_update (device, NULL,
|
||||||
|
CLUTTER_STAGE (stage), FALSE,
|
||||||
|
event);
|
||||||
if (actor != stage)
|
if (actor != stage)
|
||||||
{
|
{
|
||||||
ClutterEvent *crossing;
|
ClutterEvent *crossing;
|
||||||
@@ -1821,7 +1666,6 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_DESTROY_NOTIFY:
|
case CLUTTER_DESTROY_NOTIFY:
|
||||||
case CLUTTER_DELETE:
|
|
||||||
event->any.source = stage;
|
event->any.source = stage;
|
||||||
|
|
||||||
if (_clutter_event_process_filters (event))
|
if (_clutter_event_process_filters (event))
|
||||||
@@ -1832,8 +1676,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CLUTTER_MOTION:
|
case CLUTTER_MOTION:
|
||||||
#ifdef CLUTTER_WINDOWING_X11
|
if (clutter_backend_is_display_server (backend) &&
|
||||||
if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11) &&
|
|
||||||
!(event->any.flags & CLUTTER_EVENT_FLAG_SYNTHETIC))
|
!(event->any.flags & CLUTTER_EVENT_FLAG_SYNTHETIC))
|
||||||
{
|
{
|
||||||
if (_clutter_is_input_pointer_a11y_enabled (device))
|
if (_clutter_is_input_pointer_a11y_enabled (device))
|
||||||
@@ -1844,7 +1687,6 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
_clutter_input_pointer_a11y_on_motion_event (device, x, y);
|
_clutter_input_pointer_a11y_on_motion_event (device, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CLUTTER_WINDOWING_X11 */
|
|
||||||
/* only the stage gets motion events if they are enabled */
|
/* only the stage gets motion events if they are enabled */
|
||||||
if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
|
if (!clutter_stage_get_motion_events_enabled (CLUTTER_STAGE (stage)) &&
|
||||||
event->any.source == NULL)
|
event->any.source == NULL)
|
||||||
@@ -1875,8 +1717,7 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
G_GNUC_FALLTHROUGH;
|
G_GNUC_FALLTHROUGH;
|
||||||
case CLUTTER_BUTTON_PRESS:
|
case CLUTTER_BUTTON_PRESS:
|
||||||
case CLUTTER_BUTTON_RELEASE:
|
case CLUTTER_BUTTON_RELEASE:
|
||||||
#ifdef CLUTTER_WINDOWING_X11
|
if (clutter_backend_is_display_server (backend))
|
||||||
if (!clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
|
|
||||||
{
|
{
|
||||||
if (_clutter_is_input_pointer_a11y_enabled (device) && (event->type != CLUTTER_MOTION))
|
if (_clutter_is_input_pointer_a11y_enabled (device) && (event->type != CLUTTER_MOTION))
|
||||||
{
|
{
|
||||||
@@ -1885,7 +1726,6 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
event->type == CLUTTER_BUTTON_PRESS);
|
event->type == CLUTTER_BUTTON_PRESS);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* CLUTTER_WINDOWING_X11 */
|
|
||||||
case CLUTTER_SCROLL:
|
case CLUTTER_SCROLL:
|
||||||
case CLUTTER_TOUCHPAD_PINCH:
|
case CLUTTER_TOUCHPAD_PINCH:
|
||||||
case CLUTTER_TOUCHPAD_SWIPE:
|
case CLUTTER_TOUCHPAD_SWIPE:
|
||||||
@@ -1934,21 +1774,9 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if the backend provides a device then we should
|
actor = clutter_input_device_update (device, NULL,
|
||||||
* already have everything we need to update it and
|
CLUTTER_STAGE (stage),
|
||||||
* get the actor underneath
|
TRUE, event);
|
||||||
*/
|
|
||||||
if (device != NULL)
|
|
||||||
actor = clutter_input_device_update (device, NULL, TRUE);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CLUTTER_NOTE (EVENT, "No device found: picking");
|
|
||||||
|
|
||||||
actor = _clutter_stage_do_pick (CLUTTER_STAGE (stage),
|
|
||||||
x, y,
|
|
||||||
CLUTTER_PICK_REACTIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actor == NULL)
|
if (actor == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2024,9 +1852,6 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
sequence =
|
sequence =
|
||||||
clutter_event_get_event_sequence (event);
|
clutter_event_get_event_sequence (event);
|
||||||
|
|
||||||
if (event->type == CLUTTER_TOUCH_BEGIN)
|
|
||||||
_clutter_input_device_add_event_sequence (device, event);
|
|
||||||
|
|
||||||
clutter_event_get_coords (event, &x, &y);
|
clutter_event_get_coords (event, &x, &y);
|
||||||
|
|
||||||
/* Only do a pick to find the source if source is not already set
|
/* Only do a pick to find the source if source is not already set
|
||||||
@@ -2049,23 +1874,16 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
|
|
||||||
emit_touch_event (event, device);
|
emit_touch_event (event, device);
|
||||||
|
|
||||||
if (event->type == CLUTTER_TOUCH_END)
|
if (event->type == CLUTTER_TOUCH_END ||
|
||||||
|
event->type == CLUTTER_TOUCH_CANCEL)
|
||||||
_clutter_input_device_remove_event_sequence (device, event);
|
_clutter_input_device_remove_event_sequence (device, event);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device != NULL)
|
actor = clutter_input_device_update (device, sequence,
|
||||||
actor = clutter_input_device_update (device, sequence, TRUE);
|
CLUTTER_STAGE (stage),
|
||||||
else
|
TRUE, event);
|
||||||
{
|
|
||||||
CLUTTER_NOTE (EVENT, "No device found: picking");
|
|
||||||
|
|
||||||
actor = _clutter_stage_do_pick (CLUTTER_STAGE (stage),
|
|
||||||
x, y,
|
|
||||||
CLUTTER_PICK_REACTIVE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actor == NULL)
|
if (actor == NULL)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2084,7 +1902,8 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
|
|
||||||
emit_touch_event (event, device);
|
emit_touch_event (event, device);
|
||||||
|
|
||||||
if (event->type == CLUTTER_TOUCH_END)
|
if (event->type == CLUTTER_TOUCH_END ||
|
||||||
|
event->type == CLUTTER_TOUCH_CANCEL)
|
||||||
_clutter_input_device_remove_event_sequence (device, event);
|
_clutter_input_device_remove_event_sequence (device, event);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -2116,6 +1935,11 @@ _clutter_process_event_details (ClutterActor *stage,
|
|||||||
case CLUTTER_CLIENT_MESSAGE:
|
case CLUTTER_CLIENT_MESSAGE:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
|
_clutter_event_process_filters (event);
|
||||||
|
break;
|
||||||
|
|
||||||
case CLUTTER_EVENT_LAST:
|
case CLUTTER_EVENT_LAST:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2154,27 +1978,6 @@ _clutter_process_event (ClutterEvent *event)
|
|||||||
context->current_event = g_slist_delete_link (context->current_event, context->current_event);
|
context->current_event = g_slist_delete_link (context->current_event, context->current_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_get_actor_by_gid:
|
|
||||||
* @id_: a #ClutterActor unique id.
|
|
||||||
*
|
|
||||||
* Retrieves the #ClutterActor with @id_.
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): the actor with the passed id or %NULL.
|
|
||||||
* The returned actor does not have its reference count increased.
|
|
||||||
*
|
|
||||||
* Since: 0.6
|
|
||||||
*
|
|
||||||
* Deprecated: 1.8: The id is deprecated, and this function always returns
|
|
||||||
* %NULL. Use the proper scene graph API in #ClutterActor to find a child
|
|
||||||
* of the stage.
|
|
||||||
*/
|
|
||||||
ClutterActor *
|
|
||||||
clutter_get_actor_by_gid (guint32 id_)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_base_init (void)
|
clutter_base_init (void)
|
||||||
{
|
{
|
||||||
@@ -2189,9 +1992,6 @@ clutter_base_init (void)
|
|||||||
g_type_init ();
|
g_type_init ();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* initialise the Big Clutter Lock™ if necessary */
|
|
||||||
clutter_threads_init_default ();
|
|
||||||
|
|
||||||
clutter_graphene_init ();
|
clutter_graphene_init ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2259,9 +2059,7 @@ clutter_threads_remove_repaint_func (guint handle_id)
|
|||||||
|
|
||||||
g_return_if_fail (handle_id > 0);
|
g_return_if_fail (handle_id > 0);
|
||||||
|
|
||||||
_clutter_context_lock ();
|
context = _clutter_context_get_default ();
|
||||||
|
|
||||||
context = clutter_context_get_default_unlocked ();
|
|
||||||
l = context->repaint_funcs;
|
l = context->repaint_funcs;
|
||||||
while (l != NULL)
|
while (l != NULL)
|
||||||
{
|
{
|
||||||
@@ -2284,8 +2082,6 @@ clutter_threads_remove_repaint_func (guint handle_id)
|
|||||||
|
|
||||||
l = l->next;
|
l = l->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
_clutter_context_unlock ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2384,16 +2180,13 @@ clutter_threads_add_repaint_func_full (ClutterRepaintFlags flags,
|
|||||||
|
|
||||||
g_return_val_if_fail (func != NULL, 0);
|
g_return_val_if_fail (func != NULL, 0);
|
||||||
|
|
||||||
_clutter_context_lock ();
|
context = _clutter_context_get_default ();
|
||||||
|
|
||||||
context = clutter_context_get_default_unlocked ();
|
|
||||||
|
|
||||||
repaint_func = g_slice_new (ClutterRepaintFunction);
|
repaint_func = g_slice_new (ClutterRepaintFunction);
|
||||||
|
|
||||||
repaint_func->id = context->last_repaint_id++;
|
repaint_func->id = context->last_repaint_id++;
|
||||||
|
|
||||||
/* mask out QUEUE_REDRAW_ON_ADD, since we're going to consume it */
|
repaint_func->flags = flags;
|
||||||
repaint_func->flags = flags & ~CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD;
|
|
||||||
repaint_func->func = func;
|
repaint_func->func = func;
|
||||||
repaint_func->data = data;
|
repaint_func->data = data;
|
||||||
repaint_func->notify = notify;
|
repaint_func->notify = notify;
|
||||||
@@ -2401,15 +2194,6 @@ clutter_threads_add_repaint_func_full (ClutterRepaintFlags flags,
|
|||||||
context->repaint_funcs = g_list_prepend (context->repaint_funcs,
|
context->repaint_funcs = g_list_prepend (context->repaint_funcs,
|
||||||
repaint_func);
|
repaint_func);
|
||||||
|
|
||||||
_clutter_context_unlock ();
|
|
||||||
|
|
||||||
if ((flags & CLUTTER_REPAINT_FLAGS_QUEUE_REDRAW_ON_ADD) != 0)
|
|
||||||
{
|
|
||||||
ClutterMasterClock *master_clock = _clutter_master_clock_get_default ();
|
|
||||||
|
|
||||||
_clutter_master_clock_ensure_next_iteration (master_clock);
|
|
||||||
}
|
|
||||||
|
|
||||||
return repaint_func->id;
|
return repaint_func->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2504,39 +2288,16 @@ void
|
|||||||
_clutter_clear_events_queue (void)
|
_clutter_clear_events_queue (void)
|
||||||
{
|
{
|
||||||
ClutterMainContext *context = _clutter_context_get_default ();
|
ClutterMainContext *context = _clutter_context_get_default ();
|
||||||
|
ClutterEvent *event;
|
||||||
|
|
||||||
if (context->events_queue != NULL)
|
/* Lock the queue for as long as it lives */
|
||||||
{
|
g_async_queue_lock (context->events_queue);
|
||||||
g_queue_foreach (context->events_queue,
|
|
||||||
(GFunc) clutter_event_free,
|
|
||||||
NULL);
|
|
||||||
g_queue_free (context->events_queue);
|
|
||||||
context->events_queue = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
while ((event = g_async_queue_try_pop_unlocked (context->events_queue)))
|
||||||
_clutter_clear_events_queue_for_stage (ClutterStage *stage)
|
clutter_event_free (event);
|
||||||
{
|
|
||||||
ClutterMainContext *context = _clutter_context_get_default ();
|
|
||||||
GList *l, *next;
|
|
||||||
|
|
||||||
if (context->events_queue == NULL)
|
g_async_queue_unref (context->events_queue);
|
||||||
return;
|
context->events_queue = NULL;
|
||||||
|
|
||||||
/* Remove any pending events for this stage from the event queue */
|
|
||||||
for (l = context->events_queue->head; l; l = next)
|
|
||||||
{
|
|
||||||
ClutterEvent *event = l->data;
|
|
||||||
|
|
||||||
next = l->next;
|
|
||||||
|
|
||||||
if (event->any.stage == stage)
|
|
||||||
{
|
|
||||||
g_queue_delete_link (context->events_queue, l);
|
|
||||||
clutter_event_free (event);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClutterPickMode
|
ClutterPickMode
|
||||||
@@ -2547,58 +2308,6 @@ _clutter_context_get_pick_mode (void)
|
|||||||
return context->pick_mode;
|
return context->pick_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_check_windowing_backend:
|
|
||||||
* @backend_type: the name of the backend to check
|
|
||||||
*
|
|
||||||
* Checks the run-time name of the Clutter windowing system backend, using
|
|
||||||
* the symbolic macros like %CLUTTER_WINDOWING_X11.
|
|
||||||
*
|
|
||||||
* This function should be used in conjuction with the compile-time macros
|
|
||||||
* inside applications and libraries that are using the platform-specific
|
|
||||||
* windowing system API, to ensure that they are running on the correct
|
|
||||||
* windowing system; for instance:
|
|
||||||
*
|
|
||||||
* |[
|
|
||||||
* #ifdef CLUTTER_WINDOWING_X11
|
|
||||||
* if (clutter_check_windowing_backend (CLUTTER_WINDOWING_X11))
|
|
||||||
* {
|
|
||||||
* // it is safe to use the clutter_x11_* API
|
|
||||||
* }
|
|
||||||
* else
|
|
||||||
* #endif
|
|
||||||
* g_error ("Unknown Clutter backend.");
|
|
||||||
* ]|
|
|
||||||
*
|
|
||||||
* Return value: %TRUE if the current Clutter windowing system backend is
|
|
||||||
* the one checked, and %FALSE otherwise
|
|
||||||
*
|
|
||||||
* Since: 1.10
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
clutter_check_windowing_backend (const char *backend_type)
|
|
||||||
{
|
|
||||||
ClutterMainContext *context = _clutter_context_get_default ();
|
|
||||||
|
|
||||||
g_return_val_if_fail (backend_type != NULL, FALSE);
|
|
||||||
|
|
||||||
backend_type = g_intern_string (backend_type);
|
|
||||||
|
|
||||||
#ifdef CLUTTER_WINDOWING_EGL
|
|
||||||
if (backend_type == I_(CLUTTER_WINDOWING_EGL) &&
|
|
||||||
CLUTTER_IS_BACKEND_EGL_NATIVE (context->backend))
|
|
||||||
return TRUE;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
#ifdef CLUTTER_WINDOWING_X11
|
|
||||||
if (backend_type == I_(CLUTTER_WINDOWING_X11) &&
|
|
||||||
CLUTTER_IS_BACKEND_X11 (context->backend))
|
|
||||||
return TRUE;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_add_debug_flags: (skip)
|
* clutter_add_debug_flags: (skip)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -136,14 +136,6 @@ GOptionGroup * clutter_get_option_group (void);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
GOptionGroup * clutter_get_option_group_without_init (void);
|
GOptionGroup * clutter_get_option_group_without_init (void);
|
||||||
|
|
||||||
/* Mainloop */
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_main (void);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_main_quit (void);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
gint clutter_main_level (void);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_do_event (ClutterEvent *event);
|
void clutter_do_event (ClutterEvent *event);
|
||||||
|
|
||||||
@@ -194,9 +186,6 @@ ClutterTextDirection clutter_get_default_text_direction (void);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
guint clutter_get_default_frame_rate (void);
|
guint clutter_get_default_frame_rate (void);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
gboolean clutter_check_windowing_backend (const char *backend_type);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
|
void clutter_add_debug_flags (ClutterDebugFlag debug_flags,
|
||||||
ClutterDrawDebugFlag draw_flags,
|
ClutterDrawDebugFlag draw_flags,
|
||||||
|
|||||||
@@ -1,618 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Authored By: Emmanuele Bassi <ebassi@linux.intel.com>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Intel Corporation.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SECTION:clutter-master-clock-default
|
|
||||||
* @short_description: The default master clock for all animations
|
|
||||||
*
|
|
||||||
* The #ClutterMasterClockDefault class is the default implementation
|
|
||||||
* of #ClutterMasterClock.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
|
||||||
|
|
||||||
#include <cogl/cogl.h>
|
|
||||||
|
|
||||||
#include "clutter-master-clock.h"
|
|
||||||
#include "clutter-master-clock-default.h"
|
|
||||||
#include "clutter-debug.h"
|
|
||||||
#include "clutter-private.h"
|
|
||||||
#include "clutter-stage-manager-private.h"
|
|
||||||
#include "clutter-stage-private.h"
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
#define clutter_warn_if_over_budget(master_clock,start_time,section) G_STMT_START { \
|
|
||||||
gint64 __delta = g_get_monotonic_time () - start_time; \
|
|
||||||
gint64 __budget = master_clock->remaining_budget; \
|
|
||||||
if (__budget > 0 && __delta >= __budget) { \
|
|
||||||
_clutter_diagnostic_message ("%s took %" G_GINT64_FORMAT " microseconds " \
|
|
||||||
"more than the remaining budget of %" G_GINT64_FORMAT \
|
|
||||||
" microseconds", \
|
|
||||||
section, __delta - __budget, __budget); \
|
|
||||||
} } G_STMT_END
|
|
||||||
#else
|
|
||||||
#define clutter_warn_if_over_budget(master_clock,start_time,section)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct _ClutterClockSource ClutterClockSource;
|
|
||||||
|
|
||||||
struct _ClutterMasterClockDefault
|
|
||||||
{
|
|
||||||
GObject parent_instance;
|
|
||||||
|
|
||||||
/* the list of timelines handled by the clock */
|
|
||||||
GSList *timelines;
|
|
||||||
|
|
||||||
/* the current state of the clock, in usecs */
|
|
||||||
gint64 cur_tick;
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
gint64 frame_budget;
|
|
||||||
gint64 remaining_budget;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* an idle source, used by the Master Clock to queue
|
|
||||||
* a redraw on the stage and drive the animations
|
|
||||||
*/
|
|
||||||
GSource *source;
|
|
||||||
|
|
||||||
guint ensure_next_iteration : 1;
|
|
||||||
|
|
||||||
guint paused : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _ClutterClockSource
|
|
||||||
{
|
|
||||||
GSource source;
|
|
||||||
|
|
||||||
ClutterMasterClockDefault *master_clock;
|
|
||||||
};
|
|
||||||
|
|
||||||
static gboolean clutter_clock_prepare (GSource *source,
|
|
||||||
gint *timeout);
|
|
||||||
static gboolean clutter_clock_check (GSource *source);
|
|
||||||
static gboolean clutter_clock_dispatch (GSource *source,
|
|
||||||
GSourceFunc callback,
|
|
||||||
gpointer user_data);
|
|
||||||
|
|
||||||
static GSourceFuncs clock_funcs = {
|
|
||||||
clutter_clock_prepare,
|
|
||||||
clutter_clock_check,
|
|
||||||
clutter_clock_dispatch,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_iface_init (ClutterMasterClockInterface *iface);
|
|
||||||
|
|
||||||
#define clutter_master_clock_default_get_type _clutter_master_clock_default_get_type
|
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (ClutterMasterClockDefault,
|
|
||||||
clutter_master_clock_default,
|
|
||||||
G_TYPE_OBJECT,
|
|
||||||
G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_MASTER_CLOCK,
|
|
||||||
clutter_master_clock_iface_init));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* master_clock_is_running:
|
|
||||||
* @master_clock: a #ClutterMasterClock
|
|
||||||
*
|
|
||||||
* Checks if we should currently be advancing timelines or redrawing
|
|
||||||
* stages.
|
|
||||||
*
|
|
||||||
* Return value: %TRUE if the #ClutterMasterClock has at least
|
|
||||||
* one running timeline
|
|
||||||
*/
|
|
||||||
static gboolean
|
|
||||||
master_clock_is_running (ClutterMasterClockDefault *master_clock)
|
|
||||||
{
|
|
||||||
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
|
|
||||||
const GSList *stages, *l;
|
|
||||||
|
|
||||||
stages = clutter_stage_manager_peek_stages (stage_manager);
|
|
||||||
|
|
||||||
if (master_clock->paused)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (master_clock->timelines)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
for (l = stages; l; l = l->next)
|
|
||||||
{
|
|
||||||
if (clutter_actor_is_mapped (l->data) &&
|
|
||||||
(_clutter_stage_has_queued_events (l->data) ||
|
|
||||||
_clutter_stage_needs_update (l->data)))
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (master_clock->ensure_next_iteration)
|
|
||||||
{
|
|
||||||
master_clock->ensure_next_iteration = FALSE;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gint
|
|
||||||
master_clock_get_swap_wait_time (ClutterMasterClockDefault *master_clock)
|
|
||||||
{
|
|
||||||
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
|
|
||||||
const GSList *stages, *l;
|
|
||||||
gint64 min_update_time = -1;
|
|
||||||
|
|
||||||
stages = clutter_stage_manager_peek_stages (stage_manager);
|
|
||||||
|
|
||||||
for (l = stages; l != NULL; l = l->next)
|
|
||||||
{
|
|
||||||
gint64 update_time = _clutter_stage_get_update_time (l->data);
|
|
||||||
if (min_update_time == -1 ||
|
|
||||||
(update_time != -1 && update_time < min_update_time))
|
|
||||||
min_update_time = update_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (min_update_time == -1)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gint64 now = g_source_get_time (master_clock->source);
|
|
||||||
if (min_update_time < now)
|
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
gint64 delay_us = min_update_time - now;
|
|
||||||
return (delay_us + 999) / 1000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
master_clock_schedule_stage_updates (ClutterMasterClockDefault *master_clock)
|
|
||||||
{
|
|
||||||
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
|
|
||||||
const GSList *stages, *l;
|
|
||||||
|
|
||||||
stages = clutter_stage_manager_peek_stages (stage_manager);
|
|
||||||
|
|
||||||
for (l = stages; l != NULL; l = l->next)
|
|
||||||
_clutter_stage_schedule_update (l->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GSList *
|
|
||||||
master_clock_list_ready_stages (ClutterMasterClockDefault *master_clock)
|
|
||||||
{
|
|
||||||
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
|
|
||||||
const GSList *stages, *l;
|
|
||||||
GSList *result;
|
|
||||||
|
|
||||||
stages = clutter_stage_manager_peek_stages (stage_manager);
|
|
||||||
|
|
||||||
result = NULL;
|
|
||||||
for (l = stages; l != NULL; l = l->next)
|
|
||||||
{
|
|
||||||
gint64 update_time = _clutter_stage_get_update_time (l->data);
|
|
||||||
/* We carefully avoid to update stages that aren't mapped, because
|
|
||||||
* they have nothing to render and this could cause a deadlock with
|
|
||||||
* some of the SwapBuffers implementations (in particular
|
|
||||||
* GLX_INTEL_swap_event is not emitted if nothing was rendered).
|
|
||||||
*
|
|
||||||
* Also, if a stage has a swap-buffers pending we don't want to draw
|
|
||||||
* to it in case the driver may block the CPU while it waits for the
|
|
||||||
* next backbuffer to become available.
|
|
||||||
*
|
|
||||||
* TODO: We should be able to identify if we are running triple or N
|
|
||||||
* buffered and in these cases we can still draw if there is 1 swap
|
|
||||||
* pending so we can hopefully always be ready to swap for the next
|
|
||||||
* vblank and really match the vsync frequency.
|
|
||||||
*/
|
|
||||||
if (clutter_actor_is_mapped (l->data) &&
|
|
||||||
update_time != -1 && update_time <= master_clock->cur_tick)
|
|
||||||
result = g_slist_prepend (result, g_object_ref (l->data));
|
|
||||||
}
|
|
||||||
|
|
||||||
return g_slist_reverse (result);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
master_clock_reschedule_stage_updates (ClutterMasterClockDefault *master_clock,
|
|
||||||
GSList *stages)
|
|
||||||
{
|
|
||||||
const GSList *l;
|
|
||||||
|
|
||||||
for (l = stages; l != NULL; l = l->next)
|
|
||||||
{
|
|
||||||
/* Clear the old update time */
|
|
||||||
_clutter_stage_clear_update_time (l->data);
|
|
||||||
|
|
||||||
/* And if there is still work to be done, schedule a new one */
|
|
||||||
if (master_clock->timelines ||
|
|
||||||
_clutter_stage_has_queued_events (l->data) ||
|
|
||||||
_clutter_stage_needs_update (l->data))
|
|
||||||
_clutter_stage_schedule_update (l->data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* master_clock_next_frame_delay:
|
|
||||||
* @master_clock: a #ClutterMasterClock
|
|
||||||
*
|
|
||||||
* Computes the number of delay before we need to draw the next frame.
|
|
||||||
*
|
|
||||||
* Return value: -1 if there is no next frame pending, otherwise the
|
|
||||||
* number of millseconds before the we need to draw the next frame
|
|
||||||
*/
|
|
||||||
static gint
|
|
||||||
master_clock_next_frame_delay (ClutterMasterClockDefault *master_clock)
|
|
||||||
{
|
|
||||||
if (!master_clock_is_running (master_clock))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
/* If all of the stages are busy waiting for a swap-buffers to complete
|
|
||||||
* then we wait for one to be ready.. */
|
|
||||||
return master_clock_get_swap_wait_time (master_clock);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
master_clock_process_events (ClutterMasterClockDefault *master_clock,
|
|
||||||
GSList *stages)
|
|
||||||
{
|
|
||||||
GSList *l;
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
gint64 start = g_get_monotonic_time ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Process queued events */
|
|
||||||
for (l = stages; l != NULL; l = l->next)
|
|
||||||
_clutter_stage_process_queued_events (l->data);
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
if (_clutter_diagnostic_enabled ())
|
|
||||||
clutter_warn_if_over_budget (master_clock, start, "Event processing");
|
|
||||||
|
|
||||||
master_clock->remaining_budget -= (g_get_monotonic_time () - start);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* master_clock_advance_timelines:
|
|
||||||
* @master_clock: a #ClutterMasterClock
|
|
||||||
*
|
|
||||||
* Advances all the timelines held by the master clock. This function
|
|
||||||
* should be called before calling _clutter_stage_do_update() to
|
|
||||||
* make sure that all the timelines are advanced and the scene is updated.
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
master_clock_advance_timelines (ClutterMasterClockDefault *master_clock)
|
|
||||||
{
|
|
||||||
GSList *timelines, *l;
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
gint64 start = g_get_monotonic_time ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* we protect ourselves from timelines being removed during
|
|
||||||
* the advancement by other timelines by copying the list of
|
|
||||||
* timelines, taking a reference on them, iterating over the
|
|
||||||
* copied list and then releasing the reference.
|
|
||||||
*
|
|
||||||
* we cannot simply take a reference on the timelines and still
|
|
||||||
* use the list held by the master clock because the do_tick()
|
|
||||||
* might result in the creation of a new timeline, which gets
|
|
||||||
* added at the end of the list with no reference increase and
|
|
||||||
* thus gets disposed at the end of the iteration.
|
|
||||||
*
|
|
||||||
* this implies that a newly added timeline will not be advanced
|
|
||||||
* by this clock iteration, which is perfectly fine since we're
|
|
||||||
* in its first cycle.
|
|
||||||
*
|
|
||||||
* we also cannot steal the master clock timelines list because
|
|
||||||
* a timeline might be removed as the direct result of do_tick()
|
|
||||||
* and remove_timeline() would not find the timeline, failing
|
|
||||||
* and leaving a dangling pointer behind.
|
|
||||||
*/
|
|
||||||
timelines = g_slist_copy (master_clock->timelines);
|
|
||||||
g_slist_foreach (timelines, (GFunc) g_object_ref, NULL);
|
|
||||||
|
|
||||||
for (l = timelines; l != NULL; l = l->next)
|
|
||||||
_clutter_timeline_do_tick (l->data, master_clock->cur_tick / 1000);
|
|
||||||
|
|
||||||
g_slist_free_full (timelines, g_object_unref);
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
if (_clutter_diagnostic_enabled ())
|
|
||||||
clutter_warn_if_over_budget (master_clock, start, "Animations");
|
|
||||||
|
|
||||||
master_clock->remaining_budget -= (g_get_monotonic_time () - start);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
master_clock_update_stages (ClutterMasterClockDefault *master_clock,
|
|
||||||
GSList *stages)
|
|
||||||
{
|
|
||||||
gboolean stages_updated = FALSE;
|
|
||||||
GSList *l;
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
gint64 start = g_get_monotonic_time ();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
_clutter_run_repaint_functions (CLUTTER_REPAINT_FLAGS_PRE_PAINT);
|
|
||||||
|
|
||||||
/* Update any stage that needs redraw/relayout after the clock
|
|
||||||
* is advanced.
|
|
||||||
*/
|
|
||||||
for (l = stages; l != NULL; l = l->next)
|
|
||||||
stages_updated |= _clutter_stage_do_update (l->data);
|
|
||||||
|
|
||||||
_clutter_run_repaint_functions (CLUTTER_REPAINT_FLAGS_POST_PAINT);
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
if (_clutter_diagnostic_enabled ())
|
|
||||||
clutter_warn_if_over_budget (master_clock, start, "Updating the stage");
|
|
||||||
|
|
||||||
master_clock->remaining_budget -= (g_get_monotonic_time () - start);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return stages_updated;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* clutter_clock_source_new:
|
|
||||||
* @master_clock: a #ClutterMasterClock for the source
|
|
||||||
*
|
|
||||||
* The #ClutterClockSource is an idle GSource that will queue a redraw
|
|
||||||
* if @master_clock has at least a running #ClutterTimeline. The redraw
|
|
||||||
* will cause @master_clock to advance all timelines, thus advancing all
|
|
||||||
* animations as well.
|
|
||||||
*
|
|
||||||
* Return value: the newly created #GSource
|
|
||||||
*/
|
|
||||||
static GSource *
|
|
||||||
clutter_clock_source_new (ClutterMasterClockDefault *master_clock)
|
|
||||||
{
|
|
||||||
GSource *source = g_source_new (&clock_funcs, sizeof (ClutterClockSource));
|
|
||||||
ClutterClockSource *clock_source = (ClutterClockSource *) source;
|
|
||||||
|
|
||||||
g_source_set_name (source, "Clutter master clock");
|
|
||||||
g_source_set_priority (source, CLUTTER_PRIORITY_REDRAW);
|
|
||||||
g_source_set_can_recurse (source, FALSE);
|
|
||||||
clock_source->master_clock = master_clock;
|
|
||||||
|
|
||||||
return source;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
clutter_clock_prepare (GSource *source,
|
|
||||||
gint *timeout)
|
|
||||||
{
|
|
||||||
ClutterClockSource *clock_source = (ClutterClockSource *) source;
|
|
||||||
ClutterMasterClockDefault *master_clock = clock_source->master_clock;
|
|
||||||
int delay;
|
|
||||||
|
|
||||||
_clutter_threads_acquire_lock ();
|
|
||||||
|
|
||||||
if (G_UNLIKELY (clutter_paint_debug_flags &
|
|
||||||
CLUTTER_DEBUG_CONTINUOUS_REDRAW))
|
|
||||||
{
|
|
||||||
ClutterStageManager *stage_manager = clutter_stage_manager_get_default ();
|
|
||||||
const GSList *stages, *l;
|
|
||||||
|
|
||||||
stages = clutter_stage_manager_peek_stages (stage_manager);
|
|
||||||
|
|
||||||
/* Queue a full redraw on all of the stages */
|
|
||||||
for (l = stages; l != NULL; l = l->next)
|
|
||||||
clutter_actor_queue_redraw (l->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
delay = master_clock_next_frame_delay (master_clock);
|
|
||||||
|
|
||||||
_clutter_threads_release_lock ();
|
|
||||||
|
|
||||||
*timeout = delay;
|
|
||||||
|
|
||||||
return delay == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
clutter_clock_check (GSource *source)
|
|
||||||
{
|
|
||||||
ClutterClockSource *clock_source = (ClutterClockSource *) source;
|
|
||||||
ClutterMasterClockDefault *master_clock = clock_source->master_clock;
|
|
||||||
int delay;
|
|
||||||
|
|
||||||
_clutter_threads_acquire_lock ();
|
|
||||||
delay = master_clock_next_frame_delay (master_clock);
|
|
||||||
_clutter_threads_release_lock ();
|
|
||||||
|
|
||||||
return delay == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
clutter_clock_dispatch (GSource *source,
|
|
||||||
GSourceFunc callback,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
ClutterClockSource *clock_source = (ClutterClockSource *) source;
|
|
||||||
ClutterMasterClockDefault *master_clock = clock_source->master_clock;
|
|
||||||
GSList *stages;
|
|
||||||
|
|
||||||
CLUTTER_NOTE (SCHEDULER, "Master clock [tick]");
|
|
||||||
|
|
||||||
_clutter_threads_acquire_lock ();
|
|
||||||
|
|
||||||
COGL_TRACE_BEGIN (ClutterMasterClockTick, "Master Clock (tick)");
|
|
||||||
|
|
||||||
/* Get the time to use for this frame */
|
|
||||||
master_clock->cur_tick = g_source_get_time (source);
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
master_clock->remaining_budget = master_clock->frame_budget;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* We need to protect ourselves against stages being destroyed during
|
|
||||||
* event handling - master_clock_list_ready_stages() returns a
|
|
||||||
* list of referenced that we'll unref afterwards.
|
|
||||||
*/
|
|
||||||
stages = master_clock_list_ready_stages (master_clock);
|
|
||||||
|
|
||||||
/* Each frame is split into three separate phases: */
|
|
||||||
|
|
||||||
/* 1. process all the events; each stage goes through its events queue
|
|
||||||
* and processes each event according to its type, then emits the
|
|
||||||
* various signals that are associated with the event
|
|
||||||
*/
|
|
||||||
master_clock_process_events (master_clock, stages);
|
|
||||||
|
|
||||||
/* 2. advance the timelines */
|
|
||||||
master_clock_advance_timelines (master_clock);
|
|
||||||
|
|
||||||
/* 3. relayout and redraw the stages */
|
|
||||||
master_clock_update_stages (master_clock, stages);
|
|
||||||
|
|
||||||
master_clock_reschedule_stage_updates (master_clock, stages);
|
|
||||||
|
|
||||||
g_slist_free_full (stages, g_object_unref);
|
|
||||||
|
|
||||||
COGL_TRACE_END (ClutterMasterClockTick);
|
|
||||||
|
|
||||||
_clutter_threads_release_lock ();
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_default_finalize (GObject *gobject)
|
|
||||||
{
|
|
||||||
ClutterMasterClockDefault *master_clock = CLUTTER_MASTER_CLOCK_DEFAULT (gobject);
|
|
||||||
|
|
||||||
g_slist_free (master_clock->timelines);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_master_clock_default_parent_class)->finalize (gobject);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_default_class_init (ClutterMasterClockDefaultClass *klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
|
||||||
|
|
||||||
gobject_class->finalize = clutter_master_clock_default_finalize;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_default_init (ClutterMasterClockDefault *self)
|
|
||||||
{
|
|
||||||
GSource *source;
|
|
||||||
|
|
||||||
source = clutter_clock_source_new (self);
|
|
||||||
self->source = source;
|
|
||||||
|
|
||||||
self->ensure_next_iteration = FALSE;
|
|
||||||
self->paused = FALSE;
|
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_DEBUG
|
|
||||||
self->frame_budget = G_USEC_PER_SEC / 60;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
g_source_attach (source, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_default_add_timeline (ClutterMasterClock *clock,
|
|
||||||
ClutterTimeline *timeline)
|
|
||||||
{
|
|
||||||
ClutterMasterClockDefault *master_clock = (ClutterMasterClockDefault *) clock;
|
|
||||||
gboolean is_first;
|
|
||||||
|
|
||||||
if (g_slist_find (master_clock->timelines, timeline))
|
|
||||||
return;
|
|
||||||
|
|
||||||
is_first = master_clock->timelines == NULL;
|
|
||||||
|
|
||||||
master_clock->timelines = g_slist_prepend (master_clock->timelines,
|
|
||||||
timeline);
|
|
||||||
|
|
||||||
if (is_first)
|
|
||||||
{
|
|
||||||
master_clock_schedule_stage_updates (master_clock);
|
|
||||||
_clutter_master_clock_start_running (clock);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_default_remove_timeline (ClutterMasterClock *clock,
|
|
||||||
ClutterTimeline *timeline)
|
|
||||||
{
|
|
||||||
ClutterMasterClockDefault *master_clock = (ClutterMasterClockDefault *) clock;
|
|
||||||
|
|
||||||
master_clock->timelines = g_slist_remove (master_clock->timelines,
|
|
||||||
timeline);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_default_start_running (ClutterMasterClock *master_clock)
|
|
||||||
{
|
|
||||||
/* If called from a different thread, we need to wake up the
|
|
||||||
* main loop to start running the timelines
|
|
||||||
*/
|
|
||||||
g_main_context_wakeup (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_default_ensure_next_iteration (ClutterMasterClock *clock)
|
|
||||||
{
|
|
||||||
ClutterMasterClockDefault *master_clock = (ClutterMasterClockDefault *) clock;
|
|
||||||
|
|
||||||
master_clock->ensure_next_iteration = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_default_set_paused (ClutterMasterClock *clock,
|
|
||||||
gboolean paused)
|
|
||||||
{
|
|
||||||
ClutterMasterClockDefault *master_clock = (ClutterMasterClockDefault *) clock;
|
|
||||||
|
|
||||||
if (paused && !master_clock->paused)
|
|
||||||
{
|
|
||||||
g_clear_pointer (&master_clock->source, g_source_destroy);
|
|
||||||
}
|
|
||||||
else if (!paused && master_clock->paused)
|
|
||||||
{
|
|
||||||
master_clock->source = clutter_clock_source_new (master_clock);
|
|
||||||
g_source_attach (master_clock->source, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
master_clock->paused = !!paused;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_iface_init (ClutterMasterClockInterface *iface)
|
|
||||||
{
|
|
||||||
iface->add_timeline = clutter_master_clock_default_add_timeline;
|
|
||||||
iface->remove_timeline = clutter_master_clock_default_remove_timeline;
|
|
||||||
iface->start_running = clutter_master_clock_default_start_running;
|
|
||||||
iface->ensure_next_iteration = clutter_master_clock_default_ensure_next_iteration;
|
|
||||||
iface->set_paused = clutter_master_clock_default_set_paused;
|
|
||||||
}
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Authored By: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2015 Intel Corporation.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CLUTTER_MASTER_CLOCK_DEFAULT_H__
|
|
||||||
#define __CLUTTER_MASTER_CLOCK_DEFAULT_H__
|
|
||||||
|
|
||||||
#include <clutter/clutter-timeline.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_MASTER_CLOCK_DEFAULT (_clutter_master_clock_default_get_type ())
|
|
||||||
#define CLUTTER_MASTER_CLOCK_DEFAULT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CLUTTER_TYPE_MASTER_CLOCK_DEFAULT, ClutterMasterClockDefault))
|
|
||||||
#define CLUTTER_IS_MASTER_CLOCK_DEFAULT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CLUTTER_TYPE_MASTER_CLOCK_DEFAULT))
|
|
||||||
#define CLUTTER_MASTER_CLOCK_DEFAULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_MASTER_CLOCK_DEFAULT, ClutterMasterClockDefaultClass))
|
|
||||||
|
|
||||||
typedef struct _ClutterMasterClockDefault ClutterMasterClockDefault;
|
|
||||||
typedef struct _ClutterMasterClockDefaultClass ClutterMasterClockDefaultClass;
|
|
||||||
|
|
||||||
struct _ClutterMasterClockDefaultClass
|
|
||||||
{
|
|
||||||
GObjectClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType _clutter_master_clock_default_get_type (void) G_GNUC_CONST;
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_MASTER_CLOCK_DEFAULT_H__ */
|
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Authored By: Emmanuele Bassi <ebassi@linux.intel.com>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Intel Corporation.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* SECTION:clutter-master-clock
|
|
||||||
* @short_description: The master clock for all animations
|
|
||||||
*
|
|
||||||
* The #ClutterMasterClock class is responsible for advancing all
|
|
||||||
* #ClutterTimelines when a stage is being redrawn. The master clock
|
|
||||||
* makes sure that the scenegraph is always integrally updated before
|
|
||||||
* painting it.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "clutter-build-config.h"
|
|
||||||
|
|
||||||
#include "clutter-master-clock.h"
|
|
||||||
#include "clutter-master-clock-default.h"
|
|
||||||
#include "clutter-private.h"
|
|
||||||
|
|
||||||
G_DEFINE_INTERFACE (ClutterMasterClock, clutter_master_clock, G_TYPE_OBJECT)
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_master_clock_default_init (ClutterMasterClockInterface *iface)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
ClutterMasterClock *
|
|
||||||
_clutter_master_clock_get_default (void)
|
|
||||||
{
|
|
||||||
ClutterMainContext *context = _clutter_context_get_default ();
|
|
||||||
|
|
||||||
if (G_UNLIKELY (context->master_clock == NULL))
|
|
||||||
context->master_clock = g_object_new (CLUTTER_TYPE_MASTER_CLOCK_DEFAULT, NULL);
|
|
||||||
|
|
||||||
return context->master_clock;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* _clutter_master_clock_add_timeline:
|
|
||||||
* @master_clock: a #ClutterMasterClock
|
|
||||||
* @timeline: a #ClutterTimeline
|
|
||||||
*
|
|
||||||
* Adds @timeline to the list of playing timelines held by the master
|
|
||||||
* clock.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_master_clock_add_timeline (ClutterMasterClock *master_clock,
|
|
||||||
ClutterTimeline *timeline)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_MASTER_CLOCK (master_clock));
|
|
||||||
|
|
||||||
CLUTTER_MASTER_CLOCK_GET_IFACE (master_clock)->add_timeline (master_clock,
|
|
||||||
timeline);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* _clutter_master_clock_remove_timeline:
|
|
||||||
* @master_clock: a #ClutterMasterClock
|
|
||||||
* @timeline: a #ClutterTimeline
|
|
||||||
*
|
|
||||||
* Removes @timeline from the list of playing timelines held by the
|
|
||||||
* master clock.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_master_clock_remove_timeline (ClutterMasterClock *master_clock,
|
|
||||||
ClutterTimeline *timeline)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_MASTER_CLOCK (master_clock));
|
|
||||||
|
|
||||||
CLUTTER_MASTER_CLOCK_GET_IFACE (master_clock)->remove_timeline (master_clock,
|
|
||||||
timeline);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* _clutter_master_clock_start_running:
|
|
||||||
* @master_clock: a #ClutterMasterClock
|
|
||||||
*
|
|
||||||
* Called when we have events or redraws to process; if the clock
|
|
||||||
* is stopped, does the processing necessary to wake it up again.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_master_clock_start_running (ClutterMasterClock *master_clock)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_MASTER_CLOCK (master_clock));
|
|
||||||
|
|
||||||
CLUTTER_MASTER_CLOCK_GET_IFACE (master_clock)->start_running (master_clock);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* _clutter_master_clock_ensure_next_iteration:
|
|
||||||
* @master_clock: a #ClutterMasterClock
|
|
||||||
*
|
|
||||||
* Ensures that the master clock will run at least one iteration
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_master_clock_ensure_next_iteration (ClutterMasterClock *master_clock)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_MASTER_CLOCK (master_clock));
|
|
||||||
|
|
||||||
CLUTTER_MASTER_CLOCK_GET_IFACE (master_clock)->ensure_next_iteration (master_clock);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_master_clock_set_paused (ClutterMasterClock *master_clock,
|
|
||||||
gboolean paused)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_MASTER_CLOCK (master_clock));
|
|
||||||
|
|
||||||
CLUTTER_MASTER_CLOCK_GET_IFACE (master_clock)->set_paused (master_clock,
|
|
||||||
!!paused);
|
|
||||||
}
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
/*
|
|
||||||
* Clutter.
|
|
||||||
*
|
|
||||||
* An OpenGL based 'interactive canvas' library.
|
|
||||||
*
|
|
||||||
* Authored By: Emmanuele Bassi <ebassi@linux.intel.com>
|
|
||||||
*
|
|
||||||
* Copyright (C) 2009 Intel Corporation.
|
|
||||||
*
|
|
||||||
* 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/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CLUTTER_MASTER_CLOCK_H__
|
|
||||||
#define __CLUTTER_MASTER_CLOCK_H__
|
|
||||||
|
|
||||||
#include <clutter/clutter-timeline.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
#define CLUTTER_TYPE_MASTER_CLOCK (clutter_master_clock_get_type ())
|
|
||||||
G_DECLARE_INTERFACE (ClutterMasterClock, clutter_master_clock,
|
|
||||||
CLUTTER, MASTER_CLOCK,
|
|
||||||
GObject)
|
|
||||||
|
|
||||||
struct _ClutterMasterClockInterface
|
|
||||||
{
|
|
||||||
/*< private >*/
|
|
||||||
GTypeInterface parent_iface;
|
|
||||||
|
|
||||||
void (* add_timeline) (ClutterMasterClock *master_clock,
|
|
||||||
ClutterTimeline *timeline);
|
|
||||||
void (* remove_timeline) (ClutterMasterClock *master_clock,
|
|
||||||
ClutterTimeline *timeline);
|
|
||||||
void (* start_running) (ClutterMasterClock *master_clock);
|
|
||||||
void (* ensure_next_iteration) (ClutterMasterClock *master_clock);
|
|
||||||
void (* set_paused) (ClutterMasterClock *master_clock,
|
|
||||||
gboolean paused);
|
|
||||||
};
|
|
||||||
|
|
||||||
ClutterMasterClock * _clutter_master_clock_get_default (void);
|
|
||||||
void _clutter_master_clock_add_timeline (ClutterMasterClock *master_clock,
|
|
||||||
ClutterTimeline *timeline);
|
|
||||||
void _clutter_master_clock_remove_timeline (ClutterMasterClock *master_clock,
|
|
||||||
ClutterTimeline *timeline);
|
|
||||||
void _clutter_master_clock_start_running (ClutterMasterClock *master_clock);
|
|
||||||
void _clutter_master_clock_ensure_next_iteration (ClutterMasterClock *master_clock);
|
|
||||||
void _clutter_master_clock_set_paused (ClutterMasterClock *master_clock,
|
|
||||||
gboolean paused);
|
|
||||||
|
|
||||||
void _clutter_timeline_advance (ClutterTimeline *timeline,
|
|
||||||
gint64 tick_time);
|
|
||||||
gint64 _clutter_timeline_get_delta (ClutterTimeline *timeline);
|
|
||||||
void _clutter_timeline_do_tick (ClutterTimeline *timeline,
|
|
||||||
gint64 tick_time);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_MASTER_CLOCK_H__ */
|
|
||||||
@@ -36,6 +36,13 @@
|
|||||||
#include "cogl/clutter-stage-cogl.h"
|
#include "cogl/clutter-stage-cogl.h"
|
||||||
#include "clutter/x11/clutter-backend-x11.h"
|
#include "clutter/x11/clutter-backend-x11.h"
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
GList * clutter_stage_peek_stage_views (ClutterStage *stage);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
gboolean clutter_actor_is_effectively_on_stage_view (ClutterActor *self,
|
||||||
|
ClutterStageView *view);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
|
void clutter_set_custom_backend_func (ClutterBackend *(* func) (void));
|
||||||
|
|
||||||
@@ -49,17 +56,25 @@ void clutter_stage_capture_into (ClutterStage *stage,
|
|||||||
uint8_t *data);
|
uint8_t *data);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_freeze_updates (ClutterStage *stage);
|
void clutter_stage_clear_stage_views (ClutterStage *stage);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_thaw_updates (ClutterStage *stage);
|
void clutter_stage_view_assign_next_scanout (ClutterStageView *stage_view,
|
||||||
|
CoglScanout *scanout);
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_stage_update_resource_scales (ClutterStage *stage);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_actor_has_damage (ClutterActor *actor);
|
gboolean clutter_actor_has_damage (ClutterActor *actor);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
gboolean clutter_actor_has_transitions (ClutterActor *actor);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterFrameClock * clutter_actor_pick_frame_clock (ClutterActor *self,
|
||||||
|
ClutterActor **out_actor);
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
gboolean clutter_seat_handle_event_post (ClutterSeat *seat,
|
||||||
|
const ClutterEvent *event);
|
||||||
|
|
||||||
#undef __CLUTTER_H_INSIDE__
|
#undef __CLUTTER_H_INSIDE__
|
||||||
|
|
||||||
#endif /* __CLUTTER_MUTTER_H__ */
|
#endif /* __CLUTTER_MUTTER_H__ */
|
||||||
|
|||||||
@@ -81,7 +81,7 @@
|
|||||||
struct _ClutterOffscreenEffectPrivate
|
struct _ClutterOffscreenEffectPrivate
|
||||||
{
|
{
|
||||||
CoglHandle offscreen;
|
CoglHandle offscreen;
|
||||||
CoglPipeline *target;
|
CoglPipeline *pipeline;
|
||||||
CoglHandle texture;
|
CoglHandle texture;
|
||||||
|
|
||||||
ClutterActor *actor;
|
ClutterActor *actor;
|
||||||
@@ -100,6 +100,8 @@ struct _ClutterOffscreenEffectPrivate
|
|||||||
int target_height;
|
int target_height;
|
||||||
|
|
||||||
gint old_opacity_override;
|
gint old_opacity_override;
|
||||||
|
|
||||||
|
gulong purge_handler_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
|
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (ClutterOffscreenEffect,
|
||||||
@@ -140,7 +142,7 @@ ensure_pipeline_filter_for_scale (ClutterOffscreenEffect *self,
|
|||||||
{
|
{
|
||||||
CoglPipelineFilter filter;
|
CoglPipelineFilter filter;
|
||||||
|
|
||||||
if (!self->priv->target)
|
if (!self->priv->pipeline)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* If no fractional scaling is set, we're always going to render the texture
|
/* If no fractional scaling is set, we're always going to render the texture
|
||||||
@@ -154,10 +156,16 @@ ensure_pipeline_filter_for_scale (ClutterOffscreenEffect *self,
|
|||||||
else
|
else
|
||||||
filter = COGL_PIPELINE_FILTER_LINEAR;
|
filter = COGL_PIPELINE_FILTER_LINEAR;
|
||||||
|
|
||||||
cogl_pipeline_set_layer_filters (self->priv->target, 0 /* layer_index */,
|
cogl_pipeline_set_layer_filters (self->priv->pipeline, 0 /* layer_index */,
|
||||||
filter, filter);
|
filter, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
video_memory_purged (ClutterOffscreenEffect *self)
|
||||||
|
{
|
||||||
|
g_clear_pointer (&self->priv->offscreen, cogl_object_unref);
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
update_fbo (ClutterEffect *effect,
|
update_fbo (ClutterEffect *effect,
|
||||||
int target_width,
|
int target_width,
|
||||||
@@ -166,8 +174,26 @@ update_fbo (ClutterEffect *effect,
|
|||||||
{
|
{
|
||||||
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
ClutterOffscreenEffect *self = CLUTTER_OFFSCREEN_EFFECT (effect);
|
||||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||||
|
ClutterActor *stage_actor;
|
||||||
|
|
||||||
|
stage_actor = clutter_actor_get_stage (priv->actor);
|
||||||
|
if (stage_actor != priv->stage)
|
||||||
|
{
|
||||||
|
g_clear_signal_handler (&priv->purge_handler_id, priv->stage);
|
||||||
|
|
||||||
|
priv->stage = stage_actor;
|
||||||
|
|
||||||
|
if (priv->stage)
|
||||||
|
{
|
||||||
|
priv->purge_handler_id =
|
||||||
|
g_signal_connect_object (priv->stage,
|
||||||
|
"gl-video-memory-purged",
|
||||||
|
G_CALLBACK (video_memory_purged),
|
||||||
|
self,
|
||||||
|
G_CONNECT_SWAPPED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
priv->stage = clutter_actor_get_stage (priv->actor);
|
|
||||||
if (priv->stage == NULL)
|
if (priv->stage == NULL)
|
||||||
{
|
{
|
||||||
CLUTTER_NOTE (MISC, "The actor '%s' is not part of a stage",
|
CLUTTER_NOTE (MISC, "The actor '%s' is not part of a stage",
|
||||||
@@ -185,12 +211,12 @@ update_fbo (ClutterEffect *effect,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (priv->target == NULL)
|
if (priv->pipeline == NULL)
|
||||||
{
|
{
|
||||||
CoglContext *ctx =
|
CoglContext *ctx =
|
||||||
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
|
|
||||||
priv->target = cogl_pipeline_new (ctx);
|
priv->pipeline = cogl_pipeline_new (ctx);
|
||||||
ensure_pipeline_filter_for_scale (self, resource_scale);
|
ensure_pipeline_filter_for_scale (self, resource_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,7 +228,7 @@ update_fbo (ClutterEffect *effect,
|
|||||||
if (priv->texture == NULL)
|
if (priv->texture == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
cogl_pipeline_set_layer_texture (priv->target, 0, priv->texture);
|
cogl_pipeline_set_layer_texture (priv->pipeline, 0, priv->texture);
|
||||||
|
|
||||||
priv->target_width = target_width;
|
priv->target_width = target_width;
|
||||||
priv->target_height = target_height;
|
priv->target_height = target_height;
|
||||||
@@ -212,8 +238,8 @@ update_fbo (ClutterEffect *effect,
|
|||||||
{
|
{
|
||||||
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
|
g_warning ("%s: Unable to create an Offscreen buffer", G_STRLOC);
|
||||||
|
|
||||||
cogl_object_unref (priv->target);
|
cogl_object_unref (priv->pipeline);
|
||||||
priv->target = NULL;
|
priv->pipeline = NULL;
|
||||||
|
|
||||||
priv->target_width = 0;
|
priv->target_width = 0;
|
||||||
priv->target_height = 0;
|
priv->target_height = 0;
|
||||||
@@ -238,8 +264,8 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
|||||||
gfloat stage_width, stage_height;
|
gfloat stage_width, stage_height;
|
||||||
gfloat target_width = -1, target_height = -1;
|
gfloat target_width = -1, target_height = -1;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
gfloat resource_scale;
|
float resource_scale;
|
||||||
gfloat ceiled_resource_scale;
|
float ceiled_resource_scale;
|
||||||
graphene_point3d_t local_offset;
|
graphene_point3d_t local_offset;
|
||||||
gfloat old_viewport[4];
|
gfloat old_viewport[4];
|
||||||
|
|
||||||
@@ -254,17 +280,11 @@ clutter_offscreen_effect_pre_paint (ClutterEffect *effect,
|
|||||||
stage = _clutter_actor_get_stage_internal (priv->actor);
|
stage = _clutter_actor_get_stage_internal (priv->actor);
|
||||||
clutter_actor_get_size (stage, &stage_width, &stage_height);
|
clutter_actor_get_size (stage, &stage_width, &stage_height);
|
||||||
|
|
||||||
if (_clutter_actor_get_real_resource_scale (priv->actor, &resource_scale))
|
resource_scale = clutter_actor_get_real_resource_scale (priv->actor);
|
||||||
{
|
|
||||||
ceiled_resource_scale = ceilf (resource_scale);
|
ceiled_resource_scale = ceilf (resource_scale);
|
||||||
stage_width *= ceiled_resource_scale;
|
stage_width *= ceiled_resource_scale;
|
||||||
stage_height *= ceiled_resource_scale;
|
stage_height *= ceiled_resource_scale;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* We are sure we have a resource scale set to a good value at paint */
|
|
||||||
g_assert_not_reached ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the minimal bounding box for what we want to paint, relative to the
|
/* Get the minimal bounding box for what we want to paint, relative to the
|
||||||
* parent of priv->actor. Note that we may actually be painting a clone of
|
* parent of priv->actor. Note that we may actually be painting a clone of
|
||||||
@@ -380,7 +400,7 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
|
|||||||
|
|
||||||
paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
|
paint_opacity = clutter_actor_get_paint_opacity (priv->actor);
|
||||||
|
|
||||||
cogl_pipeline_set_color4ub (priv->target,
|
cogl_pipeline_set_color4ub (priv->pipeline,
|
||||||
paint_opacity,
|
paint_opacity,
|
||||||
paint_opacity,
|
paint_opacity,
|
||||||
paint_opacity,
|
paint_opacity,
|
||||||
@@ -392,7 +412,7 @@ clutter_offscreen_effect_real_paint_target (ClutterOffscreenEffect *effect,
|
|||||||
* hadn't been redirected offscreen.
|
* hadn't been redirected offscreen.
|
||||||
*/
|
*/
|
||||||
cogl_framebuffer_draw_textured_rectangle (framebuffer,
|
cogl_framebuffer_draw_textured_rectangle (framebuffer,
|
||||||
priv->target,
|
priv->pipeline,
|
||||||
0, 0,
|
0, 0,
|
||||||
cogl_texture_get_width (priv->texture),
|
cogl_texture_get_width (priv->texture),
|
||||||
cogl_texture_get_height (priv->texture),
|
cogl_texture_get_height (priv->texture),
|
||||||
@@ -417,8 +437,9 @@ clutter_offscreen_effect_paint_texture (ClutterOffscreenEffect *effect,
|
|||||||
*/
|
*/
|
||||||
cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview);
|
cogl_framebuffer_get_modelview_matrix (framebuffer, &modelview);
|
||||||
|
|
||||||
if (clutter_actor_get_resource_scale (priv->actor, &resource_scale) &&
|
resource_scale = clutter_actor_get_resource_scale (priv->actor);
|
||||||
resource_scale != 1.0f)
|
|
||||||
|
if (resource_scale != 1.0f)
|
||||||
{
|
{
|
||||||
float paint_scale = 1.0f / resource_scale;
|
float paint_scale = 1.0f / resource_scale;
|
||||||
cogl_matrix_scale (&modelview, paint_scale, paint_scale, 1);
|
cogl_matrix_scale (&modelview, paint_scale, paint_scale, 1);
|
||||||
@@ -446,13 +467,16 @@ clutter_offscreen_effect_post_paint (ClutterEffect *effect,
|
|||||||
ClutterOffscreenEffectPrivate *priv = self->priv;
|
ClutterOffscreenEffectPrivate *priv = self->priv;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
|
|
||||||
if (priv->offscreen == NULL ||
|
g_warn_if_fail (priv->offscreen);
|
||||||
priv->target == NULL ||
|
g_warn_if_fail (priv->pipeline);
|
||||||
priv->actor == NULL)
|
g_warn_if_fail (priv->actor);
|
||||||
return;
|
|
||||||
|
|
||||||
/* Restore the previous opacity override */
|
/* Restore the previous opacity override */
|
||||||
clutter_actor_set_opacity_override (priv->actor, priv->old_opacity_override);
|
if (priv->actor)
|
||||||
|
{
|
||||||
|
clutter_actor_set_opacity_override (priv->actor,
|
||||||
|
priv->old_opacity_override);
|
||||||
|
}
|
||||||
|
|
||||||
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
framebuffer = clutter_paint_context_get_framebuffer (paint_context);
|
||||||
cogl_framebuffer_pop_matrix (framebuffer);
|
cogl_framebuffer_pop_matrix (framebuffer);
|
||||||
@@ -498,16 +522,17 @@ clutter_offscreen_effect_paint (ClutterEffect *effect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_offscreen_effect_notify (GObject *gobject,
|
clutter_offscreen_effect_set_enabled (ClutterActorMeta *meta,
|
||||||
GParamSpec *pspec)
|
gboolean is_enabled)
|
||||||
{
|
{
|
||||||
ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (gobject);
|
ClutterActorMetaClass *parent_class =
|
||||||
|
CLUTTER_ACTOR_META_CLASS (clutter_offscreen_effect_parent_class);
|
||||||
|
ClutterOffscreenEffect *offscreen_effect = CLUTTER_OFFSCREEN_EFFECT (meta);
|
||||||
ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
|
ClutterOffscreenEffectPrivate *priv = offscreen_effect->priv;
|
||||||
|
|
||||||
if (strcmp (pspec->name, "enabled") == 0)
|
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->notify (gobject, pspec);
|
parent_class->set_enabled (meta, is_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -518,7 +543,7 @@ clutter_offscreen_effect_finalize (GObject *gobject)
|
|||||||
|
|
||||||
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
g_clear_pointer (&priv->offscreen, cogl_object_unref);
|
||||||
g_clear_pointer (&priv->texture, cogl_object_unref);
|
g_clear_pointer (&priv->texture, cogl_object_unref);
|
||||||
g_clear_pointer (&priv->target, cogl_object_unref);
|
g_clear_pointer (&priv->pipeline, cogl_object_unref);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
G_OBJECT_CLASS (clutter_offscreen_effect_parent_class)->finalize (gobject);
|
||||||
}
|
}
|
||||||
@@ -534,13 +559,13 @@ clutter_offscreen_effect_class_init (ClutterOffscreenEffectClass *klass)
|
|||||||
klass->paint_target = clutter_offscreen_effect_real_paint_target;
|
klass->paint_target = clutter_offscreen_effect_real_paint_target;
|
||||||
|
|
||||||
meta_class->set_actor = clutter_offscreen_effect_set_actor;
|
meta_class->set_actor = clutter_offscreen_effect_set_actor;
|
||||||
|
meta_class->set_enabled = clutter_offscreen_effect_set_enabled;
|
||||||
|
|
||||||
effect_class->pre_paint = clutter_offscreen_effect_pre_paint;
|
effect_class->pre_paint = clutter_offscreen_effect_pre_paint;
|
||||||
effect_class->post_paint = clutter_offscreen_effect_post_paint;
|
effect_class->post_paint = clutter_offscreen_effect_post_paint;
|
||||||
effect_class->paint = clutter_offscreen_effect_paint;
|
effect_class->paint = clutter_offscreen_effect_paint;
|
||||||
|
|
||||||
gobject_class->finalize = clutter_offscreen_effect_finalize;
|
gobject_class->finalize = clutter_offscreen_effect_finalize;
|
||||||
gobject_class->notify = clutter_offscreen_effect_notify;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -600,7 +625,7 @@ clutter_offscreen_effect_get_target (ClutterOffscreenEffect *effect)
|
|||||||
g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect),
|
g_return_val_if_fail (CLUTTER_IS_OFFSCREEN_EFFECT (effect),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
return (CoglMaterial *)effect->priv->target;
|
return (CoglMaterial *)effect->priv->pipeline;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
#include "clutter-paint-context.h"
|
#include "clutter-paint-context.h"
|
||||||
|
|
||||||
ClutterPaintContext * clutter_paint_context_new_for_view (ClutterStageView *view,
|
ClutterPaintContext * clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip);
|
const cairo_region_t *redraw_clip,
|
||||||
|
ClutterPaintFlag paint_flags);
|
||||||
|
|
||||||
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
|
gboolean clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context);
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ struct _ClutterPaintContext
|
|||||||
{
|
{
|
||||||
grefcount ref_count;
|
grefcount ref_count;
|
||||||
|
|
||||||
|
ClutterPaintFlag paint_flags;
|
||||||
|
|
||||||
GList *framebuffers;
|
GList *framebuffers;
|
||||||
|
|
||||||
ClutterStageView *view;
|
ClutterStageView *view;
|
||||||
@@ -36,7 +38,8 @@ G_DEFINE_BOXED_TYPE (ClutterPaintContext, clutter_paint_context,
|
|||||||
|
|
||||||
ClutterPaintContext *
|
ClutterPaintContext *
|
||||||
clutter_paint_context_new_for_view (ClutterStageView *view,
|
clutter_paint_context_new_for_view (ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip)
|
const cairo_region_t *redraw_clip,
|
||||||
|
ClutterPaintFlag paint_flags)
|
||||||
{
|
{
|
||||||
ClutterPaintContext *paint_context;
|
ClutterPaintContext *paint_context;
|
||||||
CoglFramebuffer *framebuffer;
|
CoglFramebuffer *framebuffer;
|
||||||
@@ -45,6 +48,7 @@ clutter_paint_context_new_for_view (ClutterStageView *view,
|
|||||||
g_ref_count_init (&paint_context->ref_count);
|
g_ref_count_init (&paint_context->ref_count);
|
||||||
paint_context->view = view;
|
paint_context->view = view;
|
||||||
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
||||||
|
paint_context->paint_flags = paint_flags;
|
||||||
|
|
||||||
framebuffer = clutter_stage_view_get_framebuffer (view);
|
framebuffer = clutter_stage_view_get_framebuffer (view);
|
||||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||||
@@ -56,12 +60,16 @@ clutter_paint_context_new_for_view (ClutterStageView *view,
|
|||||||
* clutter_paint_context_new_for_framebuffer: (skip)
|
* clutter_paint_context_new_for_framebuffer: (skip)
|
||||||
*/
|
*/
|
||||||
ClutterPaintContext *
|
ClutterPaintContext *
|
||||||
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer)
|
clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||||
|
const cairo_region_t *redraw_clip,
|
||||||
|
ClutterPaintFlag paint_flags)
|
||||||
{
|
{
|
||||||
ClutterPaintContext *paint_context;
|
ClutterPaintContext *paint_context;
|
||||||
|
|
||||||
paint_context = g_new0 (ClutterPaintContext, 1);
|
paint_context = g_new0 (ClutterPaintContext, 1);
|
||||||
g_ref_count_init (&paint_context->ref_count);
|
g_ref_count_init (&paint_context->ref_count);
|
||||||
|
paint_context->redraw_clip = cairo_region_copy (redraw_clip);
|
||||||
|
paint_context->paint_flags = paint_flags;
|
||||||
|
|
||||||
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
clutter_paint_context_push_framebuffer (paint_context, framebuffer);
|
||||||
|
|
||||||
@@ -170,3 +178,12 @@ clutter_paint_context_is_drawing_off_stage (ClutterPaintContext *paint_context)
|
|||||||
|
|
||||||
return !paint_context->view;
|
return !paint_context->view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_paint_context_get_paint_flags: (skip)
|
||||||
|
*/
|
||||||
|
ClutterPaintFlag
|
||||||
|
clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context)
|
||||||
|
{
|
||||||
|
return paint_context->paint_flags;
|
||||||
|
}
|
||||||
|
|||||||
@@ -29,13 +29,22 @@
|
|||||||
|
|
||||||
typedef struct _ClutterPaintContext ClutterPaintContext;
|
typedef struct _ClutterPaintContext ClutterPaintContext;
|
||||||
|
|
||||||
|
typedef enum _ClutterPaintFlag
|
||||||
|
{
|
||||||
|
CLUTTER_PAINT_FLAG_NONE = 0,
|
||||||
|
CLUTTER_PAINT_FLAG_NO_CURSORS = 1 << 0,
|
||||||
|
CLUTTER_PAINT_FLAG_FORCE_CURSORS = 1 << 1,
|
||||||
|
} ClutterPaintFlag;
|
||||||
|
|
||||||
#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())
|
#define CLUTTER_TYPE_PAINT_CONTEXT (clutter_paint_context_get_type ())
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
GType clutter_paint_context_get_type (void);
|
GType clutter_paint_context_get_type (void);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer);
|
ClutterPaintContext * clutter_paint_context_new_for_framebuffer (CoglFramebuffer *framebuffer,
|
||||||
|
const cairo_region_t *redraw_clip,
|
||||||
|
ClutterPaintFlag paint_flags);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
|
ClutterPaintContext * clutter_paint_context_ref (ClutterPaintContext *paint_context);
|
||||||
@@ -62,4 +71,7 @@ void clutter_paint_context_pop_framebuffer (ClutterPaintContext *paint_context);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
const cairo_region_t * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
|
const cairo_region_t * clutter_paint_context_get_redraw_clip (ClutterPaintContext *paint_context);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterPaintFlag clutter_paint_context_get_paint_flags (ClutterPaintContext *paint_context);
|
||||||
|
|
||||||
#endif /* CLUTTER_PAINT_CONTEXT_H */
|
#endif /* CLUTTER_PAINT_CONTEXT_H */
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ typedef enum
|
|||||||
PAINT_OP_INVALID = 0,
|
PAINT_OP_INVALID = 0,
|
||||||
PAINT_OP_TEX_RECT,
|
PAINT_OP_TEX_RECT,
|
||||||
PAINT_OP_MULTITEX_RECT,
|
PAINT_OP_MULTITEX_RECT,
|
||||||
PAINT_OP_PATH,
|
|
||||||
PAINT_OP_PRIMITIVE
|
PAINT_OP_PRIMITIVE
|
||||||
} PaintOpCode;
|
} PaintOpCode;
|
||||||
|
|
||||||
@@ -96,8 +95,6 @@ struct _ClutterPaintOperation
|
|||||||
union {
|
union {
|
||||||
float texrect[8];
|
float texrect[8];
|
||||||
|
|
||||||
CoglPath *path;
|
|
||||||
|
|
||||||
CoglPrimitive *primitive;
|
CoglPrimitive *primitive;
|
||||||
} op;
|
} op;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -782,11 +782,6 @@ clutter_paint_operation_clear (ClutterPaintOperation *op)
|
|||||||
g_array_unref (op->multitex_coords);
|
g_array_unref (op->multitex_coords);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAINT_OP_PATH:
|
|
||||||
if (op->op.path != NULL)
|
|
||||||
cogl_object_unref (op->op.path);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PAINT_OP_PRIMITIVE:
|
case PAINT_OP_PRIMITIVE:
|
||||||
if (op->op.primitive != NULL)
|
if (op->op.primitive != NULL)
|
||||||
cogl_object_unref (op->op.primitive);
|
cogl_object_unref (op->op.primitive);
|
||||||
@@ -836,16 +831,6 @@ clutter_paint_op_init_multitex_rect (ClutterPaintOperation *op,
|
|||||||
op->op.texrect[3] = rect->y2;
|
op->op.texrect[3] = rect->y2;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
|
||||||
clutter_paint_op_init_path (ClutterPaintOperation *op,
|
|
||||||
CoglPath *path)
|
|
||||||
{
|
|
||||||
clutter_paint_operation_clear (op);
|
|
||||||
|
|
||||||
op->opcode = PAINT_OP_PATH;
|
|
||||||
op->op.path = cogl_object_ref (path);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
clutter_paint_op_init_primitive (ClutterPaintOperation *op,
|
clutter_paint_op_init_primitive (ClutterPaintOperation *op,
|
||||||
CoglPrimitive *primitive)
|
CoglPrimitive *primitive)
|
||||||
@@ -950,34 +935,6 @@ clutter_paint_node_add_multitexture_rectangle (ClutterPaintNode *node,
|
|||||||
g_array_append_val (node->operations, operation);
|
g_array_append_val (node->operations, operation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_paint_node_add_path: (skip)
|
|
||||||
* @node: a #ClutterPaintNode
|
|
||||||
* @path: a Cogl path
|
|
||||||
*
|
|
||||||
* Adds a region described as a path to the @node.
|
|
||||||
*
|
|
||||||
* This function acquires a reference on the passed @path, so it
|
|
||||||
* is safe to call cogl_object_unref() when it returns.
|
|
||||||
*
|
|
||||||
* Since: 1.10
|
|
||||||
* Stability: unstable
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_paint_node_add_path (ClutterPaintNode *node,
|
|
||||||
CoglPath *path)
|
|
||||||
{
|
|
||||||
ClutterPaintOperation operation = PAINT_OP_INIT;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_PAINT_NODE (node));
|
|
||||||
g_return_if_fail (cogl_is_path (path));
|
|
||||||
|
|
||||||
clutter_paint_node_maybe_init_operations (node);
|
|
||||||
|
|
||||||
clutter_paint_op_init_path (&operation, path);
|
|
||||||
g_array_append_val (node->operations, operation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_paint_node_add_primitive: (skip)
|
* clutter_paint_node_add_primitive: (skip)
|
||||||
* @node: a #ClutterPaintNode
|
* @node: a #ClutterPaintNode
|
||||||
@@ -1114,11 +1071,6 @@ clutter_paint_node_to_json (ClutterPaintNode *node)
|
|||||||
json_builder_end_array (builder);
|
json_builder_end_array (builder);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAINT_OP_PATH:
|
|
||||||
json_builder_set_member_name (builder, "path");
|
|
||||||
json_builder_add_int_value (builder, (intptr_t) op->op.path);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PAINT_OP_PRIMITIVE:
|
case PAINT_OP_PRIMITIVE:
|
||||||
json_builder_set_member_name (builder, "primitive");
|
json_builder_set_member_name (builder, "primitive");
|
||||||
json_builder_add_int_value (builder, (intptr_t) op->op.primitive);
|
json_builder_add_int_value (builder, (intptr_t) op->op.primitive);
|
||||||
|
|||||||
@@ -84,9 +84,6 @@ void clutter_paint_node_add_multitexture_rectangle (ClutterP
|
|||||||
unsigned int text_coords_len);
|
unsigned int text_coords_len);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_paint_node_add_path (ClutterPaintNode *node,
|
|
||||||
CoglPath *path);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_paint_node_add_primitive (ClutterPaintNode *node,
|
void clutter_paint_node_add_primitive (ClutterPaintNode *node,
|
||||||
CoglPrimitive *primitive);
|
CoglPrimitive *primitive);
|
||||||
|
|
||||||
|
|||||||
@@ -477,10 +477,6 @@ clutter_pipeline_node_draw (ClutterPaintNode *node,
|
|||||||
op->multitex_coords->len);
|
op->multitex_coords->len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAINT_OP_PATH:
|
|
||||||
cogl_framebuffer_fill_path (fb, pnode->pipeline, op->op.path);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PAINT_OP_PRIMITIVE:
|
case PAINT_OP_PRIMITIVE:
|
||||||
cogl_framebuffer_draw_primitive (fb,
|
cogl_framebuffer_draw_primitive (fb,
|
||||||
pnode->pipeline,
|
pnode->pipeline,
|
||||||
@@ -876,7 +872,6 @@ clutter_text_node_draw (ClutterPaintNode *node,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PAINT_OP_MULTITEX_RECT:
|
case PAINT_OP_MULTITEX_RECT:
|
||||||
case PAINT_OP_PATH:
|
|
||||||
case PAINT_OP_PRIMITIVE:
|
case PAINT_OP_PRIMITIVE:
|
||||||
case PAINT_OP_INVALID:
|
case PAINT_OP_INVALID:
|
||||||
break;
|
break;
|
||||||
@@ -1037,11 +1032,6 @@ clutter_clip_node_pre_draw (ClutterPaintNode *node,
|
|||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAINT_OP_PATH:
|
|
||||||
cogl_framebuffer_push_path_clip (fb, op->op.path);
|
|
||||||
retval = TRUE;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PAINT_OP_MULTITEX_RECT:
|
case PAINT_OP_MULTITEX_RECT:
|
||||||
case PAINT_OP_PRIMITIVE:
|
case PAINT_OP_PRIMITIVE:
|
||||||
case PAINT_OP_INVALID:
|
case PAINT_OP_INVALID:
|
||||||
@@ -1072,7 +1062,6 @@ clutter_clip_node_post_draw (ClutterPaintNode *node,
|
|||||||
|
|
||||||
switch (op->opcode)
|
switch (op->opcode)
|
||||||
{
|
{
|
||||||
case PAINT_OP_PATH:
|
|
||||||
case PAINT_OP_TEX_RECT:
|
case PAINT_OP_TEX_RECT:
|
||||||
cogl_framebuffer_pop_clip (fb);
|
cogl_framebuffer_pop_clip (fb);
|
||||||
break;
|
break;
|
||||||
@@ -1242,9 +1231,8 @@ struct _ClutterLayerNode
|
|||||||
float fbo_width;
|
float fbo_width;
|
||||||
float fbo_height;
|
float fbo_height;
|
||||||
|
|
||||||
CoglPipeline *state;
|
CoglPipeline *pipeline;
|
||||||
CoglFramebuffer *offscreen;
|
CoglFramebuffer *offscreen;
|
||||||
CoglTexture *texture;
|
|
||||||
|
|
||||||
guint8 opacity;
|
guint8 opacity;
|
||||||
};
|
};
|
||||||
@@ -1334,7 +1322,7 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
|
|||||||
case PAINT_OP_TEX_RECT:
|
case PAINT_OP_TEX_RECT:
|
||||||
/* now we need to paint the texture */
|
/* now we need to paint the texture */
|
||||||
cogl_framebuffer_draw_textured_rectangle (fb,
|
cogl_framebuffer_draw_textured_rectangle (fb,
|
||||||
lnode->state,
|
lnode->pipeline,
|
||||||
op->op.texrect[0],
|
op->op.texrect[0],
|
||||||
op->op.texrect[1],
|
op->op.texrect[1],
|
||||||
op->op.texrect[2],
|
op->op.texrect[2],
|
||||||
@@ -1347,7 +1335,7 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
|
|||||||
|
|
||||||
case PAINT_OP_MULTITEX_RECT:
|
case PAINT_OP_MULTITEX_RECT:
|
||||||
cogl_framebuffer_draw_multitextured_rectangle (fb,
|
cogl_framebuffer_draw_multitextured_rectangle (fb,
|
||||||
lnode->state,
|
lnode->pipeline,
|
||||||
op->op.texrect[0],
|
op->op.texrect[0],
|
||||||
op->op.texrect[1],
|
op->op.texrect[1],
|
||||||
op->op.texrect[2],
|
op->op.texrect[2],
|
||||||
@@ -1356,12 +1344,10 @@ clutter_layer_node_post_draw (ClutterPaintNode *node,
|
|||||||
op->multitex_coords->len);
|
op->multitex_coords->len);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PAINT_OP_PATH:
|
|
||||||
cogl_framebuffer_fill_path (fb, lnode->state, op->op.path);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case PAINT_OP_PRIMITIVE:
|
case PAINT_OP_PRIMITIVE:
|
||||||
cogl_framebuffer_draw_primitive (fb, lnode->state, op->op.primitive);
|
cogl_framebuffer_draw_primitive (fb,
|
||||||
|
lnode->pipeline,
|
||||||
|
op->op.primitive);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1372,8 +1358,8 @@ clutter_layer_node_finalize (ClutterPaintNode *node)
|
|||||||
{
|
{
|
||||||
ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
|
ClutterLayerNode *lnode = CLUTTER_LAYER_NODE (node);
|
||||||
|
|
||||||
if (lnode->state != NULL)
|
if (lnode->pipeline != NULL)
|
||||||
cogl_object_unref (lnode->state);
|
cogl_object_unref (lnode->pipeline);
|
||||||
|
|
||||||
if (lnode->offscreen != NULL)
|
if (lnode->offscreen != NULL)
|
||||||
cogl_object_unref (lnode->offscreen);
|
cogl_object_unref (lnode->offscreen);
|
||||||
@@ -1425,6 +1411,9 @@ clutter_layer_node_new (const CoglMatrix *projection,
|
|||||||
guint8 opacity)
|
guint8 opacity)
|
||||||
{
|
{
|
||||||
ClutterLayerNode *res;
|
ClutterLayerNode *res;
|
||||||
|
CoglContext *context;
|
||||||
|
CoglTexture2D *tex_2d;
|
||||||
|
CoglTexture *texture;
|
||||||
CoglColor color;
|
CoglColor color;
|
||||||
|
|
||||||
res = _clutter_paint_node_create (CLUTTER_TYPE_LAYER_NODE);
|
res = _clutter_paint_node_create (CLUTTER_TYPE_LAYER_NODE);
|
||||||
@@ -1436,19 +1425,18 @@ clutter_layer_node_new (const CoglMatrix *projection,
|
|||||||
res->opacity = opacity;
|
res->opacity = opacity;
|
||||||
|
|
||||||
/* the texture backing the FBO */
|
/* the texture backing the FBO */
|
||||||
res->texture = cogl_texture_new_with_size (MAX (res->fbo_width, 1),
|
context = clutter_backend_get_cogl_context (clutter_get_default_backend ());
|
||||||
MAX (res->fbo_height, 1),
|
|
||||||
COGL_TEXTURE_NO_SLICING,
|
|
||||||
COGL_PIXEL_FORMAT_RGBA_8888_PRE);
|
|
||||||
|
|
||||||
res->offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_texture (res->texture));
|
tex_2d = cogl_texture_2d_new_with_size (context,
|
||||||
|
MAX (res->fbo_width, 1),
|
||||||
|
MAX (res->fbo_height, 1));
|
||||||
|
texture = COGL_TEXTURE (tex_2d);
|
||||||
|
cogl_texture_set_premultiplied (texture, TRUE);
|
||||||
|
|
||||||
|
res->offscreen = COGL_FRAMEBUFFER (cogl_offscreen_new_to_texture (texture));
|
||||||
if (res->offscreen == NULL)
|
if (res->offscreen == NULL)
|
||||||
{
|
{
|
||||||
g_critical ("%s: Unable to create an offscreen buffer", G_STRLOC);
|
g_critical ("%s: Unable to create an offscreen buffer", G_STRLOC);
|
||||||
|
|
||||||
cogl_object_unref (res->texture);
|
|
||||||
res->texture = NULL;
|
|
||||||
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1458,14 +1446,15 @@ clutter_layer_node_new (const CoglMatrix *projection,
|
|||||||
* interpolation filters because the texture is always
|
* interpolation filters because the texture is always
|
||||||
* going to be painted at a 1:1 texel:pixel ratio
|
* going to be painted at a 1:1 texel:pixel ratio
|
||||||
*/
|
*/
|
||||||
res->state = cogl_pipeline_copy (default_texture_pipeline);
|
res->pipeline = cogl_pipeline_copy (default_texture_pipeline);
|
||||||
cogl_pipeline_set_layer_filters (res->state, 0,
|
cogl_pipeline_set_layer_filters (res->pipeline, 0,
|
||||||
COGL_PIPELINE_FILTER_NEAREST,
|
COGL_PIPELINE_FILTER_NEAREST,
|
||||||
COGL_PIPELINE_FILTER_NEAREST);
|
COGL_PIPELINE_FILTER_NEAREST);
|
||||||
cogl_pipeline_set_layer_texture (res->state, 0, res->texture);
|
cogl_pipeline_set_layer_texture (res->pipeline, 0, texture);
|
||||||
cogl_pipeline_set_color (res->state, &color);
|
cogl_pipeline_set_color (res->pipeline, &color);
|
||||||
cogl_object_unref (res->texture);
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
cogl_object_unref (texture);
|
||||||
|
|
||||||
return (ClutterPaintNode *) res;
|
return (ClutterPaintNode *) res;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,7 @@
|
|||||||
#include "clutter-gesture-action-private.h"
|
#include "clutter-gesture-action-private.h"
|
||||||
#include "clutter-marshal.h"
|
#include "clutter-marshal.h"
|
||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
|
#include "clutter-timeline.h"
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#define FLOAT_EPSILON (1e-15)
|
#define FLOAT_EPSILON (1e-15)
|
||||||
@@ -136,7 +137,8 @@ enum
|
|||||||
|
|
||||||
static guint pan_signals[LAST_SIGNAL] = { 0, };
|
static guint pan_signals[LAST_SIGNAL] = { 0, };
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (ClutterPanAction, clutter_pan_action, CLUTTER_TYPE_GESTURE_ACTION)
|
G_DEFINE_TYPE_WITH_PRIVATE (ClutterPanAction, clutter_pan_action,
|
||||||
|
CLUTTER_TYPE_GESTURE_ACTION)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
emit_pan (ClutterPanAction *self,
|
emit_pan (ClutterPanAction *self,
|
||||||
@@ -156,14 +158,18 @@ emit_pan (ClutterPanAction *self,
|
|||||||
gfloat scroll_threshold = G_PI_4/2;
|
gfloat scroll_threshold = G_PI_4/2;
|
||||||
gfloat drag_angle;
|
gfloat drag_angle;
|
||||||
|
|
||||||
clutter_gesture_action_get_motion_delta (CLUTTER_GESTURE_ACTION (self), 0, &delta_x, &delta_y);
|
clutter_gesture_action_get_motion_delta (CLUTTER_GESTURE_ACTION (self),
|
||||||
|
0,
|
||||||
|
&delta_x,
|
||||||
|
&delta_y);
|
||||||
|
|
||||||
if (delta_x != 0.0f)
|
if (delta_x != 0.0f)
|
||||||
drag_angle = atanf (delta_y / delta_x);
|
drag_angle = atanf (delta_y / delta_x);
|
||||||
else
|
else
|
||||||
drag_angle = G_PI_2;
|
drag_angle = G_PI_2;
|
||||||
|
|
||||||
if ((drag_angle > -scroll_threshold) && (drag_angle < scroll_threshold))
|
if ((drag_angle > -scroll_threshold) &&
|
||||||
|
(drag_angle < scroll_threshold))
|
||||||
priv->pin_state = SCROLL_PINNED_HORIZONTAL;
|
priv->pin_state = SCROLL_PINNED_HORIZONTAL;
|
||||||
else if ((drag_angle > (G_PI_2 - scroll_threshold)) ||
|
else if ((drag_angle > (G_PI_2 - scroll_threshold)) ||
|
||||||
(drag_angle < -(G_PI_2 - scroll_threshold)))
|
(drag_angle < -(G_PI_2 - scroll_threshold)))
|
||||||
@@ -282,7 +288,10 @@ gesture_end (ClutterGestureAction *gesture,
|
|||||||
gfloat tau;
|
gfloat tau;
|
||||||
gint duration;
|
gint duration;
|
||||||
|
|
||||||
clutter_gesture_action_get_release_coords (CLUTTER_GESTURE_ACTION (self), 0, &priv->release_x, &priv->release_y);
|
clutter_gesture_action_get_release_coords (CLUTTER_GESTURE_ACTION (self),
|
||||||
|
0,
|
||||||
|
&priv->release_x,
|
||||||
|
&priv->release_y);
|
||||||
|
|
||||||
if (!priv->should_interpolate)
|
if (!priv->should_interpolate)
|
||||||
{
|
{
|
||||||
@@ -293,7 +302,9 @@ gesture_end (ClutterGestureAction *gesture,
|
|||||||
priv->state = PAN_STATE_INTERPOLATING;
|
priv->state = PAN_STATE_INTERPOLATING;
|
||||||
|
|
||||||
clutter_gesture_action_get_motion_delta (gesture, 0, &delta_x, &delta_y);
|
clutter_gesture_action_get_motion_delta (gesture, 0, &delta_x, &delta_y);
|
||||||
velocity = clutter_gesture_action_get_velocity (gesture, 0, &velocity_x, &velocity_y);
|
velocity = clutter_gesture_action_get_velocity (gesture, 0,
|
||||||
|
&velocity_x,
|
||||||
|
&velocity_y);
|
||||||
|
|
||||||
/* Exponential timing constant v(t) = v(0) * exp(-t/tau)
|
/* Exponential timing constant v(t) = v(0) * exp(-t/tau)
|
||||||
* tau = 1000ms / (frame_per_second * - ln(decay_per_frame))
|
* tau = 1000ms / (frame_per_second * - ln(decay_per_frame))
|
||||||
@@ -304,17 +315,26 @@ gesture_end (ClutterGestureAction *gesture,
|
|||||||
/* See where the decreasing velocity reaches $min_velocity px/ms
|
/* See where the decreasing velocity reaches $min_velocity px/ms
|
||||||
* v(t) = v(0) * exp(-t/tau) = min_velocity
|
* v(t) = v(0) * exp(-t/tau) = min_velocity
|
||||||
* t = - tau * ln( min_velocity / |v(0)|) */
|
* t = - tau * ln( min_velocity / |v(0)|) */
|
||||||
duration = - tau * logf (min_velocity / (ABS (velocity) * priv->acceleration_factor));
|
duration = - tau * logf (min_velocity / (ABS (velocity) *
|
||||||
|
priv->acceleration_factor));
|
||||||
|
|
||||||
/* Target point: x(t) = v(0) * tau * [1 - exp(-t/tau)] */
|
/* Target point: x(t) = v(0) * tau * [1 - exp(-t/tau)] */
|
||||||
priv->target_x = velocity_x * priv->acceleration_factor * tau * (1 - exp ((float)-duration / tau));
|
priv->target_x = (velocity_x * priv->acceleration_factor * tau *
|
||||||
priv->target_y = velocity_y * priv->acceleration_factor * tau * (1 - exp ((float)-duration / tau));
|
(1 - exp ((float)-duration / tau)));
|
||||||
|
priv->target_y = (velocity_y * priv->acceleration_factor * tau *
|
||||||
|
(1 - exp ((float)-duration / tau)));
|
||||||
|
|
||||||
if (ABS (velocity) * priv->acceleration_factor > min_velocity && duration > FLOAT_EPSILON)
|
if (ABS (velocity) * priv->acceleration_factor > min_velocity &&
|
||||||
|
duration > FLOAT_EPSILON)
|
||||||
{
|
{
|
||||||
|
ClutterActor *pan_actor =
|
||||||
|
clutter_actor_meta_get_actor (CLUTTER_ACTOR_META (gesture));
|
||||||
|
|
||||||
priv->interpolated_x = priv->interpolated_y = 0.0f;
|
priv->interpolated_x = priv->interpolated_y = 0.0f;
|
||||||
priv->deceleration_timeline = clutter_timeline_new (duration);
|
priv->deceleration_timeline = clutter_timeline_new_for_actor (pan_actor,
|
||||||
clutter_timeline_set_progress_mode (priv->deceleration_timeline, CLUTTER_EASE_OUT_EXPO);
|
duration);
|
||||||
|
clutter_timeline_set_progress_mode (priv->deceleration_timeline,
|
||||||
|
CLUTTER_EASE_OUT_EXPO);
|
||||||
|
|
||||||
g_signal_connect (priv->deceleration_timeline, "new_frame",
|
g_signal_connect (priv->deceleration_timeline, "new_frame",
|
||||||
G_CALLBACK (on_deceleration_new_frame), self);
|
G_CALLBACK (on_deceleration_new_frame), self);
|
||||||
@@ -367,7 +387,8 @@ clutter_pan_action_set_property (GObject *gobject,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_ACCELERATION_FACTOR :
|
case PROP_ACCELERATION_FACTOR :
|
||||||
clutter_pan_action_set_acceleration_factor (self, g_value_get_double (value));
|
clutter_pan_action_set_acceleration_factor (self,
|
||||||
|
g_value_get_double (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -411,9 +432,11 @@ static void
|
|||||||
clutter_pan_action_constructed (GObject *gobject)
|
clutter_pan_action_constructed (GObject *gobject)
|
||||||
{
|
{
|
||||||
ClutterGestureAction *gesture;
|
ClutterGestureAction *gesture;
|
||||||
|
ClutterGestureTriggerEdge edge;
|
||||||
|
|
||||||
gesture = CLUTTER_GESTURE_ACTION (gobject);
|
gesture = CLUTTER_GESTURE_ACTION (gobject);
|
||||||
clutter_gesture_action_set_threshold_trigger_edge (gesture, CLUTTER_GESTURE_TRIGGER_EDGE_AFTER);
|
edge = CLUTTER_GESTURE_TRIGGER_EDGE_AFTER;
|
||||||
|
clutter_gesture_action_set_threshold_trigger_edge (gesture, edge);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -440,9 +463,12 @@ clutter_pan_action_set_actor (ClutterActorMeta *meta,
|
|||||||
/* make sure we reset the state */
|
/* make sure we reset the state */
|
||||||
if (priv->state == PAN_STATE_INTERPOLATING)
|
if (priv->state == PAN_STATE_INTERPOLATING)
|
||||||
g_clear_object (&priv->deceleration_timeline);
|
g_clear_object (&priv->deceleration_timeline);
|
||||||
|
else if (priv->deceleration_timeline)
|
||||||
|
clutter_timeline_set_actor (priv->deceleration_timeline, actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
CLUTTER_ACTOR_META_CLASS (clutter_pan_action_parent_class)->set_actor (meta, actor);
|
CLUTTER_ACTOR_META_CLASS (clutter_pan_action_parent_class)->set_actor (meta,
|
||||||
|
actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -880,7 +906,9 @@ clutter_pan_action_get_constrained_motion_delta (ClutterPanAction *self,
|
|||||||
|
|
||||||
priv = self->priv;
|
priv = self->priv;
|
||||||
|
|
||||||
distance = clutter_pan_action_get_motion_delta (self, point, &delta_x, &delta_y);
|
distance = clutter_pan_action_get_motion_delta (self, point,
|
||||||
|
&delta_x,
|
||||||
|
&delta_y);
|
||||||
|
|
||||||
switch (priv->pan_axis)
|
switch (priv->pan_axis)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,7 +37,6 @@
|
|||||||
#include "clutter-feature.h"
|
#include "clutter-feature.h"
|
||||||
#include "clutter-id-pool.h"
|
#include "clutter-id-pool.h"
|
||||||
#include "clutter-layout-manager.h"
|
#include "clutter-layout-manager.h"
|
||||||
#include "clutter-master-clock.h"
|
|
||||||
#include "clutter-settings.h"
|
#include "clutter-settings.h"
|
||||||
#include "clutter-stage-manager.h"
|
#include "clutter-stage-manager.h"
|
||||||
#include "clutter-stage.h"
|
#include "clutter-stage.h"
|
||||||
@@ -65,7 +64,6 @@ typedef struct _ClutterVertex4 ClutterVertex4;
|
|||||||
|
|
||||||
#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE)
|
#define CLUTTER_ACTOR_IS_TOPLEVEL(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IS_TOPLEVEL) != FALSE)
|
||||||
#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
|
#define CLUTTER_ACTOR_IN_DESTRUCTION(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_DESTRUCTION) != FALSE)
|
||||||
#define CLUTTER_ACTOR_IN_REPARENT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_REPARENT) != FALSE)
|
|
||||||
#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
|
#define CLUTTER_ACTOR_IN_PAINT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PAINT) != FALSE)
|
||||||
#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
|
#define CLUTTER_ACTOR_IN_PICK(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_PICK) != FALSE)
|
||||||
#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
|
#define CLUTTER_ACTOR_IN_RELAYOUT(a) ((CLUTTER_PRIVATE_FLAGS (a) & CLUTTER_IN_RELAYOUT) != FALSE)
|
||||||
@@ -99,7 +97,6 @@ typedef enum
|
|||||||
|
|
||||||
CLUTTER_IN_DESTRUCTION = 1 << 0,
|
CLUTTER_IN_DESTRUCTION = 1 << 0,
|
||||||
CLUTTER_IS_TOPLEVEL = 1 << 1,
|
CLUTTER_IS_TOPLEVEL = 1 << 1,
|
||||||
CLUTTER_IN_REPARENT = 1 << 2,
|
|
||||||
CLUTTER_IN_PREF_WIDTH = 1 << 3,
|
CLUTTER_IN_PREF_WIDTH = 1 << 3,
|
||||||
CLUTTER_IN_PREF_HEIGHT = 1 << 4,
|
CLUTTER_IN_PREF_HEIGHT = 1 << 4,
|
||||||
|
|
||||||
@@ -124,11 +121,8 @@ struct _ClutterMainContext
|
|||||||
/* the object holding all the stage instances */
|
/* the object holding all the stage instances */
|
||||||
ClutterStageManager *stage_manager;
|
ClutterStageManager *stage_manager;
|
||||||
|
|
||||||
/* the clock driving all the frame operations */
|
|
||||||
ClutterMasterClock *master_clock;
|
|
||||||
|
|
||||||
/* the main event queue */
|
/* the main event queue */
|
||||||
GQueue *events_queue;
|
GAsyncQueue *events_queue;
|
||||||
|
|
||||||
/* the event filters added via clutter_event_add_filter. these are
|
/* the event filters added via clutter_event_add_filter. these are
|
||||||
* ordered from least recently added to most recently added */
|
* ordered from least recently added to most recently added */
|
||||||
@@ -179,11 +173,6 @@ typedef struct
|
|||||||
gboolean _clutter_threads_dispatch (gpointer data);
|
gboolean _clutter_threads_dispatch (gpointer data);
|
||||||
void _clutter_threads_dispatch_free (gpointer data);
|
void _clutter_threads_dispatch_free (gpointer data);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void _clutter_threads_acquire_lock (void);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void _clutter_threads_release_lock (void);
|
|
||||||
|
|
||||||
ClutterMainContext * _clutter_context_get_default (void);
|
ClutterMainContext * _clutter_context_get_default (void);
|
||||||
void _clutter_context_lock (void);
|
void _clutter_context_lock (void);
|
||||||
void _clutter_context_unlock (void);
|
void _clutter_context_unlock (void);
|
||||||
@@ -318,6 +307,36 @@ gboolean _clutter_run_progress_function (GType gtype,
|
|||||||
|
|
||||||
void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
|
void clutter_timeline_cancel_delay (ClutterTimeline *timeline);
|
||||||
|
|
||||||
|
static inline uint64_t
|
||||||
|
us (uint64_t us)
|
||||||
|
{
|
||||||
|
return us;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
ms (uint32_t ms)
|
||||||
|
{
|
||||||
|
return ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t
|
||||||
|
ms2us (uint64_t ms)
|
||||||
|
{
|
||||||
|
return us (ms * 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint32_t
|
||||||
|
us2ms (uint64_t us)
|
||||||
|
{
|
||||||
|
return (uint32_t) (us / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline uint64_t
|
||||||
|
ns2us (uint64_t ns)
|
||||||
|
{
|
||||||
|
return us (ns / 1000);
|
||||||
|
}
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_PRIVATE_H__ */
|
#endif /* __CLUTTER_PRIVATE_H__ */
|
||||||
|
|||||||
@@ -278,6 +278,26 @@ clutter_property_transition_init (ClutterPropertyTransition *self)
|
|||||||
self->priv = clutter_property_transition_get_instance_private (self);
|
self->priv = clutter_property_transition_get_instance_private (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_property_transition_new_for_actor:
|
||||||
|
* @actor: a #ClutterActor
|
||||||
|
* @property_name: (allow-none): a property of @animatable, or %NULL
|
||||||
|
*
|
||||||
|
* Creates a new #ClutterPropertyTransition.
|
||||||
|
*
|
||||||
|
* Return value: (transfer full): the newly created #ClutterPropertyTransition.
|
||||||
|
* Use g_object_unref() when done
|
||||||
|
*/
|
||||||
|
ClutterTransition *
|
||||||
|
clutter_property_transition_new_for_actor (ClutterActor *actor,
|
||||||
|
const char *property_name)
|
||||||
|
{
|
||||||
|
return g_object_new (CLUTTER_TYPE_PROPERTY_TRANSITION,
|
||||||
|
"actor", actor,
|
||||||
|
"property-name", property_name,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_property_transition_new:
|
* clutter_property_transition_new:
|
||||||
* @property_name: (allow-none): a property of @animatable, or %NULL
|
* @property_name: (allow-none): a property of @animatable, or %NULL
|
||||||
|
|||||||
@@ -78,8 +78,13 @@ struct _ClutterPropertyTransitionClass
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
GType clutter_property_transition_get_type (void) G_GNUC_CONST;
|
GType clutter_property_transition_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterTransition * clutter_property_transition_new_for_actor (ClutterActor *actor,
|
||||||
|
const char *property_name);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterTransition * clutter_property_transition_new (const char *property_name);
|
ClutterTransition * clutter_property_transition_new (const char *property_name);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_property_transition_set_property_name (ClutterPropertyTransition *transition,
|
void clutter_property_transition_set_property_name (ClutterPropertyTransition *transition,
|
||||||
const char *property_name);
|
const char *property_name);
|
||||||
|
|||||||
@@ -34,7 +34,6 @@
|
|||||||
|
|
||||||
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
#define CLUTTER_DISABLE_DEPRECATION_WARNINGS
|
||||||
#include "deprecated/clutter-container.h"
|
#include "deprecated/clutter-container.h"
|
||||||
#include "deprecated/clutter-alpha.h"
|
|
||||||
|
|
||||||
#include "clutter-actor.h"
|
#include "clutter-actor.h"
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
@@ -799,232 +798,6 @@ parse_signals (ClutterScript *script,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClutterTimeline *
|
|
||||||
construct_timeline (ClutterScript *script,
|
|
||||||
JsonObject *object)
|
|
||||||
{
|
|
||||||
ClutterTimeline *retval = NULL;
|
|
||||||
ObjectInfo *oinfo;
|
|
||||||
GList *members, *l;
|
|
||||||
|
|
||||||
/* we fake an ObjectInfo so we can reuse clutter_script_construct_object()
|
|
||||||
* here; we do not save it inside the hash table, because if this had
|
|
||||||
* been a named object then we wouldn't have ended up here in the first
|
|
||||||
* place
|
|
||||||
*/
|
|
||||||
oinfo = g_slice_new0 (ObjectInfo);
|
|
||||||
oinfo->gtype = CLUTTER_TYPE_TIMELINE;
|
|
||||||
oinfo->id = g_strdup ("dummy");
|
|
||||||
|
|
||||||
members = json_object_get_members (object);
|
|
||||||
for (l = members; l != NULL; l = l->next)
|
|
||||||
{
|
|
||||||
const gchar *name = l->data;
|
|
||||||
JsonNode *node = json_object_get_member (object, name);
|
|
||||||
PropertyInfo *pinfo = g_slice_new0 (PropertyInfo);
|
|
||||||
|
|
||||||
pinfo->name = g_strdelimit (g_strdup (name), G_STR_DELIMITERS, '-');
|
|
||||||
pinfo->node = json_node_copy (node);
|
|
||||||
|
|
||||||
oinfo->properties = g_list_prepend (oinfo->properties, pinfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (members);
|
|
||||||
|
|
||||||
_clutter_script_construct_object (script, oinfo);
|
|
||||||
_clutter_script_apply_properties (script, oinfo);
|
|
||||||
retval = CLUTTER_TIMELINE (oinfo->object);
|
|
||||||
|
|
||||||
/* we transfer ownership to the alpha function, so we ref before
|
|
||||||
* destroying the ObjectInfo to avoid the timeline going away
|
|
||||||
*/
|
|
||||||
g_object_ref (retval);
|
|
||||||
object_info_free (oinfo);
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* define the names of the animation modes to match the ones
|
|
||||||
* that developers might be more accustomed to
|
|
||||||
*/
|
|
||||||
static const struct
|
|
||||||
{
|
|
||||||
const gchar *name;
|
|
||||||
ClutterAnimationMode mode;
|
|
||||||
} animation_modes[] = {
|
|
||||||
{ "linear", CLUTTER_LINEAR },
|
|
||||||
{ "easeInQuad", CLUTTER_EASE_IN_QUAD },
|
|
||||||
{ "easeOutQuad", CLUTTER_EASE_OUT_QUAD },
|
|
||||||
{ "easeInOutQuad", CLUTTER_EASE_IN_OUT_QUAD },
|
|
||||||
{ "easeInCubic", CLUTTER_EASE_IN_CUBIC },
|
|
||||||
{ "easeOutCubic", CLUTTER_EASE_OUT_CUBIC },
|
|
||||||
{ "easeInOutCubic", CLUTTER_EASE_IN_OUT_CUBIC },
|
|
||||||
{ "easeInQuart", CLUTTER_EASE_IN_QUART },
|
|
||||||
{ "easeOutQuart", CLUTTER_EASE_OUT_QUART },
|
|
||||||
{ "easeInOutQuart", CLUTTER_EASE_IN_OUT_QUART },
|
|
||||||
{ "easeInQuint", CLUTTER_EASE_IN_QUINT },
|
|
||||||
{ "easeOutQuint", CLUTTER_EASE_OUT_QUINT },
|
|
||||||
{ "easeInOutQuint", CLUTTER_EASE_IN_OUT_QUINT },
|
|
||||||
{ "easeInSine", CLUTTER_EASE_IN_SINE },
|
|
||||||
{ "easeOutSine", CLUTTER_EASE_OUT_SINE },
|
|
||||||
{ "easeInOutSine", CLUTTER_EASE_IN_OUT_SINE },
|
|
||||||
{ "easeInExpo", CLUTTER_EASE_IN_EXPO },
|
|
||||||
{ "easeOutExpo", CLUTTER_EASE_OUT_EXPO },
|
|
||||||
{ "easeInOutExpo", CLUTTER_EASE_IN_OUT_EXPO },
|
|
||||||
{ "easeInCirc", CLUTTER_EASE_IN_CIRC },
|
|
||||||
{ "easeOutCirc", CLUTTER_EASE_OUT_CIRC },
|
|
||||||
{ "easeInOutCirc", CLUTTER_EASE_IN_OUT_CIRC },
|
|
||||||
{ "easeInElastic", CLUTTER_EASE_IN_ELASTIC },
|
|
||||||
{ "easeOutElastic", CLUTTER_EASE_OUT_ELASTIC },
|
|
||||||
{ "easeInOutElastic", CLUTTER_EASE_IN_OUT_ELASTIC },
|
|
||||||
{ "easeInBack", CLUTTER_EASE_IN_BACK },
|
|
||||||
{ "easeOutBack", CLUTTER_EASE_OUT_BACK },
|
|
||||||
{ "easeInOutBack", CLUTTER_EASE_IN_OUT_BACK },
|
|
||||||
{ "easeInBounce", CLUTTER_EASE_IN_BOUNCE },
|
|
||||||
{ "easeOutBounce", CLUTTER_EASE_OUT_BOUNCE },
|
|
||||||
{ "easeInOutBounce", CLUTTER_EASE_IN_OUT_BOUNCE },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const gint n_animation_modes = G_N_ELEMENTS (animation_modes);
|
|
||||||
|
|
||||||
gulong
|
|
||||||
_clutter_script_resolve_animation_mode (JsonNode *node)
|
|
||||||
{
|
|
||||||
gint i, res = CLUTTER_CUSTOM_MODE;
|
|
||||||
|
|
||||||
if (JSON_NODE_TYPE (node) != JSON_NODE_VALUE)
|
|
||||||
return CLUTTER_CUSTOM_MODE;
|
|
||||||
|
|
||||||
if (json_node_get_value_type (node) == G_TYPE_INT64)
|
|
||||||
return json_node_get_int (node);
|
|
||||||
|
|
||||||
if (json_node_get_value_type (node) == G_TYPE_STRING)
|
|
||||||
{
|
|
||||||
const gchar *name = json_node_get_string (node);
|
|
||||||
|
|
||||||
/* XXX - we might be able to optimize by changing the ordering
|
|
||||||
* of the animation_modes array, e.g.
|
|
||||||
* - special casing linear
|
|
||||||
* - tokenizing ('ease', 'In', 'Sine') and matching on token
|
|
||||||
* - binary searching?
|
|
||||||
*/
|
|
||||||
for (i = 0; i < n_animation_modes; i++)
|
|
||||||
{
|
|
||||||
if (strcmp (animation_modes[i].name, name) == 0)
|
|
||||||
return animation_modes[i].mode;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_clutter_script_enum_from_string (CLUTTER_TYPE_ANIMATION_MODE,
|
|
||||||
name,
|
|
||||||
&res))
|
|
||||||
return res;
|
|
||||||
|
|
||||||
g_warning ("Unable to find the animation mode '%s'", name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return CLUTTER_CUSTOM_MODE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ClutterAlphaFunc
|
|
||||||
resolve_alpha_func (const gchar *name)
|
|
||||||
{
|
|
||||||
static GModule *module = NULL;
|
|
||||||
ClutterAlphaFunc func;
|
|
||||||
|
|
||||||
CLUTTER_NOTE (SCRIPT, "Looking up '%s' alpha function", name);
|
|
||||||
|
|
||||||
if (G_UNLIKELY (!module))
|
|
||||||
module = g_module_open (NULL, 0);
|
|
||||||
|
|
||||||
if (g_module_symbol (module, name, (gpointer) &func))
|
|
||||||
{
|
|
||||||
CLUTTER_NOTE (SCRIPT, "Found '%s' alpha function in the symbols table",
|
|
||||||
name);
|
|
||||||
return func;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
GObject *
|
|
||||||
_clutter_script_parse_alpha (ClutterScript *script,
|
|
||||||
JsonNode *node)
|
|
||||||
{
|
|
||||||
GObject *retval = NULL;
|
|
||||||
JsonObject *object;
|
|
||||||
ClutterTimeline *timeline = NULL;
|
|
||||||
ClutterAlphaFunc alpha_func = NULL;
|
|
||||||
ClutterAnimationMode mode = CLUTTER_CUSTOM_MODE;
|
|
||||||
JsonNode *val;
|
|
||||||
gboolean unref_timeline = FALSE;
|
|
||||||
|
|
||||||
if (JSON_NODE_TYPE (node) != JSON_NODE_OBJECT)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
object = json_node_get_object (node);
|
|
||||||
|
|
||||||
val = json_object_get_member (object, "timeline");
|
|
||||||
if (val)
|
|
||||||
{
|
|
||||||
if (JSON_NODE_TYPE (val) == JSON_NODE_VALUE &&
|
|
||||||
json_node_get_string (val) != NULL)
|
|
||||||
{
|
|
||||||
const gchar *id_ = json_node_get_string (val);
|
|
||||||
|
|
||||||
timeline =
|
|
||||||
CLUTTER_TIMELINE (clutter_script_get_object (script, id_));
|
|
||||||
}
|
|
||||||
else if (JSON_NODE_TYPE (val) == JSON_NODE_OBJECT)
|
|
||||||
{
|
|
||||||
timeline = construct_timeline (script, json_node_get_object (val));
|
|
||||||
unref_timeline = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
val = json_object_get_member (object, "mode");
|
|
||||||
if (val != NULL)
|
|
||||||
mode = _clutter_script_resolve_animation_mode (val);
|
|
||||||
|
|
||||||
if (mode == CLUTTER_CUSTOM_MODE)
|
|
||||||
{
|
|
||||||
val = json_object_get_member (object, "function");
|
|
||||||
if (val && json_node_get_string (val) != NULL)
|
|
||||||
{
|
|
||||||
alpha_func = resolve_alpha_func (json_node_get_string (val));
|
|
||||||
if (!alpha_func)
|
|
||||||
{
|
|
||||||
g_warning ("Unable to find the function '%s' in the "
|
|
||||||
"Clutter alpha functions or the symbols table",
|
|
||||||
json_node_get_string (val));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CLUTTER_NOTE (SCRIPT, "Parsed alpha: %s timeline (%p) (mode:%d, func:%p)",
|
|
||||||
unref_timeline ? "implicit" : "explicit",
|
|
||||||
timeline ? timeline : 0x0,
|
|
||||||
mode != CLUTTER_CUSTOM_MODE ? mode : 0,
|
|
||||||
alpha_func ? alpha_func : 0x0);
|
|
||||||
|
|
||||||
retval = g_object_new (CLUTTER_TYPE_ALPHA, NULL);
|
|
||||||
|
|
||||||
if (mode != CLUTTER_CUSTOM_MODE)
|
|
||||||
clutter_alpha_set_mode (CLUTTER_ALPHA (retval), mode);
|
|
||||||
|
|
||||||
if (alpha_func != NULL)
|
|
||||||
clutter_alpha_set_func (CLUTTER_ALPHA (retval), alpha_func, NULL, NULL);
|
|
||||||
|
|
||||||
clutter_alpha_set_timeline (CLUTTER_ALPHA (retval), timeline);
|
|
||||||
|
|
||||||
/* if we created an implicit timeline, the Alpha has full ownership
|
|
||||||
* of it now, since it won't be accessible from ClutterScript
|
|
||||||
*/
|
|
||||||
if (unref_timeline)
|
|
||||||
g_object_unref (timeline);
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_script_parser_object_end (JsonParser *json_parser,
|
clutter_script_parser_object_end (JsonParser *json_parser,
|
||||||
JsonObject *object)
|
JsonObject *object)
|
||||||
@@ -1750,7 +1523,7 @@ clutter_script_construct_parameters (ClutterScript *script,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(pspec->flags & G_PARAM_CONSTRUCT_ONLY))
|
if (!(pspec->flags & (G_PARAM_CONSTRUCT | G_PARAM_CONSTRUCT_ONLY)))
|
||||||
{
|
{
|
||||||
unparsed = g_list_prepend (unparsed, pinfo);
|
unparsed = g_list_prepend (unparsed, pinfo);
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -110,8 +110,6 @@ gboolean _clutter_script_parse_node (ClutterScript *script,
|
|||||||
GType _clutter_script_get_type_from_symbol (const gchar *symbol);
|
GType _clutter_script_get_type_from_symbol (const gchar *symbol);
|
||||||
GType _clutter_script_get_type_from_class (const gchar *name);
|
GType _clutter_script_get_type_from_class (const gchar *name);
|
||||||
|
|
||||||
gulong _clutter_script_resolve_animation_mode (JsonNode *node);
|
|
||||||
|
|
||||||
gboolean _clutter_script_enum_from_string (GType gtype,
|
gboolean _clutter_script_enum_from_string (GType gtype,
|
||||||
const gchar *string,
|
const gchar *string,
|
||||||
gint *enum_value);
|
gint *enum_value);
|
||||||
@@ -128,8 +126,6 @@ gboolean _clutter_script_parse_rect (ClutterScript *script,
|
|||||||
gboolean _clutter_script_parse_color (ClutterScript *script,
|
gboolean _clutter_script_parse_color (ClutterScript *script,
|
||||||
JsonNode *node,
|
JsonNode *node,
|
||||||
ClutterColor *color);
|
ClutterColor *color);
|
||||||
GObject *_clutter_script_parse_alpha (ClutterScript *script,
|
|
||||||
JsonNode *node);
|
|
||||||
gboolean _clutter_script_parse_point (ClutterScript *script,
|
gboolean _clutter_script_parse_point (ClutterScript *script,
|
||||||
JsonNode *node,
|
JsonNode *node,
|
||||||
graphene_point_t *point);
|
graphene_point_t *point);
|
||||||
|
|||||||
@@ -50,14 +50,14 @@
|
|||||||
* <informalexample><programlisting><![CDATA[
|
* <informalexample><programlisting><![CDATA[
|
||||||
* {
|
* {
|
||||||
* "id" : "red-button",
|
* "id" : "red-button",
|
||||||
* "type" : "ClutterRectangle",
|
* "type" : "ClutterActor",
|
||||||
* "width" : 100,
|
* "width" : 100,
|
||||||
* "height" : 100,
|
* "height" : 100,
|
||||||
* "color" : "#ff0000ff"
|
* "background-color" : "#ff0000ff"
|
||||||
* }
|
* }
|
||||||
* ]]></programlisting></informalexample>
|
* ]]></programlisting></informalexample>
|
||||||
*
|
*
|
||||||
* This will produce a red #ClutterRectangle, 100x100 pixels wide, and
|
* This will produce a red #ClutterActor, 100x100 pixels wide, and
|
||||||
* with a ClutterScript id of "red-button"; it can be retrieved by calling:
|
* with a ClutterScript id of "red-button"; it can be retrieved by calling:
|
||||||
*
|
*
|
||||||
* |[
|
* |[
|
||||||
@@ -98,49 +98,6 @@
|
|||||||
* respectively) and the "object" string member for calling
|
* respectively) and the "object" string member for calling
|
||||||
* g_signal_connect_object() instead of g_signal_connect().
|
* g_signal_connect_object() instead of g_signal_connect().
|
||||||
*
|
*
|
||||||
* Signals can also be directly attached to a specific state defined
|
|
||||||
* inside a #ClutterState instance, for instance:
|
|
||||||
*
|
|
||||||
* |[
|
|
||||||
* ...
|
|
||||||
* "signals" : [
|
|
||||||
* {
|
|
||||||
* "name" : "enter-event",
|
|
||||||
* "states" : "button-states",
|
|
||||||
* "target-state" : "hover"
|
|
||||||
* },
|
|
||||||
* {
|
|
||||||
* "name" : "leave-event",
|
|
||||||
* "states" : "button-states",
|
|
||||||
* "target-state" : "base"
|
|
||||||
* },
|
|
||||||
* {
|
|
||||||
* "name" : "button-press-event",
|
|
||||||
* "states" : "button-states",
|
|
||||||
* "target-state" : "active",
|
|
||||||
* },
|
|
||||||
* {
|
|
||||||
* "name" : "key-press-event",
|
|
||||||
* "states" : "button-states",
|
|
||||||
* "target-state" : "key-focus",
|
|
||||||
* "warp" : true
|
|
||||||
* }
|
|
||||||
* ],
|
|
||||||
* ...
|
|
||||||
* ]|
|
|
||||||
*
|
|
||||||
* The "states" key defines the #ClutterState instance to be used to
|
|
||||||
* resolve the "target-state" key; it can be either a script id for a
|
|
||||||
* #ClutterState built by the same #ClutterScript instance, or to a
|
|
||||||
* #ClutterState built in code and associated to the #ClutterScript
|
|
||||||
* instance through the clutter_script_add_states() function. If no
|
|
||||||
* "states" key is present, then the default #ClutterState associated to
|
|
||||||
* the #ClutterScript instance will be used; the default #ClutterState
|
|
||||||
* can be set using clutter_script_add_states() using a %NULL name. The
|
|
||||||
* "warp" key can be used to warp to a specific state instead of
|
|
||||||
* animating to it. State changes on signal emission will not affect
|
|
||||||
* the signal emission chain.
|
|
||||||
*
|
|
||||||
* Clutter reserves the following names, so classes defining properties
|
* Clutter reserves the following names, so classes defining properties
|
||||||
* through the usual GObject registration process should avoid using these
|
* through the usual GObject registration process should avoid using these
|
||||||
* names to avoid collisions:
|
* names to avoid collisions:
|
||||||
@@ -184,9 +141,7 @@
|
|||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
|
|
||||||
#include "deprecated/clutter-alpha.h"
|
|
||||||
#include "deprecated/clutter-container.h"
|
#include "deprecated/clutter-container.h"
|
||||||
#include "deprecated/clutter-state.h"
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
@@ -210,8 +165,6 @@ struct _ClutterScriptPrivate
|
|||||||
|
|
||||||
ClutterScriptParser *parser;
|
ClutterScriptParser *parser;
|
||||||
|
|
||||||
GHashTable *states;
|
|
||||||
|
|
||||||
gchar **search_paths;
|
gchar **search_paths;
|
||||||
|
|
||||||
gchar *translation_domain;
|
gchar *translation_domain;
|
||||||
@@ -264,7 +217,6 @@ signal_info_free (gpointer data)
|
|||||||
g_free (sinfo->name);
|
g_free (sinfo->name);
|
||||||
g_free (sinfo->handler);
|
g_free (sinfo->handler);
|
||||||
g_free (sinfo->object);
|
g_free (sinfo->object);
|
||||||
g_free (sinfo->state);
|
|
||||||
g_free (sinfo->target);
|
g_free (sinfo->target);
|
||||||
|
|
||||||
g_slice_free (SignalInfo, sinfo);
|
g_slice_free (SignalInfo, sinfo);
|
||||||
@@ -319,7 +271,6 @@ clutter_script_finalize (GObject *gobject)
|
|||||||
g_hash_table_destroy (priv->objects);
|
g_hash_table_destroy (priv->objects);
|
||||||
g_strfreev (priv->search_paths);
|
g_strfreev (priv->search_paths);
|
||||||
g_free (priv->filename);
|
g_free (priv->filename);
|
||||||
g_hash_table_destroy (priv->states);
|
|
||||||
g_free (priv->translation_domain);
|
g_free (priv->translation_domain);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_script_parent_class)->finalize (gobject);
|
G_OBJECT_CLASS (clutter_script_parent_class)->finalize (gobject);
|
||||||
@@ -454,9 +405,6 @@ clutter_script_init (ClutterScript *script)
|
|||||||
priv->objects = g_hash_table_new_full (g_str_hash, g_str_equal,
|
priv->objects = g_hash_table_new_full (g_str_hash, g_str_equal,
|
||||||
NULL,
|
NULL,
|
||||||
object_info_free);
|
object_info_free);
|
||||||
priv->states = g_hash_table_new_full (g_str_hash, g_str_equal,
|
|
||||||
g_free,
|
|
||||||
(GDestroyNotify) g_object_unref);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -972,65 +920,12 @@ clutter_script_connect_signals (ClutterScript *script,
|
|||||||
g_free (cd);
|
g_free (cd);
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
ClutterState *state;
|
|
||||||
GObject *emitter;
|
|
||||||
gchar *target;
|
|
||||||
gulong signal_id;
|
|
||||||
gulong hook_id;
|
|
||||||
gboolean warp_to;
|
|
||||||
} HookData;
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
ClutterScript *script;
|
ClutterScript *script;
|
||||||
ClutterScriptConnectFunc func;
|
ClutterScriptConnectFunc func;
|
||||||
gpointer user_data;
|
gpointer user_data;
|
||||||
} SignalConnectData;
|
} SignalConnectData;
|
||||||
|
|
||||||
static void
|
|
||||||
hook_data_free (gpointer data)
|
|
||||||
{
|
|
||||||
if (G_LIKELY (data != NULL))
|
|
||||||
{
|
|
||||||
HookData *hook_data = data;
|
|
||||||
|
|
||||||
g_free (hook_data->target);
|
|
||||||
g_slice_free (HookData, hook_data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
clutter_script_state_change_hook (GSignalInvocationHint *ihint,
|
|
||||||
guint n_params,
|
|
||||||
const GValue *params,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
HookData *hook_data = user_data;
|
|
||||||
GObject *emitter;
|
|
||||||
|
|
||||||
emitter = g_value_get_object (¶ms[0]);
|
|
||||||
|
|
||||||
if (emitter == hook_data->emitter)
|
|
||||||
{
|
|
||||||
if (hook_data->warp_to)
|
|
||||||
clutter_state_warp_to_state (hook_data->state, hook_data->target);
|
|
||||||
else
|
|
||||||
clutter_state_set_state (hook_data->state, hook_data->target);
|
|
||||||
}
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_script_remove_state_change_hook (gpointer user_data,
|
|
||||||
GObject *object_p)
|
|
||||||
{
|
|
||||||
HookData *hook_data = user_data;
|
|
||||||
|
|
||||||
g_signal_remove_emission_hook (hook_data->signal_id,
|
|
||||||
hook_data->hook_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
connect_each_object (gpointer key,
|
connect_each_object (gpointer key,
|
||||||
gpointer value,
|
gpointer value,
|
||||||
@@ -1070,64 +965,7 @@ connect_each_object (gpointer key,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
GObject *state_object = NULL;
|
g_warn_if_reached ();
|
||||||
const gchar *signal_name, *signal_detail;
|
|
||||||
gchar **components;
|
|
||||||
GQuark signal_quark;
|
|
||||||
guint signal_id;
|
|
||||||
HookData *hook_data;
|
|
||||||
|
|
||||||
if (sinfo->state == NULL)
|
|
||||||
state_object = (GObject *) clutter_script_get_states (script, NULL);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
state_object = clutter_script_get_object (script, sinfo->state);
|
|
||||||
if (state_object == NULL)
|
|
||||||
state_object = (GObject *) clutter_script_get_states (script, sinfo->state);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state_object == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
components = g_strsplit (sinfo->name, "::", 2);
|
|
||||||
if (g_strv_length (components) == 2)
|
|
||||||
{
|
|
||||||
signal_name = components[0];
|
|
||||||
signal_detail = components[1];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
signal_name = components[0];
|
|
||||||
signal_detail = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
signal_id = g_signal_lookup (signal_name, G_OBJECT_TYPE (object));
|
|
||||||
if (signal_id == 0)
|
|
||||||
{
|
|
||||||
g_strfreev (components);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (signal_detail != NULL)
|
|
||||||
signal_quark = g_quark_from_string (signal_detail);
|
|
||||||
else
|
|
||||||
signal_quark = 0;
|
|
||||||
|
|
||||||
hook_data = g_slice_new (HookData);
|
|
||||||
hook_data->emitter = object;
|
|
||||||
hook_data->state = CLUTTER_STATE (state_object);
|
|
||||||
hook_data->target = g_strdup (sinfo->target);
|
|
||||||
hook_data->warp_to = sinfo->warp_to;
|
|
||||||
hook_data->signal_id = signal_id;
|
|
||||||
hook_data->hook_id =
|
|
||||||
g_signal_add_emission_hook (signal_id, signal_quark,
|
|
||||||
clutter_script_state_change_hook,
|
|
||||||
hook_data,
|
|
||||||
hook_data_free);
|
|
||||||
|
|
||||||
g_object_weak_ref (hook_data->emitter,
|
|
||||||
clutter_script_remove_state_change_hook,
|
|
||||||
hook_data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
signal_info_free (sinfo);
|
signal_info_free (sinfo);
|
||||||
@@ -1352,72 +1190,6 @@ clutter_script_list_objects (ClutterScript *script)
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_script_add_states:
|
|
||||||
* @script: a #ClutterScript
|
|
||||||
* @name: (allow-none): a name for the @state, or %NULL to
|
|
||||||
* set the default #ClutterState
|
|
||||||
* @state: a #ClutterState
|
|
||||||
*
|
|
||||||
* Associates a #ClutterState to the #ClutterScript instance using the given
|
|
||||||
* name.
|
|
||||||
*
|
|
||||||
* The #ClutterScript instance will use @state to resolve target states when
|
|
||||||
* connecting signal handlers.
|
|
||||||
*
|
|
||||||
* The #ClutterScript instance will take a reference on the #ClutterState
|
|
||||||
* passed to this function.
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*
|
|
||||||
* Deprecated: 1.12
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_script_add_states (ClutterScript *script,
|
|
||||||
const gchar *name,
|
|
||||||
ClutterState *state)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_SCRIPT (script));
|
|
||||||
g_return_if_fail (CLUTTER_IS_STATE (state));
|
|
||||||
|
|
||||||
if (name == NULL || *name == '\0')
|
|
||||||
name = "__clutter_script_default_state";
|
|
||||||
|
|
||||||
g_hash_table_replace (script->priv->states,
|
|
||||||
g_strdup (name),
|
|
||||||
g_object_ref (state));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_script_get_states:
|
|
||||||
* @script: a #ClutterScript
|
|
||||||
* @name: (allow-none): the name of the #ClutterState, or %NULL
|
|
||||||
*
|
|
||||||
* Retrieves the #ClutterState for the given @state_name.
|
|
||||||
*
|
|
||||||
* If @name is %NULL, this function will return the default
|
|
||||||
* #ClutterState instance.
|
|
||||||
*
|
|
||||||
* Return value: (transfer none): a pointer to the #ClutterState for the
|
|
||||||
* given name. The #ClutterState is owned by the #ClutterScript instance
|
|
||||||
* and it should not be unreferenced
|
|
||||||
*
|
|
||||||
* Since: 1.8
|
|
||||||
*
|
|
||||||
* Deprecated: 1.12
|
|
||||||
*/
|
|
||||||
ClutterState *
|
|
||||||
clutter_script_get_states (ClutterScript *script,
|
|
||||||
const gchar *name)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_SCRIPT (script), NULL);
|
|
||||||
|
|
||||||
if (name == NULL || *name == '\0')
|
|
||||||
name = "__clutter_script_default_state";
|
|
||||||
|
|
||||||
return g_hash_table_lookup (script->priv->states, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_script_set_translation_domain:
|
* clutter_script_set_translation_domain:
|
||||||
* @script: a #ClutterScript
|
* @script: a #ClutterScript
|
||||||
|
|||||||
@@ -179,15 +179,6 @@ void clutter_script_unmerge_objects (ClutterScript
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_script_ensure_objects (ClutterScript *script);
|
void clutter_script_ensure_objects (ClutterScript *script);
|
||||||
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
void clutter_script_add_states (ClutterScript *script,
|
|
||||||
const gchar *name,
|
|
||||||
ClutterState *state);
|
|
||||||
|
|
||||||
CLUTTER_DEPRECATED
|
|
||||||
ClutterState * clutter_script_get_states (ClutterScript *script,
|
|
||||||
const gchar *name);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_script_connect_signals (ClutterScript *script,
|
void clutter_script_connect_signals (ClutterScript *script,
|
||||||
gpointer user_data);
|
gpointer user_data);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@
|
|||||||
#include "clutter-input-device-tool.h"
|
#include "clutter-input-device-tool.h"
|
||||||
#include "clutter-input-pointer-a11y-private.h"
|
#include "clutter-input-pointer-a11y-private.h"
|
||||||
#include "clutter-marshal.h"
|
#include "clutter-marshal.h"
|
||||||
|
#include "clutter-mutter.h"
|
||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
#include "clutter-seat.h"
|
#include "clutter-seat.h"
|
||||||
#include "clutter-virtual-input-device.h"
|
#include "clutter-virtual-input-device.h"
|
||||||
@@ -65,9 +66,6 @@ struct _ClutterSeatPrivate
|
|||||||
|
|
||||||
unsigned int inhibit_unfocus_count;
|
unsigned int inhibit_unfocus_count;
|
||||||
|
|
||||||
/* Keyboard a11y */
|
|
||||||
ClutterKbdA11ySettings kbd_a11y_settings;
|
|
||||||
|
|
||||||
/* Pointer a11y */
|
/* Pointer a11y */
|
||||||
ClutterPointerA11ySettings pointer_a11y_settings;
|
ClutterPointerA11ySettings pointer_a11y_settings;
|
||||||
};
|
};
|
||||||
@@ -354,6 +352,17 @@ clutter_seat_get_keyboard (ClutterSeat *seat)
|
|||||||
return CLUTTER_SEAT_GET_CLASS (seat)->get_keyboard (seat);
|
return CLUTTER_SEAT_GET_CLASS (seat)->get_keyboard (seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_seat_peek_devices: (skip)
|
||||||
|
**/
|
||||||
|
const GList *
|
||||||
|
clutter_seat_peek_devices (ClutterSeat *seat)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
|
||||||
|
|
||||||
|
return CLUTTER_SEAT_GET_CLASS (seat)->peek_devices (seat);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_seat_list_devices:
|
* clutter_seat_list_devices:
|
||||||
* @seat: a #ClutterSeat
|
* @seat: a #ClutterSeat
|
||||||
@@ -370,7 +379,7 @@ clutter_seat_list_devices (ClutterSeat *seat)
|
|||||||
{
|
{
|
||||||
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
|
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), NULL);
|
||||||
|
|
||||||
return CLUTTER_SEAT_GET_CLASS (seat)->list_devices (seat);
|
return g_list_copy ((GList *)clutter_seat_peek_devices (seat));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -393,43 +402,6 @@ clutter_seat_get_keymap (ClutterSeat *seat)
|
|||||||
return CLUTTER_SEAT_GET_CLASS (seat)->get_keymap (seat);
|
return CLUTTER_SEAT_GET_CLASS (seat)->get_keymap (seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
are_kbd_a11y_settings_equal (ClutterKbdA11ySettings *a,
|
|
||||||
ClutterKbdA11ySettings *b)
|
|
||||||
{
|
|
||||||
return (memcmp (a, b, sizeof (ClutterKbdA11ySettings)) == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
|
|
||||||
ClutterKbdA11ySettings *settings)
|
|
||||||
{
|
|
||||||
ClutterSeatClass *seat_class;
|
|
||||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
|
||||||
|
|
||||||
if (are_kbd_a11y_settings_equal (&priv->kbd_a11y_settings, settings))
|
|
||||||
return;
|
|
||||||
|
|
||||||
priv->kbd_a11y_settings = *settings;
|
|
||||||
|
|
||||||
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
|
||||||
if (seat_class->apply_kbd_a11y_settings)
|
|
||||||
seat_class->apply_kbd_a11y_settings (seat, settings);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
|
|
||||||
ClutterKbdA11ySettings *settings)
|
|
||||||
{
|
|
||||||
ClutterSeatPrivate *priv = clutter_seat_get_instance_private (seat);
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_SEAT (seat));
|
|
||||||
|
|
||||||
*settings = priv->kbd_a11y_settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_seat_ensure_a11y_state (ClutterSeat *seat)
|
clutter_seat_ensure_a11y_state (ClutterSeat *seat)
|
||||||
{
|
{
|
||||||
@@ -634,8 +606,8 @@ clutter_seat_create_virtual_device (ClutterSeat *seat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_seat_supported_virtual_device_types: (skip)
|
* clutter_seat_get_supported_virtual_device_types: (skip)
|
||||||
*/
|
**/
|
||||||
ClutterVirtualDeviceType
|
ClutterVirtualDeviceType
|
||||||
clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat)
|
clutter_seat_get_supported_virtual_device_types (ClutterSeat *seat)
|
||||||
{
|
{
|
||||||
@@ -663,6 +635,40 @@ clutter_seat_compress_motion (ClutterSeat *seat,
|
|||||||
seat_class->compress_motion (seat, event, to_discard);
|
seat_class->compress_motion (seat, event, to_discard);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
clutter_seat_handle_event_post (ClutterSeat *seat,
|
||||||
|
const ClutterEvent *event)
|
||||||
|
{
|
||||||
|
ClutterSeatClass *seat_class;
|
||||||
|
ClutterInputDevice *device;
|
||||||
|
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
|
||||||
|
g_return_val_if_fail (event, FALSE);
|
||||||
|
|
||||||
|
seat_class = CLUTTER_SEAT_GET_CLASS (seat);
|
||||||
|
|
||||||
|
if (seat_class->handle_event_post)
|
||||||
|
seat_class->handle_event_post (seat, event);
|
||||||
|
|
||||||
|
device = clutter_event_get_source_device (event);
|
||||||
|
g_assert_true (CLUTTER_IS_INPUT_DEVICE (device));
|
||||||
|
|
||||||
|
switch (event->type)
|
||||||
|
{
|
||||||
|
case CLUTTER_DEVICE_ADDED:
|
||||||
|
g_signal_emit (seat, signals[DEVICE_ADDED], 0, device);
|
||||||
|
break;
|
||||||
|
case CLUTTER_DEVICE_REMOVED:
|
||||||
|
g_signal_emit (seat, signals[DEVICE_REMOVED], 0, device);
|
||||||
|
g_object_run_dispose (G_OBJECT (device));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
clutter_seat_warp_pointer (ClutterSeat *seat,
|
clutter_seat_warp_pointer (ClutterSeat *seat,
|
||||||
int x,
|
int x,
|
||||||
@@ -682,7 +688,6 @@ clutter_seat_warp_pointer (ClutterSeat *seat,
|
|||||||
* requirements are fulfilled:
|
* requirements are fulfilled:
|
||||||
*
|
*
|
||||||
* - A touchscreen is available
|
* - A touchscreen is available
|
||||||
* - No external keyboard is attached to the device
|
|
||||||
* - A tablet mode switch, if present, is enabled
|
* - A tablet mode switch, if present, is enabled
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the device is a tablet that doesn't have an external
|
* Returns: %TRUE if the device is a tablet that doesn't have an external
|
||||||
@@ -699,3 +704,20 @@ clutter_seat_get_touch_mode (ClutterSeat *seat)
|
|||||||
|
|
||||||
return touch_mode;
|
return touch_mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
clutter_seat_query_state (ClutterSeat *seat,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
ClutterEventSequence *sequence,
|
||||||
|
graphene_point_t *coords,
|
||||||
|
ClutterModifierType *modifiers)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_SEAT (seat), FALSE);
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_INPUT_DEVICE (device), FALSE);
|
||||||
|
|
||||||
|
return CLUTTER_SEAT_GET_CLASS (seat)->query_state (seat,
|
||||||
|
device,
|
||||||
|
sequence,
|
||||||
|
coords,
|
||||||
|
modifiers);
|
||||||
|
}
|
||||||
|
|||||||
@@ -37,24 +37,6 @@ CLUTTER_EXPORT
|
|||||||
G_DECLARE_DERIVABLE_TYPE (ClutterSeat, clutter_seat,
|
G_DECLARE_DERIVABLE_TYPE (ClutterSeat, clutter_seat,
|
||||||
CLUTTER, SEAT, GObject)
|
CLUTTER, SEAT, GObject)
|
||||||
|
|
||||||
/**
|
|
||||||
* ClutterKbdA11ySettings:
|
|
||||||
*
|
|
||||||
* The #ClutterKbdA11ySettings structure contains keyboard accessibility
|
|
||||||
* settings
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
typedef struct _ClutterKbdA11ySettings
|
|
||||||
{
|
|
||||||
ClutterKeyboardA11yFlags controls;
|
|
||||||
gint slowkeys_delay;
|
|
||||||
gint debounce_delay;
|
|
||||||
gint timeout_delay;
|
|
||||||
gint mousekeys_init_delay;
|
|
||||||
gint mousekeys_max_speed;
|
|
||||||
gint mousekeys_accel_time;
|
|
||||||
} ClutterKbdA11ySettings;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterPointerA11ySettings:
|
* ClutterPointerA11ySettings:
|
||||||
*
|
*
|
||||||
@@ -96,7 +78,7 @@ struct _ClutterSeatClass
|
|||||||
ClutterInputDevice * (* get_pointer) (ClutterSeat *seat);
|
ClutterInputDevice * (* get_pointer) (ClutterSeat *seat);
|
||||||
ClutterInputDevice * (* get_keyboard) (ClutterSeat *seat);
|
ClutterInputDevice * (* get_keyboard) (ClutterSeat *seat);
|
||||||
|
|
||||||
GList * (* list_devices) (ClutterSeat *seat);
|
const GList * (* peek_devices) (ClutterSeat *seat);
|
||||||
|
|
||||||
void (* bell_notify) (ClutterSeat *seat);
|
void (* bell_notify) (ClutterSeat *seat);
|
||||||
|
|
||||||
@@ -106,10 +88,19 @@ struct _ClutterSeatClass
|
|||||||
ClutterEvent *event,
|
ClutterEvent *event,
|
||||||
const ClutterEvent *to_discard);
|
const ClutterEvent *to_discard);
|
||||||
|
|
||||||
|
gboolean (* handle_event_post) (ClutterSeat *seat,
|
||||||
|
const ClutterEvent *event);
|
||||||
|
|
||||||
void (* warp_pointer) (ClutterSeat *seat,
|
void (* warp_pointer) (ClutterSeat *seat,
|
||||||
int x,
|
int x,
|
||||||
int y);
|
int y);
|
||||||
|
|
||||||
|
gboolean (* query_state) (ClutterSeat *seat,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
ClutterEventSequence *sequence,
|
||||||
|
graphene_point_t *coords,
|
||||||
|
ClutterModifierType *modifiers);
|
||||||
|
|
||||||
/* Event platform data */
|
/* Event platform data */
|
||||||
void (* copy_event_data) (ClutterSeat *seat,
|
void (* copy_event_data) (ClutterSeat *seat,
|
||||||
const ClutterEvent *src,
|
const ClutterEvent *src,
|
||||||
@@ -117,10 +108,6 @@ struct _ClutterSeatClass
|
|||||||
void (* free_event_data) (ClutterSeat *seat,
|
void (* free_event_data) (ClutterSeat *seat,
|
||||||
ClutterEvent *event);
|
ClutterEvent *event);
|
||||||
|
|
||||||
/* Keyboard accessibility */
|
|
||||||
void (* apply_kbd_a11y_settings) (ClutterSeat *seat,
|
|
||||||
ClutterKbdA11ySettings *settings);
|
|
||||||
|
|
||||||
/* Virtual devices */
|
/* Virtual devices */
|
||||||
ClutterVirtualInputDevice * (* create_virtual_device) (ClutterSeat *seat,
|
ClutterVirtualInputDevice * (* create_virtual_device) (ClutterSeat *seat,
|
||||||
ClutterInputDeviceType device_type);
|
ClutterInputDeviceType device_type);
|
||||||
@@ -133,18 +120,13 @@ CLUTTER_EXPORT
|
|||||||
ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat);
|
ClutterInputDevice * clutter_seat_get_keyboard (ClutterSeat *seat);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
GList * clutter_seat_list_devices (ClutterSeat *seat);
|
GList * clutter_seat_list_devices (ClutterSeat *seat);
|
||||||
|
const GList * clutter_seat_peek_devices (ClutterSeat *seat);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_seat_bell_notify (ClutterSeat *seat);
|
void clutter_seat_bell_notify (ClutterSeat *seat);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterKeymap * clutter_seat_get_keymap (ClutterSeat *seat);
|
ClutterKeymap * clutter_seat_get_keymap (ClutterSeat *seat);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_seat_set_kbd_a11y_settings (ClutterSeat *seat,
|
|
||||||
ClutterKbdA11ySettings *settings);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_seat_get_kbd_a11y_settings (ClutterSeat *seat,
|
|
||||||
ClutterKbdA11ySettings *settings);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_seat_ensure_a11y_state (ClutterSeat *seat);
|
void clutter_seat_ensure_a11y_state (ClutterSeat *seat);
|
||||||
|
|
||||||
@@ -187,4 +169,11 @@ void clutter_seat_warp_pointer (ClutterSeat *seat,
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
|
gboolean clutter_seat_get_touch_mode (ClutterSeat *seat);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
gboolean clutter_seat_query_state (ClutterSeat *seat,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
ClutterEventSequence *sequence,
|
||||||
|
graphene_point_t *coords,
|
||||||
|
ClutterModifierType *modifiers);
|
||||||
|
|
||||||
#endif /* CLUTTER_SEAT_H */
|
#endif /* CLUTTER_SEAT_H */
|
||||||
|
|||||||
@@ -40,6 +40,18 @@
|
|||||||
#define CLUTTER_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SETTINGS))
|
#define CLUTTER_IS_SETTINGS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CLUTTER_TYPE_SETTINGS))
|
||||||
#define CLUTTER_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SETTINGS, ClutterSettingsClass))
|
#define CLUTTER_SETTINGS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CLUTTER_TYPE_SETTINGS, ClutterSettingsClass))
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
cairo_antialias_t cairo_antialias;
|
||||||
|
gint clutter_font_antialias;
|
||||||
|
|
||||||
|
cairo_hint_style_t cairo_hint_style;
|
||||||
|
const char *clutter_font_hint_style;
|
||||||
|
|
||||||
|
cairo_subpixel_order_t cairo_subpixel_order;
|
||||||
|
const char *clutter_font_subpixel_order;
|
||||||
|
} FontSettings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterSettings:
|
* ClutterSettings:
|
||||||
*
|
*
|
||||||
@@ -53,6 +65,7 @@ struct _ClutterSettings
|
|||||||
GObject parent_instance;
|
GObject parent_instance;
|
||||||
|
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
|
GSettings *xsettings;
|
||||||
|
|
||||||
gint double_click_time;
|
gint double_click_time;
|
||||||
gint double_click_distance;
|
gint double_click_distance;
|
||||||
@@ -267,6 +280,159 @@ settings_update_fontmap (ClutterSettings *self,
|
|||||||
#endif /* HAVE_PANGO_FT2 */
|
#endif /* HAVE_PANGO_FT2 */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
get_font_gsettings (GSettings *xsettings,
|
||||||
|
FontSettings *output)
|
||||||
|
{
|
||||||
|
/* org.gnome.settings-daemon.GsdFontAntialiasingMode */
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
cairo_antialias_t cairo_antialias;
|
||||||
|
gint clutter_font_antialias;
|
||||||
|
}
|
||||||
|
antialiasings[] =
|
||||||
|
{
|
||||||
|
/* none=0 */ {CAIRO_ANTIALIAS_NONE, 0},
|
||||||
|
/* grayscale=1 */ {CAIRO_ANTIALIAS_GRAY, 1},
|
||||||
|
/* rgba=2 */ {CAIRO_ANTIALIAS_SUBPIXEL, 1},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* org.gnome.settings-daemon.GsdFontHinting */
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
cairo_hint_style_t cairo_hint_style;
|
||||||
|
const char *clutter_font_hint_style;
|
||||||
|
}
|
||||||
|
hintings[] =
|
||||||
|
{
|
||||||
|
/* none=0 */ {CAIRO_HINT_STYLE_NONE, "hintnone"},
|
||||||
|
/* slight=1 */ {CAIRO_HINT_STYLE_SLIGHT, "hintslight"},
|
||||||
|
/* medium=2 */ {CAIRO_HINT_STYLE_MEDIUM, "hintmedium"},
|
||||||
|
/* full=3 */ {CAIRO_HINT_STYLE_FULL, "hintfull"},
|
||||||
|
};
|
||||||
|
|
||||||
|
/* org.gnome.settings-daemon.GsdFontRgbaOrder */
|
||||||
|
static const struct
|
||||||
|
{
|
||||||
|
cairo_subpixel_order_t cairo_subpixel_order;
|
||||||
|
const char *clutter_font_subpixel_order;
|
||||||
|
}
|
||||||
|
rgba_orders[] =
|
||||||
|
{
|
||||||
|
/* rgba=0 */ {CAIRO_SUBPIXEL_ORDER_RGB, "rgb"}, /* XXX what is 'rgba'? */
|
||||||
|
/* rgb=1 */ {CAIRO_SUBPIXEL_ORDER_RGB, "rgb"},
|
||||||
|
/* bgr=2 */ {CAIRO_SUBPIXEL_ORDER_BGR, "bgr"},
|
||||||
|
/* vrgb=3 */ {CAIRO_SUBPIXEL_ORDER_VRGB, "vrgb"},
|
||||||
|
/* vbgr=4 */ {CAIRO_SUBPIXEL_ORDER_VBGR, "vbgr"},
|
||||||
|
};
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
i = g_settings_get_enum (xsettings, "hinting");
|
||||||
|
if (i < G_N_ELEMENTS (hintings))
|
||||||
|
{
|
||||||
|
output->cairo_hint_style = hintings[i].cairo_hint_style;
|
||||||
|
output->clutter_font_hint_style = hintings[i].clutter_font_hint_style;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output->cairo_hint_style = CAIRO_HINT_STYLE_DEFAULT;
|
||||||
|
output->clutter_font_hint_style = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = g_settings_get_enum (xsettings, "antialiasing");
|
||||||
|
if (i < G_N_ELEMENTS (antialiasings))
|
||||||
|
{
|
||||||
|
output->cairo_antialias = antialiasings[i].cairo_antialias;
|
||||||
|
output->clutter_font_antialias = antialiasings[i].clutter_font_antialias;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output->cairo_antialias = CAIRO_ANTIALIAS_DEFAULT;
|
||||||
|
output->clutter_font_antialias = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
i = g_settings_get_enum (xsettings, "rgba-order");
|
||||||
|
if (i < G_N_ELEMENTS (rgba_orders))
|
||||||
|
{
|
||||||
|
output->cairo_subpixel_order = rgba_orders[i].cairo_subpixel_order;
|
||||||
|
output->clutter_font_subpixel_order = rgba_orders[i].clutter_font_subpixel_order;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
output->cairo_subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
|
||||||
|
output->clutter_font_subpixel_order = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (output->cairo_antialias == CAIRO_ANTIALIAS_GRAY)
|
||||||
|
output->clutter_font_subpixel_order = "none";
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
init_font_options (ClutterSettings *self)
|
||||||
|
{
|
||||||
|
GSettings *xsettings = self->xsettings;
|
||||||
|
cairo_font_options_t *options = cairo_font_options_create ();
|
||||||
|
FontSettings fs;
|
||||||
|
|
||||||
|
get_font_gsettings (xsettings, &fs);
|
||||||
|
|
||||||
|
cairo_font_options_set_hint_style (options, fs.cairo_hint_style);
|
||||||
|
cairo_font_options_set_antialias (options, fs.cairo_antialias);
|
||||||
|
cairo_font_options_set_subpixel_order (options, fs.cairo_subpixel_order);
|
||||||
|
|
||||||
|
clutter_backend_set_font_options (self->backend, options);
|
||||||
|
|
||||||
|
cairo_font_options_destroy (options);
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
on_xsettings_change_event (GSettings *xsettings,
|
||||||
|
gpointer keys,
|
||||||
|
gint n_keys,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
ClutterSettings *self = CLUTTER_SETTINGS (user_data);
|
||||||
|
FontSettings fs;
|
||||||
|
gint hinting;
|
||||||
|
|
||||||
|
get_font_gsettings (xsettings, &fs);
|
||||||
|
hinting = fs.cairo_hint_style == CAIRO_HINT_STYLE_NONE ? 0 : 1;
|
||||||
|
g_object_set (self,
|
||||||
|
"font-hinting", hinting,
|
||||||
|
"font-hint-style", fs.clutter_font_hint_style,
|
||||||
|
"font-antialias", fs.clutter_font_antialias,
|
||||||
|
"font-subpixel-order", fs.clutter_font_subpixel_order,
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
load_initial_settings (ClutterSettings *self)
|
||||||
|
{
|
||||||
|
static const gchar xsettings_path[] =
|
||||||
|
"org.gnome.settings-daemon.plugins.xsettings";
|
||||||
|
GSettingsSchemaSource *source = g_settings_schema_source_get_default ();
|
||||||
|
GSettingsSchema *schema;
|
||||||
|
|
||||||
|
schema = g_settings_schema_source_lookup (source, xsettings_path, TRUE);
|
||||||
|
if (!schema)
|
||||||
|
{
|
||||||
|
g_warning ("Failed to find schema: %s", xsettings_path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self->xsettings = g_settings_new_full (schema, NULL, NULL);
|
||||||
|
if (self->xsettings)
|
||||||
|
{
|
||||||
|
init_font_options (self);
|
||||||
|
g_signal_connect (self->xsettings, "change-event",
|
||||||
|
G_CALLBACK (on_xsettings_change_event),
|
||||||
|
self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_settings_finalize (GObject *gobject)
|
clutter_settings_finalize (GObject *gobject)
|
||||||
{
|
{
|
||||||
@@ -276,6 +442,8 @@ clutter_settings_finalize (GObject *gobject)
|
|||||||
g_free (self->xft_hint_style);
|
g_free (self->xft_hint_style);
|
||||||
g_free (self->xft_rgba);
|
g_free (self->xft_rgba);
|
||||||
|
|
||||||
|
g_clear_object (&self->xsettings);
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_settings_parent_class)->finalize (gobject);
|
G_OBJECT_CLASS (clutter_settings_parent_class)->finalize (gobject);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -740,6 +908,8 @@ _clutter_settings_set_backend (ClutterSettings *settings,
|
|||||||
g_assert (CLUTTER_IS_BACKEND (backend));
|
g_assert (CLUTTER_IS_BACKEND (backend));
|
||||||
|
|
||||||
settings->backend = backend;
|
settings->backend = backend;
|
||||||
|
|
||||||
|
load_initial_settings (settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SETTINGS_GROUP "Settings"
|
#define SETTINGS_GROUP "Settings"
|
||||||
|
|||||||
@@ -40,7 +40,14 @@ void clutter_stage_paint_view (ClutterStage
|
|||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip);
|
const cairo_region_t *redraw_clip);
|
||||||
|
|
||||||
void _clutter_stage_emit_after_paint (ClutterStage *stage);
|
void clutter_stage_emit_before_update (ClutterStage *stage,
|
||||||
|
ClutterStageView *view);
|
||||||
|
void clutter_stage_emit_before_paint (ClutterStage *stage,
|
||||||
|
ClutterStageView *view);
|
||||||
|
void clutter_stage_emit_after_paint (ClutterStage *stage,
|
||||||
|
ClutterStageView *view);
|
||||||
|
void clutter_stage_emit_after_update (ClutterStage *stage,
|
||||||
|
ClutterStageView *view);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void _clutter_stage_set_window (ClutterStage *stage,
|
void _clutter_stage_set_window (ClutterStage *stage,
|
||||||
@@ -50,11 +57,6 @@ ClutterStageWindow *_clutter_stage_get_window (ClutterStage
|
|||||||
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
|
void _clutter_stage_get_projection_matrix (ClutterStage *stage,
|
||||||
CoglMatrix *projection);
|
CoglMatrix *projection);
|
||||||
void _clutter_stage_dirty_projection (ClutterStage *stage);
|
void _clutter_stage_dirty_projection (ClutterStage *stage);
|
||||||
void _clutter_stage_set_viewport (ClutterStage *stage,
|
|
||||||
float x,
|
|
||||||
float y,
|
|
||||||
float width,
|
|
||||||
float height);
|
|
||||||
void _clutter_stage_get_viewport (ClutterStage *stage,
|
void _clutter_stage_get_viewport (ClutterStage *stage,
|
||||||
float *x,
|
float *x,
|
||||||
float *y,
|
float *y,
|
||||||
@@ -63,9 +65,12 @@ void _clutter_stage_get_viewport (ClutterStage
|
|||||||
void _clutter_stage_dirty_viewport (ClutterStage *stage);
|
void _clutter_stage_dirty_viewport (ClutterStage *stage);
|
||||||
void _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
void _clutter_stage_maybe_setup_viewport (ClutterStage *stage,
|
||||||
ClutterStageView *view);
|
ClutterStageView *view);
|
||||||
void _clutter_stage_maybe_relayout (ClutterActor *stage);
|
void clutter_stage_maybe_relayout (ClutterActor *stage);
|
||||||
gboolean _clutter_stage_needs_update (ClutterStage *stage);
|
void clutter_stage_maybe_finish_queue_redraws (ClutterStage *stage);
|
||||||
gboolean _clutter_stage_do_update (ClutterStage *stage);
|
GSList * clutter_stage_find_updated_devices (ClutterStage *stage);
|
||||||
|
void clutter_stage_update_devices (ClutterStage *stage,
|
||||||
|
GSList *devices);
|
||||||
|
void clutter_stage_update_actor_stage_views (ClutterStage *stage);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void _clutter_stage_queue_event (ClutterStage *stage,
|
void _clutter_stage_queue_event (ClutterStage *stage,
|
||||||
@@ -74,9 +79,6 @@ void _clutter_stage_queue_event (ClutterStage *stage,
|
|||||||
gboolean _clutter_stage_has_queued_events (ClutterStage *stage);
|
gboolean _clutter_stage_has_queued_events (ClutterStage *stage);
|
||||||
void _clutter_stage_process_queued_events (ClutterStage *stage);
|
void _clutter_stage_process_queued_events (ClutterStage *stage);
|
||||||
void _clutter_stage_update_input_devices (ClutterStage *stage);
|
void _clutter_stage_update_input_devices (ClutterStage *stage);
|
||||||
void _clutter_stage_schedule_update (ClutterStage *stage);
|
|
||||||
gint64 _clutter_stage_get_update_time (ClutterStage *stage);
|
|
||||||
void _clutter_stage_clear_update_time (ClutterStage *stage);
|
|
||||||
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
|
gboolean _clutter_stage_has_full_redraw_queued (ClutterStage *stage);
|
||||||
|
|
||||||
void clutter_stage_log_pick (ClutterStage *stage,
|
void clutter_stage_log_pick (ClutterStage *stage,
|
||||||
@@ -131,19 +133,22 @@ gboolean _clutter_stage_update_state (ClutterStage *stag
|
|||||||
|
|
||||||
void _clutter_stage_set_scale_factor (ClutterStage *stage,
|
void _clutter_stage_set_scale_factor (ClutterStage *stage,
|
||||||
int factor);
|
int factor);
|
||||||
gboolean _clutter_stage_get_max_view_scale_factor_for_rect (ClutterStage *stage,
|
|
||||||
graphene_rect_t *rect,
|
|
||||||
float *view_scale);
|
|
||||||
|
|
||||||
void _clutter_stage_presented (ClutterStage *stage,
|
void clutter_stage_presented (ClutterStage *stage,
|
||||||
CoglFrameEvent frame_event,
|
ClutterStageView *view,
|
||||||
ClutterFrameInfo *frame_info);
|
ClutterFrameInfo *frame_info);
|
||||||
|
|
||||||
GList * _clutter_stage_peek_stage_views (ClutterStage *stage);
|
|
||||||
|
|
||||||
void clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
void clutter_stage_queue_actor_relayout (ClutterStage *stage,
|
||||||
ClutterActor *actor);
|
ClutterActor *actor);
|
||||||
|
|
||||||
|
void clutter_stage_dequeue_actor_relayout (ClutterStage *stage,
|
||||||
|
ClutterActor *actor);
|
||||||
|
|
||||||
|
GList * clutter_stage_get_views_for_rect (ClutterStage *stage,
|
||||||
|
const graphene_rect_t *rect);
|
||||||
|
|
||||||
|
void clutter_stage_set_actor_needs_immediate_relayout (ClutterStage *stage);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|
#endif /* __CLUTTER_STAGE_PRIVATE_H__ */
|
||||||
|
|||||||
@@ -19,18 +19,30 @@
|
|||||||
#define __CLUTTER_STAGE_VIEW_PRIVATE_H__
|
#define __CLUTTER_STAGE_VIEW_PRIVATE_H__
|
||||||
|
|
||||||
#include "clutter/clutter-stage-view.h"
|
#include "clutter/clutter-stage-view.h"
|
||||||
|
#include "clutter/clutter-types.h"
|
||||||
|
|
||||||
void clutter_stage_view_after_paint (ClutterStageView *view);
|
void clutter_stage_view_after_paint (ClutterStageView *view,
|
||||||
|
cairo_region_t *redraw_clip);
|
||||||
|
|
||||||
|
void clutter_stage_view_before_swap_buffer (ClutterStageView *view,
|
||||||
|
const cairo_region_t *swap_region);
|
||||||
|
|
||||||
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
gboolean clutter_stage_view_is_dirty_viewport (ClutterStageView *view);
|
||||||
|
|
||||||
void clutter_stage_view_set_dirty_viewport (ClutterStageView *view,
|
void clutter_stage_view_invalidate_viewport (ClutterStageView *view);
|
||||||
gboolean dirty);
|
|
||||||
|
void clutter_stage_view_set_viewport (ClutterStageView *view,
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float width,
|
||||||
|
float height);
|
||||||
|
|
||||||
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
gboolean clutter_stage_view_is_dirty_projection (ClutterStageView *view);
|
||||||
|
|
||||||
void clutter_stage_view_set_dirty_projection (ClutterStageView *view,
|
void clutter_stage_view_invalidate_projection (ClutterStageView *view);
|
||||||
gboolean dirty);
|
|
||||||
|
void clutter_stage_view_set_projection (ClutterStageView *view,
|
||||||
|
const CoglMatrix *matrix);
|
||||||
|
|
||||||
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
void clutter_stage_view_add_redraw_clip (ClutterStageView *view,
|
||||||
const cairo_rectangle_int_t *clip);
|
const cairo_rectangle_int_t *clip);
|
||||||
@@ -43,4 +55,20 @@ const cairo_region_t * clutter_stage_view_peek_redraw_clip (ClutterStageView *vi
|
|||||||
|
|
||||||
cairo_region_t * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
|
cairo_region_t * clutter_stage_view_take_redraw_clip (ClutterStageView *view);
|
||||||
|
|
||||||
|
CoglScanout * clutter_stage_view_take_scanout (ClutterStageView *view);
|
||||||
|
|
||||||
|
void clutter_stage_view_transform_rect_to_onscreen (ClutterStageView *view,
|
||||||
|
const cairo_rectangle_int_t *src_rect,
|
||||||
|
int dst_width,
|
||||||
|
int dst_height,
|
||||||
|
cairo_rectangle_int_t *dst_rect);
|
||||||
|
|
||||||
|
void clutter_stage_view_schedule_update (ClutterStageView *view);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
float clutter_stage_view_get_refresh_rate (ClutterStageView *view);
|
||||||
|
|
||||||
|
void clutter_stage_view_notify_presented (ClutterStageView *view,
|
||||||
|
ClutterFrameInfo *frame_info);
|
||||||
|
|
||||||
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
#endif /* __CLUTTER_STAGE_VIEW_PRIVATE_H__ */
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -27,6 +27,7 @@
|
|||||||
#include <cogl/cogl.h>
|
#include <cogl/cogl.h>
|
||||||
|
|
||||||
#include "clutter-macros.h"
|
#include "clutter-macros.h"
|
||||||
|
#include "clutter-frame-clock.h"
|
||||||
|
|
||||||
#define CLUTTER_TYPE_STAGE_VIEW (clutter_stage_view_get_type ())
|
#define CLUTTER_TYPE_STAGE_VIEW (clutter_stage_view_get_type ())
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
@@ -43,8 +44,17 @@ struct _ClutterStageViewClass
|
|||||||
|
|
||||||
void (* get_offscreen_transformation_matrix) (ClutterStageView *view,
|
void (* get_offscreen_transformation_matrix) (ClutterStageView *view,
|
||||||
CoglMatrix *matrix);
|
CoglMatrix *matrix);
|
||||||
|
|
||||||
|
void (* transform_rect_to_onscreen) (ClutterStageView *view,
|
||||||
|
const cairo_rectangle_int_t *src_rect,
|
||||||
|
int dst_width,
|
||||||
|
int dst_height,
|
||||||
|
cairo_rectangle_int_t *dst_rect);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_stage_view_destroy (ClutterStageView *view);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_view_get_layout (ClutterStageView *view,
|
void clutter_stage_view_get_layout (ClutterStageView *view,
|
||||||
cairo_rectangle_int_t *rect);
|
cairo_rectangle_int_t *rect);
|
||||||
@@ -56,11 +66,6 @@ CoglFramebuffer *clutter_stage_view_get_onscreen (ClutterStageView *view);
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view);
|
void clutter_stage_view_invalidate_offscreen_blit_pipeline (ClutterStageView *view);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_stage_view_transform_to_onscreen (ClutterStageView *view,
|
|
||||||
gfloat *x,
|
|
||||||
gfloat *y);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
float clutter_stage_view_get_scale (ClutterStageView *view);
|
float clutter_stage_view_get_scale (ClutterStageView *view);
|
||||||
|
|
||||||
@@ -68,4 +73,7 @@ CLUTTER_EXPORT
|
|||||||
void clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
|
void clutter_stage_view_get_offscreen_transformation_matrix (ClutterStageView *view,
|
||||||
CoglMatrix *matrix);
|
CoglMatrix *matrix);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterFrameClock * clutter_stage_view_get_frame_clock (ClutterStageView *view);
|
||||||
|
|
||||||
#endif /* __CLUTTER_STAGE_VIEW_H__ */
|
#endif /* __CLUTTER_STAGE_VIEW_H__ */
|
||||||
|
|||||||
@@ -62,16 +62,6 @@ _clutter_stage_window_set_title (ClutterStageWindow *window,
|
|||||||
iface->set_title (window, title);
|
iface->set_title (window, title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_stage_window_set_cursor_visible (ClutterStageWindow *window,
|
|
||||||
gboolean is_visible)
|
|
||||||
{
|
|
||||||
ClutterStageWindowInterface *iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
|
||||||
|
|
||||||
if (iface->set_cursor_visible)
|
|
||||||
iface->set_cursor_visible (window, is_visible);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
_clutter_stage_window_realize (ClutterStageWindow *window)
|
_clutter_stage_window_realize (ClutterStageWindow *window)
|
||||||
{
|
{
|
||||||
@@ -113,94 +103,12 @@ _clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_clutter_stage_window_schedule_update (ClutterStageWindow *window,
|
_clutter_stage_window_redraw_view (ClutterStageWindow *window,
|
||||||
int sync_delay)
|
ClutterStageView *view)
|
||||||
{
|
{
|
||||||
ClutterStageWindowInterface *iface;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
||||||
|
|
||||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
CLUTTER_STAGE_WINDOW_GET_IFACE (window)->redraw_view (window, view);
|
||||||
if (iface->schedule_update == NULL)
|
|
||||||
{
|
|
||||||
g_assert (!clutter_feature_available (CLUTTER_FEATURE_SWAP_EVENTS));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
iface->schedule_update (window, sync_delay);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* _clutter_stage_window_get_update_time:
|
|
||||||
* @window: a #ClutterStageWindow object
|
|
||||||
*
|
|
||||||
* See _clutter_stage_get_update_time() for more info.
|
|
||||||
*
|
|
||||||
* Returns: The timestamp of the update time
|
|
||||||
*/
|
|
||||||
gint64
|
|
||||||
_clutter_stage_window_get_update_time (ClutterStageWindow *window)
|
|
||||||
{
|
|
||||||
ClutterStageWindowInterface *iface;
|
|
||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_STAGE_WINDOW (window), 0);
|
|
||||||
|
|
||||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
|
||||||
if (iface->get_update_time == NULL)
|
|
||||||
{
|
|
||||||
g_assert (!clutter_feature_available (CLUTTER_FEATURE_SWAP_EVENTS));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return iface->get_update_time (window);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* _clutter_stage_window_clear_update_time:
|
|
||||||
* @window: a #ClutterStageWindow object
|
|
||||||
*
|
|
||||||
* Clears the update time. See _clutter_stage_clear_update_time() for more info.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
_clutter_stage_window_clear_update_time (ClutterStageWindow *window)
|
|
||||||
{
|
|
||||||
ClutterStageWindowInterface *iface;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
|
||||||
|
|
||||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
|
||||||
if (iface->clear_update_time == NULL)
|
|
||||||
{
|
|
||||||
g_assert (!clutter_feature_available (CLUTTER_FEATURE_SWAP_EVENTS));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
iface->clear_update_time (window);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
|
||||||
gboolean accept_focus)
|
|
||||||
{
|
|
||||||
ClutterStageWindowInterface *iface;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
|
||||||
|
|
||||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
|
||||||
if (iface->set_accept_focus)
|
|
||||||
iface->set_accept_focus (window, accept_focus);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
_clutter_stage_window_redraw (ClutterStageWindow *window)
|
|
||||||
{
|
|
||||||
ClutterStageWindowInterface *iface;
|
|
||||||
|
|
||||||
g_return_if_fail (CLUTTER_IS_STAGE_WINDOW (window));
|
|
||||||
|
|
||||||
iface = CLUTTER_STAGE_WINDOW_GET_IFACE (window);
|
|
||||||
if (iface->redraw)
|
|
||||||
iface->redraw (window);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
|||||||
@@ -30,8 +30,6 @@ struct _ClutterStageWindowInterface
|
|||||||
|
|
||||||
void (* set_title) (ClutterStageWindow *stage_window,
|
void (* set_title) (ClutterStageWindow *stage_window,
|
||||||
const gchar *title);
|
const gchar *title);
|
||||||
void (* set_cursor_visible) (ClutterStageWindow *stage_window,
|
|
||||||
gboolean cursor_visible);
|
|
||||||
|
|
||||||
gboolean (* realize) (ClutterStageWindow *stage_window);
|
gboolean (* realize) (ClutterStageWindow *stage_window);
|
||||||
void (* unrealize) (ClutterStageWindow *stage_window);
|
void (* unrealize) (ClutterStageWindow *stage_window);
|
||||||
@@ -46,15 +44,8 @@ struct _ClutterStageWindowInterface
|
|||||||
void (* get_geometry) (ClutterStageWindow *stage_window,
|
void (* get_geometry) (ClutterStageWindow *stage_window,
|
||||||
cairo_rectangle_int_t *geometry);
|
cairo_rectangle_int_t *geometry);
|
||||||
|
|
||||||
void (* schedule_update) (ClutterStageWindow *stage_window,
|
void (* redraw_view) (ClutterStageWindow *stage_window,
|
||||||
int sync_delay);
|
ClutterStageView *view);
|
||||||
gint64 (* get_update_time) (ClutterStageWindow *stage_window);
|
|
||||||
void (* clear_update_time) (ClutterStageWindow *stage_window);
|
|
||||||
|
|
||||||
void (* set_accept_focus) (ClutterStageWindow *stage_window,
|
|
||||||
gboolean accept_focus);
|
|
||||||
|
|
||||||
void (* redraw) (ClutterStageWindow *stage_window);
|
|
||||||
|
|
||||||
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
|
gboolean (* can_clip_redraws) (ClutterStageWindow *stage_window);
|
||||||
|
|
||||||
@@ -83,15 +74,12 @@ void _clutter_stage_window_resize (ClutterStageWin
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
void _clutter_stage_window_get_geometry (ClutterStageWindow *window,
|
||||||
cairo_rectangle_int_t *geometry);
|
cairo_rectangle_int_t *geometry);
|
||||||
void _clutter_stage_window_schedule_update (ClutterStageWindow *window,
|
|
||||||
int sync_delay);
|
|
||||||
gint64 _clutter_stage_window_get_update_time (ClutterStageWindow *window);
|
|
||||||
void _clutter_stage_window_clear_update_time (ClutterStageWindow *window);
|
|
||||||
|
|
||||||
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
void _clutter_stage_window_set_accept_focus (ClutterStageWindow *window,
|
||||||
gboolean accept_focus);
|
gboolean accept_focus);
|
||||||
|
|
||||||
void _clutter_stage_window_redraw (ClutterStageWindow *window);
|
void _clutter_stage_window_redraw_view (ClutterStageWindow *window,
|
||||||
|
ClutterStageView *view);
|
||||||
|
|
||||||
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
|
gboolean _clutter_stage_window_can_clip_redraws (ClutterStageWindow *window);
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -28,8 +28,8 @@
|
|||||||
#error "Only <clutter/clutter.h> can be included directly."
|
#error "Only <clutter/clutter.h> can be included directly."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <clutter/clutter-actor.h>
|
||||||
#include <clutter/clutter-types.h>
|
#include <clutter/clutter-types.h>
|
||||||
#include <clutter/clutter-group.h>
|
|
||||||
#include <clutter/clutter-stage-view.h>
|
#include <clutter/clutter-stage-view.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
@@ -56,7 +56,7 @@ typedef struct _ClutterStagePrivate ClutterStagePrivate;
|
|||||||
struct _ClutterStage
|
struct _ClutterStage
|
||||||
{
|
{
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
ClutterGroup parent_instance;
|
ClutterActor parent_instance;
|
||||||
|
|
||||||
ClutterStagePrivate *priv;
|
ClutterStagePrivate *priv;
|
||||||
};
|
};
|
||||||
@@ -64,7 +64,6 @@ struct _ClutterStage
|
|||||||
* ClutterStageClass:
|
* ClutterStageClass:
|
||||||
* @activate: handler for the #ClutterStage::activate signal
|
* @activate: handler for the #ClutterStage::activate signal
|
||||||
* @deactivate: handler for the #ClutterStage::deactivate signal
|
* @deactivate: handler for the #ClutterStage::deactivate signal
|
||||||
* @delete_event: handler for the #ClutterStage::delete-event signal
|
|
||||||
*
|
*
|
||||||
* The #ClutterStageClass structure contains only private data
|
* The #ClutterStageClass structure contains only private data
|
||||||
*
|
*
|
||||||
@@ -74,23 +73,20 @@ struct _ClutterStage
|
|||||||
struct _ClutterStageClass
|
struct _ClutterStageClass
|
||||||
{
|
{
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
ClutterGroupClass parent_class;
|
ClutterActorClass parent_class;
|
||||||
|
|
||||||
/*< public >*/
|
/*< public >*/
|
||||||
/* signals */
|
/* signals */
|
||||||
void (* activate) (ClutterStage *stage);
|
void (* activate) (ClutterStage *stage);
|
||||||
void (* deactivate) (ClutterStage *stage);
|
void (* deactivate) (ClutterStage *stage);
|
||||||
|
|
||||||
gboolean (* delete_event) (ClutterStage *stage,
|
|
||||||
ClutterEvent *event);
|
|
||||||
|
|
||||||
void (* paint_view) (ClutterStage *stage,
|
void (* paint_view) (ClutterStage *stage,
|
||||||
ClutterStageView *view,
|
ClutterStageView *view,
|
||||||
const cairo_region_t *redraw_clip);
|
const cairo_region_t *redraw_clip);
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
/* padding for future expansion */
|
/* padding for future expansion */
|
||||||
gpointer _padding_dummy[30];
|
gpointer _padding_dummy[31];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,8 +99,7 @@ struct _ClutterStageClass
|
|||||||
* @z_far: the distance from the viewer to the far clipping
|
* @z_far: the distance from the viewer to the far clipping
|
||||||
* plane (always positive)
|
* plane (always positive)
|
||||||
*
|
*
|
||||||
* Stage perspective definition. #ClutterPerspective is only used by
|
* Stage perspective definition.
|
||||||
* the fixed point version of clutter_stage_set_perspective().
|
|
||||||
*
|
*
|
||||||
* Since: 0.4
|
* Since: 0.4
|
||||||
*/
|
*/
|
||||||
@@ -137,20 +132,10 @@ GType clutter_perspective_get_type (void) G_GNUC_CONST;
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
GType clutter_stage_get_type (void) G_GNUC_CONST;
|
GType clutter_stage_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
ClutterActor * clutter_stage_new (void);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_stage_set_perspective (ClutterStage *stage,
|
|
||||||
ClutterPerspective *perspective);
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_get_perspective (ClutterStage *stage,
|
void clutter_stage_get_perspective (ClutterStage *stage,
|
||||||
ClutterPerspective *perspective);
|
ClutterPerspective *perspective);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_show_cursor (ClutterStage *stage);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_stage_hide_cursor (ClutterStage *stage);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_stage_set_title (ClutterStage *stage,
|
void clutter_stage_set_title (ClutterStage *stage,
|
||||||
const gchar *title);
|
const gchar *title);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
@@ -186,11 +171,6 @@ void clutter_stage_set_motion_events_enabled (ClutterStage
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_stage_get_motion_events_enabled (ClutterStage *stage);
|
gboolean clutter_stage_get_motion_events_enabled (ClutterStage *stage);
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_set_accept_focus (ClutterStage *stage,
|
|
||||||
gboolean accept_focus);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
gboolean clutter_stage_get_accept_focus (ClutterStage *stage);
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
gboolean clutter_stage_event (ClutterStage *stage,
|
gboolean clutter_stage_event (ClutterStage *stage,
|
||||||
ClutterEvent *event);
|
ClutterEvent *event);
|
||||||
|
|
||||||
@@ -208,11 +188,10 @@ guchar * clutter_stage_read_pixels (ClutterStage
|
|||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
void clutter_stage_ensure_viewport (ClutterStage *stage);
|
void clutter_stage_ensure_viewport (ClutterStage *stage);
|
||||||
CLUTTER_EXPORT
|
|
||||||
void clutter_stage_ensure_redraw (ClutterStage *stage);
|
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_stage_is_redraw_queued (ClutterStage *stage);
|
gboolean clutter_stage_is_redraw_queued_on_view (ClutterStage *stage,
|
||||||
|
ClutterStageView *view);
|
||||||
|
|
||||||
#ifdef CLUTTER_ENABLE_EXPERIMENTAL_API
|
#ifdef CLUTTER_ENABLE_EXPERIMENTAL_API
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
@@ -222,6 +201,9 @@ CLUTTER_EXPORT
|
|||||||
void clutter_stage_skip_sync_delay (ClutterStage *stage);
|
void clutter_stage_skip_sync_delay (ClutterStage *stage);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_stage_schedule_update (ClutterStage *stage);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
|
gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
|
||||||
cairo_rectangle_int_t *rect,
|
cairo_rectangle_int_t *rect,
|
||||||
@@ -230,11 +212,22 @@ gboolean clutter_stage_get_capture_final_size (ClutterStage *stage,
|
|||||||
float *scale);
|
float *scale);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gboolean clutter_stage_capture (ClutterStage *stage,
|
void clutter_stage_paint_to_framebuffer (ClutterStage *stage,
|
||||||
gboolean paint,
|
CoglFramebuffer *framebuffer,
|
||||||
cairo_rectangle_int_t *rect,
|
const cairo_rectangle_int_t *rect,
|
||||||
ClutterCapture **out_captures,
|
float scale,
|
||||||
int *out_n_captures);
|
ClutterPaintFlag paint_flags);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
gboolean clutter_stage_paint_to_buffer (ClutterStage *stage,
|
||||||
|
const cairo_rectangle_int_t *rect,
|
||||||
|
float scale,
|
||||||
|
uint8_t *data,
|
||||||
|
int stride,
|
||||||
|
CoglPixelFormat format,
|
||||||
|
ClutterPaintFlag paint_flags,
|
||||||
|
GError **error);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
|
ClutterStageView * clutter_stage_get_view_at (ClutterStage *stage,
|
||||||
float x,
|
float x,
|
||||||
|
|||||||
@@ -187,9 +187,6 @@ struct _ClutterTextPrivate
|
|||||||
ClutterInputContentHintFlags input_hints;
|
ClutterInputContentHintFlags input_hints;
|
||||||
ClutterInputContentPurpose input_purpose;
|
ClutterInputContentPurpose input_purpose;
|
||||||
|
|
||||||
/* Signal handler for when the :resource-scale changes */
|
|
||||||
gulong resource_scale_changed_id;
|
|
||||||
|
|
||||||
/* bitfields */
|
/* bitfields */
|
||||||
guint alignment : 2;
|
guint alignment : 2;
|
||||||
guint wrap : 1;
|
guint wrap : 1;
|
||||||
@@ -598,9 +595,7 @@ ensure_effective_pango_scale_attribute (ClutterText *self)
|
|||||||
float resource_scale;
|
float resource_scale;
|
||||||
ClutterTextPrivate *priv = self->priv;
|
ClutterTextPrivate *priv = self->priv;
|
||||||
|
|
||||||
if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (self), &resource_scale) ||
|
resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
|
||||||
resource_scale == 1.0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (priv->effective_attrs != NULL)
|
if (priv->effective_attrs != NULL)
|
||||||
{
|
{
|
||||||
@@ -922,18 +917,6 @@ clutter_text_direction_changed_cb (GObject *gobject,
|
|||||||
/* no need to queue a relayout: set_text_direction() will do that for us */
|
/* no need to queue a relayout: set_text_direction() will do that for us */
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
clutter_text_resource_scale_changed_cb (GObject *gobject,
|
|
||||||
GParamSpec *pspec)
|
|
||||||
{
|
|
||||||
ClutterText *self = CLUTTER_TEXT (gobject);
|
|
||||||
ClutterTextPrivate *priv = self->priv;
|
|
||||||
|
|
||||||
g_clear_pointer (&priv->effective_attrs, pango_attr_list_unref);
|
|
||||||
clutter_text_dirty_cache (self);
|
|
||||||
clutter_actor_queue_relayout (CLUTTER_ACTOR (gobject));
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* clutter_text_create_layout:
|
* clutter_text_create_layout:
|
||||||
* @text: a #ClutterText
|
* @text: a #ClutterText
|
||||||
@@ -1137,8 +1120,7 @@ maybe_create_text_layout_with_resource_scale (ClutterText *text,
|
|||||||
{
|
{
|
||||||
float resource_scale;
|
float resource_scale;
|
||||||
|
|
||||||
if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (text), &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (text));
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return create_text_layout_with_scale (text,
|
return create_text_layout_with_scale (text,
|
||||||
allocation_width,
|
allocation_width,
|
||||||
@@ -1170,8 +1152,7 @@ clutter_text_coords_to_position (ClutterText *self,
|
|||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
|
g_return_val_if_fail (CLUTTER_IS_TEXT (self), 0);
|
||||||
|
|
||||||
if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (self), &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Take any offset due to scrolling into account, and normalize
|
/* Take any offset due to scrolling into account, and normalize
|
||||||
* the coordinates to PangoScale units
|
* the coordinates to PangoScale units
|
||||||
@@ -1299,8 +1280,7 @@ clutter_text_position_to_coords (ClutterText *self,
|
|||||||
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
|
g_return_val_if_fail (CLUTTER_IS_TEXT (self), FALSE);
|
||||||
|
|
||||||
if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (self), &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
ret = clutter_text_position_to_coords_internal (self, position,
|
ret = clutter_text_position_to_coords_internal (self, position,
|
||||||
x, y, line_height);
|
x, y, line_height);
|
||||||
@@ -1776,7 +1756,6 @@ clutter_text_dispose (GObject *gobject)
|
|||||||
clutter_text_dirty_cache (self);
|
clutter_text_dirty_cache (self);
|
||||||
|
|
||||||
g_clear_signal_handler (&priv->direction_changed_id, self);
|
g_clear_signal_handler (&priv->direction_changed_id, self);
|
||||||
g_clear_signal_handler (&priv->resource_scale_changed_id, self);
|
|
||||||
g_clear_signal_handler (&priv->settings_changed_id,
|
g_clear_signal_handler (&priv->settings_changed_id,
|
||||||
clutter_get_default_backend ());
|
clutter_get_default_backend ());
|
||||||
|
|
||||||
@@ -1907,14 +1886,6 @@ clutter_text_foreach_selection_rectangle (ClutterText *self,
|
|||||||
g_free (utf8);
|
g_free (utf8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
add_selection_rectangle_to_path (ClutterText *text,
|
|
||||||
const ClutterActorBox *box,
|
|
||||||
gpointer user_data)
|
|
||||||
{
|
|
||||||
cogl_path_rectangle (user_data, box->x1, box->y1, box->x2, box->y2);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_text_foreach_selection_rectangle_prescaled (ClutterText *self,
|
clutter_text_foreach_selection_rectangle_prescaled (ClutterText *self,
|
||||||
ClutterTextSelectionFunc func,
|
ClutterTextSelectionFunc func,
|
||||||
@@ -1923,6 +1894,60 @@ clutter_text_foreach_selection_rectangle_prescaled (ClutterText *se
|
|||||||
clutter_text_foreach_selection_rectangle (self, 1.0f, func, user_data);
|
clutter_text_foreach_selection_rectangle (self, 1.0f, func, user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
paint_selection_rectangle (ClutterText *self,
|
||||||
|
const ClutterActorBox *box,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
CoglFramebuffer *fb = user_data;
|
||||||
|
ClutterTextPrivate *priv = self->priv;
|
||||||
|
ClutterActor *actor = CLUTTER_ACTOR (self);
|
||||||
|
guint8 paint_opacity = clutter_actor_get_paint_opacity (actor);
|
||||||
|
CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
|
||||||
|
PangoLayout *layout = clutter_text_get_layout (self);
|
||||||
|
CoglColor cogl_color = { 0, };
|
||||||
|
const ClutterColor *color;
|
||||||
|
|
||||||
|
/* Paint selection background */
|
||||||
|
if (priv->selection_color_set)
|
||||||
|
color = &priv->selection_color;
|
||||||
|
else if (priv->cursor_color_set)
|
||||||
|
color = &priv->cursor_color;
|
||||||
|
else
|
||||||
|
color = &priv->text_color;
|
||||||
|
|
||||||
|
cogl_color_init_from_4ub (&cogl_color,
|
||||||
|
color->red,
|
||||||
|
color->green,
|
||||||
|
color->blue,
|
||||||
|
paint_opacity * color->alpha / 255);
|
||||||
|
cogl_color_premultiply (&cogl_color);
|
||||||
|
cogl_pipeline_set_color (color_pipeline, &cogl_color);
|
||||||
|
|
||||||
|
cogl_framebuffer_push_rectangle_clip (fb,
|
||||||
|
box->x1, box->y1,
|
||||||
|
box->x2, box->y2);
|
||||||
|
cogl_framebuffer_draw_rectangle (fb, color_pipeline,
|
||||||
|
box->x1, box->y1,
|
||||||
|
box->x2, box->y2);
|
||||||
|
|
||||||
|
if (priv->selected_text_color_set)
|
||||||
|
color = &priv->selected_text_color;
|
||||||
|
else
|
||||||
|
color = &priv->text_color;
|
||||||
|
|
||||||
|
cogl_color_init_from_4ub (&cogl_color,
|
||||||
|
color->red,
|
||||||
|
color->green,
|
||||||
|
color->blue,
|
||||||
|
paint_opacity * color->alpha / 255);
|
||||||
|
|
||||||
|
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
|
||||||
|
|
||||||
|
cogl_framebuffer_pop_clip (fb);
|
||||||
|
cogl_object_unref (color_pipeline);
|
||||||
|
}
|
||||||
|
|
||||||
/* Draws the selected text, its background, and the cursor */
|
/* Draws the selected text, its background, and the cursor */
|
||||||
static void
|
static void
|
||||||
selection_paint (ClutterText *self,
|
selection_paint (ClutterText *self,
|
||||||
@@ -1965,52 +1990,9 @@ selection_paint (ClutterText *self,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Paint selection background first */
|
|
||||||
CoglPipeline *color_pipeline = cogl_pipeline_copy (default_color_pipeline);
|
|
||||||
PangoLayout *layout = clutter_text_get_layout (self);
|
|
||||||
CoglPath *selection_path = cogl_path_new ();
|
|
||||||
CoglColor cogl_color = { 0, };
|
|
||||||
|
|
||||||
/* Paint selection background */
|
|
||||||
if (priv->selection_color_set)
|
|
||||||
color = &priv->selection_color;
|
|
||||||
else if (priv->cursor_color_set)
|
|
||||||
color = &priv->cursor_color;
|
|
||||||
else
|
|
||||||
color = &priv->text_color;
|
|
||||||
|
|
||||||
cogl_color_init_from_4ub (&cogl_color,
|
|
||||||
color->red,
|
|
||||||
color->green,
|
|
||||||
color->blue,
|
|
||||||
paint_opacity * color->alpha / 255);
|
|
||||||
cogl_color_premultiply (&cogl_color);
|
|
||||||
cogl_pipeline_set_color (color_pipeline, &cogl_color);
|
|
||||||
|
|
||||||
clutter_text_foreach_selection_rectangle_prescaled (self,
|
clutter_text_foreach_selection_rectangle_prescaled (self,
|
||||||
add_selection_rectangle_to_path,
|
paint_selection_rectangle,
|
||||||
selection_path);
|
fb);
|
||||||
|
|
||||||
cogl_framebuffer_fill_path (fb, color_pipeline, selection_path);
|
|
||||||
|
|
||||||
/* Paint selected text */
|
|
||||||
cogl_framebuffer_push_path_clip (fb, selection_path);
|
|
||||||
cogl_object_unref (selection_path);
|
|
||||||
|
|
||||||
if (priv->selected_text_color_set)
|
|
||||||
color = &priv->selected_text_color;
|
|
||||||
else
|
|
||||||
color = &priv->text_color;
|
|
||||||
|
|
||||||
cogl_color_init_from_4ub (&cogl_color,
|
|
||||||
color->red,
|
|
||||||
color->green,
|
|
||||||
color->blue,
|
|
||||||
paint_opacity * color->alpha / 255);
|
|
||||||
|
|
||||||
cogl_pango_show_layout (fb, layout, priv->text_x, 0, &cogl_color);
|
|
||||||
|
|
||||||
cogl_framebuffer_pop_clip (fb);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2638,8 +2620,7 @@ clutter_text_paint (ClutterActor *self,
|
|||||||
!clutter_text_should_draw_cursor (text))
|
!clutter_text_should_draw_cursor (text))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!clutter_actor_get_resource_scale (CLUTTER_ACTOR (self), &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (CLUTTER_ACTOR (self));
|
||||||
return;
|
|
||||||
|
|
||||||
clutter_actor_box_scale (&alloc, resource_scale);
|
clutter_actor_box_scale (&alloc, resource_scale);
|
||||||
clutter_actor_box_get_size (&alloc, &alloc_width, &alloc_height);
|
clutter_actor_box_get_size (&alloc, &alloc_width, &alloc_height);
|
||||||
@@ -2871,8 +2852,7 @@ clutter_text_get_paint_volume (ClutterActor *self,
|
|||||||
if (!clutter_actor_has_allocation (self))
|
if (!clutter_actor_has_allocation (self))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!clutter_actor_get_resource_scale (self, &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (self);
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
_clutter_paint_volume_init_static (&priv->paint_volume, self);
|
_clutter_paint_volume_init_static (&priv->paint_volume, self);
|
||||||
|
|
||||||
@@ -2929,8 +2909,7 @@ clutter_text_get_preferred_width (ClutterActor *self,
|
|||||||
gfloat layout_width;
|
gfloat layout_width;
|
||||||
gfloat resource_scale;
|
gfloat resource_scale;
|
||||||
|
|
||||||
if (!clutter_actor_get_resource_scale (self, &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (self);
|
||||||
resource_scale = 1;
|
|
||||||
|
|
||||||
layout = clutter_text_create_layout (text, -1, -1);
|
layout = clutter_text_create_layout (text, -1, -1);
|
||||||
pango_layout_get_extents (layout, NULL, &logical_rect);
|
pango_layout_get_extents (layout, NULL, &logical_rect);
|
||||||
@@ -2986,8 +2965,7 @@ clutter_text_get_preferred_height (ClutterActor *self,
|
|||||||
gfloat layout_height;
|
gfloat layout_height;
|
||||||
gfloat resource_scale;
|
gfloat resource_scale;
|
||||||
|
|
||||||
if (!clutter_actor_get_resource_scale (self, &resource_scale))
|
resource_scale = clutter_actor_get_resource_scale (self);
|
||||||
resource_scale = 1;
|
|
||||||
|
|
||||||
if (priv->single_line_mode)
|
if (priv->single_line_mode)
|
||||||
for_width = -1;
|
for_width = -1;
|
||||||
@@ -3034,8 +3012,7 @@ clutter_text_get_preferred_height (ClutterActor *self,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_text_allocate (ClutterActor *self,
|
clutter_text_allocate (ClutterActor *self,
|
||||||
const ClutterActorBox *box,
|
const ClutterActorBox *box)
|
||||||
ClutterAllocationFlags flags)
|
|
||||||
{
|
{
|
||||||
ClutterText *text = CLUTTER_TEXT (self);
|
ClutterText *text = CLUTTER_TEXT (self);
|
||||||
ClutterActorClass *parent_class;
|
ClutterActorClass *parent_class;
|
||||||
@@ -3055,7 +3032,7 @@ clutter_text_allocate (ClutterActor *self,
|
|||||||
box->y2 - box->y1);
|
box->y2 - box->y1);
|
||||||
|
|
||||||
parent_class = CLUTTER_ACTOR_CLASS (clutter_text_parent_class);
|
parent_class = CLUTTER_ACTOR_CLASS (clutter_text_parent_class);
|
||||||
parent_class->allocate (self, box, flags);
|
parent_class->allocate (self, box);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -3064,6 +3041,33 @@ clutter_text_has_overlaps (ClutterActor *self)
|
|||||||
return clutter_text_should_draw_cursor ((ClutterText *) self);
|
return clutter_text_should_draw_cursor ((ClutterText *) self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static float
|
||||||
|
clutter_text_calculate_resource_scale (ClutterActor *actor,
|
||||||
|
int phase)
|
||||||
|
{
|
||||||
|
ClutterActorClass *parent_class = CLUTTER_ACTOR_CLASS (clutter_text_parent_class);
|
||||||
|
float new_resource_scale;
|
||||||
|
|
||||||
|
new_resource_scale = parent_class->calculate_resource_scale (actor, phase);
|
||||||
|
|
||||||
|
if (phase == 1)
|
||||||
|
return MAX (new_resource_scale, clutter_actor_get_real_resource_scale (actor));
|
||||||
|
|
||||||
|
return new_resource_scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_text_resource_scale_changed (ClutterActor *actor)
|
||||||
|
{
|
||||||
|
ClutterText *text = CLUTTER_TEXT (actor);
|
||||||
|
ClutterTextPrivate *priv = text->priv;
|
||||||
|
|
||||||
|
g_clear_pointer (&priv->effective_attrs, pango_attr_list_unref);
|
||||||
|
clutter_text_dirty_cache (text);
|
||||||
|
|
||||||
|
clutter_actor_queue_immediate_relayout (actor);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_text_im_focus (ClutterText *text)
|
clutter_text_im_focus (ClutterText *text)
|
||||||
{
|
{
|
||||||
@@ -3812,6 +3816,8 @@ clutter_text_class_init (ClutterTextClass *klass)
|
|||||||
actor_class->key_focus_in = clutter_text_key_focus_in;
|
actor_class->key_focus_in = clutter_text_key_focus_in;
|
||||||
actor_class->key_focus_out = clutter_text_key_focus_out;
|
actor_class->key_focus_out = clutter_text_key_focus_out;
|
||||||
actor_class->has_overlaps = clutter_text_has_overlaps;
|
actor_class->has_overlaps = clutter_text_has_overlaps;
|
||||||
|
actor_class->calculate_resource_scale = clutter_text_calculate_resource_scale;
|
||||||
|
actor_class->resource_scale_changed = clutter_text_resource_scale_changed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterText:buffer:
|
* ClutterText:buffer:
|
||||||
@@ -4619,11 +4625,6 @@ clutter_text_init (ClutterText *self)
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
priv->input_focus = clutter_text_input_focus_new (self);
|
priv->input_focus = clutter_text_input_focus_new (self);
|
||||||
|
|
||||||
priv->resource_scale_changed_id =
|
|
||||||
g_signal_connect (self, "notify::resource-scale",
|
|
||||||
G_CALLBACK (clutter_text_resource_scale_changed_cb),
|
|
||||||
NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -4784,11 +4785,11 @@ clutter_text_queue_redraw_or_relayout (ClutterText *self)
|
|||||||
clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
|
clutter_text_get_preferred_height (actor, preferred_width, NULL, &preferred_height);
|
||||||
|
|
||||||
if (clutter_actor_has_allocation (actor) &&
|
if (clutter_actor_has_allocation (actor) &&
|
||||||
(fabsf (preferred_width - clutter_actor_get_width (actor)) > 0.001 ||
|
fabsf (preferred_width - clutter_actor_get_width (actor)) <= 0.001 &&
|
||||||
fabsf (preferred_height - clutter_actor_get_height (actor)) > 0.001))
|
fabsf (preferred_height - clutter_actor_get_height (actor)) <= 0.001)
|
||||||
clutter_actor_queue_relayout (actor);
|
|
||||||
else
|
|
||||||
clutter_text_queue_redraw (actor);
|
clutter_text_queue_redraw (actor);
|
||||||
|
else
|
||||||
|
clutter_actor_queue_relayout (actor);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -5325,7 +5326,7 @@ clutter_text_set_selection_bound (ClutterText *self,
|
|||||||
|
|
||||||
if (priv->selection_bound != selection_bound)
|
if (priv->selection_bound != selection_bound)
|
||||||
{
|
{
|
||||||
gint len = clutter_text_buffer_get_length (get_buffer (self));;
|
gint len = clutter_text_buffer_get_length (get_buffer (self));
|
||||||
|
|
||||||
if (selection_bound < 0 || selection_bound >= len)
|
if (selection_bound < 0 || selection_bound >= len)
|
||||||
priv->selection_bound = -1;
|
priv->selection_bound = -1;
|
||||||
|
|||||||
@@ -3,9 +3,9 @@
|
|||||||
*
|
*
|
||||||
* An OpenGL based 'interactive canvas' library.
|
* An OpenGL based 'interactive canvas' library.
|
||||||
*
|
*
|
||||||
* Authored By Matthew Allum <mallum@openedhand.com>
|
* Authored By: Emmanuele Bassi <ebassi@linux.intel.com>
|
||||||
*
|
*
|
||||||
* Copyright (C) 2006 OpenedHand
|
* Copyright (C) 2009 Intel Corporation.
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@@ -19,41 +19,15 @@
|
|||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Lesser General Public
|
* 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 along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
#ifndef CLUTTER_TIMELINE_PRIVATE_H
|
||||||
* SECTION:clutter-egl
|
#define CLUTTER_TIMELINE_PRIVATE_H
|
||||||
* @short_description: EGL specific API
|
|
||||||
*
|
|
||||||
* The EGL backend for Clutter provides some EGL specific API
|
|
||||||
*
|
|
||||||
* You need to include `clutter-egl.h` to have access to the functions documented here.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef __CLUTTER_EGL_H__
|
void _clutter_timeline_advance (ClutterTimeline *timeline,
|
||||||
#define __CLUTTER_EGL_H__
|
int64_t tick_time);
|
||||||
|
int64_t _clutter_timeline_get_delta (ClutterTimeline *timeline);
|
||||||
|
void _clutter_timeline_do_tick (ClutterTimeline *timeline,
|
||||||
|
int64_t tick_time);
|
||||||
|
|
||||||
#include <glib.h>
|
#endif /* CLUTTER_TIMELINE_PRIVATE_H */
|
||||||
|
|
||||||
#include "clutter-egl-headers.h"
|
|
||||||
#include <clutter/clutter.h>
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_egl_get_egl_display:
|
|
||||||
*
|
|
||||||
* Retrieves the #EGLDisplay used by Clutter.
|
|
||||||
*
|
|
||||||
* Return value: the EGL display
|
|
||||||
*
|
|
||||||
* Since: 1.6
|
|
||||||
*/
|
|
||||||
CLUTTER_EXPORT
|
|
||||||
EGLDisplay clutter_egl_get_egl_display (void);
|
|
||||||
|
|
||||||
G_END_DECLS
|
|
||||||
|
|
||||||
#endif /* __CLUTTER_EGL_H__ */
|
|
||||||
@@ -24,7 +24,6 @@
|
|||||||
/**
|
/**
|
||||||
* SECTION:clutter-timeline
|
* SECTION:clutter-timeline
|
||||||
* @short_description: A class for time-based events
|
* @short_description: A class for time-based events
|
||||||
* @see_also: #ClutterAnimation, #ClutterAnimator, #ClutterState
|
|
||||||
*
|
*
|
||||||
* #ClutterTimeline is a base class for managing time-based event that cause
|
* #ClutterTimeline is a base class for managing time-based event that cause
|
||||||
* Clutter to redraw a stage, such as animations.
|
* Clutter to redraw a stage, such as animations.
|
||||||
@@ -71,7 +70,7 @@
|
|||||||
* when reaching completion by using the #ClutterTimeline:auto-reverse property.
|
* when reaching completion by using the #ClutterTimeline:auto-reverse property.
|
||||||
*
|
*
|
||||||
* Timelines are used in the Clutter animation framework by classes like
|
* Timelines are used in the Clutter animation framework by classes like
|
||||||
* #ClutterAnimation, #ClutterAnimator, and #ClutterState.
|
* #ClutterTransition.
|
||||||
*
|
*
|
||||||
* ## Defining Timelines in ClutterScript
|
* ## Defining Timelines in ClutterScript
|
||||||
*
|
*
|
||||||
@@ -96,22 +95,34 @@
|
|||||||
#include "clutter-build-config.h"
|
#include "clutter-build-config.h"
|
||||||
|
|
||||||
#include "clutter-timeline.h"
|
#include "clutter-timeline.h"
|
||||||
|
#include "deprecated/clutter-timeline.h"
|
||||||
|
|
||||||
#include "clutter-debug.h"
|
#include "clutter-debug.h"
|
||||||
#include "clutter-easing.h"
|
#include "clutter-easing.h"
|
||||||
#include "clutter-enum-types.h"
|
#include "clutter-enum-types.h"
|
||||||
|
#include "clutter-frame-clock.h"
|
||||||
#include "clutter-main.h"
|
#include "clutter-main.h"
|
||||||
#include "clutter-marshal.h"
|
#include "clutter-marshal.h"
|
||||||
#include "clutter-master-clock.h"
|
#include "clutter-mutter.h"
|
||||||
#include "clutter-private.h"
|
#include "clutter-private.h"
|
||||||
#include "clutter-scriptable.h"
|
#include "clutter-scriptable.h"
|
||||||
|
#include "clutter-timeline-private.h"
|
||||||
#include "deprecated/clutter-timeline.h"
|
|
||||||
|
|
||||||
struct _ClutterTimelinePrivate
|
struct _ClutterTimelinePrivate
|
||||||
{
|
{
|
||||||
ClutterTimelineDirection direction;
|
ClutterTimelineDirection direction;
|
||||||
|
|
||||||
|
ClutterFrameClock *custom_frame_clock;
|
||||||
|
ClutterFrameClock *frame_clock;
|
||||||
|
ClutterActor *frame_clock_actor;
|
||||||
|
gulong frame_clock_actor_stage_views_handler_id;
|
||||||
|
|
||||||
|
ClutterActor *actor;
|
||||||
|
gulong actor_destroy_handler_id;
|
||||||
|
gulong actor_stage_views_handler_id;
|
||||||
|
gulong stage_stage_views_handler_id;
|
||||||
|
ClutterActor *stage;
|
||||||
|
|
||||||
guint delay_id;
|
guint delay_id;
|
||||||
|
|
||||||
/* The total length in milliseconds of this timeline */
|
/* The total length in milliseconds of this timeline */
|
||||||
@@ -173,13 +184,14 @@ enum
|
|||||||
{
|
{
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
|
||||||
PROP_LOOP,
|
PROP_ACTOR,
|
||||||
PROP_DELAY,
|
PROP_DELAY,
|
||||||
PROP_DURATION,
|
PROP_DURATION,
|
||||||
PROP_DIRECTION,
|
PROP_DIRECTION,
|
||||||
PROP_AUTO_REVERSE,
|
PROP_AUTO_REVERSE,
|
||||||
PROP_REPEAT_COUNT,
|
PROP_REPEAT_COUNT,
|
||||||
PROP_PROGRESS_MODE,
|
PROP_PROGRESS_MODE,
|
||||||
|
PROP_FRAME_CLOCK,
|
||||||
|
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
@@ -200,6 +212,8 @@ enum
|
|||||||
|
|
||||||
static guint timeline_signals[LAST_SIGNAL] = { 0, };
|
static guint timeline_signals[LAST_SIGNAL] = { 0, };
|
||||||
|
|
||||||
|
static void update_frame_clock (ClutterTimeline *timeline);
|
||||||
|
|
||||||
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
static void clutter_scriptable_iface_init (ClutterScriptableIface *iface);
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_CODE (ClutterTimeline, clutter_timeline, G_TYPE_OBJECT,
|
G_DEFINE_TYPE_WITH_CODE (ClutterTimeline, clutter_timeline, G_TYPE_OBJECT,
|
||||||
@@ -291,21 +305,196 @@ clutter_timeline_add_marker_internal (ClutterTimeline *timeline,
|
|||||||
g_hash_table_insert (priv->markers_by_name, marker->name, marker);
|
g_hash_table_insert (priv->markers_by_name, marker->name, marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static void
|
||||||
clutter_timeline_set_loop_internal (ClutterTimeline *timeline,
|
on_actor_destroyed (ClutterActor *actor,
|
||||||
gboolean loop)
|
ClutterTimeline *timeline)
|
||||||
{
|
{
|
||||||
gint old_repeat_count;
|
ClutterTimelinePrivate *priv = timeline->priv;
|
||||||
|
|
||||||
old_repeat_count = timeline->priv->repeat_count;
|
priv->actor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (loop)
|
/**
|
||||||
clutter_timeline_set_repeat_count (timeline, -1);
|
* clutter_timeline_get_actor:
|
||||||
else
|
* @timeline: a #ClutterTimeline
|
||||||
clutter_timeline_set_repeat_count (timeline, 0);
|
*
|
||||||
|
* Get the actor the timeline is associated with.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): the associated #ClutterActor
|
||||||
|
*/
|
||||||
|
ClutterActor *
|
||||||
|
clutter_timeline_get_actor (ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
ClutterTimelinePrivate *priv = timeline->priv;
|
||||||
|
|
||||||
if (old_repeat_count != timeline->priv->repeat_count)
|
return priv->actor;
|
||||||
g_object_notify_by_pspec (G_OBJECT (timeline), obj_props[PROP_LOOP]);
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
maybe_add_timeline (ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
ClutterTimelinePrivate *priv = timeline->priv;
|
||||||
|
|
||||||
|
if (!priv->frame_clock)
|
||||||
|
return;
|
||||||
|
|
||||||
|
clutter_frame_clock_add_timeline (priv->frame_clock, timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
maybe_remove_timeline (ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
ClutterTimelinePrivate *priv = timeline->priv;
|
||||||
|
|
||||||
|
if (!priv->frame_clock)
|
||||||
|
return;
|
||||||
|
|
||||||
|
clutter_frame_clock_remove_timeline (priv->frame_clock, timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
set_frame_clock_internal (ClutterTimeline *timeline,
|
||||||
|
ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
ClutterTimelinePrivate *priv = timeline->priv;
|
||||||
|
|
||||||
|
if (priv->frame_clock == frame_clock)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (priv->frame_clock && priv->is_playing)
|
||||||
|
maybe_remove_timeline (timeline);
|
||||||
|
|
||||||
|
g_set_object (&priv->frame_clock, frame_clock);
|
||||||
|
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (timeline),
|
||||||
|
obj_props[PROP_FRAME_CLOCK]);
|
||||||
|
|
||||||
|
if (priv->is_playing)
|
||||||
|
maybe_add_timeline (timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_stage_stage_views_changed (ClutterActor *stage,
|
||||||
|
ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
ClutterTimelinePrivate *priv = timeline->priv;
|
||||||
|
|
||||||
|
g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
|
||||||
|
priv->stage = NULL;
|
||||||
|
|
||||||
|
update_frame_clock (timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_frame_clock_actor_stage_views_changed (ClutterActor *frame_clock_actor,
|
||||||
|
ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
update_frame_clock (timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
update_frame_clock (ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
ClutterTimelinePrivate *priv = timeline->priv;
|
||||||
|
ClutterFrameClock *frame_clock = NULL;
|
||||||
|
ClutterActor *stage;
|
||||||
|
ClutterActor *frame_clock_actor;
|
||||||
|
|
||||||
|
if (!priv->actor)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (priv->frame_clock_actor)
|
||||||
|
{
|
||||||
|
g_clear_signal_handler (&priv->frame_clock_actor_stage_views_handler_id,
|
||||||
|
priv->frame_clock_actor);
|
||||||
|
g_clear_weak_pointer (&priv->frame_clock_actor);
|
||||||
|
}
|
||||||
|
|
||||||
|
frame_clock = clutter_actor_pick_frame_clock (priv->actor, &frame_clock_actor);
|
||||||
|
if (frame_clock)
|
||||||
|
{
|
||||||
|
g_set_weak_pointer (&priv->frame_clock_actor, frame_clock_actor);
|
||||||
|
priv->frame_clock_actor_stage_views_handler_id =
|
||||||
|
g_signal_connect (frame_clock_actor, "stage-views-changed",
|
||||||
|
G_CALLBACK (on_frame_clock_actor_stage_views_changed),
|
||||||
|
timeline);
|
||||||
|
|
||||||
|
g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
stage = clutter_actor_get_stage (priv->actor);
|
||||||
|
if (!stage)
|
||||||
|
{
|
||||||
|
if (priv->is_playing)
|
||||||
|
g_warning ("Timelines with detached actors are not supported");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->stage_stage_views_handler_id > 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
priv->stage_stage_views_handler_id =
|
||||||
|
g_signal_connect (stage, "stage-views-changed",
|
||||||
|
G_CALLBACK (on_stage_stage_views_changed),
|
||||||
|
timeline);
|
||||||
|
priv->stage = stage;
|
||||||
|
|
||||||
|
out:
|
||||||
|
set_frame_clock_internal (timeline, frame_clock);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
on_actor_stage_views_changed (ClutterActor *actor,
|
||||||
|
ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
update_frame_clock (timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_timeline_set_actor:
|
||||||
|
* @timeline: a #ClutterTimeline
|
||||||
|
* @actor: (nullable): a #ClutterActor
|
||||||
|
*
|
||||||
|
* Set the actor the timeline is associated with.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
clutter_timeline_set_actor (ClutterTimeline *timeline,
|
||||||
|
ClutterActor *actor)
|
||||||
|
{
|
||||||
|
ClutterTimelinePrivate *priv = timeline->priv;
|
||||||
|
|
||||||
|
g_return_if_fail (!actor || (actor && !priv->custom_frame_clock));
|
||||||
|
|
||||||
|
if (priv->actor)
|
||||||
|
{
|
||||||
|
g_clear_signal_handler (&priv->actor_destroy_handler_id, priv->actor);
|
||||||
|
g_clear_signal_handler (&priv->actor_stage_views_handler_id, priv->actor);
|
||||||
|
g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
|
||||||
|
priv->stage = NULL;
|
||||||
|
priv->actor = NULL;
|
||||||
|
|
||||||
|
if (priv->is_playing)
|
||||||
|
maybe_remove_timeline (timeline);
|
||||||
|
|
||||||
|
priv->frame_clock = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->actor = actor;
|
||||||
|
|
||||||
|
if (priv->actor)
|
||||||
|
{
|
||||||
|
priv->actor_destroy_handler_id =
|
||||||
|
g_signal_connect (priv->actor, "destroy",
|
||||||
|
G_CALLBACK (on_actor_destroyed),
|
||||||
|
timeline);
|
||||||
|
priv->actor_stage_views_handler_id =
|
||||||
|
g_signal_connect (priv->actor, "stage-views-changed",
|
||||||
|
G_CALLBACK (on_actor_stage_views_changed),
|
||||||
|
timeline);
|
||||||
|
}
|
||||||
|
|
||||||
|
update_frame_clock (timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Scriptable */
|
/* Scriptable */
|
||||||
@@ -449,8 +638,8 @@ clutter_timeline_set_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_LOOP:
|
case PROP_ACTOR:
|
||||||
clutter_timeline_set_loop_internal (timeline, g_value_get_boolean (value));
|
clutter_timeline_set_actor (timeline, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DELAY:
|
case PROP_DELAY:
|
||||||
@@ -477,6 +666,10 @@ clutter_timeline_set_property (GObject *object,
|
|||||||
clutter_timeline_set_progress_mode (timeline, g_value_get_enum (value));
|
clutter_timeline_set_progress_mode (timeline, g_value_get_enum (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_FRAME_CLOCK:
|
||||||
|
clutter_timeline_set_frame_clock (timeline, g_value_get_object (value));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -494,8 +687,8 @@ clutter_timeline_get_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
case PROP_LOOP:
|
case PROP_ACTOR:
|
||||||
g_value_set_boolean (value, priv->repeat_count != 0);
|
g_value_set_object (value, priv->actor);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PROP_DELAY:
|
case PROP_DELAY:
|
||||||
@@ -522,6 +715,10 @@ clutter_timeline_get_property (GObject *object,
|
|||||||
g_value_set_enum (value, priv->progress_mode);
|
g_value_set_enum (value, priv->progress_mode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_FRAME_CLOCK:
|
||||||
|
g_value_set_object (value, priv->frame_clock);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
@@ -533,16 +730,14 @@ clutter_timeline_finalize (GObject *object)
|
|||||||
{
|
{
|
||||||
ClutterTimeline *self = CLUTTER_TIMELINE (object);
|
ClutterTimeline *self = CLUTTER_TIMELINE (object);
|
||||||
ClutterTimelinePrivate *priv = self->priv;
|
ClutterTimelinePrivate *priv = self->priv;
|
||||||
ClutterMasterClock *master_clock;
|
|
||||||
|
|
||||||
if (priv->markers_by_name)
|
if (priv->markers_by_name)
|
||||||
g_hash_table_destroy (priv->markers_by_name);
|
g_hash_table_destroy (priv->markers_by_name);
|
||||||
|
|
||||||
if (priv->is_playing)
|
if (priv->is_playing)
|
||||||
{
|
maybe_remove_timeline (self);
|
||||||
master_clock = _clutter_master_clock_get_default ();
|
|
||||||
_clutter_master_clock_remove_timeline (master_clock, self);
|
g_clear_object (&priv->frame_clock);
|
||||||
}
|
|
||||||
|
|
||||||
G_OBJECT_CLASS (clutter_timeline_parent_class)->finalize (object);
|
G_OBJECT_CLASS (clutter_timeline_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
@@ -557,6 +752,21 @@ clutter_timeline_dispose (GObject *object)
|
|||||||
|
|
||||||
clutter_timeline_cancel_delay (self);
|
clutter_timeline_cancel_delay (self);
|
||||||
|
|
||||||
|
if (priv->actor)
|
||||||
|
{
|
||||||
|
g_clear_signal_handler (&priv->actor_destroy_handler_id, priv->actor);
|
||||||
|
g_clear_signal_handler (&priv->actor_stage_views_handler_id, priv->actor);
|
||||||
|
g_clear_signal_handler (&priv->stage_stage_views_handler_id, priv->stage);
|
||||||
|
priv->actor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (priv->frame_clock_actor)
|
||||||
|
{
|
||||||
|
g_clear_signal_handler (&priv->frame_clock_actor_stage_views_handler_id,
|
||||||
|
priv->frame_clock_actor);
|
||||||
|
g_clear_weak_pointer (&priv->frame_clock_actor);
|
||||||
|
}
|
||||||
|
|
||||||
if (priv->progress_notify != NULL)
|
if (priv->progress_notify != NULL)
|
||||||
{
|
{
|
||||||
priv->progress_notify (priv->progress_data);
|
priv->progress_notify (priv->progress_data);
|
||||||
@@ -574,24 +784,17 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
|
|||||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterTimeline:loop:
|
* ClutterTimeline::actor:
|
||||||
*
|
*
|
||||||
* Whether the timeline should automatically rewind and restart.
|
* The actor the timeline is associated with. This will determine what frame
|
||||||
*
|
* clock will drive it.
|
||||||
* As a side effect, setting this property to %TRUE will set the
|
|
||||||
* #ClutterTimeline:repeat-count property to -1, while setting this
|
|
||||||
* property to %FALSE will set the #ClutterTimeline:repeat-count
|
|
||||||
* property to 0.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.10: Use the #ClutterTimeline:repeat-count property instead.
|
|
||||||
*/
|
*/
|
||||||
obj_props[PROP_LOOP] =
|
obj_props[PROP_ACTOR] =
|
||||||
g_param_spec_boolean ("loop",
|
g_param_spec_object ("actor",
|
||||||
P_("Loop"),
|
P_("Actor"),
|
||||||
P_("Should the timeline automatically restart"),
|
P_("Associated ClutterActor"),
|
||||||
FALSE,
|
CLUTTER_TYPE_ACTOR,
|
||||||
CLUTTER_PARAM_READWRITE | G_PARAM_DEPRECATED);
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClutterTimeline:delay:
|
* ClutterTimeline:delay:
|
||||||
*
|
*
|
||||||
@@ -690,6 +893,18 @@ clutter_timeline_class_init (ClutterTimelineClass *klass)
|
|||||||
CLUTTER_LINEAR,
|
CLUTTER_LINEAR,
|
||||||
CLUTTER_PARAM_READWRITE);
|
CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClutterTimeline:frame-clock:
|
||||||
|
*
|
||||||
|
* The frame clock driving the timeline.
|
||||||
|
*/
|
||||||
|
obj_props[PROP_FRAME_CLOCK] =
|
||||||
|
g_param_spec_object ("frame-clock",
|
||||||
|
"Frame clock",
|
||||||
|
"Frame clock driving the timeline",
|
||||||
|
CLUTTER_TYPE_FRAME_CLOCK,
|
||||||
|
G_PARAM_CONSTRUCT | CLUTTER_PARAM_READWRITE);
|
||||||
|
|
||||||
object_class->dispose = clutter_timeline_dispose;
|
object_class->dispose = clutter_timeline_dispose;
|
||||||
object_class->finalize = clutter_timeline_finalize;
|
object_class->finalize = clutter_timeline_finalize;
|
||||||
object_class->set_property = clutter_timeline_set_property;
|
object_class->set_property = clutter_timeline_set_property;
|
||||||
@@ -972,7 +1187,6 @@ set_is_playing (ClutterTimeline *timeline,
|
|||||||
gboolean is_playing)
|
gboolean is_playing)
|
||||||
{
|
{
|
||||||
ClutterTimelinePrivate *priv = timeline->priv;
|
ClutterTimelinePrivate *priv = timeline->priv;
|
||||||
ClutterMasterClock *master_clock;
|
|
||||||
|
|
||||||
is_playing = !!is_playing;
|
is_playing = !!is_playing;
|
||||||
|
|
||||||
@@ -981,15 +1195,17 @@ set_is_playing (ClutterTimeline *timeline,
|
|||||||
|
|
||||||
priv->is_playing = is_playing;
|
priv->is_playing = is_playing;
|
||||||
|
|
||||||
master_clock = _clutter_master_clock_get_default ();
|
|
||||||
if (priv->is_playing)
|
if (priv->is_playing)
|
||||||
{
|
{
|
||||||
priv->waiting_first_tick = TRUE;
|
priv->waiting_first_tick = TRUE;
|
||||||
priv->current_repeat = 0;
|
priv->current_repeat = 0;
|
||||||
_clutter_master_clock_add_timeline (master_clock, timeline);
|
|
||||||
|
maybe_add_timeline (timeline);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
_clutter_master_clock_remove_timeline (master_clock, timeline);
|
{
|
||||||
|
maybe_remove_timeline (timeline);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@@ -1186,6 +1402,9 @@ clutter_timeline_start (ClutterTimeline *timeline)
|
|||||||
if (priv->duration == 0)
|
if (priv->duration == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_warn_if_fail ((priv->actor && clutter_actor_get_stage (priv->actor)) ||
|
||||||
|
priv->frame_clock);
|
||||||
|
|
||||||
if (priv->delay)
|
if (priv->delay)
|
||||||
priv->delay_id = clutter_threads_add_timeout (priv->delay,
|
priv->delay_id = clutter_threads_add_timeout (priv->delay,
|
||||||
delay_timeout_func,
|
delay_timeout_func,
|
||||||
@@ -1252,45 +1471,6 @@ clutter_timeline_stop (ClutterTimeline *timeline)
|
|||||||
g_signal_emit (timeline, timeline_signals[STOPPED], 0, FALSE);
|
g_signal_emit (timeline, timeline_signals[STOPPED], 0, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_timeline_set_loop:
|
|
||||||
* @timeline: a #ClutterTimeline
|
|
||||||
* @loop: %TRUE for enable looping
|
|
||||||
*
|
|
||||||
* Sets whether @timeline should loop.
|
|
||||||
*
|
|
||||||
* This function is equivalent to calling clutter_timeline_set_repeat_count()
|
|
||||||
* with -1 if @loop is %TRUE, and with 0 if @loop is %FALSE.
|
|
||||||
*
|
|
||||||
* Deprecated: 1.10: Use clutter_timeline_set_repeat_count() instead.
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
clutter_timeline_set_loop (ClutterTimeline *timeline,
|
|
||||||
gboolean loop)
|
|
||||||
{
|
|
||||||
g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
|
|
||||||
|
|
||||||
clutter_timeline_set_loop_internal (timeline, loop);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_timeline_get_loop:
|
|
||||||
* @timeline: a #ClutterTimeline
|
|
||||||
*
|
|
||||||
* Gets whether @timeline is looping
|
|
||||||
*
|
|
||||||
* Return value: %TRUE if the timeline is looping
|
|
||||||
*
|
|
||||||
* Deprecated: 1.10: Use clutter_timeline_get_repeat_count() instead.
|
|
||||||
*/
|
|
||||||
gboolean
|
|
||||||
clutter_timeline_get_loop (ClutterTimeline *timeline)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), FALSE);
|
|
||||||
|
|
||||||
return timeline->priv->repeat_count != 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_timeline_rewind:
|
* clutter_timeline_rewind:
|
||||||
* @timeline: A #ClutterTimeline
|
* @timeline: A #ClutterTimeline
|
||||||
@@ -1406,49 +1586,11 @@ clutter_timeline_is_playing (ClutterTimeline *timeline)
|
|||||||
return timeline->priv->is_playing;
|
return timeline->priv->is_playing;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* clutter_timeline_clone:
|
|
||||||
* @timeline: #ClutterTimeline to duplicate.
|
|
||||||
*
|
|
||||||
* Create a new #ClutterTimeline instance which has property values
|
|
||||||
* matching that of supplied timeline. The cloned timeline will not
|
|
||||||
* be started and will not be positioned to the current position of
|
|
||||||
* the original @timeline: you will have to start it with
|
|
||||||
* clutter_timeline_start().
|
|
||||||
*
|
|
||||||
* The only cloned properties are:
|
|
||||||
*
|
|
||||||
* - #ClutterTimeline:duration
|
|
||||||
* - #ClutterTimeline:loop
|
|
||||||
* - #ClutterTimeline:delay
|
|
||||||
* - #ClutterTimeline:direction
|
|
||||||
*
|
|
||||||
* Return value: (transfer full): a new #ClutterTimeline, cloned
|
|
||||||
* from @timeline
|
|
||||||
*
|
|
||||||
* Since: 0.4
|
|
||||||
*
|
|
||||||
* Deprecated: 1.10: Use clutter_timeline_new() or g_object_new()
|
|
||||||
* instead
|
|
||||||
*/
|
|
||||||
ClutterTimeline *
|
|
||||||
clutter_timeline_clone (ClutterTimeline *timeline)
|
|
||||||
{
|
|
||||||
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
|
||||||
|
|
||||||
return g_object_new (CLUTTER_TYPE_TIMELINE,
|
|
||||||
"duration", timeline->priv->duration,
|
|
||||||
"loop", timeline->priv->repeat_count != 0,
|
|
||||||
"delay", timeline->priv->delay,
|
|
||||||
"direction", timeline->priv->direction,
|
|
||||||
NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_timeline_new:
|
* clutter_timeline_new:
|
||||||
* @msecs: Duration of the timeline in milliseconds
|
* @duration_ms: Duration of the timeline in milliseconds
|
||||||
*
|
*
|
||||||
* Creates a new #ClutterTimeline with a duration of @msecs.
|
* Creates a new #ClutterTimeline with a duration of @duration_ms milli seconds.
|
||||||
*
|
*
|
||||||
* Return value: the newly created #ClutterTimeline instance. Use
|
* Return value: the newly created #ClutterTimeline instance. Use
|
||||||
* g_object_unref() when done using it
|
* g_object_unref() when done using it
|
||||||
@@ -1456,10 +1598,50 @@ clutter_timeline_clone (ClutterTimeline *timeline)
|
|||||||
* Since: 0.6
|
* Since: 0.6
|
||||||
*/
|
*/
|
||||||
ClutterTimeline *
|
ClutterTimeline *
|
||||||
clutter_timeline_new (guint msecs)
|
clutter_timeline_new (guint duration_ms)
|
||||||
{
|
{
|
||||||
return g_object_new (CLUTTER_TYPE_TIMELINE,
|
return g_object_new (CLUTTER_TYPE_TIMELINE,
|
||||||
"duration", msecs,
|
"duration", duration_ms,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_timeline_new_for_actor:
|
||||||
|
* @actor: The #ClutterActor the timeline is associated with
|
||||||
|
* @duration_ms: Duration of the timeline in milliseconds
|
||||||
|
*
|
||||||
|
* Creates a new #ClutterTimeline with a duration of @duration milli seconds.
|
||||||
|
*
|
||||||
|
* Return value: the newly created #ClutterTimeline instance. Use
|
||||||
|
* g_object_unref() when done using it
|
||||||
|
*/
|
||||||
|
ClutterTimeline *
|
||||||
|
clutter_timeline_new_for_actor (ClutterActor *actor,
|
||||||
|
unsigned int duration_ms)
|
||||||
|
{
|
||||||
|
return g_object_new (CLUTTER_TYPE_TIMELINE,
|
||||||
|
"duration", duration_ms,
|
||||||
|
"actor", actor,
|
||||||
|
NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_timeline_new_for_frame_clock:
|
||||||
|
* @frame_clock: The #ClutterFrameClock the timeline is driven by
|
||||||
|
* @duration_ms: Duration of the timeline in milliseconds
|
||||||
|
*
|
||||||
|
* Creates a new #ClutterTimeline with a duration of @duration_ms milli seconds.
|
||||||
|
*
|
||||||
|
* Return value: the newly created #ClutterTimeline instance. Use
|
||||||
|
* g_object_unref() when done using it
|
||||||
|
*/
|
||||||
|
ClutterTimeline *
|
||||||
|
clutter_timeline_new_for_frame_clock (ClutterFrameClock *frame_clock,
|
||||||
|
unsigned int duration_ms)
|
||||||
|
{
|
||||||
|
return g_object_new (CLUTTER_TYPE_TIMELINE,
|
||||||
|
"duration", duration_ms,
|
||||||
|
"frame-clock", frame_clock,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1725,7 +1907,7 @@ _clutter_timeline_do_tick (ClutterTimeline *timeline,
|
|||||||
|
|
||||||
/* Check the is_playing variable before performing the timeline tick.
|
/* Check the is_playing variable before performing the timeline tick.
|
||||||
* This is necessary, as if a timeline is stopped in response to a
|
* This is necessary, as if a timeline is stopped in response to a
|
||||||
* master-clock generated signal of a different timeline, this code can
|
* frame clock generated signal of a different timeline, this code can
|
||||||
* still be reached.
|
* still be reached.
|
||||||
*/
|
*/
|
||||||
if (!priv->is_playing)
|
if (!priv->is_playing)
|
||||||
@@ -2543,3 +2725,32 @@ clutter_timeline_get_cubic_bezier_progress (ClutterTimeline *timeline,
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clutter_timeline_get_frame_clock: (skip)
|
||||||
|
*/
|
||||||
|
ClutterFrameClock *
|
||||||
|
clutter_timeline_get_frame_clock (ClutterTimeline *timeline)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (CLUTTER_IS_TIMELINE (timeline), NULL);
|
||||||
|
|
||||||
|
return timeline->priv->frame_clock;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_timeline_set_frame_clock (ClutterTimeline *timeline,
|
||||||
|
ClutterFrameClock *frame_clock)
|
||||||
|
{
|
||||||
|
ClutterTimelinePrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_TIMELINE (timeline));
|
||||||
|
|
||||||
|
priv = timeline->priv;
|
||||||
|
|
||||||
|
g_assert (!frame_clock || (frame_clock && !priv->actor));
|
||||||
|
g_return_if_fail (!frame_clock || (frame_clock && !priv->actor));
|
||||||
|
|
||||||
|
priv->custom_frame_clock = frame_clock;
|
||||||
|
if (!priv->actor)
|
||||||
|
set_frame_clock_internal (timeline, frame_clock);
|
||||||
|
}
|
||||||
|
|||||||
@@ -119,7 +119,19 @@ CLUTTER_EXPORT
|
|||||||
GType clutter_timeline_get_type (void) G_GNUC_CONST;
|
GType clutter_timeline_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
ClutterTimeline * clutter_timeline_new (guint msecs);
|
ClutterTimeline * clutter_timeline_new_for_actor (ClutterActor *actor,
|
||||||
|
unsigned int duration_ms);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterTimeline * clutter_timeline_new_for_frame_clock (ClutterFrameClock *frame_clock,
|
||||||
|
unsigned int duration_ms);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterActor * clutter_timeline_get_actor (ClutterTimeline *timeline);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_timeline_set_actor (ClutterTimeline *timeline,
|
||||||
|
ClutterActor *actor);
|
||||||
|
|
||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
guint clutter_timeline_get_duration (ClutterTimeline *timeline);
|
guint clutter_timeline_get_duration (ClutterTimeline *timeline);
|
||||||
@@ -221,6 +233,13 @@ gint64 clutter_timeline_get_duration_hint
|
|||||||
CLUTTER_EXPORT
|
CLUTTER_EXPORT
|
||||||
gint clutter_timeline_get_current_repeat (ClutterTimeline *timeline);
|
gint clutter_timeline_get_current_repeat (ClutterTimeline *timeline);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
ClutterFrameClock * clutter_timeline_get_frame_clock (ClutterTimeline *timeline);
|
||||||
|
|
||||||
|
CLUTTER_EXPORT
|
||||||
|
void clutter_timeline_set_frame_clock (ClutterTimeline *timeline,
|
||||||
|
ClutterFrameClock *frame_clock);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* _CLUTTER_TIMELINE_H__ */
|
#endif /* _CLUTTER_TIMELINE_H__ */
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user