Compare commits
1693 Commits
css-render
...
oklab-supp
Author | SHA1 | Date | |
---|---|---|---|
|
d14a5acd4e | ||
|
4de67b2fe5 | ||
|
6d878bd21c | ||
|
965fd476a5 | ||
|
3bce60c433 | ||
|
8083456599 | ||
|
2a1b8c4fcc | ||
|
ed9e759917 | ||
|
f69d7f804a | ||
|
4368583cbe | ||
|
c44efc31ba | ||
|
3c6cc6c362 | ||
|
eff0d5b37b | ||
|
579878a855 | ||
|
b43294c1c3 | ||
|
5d8e801d80 | ||
|
4c7631a645 | ||
|
9fe78d9f75 | ||
|
9a7d84b441 | ||
|
1fe9918f3c | ||
|
cd04aa1cd4 | ||
|
ac1c0d37c6 | ||
|
ea6bcdbd3d | ||
|
fe83b06eaf | ||
|
be5fd3d89f | ||
|
bef38bd9c4 | ||
|
06f08ea804 | ||
|
79bb805a02 | ||
|
d70c005021 | ||
|
9fc7d8e947 | ||
|
b06ac9826c | ||
|
94cacd79f9 | ||
|
17d3631605 | ||
|
3b027cf466 | ||
|
5d4f2822d0 | ||
|
5a11ee7b9c | ||
|
874410129e | ||
|
2cf1651235 | ||
|
ad2221ce29 | ||
|
6dd0be2f06 | ||
|
2103ab99a5 | ||
|
d7ab7e9628 | ||
|
3d7ac47e5e | ||
|
c373e2c76b | ||
|
ec3b27bb68 | ||
|
5b87dba1a3 | ||
|
12dcaf1e7a | ||
|
5031f30f28 | ||
|
ad465e81aa | ||
|
39374c7209 | ||
|
170a1cd941 | ||
|
6074a18e3e | ||
|
5d5b612630 | ||
|
5942252175 | ||
|
9a3898fe89 | ||
|
c6a3efaf70 | ||
|
9870234294 | ||
|
64ecb972cf | ||
|
ded6d400d7 | ||
|
979a37d3f7 | ||
|
270e6165f4 | ||
|
df51d474fc | ||
|
1e0ab6f249 | ||
|
deb4de6332 | ||
|
b4c7dd770c | ||
|
7488644176 | ||
|
9ed7cecd42 | ||
|
df36ab3f93 | ||
|
7e4fdea71b | ||
|
ea8062e86a | ||
|
c4efe7709b | ||
|
fdea496883 | ||
|
60878e4186 | ||
|
02297138f3 | ||
|
6603e02beb | ||
|
bfb7573810 | ||
|
6847c3469d | ||
|
7a1e5b4418 | ||
|
76980e10a0 | ||
|
34f4a06691 | ||
|
2dea5ae958 | ||
|
5856716188 | ||
|
1c4a0dae62 | ||
|
b7fba6298f | ||
|
5ce196fe9f | ||
|
c31c89c794 | ||
|
1eb8c3ea34 | ||
|
b2414b1ecd | ||
|
fd3dfaf2c3 | ||
|
43a6c8c5f5 | ||
|
3789191853 | ||
|
eb4fb2af0e | ||
|
fd02afa2e4 | ||
|
55bb77cffc | ||
|
119ba5844f | ||
|
9b2b5ebb65 | ||
|
1624455a32 | ||
|
d483883f38 | ||
|
0dc0bea1d5 | ||
|
55e31b972c | ||
|
1013874de8 | ||
|
c397460c11 | ||
|
ff0045b8c9 | ||
|
d0b409d349 | ||
|
c0cb10262d | ||
|
279a5f7825 | ||
|
6fa87d4f37 | ||
|
fe35daaf34 | ||
|
c3b836951a | ||
|
ec10f1fe16 | ||
|
ae741a06c0 | ||
|
754c9cb323 | ||
|
a3683a080b | ||
|
0673d74986 | ||
|
8c46df425e | ||
|
ff78e1888b | ||
|
f2f219f304 | ||
|
bb46edcc21 | ||
|
24173e3f93 | ||
|
ec73bcb05b | ||
|
6c74c9c970 | ||
|
c9c35ae41d | ||
|
95cea06462 | ||
|
d01ca53bde | ||
|
3d3cafefc8 | ||
|
86cdb0ceb2 | ||
|
0c97c86573 | ||
|
10fa570195 | ||
|
e18c553457 | ||
|
187763d286 | ||
|
e6ae136de0 | ||
|
81efb63073 | ||
|
cbadb1ed8e | ||
|
103e98f570 | ||
|
3768c751c5 | ||
|
e42014573a | ||
|
a9f1ff471b | ||
|
e26a1bbda9 | ||
|
b2ae7a2448 | ||
|
cb682c759d | ||
|
b154c9caf4 | ||
|
523fca21e9 | ||
|
73ddde6eda | ||
|
403da9a2d5 | ||
|
fb6f211869 | ||
|
c358606a46 | ||
|
b7e5a79468 | ||
|
06bcb0ee47 | ||
|
58ce0a39dc | ||
|
6d3c333208 | ||
|
62c3923e5a | ||
|
3be8b1d927 | ||
|
27a61e221f | ||
|
52df3481d6 | ||
|
ccb993d87b | ||
|
5fdaa4a232 | ||
|
8b166dff74 | ||
|
f6b3f321a4 | ||
|
a314143a83 | ||
|
6c7abf425a | ||
|
b11e45762b | ||
|
d041a681a5 | ||
|
d22d2f77a6 | ||
|
7458461d06 | ||
|
283615936b | ||
|
2274bca95b | ||
|
f8b4deeac0 | ||
|
afa503c2e0 | ||
|
105f5f1137 | ||
|
b83ad60a1f | ||
|
58b44ebc1c | ||
|
b598f21506 | ||
|
d3c166d511 | ||
|
76e93206f3 | ||
|
ecfe47af73 | ||
|
f20ca9067e | ||
|
8f3cd4733c | ||
|
402ee9b39c | ||
|
becbf4e1f9 | ||
|
67407d5dcf | ||
|
fcc0f243cf | ||
|
282dcfa9ac | ||
|
8c04801f6a | ||
|
abe2d1cb16 | ||
|
e407d22b1e | ||
|
37cefde5b0 | ||
|
310a4a3bf6 | ||
|
e6896aa8dc | ||
|
36ce68a3ca | ||
|
797343da59 | ||
|
bd3223d452 | ||
|
87a1a17868 | ||
|
70f386bd68 | ||
|
0af89088ba | ||
|
7342317c31 | ||
|
8d8bd4efba | ||
|
0ae3c8968e | ||
|
5e3f13acd1 | ||
|
32cdf35583 | ||
|
2f670bdc59 | ||
|
8d5660b4ab | ||
|
2a39f427e1 | ||
|
ca86294325 | ||
|
820ba1ef13 | ||
|
9507130dbc | ||
|
d2dede635b | ||
|
5a7fc4054b | ||
|
7fe22845e3 | ||
|
6c9a7cc708 | ||
|
feeca98270 | ||
|
7c27241479 | ||
|
fb73040d70 | ||
|
bbe74abf51 | ||
|
34bd3fc854 | ||
|
940b5af2a8 | ||
|
0929d77f7f | ||
|
617297ddd7 | ||
|
67cec180ca | ||
|
bab8f2f976 | ||
|
4801c3275e | ||
|
39354b3b99 | ||
|
661e953558 | ||
|
039b97ef9e | ||
|
630699fb68 | ||
|
3f4a414b1d | ||
|
4569b1ab40 | ||
|
a484e8fc37 | ||
|
d51bf6d905 | ||
|
358b0b4d13 | ||
|
97e0f872a2 | ||
|
de74fa0836 | ||
|
42d26720d6 | ||
|
c7dfb8cb55 | ||
|
8648a67c10 | ||
|
f9b3ce95c2 | ||
|
c828813d78 | ||
|
5935dc174f | ||
|
b623b2acef | ||
|
cc867eeccf | ||
|
17bdb4c8fb | ||
|
236b6d1cd6 | ||
|
9ded3e64a2 | ||
|
6e714722c4 | ||
|
60b1496091 | ||
|
dc1b2d4117 | ||
|
e205f13495 | ||
|
72718b7193 | ||
|
db95e37e15 | ||
|
f9714cc054 | ||
|
58c49ce6b0 | ||
|
13364cea74 | ||
|
f6014bdc08 | ||
|
6070edfa61 | ||
|
0600357373 | ||
|
7873ebac2a | ||
|
8edd376ab8 | ||
|
6f300557bf | ||
|
bcda071d7d | ||
|
9df3a50c87 | ||
|
70d41583b3 | ||
|
a50df37d52 | ||
|
b7d07ae190 | ||
|
3610ac0fd1 | ||
|
9f855eecb1 | ||
|
ffc8f34dfd | ||
|
7acc1c0125 | ||
|
6059eaf355 | ||
|
26971c48d4 | ||
|
b42caef0ed | ||
|
b3706daf90 | ||
|
24dc9dc653 | ||
|
172dfb14c4 | ||
|
3b43078b08 | ||
|
f2e75529cb | ||
|
eed58b4051 | ||
|
28a01ca954 | ||
|
efd5395ecf | ||
|
376dbe9def | ||
|
bba7979670 | ||
|
01aafc6e65 | ||
|
fa86bfcb55 | ||
|
c3d9f4a9ac | ||
|
d11ac3585d | ||
|
8f78a0f809 | ||
|
3286d9f1b5 | ||
|
ee38c96ee3 | ||
|
e5705bd141 | ||
|
753d74d676 | ||
|
670b4aabac | ||
|
eba9316c12 | ||
|
7f3835cc4f | ||
|
be89fa7919 | ||
|
20d6938a90 | ||
|
6f4f4d0123 | ||
|
250322deb0 | ||
|
bdee95c32c | ||
|
1ffd23dbab | ||
|
e92bd4d9ce | ||
|
24841a8d5b | ||
|
c2dc459167 | ||
|
d87ce14869 | ||
|
e9735f0c35 | ||
|
d320373262 | ||
|
a84fe6bde6 | ||
|
a8748598b6 | ||
|
748acaf654 | ||
|
1ff9d1545d | ||
|
e35670a014 | ||
|
9690c87736 | ||
|
a60d96a9ac | ||
|
0a9b501743 | ||
|
6dd55e381d | ||
|
abd8d40bf9 | ||
|
348e938698 | ||
|
4e0a909ca9 | ||
|
8964f6f0cc | ||
|
b807b84e16 | ||
|
97a2c3a656 | ||
|
5925c4c51f | ||
|
0fa2ae48d4 | ||
|
43303bf7e5 | ||
|
f26f491d58 | ||
|
a9b46e8409 | ||
|
b27e67999b | ||
|
3177fd14f9 | ||
|
9ba41ed6e8 | ||
|
70f2e2e09c | ||
|
56fc8f0077 | ||
|
85abff343e | ||
|
6cefdfeddd | ||
|
75fa51ef6d | ||
|
4181b4b142 | ||
|
7b55d2cf1a | ||
|
03230181ce | ||
|
5e4f692e63 | ||
|
e9a046c439 | ||
|
182de7c957 | ||
|
6c939819a3 | ||
|
6288be286f | ||
|
76a13596aa | ||
|
c18cd6050b | ||
|
60f5d4c93e | ||
|
03840151ac | ||
|
2e44f3e2ff | ||
|
4f9fd5cf1d | ||
|
59f334622b | ||
|
c505a08e46 | ||
|
ffae0010c4 | ||
|
6c72a223f5 | ||
|
5a027594c3 | ||
|
ebc3600f78 | ||
|
ae0cf9ff54 | ||
|
08bf8b7464 | ||
|
0201abca5e | ||
|
d87b566c59 | ||
|
572b4140f9 | ||
|
6241471f3e | ||
|
1ae9cdb4c9 | ||
|
c1e1b54034 | ||
|
f654cb7d3b | ||
|
85beb4fa20 | ||
|
a0e81996eb | ||
|
ec477ef71d | ||
|
3afc760644 | ||
|
ba32140671 | ||
|
91d36dd410 | ||
|
4fd1e32752 | ||
|
b538adf2c0 | ||
|
d16c9fbaca | ||
|
9b6063c07c | ||
|
d1a4740894 | ||
|
5186c4dc45 | ||
|
ca9664cdfd | ||
|
6c9edbf0da | ||
|
b8d2b1d3ce | ||
|
0274294a6f | ||
|
03b19d8861 | ||
|
171612671f | ||
|
d3db28b3f4 | ||
|
896ea5b753 | ||
|
5498b077fd | ||
|
534a9b6ba0 | ||
|
cea961f4f4 | ||
|
848c6815d3 | ||
|
46559039f3 | ||
|
eb7a42bc13 | ||
|
ffe56fe6b3 | ||
|
d4ba57fcc3 | ||
|
a95c9ebc51 | ||
|
9195c39756 | ||
|
e0ffeb8ded | ||
|
d9bb434c1f | ||
|
866c83909c | ||
|
4965b7b6fa | ||
|
45f3e86457 | ||
|
c033de9b83 | ||
|
3f7f9b705e | ||
|
b6d19f4c8b | ||
|
3a2b8f94ec | ||
|
3a5933a519 | ||
|
4c295dc49c | ||
|
03ebb41262 | ||
|
b0c3265561 | ||
|
98943b28aa | ||
|
c354c5a63d | ||
|
2f8cb9b2d0 | ||
|
7559a87e8a | ||
|
b2394691cc | ||
|
5a94004b59 | ||
|
3bd609d77c | ||
|
84d2961a91 | ||
|
3a9f26113f | ||
|
6a240c36ac | ||
|
aaf4261969 | ||
|
0211299846 | ||
|
aca11d6879 | ||
|
5dceb7f7d2 | ||
|
3372b1a84b | ||
|
75a4eca13a | ||
|
13f0ab881e | ||
|
d4b45526b2 | ||
|
c06e1f4848 | ||
|
6a4a52d110 | ||
|
ed6f5b8755 | ||
|
e87b4dca71 | ||
|
567c8b5ab3 | ||
|
7aeca0512c | ||
|
5567934fc9 | ||
|
63bece1fe7 | ||
|
ad3c285fc6 | ||
|
47c461b25b | ||
|
97f0aa7875 | ||
|
8e54460a48 | ||
|
4c4d260199 | ||
|
b18c6b5781 | ||
|
d76e241558 | ||
|
13cbd9fcc7 | ||
|
6e54589d9e | ||
|
c781c0ff24 | ||
|
105ff3a25f | ||
|
0277e26152 | ||
|
563cce5530 | ||
|
b0e4be7fda | ||
|
e29701a203 | ||
|
6a1cd87480 | ||
|
3db858b45f | ||
|
49ee69f316 | ||
|
b43e0a3423 | ||
|
8054099d0e | ||
|
a8e49cc21f | ||
|
5f1ec18550 | ||
|
6b5c5714e5 | ||
|
9a8e5b07ae | ||
|
3f4cf65686 | ||
|
345eca1efe | ||
|
166afbf8e8 | ||
|
9120d1c834 | ||
|
083f9e7723 | ||
|
a0cfc6c404 | ||
|
edc50c85ef | ||
|
4794bc3db6 | ||
|
2299c02639 | ||
|
ae13a82a9a | ||
|
6c88713f82 | ||
|
5c6fedae17 | ||
|
5faa1c3d6e | ||
|
074bcd33be | ||
|
5b6b42b5a9 | ||
|
ae8a06cdca | ||
|
cba4ce03e5 | ||
|
5e82ad3ea7 | ||
|
c9bbf5820b | ||
|
bb0b764172 | ||
|
ae8e9ef650 | ||
|
8df7ff75bb | ||
|
bbfd8e0e89 | ||
|
467212877f | ||
|
204b8857a1 | ||
|
a524524ffd | ||
|
3ef1f448a3 | ||
|
a5df8f2f35 | ||
|
b56a8c7f88 | ||
|
649782b547 | ||
|
97245e9baa | ||
|
0f3c27c8a5 | ||
|
3273637179 | ||
|
1eaa0e9b74 | ||
|
28d1bce2d4 | ||
|
b8072d8562 | ||
|
da9886d822 | ||
|
747f2e5af6 | ||
|
aeb3ee0969 | ||
|
e248f1a4b5 | ||
|
d23833285e | ||
|
ff9fe6857f | ||
|
58f2d3fbe7 | ||
|
d9f75581be | ||
|
307efe2172 | ||
|
4ea4dc9176 | ||
|
fa25015e8c | ||
|
296b6b1ed5 | ||
|
b88fe301be | ||
|
ffd836e6f4 | ||
|
457cf66d0d | ||
|
36765745a1 | ||
|
46c19a3d28 | ||
|
6cf928eb6c | ||
|
a0d076f01a | ||
|
37c744759c | ||
|
277a05eb8c | ||
|
0376e4668c | ||
|
9d5652de64 | ||
|
bb109b5d9e | ||
|
d630ddd182 | ||
|
e268041a42 | ||
|
f9cbeeeedc | ||
|
62542f836f | ||
|
6d4c74fdce | ||
|
3dac4a01c6 | ||
|
f598ec00f5 | ||
|
6fc18f4b37 | ||
|
8c9f16fa7a | ||
|
001ca0a982 | ||
|
b23c0248ba | ||
|
c4c352facc | ||
|
30af6d1159 | ||
|
1fac3fe44e | ||
|
8ac6c08f00 | ||
|
5b62f29b5e | ||
|
817cfb09f8 | ||
|
8da478ab34 | ||
|
8d866c5980 | ||
|
467e622778 | ||
|
aa81df921b | ||
|
328020b241 | ||
|
41cd0c6f13 | ||
|
db02abe54e | ||
|
447bc18c48 | ||
|
283c66251b | ||
|
63b68d2f5e | ||
|
7e09a5648a | ||
|
4a0b833548 | ||
|
86bec01640 | ||
|
b07a2a968d | ||
|
997d553520 | ||
|
8eb05850cb | ||
|
98eaec99ee | ||
|
8fb946f6e8 | ||
|
a10670c991 | ||
|
2e2dab9c3d | ||
|
a6eea6ba3c | ||
|
48f347e62b | ||
|
ed1c047cf2 | ||
|
ea9c2a72d9 | ||
|
15edfe4ffa | ||
|
c2698e2be9 | ||
|
0defdc4af5 | ||
|
ea9b47f1b6 | ||
|
65c8320a32 | ||
|
a7afde2e7d | ||
|
a876a829e4 | ||
|
f4bd883003 | ||
|
0fcdadc531 | ||
|
d58b545ffb | ||
|
8ca299e82b | ||
|
a231a2114a | ||
|
ab41a549f8 | ||
|
a9997a3af6 | ||
|
6d86b16dbe | ||
|
779d32747d | ||
|
ffeca06bd6 | ||
|
83b387e782 | ||
|
b41fe2e093 | ||
|
93573218d4 | ||
|
076968dc1e | ||
|
5e6cf622e3 | ||
|
90c65e3611 | ||
|
afe75aedc2 | ||
|
8b215a453c | ||
|
c3329123a3 | ||
|
107ef2017c | ||
|
acad180cee | ||
|
504ca9c0c8 | ||
|
2d9f28c0ff | ||
|
07b3e8785c | ||
|
68ef86ac4f | ||
|
beb20fb1db | ||
|
3a965088a2 | ||
|
89118ee7ba | ||
|
4b5d503cf0 | ||
|
aeac103fbc | ||
|
cd153e8a53 | ||
|
5369b07eb0 | ||
|
58f7b966d0 | ||
|
4be1d754b7 | ||
|
c1351fb659 | ||
|
d8926de40e | ||
|
73c94cf1d6 | ||
|
c2a637f68a | ||
|
6a986f03b6 | ||
|
a52ae238ab | ||
|
8a0d688a61 | ||
|
3260b8f142 | ||
|
dc8e01d469 | ||
|
0105da3238 | ||
|
8979515aa4 | ||
|
a8c827455d | ||
|
798edf5300 | ||
|
54758bee1f | ||
|
cfe0da1eed | ||
|
1198dc76a4 | ||
|
bed3e9918b | ||
|
d76bb2991a | ||
|
e962e86fcd | ||
|
dd59c90842 | ||
|
c03720879e | ||
|
a62787ebb2 | ||
|
2a7541342c | ||
|
f96d6cdb2b | ||
|
3ea6ddd321 | ||
|
17f7d80fcf | ||
|
e3437c748a | ||
|
f1d80727d0 | ||
|
c7fabe2897 | ||
|
cc1c3799b6 | ||
|
a196bf1132 | ||
|
4bcfeebdea | ||
|
740965016f | ||
|
39e6301f42 | ||
|
fd02c885e9 | ||
|
26a2966a7b | ||
|
29cfcbdc97 | ||
|
de62ea96ab | ||
|
2d230f79a6 | ||
|
cde094a0df | ||
|
2fb3dc8c90 | ||
|
f6a8ba0ccb | ||
|
f650f96b69 | ||
|
c230546a2c | ||
|
f3ac0535f8 | ||
|
7ce942d3fb | ||
|
56a8e947df | ||
|
f592a303e4 | ||
|
e14670d457 | ||
|
0acf9caa8e | ||
|
22860389de | ||
|
16e764b402 | ||
|
85862c4e22 | ||
|
eb764d43f8 | ||
|
6b57f596f7 | ||
|
cefaec5d6f | ||
|
29b6eab0ea | ||
|
360674f523 | ||
|
7900f91e46 | ||
|
e4248503cf | ||
|
168bab34f7 | ||
|
46e7ea8c1e | ||
|
1ce7de0fb8 | ||
|
d9a0f3cfe2 | ||
|
200cec3321 | ||
|
d4e730db0c | ||
|
ca78d845df | ||
|
9ff31dd29b | ||
|
0815359a20 | ||
|
96139a902d | ||
|
a6233ac852 | ||
|
4e9ebb5299 | ||
|
585f31fa2e | ||
|
69e7838461 | ||
|
3fe3800b7c | ||
|
491275b444 | ||
|
1cd107d5ab | ||
|
5af2d95bff | ||
|
62f5db06a1 | ||
|
e32a12f877 | ||
|
584733f034 | ||
|
c3c1819e12 | ||
|
3f36ebc6e7 | ||
|
4aea2d2e09 | ||
|
4e9107d4b1 | ||
|
7d895720be | ||
|
323dde2b10 | ||
|
ac16e375c7 | ||
|
31143f9611 | ||
|
7da4844dcc | ||
|
c9e4abcd3a | ||
|
6e80fde45f | ||
|
d182b133a9 | ||
|
5e3240a32f | ||
|
436989d745 | ||
|
f62606105e | ||
|
0f85a40a25 | ||
|
16ad1e428f | ||
|
a6e0028899 | ||
|
dc3def1afd | ||
|
a14e426fb5 | ||
|
a1a4026867 | ||
|
aff1b88c92 | ||
|
dc072f881c | ||
|
824ccfc562 | ||
|
8c6e5ca131 | ||
|
a7b69ad9b5 | ||
|
3cd25516ab | ||
|
f3c8c5a9c0 | ||
|
6878200ccf | ||
|
e1fbd52c29 | ||
|
79c2df8392 | ||
|
0888402cea | ||
|
3dae3205e7 | ||
|
4858122d17 | ||
|
a19023277f | ||
|
72dc9e3bf1 | ||
|
5f814cc30a | ||
|
23aafbf09f | ||
|
761dc7cad0 | ||
|
f62a873eef | ||
|
03c99ebc99 | ||
|
cb339f85b8 | ||
|
5d056eabf6 | ||
|
4e77667ab8 | ||
|
d3e3ddf897 | ||
|
fca983e81e | ||
|
b1995d0d77 | ||
|
8ccfda4972 | ||
|
9a47c0f923 | ||
|
b33b679b13 | ||
|
8d41ecff3e | ||
|
85bcf9a366 | ||
|
b27e3631f0 | ||
|
4d5ba0631d | ||
|
0f618ae29e | ||
|
13d415f2f6 | ||
|
e7b14ae26e | ||
|
07658347a9 | ||
|
0436801a9c | ||
|
4da593a3de | ||
|
f5194bbf83 | ||
|
15552e5478 | ||
|
d9616c1993 | ||
|
5dbce5ce9b | ||
|
1f47c36e49 | ||
|
ed05890740 | ||
|
68d73dcce5 | ||
|
9643a21827 | ||
|
07b64c2f0f | ||
|
3df3ec2a29 | ||
|
0015fda94c | ||
|
589f483e7b | ||
|
a77f8c9f62 | ||
|
1d7aa9e40b | ||
|
8de4b04819 | ||
|
175dba86fd | ||
|
767b9b9405 | ||
|
202a51d9e3 | ||
|
3014d36a61 | ||
|
d718fda057 | ||
|
bbb7b365d5 | ||
|
740e485160 | ||
|
5a69127862 | ||
|
798883f21a | ||
|
bec71a15b4 | ||
|
c4baf60044 | ||
|
d32081401f | ||
|
ed119ae246 | ||
|
51768d0e16 | ||
|
6f1a4e5bb9 | ||
|
e323d2a93e | ||
|
23922eebf1 | ||
|
92bd85ba30 | ||
|
ca7aa30bc5 | ||
|
d17972427a | ||
|
25f0c81530 | ||
|
4f95d126ba | ||
|
310196cc59 | ||
|
8052bcc69c | ||
|
04ee41d7b0 | ||
|
23af1cd8ad | ||
|
4426194ee6 | ||
|
92c119e12c | ||
|
ff02665407 | ||
|
d471ed5912 | ||
|
b92ca5da02 | ||
|
0f7c0f616c | ||
|
5551f30400 | ||
|
2c10d72fe5 | ||
|
44fe51247c | ||
|
3a99f1e9f1 | ||
|
d233f0ca3e | ||
|
c548bdc3fe | ||
|
839d797292 | ||
|
f8a30ddfc1 | ||
|
bb0eb3af45 | ||
|
999d9bc73b | ||
|
16c7003acb | ||
|
f64045c229 | ||
|
58aebc4447 | ||
|
3b3b6036f8 | ||
|
75748f4ae9 | ||
|
f90fb68aec | ||
|
4fa3943e51 | ||
|
0a92f741b3 | ||
|
a35f8d52d6 | ||
|
b08ccc0bec | ||
|
523cd0dff7 | ||
|
8ac1806015 | ||
|
0b2275774f | ||
|
4fbfe9b041 | ||
|
b6c848d711 | ||
|
a467cfd060 | ||
|
f24be8476e | ||
|
904b1815b5 | ||
|
d6322c6389 | ||
|
2ee16e5dd9 | ||
|
f846315a6a | ||
|
5329b7d211 | ||
|
ac18a665d5 | ||
|
c492e71aed | ||
|
4ea1319c6b | ||
|
2aac3c2cc9 | ||
|
55d18bdc06 | ||
|
abefa0ab00 | ||
|
ea28dc8cff | ||
|
d3b9eb7fc8 | ||
|
cdb61923af | ||
|
070ddcd14b | ||
|
355890b421 | ||
|
d86407f263 | ||
|
a24a7db72b | ||
|
2096a29b06 | ||
|
ce352b5538 | ||
|
4bcd2c75cc | ||
|
3c3bf0192d | ||
|
cf84d999d8 | ||
|
668628941e | ||
|
33f8fa331d | ||
|
7814d1fd75 | ||
|
b57c3008a3 | ||
|
99d291eb69 | ||
|
8e35398371 | ||
|
3313fd4e2b | ||
|
56c02dd7d1 | ||
|
4e4ed1e2d5 | ||
|
82aa2cb5c2 | ||
|
e9944148d5 | ||
|
afa4eb7d35 | ||
|
55597d88a4 | ||
|
ac37b589b6 | ||
|
b9d868b8eb | ||
|
30e5bfcbf0 | ||
|
57e21683a6 | ||
|
852ecf7c20 | ||
|
5976debfcd | ||
|
08fcba63d0 | ||
|
1abe9760ab | ||
|
9a4d8453ed | ||
|
b637c3e201 | ||
|
292f54dd60 | ||
|
1328c1409a | ||
|
dbeddd4417 | ||
|
add5dec4a9 | ||
|
97b51dc070 | ||
|
88c9a30f77 | ||
|
83035c1d4b | ||
|
50c19a6534 | ||
|
5c071cb02e | ||
|
6edb526561 | ||
|
ee18156675 | ||
|
e70a961ac1 | ||
|
ffdc8c8f60 | ||
|
fd78bd3eaf | ||
|
f2ccba0988 | ||
|
8ee465c630 | ||
|
31b655c9eb | ||
|
7fd65cc3c1 | ||
|
8089222fc3 | ||
|
0667bd39fb | ||
|
a4854dfa9e | ||
|
6c54d0a7e2 | ||
|
341860eb4d | ||
|
876445f080 | ||
|
03ef6a7719 | ||
|
fde8c6df79 | ||
|
6c06e1855e | ||
|
c60ae0b575 | ||
|
e58f9ea1b4 | ||
|
2960bb7cb2 | ||
|
161c0f0963 | ||
|
3002591d08 | ||
|
1b2b9726f8 | ||
|
a3691d311b | ||
|
89d449352f | ||
|
e220e6dae7 | ||
|
bd3d1f7715 | ||
|
f3ffa99f6a | ||
|
3d55d733dc | ||
|
582dba54b1 | ||
|
0775432ed9 | ||
|
d9e15ff6e9 | ||
|
c04edfc76e | ||
|
71d6392572 | ||
|
dbd16cd9da | ||
|
950d266894 | ||
|
884974eeaa | ||
|
e836166664 | ||
|
c1a99bf901 | ||
|
f9c9a03404 | ||
|
3a337824e6 | ||
|
7dab23e38a | ||
|
78935ec83c | ||
|
b8989b7ff6 | ||
|
96cd47d0a0 | ||
|
d6a6cfe6c5 | ||
|
501356116d | ||
|
e11e5525db | ||
|
16431da3f2 | ||
|
842949fcf3 | ||
|
3d3e935c91 | ||
|
d5ae94ca5d | ||
|
87e9c940a4 | ||
|
6a02fa4be8 | ||
|
9f548efd32 | ||
|
9eebe8e547 | ||
|
f9612533c2 | ||
|
c9c0d444a2 | ||
|
13a8704f51 | ||
|
f20714262c | ||
|
11ffeeb55c | ||
|
85830c059e | ||
|
ffc89e40a0 | ||
|
1c92f2d963 | ||
|
12e0ec0b48 | ||
|
5574bf59f6 | ||
|
7ee27cc0ad | ||
|
040974c8a2 | ||
|
126d689086 | ||
|
8e676c7360 | ||
|
84847e46fa | ||
|
3fca84f974 | ||
|
2be48a8f86 | ||
|
389d246af8 | ||
|
9e0f41bd05 | ||
|
564a237454 | ||
|
86b59ba643 | ||
|
487e568722 | ||
|
67080dab21 | ||
|
0809e6585d | ||
|
809b98c96e | ||
|
059af1365a | ||
|
fbcffb36c8 | ||
|
3af0cfb53b | ||
|
96422fcf52 | ||
|
2754f2be2d | ||
|
6435d5083a | ||
|
3d802177be | ||
|
a02d4ba2a1 | ||
|
249cf0833c | ||
|
20b00d3947 | ||
|
269dcaaadf | ||
|
322bbd2376 | ||
|
52bec248ce | ||
|
9f71528a05 | ||
|
65e02a3bae | ||
|
defc4d335e | ||
|
bdcfcfa5b9 | ||
|
4a94c91772 | ||
|
cc3ed89e34 | ||
|
f0925e4ef2 | ||
|
df87b1820b | ||
|
87e8265a2d | ||
|
9fd6d431e3 | ||
|
5059ae1d7b | ||
|
50bb42f0f3 | ||
|
d71a7c901d | ||
|
65f727731c | ||
|
ff60b19e4b | ||
|
b8f12c5d28 | ||
|
bfb779ac2f | ||
|
84c28d2efb | ||
|
06372c5f2a | ||
|
3d75292c4d | ||
|
541ffbe4b5 | ||
|
17524f2794 | ||
|
1040d7c7e4 | ||
|
1b53359cd3 | ||
|
1987738d16 | ||
|
b8890ca27d | ||
|
2e7916cf4f | ||
|
24cf5b6df8 | ||
|
214f5a6f98 | ||
|
50ea9450ea | ||
|
d2028c7323 | ||
|
76c1ea0449 | ||
|
a97f378d64 | ||
|
ffe82b7641 | ||
|
785709d51c | ||
|
8406c34166 | ||
|
2ee1f3e8cf | ||
|
1373a7a6f0 | ||
|
a5aac30843 | ||
|
3149493679 | ||
|
a60cda3daa | ||
|
660c6c8d6f | ||
|
ad679187d3 | ||
|
b769295682 | ||
|
6649af5ec6 | ||
|
ca7094296c | ||
|
15a09c79f9 | ||
|
e2a7dc5427 | ||
|
170f099ce1 | ||
|
d301d16aee | ||
|
ec489e673c | ||
|
a904da12b7 | ||
|
91865d172b | ||
|
adedb89779 | ||
|
514dbcacd4 | ||
|
25c812fa87 | ||
|
45e76c1604 | ||
|
a9c3163a64 | ||
|
a8bb71383a | ||
|
3b08f8026e | ||
|
2cdc2287a5 | ||
|
c80c4ee75c | ||
|
082691ba16 | ||
|
d09a610433 | ||
|
ea9f8b2f77 | ||
|
e2d337740f | ||
|
45c5b250b9 | ||
|
f4b35093bd | ||
|
5e52cefb28 | ||
|
bf43aee690 | ||
|
62f359a494 | ||
|
cbe09373a5 | ||
|
b3451dda04 | ||
|
d477bf3d93 | ||
|
12c7f2d4fd | ||
|
feca09b8a4 | ||
|
150f57f706 | ||
|
33131ad24d | ||
|
d53b3f9941 | ||
|
da07f1221f | ||
|
9aed7ab25f | ||
|
5ae225fe52 | ||
|
cc8fa39110 | ||
|
c673a0bcc3 | ||
|
efc6d15dde | ||
|
50403fbca8 | ||
|
7de91d1777 | ||
|
6f9a70bd4e | ||
|
de1dfb99bc | ||
|
103296d948 | ||
|
0001562850 | ||
|
1f3c88b995 | ||
|
5e7f227d92 | ||
|
6bbda619f9 | ||
|
e216fa3b6d | ||
|
c9443dd04d | ||
|
29cb5051d4 | ||
|
5f2e70df8e | ||
|
d8775d0194 | ||
|
8d87ed1a6a | ||
|
a46bcc2755 | ||
|
229edc5225 | ||
|
b1962de51a | ||
|
fb10b61528 | ||
|
e415ec9ca5 | ||
|
226652edb0 | ||
|
64f4967867 | ||
|
c37fa3a895 | ||
|
d907c0a42e | ||
|
4255230e36 | ||
|
d8a0915ada | ||
|
32b348776e | ||
|
bbe552d6a8 | ||
|
ccc6f7c24e | ||
|
41b21b6634 | ||
|
b46a900d71 | ||
|
cfc871f031 | ||
|
b435f3c543 | ||
|
ebc4bb2363 | ||
|
23e4c788fa | ||
|
4e0a64c46c | ||
|
e46e61643c | ||
|
cc5526e019 | ||
|
e6cafa890d | ||
|
293d2fd19f | ||
|
7bca467e01 | ||
|
40e25218e2 | ||
|
9e27acb0a6 | ||
|
67b9fb43d0 | ||
|
762b981dfe | ||
|
5e027ae5d9 | ||
|
7dd3680d7d | ||
|
14a7b4b4b4 | ||
|
f5096fd11a | ||
|
9c5ac13301 | ||
|
ecc33d6e62 | ||
|
03c34021af | ||
|
1b2156493b | ||
|
7b76170f46 | ||
|
8109e8e3b6 | ||
|
163278af0d | ||
|
677b6c1a81 | ||
|
1331a10e88 | ||
|
dc9f0869b1 | ||
|
ea6253c1df | ||
|
b481fd854f | ||
|
68baa93460 | ||
|
52db54e803 | ||
|
71e412e8f8 | ||
|
9644fc2e8f | ||
|
0795d86df7 | ||
|
21988ea700 | ||
|
23081d2bc4 | ||
|
b1e441d18a | ||
|
a118cbb3ff | ||
|
4639b3bc4c | ||
|
821eb92dfb | ||
|
0370043775 | ||
|
82bcc05ca1 | ||
|
527852e1b8 | ||
|
2e1686091f | ||
|
5353e28dca | ||
|
b58e89f380 | ||
|
c1e008fa86 | ||
|
c47a3c54fd | ||
|
3bc1e0534f | ||
|
7fb11dfeb0 | ||
|
6d09eed90e | ||
|
496211727d | ||
|
ee5e3b5927 | ||
|
2087595747 | ||
|
25268c2086 | ||
|
2a9056b49e | ||
|
46363b617e | ||
|
adb3baa7d2 | ||
|
31a79fbd9f | ||
|
d8919311b1 | ||
|
0e0158a825 | ||
|
619926ec83 | ||
|
1afb832ff0 | ||
|
823b529f89 | ||
|
4707784755 | ||
|
1ebcd27605 | ||
|
300639e537 | ||
|
ad218f0786 | ||
|
4966f8cdf8 | ||
|
1580490670 | ||
|
3cf5e8cf4e | ||
|
d21ac80178 | ||
|
effbaa7770 | ||
|
a9a61abc81 | ||
|
e5b05424c8 | ||
|
8f920101f3 | ||
|
1c59474f45 | ||
|
9be7104b71 | ||
|
31e0ec71f2 | ||
|
6c33afc13c | ||
|
03daf42fb5 | ||
|
b33b68ef75 | ||
|
0ee8ca43d1 | ||
|
77da45a173 | ||
|
5e1c3c5d69 | ||
|
05953a20cc | ||
|
3c8a93b972 | ||
|
11543a229a | ||
|
d448e12cf4 | ||
|
fee4ad0174 | ||
|
38f01cf1f2 | ||
|
37bea9d162 | ||
|
b241fcd418 | ||
|
4fa661b450 | ||
|
86e735cd5c | ||
|
4c40395a38 | ||
|
d32fd76b31 | ||
|
5f8e83d75d | ||
|
b08a17064e | ||
|
3f39cb38c4 | ||
|
2031ec1b57 | ||
|
533aaba5eb | ||
|
72c782af17 | ||
|
af8a3eff10 | ||
|
ee7ba54a7f | ||
|
53d99f5521 | ||
|
52d2975af3 | ||
|
926a651f12 | ||
|
7aeab7a63f | ||
|
a2389b3169 | ||
|
54e5cc296f | ||
|
457fd68168 | ||
|
2d69f35e0e | ||
|
648c780e91 | ||
|
f36618f02a | ||
|
8548a1dd7f | ||
|
5e1d58c41c | ||
|
a61d7f3864 | ||
|
c7fcaaf443 | ||
|
6d263f8680 | ||
|
d9ab6495ef | ||
|
ceac0ce9aa | ||
|
e975d6db17 | ||
|
d54b68b93c | ||
|
761346ed5a | ||
|
6d71dd0025 | ||
|
d0e2d9e2f4 | ||
|
b0effee9b3 | ||
|
abb7e85260 | ||
|
3ccd03e226 | ||
|
2ae345aa8f | ||
|
1c1b78aa1c | ||
|
cdb2308ddd | ||
|
c581f722bd | ||
|
340c98c6cd | ||
|
39f5c5bf49 | ||
|
392f6855ca | ||
|
1cae48ab93 | ||
|
25f04f3c37 | ||
|
d0f8ef09a0 | ||
|
0516dca116 | ||
|
ebc6a043c9 | ||
|
8e2ae79875 | ||
|
27ac764653 | ||
|
80df6e2b8d | ||
|
bfda8cf820 | ||
|
cb91f96fd3 | ||
|
549ec0aac8 | ||
|
5cea9f9e17 | ||
|
a9cce55693 | ||
|
e1152c33c4 | ||
|
e40ad5faa5 | ||
|
dd393a4a0e | ||
|
881954dfca | ||
|
cf12503fec | ||
|
ad757cccb6 | ||
|
b801eae00f | ||
|
2fe9ff7918 | ||
|
c407582096 | ||
|
0fc3dbaa9b | ||
|
77ed264714 | ||
|
a14efce914 | ||
|
08f90a188c | ||
|
df46eeafdb | ||
|
0029286a1e | ||
|
0e46d4eb98 | ||
|
f80e3fff92 | ||
|
504c6ba792 | ||
|
c0aba9aee1 | ||
|
fa33af248e | ||
|
e6cfbc00fc | ||
|
b97cf2b9d9 | ||
|
f81e7b2112 | ||
|
b59e4a929e | ||
|
099d72f037 | ||
|
73acb41931 | ||
|
ebb7fdb099 | ||
|
ec3cb0ad9a | ||
|
7ffef6792f | ||
|
383148dc31 | ||
|
a31601ccfc | ||
|
a587492cad | ||
|
f65d4914e4 | ||
|
88dc49a5b6 | ||
|
91d970e9c5 | ||
|
6c5ae48a05 | ||
|
d85ec2cbb4 | ||
|
527f305690 | ||
|
b05c9c26bd | ||
|
05b79bc378 | ||
|
3ba63315d5 | ||
|
eccdb594eb | ||
|
a78796f22c | ||
|
4fa6f791f4 | ||
|
6287eaa745 | ||
|
2ae13229ea | ||
|
2879d35f3d | ||
|
ab7d969700 | ||
|
e1031ac5ad | ||
|
1b1e7f4296 | ||
|
5a7d7cc9f5 | ||
|
4253bb9922 | ||
|
1bbf5f7a17 | ||
|
9abc83fdad | ||
|
8d5325b816 | ||
|
ad6fd451fb | ||
|
db3b3c62bb | ||
|
dfd181d7d5 | ||
|
de76045939 | ||
|
b707568fc1 | ||
|
16c29a7db5 | ||
|
b5b0002d24 | ||
|
127b92e3db | ||
|
a7ceb8ce66 | ||
|
6dea23128a | ||
|
5297c5f2ee | ||
|
bdb6b10be8 | ||
|
7f9031eae8 | ||
|
aa746bc0c8 | ||
|
01ca59ea91 | ||
|
2f4e19d514 | ||
|
8d5224eba7 | ||
|
c8436d3c1e | ||
|
1273413c7b | ||
|
ef3f48a2be | ||
|
4b1bca8b6e | ||
|
2478dd8322 | ||
|
4c1edd3881 | ||
|
14541480ae | ||
|
fff78b60e9 | ||
|
9abc7fc80b | ||
|
d8059ebdd2 | ||
|
1001445d3e | ||
|
fff72cf322 | ||
|
fd9306a282 | ||
|
7c0c2a8085 | ||
|
b5b58ced2a | ||
|
8c988a7b07 | ||
|
e68f58940c | ||
|
4f2b639a24 | ||
|
3e01924ca3 | ||
|
3841ae935c | ||
|
4d2884bde7 | ||
|
a4a7255216 | ||
|
6065165060 | ||
|
61c22d1c72 | ||
|
efacf2ff09 | ||
|
9272bf96f6 | ||
|
ae3efb2d2f | ||
|
b9ecae84f5 | ||
|
cd3286c71a | ||
|
83c2766e3f | ||
|
5f719c8ea3 | ||
|
555f7d5404 | ||
|
73b2913be3 | ||
|
3bcfc5539c | ||
|
4cfcc7e521 | ||
|
3221a8bdab | ||
|
930f059f5e | ||
|
bd3e596243 | ||
|
9a6e61e510 | ||
|
56d2d65e25 | ||
|
ae08963acc | ||
|
ed4f51436c | ||
|
7837354c6c | ||
|
a203a28de0 | ||
|
5dc6f134c5 | ||
|
6daeb7e504 | ||
|
fcf59ad135 | ||
|
1dd905d976 | ||
|
155f7cdeec | ||
|
960967623a | ||
|
3c963f65a2 | ||
|
168203ab0c | ||
|
f2fff53169 | ||
|
f74b8f715a | ||
|
aeac2b547f | ||
|
827aa9ca05 | ||
|
95c21acec1 | ||
|
4d035dce5d | ||
|
7f6dce1c22 | ||
|
58568a36ce | ||
|
9c2a2f01b7 | ||
|
657e536941 | ||
|
a81b6ea6af | ||
|
1887504666 | ||
|
8a61b01c06 | ||
|
6d564075f3 | ||
|
4cdf7aa65a | ||
|
329dc9e0cf | ||
|
e02de45537 | ||
|
29fbda49bb | ||
|
1b155341bd | ||
|
96c02c1eb4 | ||
|
116d662e0f | ||
|
d81cd4751f | ||
|
dd33068943 | ||
|
09c1e51b8a | ||
|
af9a9422c4 | ||
|
df3c85ea7f | ||
|
b14a115fc0 | ||
|
355a88d002 | ||
|
1014b3d972 | ||
|
1a2b1575d6 | ||
|
cc25fdf602 | ||
|
444eb2630c | ||
|
9c032bec89 | ||
|
5a59548d72 | ||
|
39913c2001 | ||
|
a858736516 | ||
|
880c33a777 | ||
|
c32ab9440d | ||
|
3a97b44321 | ||
|
2f18d5584d | ||
|
287b27dad3 | ||
|
33f0f2a2b1 | ||
|
bf6ba18048 | ||
|
058252e895 | ||
|
c594de8302 | ||
|
8eaf05a3ef | ||
|
9736bea29f | ||
|
ea392cf2b6 | ||
|
b0f8550b01 | ||
|
ba05963729 | ||
|
f14f7e7df6 | ||
|
daa97d4b79 | ||
|
4822b85cb0 | ||
|
7f61d7ac8b | ||
|
010ca5feef | ||
|
31a907be35 | ||
|
ab37fed974 | ||
|
10a7650411 | ||
|
fc4c6525e6 | ||
|
d7308f2d73 | ||
|
ead566b841 | ||
|
ecc2e02453 | ||
|
012c4b9425 | ||
|
be8fef9811 | ||
|
2938b48939 | ||
|
16c2e0a642 | ||
|
017510ea5f | ||
|
c43c0275e3 | ||
|
df5d233155 | ||
|
a8238c2251 | ||
|
c12d1fe29c | ||
|
347cdc63f8 | ||
|
32625381fa | ||
|
350f9e2636 | ||
|
4d9d50d8e1 | ||
|
106db1a9be | ||
|
e6d22fd8df | ||
|
8e2de53c3f | ||
|
0057af3668 | ||
|
7f7e4ab69e | ||
|
db4f60cc9d | ||
|
77cf390727 | ||
|
dcadf1422b | ||
|
53ac80d6c8 | ||
|
2e9fcdad6e | ||
|
0f55b3bc18 | ||
|
9c249fefc3 | ||
|
eae7ee6c25 | ||
|
bf7f302ff5 | ||
|
0d6981bd54 | ||
|
148d7bcc25 | ||
|
71161b6352 | ||
|
dd33a2f280 | ||
|
9d48d684a5 | ||
|
eb252d33a9 | ||
|
40bdf7e0d4 | ||
|
6aba047ace | ||
|
554045de6e | ||
|
fa42081556 | ||
|
54d0bcab71 | ||
|
3539128d42 | ||
|
372c68a1c9 | ||
|
f9856d547f | ||
|
d0d8f6b5ee | ||
|
28c91bf767 | ||
|
a8bfe4e6f2 | ||
|
1f076432db | ||
|
b6e79a7234 | ||
|
68b05cadd8 | ||
|
93c5fb0b31 | ||
|
cfdbf95cb6 | ||
|
b80e33b209 | ||
|
9f7254a2d0 | ||
|
00e59c385e | ||
|
43c2b53811 | ||
|
c645acc214 | ||
|
33d87bc22e | ||
|
a35f9102f2 | ||
|
525d773a30 | ||
|
d22812ae35 | ||
|
1dc70ebb07 | ||
|
297e4f6134 | ||
|
4e73297cb8 | ||
|
8fe16190b9 | ||
|
047ab10a5c | ||
|
3c8e9231ea | ||
|
cb9c57f223 | ||
|
253e8f0d64 | ||
|
4aee2c3c41 | ||
|
2641aad318 | ||
|
346fcdb405 | ||
|
9564e4c178 | ||
|
50dd958890 | ||
|
9126bf2c9d | ||
|
a692f0cb07 | ||
|
2bbfa92504 | ||
|
0e74355782 | ||
|
be137358f1 | ||
|
d9564df6a7 | ||
|
3f9ad44948 | ||
|
c73ff197e0 | ||
|
1ad1a13085 | ||
|
50e3a37b7a | ||
|
7d3970546c | ||
|
3d739c6a15 | ||
|
16692f9f5e | ||
|
4f453ab521 | ||
|
72a4fae8dc | ||
|
36c7d05445 | ||
|
f3d5683f67 | ||
|
120887979d | ||
|
77434fc9f9 | ||
|
830846b39c | ||
|
3073704010 | ||
|
e165dcf78d | ||
|
2d2fc59597 | ||
|
89020892a8 | ||
|
653f4d4183 | ||
|
d998d703ff | ||
|
43bec39794 | ||
|
e2067e3703 | ||
|
0e19a7d024 | ||
|
cdd0aa4cfd | ||
|
157c714d86 | ||
|
4873bb3099 | ||
|
7207810ce4 | ||
|
f072ff3861 | ||
|
3f05b17d37 | ||
|
4fef3c157a | ||
|
38602823bb | ||
|
6e02b9d5bc | ||
|
03337534f9 | ||
|
613a004d18 | ||
|
6fa23794fc | ||
|
82027bb51e | ||
|
9e5ce813c4 | ||
|
b7f3beda00 | ||
|
f4509a63b0 | ||
|
29559deeeb | ||
|
0cff62335b | ||
|
e4325e5b2b | ||
|
f57010180c | ||
|
5807b68d5b | ||
|
1af746e136 | ||
|
d3c78c8811 | ||
|
28a4f7a60a | ||
|
d54a9d241d | ||
|
8814c00573 | ||
|
36b55a8b57 | ||
|
e027843cb0 | ||
|
5de0ebab26 | ||
|
cc463d52f6 | ||
|
eeca361418 | ||
|
bdf56ec6d6 | ||
|
ee9e302b24 | ||
|
17b50f08b3 | ||
|
d58297fa15 | ||
|
c27516a1db | ||
|
cf4cd4abd8 | ||
|
a4cc95b293 | ||
|
a8bb6d5918 | ||
|
496c75617c | ||
|
6b14f221c1 | ||
|
9948e0a564 | ||
|
c89e029223 | ||
|
0ca569baab | ||
|
40b13bfa35 | ||
|
1df3c87ed5 | ||
|
0b57bd5a53 | ||
|
5df9b1cb5b | ||
|
f5b7e131d6 | ||
|
51012c1802 | ||
|
b5c1e77d4c | ||
|
85149445e0 | ||
|
61d0043f9c | ||
|
5c97089e59 | ||
|
6f5c610858 | ||
|
a05dd4d194 | ||
|
b1a840bec0 | ||
|
31fabecddd | ||
|
96cb38dd05 | ||
|
b672dabee8 | ||
|
5fbdec2a29 | ||
|
f22ae99b98 | ||
|
3be7ef17ff | ||
|
146422fabd | ||
|
a274a5ff4b | ||
|
d1d4d80a1d | ||
|
167d32811d | ||
|
6ec4a2a4a5 | ||
|
a11abf57e1 | ||
|
a63a201812 | ||
|
f09caced9b | ||
|
01cd2fe4bb | ||
|
45b93644b7 | ||
|
76a80d8f45 | ||
|
153b8399f7 | ||
|
da41271dd5 | ||
|
5610af1b77 | ||
|
8da70fec91 | ||
|
f9cd30a859 | ||
|
763d620a23 | ||
|
500a3a6dee | ||
|
57073e1057 | ||
|
6bbfd2f62a | ||
|
6c69a96cd7 | ||
|
fa247d5a84 | ||
|
0320c4ac14 | ||
|
36993ac707 | ||
|
2f93eb4a28 | ||
|
5a2982ac31 | ||
|
441b704afd | ||
|
abf6ebd7fe | ||
|
34fb08af6e | ||
|
0b9dfdd41f | ||
|
701e0812e4 | ||
|
4918a46172 | ||
|
ef5e3fae64 | ||
|
9fcf55571e | ||
|
260898ecf6 | ||
|
66c9132abe | ||
|
c5abdfb72b | ||
|
4fe37847ba | ||
|
c99a0b0518 | ||
|
31f3edec5c | ||
|
dee372c08e | ||
|
8c0a4e5a6e | ||
|
7195514fb5 | ||
|
420bd5bc16 | ||
|
f024ee1adf | ||
|
18c2c71cd5 | ||
|
2d1bfc84b9 | ||
|
8edfa759fb | ||
|
2d1e978599 | ||
|
d71fc41152 | ||
|
d141cb7b72 | ||
|
b19cf5998f | ||
|
7010067884 | ||
|
0ec29c4176 | ||
|
42c6e0249f | ||
|
54eb85f814 | ||
|
18b3b4feed | ||
|
0045ac839b | ||
|
a9da807de3 | ||
|
366639b7e4 | ||
|
7d2e2171be | ||
|
e3ceda15ac | ||
|
7291a21a85 | ||
|
888afe3e46 | ||
|
171bfde133 | ||
|
82d1fdb714 | ||
|
82b19daa7e | ||
|
dc1ff3c2e3 | ||
|
6602ac5eae | ||
|
5dab5bf0e9 | ||
|
721be8fe9f | ||
|
58fe590eae | ||
|
c18a7ff5cf | ||
|
24fc38b287 | ||
|
aa03c50f05 | ||
|
03e971b2e3 | ||
|
a595133b77 | ||
|
e50f4ecccf | ||
|
67913e4af0 | ||
|
b3d1795327 | ||
|
6edcc8f256 | ||
|
d5e5f47666 | ||
|
0524c40640 | ||
|
b5fd894f77 | ||
|
d8492121aa | ||
|
4a0bf603d7 | ||
|
02fa89df9e | ||
|
5b6dde9a73 | ||
|
e9d8ebdfc9 | ||
|
366efc3d61 | ||
|
3b890fd3c1 | ||
|
5de373a14b | ||
|
24cb9d2437 | ||
|
83aa176466 | ||
|
0e94e5ecda | ||
|
130485a583 | ||
|
f34c10abb5 | ||
|
48b00f0ac1 | ||
|
743329a3af | ||
|
f5783f1637 | ||
|
67f61a8d39 | ||
|
f7df663dea | ||
|
c99278aa58 | ||
|
1765e1b7c2 | ||
|
bf1a434d5c | ||
|
9256b5b552 | ||
|
577e4afb3c | ||
|
2a05c04db7 | ||
|
a6ffd6b3b2 | ||
|
24eba7c4c1 | ||
|
80de844922 | ||
|
a2223c0884 | ||
|
5ffa2b757c | ||
|
b660fa27d3 | ||
|
77f0e5e1ba | ||
|
32a4f805b8 | ||
|
4da8d39ec5 |
@@ -26,7 +26,8 @@ variables:
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Dbuild-testsuite=true -Dintrospection=enabled"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v49"
|
||||
MESON_TEST_MAX_PROCESSES: 8
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v52"
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
@@ -67,7 +68,6 @@ style-check-diff:
|
||||
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland_gl.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-wayland_gles2.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
@@ -117,10 +117,12 @@ release-build:
|
||||
EXTRA_MESON_FLAGS: "--buildtype=release"
|
||||
script:
|
||||
- .gitlab-ci/show-info-linux.sh
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
- mkdir _install
|
||||
# don't use catch by default, since it causes sporadic test failures
|
||||
# - export PATH="$HOME/.local/bin:${CI_PROJECT_DIR}/_install/bin:$PATH"
|
||||
# - .gitlab-ci/install-meson-project.sh --prefix ${CI_PROJECT_DIR}/_install https://gitlab.gnome.org/jadahl/catch.git main
|
||||
- meson subprojects download
|
||||
- meson subprojects update --reset
|
||||
- mkdir _install
|
||||
- meson setup
|
||||
--prefix=${CI_PROJECT_DIR}/_install
|
||||
${COMMON_MESON_FLAGS}
|
||||
@@ -133,8 +135,6 @@ release-build:
|
||||
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
|
||||
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
|
||||
- .gitlab-ci/run-tests.sh _build wayland gtk
|
||||
# only repeat test runs that are likely affected by test setups
|
||||
- .gitlab-ci/run-tests.sh _build wayland_gles2 gtk:gdk,gtk:gsk-gl
|
||||
|
||||
fedora-clang:
|
||||
extends: .build-fedora-default
|
||||
@@ -413,11 +413,12 @@ static-scan:
|
||||
# Run tests with the address sanitizer. We need to turn off introspection
|
||||
# and f16c, since they are incompatible with asan
|
||||
asan-build:
|
||||
image: $FEDORA_IMAGE
|
||||
extends: .build-fedora-default
|
||||
tags: [ asan ]
|
||||
stage: analysis
|
||||
needs: []
|
||||
variables:
|
||||
MESON_TEST_MAX_PROCESSES: 4
|
||||
script:
|
||||
- export PATH="$HOME/.local/bin:$PATH"
|
||||
- CC=clang meson setup
|
||||
@@ -445,9 +446,10 @@ reference:
|
||||
--force-fallback-for=gdk-pixbuf,pango
|
||||
-Dintrospection=enabled
|
||||
-Ddocumentation=true
|
||||
-Dman-pages=true
|
||||
-Dgdk-pixbuf:gtk_doc=true
|
||||
-Dpango:documentation=true
|
||||
-Dbuild-demos=false
|
||||
-Dbuild-demos=true
|
||||
-Dbuild-examples=false
|
||||
-Dbuild-tests=false
|
||||
-Dbuild-testsuite=false
|
||||
|
@@ -1,4 +1,4 @@
|
||||
FROM fedora:39
|
||||
FROM fedora:40
|
||||
|
||||
RUN dnf -y install \
|
||||
adwaita-icon-theme \
|
||||
@@ -99,8 +99,11 @@ RUN dnf -y install \
|
||||
which \
|
||||
wireplumber \
|
||||
xorg-x11-server-Xvfb \
|
||||
&& dnf -y update \
|
||||
&& dnf clean all
|
||||
|
||||
RUN rm /usr/share/vulkan/icd.d/powervr_mesa_icd.x86_64.json
|
||||
|
||||
# Enable sudo for wheel users
|
||||
RUN sed -i -e 's/# %wheel/%wheel/' -e '0,/%wheel/{s/%wheel/# %wheel/}' /etc/sudoers
|
||||
|
||||
|
91
.gitlab-ci/install-meson-project.sh
Executable file
91
.gitlab-ci/install-meson-project.sh
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat <<-EOF
|
||||
Usage: $(basename $0) [OPTION…] REPO_URL COMMIT
|
||||
|
||||
Check out and install a meson project
|
||||
|
||||
Options:
|
||||
-Dkey=val Option to pass on to meson
|
||||
--prefix Prefix to install to
|
||||
--subdir Build subdirectory instead of whole project
|
||||
--prepare Script to run before build
|
||||
|
||||
-h, --help Display this help
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
TEMP=$(getopt \
|
||||
--name=$(basename $0) \
|
||||
--options='D:h' \
|
||||
--longoptions='prefix:' \
|
||||
--longoptions='subdir:' \
|
||||
--longoptions='prepare:' \
|
||||
--longoptions='help' \
|
||||
-- "$@")
|
||||
|
||||
eval set -- "$TEMP"
|
||||
unset TEMP
|
||||
|
||||
MESON_OPTIONS=()
|
||||
PREFIX=/usr
|
||||
SUBDIR=.
|
||||
PREPARE=:
|
||||
|
||||
while true; do
|
||||
case "$1" in
|
||||
-D)
|
||||
MESON_OPTIONS+=( -D$2 )
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--prefix)
|
||||
PREFIX=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--subdir)
|
||||
SUBDIR=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
--prepare)
|
||||
PREPARE=$2
|
||||
shift 2
|
||||
;;
|
||||
|
||||
-h|--help)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ $# -lt 2 ]]; then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
REPO_URL="$1"
|
||||
COMMIT="$2"
|
||||
|
||||
CHECKOUT_DIR=$(mktemp --directory)
|
||||
trap "rm -rf $CHECKOUT_DIR" EXIT
|
||||
|
||||
git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
|
||||
|
||||
pushd "$CHECKOUT_DIR/$SUBDIR"
|
||||
sh -c "$PREPARE"
|
||||
meson setup --prefix "$PREFIX" _build "${MESON_OPTIONS[@]}"
|
||||
meson compile -C _build
|
||||
meson install -C _build
|
||||
popd
|
@@ -8,17 +8,19 @@ builddir=$1
|
||||
setup=$2
|
||||
suite=$3
|
||||
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
|
||||
n_processes=${MESON_TEST_MAX_PROCESSES:-1}
|
||||
|
||||
# Ignore memory leaks lower in dependencies
|
||||
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:detect_leaks=0:allocator_may_return_null=1
|
||||
export G_SLICE=always-malloc
|
||||
|
||||
case "${setup}" in
|
||||
x11*)
|
||||
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
|
||||
dbus-run-session -- \
|
||||
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
|
||||
meson test -C ${builddir} \
|
||||
--quiet \
|
||||
--timeout-multiplier "${multiplier}" \
|
||||
--num-processes "${n_processes}" \
|
||||
--print-errorlogs \
|
||||
--setup=${setup} \
|
||||
--suite=${suite//,/ --suite=} \
|
||||
@@ -40,9 +42,11 @@ case "${setup}" in
|
||||
compositor=$!
|
||||
export WAYLAND_DISPLAY=wayland-5
|
||||
|
||||
meson test -C ${builddir} \
|
||||
dbus-run-session -- \
|
||||
meson test -C ${builddir} \
|
||||
--quiet \
|
||||
--timeout-multiplier "${multiplier}" \
|
||||
--num-processes "${n_processes}" \
|
||||
--print-errorlogs \
|
||||
--setup=${setup} \
|
||||
--suite=${suite//,/ --suite=} \
|
||||
@@ -63,9 +67,11 @@ case "${setup}" in
|
||||
server=$!
|
||||
export BROADWAY_DISPLAY=:5
|
||||
|
||||
meson test -C ${builddir} \
|
||||
dbus-run-session -- \
|
||||
meson test -C ${builddir} \
|
||||
--quiet \
|
||||
--timeout-multiplier "${multiplier}" \
|
||||
--num-processes "${n_processes}" \
|
||||
--print-errorlogs \
|
||||
--setup=${setup} \
|
||||
--suite=${suite//,/ --suite=} \
|
||||
|
@@ -34,7 +34,9 @@
|
||||
<!--
|
||||
- Which version of GTK you are using
|
||||
- What operating system and version
|
||||
- For Linux, which distribution
|
||||
- What windowing system (X11 or Wayland)
|
||||
- What graphics driver / mesa version
|
||||
- For Linux, which distribution
|
||||
- If you built GTK yourself, the list of options used to configure the build
|
||||
-->
|
||||
|
||||
|
@@ -100,14 +100,16 @@ development tools appropriate for your operating system, including:
|
||||
- Meson
|
||||
- Ninja
|
||||
- Gettext (19.7 or newer)
|
||||
- a [C99 compatible compiler](https://wiki.gnome.org/Projects/GLib/CompilerRequirements)
|
||||
- a [C99 compatible compiler][glib-toolchain-reqs]
|
||||
|
||||
Up-to-date instructions about developing GNOME applications and libraries
|
||||
can be found on [the GNOME Developer Center](https://developer.gnome.org).
|
||||
|
||||
The GTK project uses GitLab for code hosting and for tracking issues. More
|
||||
information about using GitLab can be found [on the GNOME
|
||||
wiki](https://wiki.gnome.org/GitLab).
|
||||
information about using GitLab can be found on [the GNOME handbook][handbook].
|
||||
|
||||
[glib-toolchain-reqs]: https://gitlab.gnome.org/GNOME/glib/-/blob/main/docs/toolchain-requirements.md
|
||||
[handbook]: https://handbook.gnome.org/infrastructure/gitlab.html
|
||||
|
||||
### Dependencies
|
||||
|
||||
@@ -131,7 +133,7 @@ GTK will attempt to download and build some of these dependencies if it
|
||||
cannot find them on your system.
|
||||
|
||||
Additionally, you may want to look at projects that create a development
|
||||
environment for you, like [jhbuild](https://wiki.gnome.org/HowDoI/Jhbuild)
|
||||
environment for you, like [jhbuild](https://gitlab.gnome.org/GNOME/jhbuild)
|
||||
and [gvsbuild](https://github.com/wingtk/gvsbuild).
|
||||
|
||||
### Getting started
|
||||
|
418
NEWS
418
NEWS
@@ -1,6 +1,422 @@
|
||||
Overview of Changes in 4.15.2, xx-xx-xxxx
|
||||
Overview of Changes in 4.17.0, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
|
||||
Overview of Changes in 4.16.2, 09-25-2024
|
||||
=========================================
|
||||
|
||||
* GtkLabel:
|
||||
- Fix centered text in RTL
|
||||
|
||||
* Gsk:
|
||||
- Speed up some Vulkan operations
|
||||
- Improve startup speed by avoiding initialization
|
||||
of GL and Vulkan in most cases
|
||||
- Reduce critials at startup to warnings
|
||||
- Fix a crash on startup with some Vulkan drivers
|
||||
- Fix a big texture leak in NGL
|
||||
|
||||
* Gdk:
|
||||
- Speed up memory format conversions
|
||||
|
||||
* Wayland:
|
||||
- Be more careful with mimetypes during DND or copy-paste
|
||||
|
||||
* Tools:
|
||||
- builder-tool: Improve conversion of boxes
|
||||
|
||||
* Translation updates:
|
||||
Brazilian Portuguese
|
||||
Bulgarian
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Georgian
|
||||
German
|
||||
Hebrew
|
||||
Indonesian
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Slovenian
|
||||
Spanish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.16.1, 09-16-2024
|
||||
=========================================
|
||||
|
||||
* GtkFileChooser:
|
||||
- Plug a memory leak
|
||||
|
||||
* GtkCalendar:
|
||||
- Avoid ending up with invalid dates
|
||||
|
||||
* Printing:
|
||||
- Fix initial printer selection in the print dialog
|
||||
|
||||
* Gsk:
|
||||
- Fix shadows for opaque textures
|
||||
- Fix a crash in a corner case
|
||||
|
||||
* Css:
|
||||
- Make relative paths work again in theme files
|
||||
|
||||
* Accessibility:
|
||||
- Fix detection of the Flatpak portal
|
||||
|
||||
* MacOS:
|
||||
- Fix keyboard input in popovers
|
||||
- Keep DND icons above regular windows
|
||||
- Ignore events from DND icons
|
||||
|
||||
* Translation updates
|
||||
Basque
|
||||
British English
|
||||
Bulgarian
|
||||
Czech
|
||||
Danish
|
||||
Georgian
|
||||
Hungarian
|
||||
Lithuanian
|
||||
Portuguese
|
||||
Spanish
|
||||
Swedish
|
||||
|
||||
|
||||
Overview of Changes in 4.16.0, 09-06-2024
|
||||
=========================================
|
||||
|
||||
Note: This release changes the default GSK renderer to be Vulkan,
|
||||
on Wayland. Other platforms still use ngl. The intent of this change
|
||||
is to use the best available platform APIs. You can still override
|
||||
the renderer choice using the GSK_RENDERER environment variable.
|
||||
|
||||
We believe that most of the problems reported with the new renderers
|
||||
during the 4.13 and 4.15 development cycles have been addressed by now.
|
||||
|
||||
But the new renderers and dmabuf support are using graphics drivers
|
||||
in different ways than the old gl renderer, and trigger new driver bugs.
|
||||
Therefore, it is recommended to use the latest mesa release (24.2)
|
||||
with the new renderers.
|
||||
|
||||
* GtkScale:
|
||||
- Fix positioning of scale values
|
||||
|
||||
* GtkEmojiChooser:
|
||||
- Make Control-clicks work for the recent section
|
||||
|
||||
* GtkPopover:
|
||||
- Make sure focus lands on the right widget when cascading
|
||||
|
||||
* GtkSpinButton:
|
||||
- Disable Emoji input for numeric spin buttons
|
||||
|
||||
* GtkSingleSelection:
|
||||
- Implement unselect_all
|
||||
|
||||
* Accssibility:
|
||||
- Fix roles for radio buttons
|
||||
- Check if ATs are listening before exporting trees
|
||||
- Add a check for sandboxed accessibility bus
|
||||
- Fix handling of the error message relation
|
||||
- Turn criticals into debug messages
|
||||
- Set expanded states properly in menus
|
||||
|
||||
* CSS:
|
||||
- Fix a few issues on bigendian systems
|
||||
- Avoid a crash with relative colors
|
||||
|
||||
* GSK:
|
||||
- Use the right GL context when exporting textures
|
||||
- Don't let colors influence depth decisions
|
||||
- Allow uploading of mipmap levels when tiling textures
|
||||
|
||||
* GDK:
|
||||
- Update keysyms from libX11 1.8.10
|
||||
- Implement cpu-side mipmapping
|
||||
- Use a thread pool for color conversions and mipmapping
|
||||
|
||||
* Vulkan:
|
||||
- Fix drag surface offsets
|
||||
|
||||
* Wayland:
|
||||
- Fix a crash
|
||||
- Associate EGL windows with context later
|
||||
|
||||
* X11:
|
||||
- Fix initial EGL context creation
|
||||
- Fix a problem with GL context creation
|
||||
|
||||
* Broadway:
|
||||
- Implement compute_size and request_layout
|
||||
|
||||
* MacOS:
|
||||
- Set transparent backgroiund for toplevel windows
|
||||
|
||||
* Windows:
|
||||
- Improve debug output
|
||||
- Detect Mesas d3d12 driver and request GDI compat
|
||||
|
||||
* Demos:
|
||||
- Set window icons in demos
|
||||
- Add a 64k x 64k image to the image scaling demo
|
||||
|
||||
* Translation updates
|
||||
Belarusian
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Czech
|
||||
Galician
|
||||
German
|
||||
Hebrew
|
||||
Indonesian
|
||||
Korean
|
||||
Lithuanian
|
||||
Persian
|
||||
Polish
|
||||
Portuguese
|
||||
Slovenian
|
||||
Spanish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.6, 08-26-2024
|
||||
=========================================
|
||||
|
||||
* GtkCheckButton:
|
||||
- Add a grouped style class for radio buttons
|
||||
|
||||
* GtkScale:
|
||||
- Fix alignment and positioning problems
|
||||
|
||||
* Css:
|
||||
- Fix crashes in the variable support
|
||||
|
||||
* Gsk:
|
||||
- Make graphics offloading work better with kwin
|
||||
- Make colorstate transfer functions more robust
|
||||
- GC dead textures more agressively
|
||||
- Only use a single render pass per frame
|
||||
|
||||
* GL:
|
||||
- Round damage rectangles properly
|
||||
- Use the shared context when creating textures
|
||||
- Fix a file descriptor leak in dmabuf export
|
||||
|
||||
* Vulkan:
|
||||
- Round damage rectangles properly
|
||||
|
||||
* Wayland:
|
||||
- Work with the kwin implementation of xx-color-management-v4
|
||||
|
||||
* Windows:
|
||||
- Make gtk_show_uri use SHOpenWithDialog()
|
||||
- Enable incremental rendering with WGL
|
||||
|
||||
* Macos:
|
||||
- Open context menus on Ctrl-left click
|
||||
|
||||
* Debugging:
|
||||
- Show color state information in the inspector
|
||||
- Collect input event traces in the recorder
|
||||
- Add shortcuts for toggling recording: Super-r
|
||||
and for screenshots: Super-c
|
||||
- Split the GDK_DEBUG env var into GDK_DEBUG and GDK_DISABLE
|
||||
- Add GDK_DISABLE=color-mgmt and GDK_DISABLE=offload
|
||||
|
||||
* Tools:
|
||||
- Add a 'Paste as node' action in gtk4-node-editor
|
||||
|
||||
* Translations updates
|
||||
Basque
|
||||
Belarusian
|
||||
Brazilian Portuguese
|
||||
Chinese (China)
|
||||
Georgian
|
||||
Hebrew
|
||||
Hindi
|
||||
Russian
|
||||
Slovenian
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.5, 11-08-2024
|
||||
=========================================
|
||||
|
||||
* GtkTextView:
|
||||
- ADd GtkTextBufferCommitNotify
|
||||
|
||||
* CSS:
|
||||
- Propagate color state information to GSK for many features:
|
||||
colors, borders, shadows, text
|
||||
|
||||
* Gdk:
|
||||
- Fix an fd leak in the Vulkan code
|
||||
- Fix a leak of EGLSurfaces and DMA buffers
|
||||
- Set the opaque region of surfaces automatically based on their content
|
||||
|
||||
* Gsk:
|
||||
- Fix Emoji rendering in Vulkan
|
||||
- Rework color handling to take color states into account
|
||||
- Implement more powerful occlusion culling
|
||||
- Minimize our use of renderpasses
|
||||
|
||||
* Macos:
|
||||
- Fix window transparency
|
||||
|
||||
* Debugging:
|
||||
- The inspector shows details about color states
|
||||
|
||||
* Deprecations:
|
||||
- gdk_draw_context_begin/end_frame
|
||||
- gdk_surface_set_opaque_region
|
||||
|
||||
* Build:
|
||||
- Require gstreamer 1.24
|
||||
|
||||
* Translation updates
|
||||
Romanian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.4, 30-07-2024
|
||||
=========================================
|
||||
|
||||
* GtkPopover:
|
||||
- Fix size allocation with wrapping labels
|
||||
|
||||
* GtkColumnView:
|
||||
- Check column visibility when measuring
|
||||
|
||||
* CSS:
|
||||
- Fix fallout from recent changes
|
||||
- Make implementation of currentcolor inheritance match browsers
|
||||
|
||||
* Gdk:
|
||||
- Introduce GdkColorState for encoding color space information
|
||||
Currently, we support srgb, srgb-linear, rec2100-pq and rec2100-linear
|
||||
- Add color states to GdkTexture, as well as to the texture builder
|
||||
and downloader objects, and convert as necessary
|
||||
- Add GdkMemoryTextureBuilder
|
||||
- Attach color states when loading or saving textures
|
||||
- Add GdkCicpParams to create color state objects for cicp tuples
|
||||
- Drop GDK_DEBUG=vulkan-validate
|
||||
Use VK_INSTEANCE_LAYERS=VK_LAYER_KHRONOS_validation instead
|
||||
|
||||
* Gsk:
|
||||
- Improve caching of glyphs and textures
|
||||
- Remove the uber shader
|
||||
- Numerous bug fixes
|
||||
- Fix corner cases in offload handling
|
||||
- Implement occlusion culling for opaque content
|
||||
- Allow offloading (some) transformed textures
|
||||
- Take colorstate into account when compositing
|
||||
- Add GDK_DEBUG=linear to opt into linear compositing
|
||||
- Implement tiling for large textures
|
||||
- Stop using descriptors and go back to simpler texture
|
||||
management that should work better with older GL
|
||||
- Use correct shader clip mode for glyphs
|
||||
- Improve shadow rendering
|
||||
|
||||
* Media:
|
||||
- Attach color states to textures obtained from gstreamer
|
||||
|
||||
* Wayland:
|
||||
- Allow offloading GL textures via dmabuf export
|
||||
- Suppot the xx-color-management-v4 protocol
|
||||
|
||||
* Deprecations:
|
||||
- GskGLShader and the render node
|
||||
|
||||
* Tools:
|
||||
- Improve the rendernode tool extract command
|
||||
- Add an image tool that is about manipulating textures
|
||||
|
||||
* Build:
|
||||
- GTK now requires a C11 compiler
|
||||
|
||||
* Translation updates
|
||||
Georgian
|
||||
Hebrew
|
||||
Hindi
|
||||
Occitan
|
||||
Slovenian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.3, 29-06-2024
|
||||
=========================================
|
||||
|
||||
* Accessibility:
|
||||
- Only emit notifications when cursor positions change in GtkText
|
||||
- Fix handling of help text properties
|
||||
|
||||
* CSS:
|
||||
- Fix some crashes introduced in recent currentcolor changes
|
||||
|
||||
* DND:
|
||||
- Avoid a critical
|
||||
|
||||
* Documentation:
|
||||
- Fix many oversights and missing docs
|
||||
|
||||
* maxOS:
|
||||
- Add native keyboard shortcuts
|
||||
|
||||
|
||||
Overview of Changes in 4.15.2, 28-06-2024
|
||||
=========================================
|
||||
|
||||
* GtkFileChooserWidget:
|
||||
- Plug some memory leaks
|
||||
- Make Ctrl-Shift-N create a new folder
|
||||
|
||||
* GtkPopover:
|
||||
- Handle resizing and position changes better
|
||||
|
||||
* CSS:
|
||||
- Support color(), oklab(), etc (https://www.w3.org/TR/css-color-4/)
|
||||
- Support color-mix() (https://www.w3.org/TR/css-color-5/)
|
||||
- Support relative colors (https://www.w3.org/TR/css-color-5/)
|
||||
- Support more colorspaces in color()
|
||||
- Allow percentages for opacity
|
||||
- Handle currentcolor more correctly
|
||||
|
||||
* Accessibility:
|
||||
- Avoid markup when reading labels
|
||||
|
||||
* GSK:
|
||||
- Subset fonts when serializing node trees
|
||||
- Make ngl export render_texture results as dmabufs
|
||||
|
||||
* Wayland:
|
||||
- Use xdg-dialog protocol for attached dialogs
|
||||
|
||||
* Windows:
|
||||
- Build with UNICODE
|
||||
|
||||
* macOS:
|
||||
- Implement fullscreen-on-monitor
|
||||
|
||||
* Documentation:
|
||||
- Widget shortcuts and actions are now described in the docs
|
||||
|
||||
* Debugging:
|
||||
- Add GTK_DEBUG=css for warning about deprecated css syntax
|
||||
|
||||
* Tools:
|
||||
- rendernode-tool: Add an extract command for data urls
|
||||
|
||||
* Deprecations:
|
||||
- CSS Color functions shade(), lighter(), darker(), alpha(), mix()
|
||||
|
||||
* Translation updates:
|
||||
Czech
|
||||
Hebrew
|
||||
Serbian
|
||||
|
||||
|
||||
Overview of Changes in 4.15.1, 21-05-2024
|
||||
=========================================
|
||||
|
||||
|
19
README.md
19
README.md
@@ -39,18 +39,21 @@ Nightly documentation can be found at
|
||||
- Gsk: https://gnome.pages.gitlab.gnome.org/gtk/gsk4/
|
||||
|
||||
Nightly flatpaks of our demos can be installed from the
|
||||
[GNOME Nightly](https://wiki.gnome.org/Apps/Nightly) repository:
|
||||
- `flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo`
|
||||
- `flatpak install gnome-nightly org.gtk.Demo4`
|
||||
- `flatpak install gnome-nightly org.gtk.WidgetFactory4`
|
||||
- `flatpak install gnome-nightly org.gtk.IconBrowser4`
|
||||
[GNOME Nightly](https://nightly.gnome.org/) repository:
|
||||
|
||||
```sh
|
||||
flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo
|
||||
flatpak install gnome-nightly org.gtk.Demo4
|
||||
flatpak install gnome-nightly org.gtk.WidgetFactory4
|
||||
flatpak install gnome-nightly org.gtk.IconBrowser4
|
||||
```
|
||||
|
||||
Building and installing
|
||||
-----------------------
|
||||
|
||||
In order to build GTK you will need:
|
||||
|
||||
- [a C99 compatible compiler](https://wiki.gnome.org/Projects/GLib/CompilerRequirements)
|
||||
- [a C11 compatible compiler](https://gitlab.gnome.org/GNOME/glib/-/blob/main/docs/toolchain-requirements.md)
|
||||
- [Python 3](https://www.python.org/)
|
||||
- [Meson](http://mesonbuild.com)
|
||||
- [Ninja](https://ninja-build.org)
|
||||
@@ -133,9 +136,13 @@ In the bug report please include:
|
||||
|
||||
- which version of GTK you are using
|
||||
- what operating system and version
|
||||
- what windowing system (X11 or Wayland)
|
||||
- what graphics driver / mesa version
|
||||
- for Linux, which distribution
|
||||
- if you built GTK, the list of options used to configure the build
|
||||
|
||||
Most of this information can be found in the GTK inspector.
|
||||
|
||||
And anything else you think is relevant.
|
||||
|
||||
* How to reproduce the bug.
|
||||
|
22315
demos/gtk-demo/Moby-Dick.txt
Normal file
22315
demos/gtk-demo/Moby-Dick.txt
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
||||
uniform float u_time;
|
||||
|
||||
void
|
||||
mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
vec2 pos = (fragCoord.xy * 2.0 - resolution.xy)/ min (resolution.x, resolution.y) ;
|
||||
|
||||
float t0 = sin ((u_time + 0.00)*1.0);
|
||||
float t1 = sin ((u_time + 0.30)*0.4);
|
||||
float t2 = cos ((u_time + 0.23)*0.9);
|
||||
float t3 = cos ((u_time + 0.41)*0.6);
|
||||
float t4 = cos ((u_time + 0.11)*0.3);
|
||||
|
||||
vec2 p0 = vec2 (t1, t0) ;
|
||||
vec2 p1 = vec2 (t2, t3) ;
|
||||
vec2 p2 = vec2 (t4, t3) ;
|
||||
|
||||
float r = 1.0/distance (pos, p0);
|
||||
float g = 1.0/distance (pos, p1);
|
||||
float b = 1.0/distance (pos, p2);
|
||||
float sum = r + g + b;
|
||||
|
||||
float alpha = 1.0 - pow (1.0/(sum), 40.0)*pow (10.0, 40.0*0.7);
|
||||
|
||||
fragColor = vec4 (r*0.5, g*0.5, b*0.5, 1.0) * alpha;
|
||||
}
|
@@ -1,226 +0,0 @@
|
||||
uniform float iTime;
|
||||
|
||||
// Originally from: https://www.shadertoy.com/view/3ljyDD
|
||||
// License CC0: Hexagonal tiling + cog wheels
|
||||
// Nothing fancy, just hexagonal tiling + cog wheels
|
||||
|
||||
#define PI 3.141592654
|
||||
#define TAU (2.0*PI)
|
||||
#define MROT(a) mat2(cos(a), sin(a), -sin(a), cos(a))
|
||||
|
||||
float hash(in vec2 co) {
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,58.233))) * 13758.5453);
|
||||
}
|
||||
|
||||
float pcos(float a) {
|
||||
return 0.5 + 0.5*cos(a);
|
||||
}
|
||||
|
||||
void rot(inout vec2 p, float a) {
|
||||
float c = cos(a);
|
||||
float s = sin(a);
|
||||
p = vec2(c*p.x + s*p.y, -s*p.x + c*p.y);
|
||||
}
|
||||
|
||||
float modPolar(inout vec2 p, float repetitions) {
|
||||
float angle = 2.0*PI/repetitions;
|
||||
float a = atan(p.y, p.x) + angle/2.;
|
||||
float r = length(p);
|
||||
float c = floor(a/angle);
|
||||
a = mod(a,angle) - angle/2.;
|
||||
p = vec2(cos(a), sin(a))*r;
|
||||
// For an odd number of repetitions, fix cell index of the cell in -x direction
|
||||
// (cell index would be e.g. -5 and 5 in the two halves of the cell):
|
||||
if (abs(c) >= (repetitions/2.0)) c = abs(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
float pmin(float a, float b, float k) {
|
||||
float h = clamp( 0.5+0.5*(b-a)/k, 0.0, 1.0 );
|
||||
return mix( b, a, h ) - k*h*(1.0-h);
|
||||
}
|
||||
|
||||
const vec2 sz = vec2(1.0, sqrt(3.0));
|
||||
const vec2 hsz = 0.5*sz;
|
||||
const float smallCount = 16.0;
|
||||
|
||||
vec2 hextile(inout vec2 p) {
|
||||
// See Art of Code: Hexagonal Tiling Explained!
|
||||
// https://www.youtube.com/watch?v=VmrIDyYiJBA
|
||||
|
||||
vec2 p1 = mod(p, sz)-hsz;
|
||||
vec2 p2 = mod(p - hsz*1.0, sz)-hsz;
|
||||
vec2 p3 = mix(p2, p1, vec2(length(p1) < length(p2)));
|
||||
vec2 n = p3 - p;
|
||||
p = p3;
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
float circle(vec2 p, float r) {
|
||||
return length(p) - r;
|
||||
}
|
||||
|
||||
float box(vec2 p, vec2 b) {
|
||||
vec2 d = abs(p)-b;
|
||||
return length(max(d,0.0)) + min(max(d.x,d.y),0.0);
|
||||
}
|
||||
|
||||
float unevenCapsule(vec2 p, float r1, float r2, float h) {
|
||||
p.x = abs(p.x);
|
||||
float b = (r1-r2)/h;
|
||||
float a = sqrt(1.0-b*b);
|
||||
float k = dot(p,vec2(-b,a));
|
||||
if( k < 0.0 ) return length(p) - r1;
|
||||
if( k > a*h ) return length(p-vec2(0.0,h)) - r2;
|
||||
return dot(p, vec2(a,b) ) - r1;
|
||||
}
|
||||
|
||||
float cogwheel(vec2 p, float innerRadius, float outerRadius, float cogs, float holes) {
|
||||
float cogWidth = 0.25*innerRadius*TAU/cogs;
|
||||
|
||||
float d0 = circle(p, innerRadius);
|
||||
|
||||
vec2 icp = p;
|
||||
modPolar(icp, holes);
|
||||
icp -= vec2(innerRadius*0.55, 0.0);
|
||||
float d1 = circle(icp, innerRadius*0.25);
|
||||
|
||||
vec2 cp = p;
|
||||
modPolar(cp, cogs);
|
||||
cp -= vec2(innerRadius, 0.0);
|
||||
float d2 = unevenCapsule(cp.yx, cogWidth, cogWidth*0.75, (outerRadius-innerRadius));
|
||||
|
||||
float d3 = circle(p, innerRadius*0.20);
|
||||
|
||||
float d = 1E6;
|
||||
d = min(d, d0);
|
||||
d = pmin(d, d2, 0.5*cogWidth);
|
||||
d = min(d, d2);
|
||||
d = max(d, -d1);
|
||||
d = max(d, -d3);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
float ccell1(vec2 p, float r) {
|
||||
float d = 1E6;
|
||||
const float bigCount = 60.0;
|
||||
|
||||
vec2 cp0 = p;
|
||||
rot(cp0, -iTime*TAU/bigCount);
|
||||
float d0 = cogwheel(cp0, 0.36, 0.38, bigCount, 5.0);
|
||||
|
||||
vec2 cp1 = p;
|
||||
float nm = modPolar(cp1, 6.0);
|
||||
|
||||
cp1 -= vec2(0.5, 0.0);
|
||||
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
|
||||
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
|
||||
|
||||
d = min(d, d0);
|
||||
d = min(d, d1);
|
||||
return d;
|
||||
}
|
||||
|
||||
float ccell2(vec2 p, float r) {
|
||||
float d = 1E6;
|
||||
vec2 cp0 = p;
|
||||
float nm = modPolar(cp0, 6.0);
|
||||
vec2 cp1 = cp0;
|
||||
const float off = 0.275;
|
||||
const float count = smallCount + 2.0;
|
||||
cp0 -= vec2(off, 0.0);
|
||||
rot(cp0, 0.+TAU*nm/2.0 - iTime*TAU/count);
|
||||
float d0 = cogwheel(cp0, 0.09, 0.105, count, 5.0);
|
||||
|
||||
|
||||
cp1 -= vec2(0.5, 0.0);
|
||||
rot(cp1, 0.2+TAU*nm/2.0 + iTime*TAU/smallCount);
|
||||
float d1 = cogwheel(cp1, 0.11, 0.125, smallCount, 5.0);
|
||||
|
||||
float l = length(p);
|
||||
float d2 = l - (off+0.055);
|
||||
float d3 = d2 + 0.020;;
|
||||
|
||||
vec2 tp0 = p;
|
||||
modPolar(tp0, 60.0);
|
||||
tp0.x -= off;
|
||||
float d4 = box(tp0, vec2(0.0125, 0.005));
|
||||
|
||||
float ctime = -(iTime*0.05 + r)*TAU;
|
||||
|
||||
vec2 tp1 = p;
|
||||
rot(tp1, ctime*12.0);
|
||||
tp1.x -= 0.13;
|
||||
float d5 = box(tp1, vec2(0.125, 0.005));
|
||||
|
||||
vec2 tp2 = p;
|
||||
rot(tp2, ctime);
|
||||
tp2.x -= 0.13*0.5;
|
||||
float d6 = box(tp2, vec2(0.125*0.5, 0.0075));
|
||||
|
||||
float d7 = l - 0.025;
|
||||
float d8 = l - 0.0125;
|
||||
|
||||
d = min(d, d0);
|
||||
d = min(d, d1);
|
||||
d = min(d, d2);
|
||||
d = max(d, -d3);
|
||||
d = min(d, d4);
|
||||
d = min(d, d5);
|
||||
d = min(d, d6);
|
||||
d = min(d, d7);
|
||||
d = max(d, -d8);
|
||||
|
||||
return d;
|
||||
}
|
||||
|
||||
float df(vec2 p, float scale, inout vec2 nn) {
|
||||
p /= scale;
|
||||
nn = hextile(p);
|
||||
nn = floor(nn + 0.5);
|
||||
float r = hash(nn);
|
||||
|
||||
float d;;
|
||||
|
||||
if (r < 0.5) {
|
||||
d = ccell1(p, r);
|
||||
} else {
|
||||
d = ccell2(p, r);
|
||||
}
|
||||
|
||||
return d*scale;
|
||||
}
|
||||
|
||||
vec3 postProcess(vec3 col, vec2 q) {
|
||||
//col = saturate(col);
|
||||
col=pow(clamp(col,0.0,1.0),vec3(0.75));
|
||||
col=col*0.6+0.4*col*col*(3.0-2.0*col); // contrast
|
||||
col=mix(col, vec3(dot(col, vec3(0.33))), -0.4); // satuation
|
||||
col*=0.5+0.5*pow(19.0*q.x*q.y*(1.0-q.x)*(1.0-q.y),0.7); // vigneting
|
||||
return col;
|
||||
}
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv) {
|
||||
vec2 q = fragCoord/resolution.xy;
|
||||
vec2 p = -1.0 + 2.0*q;
|
||||
p.x *= resolution.x/resolution.y;
|
||||
float tm = iTime*0.1;
|
||||
p += vec2(cos(tm), sin(tm*sqrt(0.5)));
|
||||
float z = mix(0.5, 1.0, pcos(tm*sqrt(0.3)));
|
||||
float aa = 4.0 / resolution.y;
|
||||
|
||||
vec2 nn = vec2(0.0);
|
||||
float d = df(p, z, nn);
|
||||
|
||||
vec3 col = vec3(160.0)/vec3(255.0);
|
||||
vec3 baseCol = vec3(0.3);
|
||||
vec4 logoCol = vec4(baseCol, 1.0)*smoothstep(-aa, 0.0, -d);
|
||||
col = mix(col, logoCol.xyz, pow(logoCol.w, 8.0));
|
||||
col += 0.4*pow(abs(sin(20.0*d)), 0.6);
|
||||
|
||||
col = postProcess(col, q);
|
||||
|
||||
fragColor = vec4(col, 1.0);
|
||||
}
|
@@ -1,27 +0,0 @@
|
||||
uniform float progress;
|
||||
uniform sampler2D u_texture1;
|
||||
uniform sampler2D u_texture2;
|
||||
|
||||
vec4 getFromColor (vec2 uv) {
|
||||
return GskTexture(u_texture1, uv);
|
||||
}
|
||||
|
||||
vec4 getToColor (vec2 uv) {
|
||||
return GskTexture(u_texture2, uv);
|
||||
}
|
||||
|
||||
// Source: https://gl-transitions.com/editor/crosswarp
|
||||
// Author: Eke Péter <peterekepeter@gmail.com>
|
||||
// License: MIT
|
||||
|
||||
vec4 transition(vec2 p) {
|
||||
float x = progress;
|
||||
x=smoothstep(.0,1.0,(x*2.0+p.x-1.0));
|
||||
return mix(getFromColor((p-.5)*(1.-x)+.5), getToColor((p-.5)*x+.5), x);
|
||||
}
|
||||
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
fragColor = transition(uv);
|
||||
}
|
@@ -146,21 +146,6 @@
|
||||
<file>cogs.glsl</file>
|
||||
<file>glowingstars.glsl</file>
|
||||
</gresource>
|
||||
<gresource prefix="/gltransition">
|
||||
<file>gtkshaderstack.c</file>
|
||||
<file>gtkshaderstack.h</file>
|
||||
<file>gtkshaderbin.h</file>
|
||||
<file>gtkshaderbin.c</file>
|
||||
<file>gskshaderpaintable.h</file>
|
||||
<file>gskshaderpaintable.c</file>
|
||||
<file>wind.glsl</file>
|
||||
<file>radial.glsl</file>
|
||||
<file>crosswarp.glsl</file>
|
||||
<file>kaleidoscope.glsl</file>
|
||||
<file>cogs2.glsl</file>
|
||||
<file>ripple.glsl</file>
|
||||
<file>background.glsl</file>
|
||||
</gresource>
|
||||
<gresource prefix="/iconscroll">
|
||||
<file>iconscroll.ui</file>
|
||||
</gresource>
|
||||
@@ -296,7 +281,6 @@
|
||||
<file>gears.c</file>
|
||||
<file>gestures.c</file>
|
||||
<file>glarea.c</file>
|
||||
<file>gltransition.c</file>
|
||||
<file>headerbar.c</file>
|
||||
<file>hypertext.c</file>
|
||||
<file>iconscroll.c</file>
|
||||
@@ -454,6 +438,10 @@
|
||||
<file>icons/16x16/categories/applications-other.png</file>
|
||||
<file>icons/48x48/status/starred.png</file>
|
||||
<file alias="icons/scalable/apps/org.gtk.Demo4.svg">data/scalable/apps/org.gtk.Demo4.svg</file>
|
||||
<file>portland-rose-thumbnail.png</file>
|
||||
<file>large-image-thumbnail.png</file>
|
||||
<file compressed="true">large-image.png</file>
|
||||
<file compressed="true">Moby-Dick.txt</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/Demo4/gtk">
|
||||
<file preprocess="xml-stripblanks">help-overlay.ui</file>
|
||||
|
@@ -55,7 +55,7 @@ mode_switch_state_set (GtkSwitch *sw,
|
||||
{
|
||||
gtk_widget_set_visible (label, TRUE);
|
||||
gtk_accessible_update_relation (GTK_ACCESSIBLE (sw),
|
||||
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label,
|
||||
GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE, label, NULL,
|
||||
-1);
|
||||
gtk_accessible_update_state (GTK_ACCESSIBLE (sw),
|
||||
GTK_ACCESSIBLE_STATE_INVALID, GTK_ACCESSIBLE_INVALID_TRUE,
|
||||
|
@@ -9,7 +9,6 @@
|
||||
|
||||
#include "gtkfishbowl.h"
|
||||
#include "gtkgears.h"
|
||||
#include "gskshaderpaintable.h"
|
||||
|
||||
#include "nodewidget.h"
|
||||
#include "graphwidget.h"
|
||||
@@ -152,44 +151,6 @@ create_switch (void)
|
||||
return w;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_paintable (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer user_data)
|
||||
{
|
||||
GskShaderPaintable *paintable;
|
||||
gint64 frame_time;
|
||||
|
||||
paintable = GSK_SHADER_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget)));
|
||||
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
gsk_shader_paintable_update_time (paintable, 0, frame_time);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_cogs (void)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
static GskGLShader *cog_shader = NULL;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
if (cog_shader == NULL)
|
||||
cog_shader = gsk_gl_shader_new_from_resource ("/gltransition/cogs2.glsl");
|
||||
paintable = gsk_shader_paintable_new (g_object_ref (cog_shader), NULL);
|
||||
picture = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_widget_set_size_request (picture, 150, 75);
|
||||
gtk_widget_add_tick_callback (picture, update_paintable, NULL, NULL);
|
||||
|
||||
return picture;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_cogs (GtkFishbowl *fb)
|
||||
{
|
||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (gtk_widget_get_native (GTK_WIDGET (fb))));
|
||||
}
|
||||
|
||||
static void
|
||||
mapped (GtkWidget *w)
|
||||
{
|
||||
@@ -239,7 +200,6 @@ static const struct {
|
||||
{ "Gears", create_gears, NULL },
|
||||
{ "Switch", create_switch, NULL },
|
||||
{ "Menubutton", create_menu_button, NULL },
|
||||
{ "Shader", create_cogs, check_cogs },
|
||||
{ "Tiger", create_tiger, NULL },
|
||||
{ "Graph", create_graph, NULL },
|
||||
};
|
||||
|
@@ -276,7 +276,7 @@ gtk_font_plane_class_init (GtkFontPlaneClass *class)
|
||||
|
||||
GtkWidget *
|
||||
gtk_font_plane_new (GtkAdjustment *weight_adj,
|
||||
GtkAdjustment *width_adj)
|
||||
GtkAdjustment *width_adj)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_FONT_PLANE,
|
||||
"weight-adjustment", weight_adj,
|
||||
|
@@ -55,7 +55,7 @@ struct _GtkFontPlaneClass
|
||||
|
||||
|
||||
GType gtk_font_plane_get_type (void) G_GNUC_CONST;
|
||||
GtkWidget * gtk_font_plane_new (GtkAdjustment *width_adj,
|
||||
GtkAdjustment *weight_adj);
|
||||
GtkWidget * gtk_font_plane_new (GtkAdjustment *weight_adj,
|
||||
GtkAdjustment *width_adj);
|
||||
|
||||
G_END_DECLS
|
||||
|
@@ -1,362 +0,0 @@
|
||||
/* OpenGL/Transitions and Effects
|
||||
* #Keywords: OpenGL, shader, effect
|
||||
*
|
||||
* Create transitions between pages using a custom fragment shader.
|
||||
*
|
||||
* The example transitions here are taken from gl-transitions.com, and you
|
||||
* can edit the shader code itself on the last page of the stack.
|
||||
*
|
||||
* The transitions work with arbitrary content. We use images, shaders
|
||||
* GL areas and plain old widgets to demonstrate this.
|
||||
*
|
||||
* The demo also shows some over-the-top effects like wobbly widgets,
|
||||
* and animated backgrounds.
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtkshaderstack.h"
|
||||
#include "gtkshaderbin.h"
|
||||
#include "gtkshadertoy.h"
|
||||
#include "gskshaderpaintable.h"
|
||||
|
||||
static GtkWidget *demo_window = NULL;
|
||||
|
||||
static void
|
||||
close_window (GtkWidget *widget)
|
||||
{
|
||||
/* Reset the state */
|
||||
demo_window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
text_changed (GtkTextBuffer *buffer,
|
||||
GtkWidget *button)
|
||||
{
|
||||
gtk_widget_set_visible (button, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
apply_text (GtkWidget *button,
|
||||
GtkTextBuffer *buffer)
|
||||
{
|
||||
GtkWidget *stack;
|
||||
GskGLShader *shader;
|
||||
GtkTextIter start, end;
|
||||
char *text;
|
||||
|
||||
stack = g_object_get_data (G_OBJECT (button), "the-stack");
|
||||
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
|
||||
|
||||
GBytes *bytes = g_bytes_new_take (text, strlen (text));
|
||||
shader = gsk_gl_shader_new_from_bytes (bytes);
|
||||
|
||||
gtk_shader_stack_set_shader (GTK_SHADER_STACK (stack), shader);
|
||||
|
||||
g_object_unref (shader);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
gtk_widget_set_visible (button, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
go_back (GtkWidget *button,
|
||||
GtkWidget *stack)
|
||||
{
|
||||
gtk_shader_stack_transition (GTK_SHADER_STACK (stack), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
go_forward (GtkWidget *button,
|
||||
GtkWidget *stack)
|
||||
{
|
||||
gtk_shader_stack_transition (GTK_SHADER_STACK (stack), TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
clicked_cb (GtkGestureClick *gesture,
|
||||
guint n_pressed,
|
||||
double x,
|
||||
double y,
|
||||
gpointer data)
|
||||
{
|
||||
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_CLAIMED);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
ripple_bin_new (void)
|
||||
{
|
||||
GtkWidget *bin = gtk_shader_bin_new ();
|
||||
static GskGLShader *shader = NULL;
|
||||
|
||||
if (shader == NULL)
|
||||
shader = gsk_gl_shader_new_from_resource ("/gltransition/ripple.glsl");
|
||||
|
||||
gtk_shader_bin_add_shader (GTK_SHADER_BIN (bin), shader, GTK_STATE_FLAG_PRELIGHT, GTK_STATE_FLAG_PRELIGHT, 20);
|
||||
|
||||
return bin;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
new_shadertoy (const char *path)
|
||||
{
|
||||
GBytes *shader;
|
||||
GtkWidget *toy;
|
||||
|
||||
toy = gtk_shadertoy_new ();
|
||||
shader = g_resources_lookup_data (path, 0, NULL);
|
||||
gtk_shadertoy_set_image_shader (GTK_SHADERTOY (toy),
|
||||
g_bytes_get_data (shader, NULL));
|
||||
g_bytes_unref (shader);
|
||||
|
||||
return toy;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
update_paintable (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer user_data)
|
||||
{
|
||||
GskShaderPaintable *paintable;
|
||||
gint64 frame_time;
|
||||
|
||||
paintable = GSK_SHADER_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget)));
|
||||
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
gsk_shader_paintable_update_time (paintable, 0, frame_time);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
make_shader_stack (const char *name,
|
||||
const char *resource_path,
|
||||
int active_child,
|
||||
GtkWidget *scale)
|
||||
{
|
||||
GtkWidget *stack, *child, *widget, *vbox, *hbox, *bin;
|
||||
GtkWidget *label, *button, *tv;
|
||||
GskGLShader *shader;
|
||||
GObjectClass *class;
|
||||
GParamSpecFloat *pspec;
|
||||
GtkAdjustment *adjustment;
|
||||
GtkTextBuffer *buffer;
|
||||
GBytes *bytes;
|
||||
GtkEventController *controller;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
stack = gtk_shader_stack_new ();
|
||||
shader = gsk_gl_shader_new_from_resource (resource_path);
|
||||
gtk_shader_stack_set_shader (GTK_SHADER_STACK (stack), shader);
|
||||
g_object_unref (shader);
|
||||
|
||||
child = gtk_picture_new_for_resource ("/css_blendmodes/ducky.png");
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (child), TRUE);
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
shader = gsk_gl_shader_new_from_resource ("/gltransition/cogs2.glsl");
|
||||
paintable = gsk_shader_paintable_new (shader, NULL);
|
||||
|
||||
child = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_widget_add_tick_callback (child, update_paintable, NULL, NULL);
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (child), TRUE);
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
child = gtk_picture_new_for_resource ("/transparent/portland-rose.jpg");
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (child), TRUE);
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
child = new_shadertoy ("/shadertoy/neon.glsl");
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
child = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||
|
||||
class = g_type_class_ref (GTK_TYPE_SHADER_STACK);
|
||||
pspec = G_PARAM_SPEC_FLOAT (g_object_class_find_property (class, "duration"));
|
||||
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (scale));
|
||||
if (gtk_adjustment_get_lower (adjustment) == 0.0 &&
|
||||
gtk_adjustment_get_upper (adjustment) == 0.0)
|
||||
{
|
||||
gtk_adjustment_configure (adjustment,
|
||||
pspec->default_value,
|
||||
pspec->minimum,
|
||||
pspec->maximum,
|
||||
0.1, 0.5, 0);
|
||||
}
|
||||
|
||||
g_type_class_unref (class);
|
||||
|
||||
g_object_bind_property (adjustment, "value",
|
||||
stack, "duration",
|
||||
G_BINDING_DEFAULT);
|
||||
|
||||
widget = gtk_scrolled_window_new ();
|
||||
gtk_scrolled_window_set_has_frame (GTK_SCROLLED_WINDOW (widget), TRUE);
|
||||
gtk_widget_set_hexpand (widget, TRUE);
|
||||
gtk_widget_set_vexpand (widget, TRUE);
|
||||
|
||||
controller = GTK_EVENT_CONTROLLER (gtk_gesture_click_new ());
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (controller), 0);
|
||||
g_signal_connect (controller, "released", G_CALLBACK (clicked_cb), NULL);
|
||||
gtk_event_controller_set_propagation_phase (controller, GTK_PHASE_BUBBLE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (widget), controller);
|
||||
|
||||
tv = gtk_text_view_new ();
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (tv), 4);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (tv), 4);
|
||||
gtk_text_view_set_top_margin (GTK_TEXT_VIEW (tv), 4);
|
||||
gtk_text_view_set_bottom_margin (GTK_TEXT_VIEW (tv), 4);
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
|
||||
bytes = g_resources_lookup_data (resource_path, 0, NULL);
|
||||
gtk_text_buffer_set_text (buffer,
|
||||
(const char *)g_bytes_get_data (bytes, NULL),
|
||||
g_bytes_get_size (bytes));
|
||||
g_bytes_unref (bytes);
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (widget), tv);
|
||||
|
||||
gtk_box_append (GTK_BOX (child), widget);
|
||||
|
||||
gtk_shader_stack_add_child (GTK_SHADER_STACK (stack), child);
|
||||
|
||||
gtk_shader_stack_set_active (GTK_SHADER_STACK (stack), active_child);
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
|
||||
|
||||
widget = gtk_center_box_new ();
|
||||
label = gtk_label_new (name);
|
||||
gtk_widget_add_css_class (label, "title-4");
|
||||
gtk_widget_set_size_request (label, -1, 26);
|
||||
gtk_center_box_set_center_widget (GTK_CENTER_BOX (widget), label);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("view-refresh-symbolic");
|
||||
g_signal_connect (buffer, "changed", G_CALLBACK (text_changed), button);
|
||||
g_object_set_data (G_OBJECT (button), "the-stack", stack);
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (apply_text), buffer);
|
||||
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_add_css_class (button, "small");
|
||||
gtk_widget_set_visible (button, FALSE);
|
||||
gtk_center_box_set_end_widget (GTK_CENTER_BOX (widget), button);
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox), widget);
|
||||
|
||||
GtkWidget *bin2 = ripple_bin_new ();
|
||||
gtk_shader_bin_set_child (GTK_SHADER_BIN (bin2), stack);
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox), bin2);
|
||||
|
||||
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
gtk_widget_set_halign (hbox, GTK_ALIGN_CENTER);
|
||||
|
||||
gtk_box_append (GTK_BOX (vbox), hbox);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("go-previous-symbolic");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (go_back), stack);
|
||||
bin = ripple_bin_new ();
|
||||
gtk_shader_bin_set_child (GTK_SHADER_BIN (bin), button);
|
||||
gtk_box_append (GTK_BOX (hbox), bin);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("go-next-symbolic");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (go_forward), stack);
|
||||
bin = ripple_bin_new ();
|
||||
gtk_shader_bin_set_child (GTK_SHADER_BIN (bin), button);
|
||||
gtk_box_append (GTK_BOX (hbox), bin);
|
||||
|
||||
return vbox;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_provider (gpointer data)
|
||||
{
|
||||
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
|
||||
g_object_unref (provider);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_gltransition_window (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *window, *headerbar, *scale, *outer_grid, *grid, *background;
|
||||
GdkPaintable *paintable;
|
||||
GtkCssProvider *provider;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Transitions and Effects");
|
||||
headerbar = gtk_header_bar_new ();
|
||||
scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, NULL);
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
gtk_widget_set_size_request (scale, 100, -1);
|
||||
gtk_widget_set_tooltip_text (scale, "Transition duration");
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), scale);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 800, 600);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
||||
outer_grid = gtk_grid_new ();
|
||||
gtk_window_set_child (GTK_WINDOW (window), outer_grid);
|
||||
|
||||
paintable = gsk_shader_paintable_new (gsk_gl_shader_new_from_resource ("/gltransition/background.glsl"), NULL);
|
||||
background = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_widget_add_tick_callback (background, update_paintable, NULL, NULL);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (outer_grid),
|
||||
background,
|
||||
0, 0, 1, 1);
|
||||
|
||||
grid = gtk_grid_new ();
|
||||
gtk_grid_attach (GTK_GRID (outer_grid),
|
||||
grid,
|
||||
0, 0, 1, 1);
|
||||
|
||||
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (grid, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_margin_start (grid, 12);
|
||||
gtk_widget_set_margin_end (grid, 12);
|
||||
gtk_widget_set_margin_top (grid, 12);
|
||||
gtk_widget_set_margin_bottom (grid, 12);
|
||||
gtk_grid_set_row_spacing (GTK_GRID (grid), 6);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (grid), 6);
|
||||
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
|
||||
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
|
||||
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
make_shader_stack ("Wind", "/gltransition/wind.glsl", 0, scale),
|
||||
0, 0, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
make_shader_stack ("Radial", "/gltransition/radial.glsl", 1, scale),
|
||||
1, 0, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
make_shader_stack ("Crosswarp", "/gltransition/crosswarp.glsl", 2, scale),
|
||||
0, 1, 1, 1);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
make_shader_stack ("Kaleidoscope", "/gltransition/kaleidoscope.glsl", 3, scale),
|
||||
1, 1, 1, 1);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_string (provider, "button.small { padding: 0; }");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_gltransition (GtkWidget *do_widget)
|
||||
{
|
||||
if (!demo_window)
|
||||
demo_window = create_gltransition_window (do_widget);
|
||||
|
||||
if (!gtk_widget_get_visible (demo_window))
|
||||
gtk_widget_set_visible (demo_window, TRUE);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (demo_window));
|
||||
|
||||
return demo_window;
|
||||
}
|
@@ -1,334 +0,0 @@
|
||||
/*
|
||||
* Copyright © 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.1 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/>.
|
||||
*
|
||||
* Authors: Matthias Clasen <mclasen@redhat.com>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gskshaderpaintable.h"
|
||||
|
||||
/**
|
||||
* GskShaderPaintable:
|
||||
*
|
||||
* `GskShaderPaintable` is an implementation of the `GdkPaintable` interface
|
||||
* that uses a `GskGLShader` to create pixels.
|
||||
*
|
||||
* You can set the uniform data that the shader needs for rendering
|
||||
* using gsk_shader_paintable_set_args(). This function can
|
||||
* be called repeatedly to change the uniform data for the next
|
||||
* snapshot.
|
||||
*
|
||||
* Commonly, time is passed to shaders as a float uniform containing
|
||||
* the elapsed time in seconds. The convenience API
|
||||
* gsk_shader_paintable_update_time() can be called from a `GtkTickCallback`
|
||||
* to update the time based on the frame time of the frame clock.
|
||||
*/
|
||||
|
||||
|
||||
struct _GskShaderPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GskGLShader *shader;
|
||||
GBytes *args;
|
||||
|
||||
gint64 start_time;
|
||||
};
|
||||
|
||||
struct _GskShaderPaintableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_SHADER,
|
||||
PROP_ARGS,
|
||||
|
||||
N_PROPS,
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (paintable);
|
||||
|
||||
gtk_snapshot_push_gl_shader (snapshot, self->shader, &GRAPHENE_RECT_INIT(0, 0, width, height), g_bytes_ref (self->args));
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_paintable_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = gsk_shader_paintable_paintable_snapshot;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (GskShaderPaintable, gsk_shader_paintable, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
gsk_shader_paintable_paintable_init))
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
|
||||
{
|
||||
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SHADER:
|
||||
gsk_shader_paintable_set_shader (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_ARGS:
|
||||
gsk_shader_paintable_set_args (self, g_value_get_boxed (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_SHADER:
|
||||
g_value_set_object (value, self->shader);
|
||||
break;
|
||||
|
||||
case PROP_ARGS:
|
||||
g_value_set_boxed (value, self->args);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_finalize (GObject *object)
|
||||
{
|
||||
GskShaderPaintable *self = GSK_SHADER_PAINTABLE (object);
|
||||
|
||||
g_clear_pointer (&self->args, g_bytes_unref);
|
||||
g_clear_object (&self->shader);
|
||||
|
||||
G_OBJECT_CLASS (gsk_shader_paintable_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_class_init (GskShaderPaintableClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->get_property = gsk_shader_paintable_get_property;
|
||||
gobject_class->set_property = gsk_shader_paintable_set_property;
|
||||
gobject_class->finalize = gsk_shader_paintable_finalize;
|
||||
|
||||
properties[PROP_SHADER] =
|
||||
g_param_spec_object ("shader", "Shader", "The shader",
|
||||
GSK_TYPE_GL_SHADER,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
properties[PROP_ARGS] =
|
||||
g_param_spec_boxed ("args", "Arguments", "The uniform arguments",
|
||||
G_TYPE_BYTES,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_shader_paintable_init (GskShaderPaintable *self)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_new:
|
||||
* @shader: (transfer full) (nullable): the shader to use
|
||||
* @data: (transfer full) (nullable): uniform data
|
||||
*
|
||||
* Creates a paintable that uses the @shader to create
|
||||
* pixels. The shader must not require input textures.
|
||||
* If @data is %NULL, all uniform values are set to zero.
|
||||
*
|
||||
* Returns: (transfer full): a new `GskShaderPaintable`
|
||||
*/
|
||||
GdkPaintable *
|
||||
gsk_shader_paintable_new (GskGLShader *shader,
|
||||
GBytes *data)
|
||||
{
|
||||
GdkPaintable *ret;
|
||||
|
||||
g_return_val_if_fail (shader == NULL || GSK_IS_GL_SHADER (shader), NULL);
|
||||
|
||||
if (shader && !data)
|
||||
{
|
||||
int size = gsk_gl_shader_get_args_size (shader);
|
||||
data = g_bytes_new_take (g_new0 (guchar, size), size);
|
||||
}
|
||||
|
||||
ret = g_object_new (GSK_TYPE_SHADER_PAINTABLE,
|
||||
"shader", shader,
|
||||
"args", data,
|
||||
NULL);
|
||||
|
||||
g_clear_object (&shader);
|
||||
g_clear_pointer (&data, g_bytes_unref);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_set_shader:
|
||||
* @self: a `GskShaderPaintable`
|
||||
* @shader: the `GskGLShader` to use
|
||||
*
|
||||
* Sets the shader that the paintable will use
|
||||
* to create pixels. The shader must not require
|
||||
* input textures.
|
||||
*/
|
||||
void
|
||||
gsk_shader_paintable_set_shader (GskShaderPaintable *self,
|
||||
GskGLShader *shader)
|
||||
{
|
||||
g_return_if_fail (GSK_IS_SHADER_PAINTABLE (self));
|
||||
g_return_if_fail (shader == NULL || GSK_IS_GL_SHADER (shader));
|
||||
g_return_if_fail (shader == NULL || gsk_gl_shader_get_n_textures (shader) == 0);
|
||||
|
||||
if (!g_set_object (&self->shader, shader))
|
||||
return;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_SHADER]);
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
|
||||
g_clear_pointer (&self->args, g_bytes_unref);
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_get_shader:
|
||||
* @self: a `GskShaderPaintable`
|
||||
*
|
||||
* Returns the shader that the paintable is using.
|
||||
*
|
||||
* Returns: (transfer none): the `GskGLShader` that is used
|
||||
*/
|
||||
GskGLShader *
|
||||
gsk_shader_paintable_get_shader (GskShaderPaintable *self)
|
||||
{
|
||||
g_return_val_if_fail (GSK_IS_SHADER_PAINTABLE (self), NULL);
|
||||
|
||||
return self->shader;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_set_args:
|
||||
* @self: a `GskShaderPaintable`
|
||||
* @data: Data block with uniform data for the shader
|
||||
*
|
||||
* Sets the uniform data that will be passed to the
|
||||
* shader when rendering. The @data will typically
|
||||
* be produced by a `GskUniformDataBuilder`.
|
||||
*
|
||||
* Note that the @data should be considered immutable
|
||||
* after it has been passed to this function.
|
||||
*/
|
||||
void
|
||||
gsk_shader_paintable_set_args (GskShaderPaintable *self,
|
||||
GBytes *data)
|
||||
{
|
||||
g_return_if_fail (GSK_IS_SHADER_PAINTABLE (self));
|
||||
g_return_if_fail (data == NULL || g_bytes_get_size (data) == gsk_gl_shader_get_args_size (self->shader));
|
||||
|
||||
g_clear_pointer (&self->args, g_bytes_unref);
|
||||
if (data)
|
||||
self->args = g_bytes_ref (data);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_ARGS]);
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_get_args:
|
||||
* @self: a `GskShaderPaintable`
|
||||
*
|
||||
* Returns the uniform data set with
|
||||
* gsk_shader_paintable_get_args().
|
||||
*
|
||||
* Returns: (transfer none): the uniform data
|
||||
*/
|
||||
GBytes *
|
||||
gsk_shader_paintable_get_args (GskShaderPaintable *self)
|
||||
{
|
||||
g_return_val_if_fail (GSK_IS_SHADER_PAINTABLE (self), NULL);
|
||||
|
||||
return self->args;
|
||||
}
|
||||
|
||||
/**
|
||||
* gsk_shader_paintable_update_time:
|
||||
* @self: a `GskShaderPaintable`
|
||||
* @time_idx: the index of the uniform for time in seconds as float
|
||||
* @frame_time: the current frame time, as returned by `GdkFrameClock`
|
||||
*
|
||||
* This function is a convenience wrapper for
|
||||
* gsk_shader_paintable_set_args() that leaves all
|
||||
* uniform values unchanged, except for the uniform with
|
||||
* index @time_idx, which will be set to the elapsed time
|
||||
* in seconds, since the first call to this function.
|
||||
*
|
||||
* This function is usually called from a `GtkTickCallback`.
|
||||
*/
|
||||
void
|
||||
gsk_shader_paintable_update_time (GskShaderPaintable *self,
|
||||
int time_idx,
|
||||
gint64 frame_time)
|
||||
{
|
||||
GskShaderArgsBuilder *builder;
|
||||
GBytes *args;
|
||||
float time;
|
||||
|
||||
if (self->start_time == 0)
|
||||
self->start_time = frame_time;
|
||||
|
||||
time = (frame_time - self->start_time) / (float)G_TIME_SPAN_SECOND;
|
||||
|
||||
builder = gsk_shader_args_builder_new (self->shader, self->args);
|
||||
gsk_shader_args_builder_set_float (builder, time_idx, time);
|
||||
args = gsk_shader_args_builder_free_to_args (builder);
|
||||
|
||||
gsk_shader_paintable_set_args (self, args);
|
||||
|
||||
g_bytes_unref (args);
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright © 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.1 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/>.
|
||||
*
|
||||
* Authors: Matthias Clasen <mclasen@redhat.com>
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gsk/gsk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GskShaderPaintable, gsk_shader_paintable, GSK, SHADER_PAINTABLE, GObject)
|
||||
|
||||
GdkPaintable * gsk_shader_paintable_new (GskGLShader *shader,
|
||||
GBytes *data);
|
||||
|
||||
GskGLShader * gsk_shader_paintable_get_shader (GskShaderPaintable *self);
|
||||
void gsk_shader_paintable_set_shader (GskShaderPaintable *self,
|
||||
GskGLShader *shader);
|
||||
GBytes * gsk_shader_paintable_get_args (GskShaderPaintable *self);
|
||||
void gsk_shader_paintable_set_args (GskShaderPaintable *self,
|
||||
GBytes *data);
|
||||
void gsk_shader_paintable_update_time (GskShaderPaintable *self,
|
||||
int time_idx,
|
||||
gint64 frame_time);
|
||||
G_END_DECLS
|
@@ -55,7 +55,7 @@ void gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
|
||||
gboolean animating);
|
||||
gboolean gtk_fishbowl_get_benchmark (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_benchmark (GtkFishbowl *fishbowl,
|
||||
gboolean animating);
|
||||
gboolean benchmark);
|
||||
double gtk_fishbowl_get_framerate (GtkFishbowl *fishbowl);
|
||||
gint64 gtk_fishbowl_get_update_delay (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_update_delay (GtkFishbowl *fishbowl,
|
||||
|
@@ -1,264 +0,0 @@
|
||||
#include "gtkshaderbin.h"
|
||||
|
||||
typedef struct {
|
||||
GskGLShader *shader;
|
||||
GtkStateFlags state;
|
||||
GtkStateFlags state_mask;
|
||||
float extra_border;
|
||||
gboolean compiled;
|
||||
gboolean compiled_ok;
|
||||
} ShaderInfo;
|
||||
|
||||
struct _GtkShaderBin
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
GtkWidget *child;
|
||||
ShaderInfo *active_shader;
|
||||
GPtrArray *shaders;
|
||||
guint tick_id;
|
||||
float time;
|
||||
float mouse_x, mouse_y;
|
||||
gint64 first_frame_time;
|
||||
};
|
||||
|
||||
struct _GtkShaderBinClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GtkShaderBin, gtk_shader_bin, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
shader_info_free (ShaderInfo *info)
|
||||
{
|
||||
g_object_unref (info->shader);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_finalize (GObject *object)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (object);
|
||||
|
||||
g_ptr_array_free (self->shaders, TRUE);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shader_bin_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_dispose (GObject *object)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (object);
|
||||
|
||||
g_clear_pointer (&self->child, gtk_widget_unparent);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shader_bin_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_shader_bin_tick (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer unused)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (widget);
|
||||
gint64 frame_time;
|
||||
|
||||
frame_time = gdk_frame_clock_get_frame_time (frame_clock);
|
||||
if (self->first_frame_time == 0)
|
||||
self->first_frame_time = frame_time;
|
||||
self->time = (frame_time - self->first_frame_time) / (float)G_USEC_PER_SEC;
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
motion_cb (GtkEventControllerMotion *controller,
|
||||
double x,
|
||||
double y,
|
||||
GtkShaderBin *self)
|
||||
{
|
||||
self->mouse_x = x;
|
||||
self->mouse_y = y;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_init (GtkShaderBin *self)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
self->shaders = g_ptr_array_new_with_free_func ((GDestroyNotify)shader_info_free);
|
||||
|
||||
controller = gtk_event_controller_motion_new ();
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (motion_cb), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_bin_update_active_shader (GtkShaderBin *self)
|
||||
{
|
||||
GtkStateFlags new_state = gtk_widget_get_state_flags (GTK_WIDGET (self));
|
||||
ShaderInfo *new_shader = NULL;
|
||||
|
||||
for (int i = 0; i < self->shaders->len; i++)
|
||||
{
|
||||
ShaderInfo *info = g_ptr_array_index (self->shaders, i);
|
||||
|
||||
if ((info->state_mask & new_state) == info->state)
|
||||
{
|
||||
new_shader = info;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (self->active_shader == new_shader)
|
||||
return;
|
||||
|
||||
self->active_shader = new_shader;
|
||||
self->first_frame_time = 0;
|
||||
|
||||
if (self->active_shader)
|
||||
{
|
||||
if (self->tick_id == 0)
|
||||
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self),
|
||||
gtk_shader_bin_tick,
|
||||
NULL, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (self->tick_id != 0)
|
||||
{
|
||||
gtk_widget_remove_tick_callback (GTK_WIDGET (self), self->tick_id);
|
||||
self->tick_id = 0;
|
||||
}
|
||||
}
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (self));
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_state_flags_changed (GtkWidget *widget,
|
||||
GtkStateFlags previous_state_flags)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (widget);
|
||||
|
||||
gtk_shader_bin_update_active_shader (self);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_bin_add_shader (GtkShaderBin *self,
|
||||
GskGLShader *shader,
|
||||
GtkStateFlags state,
|
||||
GtkStateFlags state_mask,
|
||||
float extra_border)
|
||||
{
|
||||
ShaderInfo *info = g_new0 (ShaderInfo, 1);
|
||||
info->shader = g_object_ref (shader);
|
||||
info->state = state;
|
||||
info->state_mask = state_mask;
|
||||
info->extra_border = extra_border;
|
||||
|
||||
g_ptr_array_add (self->shaders, info);
|
||||
|
||||
gtk_shader_bin_update_active_shader (self);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_bin_set_child (GtkShaderBin *self,
|
||||
GtkWidget *child)
|
||||
{
|
||||
|
||||
if (self->child == child)
|
||||
return;
|
||||
|
||||
g_clear_pointer (&self->child, gtk_widget_unparent);
|
||||
|
||||
if (child)
|
||||
{
|
||||
self->child = child;
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (self));
|
||||
}
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_shader_bin_get_child (GtkShaderBin *self)
|
||||
{
|
||||
return self->child;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkShaderBin *self = GTK_SHADER_BIN (widget);
|
||||
int width, height;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
|
||||
if (self->active_shader)
|
||||
{
|
||||
if (!self->active_shader->compiled)
|
||||
{
|
||||
GtkNative *native = gtk_widget_get_native (widget);
|
||||
GskRenderer *renderer = gtk_native_get_renderer (native);
|
||||
GError *error = NULL;
|
||||
|
||||
self->active_shader->compiled = TRUE;
|
||||
self->active_shader->compiled_ok =
|
||||
gsk_gl_shader_compile (self->active_shader->shader,
|
||||
renderer, &error);
|
||||
if (!self->active_shader->compiled_ok)
|
||||
{
|
||||
g_warning ("GtkShaderBin failed to compile shader: %s", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
if (self->active_shader->compiled_ok)
|
||||
{
|
||||
float border = self->active_shader->extra_border;
|
||||
graphene_vec2_t mouse;
|
||||
graphene_vec2_init (&mouse, self->mouse_x + border, self->mouse_y + border);
|
||||
gtk_snapshot_push_gl_shader (snapshot, self->active_shader->shader,
|
||||
&GRAPHENE_RECT_INIT(-border, -border, width+2*border, height+2*border),
|
||||
gsk_gl_shader_format_args (self->active_shader->shader,
|
||||
"u_time", self->time,
|
||||
"u_mouse", &mouse,
|
||||
NULL));
|
||||
gtk_widget_snapshot_child (widget, self->child, snapshot);
|
||||
gtk_snapshot_gl_shader_pop_texture (snapshot);
|
||||
gtk_snapshot_pop (snapshot);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* Non-shader fallback */
|
||||
gtk_widget_snapshot_child (widget, self->child, snapshot);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_bin_class_init (GtkShaderBinClass *class)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = gtk_shader_bin_finalize;
|
||||
object_class->dispose = gtk_shader_bin_dispose;
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
|
||||
widget_class->snapshot = gtk_shader_bin_snapshot;
|
||||
widget_class->state_flags_changed = gtk_shader_bin_state_flags_changed;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_shader_bin_new (void)
|
||||
{
|
||||
GtkShaderBin *self;
|
||||
|
||||
self = g_object_new (GTK_TYPE_SHADER_BIN, NULL);
|
||||
|
||||
return GTK_WIDGET (self);
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_SHADER_BIN (gtk_shader_bin_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkShaderBin, gtk_shader_bin, GTK, SHADER_BIN, GtkWidget)
|
||||
|
||||
GtkWidget *gtk_shader_bin_new (void);
|
||||
void gtk_shader_bin_add_shader (GtkShaderBin *self,
|
||||
GskGLShader *shader,
|
||||
GtkStateFlags state,
|
||||
GtkStateFlags state_mask,
|
||||
float extra_border);
|
||||
void gtk_shader_bin_set_child (GtkShaderBin *self,
|
||||
GtkWidget *child);
|
||||
GtkWidget *gtk_shader_bin_get_child (GtkShaderBin *self);
|
||||
|
||||
G_END_DECLS
|
@@ -1,361 +0,0 @@
|
||||
#include "gtkshaderstack.h"
|
||||
|
||||
struct _GtkShaderStack
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
|
||||
GskGLShader *shader;
|
||||
GPtrArray *children;
|
||||
int current;
|
||||
int next;
|
||||
gboolean backwards;
|
||||
|
||||
guint tick_id;
|
||||
float time;
|
||||
float duration;
|
||||
gint64 start_time;
|
||||
};
|
||||
|
||||
struct _GtkShaderStackClass
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
PROP_DURATION = 1,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *properties[NUM_PROPERTIES] = { NULL };
|
||||
|
||||
G_DEFINE_TYPE (GtkShaderStack, gtk_shader_stack, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
gtk_shader_stack_finalize (GObject *object)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (object);
|
||||
|
||||
g_object_unref (self->shader);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shader_stack_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
update_child_visible (GtkShaderStack *self)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < self->children->len; i++)
|
||||
{
|
||||
GtkWidget *child = g_ptr_array_index (self->children, i);
|
||||
|
||||
gtk_widget_set_child_visible (child,
|
||||
i == self->current || i == self->next);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
transition_cb (GtkWidget *widget,
|
||||
GdkFrameClock *clock,
|
||||
gpointer unused)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (widget);
|
||||
gint64 frame_time;
|
||||
|
||||
frame_time = gdk_frame_clock_get_frame_time (clock);
|
||||
|
||||
if (self->start_time == 0)
|
||||
self->start_time = frame_time;
|
||||
|
||||
self->time = (frame_time - self->start_time) / (float)G_USEC_PER_SEC;
|
||||
|
||||
gtk_widget_queue_draw (widget);
|
||||
|
||||
if (self->time >= self->duration)
|
||||
{
|
||||
self->current = self->next;
|
||||
self->next = -1;
|
||||
|
||||
update_child_visible (self);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
else
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
start_transition (GtkShaderStack *self)
|
||||
{
|
||||
self->start_time = 0;
|
||||
self->tick_id = gtk_widget_add_tick_callback (GTK_WIDGET (self),
|
||||
transition_cb,
|
||||
NULL, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
stop_transition (GtkShaderStack *self)
|
||||
{
|
||||
if (self->tick_id != 0)
|
||||
{
|
||||
gtk_widget_remove_tick_callback (GTK_WIDGET (self), self->tick_id);
|
||||
self->tick_id = 0;
|
||||
}
|
||||
|
||||
if (self->next != -1)
|
||||
self->current = self->next;
|
||||
self->next = -1;
|
||||
|
||||
update_child_visible (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_dispose (GObject *object)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (object);
|
||||
|
||||
stop_transition (self);
|
||||
|
||||
g_clear_pointer (&self->children, g_ptr_array_unref);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shader_stack_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_stack_transition (GtkShaderStack *self,
|
||||
gboolean forward)
|
||||
{
|
||||
stop_transition (self);
|
||||
|
||||
self->backwards = !forward;
|
||||
if (self->backwards)
|
||||
self->next = (self->current + self->children->len - 1) % self->children->len;
|
||||
else
|
||||
self->next = (self->current + 1) % self->children->len;
|
||||
|
||||
update_child_visible (self);
|
||||
|
||||
start_transition (self);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_init (GtkShaderStack *self)
|
||||
{
|
||||
self->children = g_ptr_array_new_with_free_func ((GDestroyNotify)gtk_widget_unparent);
|
||||
self->current = -1;
|
||||
self->next = -1;
|
||||
self->backwards = FALSE;
|
||||
self->duration = 1.0;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
int for_size,
|
||||
int *minimum,
|
||||
int *natural,
|
||||
int *minimum_baseline,
|
||||
int *natural_baseline)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (widget);
|
||||
int i;
|
||||
|
||||
*minimum = 0;
|
||||
*natural = 0;
|
||||
|
||||
for (i = 0; i < self->children->len; i++)
|
||||
{
|
||||
GtkWidget *child = g_ptr_array_index (self->children, i);
|
||||
int child_min, child_nat;
|
||||
|
||||
if (gtk_widget_get_visible (child))
|
||||
{
|
||||
gtk_widget_measure (child, orientation, for_size, &child_min, &child_nat, NULL, NULL);
|
||||
|
||||
*minimum = MAX (*minimum, child_min);
|
||||
*natural = MAX (*natural, child_nat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_size_allocate (GtkWidget *widget,
|
||||
int width,
|
||||
int height,
|
||||
int baseline)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (widget);
|
||||
GtkAllocation child_allocation;
|
||||
GtkWidget *child;
|
||||
int i;
|
||||
|
||||
child_allocation.x = 0;
|
||||
child_allocation.y = 0;
|
||||
child_allocation.width = width;
|
||||
child_allocation.height = height;
|
||||
|
||||
for (i = 0; i < self->children->len; i++)
|
||||
{
|
||||
child = g_ptr_array_index (self->children, i);
|
||||
if (gtk_widget_get_visible (child))
|
||||
gtk_widget_size_allocate (child, &child_allocation, -1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (widget);
|
||||
int width, height;
|
||||
GtkWidget *current, *next;
|
||||
|
||||
width = gtk_widget_get_width (widget);
|
||||
height = gtk_widget_get_height (widget);
|
||||
|
||||
current = g_ptr_array_index (self->children, self->current);
|
||||
|
||||
if (self->next == -1)
|
||||
{
|
||||
gtk_widget_snapshot_child (widget, current, snapshot);
|
||||
}
|
||||
else
|
||||
{
|
||||
GtkNative *native = gtk_widget_get_native (widget);
|
||||
GskRenderer *renderer = gtk_native_get_renderer (native);
|
||||
float progress;
|
||||
|
||||
next = g_ptr_array_index (self->children, self->next);
|
||||
|
||||
progress = self->time / self->duration;
|
||||
|
||||
if (self->backwards)
|
||||
{
|
||||
GtkWidget *tmp = next;
|
||||
next = current;
|
||||
current = tmp;
|
||||
progress = 1. - progress;
|
||||
}
|
||||
|
||||
if (gsk_gl_shader_compile (self->shader, renderer, NULL))
|
||||
{
|
||||
gtk_snapshot_push_gl_shader (snapshot,
|
||||
self->shader,
|
||||
&GRAPHENE_RECT_INIT(0, 0, width, height),
|
||||
gsk_gl_shader_format_args (self->shader,
|
||||
"progress", progress,
|
||||
NULL));
|
||||
|
||||
gtk_widget_snapshot_child (widget, current, snapshot);
|
||||
gtk_snapshot_gl_shader_pop_texture (snapshot); /* current child */
|
||||
gtk_widget_snapshot_child (widget, next, snapshot);
|
||||
gtk_snapshot_gl_shader_pop_texture (snapshot); /* next child */
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Non-shader fallback */
|
||||
gtk_widget_snapshot_child (widget, current, snapshot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DURATION:
|
||||
g_value_set_float (value, self->duration);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkShaderStack *self = GTK_SHADER_STACK (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_DURATION:
|
||||
self->duration = g_value_get_float (value);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shader_stack_class_init (GtkShaderStackClass *class)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = gtk_shader_stack_finalize;
|
||||
object_class->dispose = gtk_shader_stack_dispose;
|
||||
object_class->get_property = gtk_shader_stack_get_property;
|
||||
object_class->set_property = gtk_shader_stack_set_property;
|
||||
|
||||
widget_class->snapshot = gtk_shader_stack_snapshot;
|
||||
widget_class->measure = gtk_shader_stack_measure;
|
||||
widget_class->size_allocate = gtk_shader_stack_size_allocate;
|
||||
|
||||
properties[PROP_DURATION] =
|
||||
g_param_spec_float ("duration", "Duration", "Duration",
|
||||
0.1, 3.0, 1.0,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
gtk_shader_stack_new (void)
|
||||
{
|
||||
return g_object_new (GTK_TYPE_SHADER_STACK, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_stack_set_shader (GtkShaderStack *self,
|
||||
GskGLShader *shader)
|
||||
{
|
||||
g_set_object (&self->shader, shader);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_stack_add_child (GtkShaderStack *self,
|
||||
GtkWidget *child)
|
||||
{
|
||||
g_ptr_array_add (self->children, child);
|
||||
gtk_widget_set_parent (child, GTK_WIDGET (self));
|
||||
gtk_widget_queue_resize (GTK_WIDGET (self));
|
||||
|
||||
if (self->current == -1)
|
||||
self->current = 0;
|
||||
else
|
||||
gtk_widget_set_child_visible (child, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_shader_stack_set_active (GtkShaderStack *self,
|
||||
int index)
|
||||
{
|
||||
stop_transition (self);
|
||||
self->current = MIN (index, self->children->len);
|
||||
update_child_visible (self);
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_SHADER_STACK (gtk_shader_stack_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkShaderStack, gtk_shader_stack, GTK, SHADER_STACK, GtkWidget)
|
||||
|
||||
GtkWidget * gtk_shader_stack_new (void);
|
||||
void gtk_shader_stack_set_shader (GtkShaderStack *self,
|
||||
GskGLShader *shader);
|
||||
void gtk_shader_stack_add_child (GtkShaderStack *self,
|
||||
GtkWidget *child);
|
||||
void gtk_shader_stack_transition (GtkShaderStack *self,
|
||||
gboolean forward);
|
||||
void gtk_shader_stack_set_active (GtkShaderStack *self,
|
||||
int index);
|
||||
|
||||
G_END_DECLS
|
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
typedef struct _GdkHSLA GdkHSLA;
|
||||
|
||||
struct _GdkHSLA {
|
||||
|
@@ -13,7 +13,7 @@ static GtkWidget *window = NULL;
|
||||
static GtkWidget *scrolledwindow;
|
||||
static int selected;
|
||||
|
||||
#define N_WIDGET_TYPES 8
|
||||
#define N_WIDGET_TYPES 9
|
||||
|
||||
|
||||
static int hincrement = 5;
|
||||
@@ -73,30 +73,77 @@ populate_icons (void)
|
||||
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (scrolledwindow), grid);
|
||||
}
|
||||
|
||||
static char *content;
|
||||
static gsize content_len;
|
||||
|
||||
extern void fontify (const char *format, GtkTextBuffer *buffer);
|
||||
|
||||
enum {
|
||||
PLAIN_TEXT,
|
||||
HIGHLIGHTED_TEXT,
|
||||
UNDERLINED_TEXT,
|
||||
};
|
||||
|
||||
static void
|
||||
populate_text (gboolean highlight)
|
||||
underlinify (GtkTextBuffer *buffer)
|
||||
{
|
||||
GtkTextTagTable *tags;
|
||||
GtkTextTag *tag[3];
|
||||
GtkTextIter start, end;
|
||||
|
||||
tags = gtk_text_buffer_get_tag_table (buffer);
|
||||
tag[0] = gtk_text_tag_new ("error");
|
||||
tag[1] = gtk_text_tag_new ("strikeout");
|
||||
tag[2] = gtk_text_tag_new ("double");
|
||||
g_object_set (tag[0], "underline", PANGO_UNDERLINE_ERROR, NULL);
|
||||
g_object_set (tag[1], "strikethrough", TRUE, NULL);
|
||||
g_object_set (tag[2],
|
||||
"underline", PANGO_UNDERLINE_DOUBLE,
|
||||
"underline-rgba", &(GdkRGBA){0., 1., 1., 1. },
|
||||
NULL);
|
||||
gtk_text_tag_table_add (tags, tag[0]);
|
||||
gtk_text_tag_table_add (tags, tag[1]);
|
||||
gtk_text_tag_table_add (tags, tag[2]);
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &end);
|
||||
|
||||
while (TRUE)
|
||||
{
|
||||
gtk_text_iter_forward_word_end (&end);
|
||||
start = end;
|
||||
gtk_text_iter_backward_word_start (&start);
|
||||
gtk_text_buffer_apply_tag (buffer, tag[g_random_int_range (0, 3)], &start, &end);
|
||||
if (!gtk_text_iter_forward_word_ends (&end, 3))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
populate_text (const char *resource, int kind)
|
||||
{
|
||||
GtkWidget *textview;
|
||||
GtkTextBuffer *buffer;
|
||||
char *content;
|
||||
gsize content_len;
|
||||
GBytes *bytes;
|
||||
|
||||
if (!content)
|
||||
{
|
||||
GBytes *bytes;
|
||||
|
||||
bytes = g_resources_lookup_data ("/sources/font_features.c", 0, NULL);
|
||||
content = g_bytes_unref_to_data (bytes, &content_len);
|
||||
}
|
||||
bytes = g_resources_lookup_data (resource, 0, NULL);
|
||||
content = g_bytes_unref_to_data (bytes, &content_len);
|
||||
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_set_text (buffer, content, (int)content_len);
|
||||
|
||||
if (highlight)
|
||||
fontify ("c", buffer);
|
||||
switch (kind)
|
||||
{
|
||||
case HIGHLIGHTED_TEXT:
|
||||
fontify ("c", buffer);
|
||||
break;
|
||||
|
||||
case UNDERLINED_TEXT:
|
||||
underlinify (buffer);
|
||||
break;
|
||||
|
||||
case PLAIN_TEXT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
textview = gtk_text_view_new ();
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
@@ -155,14 +202,6 @@ populate_image (void)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
if (!content)
|
||||
{
|
||||
GBytes *bytes;
|
||||
|
||||
bytes = g_resources_lookup_data ("/sources/font_features.c", 0, NULL);
|
||||
content = g_bytes_unref_to_data (bytes, &content_len);
|
||||
}
|
||||
|
||||
image = gtk_picture_new_for_resource ("/sliding_puzzle/portland-rose.jpg");
|
||||
gtk_picture_set_can_shrink (GTK_PICTURE (image), FALSE);
|
||||
|
||||
@@ -255,35 +294,40 @@ set_widget_type (int type)
|
||||
|
||||
case 1:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling plain text");
|
||||
populate_text (FALSE);
|
||||
populate_text ("/sources/font_features.c", PLAIN_TEXT);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling complex text");
|
||||
populate_text (TRUE);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling colored text");
|
||||
populate_text ("/sources/font_features.c", HIGHLIGHTED_TEXT);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling text with underlines");
|
||||
populate_text ("/org/gtk/Demo4/Moby-Dick.txt", UNDERLINED_TEXT);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling text with Emoji");
|
||||
populate_emoji_text ();
|
||||
break;
|
||||
|
||||
case 4:
|
||||
case 5:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a big image");
|
||||
populate_image ();
|
||||
break;
|
||||
|
||||
case 5:
|
||||
case 6:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a list");
|
||||
populate_list ();
|
||||
break;
|
||||
|
||||
case 6:
|
||||
case 7:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a columned list");
|
||||
populate_list2 ();
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Scrolling a grid");
|
||||
populate_grid ();
|
||||
break;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="resizable">0</property>
|
||||
<property name="resizable">1</property>
|
||||
<property name="default-width">500</property>
|
||||
<property name="default-height">500</property>
|
||||
<child type="titlebar">
|
||||
|
@@ -14,6 +14,103 @@
|
||||
#include <gtk/gtk.h>
|
||||
#include "demo3widget.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GCancellable *cancellable = NULL;
|
||||
|
||||
static void
|
||||
load_texture (GTask *task,
|
||||
gpointer source_object,
|
||||
gpointer task_data,
|
||||
GCancellable *cable)
|
||||
{
|
||||
GFile *file = task_data;
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
|
||||
texture = gdk_texture_new_from_file (file, &error);
|
||||
|
||||
if (texture)
|
||||
g_task_return_pointer (task, texture, g_object_unref);
|
||||
else
|
||||
g_task_return_error (task, error);
|
||||
}
|
||||
|
||||
static void
|
||||
set_wait_cursor (GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_set_cursor_from_name (GTK_WIDGET (gtk_widget_get_root (widget)), "wait");
|
||||
}
|
||||
|
||||
static void
|
||||
unset_wait_cursor (GtkWidget *widget)
|
||||
{
|
||||
gtk_widget_set_cursor (GTK_WIDGET (gtk_widget_get_root (widget)), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_loaded (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GError *error = NULL;
|
||||
|
||||
texture = g_task_propagate_pointer (G_TASK (result), &error);
|
||||
|
||||
if (!texture)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!window)
|
||||
{
|
||||
g_object_unref (texture);
|
||||
return;
|
||||
}
|
||||
|
||||
unset_wait_cursor (GTK_WIDGET (data));
|
||||
|
||||
g_object_set (G_OBJECT (data), "texture", texture, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
open_file_async (GFile *file,
|
||||
GtkWidget *demo)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
set_wait_cursor (demo);
|
||||
|
||||
task = g_task_new (demo, cancellable, texture_loaded, demo);
|
||||
g_task_set_task_data (task, g_object_ref (file), g_object_unref);
|
||||
g_task_run_in_thread (task, load_texture);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
open_portland_rose (GtkWidget *button,
|
||||
GtkWidget *demo)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_uri ("resource:///transparent/portland-rose.jpg");
|
||||
open_file_async (file, demo);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static void
|
||||
open_large_image (GtkWidget *button,
|
||||
GtkWidget *demo)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = g_file_new_for_uri ("resource:///org/gtk/Demo4/large-image.png");
|
||||
open_file_async (file, demo);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static void
|
||||
file_opened (GObject *source,
|
||||
GAsyncResult *result,
|
||||
@@ -21,7 +118,6 @@ file_opened (GObject *source,
|
||||
{
|
||||
GFile *file;
|
||||
GError *error = NULL;
|
||||
GdkTexture *texture;
|
||||
|
||||
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
|
||||
|
||||
@@ -32,17 +128,9 @@ file_opened (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
texture = gdk_texture_new_from_file (file, &error);
|
||||
g_object_unref (file);
|
||||
if (!texture)
|
||||
{
|
||||
g_print ("%s\n", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
open_file_async (file, data);
|
||||
|
||||
g_object_set (G_OBJECT (data), "texture", texture, NULL);
|
||||
g_object_unref (texture);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -116,11 +204,26 @@ transform_from (GBinding *binding,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
free_cancellable (gpointer data)
|
||||
{
|
||||
g_cancellable_cancel (cancellable);
|
||||
g_clear_object (&cancellable);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cancel_load (GtkWidget *widget,
|
||||
GVariant *args,
|
||||
gpointer data)
|
||||
{
|
||||
unset_wait_cursor (widget);
|
||||
g_cancellable_cancel (G_CANCELLABLE (data));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_image_scaling (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *box;
|
||||
@@ -130,6 +233,7 @@ do_image_scaling (GtkWidget *do_widget)
|
||||
GtkWidget *scale;
|
||||
GtkWidget *dropdown;
|
||||
GtkWidget *button;
|
||||
GtkEventController *controller;
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Image Scaling");
|
||||
@@ -138,6 +242,20 @@ do_image_scaling (GtkWidget *do_widget)
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
|
||||
|
||||
cancellable = g_cancellable_new ();
|
||||
g_object_set_data_full (G_OBJECT (window), "cancellable",
|
||||
cancellable, free_cancellable);
|
||||
|
||||
controller = gtk_shortcut_controller_new ();
|
||||
gtk_shortcut_controller_add_shortcut (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
gtk_shortcut_new (
|
||||
gtk_keyval_trigger_new (GDK_KEY_Escape, 0),
|
||||
gtk_callback_action_new (cancel_load, cancellable, NULL)
|
||||
));
|
||||
gtk_shortcut_controller_set_scope (GTK_SHORTCUT_CONTROLLER (controller),
|
||||
GTK_SHORTCUT_SCOPE_GLOBAL);
|
||||
gtk_widget_add_controller (window, controller);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
@@ -156,6 +274,22 @@ do_image_scaling (GtkWidget *do_widget)
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (open_file), widget);
|
||||
gtk_box_append (GTK_BOX (box2), button);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_button_set_child (GTK_BUTTON (button),
|
||||
gtk_image_new_from_resource ("/org/gtk/Demo4/portland-rose-thumbnail.png"));
|
||||
gtk_widget_add_css_class (button, "image-button");
|
||||
gtk_widget_set_tooltip_text (button, "Portland Rose");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (open_portland_rose), widget);
|
||||
gtk_box_append (GTK_BOX (box2), button);
|
||||
|
||||
button = gtk_button_new ();
|
||||
gtk_button_set_child (GTK_BUTTON (button),
|
||||
gtk_image_new_from_resource ("/org/gtk/Demo4/large-image-thumbnail.png"));
|
||||
gtk_widget_add_css_class (button, "image-button");
|
||||
gtk_widget_set_tooltip_text (button, "Large image");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (open_large_image), widget);
|
||||
gtk_box_append (GTK_BOX (box2), button);
|
||||
|
||||
button = gtk_button_new_from_icon_name ("object-rotate-right-symbolic");
|
||||
gtk_widget_set_tooltip_text (button, "Rotate");
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (rotate), widget);
|
||||
@@ -191,7 +325,9 @@ do_image_scaling (GtkWidget *do_widget)
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_set_visible (window, TRUE);
|
||||
else
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
{
|
||||
gtk_window_destroy (GTK_WINDOW (window));
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
||||
|
@@ -1,41 +0,0 @@
|
||||
uniform float progress;
|
||||
uniform sampler2D u_texture1;
|
||||
uniform sampler2D u_texture2;
|
||||
|
||||
vec4 getFromColor (vec2 uv) {
|
||||
return GskTexture(u_texture1, uv);
|
||||
}
|
||||
|
||||
vec4 getToColor (vec2 uv) {
|
||||
return GskTexture(u_texture2, uv);
|
||||
}
|
||||
|
||||
// Source: https://gl-transitions.com/editor/kaleidoscope
|
||||
// Author: nwoeanhinnogaehr
|
||||
// License: MIT
|
||||
|
||||
const float speed = 1.0;
|
||||
const float angle = 1.0;
|
||||
const float power = 1.5;
|
||||
|
||||
vec4 transition(vec2 uv) {
|
||||
vec2 p = uv.xy / vec2(1.0).xy;
|
||||
vec2 q = p;
|
||||
float t = pow(progress, power)*speed;
|
||||
p = p -0.5;
|
||||
for (int i = 0; i < 7; i++) {
|
||||
p = vec2(sin(t)*p.x + cos(t)*p.y, sin(t)*p.y - cos(t)*p.x);
|
||||
t += angle;
|
||||
p = abs(mod(p, 2.0) - 1.0);
|
||||
}
|
||||
abs(mod(p, 1.0));
|
||||
return mix(
|
||||
mix(getFromColor(q), getToColor(q), progress),
|
||||
mix(getFromColor(p), getToColor(p), progress), 1.0 - 2.0*abs(progress - 0.5));
|
||||
}
|
||||
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
fragColor = transition(uv);
|
||||
}
|
BIN
demos/gtk-demo/large-image-thumbnail.png
Normal file
BIN
demos/gtk-demo/large-image-thumbnail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
BIN
demos/gtk-demo/large-image.png
Normal file
BIN
demos/gtk-demo/large-image.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 622 KiB |
@@ -355,28 +355,28 @@ create_clocks_model (void)
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
/* A bunch of timezones with GTK hackers */
|
||||
clock = gtk_clock_new ("San Francisco", g_time_zone_new ("America/Los_Angeles"));
|
||||
clock = gtk_clock_new ("San Francisco", g_time_zone_new_identifier ("America/Los_Angeles"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Xalapa", g_time_zone_new ("America/Mexico_City"));
|
||||
clock = gtk_clock_new ("Xalapa", g_time_zone_new_identifier ("America/Mexico_City"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Boston", g_time_zone_new ("America/New_York"));
|
||||
clock = gtk_clock_new ("Boston", g_time_zone_new_identifier ("America/New_York"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("London", g_time_zone_new ("Europe/London"));
|
||||
clock = gtk_clock_new ("London", g_time_zone_new_identifier ("Europe/London"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Berlin", g_time_zone_new ("Europe/Berlin"));
|
||||
clock = gtk_clock_new ("Berlin", g_time_zone_new_identifier ("Europe/Berlin"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Moscow", g_time_zone_new ("Europe/Moscow"));
|
||||
clock = gtk_clock_new ("Moscow", g_time_zone_new_identifier ("Europe/Moscow"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("New Delhi", g_time_zone_new ("Asia/Kolkata"));
|
||||
clock = gtk_clock_new ("New Delhi", g_time_zone_new_identifier ("Asia/Kolkata"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
clock = gtk_clock_new ("Shanghai", g_time_zone_new ("Asia/Shanghai"));
|
||||
clock = gtk_clock_new ("Shanghai", g_time_zone_new_identifier ("Asia/Shanghai"));
|
||||
g_list_store_append (result, clock);
|
||||
g_object_unref (clock);
|
||||
|
||||
|
@@ -156,11 +156,6 @@ gtk_demo_run (GtkDemo *self,
|
||||
if (result == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (GTK_IS_WINDOW (result))
|
||||
{
|
||||
gtk_window_set_transient_for (GTK_WINDOW (result), GTK_WINDOW (window));
|
||||
gtk_window_set_modal (GTK_WINDOW (result), TRUE);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -832,9 +827,6 @@ static gboolean
|
||||
demo_can_run (GtkWidget *window,
|
||||
const char *name)
|
||||
{
|
||||
if (name != NULL && strcmp (name, "gltransition") == 0)
|
||||
return GSK_IS_GL_RENDERER (gtk_native_get_renderer (GTK_NATIVE (window)));
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -936,7 +928,7 @@ search_results_update (GObject *filter_model,
|
||||
char *text;
|
||||
|
||||
if (n_items > 0)
|
||||
text = g_strdup_printf (ngettext ("%ld search result", "%ld search results", n_items), n_items);
|
||||
text = g_strdup_printf (ngettext ("%ld search result", "%ld search results", (long) n_items), (long) n_items);
|
||||
else
|
||||
text = g_strdup (_("No search results"));
|
||||
|
||||
@@ -1068,6 +1060,8 @@ command_line (GApplication *app,
|
||||
|
||||
window = gtk_application_get_windows (GTK_APPLICATION (app))->data;
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (window), "org.gtk.Demo4");
|
||||
|
||||
if (name == NULL)
|
||||
goto out;
|
||||
|
||||
|
@@ -33,7 +33,6 @@ demos = files([
|
||||
'gears.c',
|
||||
'gestures.c',
|
||||
'glarea.c',
|
||||
'gltransition.c',
|
||||
'headerbar.c',
|
||||
'hypertext.c',
|
||||
'iconscroll.c',
|
||||
@@ -117,10 +116,7 @@ extra_demo_sources = files([
|
||||
'gtkfishbowl.c',
|
||||
'fontplane.c',
|
||||
'gtkgears.c',
|
||||
'gtkshaderbin.c',
|
||||
'gtkshadertoy.c',
|
||||
'gtkshaderstack.c',
|
||||
'gskshaderpaintable.c',
|
||||
'hsla.c',
|
||||
'puzzlepiece.c',
|
||||
'bluroverlay.c',
|
||||
|
@@ -5,4 +5,4 @@
|
||||
#define NODE_TYPE_WIDGET (node_widget_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (NodeWidget, node_widget, NODE, WIDGET, GtkWidget)
|
||||
|
||||
GtkWidget * node_widget_new (const char *file);
|
||||
GtkWidget * node_widget_new (const char *resource);
|
||||
|
@@ -225,7 +225,8 @@ print_ready (GObject *source,
|
||||
|
||||
if (!g_output_stream_close (stream, NULL, &error))
|
||||
{
|
||||
g_print ("Error from close: %s\n", error->message);
|
||||
if (!g_error_matches (error, GTK_DIALOG_ERROR, GTK_DIALOG_ERROR_DISMISSED))
|
||||
g_print ("Error from close: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
|
BIN
demos/gtk-demo/portland-rose-thumbnail.png
Normal file
BIN
demos/gtk-demo/portland-rose-thumbnail.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
@@ -1,34 +0,0 @@
|
||||
uniform float progress;
|
||||
uniform sampler2D u_texture1;
|
||||
uniform sampler2D u_texture2;
|
||||
|
||||
vec4 getFromColor (vec2 uv) {
|
||||
return GskTexture(u_texture1, uv);
|
||||
}
|
||||
|
||||
vec4 getToColor (vec2 uv) {
|
||||
return GskTexture(u_texture2, uv);
|
||||
}
|
||||
|
||||
// Source: https://gl-transitions.com/editor/Radial
|
||||
// License: MIT
|
||||
// Author: Xaychru
|
||||
|
||||
const float smoothness = 1.0;
|
||||
|
||||
const float PI = 3.141592653589;
|
||||
|
||||
vec4 transition(vec2 p) {
|
||||
vec2 rp = p*2.-1.;
|
||||
return mix(
|
||||
getToColor(p),
|
||||
getFromColor(p),
|
||||
smoothstep(0., smoothness, atan(rp.y,rp.x) - (progress-.5) * PI * 2.5)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
fragColor = transition(uv);
|
||||
}
|
@@ -1,43 +0,0 @@
|
||||
uniform float u_time;
|
||||
uniform vec2 u_mouse;
|
||||
uniform sampler2D u_texture1;
|
||||
|
||||
#define PI 3.141592654
|
||||
|
||||
float decay(float v, float t)
|
||||
{
|
||||
return v * (1.0 / (1.0 + t*t));
|
||||
}
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
// Temporary to loop time every 1 sec
|
||||
float time = u_time;
|
||||
// we normalize all the effects according to the min height/width
|
||||
float size = min(resolution.x, resolution.y);
|
||||
|
||||
// Animate one wave over size in 0.3 sec
|
||||
float wave_speed = size / 0.3;
|
||||
float wave_length = size / 1.0;
|
||||
float wave_height = size * 0.1;
|
||||
|
||||
vec2 center = u_mouse;
|
||||
vec2 direction_from_center = fragCoord - center;
|
||||
float distance_from_center = length(direction_from_center);
|
||||
|
||||
/* Normalize direction */
|
||||
direction_from_center = direction_from_center / distance_from_center;
|
||||
|
||||
float propagation_length = time * wave_speed;
|
||||
|
||||
float t = (propagation_length - distance_from_center) / wave_length;
|
||||
float offset_magnitude = 0.0;
|
||||
if (t > 0.0)
|
||||
offset_magnitude = decay(wave_height * sin(t * 2.0 * PI), t);
|
||||
|
||||
vec2 offset = direction_from_center * min(offset_magnitude, distance_from_center);
|
||||
vec2 source = fragCoord - offset;
|
||||
|
||||
vec2 uv2 = source / resolution;
|
||||
fragColor = GskTexture(u_texture1, vec2(uv2.x, 1.0-uv2.y));
|
||||
}
|
@@ -43,7 +43,7 @@ GtkListItemFactory *
|
||||
suggestion_entry_get_factory (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_use_filter (SuggestionEntry *self,
|
||||
gboolean use_ilter);
|
||||
gboolean use_filter);
|
||||
gboolean suggestion_entry_get_use_filter (SuggestionEntry *self);
|
||||
|
||||
void suggestion_entry_set_expression (SuggestionEntry *self,
|
||||
|
@@ -1,33 +0,0 @@
|
||||
uniform float progress;
|
||||
uniform sampler2D u_texture1;
|
||||
uniform sampler2D u_texture2;
|
||||
|
||||
vec4 getFromColor (vec2 uv) {
|
||||
return GskTexture(u_texture1, uv);
|
||||
}
|
||||
|
||||
vec4 getToColor (vec2 uv) {
|
||||
return GskTexture(u_texture2, uv);
|
||||
}
|
||||
|
||||
// Source: https://gl-transitions.com/editor/wind
|
||||
// Author: gre
|
||||
// License: MIT
|
||||
|
||||
const float size = 0.2;
|
||||
|
||||
float rand(vec2 co) {
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
vec4 transition(vec2 p) {
|
||||
float r = rand(vec2(0, p.y));
|
||||
float m = smoothstep(0.0, -size, p.x*(1.0-size) + size*r - (progress * (1.0 + size)));
|
||||
return mix(getFromColor(p), getToColor(p), m);
|
||||
}
|
||||
|
||||
|
||||
void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
|
||||
{
|
||||
fragColor = transition(uv);
|
||||
}
|
@@ -139,6 +139,8 @@ icon_browser_app_activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.IconBrowser4");
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
|
@@ -219,6 +219,8 @@ node_editor_application_activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (win), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (win), "org.gtk.gtk4.NodeEditor");
|
||||
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
@@ -299,7 +301,7 @@ node_editor_application_new (void)
|
||||
|
||||
app = g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
||||
"application-id", "org.gtk.gtk4.NodeEditor",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
"flags", G_APPLICATION_HANDLES_OPEN | G_APPLICATION_NON_UNIQUE,
|
||||
NULL);
|
||||
|
||||
g_application_add_main_option (G_APPLICATION (app), "version", 0, 0,G_OPTION_ARG_NONE, "Show program version", NULL);
|
||||
|
@@ -925,7 +925,7 @@ export_image_response_cb (GObject *source,
|
||||
GdkTexture *texture;
|
||||
GskRenderer *renderer;
|
||||
|
||||
renderer = gsk_gl_renderer_new ();
|
||||
renderer = gsk_ngl_renderer_new ();
|
||||
if (!gsk_renderer_realize_for_display (renderer, gdk_display_get_default (), NULL))
|
||||
{
|
||||
g_object_unref (renderer);
|
||||
@@ -1205,6 +1205,19 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
update_paste_action (GdkClipboard *clipboard,
|
||||
GParamSpec *pspec,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (data);
|
||||
gboolean has_node;
|
||||
|
||||
has_node = gdk_content_formats_contain_mime_type (gdk_clipboard_get_formats (clipboard), "application/x-gtk-render-node");
|
||||
|
||||
gtk_widget_action_set_enabled (widget, "paste-node", has_node);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_realize (GtkWidget *widget)
|
||||
{
|
||||
@@ -1242,6 +1255,7 @@ node_editor_window_realize (GtkWidget *widget)
|
||||
self->after_paint_handler = g_signal_connect (frameclock, "after-paint",
|
||||
G_CALLBACK (after_paint), self);
|
||||
|
||||
g_signal_connect (gtk_widget_get_clipboard (widget), "notify::formats", G_CALLBACK (update_paste_action), widget);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1251,6 +1265,8 @@ node_editor_window_unrealize (GtkWidget *widget)
|
||||
GdkFrameClock *frameclock;
|
||||
guint i;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (gtk_widget_get_clipboard (widget), update_paste_action, widget);
|
||||
|
||||
frameclock = gtk_widget_get_frame_clock (widget);
|
||||
g_signal_handler_disconnect (frameclock, self->after_paint_handler);
|
||||
self->after_paint_handler = 0;
|
||||
@@ -1615,6 +1631,41 @@ edit_action_cb (GtkWidget *widget,
|
||||
node_editor_window_edit (self, &start);
|
||||
}
|
||||
|
||||
static void
|
||||
text_received (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer data)
|
||||
{
|
||||
GdkClipboard *clipboard = GDK_CLIPBOARD (source);
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (data);
|
||||
char *text;
|
||||
|
||||
text = gdk_clipboard_read_text_finish (clipboard, result, NULL);
|
||||
if (text)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter start, end;
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
|
||||
gtk_text_buffer_begin_user_action (buffer);
|
||||
gtk_text_buffer_get_bounds (buffer, &start, &end);
|
||||
gtk_text_buffer_delete (buffer, &start, &end);
|
||||
gtk_text_buffer_insert (buffer, &start, text, -1);
|
||||
gtk_text_buffer_end_user_action (buffer);
|
||||
g_free (text);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
paste_node_cb (GtkWidget *widget,
|
||||
const char *action_name,
|
||||
GVariant *parameter)
|
||||
{
|
||||
GdkClipboard *clipboard = gtk_widget_get_clipboard (widget);
|
||||
|
||||
gdk_clipboard_read_text_async (clipboard, NULL, text_received, widget);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@@ -1727,6 +1778,13 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
action = gtk_named_action_new ("smart-edit");
|
||||
shortcut = gtk_shortcut_new (trigger, action);
|
||||
gtk_widget_class_add_shortcut (widget_class, shortcut);
|
||||
|
||||
gtk_widget_class_install_action (widget_class, "paste-node", NULL, paste_node_cb);
|
||||
|
||||
trigger = gtk_keyval_trigger_new (GDK_KEY_v, GDK_CONTROL_MASK | GDK_SHIFT_MASK);
|
||||
action = gtk_named_action_new ("paste-node");
|
||||
shortcut = gtk_shortcut_new (trigger, action);
|
||||
gtk_widget_class_add_shortcut (widget_class, shortcut);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
|
@@ -22,6 +22,10 @@
|
||||
</menu>
|
||||
<menu id="extra_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Paste _Node</attribute>
|
||||
<attribute name="action">paste-node</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">Assisted _Edit</attribute>
|
||||
<attribute name="action">smart-edit</attribute>
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<gresource prefix="/org/gtk/gtk4/node-editor">
|
||||
<file preprocess="xml-stripblanks">node-editor-window.ui</file>
|
||||
<file preprocess="xml-stripblanks">help-window.ui</file>
|
||||
<file>node-format.md</file>
|
||||
<file alias='node-format.md'>../../docs/reference/gtk/node-format.md</file>
|
||||
<file alias='icons/apps/org.gtk.gtk4.NodeEditor.svg'>data/scalable/apps/org.gtk.gtk4.NodeEditor.svg</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
@@ -798,7 +798,7 @@ activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (main_window), "devel");
|
||||
|
||||
gtk_window_set_icon_name (GTK_WINDOW (main_window), "text-editor");
|
||||
gtk_window_set_icon_name (GTK_WINDOW (main_window), "org.gtk.PrintEditor4");
|
||||
gtk_window_set_default_size (GTK_WINDOW (main_window), 400, 600);
|
||||
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE);
|
||||
update_title (GTK_WINDOW (main_window));
|
||||
|
@@ -2241,6 +2241,7 @@ activate (GApplication *app)
|
||||
if (g_strcmp0 (PROFILE, "devel") == 0)
|
||||
gtk_widget_add_css_class (GTK_WIDGET (window), "devel");
|
||||
|
||||
gtk_window_set_icon_name (window, "org.gtk.WidgetFactory4");
|
||||
gtk_application_add_window (GTK_APPLICATION (app), window);
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (window),
|
||||
win_entries, G_N_ELEMENTS (win_entries),
|
||||
|
@@ -151,10 +151,11 @@ Checks whether the widget is set to be visible or not.
|
||||
- Methods are special functions whose first argument is always the instance
|
||||
of a certain class. The instance argument for newly written code should be
|
||||
called `self`.
|
||||
- If a method is a setter or a getter for an object property, you should
|
||||
add an `(attributes org.gtk.Method.set_property=property-name)` or a
|
||||
an `(attributes org.gtk.Method.get_property=property-name)` annotation
|
||||
to the method's identifier
|
||||
- If a method is a setter or a getter for an object property
|
||||
`GtkClassName:prop-name`, and if its name does not match the naming scheme
|
||||
`gtk_class_name_{g,s}et_prop_name`, you should add a `(set-property
|
||||
prop-name)` or a `(get-property prop-name)` annotation to the method's
|
||||
identifier
|
||||
- If a method changes one or more properties as side effect, link those
|
||||
properties in the method's description
|
||||
- If a method is a signal emitter, you should use the
|
||||
@@ -192,9 +193,10 @@ Checks whether the widget is set to be visible or not.
|
||||
purposes.
|
||||
- Always note if setting a property has side effects, like causing another
|
||||
property to change state.
|
||||
- If the property has public accessors you should annotate it with
|
||||
the `(attributes org.gtk.Property.set=setter_function)` and
|
||||
`(attributes org.gtk.Property.get=getter_function)` attributes
|
||||
- If a property `GtkClassName:prop-name` has a public getter or setter, and
|
||||
they do not match the naming scheme `gtk_class_name_{g,s}et_prop_name` you
|
||||
should annotate it with the `(setter setter_function)` and `(getter
|
||||
getter_function)`.
|
||||
- The syntax for property documentation is:
|
||||
|
||||
```c
|
||||
|
@@ -111,3 +111,11 @@ content_images = [
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gdk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
[[object]]
|
||||
name = "DECLARE_INTERNAL_TYPE"
|
||||
hidden = true
|
||||
|
||||
[[object]]
|
||||
pattern = "KEY_*"
|
||||
check_ignore = true
|
||||
|
@@ -29,6 +29,18 @@ if get_option('documentation')
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gdk',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gdk4_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gdk_gir[0],
|
||||
],
|
||||
depends: gdk_gir[0],
|
||||
suite: ['docs', 'failing'],
|
||||
)
|
||||
|
||||
if x11_enabled
|
||||
gdk4x11_toml = configure_file(
|
||||
input: 'gdk4-x11.toml.in',
|
||||
@@ -87,5 +99,17 @@ if get_option('documentation')
|
||||
install: true,
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gdk-wayland',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gdk4wayland_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gdk_wayland_gir[0],
|
||||
],
|
||||
depends: gdk_wayland_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
endif
|
||||
endif
|
||||
|
@@ -66,3 +66,7 @@ content_images = [
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gsk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
[[object]]
|
||||
name = "INCLUDE_WARNING"
|
||||
hidden = true
|
||||
|
@@ -30,4 +30,16 @@ if get_option('documentation')
|
||||
install: true,
|
||||
install_dir: docs_dir,
|
||||
)
|
||||
|
||||
test('doc-check-gsk',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gsk4_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gsk_gir[0],
|
||||
],
|
||||
depends: gsk_gir[0],
|
||||
suite: ['docs'],
|
||||
)
|
||||
endif
|
||||
|
@@ -1,12 +1,16 @@
|
||||
Title: The Broadway windowing system
|
||||
Slug: broadway
|
||||
|
||||
## Using GTK with Broadway
|
||||
|
||||
The GDK Broadway backend provides support for displaying GTK applications in
|
||||
a web browser, using HTML5 and web sockets.
|
||||
|
||||
To run your application in this way, first run the broadway server,
|
||||
Broadway was written as an experiment and is not the most actively developed
|
||||
backend. It supports the features that were required of GDK backends in GTK 4.0,
|
||||
but may not be up-to-date with the latest developments.
|
||||
|
||||
## Using GTK with Broadway
|
||||
|
||||
To run your application under Broadway, first run the broadway server,
|
||||
`gtk-broadwayd`, that ships with GTK:
|
||||
|
||||
```
|
||||
|
@@ -140,7 +140,7 @@ Other libraries are maintained separately.
|
||||
file formats. It is available [here](ttps://download.gnome.org/sources/gdk-pixbuf/).
|
||||
- [Pango](http://www.pango.org) is a library for internationalized
|
||||
text handling. It is available [here](https://download.gnome.org/sources/pango/).
|
||||
- [GObject Introspection](https://wiki.gnome.org/Projects/GObjectIntrospection)
|
||||
- [GObject Introspection](https://gitlab.gnome.org/GNOME/gobject-introspection)
|
||||
is a framework for making introspection data available to language
|
||||
bindings. It is available [here](https://download.gnome.org/sources/gobject-introspection/).
|
||||
- The [GNU libiconv](https://www.gnu.org/software/libiconv/) library
|
||||
|
@@ -93,11 +93,12 @@ Colors can be expressed in numerous ways in CSS (see the
|
||||
many (but not all) of these.
|
||||
|
||||
You can use rgb(), rgba(), hsl() with both the legacy or the modern CSS
|
||||
syntax, and calc() can be used as well in color expressions.
|
||||
syntax, and calc() can be used as well in color expressions. hwb(), oklab(),
|
||||
oklch(), color(), color-mix() and relative colors are supported as well.
|
||||
|
||||
### Non-CSS Colors
|
||||
|
||||
GTK extends the CSS syntax with several additional ways to specify colors.
|
||||
GTK extends the CSS syntax with several additional ways to specify colors.
|
||||
|
||||
These extensions are deprecated and should be replaced by the equivalent
|
||||
standard CSS notions.
|
||||
|
@@ -66,8 +66,8 @@ The clock has several phases:
|
||||
- Layout
|
||||
- Paint
|
||||
|
||||
The phases happens in this order and we will always run each
|
||||
phase through before going back to the start.
|
||||
The phases happen in this order and all phases will always run
|
||||
through before going back to the start.
|
||||
|
||||
The Events phase is a stretch of time between each redraw where
|
||||
GTK processes input events from the user and other events
|
||||
@@ -99,16 +99,15 @@ reaches the requested phase. However, in practice most things
|
||||
happen at higher levels:
|
||||
|
||||
- If you are doing an animation, you can use
|
||||
gtk_widget_add_tick_callback() which will cause a regular
|
||||
[method@Gtk.Widget.add_tick_callback] which will cause a regular
|
||||
beating of the clock with a callback in the Update phase
|
||||
until you stop the tick.
|
||||
- If some state changes that causes the size of your widget to
|
||||
change you call gtk_widget_queue_resize() which will request
|
||||
change you call [method@Gtk.Widget.queue_resize] which will request
|
||||
a Layout phase and mark your widget as needing relayout.
|
||||
- If some state changes so you need to redraw some area of
|
||||
your widget you use the normal gtk_widget_queue_draw()
|
||||
set of functions. These will request a Paint phase and
|
||||
mark the region as needing redraw.
|
||||
- If some state changes so you need to redraw your widget you
|
||||
use [method@Gtk.Widget.queue_draw] to request a Paint phase for
|
||||
your widget.
|
||||
|
||||
There are also a lot of implicit triggers of these from the
|
||||
CSS layer (which does animations, resizes and repaints as needed).
|
||||
|
@@ -66,10 +66,6 @@ You can compile the program above with GCC using:
|
||||
gcc $( pkg-config --cflags gtk4 ) -o example-0 example-0.c $( pkg-config --libs gtk4 )
|
||||
```
|
||||
|
||||
**Note**: If the above compilation does not work due to an error regarding `G_APPLICATION_DEFAULT_FLAGS`
|
||||
this could be due to your OS providing an older version of GLib. For GLib versions older than 2.74 you
|
||||
will need to replace `G_APPLICATION_DEFAULT_FLAGS` with `G_APPLICATION_FLAGS_NONE` in this example, and
|
||||
others in this documentation.
|
||||
For more information on how to compile a GTK application, please
|
||||
refer to the [Compiling GTK Applications](compiling.html)
|
||||
section in this reference.
|
||||
@@ -245,9 +241,6 @@ to connect the "clicked" signal with [method@Gtk.Window.destroy], then the funct
|
||||
would be called on `button` (which would not go well, since the function expects
|
||||
a `GtkWindow` as argument).
|
||||
|
||||
More information about creating buttons can be found
|
||||
[here](https://wiki.gnome.org/HowDoI/Buttons).
|
||||
|
||||
The rest of the code in `example-1.c` is identical to `example-0.c`. The next
|
||||
section will elaborate further on how to add several [class@Gtk.Widget]s to your
|
||||
GTK application.
|
||||
|
97
docs/reference/gtk/gtk4-image-tool.rst
Normal file
97
docs/reference/gtk/gtk4-image-tool.rst
Normal file
@@ -0,0 +1,97 @@
|
||||
.. _gtk4-image-tool(1):
|
||||
|
||||
====================
|
||||
gtk4-image-tool
|
||||
====================
|
||||
|
||||
-----------------------
|
||||
Image Utility
|
||||
-----------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-image-tool** <COMMAND> [OPTIONS...] <FILE>...
|
||||
|
|
||||
| **gtk4-image-tool** compare [OPTIONS...] <FILE1> <FILE2>
|
||||
| **gtk4-image-tool** convert [OPTIONS...] <FILE1> <FILE2>
|
||||
| **gtk4-image-tool** info [OPTIONS...] <FILE>
|
||||
| **gtk4-image-tool** relabel [OPTIONS...] <FILE1> <FILE2>
|
||||
| **gtk4-image-tool** show [OPTIONS...] <FILE>...
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-image-tool`` can perform various operations on images.
|
||||
|
||||
COMMANDS
|
||||
--------
|
||||
|
||||
Information
|
||||
^^^^^^^^^^^
|
||||
|
||||
The ``info`` command shows general information about the image, such
|
||||
as its format and color state.
|
||||
|
||||
Showing
|
||||
^^^^^^^
|
||||
|
||||
The ``show`` command displays one or more images, side-by-side.
|
||||
|
||||
``--undecorated``
|
||||
|
||||
Removes window decorations. This is meant for rendering of exactly the image
|
||||
without any titlebar.
|
||||
|
||||
Compare
|
||||
^^^^^^^
|
||||
|
||||
The ``compare`` command compares two images. If any differences are found,
|
||||
the exit code is 1. If the images are identical, it is 0.
|
||||
|
||||
``--output=FILE``
|
||||
|
||||
Save the differences as a png image in ``FILE``.
|
||||
|
||||
``--quiet``
|
||||
|
||||
Don't write results to stdout.
|
||||
|
||||
Conversion
|
||||
^^^^^^^^^^
|
||||
|
||||
The ``convert`` command converts the image to a different format or color state.
|
||||
|
||||
``--format=FORMAT``
|
||||
|
||||
Convert to the given format. The supported formats can be listed
|
||||
with ``--format=list``.
|
||||
|
||||
``--color-state=COLORSTATE``
|
||||
|
||||
Convert to the given color state. The supported color states can be
|
||||
listed with ``--format=list``.
|
||||
|
||||
``--cicp=CICP``
|
||||
|
||||
Convert to a color state that is specified as a cicp tuple. The cicp tuple
|
||||
must be specified as four numbers, separated by /, e.g. 1/13/6/0.
|
||||
|
||||
Relabeling
|
||||
^^^^^^^^^^
|
||||
|
||||
The ``relabel`` command changes the color state of an image without conversion.
|
||||
This can be useful to produce wrong color renderings for diagnostics.
|
||||
|
||||
``--color-state=COLORSTATE``
|
||||
|
||||
Relabel to the given color state. The supported color states can be
|
||||
listed with ``--format=list``.
|
||||
|
||||
``--cicp=CICP``
|
||||
|
||||
Relabel to a color state that is specified as a cicp tuple. The cicp tuple
|
||||
must be specified as four numbers, separated by /, e.g. 1/13/6/0.
|
@@ -18,6 +18,7 @@ SYNOPSIS
|
||||
|
|
||||
| **gtk4-rendernode-tool** benchmark [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** compare [OPTIONS...] <FILE1> <FILE2>
|
||||
| **gtk4-rendernode-tool** extract [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** info [OPTIONS...] <FILE>
|
||||
| **gtk4-rendernode-tool** render [OPTIONS...] <FILE> [<FILE>]
|
||||
| **gtk4-rendernode-tool** show [OPTIONS...] <FILE>
|
||||
@@ -99,3 +100,15 @@ exit code is 1. If the images are identical, it is 0.
|
||||
``--quiet``
|
||||
|
||||
Don't write results to stdout.
|
||||
|
||||
|
||||
Extract
|
||||
^^^^^^^
|
||||
|
||||
The ``extract`` command saves all the data urls found in a node file to a given
|
||||
directory. The file names for the extracted files are derived from the mimetype
|
||||
of the url.
|
||||
|
||||
``--dir=DIRECTORY``
|
||||
|
||||
Save extracted files in ``DIRECTORY`` (defaults to the current directory).
|
||||
|
@@ -77,6 +77,7 @@ content_files = [
|
||||
"section-tree-widget.md",
|
||||
"migrating-2to4.md",
|
||||
"migrating-3to4.md",
|
||||
"migrating-4to5.md",
|
||||
"broadway.md",
|
||||
"osx.md",
|
||||
"wayland.md",
|
||||
@@ -84,6 +85,7 @@ content_files = [
|
||||
"x11.md",
|
||||
"tools.md",
|
||||
"visual_index.md",
|
||||
"node-format.md",
|
||||
]
|
||||
content_images = [
|
||||
"../images/favicon.svg",
|
||||
@@ -250,3 +252,12 @@ content_images = [
|
||||
]
|
||||
content_base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/docs/reference/gtk/"
|
||||
urlmap_file = "urlmap.js"
|
||||
|
||||
[[object]]
|
||||
name = "StyleProvider"
|
||||
[[object.signal]]
|
||||
name = "gtk-private-changed"
|
||||
hidden = true
|
||||
|
||||
[check]
|
||||
ignore_deprecated = true
|
||||
|
@@ -140,6 +140,11 @@ capture phase, and key bindings locally, during the target phase.
|
||||
Under the hood, all shortcuts are represented as instances of `GtkShortcut`,
|
||||
and they are managed by `GtkShortcutController`.
|
||||
|
||||
Note that GTK does not do anything to map the primary shortcut modifier
|
||||
to <kbd>Command</kbd> on macOS. If you want to let your application to follow
|
||||
macOS user experience conventions, you must create macOS-specific keyboard shortcuts.
|
||||
The <kbd>Command</kbd> is named `Meta` (`GDK_META_MASK`) in GTK.
|
||||
|
||||
## Text input
|
||||
|
||||
When actual text input is needed (i.e. not just keyboard shortcuts),
|
||||
|
@@ -14,6 +14,7 @@ expand_content_md_files = [
|
||||
'running.md',
|
||||
'migrating-2to4.md',
|
||||
'migrating-3to4.md',
|
||||
'migrating-4to5.md',
|
||||
'actions.md',
|
||||
'input-handling.md',
|
||||
'drawing-model.md',
|
||||
@@ -63,6 +64,18 @@ if get_option('documentation')
|
||||
install_dir: docs_dir,
|
||||
install_tag: 'doc',
|
||||
)
|
||||
|
||||
test('doc-check-gtk',
|
||||
gidocgen,
|
||||
args: [
|
||||
'check',
|
||||
'--config', gtk4_toml,
|
||||
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
|
||||
gtk_gir[0],
|
||||
],
|
||||
depends: gtk_gir[0],
|
||||
suite: ['docs', 'failing'],
|
||||
)
|
||||
endif
|
||||
|
||||
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages'))
|
||||
@@ -72,6 +85,7 @@ rst_files = [
|
||||
[ 'gtk4-broadwayd', '1' ],
|
||||
[ 'gtk4-builder-tool', '1' ],
|
||||
[ 'gtk4-encode-symbolic-svg', '1', ],
|
||||
[ 'gtk4-image-tool', '1' ],
|
||||
[ 'gtk4-launch', '1', ],
|
||||
[ 'gtk4-query-settings', '1', ],
|
||||
[ 'gtk4-rendernode-tool', '1' ],
|
||||
|
@@ -451,11 +451,11 @@ hint about how modifiers are expected to be used. It also promoted
|
||||
the use of `<Primary>` instead of `<Control>` to specify accelerators that
|
||||
adapt to platform conventions.
|
||||
|
||||
In GTK 4, the meaning of modifiers has been fixed, and backends are
|
||||
In GTK 4, the meaning of modifiers has been fixed, and applications are
|
||||
expected to map the platform conventions to the existing modifiers.
|
||||
The expected use of modifiers in GTK 4 is:
|
||||
|
||||
`GDK_CONTROL_MASK`
|
||||
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
|
||||
: Primary accelerators
|
||||
|
||||
`GDK_ALT_MASK`
|
||||
@@ -464,7 +464,7 @@ The expected use of modifiers in GTK 4 is:
|
||||
`GDK_SHIFT_MASK`
|
||||
: Extending selections
|
||||
|
||||
`GDK_CONTROL_MASK`
|
||||
`GDK_CONTROL_MASK` (`GDK_META_MASK` on macOS)
|
||||
: Modifying selections
|
||||
|
||||
`GDK_CONTROL_MASK|GDK_ALT_MASK`
|
||||
@@ -473,9 +473,15 @@ The expected use of modifiers in GTK 4 is:
|
||||
Consequently, `GdkModifierIntent` and related APIs have been removed,
|
||||
and `<Control>` is preferred over `<Primary>` in accelerators.
|
||||
|
||||
In GTK 3 on macOS, the `<Primary>` modifier mapped to the <kbd>Command</kbd> key.
|
||||
In GTK 4, this is no longer the case: `<Primary>` is synonymous to `<Control>`.
|
||||
If you want to make your application to feel native on macOS,
|
||||
you need to add accelerators for macOS that use the `<Meta>` modifier.
|
||||
|
||||
A related change is that GTK 4 no longer supports the use of archaic
|
||||
X11 'real' modifiers with the names Mod1,..., Mod5, and `GDK_MOD1_MASK`
|
||||
has been renamed to `GDK_ALT_MASK`.
|
||||
has been renamed to `GDK_ALT_MASK` and `GDK_MOD2_MASK` has been renamed to
|
||||
`GDK_META_MASK`.
|
||||
|
||||
### Replace `GtkClipboard` with `GdkClipboard`
|
||||
|
||||
|
@@ -24,83 +24,180 @@ the motivation and goals of larger API changes.
|
||||
## Cell renderers are going away
|
||||
|
||||
Cell renderers were introduced in GTK 2 to support rendering of
|
||||
"big data" UIs, in particular treeviews. Over the years, more
|
||||
"data-like" widgets have started to use them, and cell renderers
|
||||
“big data” UIs, in particular treeviews. Over the years, more
|
||||
“data-like” widgets have started to use them, and cell renderers
|
||||
have grown into a shadowy, alternative rendering infrastructure
|
||||
that duplicates much of what widgets do, while duplicating the
|
||||
code and adding their own dose of bugs.
|
||||
|
||||
In GTK 4, replacement widgets for GtkTreeView, GtkIconView and
|
||||
GtkComboBox have appeared: GtkListView, GtkColumnView, GtkGridView
|
||||
and GtkDropDown. For GTK 5, we will take the next step and remove
|
||||
In GTK 4, replacement widgets for `GtkTreeView`, `GtkIconView` and
|
||||
`GtkComboBox` have appeared: [class@Gtk.ListView], [class@Gtk.ColumnView], [class@Gtk.GridView]
|
||||
and [class@Gtk.DropDown]. For GTK 5, we will take the next step and remove
|
||||
all cell renderer-based widgets.
|
||||
|
||||
## Themed rendering APIs are going away
|
||||
|
||||
The old GTK 2 era rendering APIs for theme components like
|
||||
gtk_render_frame() or gtk_render_check() have not been used by
|
||||
`gtk_render_frame()` or `gtk_render_check()` have not been used by
|
||||
GTK itself even in later GTK 3, but they have been kept around
|
||||
for the benefit of "external drawing" users - applications that
|
||||
for the benefit of “external drawing” users — applications that
|
||||
want their controls to look like GTK without using widgets.
|
||||
|
||||
Supporting this is increasingly getting in the way of making
|
||||
the GTK CSS machinery fast and correct. One notable problem is
|
||||
that temporary style changes (using gtk_style_context_save())
|
||||
that temporary style changes (using `gtk_style_context_save()`)
|
||||
is breaking animations. Therefore, these APIs will be going away
|
||||
in GTK 5, together with their more modern GtkSnapshot variants
|
||||
like gtk_snapshot_render_background() or gtk_snapshot_render_focus().
|
||||
in GTK 5, together with their more modern [class@Gtk.Snapshot] variants
|
||||
like `gtk_snapshot_render_background()` or `gtk_snapshot_render_focus()`.
|
||||
|
||||
The best way to render parts of your widget using CSS styling
|
||||
is to use subwidgets. For example, to show a piece of text with
|
||||
fonts, effects and shadows according to the current CSS style,
|
||||
use a GtkLabel.
|
||||
use a [class@Gtk.Label].
|
||||
|
||||
If you have a need for custom drawing that fits into the current
|
||||
(dark or light) theme, e.g. for rendering a graph, you can still
|
||||
get the current style foreground color, using
|
||||
[method@Gtk.Widget.get_style_color].
|
||||
[method@Gtk.Widget.get_color].
|
||||
|
||||
## Local stylesheets are going away
|
||||
|
||||
The cascading part of GTK's CSS implementation is complicated by
|
||||
The cascading part of GTK’s CSS implementation is complicated by
|
||||
the existence of local stylesheets (i.e. those added with
|
||||
gtk_style_context_add_provider()). And local stylesheets are
|
||||
`gtk_style_context_add_provider()`). And local stylesheets are
|
||||
unintuitive in that they do not apply to the whole subtree of
|
||||
widgets, but just to the one widget where the stylesheet was
|
||||
added.
|
||||
|
||||
GTK 5 will no longer provide this functionality. The recommendations
|
||||
is to use a global stylesheet (i.e. gtk_style_context_add_provider_for_display())
|
||||
GTK 5 will no longer provide this functionality. The recommendation
|
||||
is to use a global stylesheet (i.e. [func@Gtk.StyleContext.add_provider_for_display])
|
||||
and rely on style classes to make your CSS apply only where desired.
|
||||
|
||||
## Non-standard CSS extensions are going away
|
||||
|
||||
GTK’s CSS machinery has a some non-standard extensions around colors:
|
||||
named colors with `@define-color` and color functions: `lighter()`, `darker()`,
|
||||
`shade()`, `alpha()`, `mix()`.
|
||||
|
||||
GTK now implements equivalent functionality from the CSS specs.
|
||||
|
||||
### `@define-color` is going away
|
||||
|
||||
`@define-color` should be replaced by custom properties in the `:root` scope.
|
||||
|
||||
Instead of
|
||||
|
||||
```
|
||||
@define-color fg_color #2e3436
|
||||
|
||||
...
|
||||
|
||||
box {
|
||||
color: @fg_color;
|
||||
}
|
||||
```
|
||||
|
||||
use
|
||||
|
||||
```
|
||||
:root {
|
||||
--fg-color: #2e3436;
|
||||
}
|
||||
|
||||
...
|
||||
|
||||
box {
|
||||
color: var(--fg-color);
|
||||
}
|
||||
```
|
||||
|
||||
For more information about custom CSS properties and variables, see the
|
||||
[CSS Custom Properties for Cascading Variables](https://www.w3.org/TR/css-variables-1/)
|
||||
spec.
|
||||
|
||||
### Color expressions are going away
|
||||
|
||||
The color functions can all be replaced by combinations of `calc()` and `color-mix()`.
|
||||
|
||||
`lighter(c)` and `darker(c)` are just `shade(c, 1.3)` or `shade(c, 0.7)`, respectively, and
|
||||
thus can be handled the same way as shade in the examples below.
|
||||
|
||||
Replace
|
||||
|
||||
```
|
||||
a {
|
||||
color: mix(red, green, 0.8);
|
||||
}
|
||||
|
||||
b {
|
||||
color: alpha(green, 0.6);
|
||||
}
|
||||
|
||||
c {
|
||||
color: shade(red, 1.3);
|
||||
}
|
||||
|
||||
d {
|
||||
color: shade(red, 0.7);
|
||||
}
|
||||
```
|
||||
|
||||
with
|
||||
|
||||
```
|
||||
a {
|
||||
color: color-mix(in srgb, red, green 80%);
|
||||
}
|
||||
|
||||
b {
|
||||
color: rgb(from green, r g b / calc(alpha * 0.6));
|
||||
}
|
||||
|
||||
c {
|
||||
color: hsl(from red, h calc(s * 1.3) calc(l * 1.3));
|
||||
}
|
||||
|
||||
d {
|
||||
color: hsl(from red, h calc(s * 0.7) calc(l * 0.7));
|
||||
}
|
||||
```
|
||||
|
||||
Variations of these replacements are possible.
|
||||
|
||||
Note that GTK has historically computed `mix()` and `shade()` values in the SRGB and HSL
|
||||
colorspaces, but using OKLAB instead might yield slightly better results.
|
||||
|
||||
For more information about color-mix(), see the
|
||||
[CSS Color](https://drafts.csswg.org/css-color-5) spec.
|
||||
|
||||
## Chooser interfaces are going away
|
||||
|
||||
The GtkColorChooser, GtkFontChooser, GtkFileChooser and GtkAppChooser
|
||||
The `GtkColorChooser`, `GtkFontChooser`, `GtkFileChooser` and `GtkAppChooser`
|
||||
interfaces and their implementations as dialogs, buttons and widgets
|
||||
are phased out. The are being replaced by a new family of async APIs
|
||||
that will be more convenient to use from language bindings, in particular
|
||||
for languages that have concepts like promises. The new APIs are
|
||||
[class@Gtk.ColorDialog], [class@Gtk.FontDialog] and [class@Gtk.FileDialog],
|
||||
There are also equivalents for some of the 'button' widgets:
|
||||
There are also equivalents for some of the “button” widgets:
|
||||
[class@Gtk.ColorDialogButton], [class@Gtk.FontDialogButton].
|
||||
|
||||
## GtkMessageDialog is going away
|
||||
|
||||
Like the Chooser interfaces, GtkMessageDialog has been replaced by
|
||||
Like the Chooser interfaces, `GtkMessageDialog` has been replaced by
|
||||
a new async API that will be more convenient, in particular for
|
||||
language binding. The new API is [class@Gtk.AlertDialog].
|
||||
|
||||
## GtkDialog is going away
|
||||
|
||||
After gtk_dialog_run() was removed, the usefulness of GtkDialog
|
||||
is much reduced, and it has awkward, archaice APIs. Therefore,
|
||||
After `gtk_dialog_run()` was removed, the usefulness of `GtkDialog`
|
||||
is much reduced, and it has awkward, archaic APIs. Therefore,
|
||||
it is dropped. The recommended replacement is to just create
|
||||
your own window and add buttons as required, either in the header
|
||||
or elsewhere.
|
||||
|
||||
## GtkInfoBar is going away
|
||||
|
||||
GtkInfoBar had a dialog API, and with dialogs going away, it was time to
|
||||
`GtkInfoBar` had a dialog API, and with dialogs going away, it was time to
|
||||
retire it. If you need such a widget, it is relatively trivial to create one
|
||||
using a [class@Gtk.Revealer] with labels and buttons.
|
||||
|
||||
@@ -108,11 +205,11 @@ Other libraries, such as libadwaita, may provide replacements as well.
|
||||
|
||||
## gtk_show_uri is being replaced
|
||||
|
||||
Instead of gtk_show_uri(), you should use GtkUriLauncher or GtkFileLauncher.
|
||||
Instead of `gtk_show_uri()`, you should use [class@Gtk.UriLauncher]or [class@Gtk.FileLauncher].
|
||||
|
||||
## GtkStatusbar is going away
|
||||
|
||||
This is an oldfashioned widget that does not do all that much anymore, since
|
||||
This is an old fashioned widget that does not do all that much any more, since
|
||||
it no longer has a resize handle for the window.
|
||||
|
||||
## GtkLockButton and GtkVolumeButton are going away
|
||||
@@ -120,22 +217,22 @@ it no longer has a resize handle for the window.
|
||||
These are very specialized widgets that should better live with the application
|
||||
where they are used.
|
||||
|
||||
## Widget size api changes
|
||||
## Widget size API changes
|
||||
|
||||
The functions gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height()
|
||||
The functions `gtk_widget_get_allocated_width()` and `gtk_widget_get_allocated_height()`
|
||||
are going away. In most cases, [method@Gtk.Widget.get_width] and [method@Gtk.Widget.get_height]
|
||||
are suitable replacements. Note that the semantics are slightly different though:
|
||||
the old functions return the size of the CSS border area, while the new functions return
|
||||
the size of the widgets content area. In places where this difference matters, you can
|
||||
use `gtk_widget_compute_bounds (widget, widget, &bounds)` instead.
|
||||
|
||||
The function gtk_widget_get_allocation() is also going away. It does not have a direct
|
||||
The function `gtk_widget_get_allocation()` is also going away. It does not have a direct
|
||||
replacement, but the previously mentioned alternatives can be used for it too.
|
||||
|
||||
The function gtk_widget_get_allocated_baseline() has been renamed to [method@Gtk.Widget.get_baseline].
|
||||
The function `gtk_widget_get_allocated_baseline()` has been renamed to [method@Gtk.Widget.get_baseline].
|
||||
|
||||
## Stop using GdkPixbuf
|
||||
|
||||
GTK is moving away from GdkPixbuf as the primary API for transporting image data, in favor
|
||||
of GdkTexture. APIs that are accepting or returning GdkPixbufs are being replaced by equivalent
|
||||
APIs using GdkTexture or GdkPaintable objects.
|
||||
GTK is moving away from `GdkPixbuf` as the primary API for transporting image data, in favor
|
||||
of [class@Gdk.Texture]. APIs that are accepting or returning `GdkPixbuf`s are being replaced by equivalent
|
||||
APIs using `GdkTexture` or [iface@Gdk.Paintable] objects.
|
||||
|
@@ -1,13 +1,15 @@
|
||||
# The Node file format
|
||||
Title: The Node file format
|
||||
|
||||
GSK render nodes can be serialized and deserialized using APIs such as `gsk_render_node_serialize()` and `gsk_render_node_deserialize()`. The intended use for this is development - primarily the development of GTK - by allowing things such as creating testsuites and benchmarks, exchanging nodes in bug reports. GTK includes the `gtk4-node-editor` application for creating such test files.
|
||||
|
||||
The format is a text format that follows the [CSS syntax rules](https://drafts.csswg.org/css-syntax-3/). In particular, this means that every array of bytes will produce a render node when parsed, as there is a defined error recovery method. For more details on error handling, please refer to the documentation of the parsing APIs.
|
||||
|
||||
The grammar of a node text representation using [the CSS value definition syntax](https://drafts.csswg.org/css-values-3/#value-defs) looks like this:
|
||||
**document**: `<node>\*`
|
||||
**node**: container [ "name" ] { <document> } | `<node-type> [ "name" ] { <property>* }` | "name"
|
||||
**property**: `<property-name>: <node> | <value> ;`
|
||||
|
||||
document: <@-rule>*<node>
|
||||
@-rule: @cicp "name" { <property>* }
|
||||
node: container [ "name" ] { <document> } | <node-type> [ "name" ] { <property>* } | "name"
|
||||
property: <property-name>: <node> | <value> ;
|
||||
|
||||
Each node has its own `<node-type>` and supports a custom set of properties, each with their own `<property-name>` and syntax. The following paragraphs document each of the nodes and their properties.
|
||||
|
||||
@@ -25,6 +27,59 @@ Nodes can be given a name by adding a string after the `<node-type>` in their de
|
||||
|
||||
Just like nodes, textures can be referenced by name. When defining a named texture, the name has to be placed in front of the URL.
|
||||
|
||||
# Color states
|
||||
|
||||
Color states are represented either by an ident (for builtin ones) or a string
|
||||
(for custom ones):
|
||||
|
||||
color-state: <ident> | <string>
|
||||
|
||||
Custom color states can be defined at the beginning of the document, with an @cicp rule.
|
||||
|
||||
The format for @cicp rules is
|
||||
|
||||
@cicp "name" {
|
||||
...
|
||||
}
|
||||
|
||||
The following properties can be set for custom color states:
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| --------- | ---------------- | -------- | ----------- |
|
||||
| primaries | `<integer>` | 2 | always |
|
||||
| transfer | `<integer>` | 2 | always |
|
||||
| matrix | `<integer>` | 2 | always |
|
||||
| range | `<range>` | full | non-default |
|
||||
|
||||
Note that the primaries, transfer and matrix properties always need
|
||||
to be specified, since GTK does not allow creating color state objects
|
||||
with these being set to 2 (== unspecified).
|
||||
|
||||
Range can have the following values:
|
||||
|
||||
range: narrow | full
|
||||
|
||||
# Colors
|
||||
|
||||
Colors can be specified with a variation of the modern CSS color syntax:
|
||||
|
||||
color(<color-state> <number> <number> <number> ["/" <number>])
|
||||
|
||||
The traditional syntax for sRGB colors still works as well:
|
||||
|
||||
rgba(<number>, <number>, <number>, <number)
|
||||
rgb(<number, <number>, <number>)
|
||||
|
||||
# Rectangles
|
||||
|
||||
Rectangles can be specified just as four integers for x, y, width and height:
|
||||
|
||||
rect: <number> <number> <number> <number>
|
||||
|
||||
Rounded rectangles use a CSS-like syntax:
|
||||
|
||||
rounded-rect: <rect> [ "/" <number>{1,4} [ "/" <number>{1,4} ] ]
|
||||
|
||||
# Nodes
|
||||
|
||||
### container
|
||||
@@ -41,6 +96,13 @@ The **container** node is a special node that allows specifying a list of child
|
||||
|
||||
Creates a node like `gsk_blend_node_new()` with the given properties.
|
||||
|
||||
Possible values for the mode property are:
|
||||
|
||||
blend-mode: normal | multiply | screen | overlay | darken |
|
||||
lighten | color-dodge | color-burn | hard-light |
|
||||
soft-light | difference | exclusion | color |
|
||||
hue | saturation | luminosity
|
||||
|
||||
### blur
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -119,15 +181,21 @@ matrix3d() production to specify all 16 values individually.
|
||||
|
||||
### conic-gradient
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| center | `<point>` | 25, 25 | always |
|
||||
| rotation | `<number>` | 0 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
| property | syntax | default | printed |
|
||||
| ----------------- | --------------- | -------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| center | `<point>` | 25, 25 | always |
|
||||
| rotation | `<number>` | 0 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
| interpolation | `<color-state>` | srgb | non-default |
|
||||
| hue-interpolation | `<hue-interp>` | shorter | non-default |
|
||||
|
||||
Creates a node like `gsk_conic_gradient_node_new()` with the given properties.
|
||||
|
||||
Possible values for the hue-interpolation property are:
|
||||
|
||||
hue-interpolation: shorter | longer | increasing | decreasing
|
||||
|
||||
### cross-fade
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -160,6 +228,10 @@ Creates a node like `gsk_fill_node_new()` with the given properties.
|
||||
The default child node is the default color node, but created with the
|
||||
bounds of the path.
|
||||
|
||||
Possible values for the fill-rule property are:
|
||||
|
||||
fill-rule: winding | even-odd
|
||||
|
||||
### glshader
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -192,12 +264,14 @@ Creates a node like `gsk_inset_shadow_node_new()` with the given properties.
|
||||
|
||||
### linear-gradient
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| start | `<point>` | 0 0 | always |
|
||||
| end | `<point>` | 0 50 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
| property | syntax | default | printed |
|
||||
| ----------------- | --------------- | -------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| start | `<point>` | 0 0 | always |
|
||||
| end | `<point>` | 0 50 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
| interpolation | `<color-state>` | srgb | non-default |
|
||||
| hue-interpolation | `<hue-interp>` | shorter | non-default |
|
||||
|
||||
Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
|
||||
|
||||
@@ -211,6 +285,10 @@ Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
|
||||
|
||||
Creates a node like `gsk_mask_node_new()` with the given properties.
|
||||
|
||||
Possible values for the mode property are:
|
||||
|
||||
mask-mode: alpha | inverted-alpha | luminance | inverted-luminance
|
||||
|
||||
### opacity
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -235,25 +313,27 @@ Creates a node like `gsk_outset_shadow_node_new()` with the given properties.
|
||||
|
||||
### radial-gradient
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| center | `<point>` | 25 25 | always |
|
||||
| hradius | `<number>` | 25 | always |
|
||||
| vradius | `<number>` | 25 | always |
|
||||
| start | `<number>` | 0 | always |
|
||||
| end | `<number>` | 1 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
| property | syntax | default | printed |
|
||||
| ----------------- | --------------- | -------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| center | `<point>` | 25 25 | always |
|
||||
| hradius | `<number>` | 25 | always |
|
||||
| vradius | `<number>` | 25 | always |
|
||||
| start | `<number>` | 0 | always |
|
||||
| end | `<number>` | 1 | always |
|
||||
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
|
||||
| interpolation | `<color-state>` | srgb | non-default |
|
||||
| hue-interpolation | `<hue-interp>` | shorter | non-default |
|
||||
|
||||
Creates a node like `gsk_radial_gradient_node_new()` with the given properties.
|
||||
|
||||
### repeat
|
||||
|
||||
| property | syntax | default | printed |
|
||||
| ----------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | *bounds of child node* | non-default |
|
||||
| child | `<node>` | color { } | always |
|
||||
| child-bounds| `<rect>` | *bounds of child node* | non-default |
|
||||
| property | syntax | default | printed |
|
||||
| ------------ | ---------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | *bounds of child node* | non-default |
|
||||
| child | `<node>` | color { } | always |
|
||||
| child-bounds | `<rect>` | *bounds of child node* | non-default |
|
||||
|
||||
Creates a node like `gsk_repeat_node_new()` with the given properties.
|
||||
|
||||
@@ -320,6 +400,14 @@ Creates a node like `gsk_stroke_node_new()` with the given properties.
|
||||
The default child node is the default color node, but created with the
|
||||
stroke bounds of the path.
|
||||
|
||||
Possible values for the line-cap property are:
|
||||
|
||||
line-cap: butt | round | square
|
||||
|
||||
Possible values for the line-join property are:
|
||||
|
||||
line-join: miter | round | bevel
|
||||
|
||||
### text
|
||||
|
||||
| property | syntax | default | printed |
|
||||
@@ -328,9 +416,9 @@ stroke bounds of the path.
|
||||
| font | `<string>` `<url>`? | "Cantarell 15px" | always |
|
||||
| glyphs | `<glyphs>` | "Hello" | always |
|
||||
| offset | `<point>` | 0 0 | non-default |
|
||||
| hint-style | `<hint style>` | slight | non-default |
|
||||
| hint-style | `<hint-style>` | slight | non-default |
|
||||
| antialias | `<antialias>` | gray | non-default |
|
||||
| hint-metrics | `<hint metrics>` | off | non-default |
|
||||
| hint-metrics | `<hint-metrics>` | off | non-default |
|
||||
|
||||
Creates a node like `gsk_text_node_new()` with the given properties.
|
||||
|
||||
@@ -345,9 +433,17 @@ be specified as well, like this: 40 10 0 0 color.
|
||||
If the given font does not exist or the given glyphs are invalid for the given
|
||||
font, an error node will be returned.
|
||||
|
||||
Possible values for hint-style are none, slight or full.
|
||||
Possible value for antialias are none or gray.
|
||||
Possible value for hint-metrics are on or off.
|
||||
Possible values for the hint-style property are:
|
||||
|
||||
hint-style: none | slight | full
|
||||
|
||||
Possible value for the antialias property are:
|
||||
|
||||
antialias: none | gray
|
||||
|
||||
Possible value for hint-metrics are:
|
||||
|
||||
hint-metrics: on | off
|
||||
|
||||
### texture
|
||||
|
||||
@@ -373,14 +469,15 @@ representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANS
|
||||
| -------- | ---------------- | ---------------------- | ----------- |
|
||||
| bounds | `<rect>` | 50 | always |
|
||||
| texture | `<url>` | *see below* | always |
|
||||
| filter | `filter` | *see below* | non-default |
|
||||
| filter | `filter` | linear | non-default |
|
||||
|
||||
Creates a node like `gsk_texture_scale_node_new()` with the given properties.
|
||||
|
||||
The default texture is a 10x10 checkerboard, just like for texture.
|
||||
|
||||
The possible filter values are `linear`, `nearest` and `trilinear`, with
|
||||
`linear` being the default.
|
||||
Possible values for the filter property are:
|
||||
|
||||
filter: linear | nearest | trilinear
|
||||
|
||||
### transform
|
||||
|
@@ -7,5 +7,5 @@ on top of the Quartz API.
|
||||
Currently, the macOS port does not use any additional commandline options
|
||||
or environment variables.
|
||||
|
||||
For up-to-date information about the current status of this port, see the
|
||||
[project page](https://wiki.gnome.org/Projects/GTK/OSX).
|
||||
For up-to-date information on building, installation, and bundling, see the
|
||||
[GTK website](https://www.gtk.org/docs/installations/macos).
|
||||
|
@@ -5,10 +5,12 @@ Slug: gtk-running
|
||||
|
||||
GTK inspects a number of environment variables in addition to
|
||||
standard variables like `LANG`, `PATH`, `HOME` or `DISPLAY`; mostly
|
||||
to determine paths to look for certain files. The [X11](#x11-envar),
|
||||
[Wayland](#wayland-envar), [Windows](#win32-envar) and
|
||||
[Broadway](#broadway-envar) GDK backends use some additional
|
||||
environment variables.
|
||||
to determine paths to look for certain files. The
|
||||
[X11](https://docs.gtk.org/gtk4/x11.html#x11-specific-environment-variables),
|
||||
[Wayland](https://docs.gtk.org/gtk4/wayland.html#wayland-specific-environment-variables),
|
||||
[Windows](https://docs.gtk.org/gtk4/windows.html#windows-specific-environment-variables) and
|
||||
[Broadway](https://docs.gtk.org/gtk4/broadway.html#broadway-specific-environment-variables)
|
||||
GDK backends use some additional environment variables.
|
||||
|
||||
Note that environment variables are generally used for debugging
|
||||
purposes. They are not guaranteed to be API stable, and should not
|
||||
@@ -17,8 +19,7 @@ be used for end-user configuration and customization.
|
||||
### `GTK_DEBUG`
|
||||
|
||||
This variable can be set to a list of debug options, which cause GTK to
|
||||
print out different types of debugging information. Some of these options
|
||||
are only available when GTK has been configured with `-Ddebug=true`.
|
||||
print out different types of debugging information.
|
||||
|
||||
`actions`
|
||||
: Actions and menu models
|
||||
@@ -63,7 +64,7 @@ are only available when GTK has been configured with `-Ddebug=true`.
|
||||
: Layout managers
|
||||
|
||||
`accessibility`
|
||||
: Accessibility state changs
|
||||
: Accessibility state changes
|
||||
|
||||
A number of keys are influencing behavior instead of just logging:
|
||||
|
||||
@@ -167,8 +168,7 @@ The `loaders.cache` file is generated by the
|
||||
### `GDK_DEBUG`
|
||||
|
||||
This variable can be set to a list of debug options, which cause GDK to
|
||||
print out different types of debugging information. Some of these options
|
||||
are only available when GTK has been configured with `-Ddebug=true`.
|
||||
print out different types of debugging information.
|
||||
|
||||
`misc`
|
||||
: Miscellaneous information
|
||||
@@ -221,36 +221,15 @@ A number of options affect behavior instead of logging:
|
||||
: Force graphics offload for all textures, even when slower. This allows
|
||||
to debug offloading in the absence of dmabufs.
|
||||
|
||||
`gl-disable`
|
||||
: Disable OpenGL support
|
||||
|
||||
`gl-no-fractional`
|
||||
: Disable fractional scaling for OpenGL.
|
||||
|
||||
`gl-debug`
|
||||
: Insert debugging information in OpenGL
|
||||
|
||||
`gl-disable-gl`
|
||||
: Don't allow the use of OpenGL GL API. This forces GLES to be used
|
||||
|
||||
`gl-disable-gles`
|
||||
: Don't allow the use of OpenGL GLES API. This forces GL to be used
|
||||
|
||||
`gl-prefer-gl`
|
||||
: Prefer OpenGL over OpenGL ES. This was the default behavior before GTK 4.14.
|
||||
|
||||
`gl-egl`
|
||||
: Use an EGL context on X11 or Windows
|
||||
|
||||
`gl-glx`
|
||||
: Use GLX on X11
|
||||
|
||||
`gl-wgl`
|
||||
: Use WGL on Windows
|
||||
|
||||
`vulkan-disable`
|
||||
: Disable Vulkan support
|
||||
|
||||
`vulkan-validate`
|
||||
: Load the Vulkan validation layer, if available
|
||||
|
||||
@@ -260,27 +239,26 @@ A number of options affect behavior instead of logging:
|
||||
`high-depth`
|
||||
: Use high bit depth rendering if possible
|
||||
|
||||
`linear`
|
||||
: Enable linear rendering
|
||||
|
||||
`hdr`
|
||||
: Force HDR rendering
|
||||
|
||||
`no-vsync`
|
||||
: Repaint instantly (uses 100% CPU with animations)
|
||||
|
||||
`dmabuf-disable`
|
||||
: Disable dmabuf support
|
||||
|
||||
The special value `all` can be used to turn on all debug options. The special
|
||||
value `help` can be used to obtain a list of all supported debug options.
|
||||
|
||||
### `GSK_DEBUG`
|
||||
|
||||
This variable can be set to a list of debug options, which cause GSK to
|
||||
print out different types of debugging information. Some of these options
|
||||
are only available when GTK has been configured with `-Ddebug=true`.
|
||||
print out different types of debugging information.
|
||||
|
||||
`renderer`
|
||||
: General renderer information
|
||||
|
||||
`opengl`
|
||||
: OpenGL renderer information
|
||||
|
||||
`vulkan`
|
||||
: Check Vulkan errors
|
||||
|
||||
@@ -290,8 +268,8 @@ are only available when GTK has been configured with `-Ddebug=true`.
|
||||
`fallback`
|
||||
: Information about fallback usage in renderers
|
||||
|
||||
`glyphcache`
|
||||
: Information about glyph caching
|
||||
`cache`
|
||||
: Information about caching
|
||||
|
||||
`verbose`
|
||||
: Print verbose output while rendering
|
||||
@@ -307,12 +285,12 @@ A number of options affect behavior instead of logging:
|
||||
`staging`
|
||||
: Use a staging image for texture upload (Vulkan only)
|
||||
|
||||
`offload-disable`
|
||||
: Disable graphics offload to subsurfaces
|
||||
|
||||
`cairo`
|
||||
: Overlay error pattern over cairo drawing (finds fallbacks)
|
||||
|
||||
`occlusion`
|
||||
: Overlay highlight over areas optimized via occlusion culling
|
||||
|
||||
The special value `all` can be used to turn on all debug options. The special
|
||||
value `help` can be used to obtain a list of all supported debug options.
|
||||
|
||||
@@ -345,6 +323,41 @@ a `*`, which means: try all remaining backends. The special value
|
||||
backends. For more information about selecting backends,
|
||||
see the [func@Gdk.DisplayManager.get] function.
|
||||
|
||||
### `GDK_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
disable certain features.
|
||||
|
||||
`gl`
|
||||
: Disable OpenGL support
|
||||
|
||||
`gl-api`
|
||||
: Don't allow the use of OpenGL GL API. This forces GLES to be used
|
||||
|
||||
`gles-api`
|
||||
: Don't allow the use of OpenGL GLES API. This forces GL to be used
|
||||
|
||||
`egl`
|
||||
: Don't allow the use of an EGL context
|
||||
|
||||
`glx`
|
||||
: Don't allow the use of GLX
|
||||
|
||||
`wgl`
|
||||
: Don't allow the use of WGL
|
||||
|
||||
`vulkan`
|
||||
: Disable Vulkan support
|
||||
|
||||
`dmabuf`
|
||||
: Disable dmabuf support
|
||||
|
||||
`offload`
|
||||
: Disable graphics offload to subsurfaces
|
||||
|
||||
`color-mgmt`
|
||||
: Disable color management
|
||||
|
||||
### `GDK_GL_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
@@ -367,13 +380,6 @@ does not support them.
|
||||
`base-instance`
|
||||
:GL_EXT_base_instance
|
||||
|
||||
### `GDK_VULKAN_DEVICE`
|
||||
|
||||
This variable can be set to the index of a Vulkan device to override
|
||||
the default selection of the device that is used for Vulkan rendering.
|
||||
The special value `list` can be used to obtain a list of all Vulkan
|
||||
devices.
|
||||
|
||||
### `GDK_VULKAN_DISABLE`
|
||||
|
||||
This variable can be set to a list of values, which cause GDK to
|
||||
@@ -387,15 +393,6 @@ does not support them.
|
||||
`ycbr`
|
||||
: Do not support Ycbcr textures
|
||||
|
||||
`descriptor-indexing`
|
||||
: Force slow descriptor set layout codepath
|
||||
|
||||
`dynamic-indexing`
|
||||
: Hardcode small number of buffer and texture arrays
|
||||
|
||||
`nonuniform-indexing`
|
||||
: Split draw calls to ensure uniform texture accesses
|
||||
|
||||
`semaphore-export`
|
||||
: Disable sync of exported dmabufs
|
||||
|
||||
@@ -405,6 +402,9 @@ does not support them.
|
||||
`incremental-present`
|
||||
: Do not send damage regions
|
||||
|
||||
`swapchain-maintenance`
|
||||
: Do not use advanced swapchain features
|
||||
|
||||
The special value `all` can be used to turn on all values. The special
|
||||
value `help` can be used to obtain a list of all supported values.
|
||||
|
||||
@@ -423,14 +423,8 @@ using and the GDK backend supports them:
|
||||
`cairo`
|
||||
: Selects the fallback Cairo renderer
|
||||
|
||||
`opengl`
|
||||
: Selects the default OpenGL renderer
|
||||
|
||||
`gl`
|
||||
: Selects the "gl" OpenGL renderer
|
||||
|
||||
`ngl`
|
||||
: Selects the "ngl" OpenGL renderer
|
||||
: Selects the OpenGL renderer
|
||||
|
||||
`vulkan`
|
||||
: Selects the Vulkan renderer
|
||||
@@ -459,12 +453,12 @@ using and the GDK backend supports them:
|
||||
This variable can be set to a list of values, which cause GSK to
|
||||
disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
|
||||
`uber`
|
||||
: Don't use the uber shader
|
||||
|
||||
`clear`
|
||||
: Use shaders instead of vkCmdClearAttachment()/glClear()
|
||||
|
||||
`merge`
|
||||
: USe one vkCmdDraw()/glDrawArrays() per operation
|
||||
|
||||
`blit`
|
||||
: Use shaders instead of vkCmdBlit()/glBlitFramebuffer()
|
||||
|
||||
@@ -474,6 +468,13 @@ disable certain optimizations of the "ngl" and "vulkan" renderer.
|
||||
`mipmap`
|
||||
: Avoid creating mipmaps
|
||||
|
||||
`to-image`
|
||||
: Don't fast-path creation of images for nodes
|
||||
|
||||
`occlusion`
|
||||
: Disable occlusion culling via opacity tracking
|
||||
|
||||
|
||||
The special value `all` can be used to turn on all values. The special
|
||||
value `help` can be used to obtain a list of all supported values.
|
||||
|
||||
@@ -561,6 +562,12 @@ To enable the GTK inspector, you can use the <kbd>Control</kbd>+<kbd>Shift</kbd>
|
||||
<kbd>Control</kbd>+<kbd>Shift</kbd>+<kbd>D</kbd> keyboard shortcuts, or
|
||||
set the `GTK_DEBUG=interactive` environment variable.
|
||||
|
||||
After opening the inspector, it listens for a few keyboard shortcuts that
|
||||
let you use its frame and event recording functionality without moving the
|
||||
focus away from the application window: <kbd>Super</kbd>+<kbd>R</kbd> turns
|
||||
the recording on and off, and <kbd>Super</kbd>+<kbd>C</kbd> records a single
|
||||
frame.
|
||||
|
||||
There are a few more environment variables that can be set to influence
|
||||
how the inspector renders its UI. `GTK_INSPECTOR_DISPLAY` and
|
||||
`GTK_INSPECTOR_RENDERER` determine the GDK display and the GSK
|
||||
@@ -571,6 +578,7 @@ the GTK inspector. The keyboard shortcuts can be disabled with the
|
||||
`enable-inspector-keybinding` key in the `org.gtk.Settings.Debug`
|
||||
GSettings schema.
|
||||
|
||||
|
||||
## Profiling
|
||||
|
||||
GTK supports profiling with sysprof. It exports timing information
|
||||
|
@@ -171,7 +171,7 @@ Each relation name is part of the `GtkAccessibleRelation` enumeration.
|
||||
| %GTK_ACCESSIBLE_RELATION_CONTROLS | “aria-controls” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_DESCRIBED_BY | “aria-describedby” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_DETAILS | “aria-details” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_ERROR_MESSAGE | “aria-errormessage” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_FLOW_TO | “aria-flowto” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_LABELLED_BY | “aria-labelledby” | a list of `GtkAccessible` |
|
||||
| %GTK_ACCESSIBLE_RELATION_OWNS | “aria-owns” | a list of `GtkAccessible` |
|
||||
@@ -300,7 +300,7 @@ The attributes can also enhance the UI:
|
||||
|
||||
```c
|
||||
gtk_button_set_label (GTK_BUTTON (button), "Download");
|
||||
gtk_box_append (GTK_BOX (button), button);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
gtk_label_set_text (GTK_LABEL (label), "Final report.pdf");
|
||||
gtk_box_append (GTK_BOX (box), label);
|
||||
|
@@ -9,6 +9,7 @@ documentation in the form of man pages.
|
||||
- [gtk4-demo-application](gtk4-demo-application.html)
|
||||
- [gtk4-encode-symbolic-svg](gtk4-encode-symbolic-svg.html)
|
||||
- [gtk4-icon-browser](gtk4-icon-browser.html)
|
||||
- [gtk4-image-tool](gtk4-image-tool.html)
|
||||
- [gtk4-launch](gtk4-launch.html)
|
||||
- [gtk4-node-editor](gtk4-node-editor.html)
|
||||
- [gtk4-path-tool](gtk4-path-tool.html)
|
||||
|
@@ -43,7 +43,7 @@ X11 details, in particular the ICCCM and the Extended Window Manager
|
||||
Hints specifications. [freedesktop.org](http://www.freedesktop.org/standards/)
|
||||
has links to many relevant specifications.
|
||||
|
||||
The GDK manual covers [using Xlib in a GTK program](#gdk-X-Window-System-Interaction).
|
||||
The GDK manual covers [using Xlib in a GTK program](https://docs.gtk.org/gdk4/x11.html).
|
||||
|
||||
### Server, client, window manager
|
||||
|
||||
|
@@ -49,7 +49,7 @@ main (int argc,
|
||||
g_chdir (GTK_SRCDIR);
|
||||
#endif
|
||||
|
||||
GtkApplication *app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
GtkApplication *app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
|
||||
int status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
|
@@ -173,7 +173,7 @@ main (int argc,
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
|
@@ -60,7 +60,7 @@ main (int argc,
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
|
@@ -37,10 +37,8 @@ main (int argc,
|
||||
{
|
||||
GtkApplication *app;
|
||||
|
||||
app = gtk_application_new ("org.gtk.Example.GtkSearchBar",
|
||||
G_APPLICATION_FLAGS_NONE);
|
||||
g_signal_connect (app, "activate",
|
||||
G_CALLBACK (activate_cb), NULL);
|
||||
app = gtk_application_new ("org.gtk.Example.GtkSearchBar", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
|
||||
|
||||
return g_application_run (G_APPLICATION (app), argc, argv);
|
||||
}
|
||||
|
@@ -19,7 +19,7 @@ main (int argc,
|
||||
GtkApplication *app;
|
||||
int status;
|
||||
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_FLAGS_NONE);
|
||||
app = gtk_application_new ("org.gtk.example", G_APPLICATION_DEFAULT_FLAGS);
|
||||
g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
|
||||
status = g_application_run (G_APPLICATION (app), argc, argv);
|
||||
g_object_unref (app);
|
||||
|
@@ -111,7 +111,7 @@ gboolean broadway_server_surface_translate (BroadwayServer *
|
||||
int dx,
|
||||
int dy);
|
||||
guint32 broadway_server_upload_texture (BroadwayServer *server,
|
||||
GBytes *texture);
|
||||
GBytes *bytes);
|
||||
void broadway_server_release_texture (BroadwayServer *server,
|
||||
guint32 id);
|
||||
cairo_surface_t * broadway_server_create_surface (int width,
|
||||
|
@@ -33,9 +33,11 @@ gdk_broadway_cairo_context_dispose (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
GdkMemoryDepth depth,
|
||||
cairo_region_t *region)
|
||||
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
GdkMemoryDepth depth,
|
||||
cairo_region_t *region,
|
||||
GdkColorState **out_color_state,
|
||||
GdkMemoryDepth *out_depth)
|
||||
{
|
||||
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (self));
|
||||
@@ -59,6 +61,9 @@ gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
cairo_set_operator (cr, CAIRO_OPERATOR_CLEAR);
|
||||
cairo_fill (cr);
|
||||
cairo_destroy (cr);
|
||||
|
||||
*out_color_state = GDK_COLOR_STATE_SRGB;
|
||||
*out_depth = gdk_color_state_get_depth (GDK_COLOR_STATE_SRGB);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -33,9 +33,11 @@ gdk_broadway_draw_context_dispose (GObject *object)
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
|
||||
GdkMemoryDepth depth,
|
||||
cairo_region_t *region)
|
||||
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
|
||||
GdkMemoryDepth depth,
|
||||
cairo_region_t *region,
|
||||
GdkColorState **out_color_state,
|
||||
GdkMemoryDepth *out_depth)
|
||||
{
|
||||
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (GDK_DRAW_CONTEXT (self));
|
||||
@@ -52,6 +54,9 @@ gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
|
||||
|
||||
self->nodes = g_array_new (FALSE, FALSE, sizeof(guint32));
|
||||
self->node_textures = g_ptr_array_new_with_free_func (g_object_unref);
|
||||
|
||||
*out_color_state = GDK_COLOR_STATE_SRGB;
|
||||
*out_depth = gdk_color_state_get_depth (GDK_COLOR_STATE_SRGB);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -56,7 +56,7 @@ void _gdk_broadway_surface_translate (GdkSurface *surface,
|
||||
int dx,
|
||||
int dy);
|
||||
gboolean _gdk_broadway_moveresize_handle_event (GdkDisplay *display,
|
||||
BroadwayInputMsg *msg);
|
||||
BroadwayInputMsg *event);
|
||||
gboolean _gdk_broadway_moveresize_configure_done (GdkDisplay *display,
|
||||
GdkSurface *surface);
|
||||
void _gdk_broadway_roundtrip_notify (GdkSurface *surface,
|
||||
|
@@ -49,6 +49,135 @@
|
||||
|
||||
G_DEFINE_TYPE (GdkBroadwaySurface, gdk_broadway_surface, GDK_TYPE_SURFACE)
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_toplevel_resize (GdkSurface *surface,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_set_geometry_hints (GdkSurface *surface,
|
||||
const GdkGeometry *geometry,
|
||||
GdkSurfaceHints geom_mask);
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_move_resize_internal (GdkSurface *surface,
|
||||
gboolean with_move,
|
||||
int x,
|
||||
int y,
|
||||
int width,
|
||||
int height);
|
||||
|
||||
static void
|
||||
compute_toplevel_size (GdkSurface *surface,
|
||||
gboolean resizible,
|
||||
int *width,
|
||||
int *height)
|
||||
{
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
GdkToplevelSize size;
|
||||
int bounds_width, bounds_height;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
if (monitor)
|
||||
{
|
||||
GdkRectangle monitor_geometry;
|
||||
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
bounds_width = G_MAXINT;
|
||||
bounds_height = G_MAXINT;
|
||||
}
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (GDK_TOPLEVEL (surface), &size);
|
||||
g_warn_if_fail (size.width > 0);
|
||||
g_warn_if_fail (size.height > 0);
|
||||
*width = size.width;
|
||||
*height = size.height;
|
||||
impl->resizible = (impl->resizible && resizible);
|
||||
|
||||
if (impl->resizible)
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
mask = GDK_HINT_MIN_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry.max_width = geometry.min_width = size.width;
|
||||
geometry.max_height = geometry.min_height = size.height;
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
}
|
||||
gdk_broadway_surface_set_geometry_hints (surface, &geometry, mask);
|
||||
|
||||
if (!(surface->state & (GDK_TOPLEVEL_STATE_FULLSCREEN |
|
||||
GDK_TOPLEVEL_STATE_MAXIMIZED |
|
||||
GDK_TOPLEVEL_STATE_TILED |
|
||||
GDK_TOPLEVEL_STATE_TOP_TILED |
|
||||
GDK_TOPLEVEL_STATE_RIGHT_TILED |
|
||||
GDK_TOPLEVEL_STATE_BOTTOM_TILED |
|
||||
GDK_TOPLEVEL_STATE_LEFT_TILED |
|
||||
GDK_TOPLEVEL_STATE_MINIMIZED)))
|
||||
{
|
||||
gdk_surface_constrain_size (&geometry, mask,
|
||||
size.width, size.height,
|
||||
&size.width, &size.height);
|
||||
|
||||
if (impl->last_computed_width != size.width ||
|
||||
impl->last_computed_height != size.height)
|
||||
{
|
||||
*width = size.width;
|
||||
*height = size.height;
|
||||
impl->last_computed_width = size.width;
|
||||
impl->last_computed_height = size.height;
|
||||
|
||||
gdk_broadway_surface_toplevel_resize (surface, *width, *height);
|
||||
}
|
||||
}
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
{
|
||||
impl->shadow_left = size.shadow.left;
|
||||
impl->shadow_right = size.shadow.right;
|
||||
impl->shadow_top = size.shadow.top;
|
||||
impl->shadow_bottom = size.shadow.bottom;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
compute_size_idle (gpointer user_data)
|
||||
{
|
||||
GdkSurface *surface = user_data;
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
int width, height;
|
||||
|
||||
impl->compute_size_source_id = 0;
|
||||
compute_toplevel_size (surface, TRUE, &width, &height);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
on_frame_clock_after_update (GdkFrameClock *clock,
|
||||
GdkSurface *surface)
|
||||
{
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (impl->compute_size_source_id)
|
||||
{
|
||||
g_clear_handle_id (&impl->compute_size_source_id, g_source_remove);
|
||||
compute_size_idle (surface);
|
||||
}
|
||||
}
|
||||
|
||||
/* We need to flush in an idle rather than AFTER_PAINT, as the clock
|
||||
is frozen during e.g. surface resizes so the paint will not happen
|
||||
and the surface resize request is never flushed. */
|
||||
@@ -112,6 +241,8 @@ connect_frame_clock (GdkSurface *surface)
|
||||
|
||||
g_signal_connect (frame_clock, "before-paint",
|
||||
G_CALLBACK (on_frame_clock_before_paint), surface);
|
||||
g_signal_connect_after (frame_clock, "update",
|
||||
G_CALLBACK (on_frame_clock_after_update), surface);
|
||||
g_signal_connect (frame_clock, "after-paint",
|
||||
G_CALLBACK (on_frame_clock_after_paint), surface);
|
||||
}
|
||||
@@ -123,6 +254,8 @@ disconnect_frame_clock (GdkSurface *surface)
|
||||
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
on_frame_clock_before_paint, surface);
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
on_frame_clock_after_update, surface);
|
||||
g_signal_handlers_disconnect_by_func (frame_clock,
|
||||
on_frame_clock_after_paint, surface);
|
||||
}
|
||||
@@ -137,6 +270,7 @@ gdk_broadway_surface_constructed (GObject *object)
|
||||
if (!surface->parent)
|
||||
broadway_display->toplevels = g_list_prepend (broadway_display->toplevels, self);
|
||||
|
||||
self->resizible = TRUE;
|
||||
self->id = _gdk_broadway_server_new_surface (broadway_display->server,
|
||||
self->root_x,
|
||||
self->root_y,
|
||||
@@ -316,6 +450,7 @@ gdk_broadway_surface_hide (GdkSurface *surface)
|
||||
|
||||
_gdk_broadway_surface_grab_check_unmap (surface,
|
||||
_gdk_broadway_server_get_next_serial (broadway_display->server));
|
||||
g_clear_handle_id (&impl->compute_size_source_id, g_source_remove);
|
||||
|
||||
if (_gdk_broadway_server_surface_hide (broadway_display->server, impl->id))
|
||||
queue_flush (surface);
|
||||
@@ -1009,6 +1144,8 @@ _gdk_broadway_moveresize_configure_done (GdkDisplay *display,
|
||||
BroadwayInputMsg *tmp_event;
|
||||
MoveResizeData *mv_resize = get_move_resize_data (display, FALSE);
|
||||
|
||||
gdk_surface_request_layout (surface);
|
||||
|
||||
if (!mv_resize || surface != mv_resize->moveresize_surface)
|
||||
return FALSE;
|
||||
|
||||
@@ -1168,6 +1305,43 @@ gdk_broadway_surface_beep (GdkSurface *surface)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_request_layout (GdkSurface *surface)
|
||||
{
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
|
||||
if (!impl->compute_size_source_id &&
|
||||
GDK_IS_TOPLEVEL (surface))
|
||||
{
|
||||
impl->compute_size_source_id = g_idle_add_full (G_PRIORITY_HIGH - 10,
|
||||
compute_size_idle,
|
||||
surface,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_surface_compute_size (GdkSurface *surface)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
if (GDK_IS_TOPLEVEL (surface))
|
||||
{
|
||||
compute_toplevel_size (surface, TRUE, &width, &height);
|
||||
}
|
||||
else
|
||||
{
|
||||
width = gdk_surface_get_width(surface);
|
||||
height = gdk_surface_get_height(surface);
|
||||
|
||||
gdk_broadway_surface_move_resize_internal (surface, FALSE,
|
||||
0, 0,
|
||||
width,
|
||||
height);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
{
|
||||
@@ -1187,6 +1361,8 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
|
||||
impl_class->destroy_notify = gdk_broadway_surface_destroy_notify;
|
||||
impl_class->drag_begin = _gdk_broadway_surface_drag_begin;
|
||||
impl_class->get_scale = gdk_broadway_surface_get_scale;
|
||||
impl_class->request_layout = gdk_broadway_surface_request_layout;
|
||||
impl_class->compute_size = gdk_broadway_surface_compute_size;
|
||||
}
|
||||
|
||||
#define LAST_PROP 1
|
||||
@@ -1504,55 +1680,12 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
|
||||
GdkToplevelLayout *layout)
|
||||
{
|
||||
GdkSurface *surface = GDK_SURFACE (toplevel);
|
||||
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
|
||||
GdkDisplay *display = gdk_surface_get_display (surface);
|
||||
GdkMonitor *monitor;
|
||||
GdkToplevelSize size;
|
||||
int bounds_width, bounds_height;
|
||||
int width, height;
|
||||
GdkGeometry geometry;
|
||||
GdkSurfaceHints mask;
|
||||
gboolean maximize;
|
||||
|
||||
gdk_broadway_surface_unminimize (surface);
|
||||
|
||||
monitor = gdk_display_get_monitor_at_surface (display, surface);
|
||||
if (monitor)
|
||||
{
|
||||
GdkRectangle monitor_geometry;
|
||||
|
||||
gdk_monitor_get_geometry (monitor, &monitor_geometry);
|
||||
bounds_width = monitor_geometry.width;
|
||||
bounds_height = monitor_geometry.height;
|
||||
}
|
||||
else
|
||||
{
|
||||
bounds_width = G_MAXINT;
|
||||
bounds_height = G_MAXINT;
|
||||
}
|
||||
|
||||
gdk_toplevel_size_init (&size, bounds_width, bounds_height);
|
||||
gdk_toplevel_notify_compute_size (toplevel, &size);
|
||||
g_warn_if_fail (size.width > 0);
|
||||
g_warn_if_fail (size.height > 0);
|
||||
width = size.width;
|
||||
height = size.height;
|
||||
|
||||
if (gdk_toplevel_layout_get_resizable (layout))
|
||||
{
|
||||
geometry.min_width = size.min_width;
|
||||
geometry.min_height = size.min_height;
|
||||
mask = GDK_HINT_MIN_SIZE;
|
||||
}
|
||||
else
|
||||
{
|
||||
geometry.max_width = geometry.min_width = width;
|
||||
geometry.max_height = geometry.min_height = height;
|
||||
mask = GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE;
|
||||
}
|
||||
gdk_broadway_surface_set_geometry_hints (surface, &geometry, mask);
|
||||
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
|
||||
gdk_broadway_surface_toplevel_resize (surface, width, height);
|
||||
compute_toplevel_size (surface, gdk_toplevel_layout_get_resizable (layout), &width, &height);
|
||||
|
||||
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
|
||||
{
|
||||
@@ -1562,14 +1695,7 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
|
||||
gdk_broadway_surface_unmaximize (surface);
|
||||
}
|
||||
|
||||
if (size.shadow.is_valid)
|
||||
{
|
||||
impl->shadow_left = size.shadow.left;
|
||||
impl->shadow_right = size.shadow.right;
|
||||
impl->shadow_top = size.shadow.top;
|
||||
impl->shadow_bottom = size.shadow.bottom;
|
||||
}
|
||||
|
||||
gdk_surface_request_layout (surface);
|
||||
show_surface (surface);
|
||||
}
|
||||
|
||||
|
@@ -76,6 +76,13 @@ struct _GdkBroadwaySurface
|
||||
int shadow_right;
|
||||
int shadow_top;
|
||||
int shadow_bottom;
|
||||
|
||||
int last_computed_width;
|
||||
int last_computed_height;
|
||||
|
||||
guint compute_size_source_id;
|
||||
|
||||
gboolean resizible;
|
||||
};
|
||||
|
||||
struct _GdkBroadwaySurfaceClass
|
||||
|
@@ -17,6 +17,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gio/gio.h>
|
||||
|
||||
void file_transfer_portal_register (void);
|
||||
|
||||
|
65
gdk/gdk.c
65
gdk/gdk.c
@@ -43,6 +43,14 @@
|
||||
|
||||
#include <fribidi.h>
|
||||
|
||||
/* GTK has a general architectural assumption that gsize is pointer-sized
|
||||
* (equivalent to uintptr_t), making it non-portable to architectures like
|
||||
* CHERI where that isn't true. If a future release relaxes that
|
||||
* assumption, changes will be needed in numerous places.
|
||||
* See also https://gitlab.gnome.org/GNOME/glib/-/issues/2842 for the
|
||||
* equivalent in GLib, which would be a prerequisite. */
|
||||
G_STATIC_ASSERT (sizeof (gsize) == sizeof (void *));
|
||||
G_STATIC_ASSERT (G_ALIGNOF (gsize) == G_ALIGNOF (void *));
|
||||
|
||||
/**
|
||||
* GDK_WINDOWING_X11:
|
||||
@@ -120,26 +128,40 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "dmabuf", GDK_DEBUG_DMABUF, "Information about dmabuf buffers" },
|
||||
{ "offload", GDK_DEBUG_OFFLOAD, "Information about subsurfaces and graphics offload" },
|
||||
|
||||
{ "linear", GDK_DEBUG_LINEAR, "Enable linear rendering" },
|
||||
{ "hdr", GDK_DEBUG_HDR, "Force HDR rendering" },
|
||||
{ "portals", GDK_DEBUG_PORTALS, "Force use of portals" },
|
||||
{ "no-portals", GDK_DEBUG_NO_PORTALS, "Disable use of portals" },
|
||||
{ "force-offload", GDK_DEBUG_FORCE_OFFLOAD, "Force graphics offload for all textures" },
|
||||
{ "gl-disable", GDK_DEBUG_GL_DISABLE, "Disable OpenGL support" },
|
||||
{ "gl-no-fractional", GDK_DEBUG_GL_NO_FRACTIONAL, "Disable fractional scaling for OpenGL" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-disable-gl", GDK_DEBUG_GL_DISABLE_GL, "Only allow OpenGL GLES API" },
|
||||
{ "gl-disable-gles", GDK_DEBUG_GL_DISABLE_GLES, "Don't allow OpenGL GLES API" },
|
||||
{ "gl-prefer-gl", GDK_DEBUG_GL_PREFER_GL, "Prefer GL over GLES API" },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
|
||||
{ "gl-wgl", GDK_DEBUG_GL_WGL, "Use WGL on Windows" },
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings" },
|
||||
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible" },
|
||||
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)" },
|
||||
{ "dmabuf-disable", GDK_DEBUG_DMABUF_DISABLE, "Disable dmabuf support" },
|
||||
};
|
||||
|
||||
static const GdkDebugKey gdk_feature_keys[] = {
|
||||
{ "gl", GDK_FEATURE_OPENGL, "Disable OpenGL support" },
|
||||
{ "gl-api", GDK_FEATURE_GL_API, "Disable non-GLES GL API" },
|
||||
{ "gles-api", GDK_FEATURE_GLES_API, "Disable GLES GL API" },
|
||||
{ "egl", GDK_FEATURE_EGL, "Disable EGL" },
|
||||
{ "glx", GDK_FEATURE_GLX, "Disable GLX" },
|
||||
{ "wgl", GDK_FEATURE_WGL, "Disable WGL" },
|
||||
{ "vulkan", GDK_FEATURE_VULKAN, "Disable Vulkan support" },
|
||||
{ "dmabuf", GDK_FEATURE_DMABUF, "Disable dmabuf support" },
|
||||
{ "offload", GDK_FEATURE_OFFLOAD, "Disable graphics offload" },
|
||||
{ "color-mgmt", GDK_FEATURE_COLOR_MANAGEMENT, "Disable color management" },
|
||||
};
|
||||
|
||||
|
||||
static GdkFeatures gdk_features;
|
||||
|
||||
gboolean
|
||||
gdk_has_feature (GdkFeatures features)
|
||||
{
|
||||
return (features & gdk_features) == features;
|
||||
}
|
||||
|
||||
#ifdef G_HAS_CONSTRUCTORS
|
||||
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
||||
@@ -207,6 +229,7 @@ gdk_ensure_resources (void)
|
||||
|
||||
guint
|
||||
gdk_parse_debug_var (const char *variable,
|
||||
const char *docs,
|
||||
const GdkDebugKey *keys,
|
||||
guint nkeys)
|
||||
{
|
||||
@@ -267,6 +290,7 @@ gdk_parse_debug_var (const char *variable,
|
||||
max_width = MAX (max_width, strlen (keys[i].key));
|
||||
max_width += 4;
|
||||
|
||||
fprintf (stderr, "%s\n", docs);
|
||||
fprintf (stderr, "Supported %s values:\n", variable);
|
||||
for (i = 0; i < nkeys; i++) {
|
||||
fprintf (stderr, " %s%*s%s\n", keys[i].key, (int)(max_width - strlen (keys[i].key)), " ", keys[i].help);
|
||||
@@ -294,21 +318,26 @@ gdk_parse_debug_var (const char *variable,
|
||||
void
|
||||
gdk_pre_parse (void)
|
||||
{
|
||||
GdkFeatures disabled_features;
|
||||
|
||||
gdk_initialized = TRUE;
|
||||
|
||||
gdk_ensure_resources ();
|
||||
|
||||
_gdk_debug_flags = gdk_parse_debug_var ("GDK_DEBUG",
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
"GDK_DEBUG can be set to values that make GDK print out different\n"
|
||||
"types of debugging information or change the behavior of GDK for\n"
|
||||
"debugging purposes.\n",
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
|
||||
/* These are global */
|
||||
if (_gdk_debug_flags & GDK_DEBUG_GL_EGL)
|
||||
gdk_gl_backend_use (GDK_GL_EGL);
|
||||
else if (_gdk_debug_flags & GDK_DEBUG_GL_GLX)
|
||||
gdk_gl_backend_use (GDK_GL_GLX);
|
||||
else if (_gdk_debug_flags & GDK_DEBUG_GL_WGL)
|
||||
gdk_gl_backend_use (GDK_GL_WGL);
|
||||
disabled_features = gdk_parse_debug_var ("GDK_DISABLE",
|
||||
"GDK_DISABLE can be set to values which cause GDK to disable\n"
|
||||
"certain features.\n",
|
||||
gdk_feature_keys,
|
||||
G_N_ELEMENTS (gdk_feature_keys));
|
||||
|
||||
gdk_features = GDK_ALL_FEATURES & ~disabled_features;
|
||||
|
||||
#ifndef G_HAS_CONSTRUCTORS
|
||||
stash_and_unset_environment ();
|
||||
|
@@ -29,7 +29,9 @@
|
||||
#include <gdk/gdkapplaunchcontext.h>
|
||||
#include <gdk/gdkcairo.h>
|
||||
#include <gdk/gdkcairocontext.h>
|
||||
#include <gdk/gdkcicpparams.h>
|
||||
#include <gdk/gdkclipboard.h>
|
||||
#include <gdk/gdkcolorstate.h>
|
||||
#include <gdk/gdkconfig.h>
|
||||
#include <gdk/gdkcontentdeserializer.h>
|
||||
#include <gdk/gdkcontentformats.h>
|
||||
@@ -61,6 +63,7 @@
|
||||
#include <gdk/gdkkeys.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gdk/gdkmemorytexture.h>
|
||||
#include <gdk/gdkmemorytexturebuilder.h>
|
||||
#include <gdk/gdkmonitor.h>
|
||||
#include <gdk/gdkpaintable.h>
|
||||
#include <gdk/gdkpango.h>
|
||||
|
@@ -120,7 +120,7 @@ gdk_app_launch_context_class_init (GdkAppLaunchContextClass *klass)
|
||||
context_class->launch_failed = gdk_app_launch_context_launch_failed;
|
||||
|
||||
/**
|
||||
* GdkAppLaunchContext:display: (attributes org.gtk.Property.get=gdk_app_launch_context_get_display)
|
||||
* GdkAppLaunchContext:display:
|
||||
*
|
||||
* The display that the `GdkAppLaunchContext` is on.
|
||||
*/
|
||||
@@ -169,7 +169,7 @@ gdk_app_launch_context_get_display_name (GAppLaunchContext *context,
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_app_launch_context_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_app_launch_context_get_display:
|
||||
* @context: a `GdkAppLaunchContext`
|
||||
*
|
||||
* Gets the `GdkDisplay` that @context is for.
|
||||
|
@@ -82,8 +82,10 @@ gdk_cairo_context_cairo_create (GdkCairoContext *self)
|
||||
|
||||
draw_context = GDK_DRAW_CONTEXT (self);
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
if (!gdk_draw_context_is_in_frame (draw_context))
|
||||
return NULL;
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
cr = GDK_CAIRO_CONTEXT_GET_CLASS (self)->cairo_create (self);
|
||||
|
||||
|
171
gdk/gdkcairoprivate.h
Normal file
171
gdk/gdkcairoprivate.h
Normal file
@@ -0,0 +1,171 @@
|
||||
#pragma once
|
||||
|
||||
#include "gdkcolorstateprivate.h"
|
||||
#include "gdkcolorprivate.h"
|
||||
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkmemorytexture.h"
|
||||
|
||||
#include <cairo.h>
|
||||
#include <graphene.h>
|
||||
|
||||
static inline cairo_format_t
|
||||
gdk_cairo_format_for_depth (GdkMemoryDepth depth)
|
||||
{
|
||||
switch (depth)
|
||||
{
|
||||
case GDK_MEMORY_NONE:
|
||||
case GDK_MEMORY_U8:
|
||||
return CAIRO_FORMAT_ARGB32;
|
||||
|
||||
case GDK_MEMORY_U8_SRGB:
|
||||
case GDK_MEMORY_U16:
|
||||
case GDK_MEMORY_FLOAT16:
|
||||
case GDK_MEMORY_FLOAT32:
|
||||
return CAIRO_FORMAT_RGBA128F;
|
||||
|
||||
case GDK_N_DEPTHS:
|
||||
default:
|
||||
g_return_val_if_reached (CAIRO_FORMAT_ARGB32);
|
||||
}
|
||||
}
|
||||
|
||||
static inline GdkMemoryDepth
|
||||
gdk_cairo_depth_for_format (cairo_format_t format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case CAIRO_FORMAT_ARGB32:
|
||||
case CAIRO_FORMAT_RGB24:
|
||||
case CAIRO_FORMAT_RGB16_565:
|
||||
case CAIRO_FORMAT_A1:
|
||||
case CAIRO_FORMAT_A8:
|
||||
return GDK_MEMORY_U8;
|
||||
|
||||
case CAIRO_FORMAT_RGB30:
|
||||
return GDK_MEMORY_U16;
|
||||
|
||||
case CAIRO_FORMAT_RGB96F:
|
||||
case CAIRO_FORMAT_RGBA128F:
|
||||
return GDK_MEMORY_FLOAT32;
|
||||
|
||||
case CAIRO_FORMAT_INVALID:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return GDK_MEMORY_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
static GdkMemoryFormat
|
||||
gdk_cairo_format_to_memory_format (cairo_format_t format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case CAIRO_FORMAT_ARGB32:
|
||||
return GDK_MEMORY_DEFAULT;
|
||||
|
||||
case CAIRO_FORMAT_RGB24:
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
return GDK_MEMORY_B8G8R8X8;
|
||||
#elif G_BYTE_ORDER == G_BIG_ENDIAN
|
||||
return GDK_MEMORY_X8R8G8B8;
|
||||
#else
|
||||
#error "Unknown byte order for Cairo format"
|
||||
#endif
|
||||
case CAIRO_FORMAT_A8:
|
||||
return GDK_MEMORY_A8;
|
||||
case CAIRO_FORMAT_RGB96F:
|
||||
return GDK_MEMORY_R32G32B32_FLOAT;
|
||||
case CAIRO_FORMAT_RGBA128F:
|
||||
return GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED;
|
||||
|
||||
case CAIRO_FORMAT_RGB16_565:
|
||||
case CAIRO_FORMAT_RGB30:
|
||||
case CAIRO_FORMAT_INVALID:
|
||||
case CAIRO_FORMAT_A1:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
return GDK_MEMORY_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_cairo_set_source_color (cairo_t *cr,
|
||||
GdkColorState *ccs,
|
||||
const GdkColor *color)
|
||||
{
|
||||
float c[4];
|
||||
gdk_color_to_float (color, ccs, c);
|
||||
cairo_set_source_rgba (cr, c[0], c[1], c[2], c[3]);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_cairo_set_source_rgba_ccs (cairo_t *cr,
|
||||
GdkColorState *ccs,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
GdkColor c;
|
||||
gdk_color_init_from_rgba (&c, rgba);
|
||||
gdk_cairo_set_source_color (cr, ccs, &c);
|
||||
gdk_color_finish (&c);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_cairo_pattern_add_color_stop_rgba_ccs (cairo_pattern_t *pattern,
|
||||
GdkColorState *ccs,
|
||||
double offset,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
float color[4];
|
||||
|
||||
gdk_color_state_from_rgba (ccs, rgba, color);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, offset, color[0], color[1], color[2], color[3]);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_cairo_pattern_add_color_stop_color (cairo_pattern_t *pattern,
|
||||
GdkColorState *ccs,
|
||||
double offset,
|
||||
const GdkColor *color)
|
||||
{
|
||||
float values[4];
|
||||
|
||||
gdk_color_to_float (color, ccs, values);
|
||||
cairo_pattern_add_color_stop_rgba (pattern, offset, values[0], values[1], values[2], values[3]);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_cairo_rect (cairo_t *cr,
|
||||
const graphene_rect_t *rect)
|
||||
{
|
||||
cairo_rectangle (cr,
|
||||
rect->origin.x, rect->origin.y,
|
||||
rect->size.width, rect->size.height);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_cairo_surface_convert_color_state (cairo_surface_t *surface,
|
||||
GdkColorState *source,
|
||||
GdkColorState *target)
|
||||
{
|
||||
cairo_surface_t *image_surface;
|
||||
|
||||
if (gdk_color_state_equal (source, target))
|
||||
return;
|
||||
|
||||
image_surface = cairo_surface_map_to_image (surface, NULL);
|
||||
|
||||
gdk_memory_convert_color_state (cairo_image_surface_get_data (image_surface),
|
||||
cairo_image_surface_get_stride (image_surface),
|
||||
gdk_cairo_format_to_memory_format (cairo_image_surface_get_format (image_surface)),
|
||||
source,
|
||||
target,
|
||||
cairo_image_surface_get_width (image_surface),
|
||||
cairo_image_surface_get_height (image_surface));
|
||||
|
||||
cairo_surface_mark_dirty (image_surface);
|
||||
cairo_surface_unmap_image (surface, image_surface);
|
||||
/* https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/487 */
|
||||
cairo_surface_mark_dirty (surface);
|
||||
}
|
||||
|
481
gdk/gdkcicpparams.c
Normal file
481
gdk/gdkcicpparams.c
Normal file
@@ -0,0 +1,481 @@
|
||||
/* gdkcicpparams.c
|
||||
*
|
||||
* Copyright 2024 Matthias Clasen
|
||||
*
|
||||
* 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 "config.h"
|
||||
|
||||
#include "gdkcicpparamsprivate.h"
|
||||
#include "gdkcolorstateprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
|
||||
/**
|
||||
* GdkCicpParams:
|
||||
*
|
||||
* The `GdkCicpParams` struct contains the parameters that define
|
||||
* a colorstate according to the ITU-T H.273
|
||||
* [specification](https://www.itu.int/rec/T-REC-H.273/en).
|
||||
*
|
||||
* See the documentation of individual properties for supported values.
|
||||
*
|
||||
* The 'unspecified' value (2) is not treated in any special way, and
|
||||
* must be replaced by a different value before creating a color state.
|
||||
*
|
||||
* `GdkCicpParams` can be used as a builder object to construct a color
|
||||
* state from Cicp data with [method@Gdk.CicpParams.build_color_state].
|
||||
* The function will return an error if the given parameters are not
|
||||
* supported.
|
||||
*
|
||||
* You can obtain a `GdkCicpParams` object from a color state with
|
||||
* [method@Gdk.ColorState.create_cicp_params]. This can be used to
|
||||
* create a variant of a color state, by changing just one of the cicp
|
||||
* parameters, or just to obtain information about the color state.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
|
||||
/* {{{ GObject boilerplate */
|
||||
|
||||
struct _GdkCicpParams
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GdkCicp cicp;
|
||||
};
|
||||
|
||||
struct _GdkCicpParamsClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (GdkCicpParams, gdk_cicp_params, G_TYPE_OBJECT)
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_COLOR_PRIMARIES = 1,
|
||||
PROP_TRANSFER_FUNCTION,
|
||||
PROP_MATRIX_COEFFICIENTS,
|
||||
PROP_RANGE,
|
||||
|
||||
N_PROPERTIES,
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPERTIES] = { NULL, };
|
||||
|
||||
static void
|
||||
gdk_cicp_params_init (GdkCicpParams *self)
|
||||
{
|
||||
self->cicp.color_primaries = 2;
|
||||
self->cicp.transfer_function = 2;
|
||||
self->cicp.matrix_coefficients = 2;
|
||||
self->cicp.range = GDK_CICP_RANGE_NARROW;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_cicp_params_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkCicpParams *self = GDK_CICP_PARAMS (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_COLOR_PRIMARIES:
|
||||
g_value_set_uint (value, self->cicp.color_primaries);
|
||||
break;
|
||||
|
||||
case PROP_TRANSFER_FUNCTION:
|
||||
g_value_set_uint (value, self->cicp.transfer_function);
|
||||
break;
|
||||
|
||||
case PROP_MATRIX_COEFFICIENTS:
|
||||
g_value_set_uint (value, self->cicp.matrix_coefficients);
|
||||
break;
|
||||
|
||||
case PROP_RANGE:
|
||||
g_value_set_enum (value, self->cicp.range);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_cicp_params_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GdkCicpParams *self = GDK_CICP_PARAMS (object);
|
||||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_COLOR_PRIMARIES:
|
||||
gdk_cicp_params_set_color_primaries (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_TRANSFER_FUNCTION:
|
||||
gdk_cicp_params_set_transfer_function (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_MATRIX_COEFFICIENTS:
|
||||
gdk_cicp_params_set_matrix_coefficients (self, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_RANGE:
|
||||
gdk_cicp_params_set_range (self, g_value_get_enum (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_cicp_params_class_init (GdkCicpParamsClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
object_class->get_property = gdk_cicp_params_get_property;
|
||||
object_class->set_property = gdk_cicp_params_set_property;
|
||||
|
||||
/**
|
||||
* GdkCicpParams:color-primaries:
|
||||
*
|
||||
* The color primaries to use.
|
||||
*
|
||||
* Supported values:
|
||||
*
|
||||
* - 1: BT.709 / sRGB
|
||||
* - 2: unspecified
|
||||
* - 5: PAL
|
||||
* - 6,7: BT.601 / NTSC
|
||||
* - 9: BT.2020
|
||||
* - 12: Display P3
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_COLOR_PRIMARIES] =
|
||||
g_param_spec_uint ("color-primaries", NULL, NULL,
|
||||
0, 255, 2,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkCicpParams:transfer-function:
|
||||
*
|
||||
* The transfer function to use.
|
||||
*
|
||||
* Supported values:
|
||||
*
|
||||
* - 1,6,14,15: BT.709, BT.601, BT.2020
|
||||
* - 2: unspecified
|
||||
* - 4: gamma 2.2
|
||||
* - 5: gamma 2.8
|
||||
* - 8: linear
|
||||
* - 13: sRGB
|
||||
* - 16: BT.2100 PQ
|
||||
* - 18: BT.2100 HLG
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_TRANSFER_FUNCTION] =
|
||||
g_param_spec_uint ("transfer-function", NULL, NULL,
|
||||
0, 255, 2,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkCicpParams:matrix-coefficients:
|
||||
*
|
||||
* The matrix coefficients (for YUV to RGB conversion).
|
||||
*
|
||||
* Supported values:
|
||||
*
|
||||
* - 0: RGB
|
||||
* - 2: unspecified
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_MATRIX_COEFFICIENTS] =
|
||||
g_param_spec_uint ("matrix-coefficients", NULL, NULL,
|
||||
0, 255, 2,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
/**
|
||||
* GdkCicpParams:range:
|
||||
*
|
||||
* Whether the data is using the full range of values.
|
||||
*
|
||||
* The range of the data.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_RANGE] =
|
||||
g_param_spec_enum ("range", NULL, NULL,
|
||||
GDK_TYPE_CICP_RANGE,
|
||||
GDK_CICP_RANGE_NARROW,
|
||||
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
|
||||
|
||||
g_object_class_install_properties (object_class, N_PROPERTIES, properties);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Public API */
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_new:
|
||||
*
|
||||
* Creates a new `GdkCicpParams` object.
|
||||
*
|
||||
* The initial values of the properties are the values for "undefined"
|
||||
* and need to be set before a color state object can be built.
|
||||
*
|
||||
* Returns: (transfer full): a new `GdkCicpParams`
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
GdkCicpParams *
|
||||
gdk_cicp_params_new (void)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_CICP_PARAMS, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_get_color_primaries:
|
||||
* @self: a `GdkCicpParams`
|
||||
*
|
||||
* Returns the value of the color-primaries property
|
||||
* of @self.
|
||||
*
|
||||
* Returns: the color-primaries value
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
guint
|
||||
gdk_cicp_params_get_color_primaries (GdkCicpParams *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_CICP_PARAMS (self), 0);
|
||||
|
||||
return self->cicp.color_primaries;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_set_color_primaries:
|
||||
* @self: a `GdkCicpParams`
|
||||
* @color_primaries: the new color primaries value
|
||||
*
|
||||
* Sets the color-primaries property of @self.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
void
|
||||
gdk_cicp_params_set_color_primaries (GdkCicpParams *self,
|
||||
guint color_primaries)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_CICP_PARAMS (self));
|
||||
|
||||
if (self->cicp.color_primaries == color_primaries)
|
||||
return;
|
||||
|
||||
self->cicp.color_primaries = color_primaries;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_COLOR_PRIMARIES]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_get_transfer_function:
|
||||
* @self: a `GdkCicpParams`
|
||||
*
|
||||
* Gets the transfer-function property of @self.
|
||||
*
|
||||
* Returns: the transfer-function value
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
guint
|
||||
gdk_cicp_params_get_transfer_function (GdkCicpParams *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_CICP_PARAMS (self), 0);
|
||||
|
||||
return self->cicp.transfer_function;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_set_transfer_function:
|
||||
* @self: a `GdkCicpParams`
|
||||
* @transfer_function: the new transfer-function value
|
||||
*
|
||||
* Sets the transfer-function property of @self.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
void
|
||||
gdk_cicp_params_set_transfer_function (GdkCicpParams *self,
|
||||
guint transfer_function)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_CICP_PARAMS (self));
|
||||
|
||||
if (self->cicp.transfer_function == transfer_function)
|
||||
return;
|
||||
|
||||
self->cicp.transfer_function = transfer_function;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TRANSFER_FUNCTION]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_get_matrix_coefficients:
|
||||
* @self: a `GdkCicpParams`
|
||||
*
|
||||
* Gets the matrix-coefficients property of @self.
|
||||
*
|
||||
* Returns: the matrix-coefficients value
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
guint
|
||||
gdk_cicp_params_get_matrix_coefficients (GdkCicpParams *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_CICP_PARAMS (self), 0);
|
||||
|
||||
return self->cicp.matrix_coefficients;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_set_matrix_coefficients:
|
||||
* @self a `GdkCicpParams`
|
||||
* @matrix_coefficients: the new matrix-coefficients value
|
||||
*
|
||||
* Sets the matrix-coefficients property of @self.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
void
|
||||
gdk_cicp_params_set_matrix_coefficients (GdkCicpParams *self,
|
||||
guint matrix_coefficients)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_CICP_PARAMS (self));
|
||||
|
||||
if (self->cicp.matrix_coefficients == matrix_coefficients)
|
||||
return;
|
||||
|
||||
self->cicp.matrix_coefficients = matrix_coefficients;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_MATRIX_COEFFICIENTS]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_get_range:
|
||||
* @self: a `GdkCicpParams`
|
||||
*
|
||||
* Gets the range property of @self.
|
||||
*
|
||||
* Returns: the range value
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
GdkCicpRange
|
||||
gdk_cicp_params_get_range (GdkCicpParams *self)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_CICP_PARAMS (self), GDK_CICP_RANGE_NARROW);
|
||||
|
||||
return self->cicp.range;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_set_range:
|
||||
* @self: a `GdkCipParams`
|
||||
* @range: the range value
|
||||
*
|
||||
* Sets the range property of @self
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
void
|
||||
gdk_cicp_params_set_range (GdkCicpParams *self,
|
||||
GdkCicpRange range)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_CICP_PARAMS (self));
|
||||
|
||||
if (self->cicp.range == range)
|
||||
return;
|
||||
|
||||
self->cicp.range = range;
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_RANGE]);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_cicp_params_build_color_state:
|
||||
* @self: a `GdkCicpParams`
|
||||
* @error: return location for errors
|
||||
*
|
||||
* Creates a new `GdkColorState` object for the cicp parameters in @self.
|
||||
*
|
||||
* Note that this may fail if the cicp parameters in @self are not
|
||||
* supported by GTK. In that case, `NULL` is returned, and @error is set
|
||||
* with an error message that can be presented to the user.
|
||||
*
|
||||
* Returns: (transfer full) (nullable): A newly allocated `GdkColorState`
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
GdkColorState *
|
||||
gdk_cicp_params_build_color_state (GdkCicpParams *self,
|
||||
GError **error)
|
||||
{
|
||||
return gdk_color_state_new_for_cicp (gdk_cicp_params_get_cicp (self), error);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Private API */
|
||||
|
||||
/*< private >
|
||||
* gdk_cicp_params_new_for_cicp:
|
||||
* @cicp: a GdkCicp struct
|
||||
*
|
||||
* Create a `GdkCicpParams` from the values in @cicp.
|
||||
*
|
||||
* Returns: (transfer full): a new `GdkCicpParams` object
|
||||
*/
|
||||
GdkCicpParams *
|
||||
gdk_cicp_params_new_for_cicp (const GdkCicp *cicp)
|
||||
{
|
||||
return g_object_new (GDK_TYPE_CICP_PARAMS,
|
||||
"color-primaries", cicp->color_primaries,
|
||||
"transfer-function", cicp->transfer_function,
|
||||
"matrix-coefficients", cicp->matrix_coefficients,
|
||||
"range", cicp->range,
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_cicp_params_get_cicp:
|
||||
* @self: a `GdkCicpParams` object
|
||||
*
|
||||
* Gets the `GdkCicp` struct of @self.
|
||||
*
|
||||
* Returns: (transfer none): a `GdkCicp` struct containing
|
||||
* the values of @self
|
||||
*/
|
||||
const GdkCicp *
|
||||
gdk_cicp_params_get_cicp (GdkCicpParams *self)
|
||||
{
|
||||
return &self->cicp;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker expandtab: */
|
90
gdk/gdkcicpparams.h
Normal file
90
gdk/gdkcicpparams.h
Normal file
@@ -0,0 +1,90 @@
|
||||
/* gdkcicpparams.h
|
||||
*
|
||||
* Copyright 2024 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
#define GDK_TYPE_CICP_PARAMS (gdk_cicp_params_get_type ())
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GDK_DECLARE_INTERNAL_TYPE (GdkCicpParams, gdk_cicp_params, GDK, CICP_PARAMS, GObject)
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkCicpParams *gdk_cicp_params_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
guint gdk_cicp_params_get_color_primaries (GdkCicpParams *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
void gdk_cicp_params_set_color_primaries (GdkCicpParams *self,
|
||||
guint color_primaries);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
guint gdk_cicp_params_get_transfer_function (GdkCicpParams *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
void gdk_cicp_params_set_transfer_function (GdkCicpParams *self,
|
||||
guint transfer_function);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
guint gdk_cicp_params_get_matrix_coefficients (GdkCicpParams *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
void gdk_cicp_params_set_matrix_coefficients (GdkCicpParams *self,
|
||||
guint matrix_coefficients);
|
||||
|
||||
/**
|
||||
* GdkCicpRange:
|
||||
* @GDK_CICP_RANGE_NARROW: The values use the range of 16-235 (for Y) and 16-240 for u and v.
|
||||
* @GDK_CICP_RANGE_FULL: The values use the full range.
|
||||
*
|
||||
* The values of this enumeration describe whether image data uses
|
||||
* the full range of 8-bit values.
|
||||
*
|
||||
* In digital broadcasting, it is common to reserve the lowest and
|
||||
* highest values. Typically the allowed values for the narrow range
|
||||
* are 16-235 for Y and 16-240 for u,v (when dealing with YUV data).
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_CICP_RANGE_NARROW,
|
||||
GDK_CICP_RANGE_FULL,
|
||||
} GdkCicpRange;
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkCicpRange gdk_cicp_params_get_range (GdkCicpParams *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
void gdk_cicp_params_set_range (GdkCicpParams *self,
|
||||
GdkCicpRange range);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_cicp_params_build_color_state (GdkCicpParams *self,
|
||||
GError **error);
|
||||
|
||||
|
||||
G_END_DECLS
|
84
gdk/gdkcicpparamsprivate.h
Normal file
84
gdk/gdkcicpparamsprivate.h
Normal file
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
#include "gdkcicpparams.h"
|
||||
|
||||
typedef struct _GdkCicp GdkCicp;
|
||||
|
||||
struct _GdkCicp
|
||||
{
|
||||
guint color_primaries;
|
||||
guint transfer_function;
|
||||
guint matrix_coefficients;
|
||||
GdkCicpRange range;
|
||||
};
|
||||
|
||||
/*< private >
|
||||
* gdk_cicp_equal:
|
||||
* @p1: a `GdkCicp`
|
||||
* @p2: another `GdkCicp`
|
||||
*
|
||||
* Compare two cicp tuples for equality.
|
||||
*
|
||||
* Note that several cicp values are 'functionally equivalent'.
|
||||
* If you are interested in that notion, use gdk_cicp_equivalent().
|
||||
*
|
||||
* Returns: whether @p1 and @p2 are equal
|
||||
*/
|
||||
static inline gboolean
|
||||
gdk_cicp_equal (const GdkCicp *p1,
|
||||
const GdkCicp *p2)
|
||||
{
|
||||
return p1->color_primaries == p2->color_primaries &&
|
||||
p1->transfer_function == p2->transfer_function &&
|
||||
p1->matrix_coefficients == p2->matrix_coefficients &&
|
||||
p1->range == p2->range;
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_cicp_normalize (const GdkCicp *orig,
|
||||
GdkCicp *out)
|
||||
{
|
||||
memcpy (out, orig, sizeof (GdkCicp));
|
||||
|
||||
/* ntsc */
|
||||
if (out->color_primaries == 6)
|
||||
out->color_primaries = 5;
|
||||
|
||||
/* bt709 */
|
||||
if (out->transfer_function == 6 ||
|
||||
out->transfer_function == 14 ||
|
||||
out->transfer_function == 15)
|
||||
out->transfer_function = 1;
|
||||
|
||||
/* bt601 */
|
||||
if (out->matrix_coefficients == 6)
|
||||
out->matrix_coefficients = 5;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_cicp_equivalent:
|
||||
* @p1: a `GdkCicp`
|
||||
* @p2: another `GdkCicp`
|
||||
*
|
||||
* Determine whether two cicp tuples are functionally equivalent.
|
||||
*
|
||||
* Returns: whether @p1 and @p2 are functionally equivalent
|
||||
*/
|
||||
static inline gboolean
|
||||
gdk_cicp_equivalent (const GdkCicp *p1,
|
||||
const GdkCicp *p2)
|
||||
{
|
||||
GdkCicp n1, n2;
|
||||
|
||||
if (gdk_cicp_equal (p1, p2))
|
||||
return TRUE;
|
||||
|
||||
gdk_cicp_normalize (p1, &n1);
|
||||
gdk_cicp_normalize (p2, &n2);
|
||||
|
||||
return gdk_cicp_equal (&n1, &n2);
|
||||
}
|
||||
|
||||
const GdkCicp * gdk_cicp_params_get_cicp (GdkCicpParams *self);
|
||||
|
||||
GdkCicpParams * gdk_cicp_params_new_for_cicp (const GdkCicp *cicp);
|
@@ -353,7 +353,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
class->read_finish = gdk_clipboard_read_local_finish;
|
||||
|
||||
/**
|
||||
* GdkClipboard:display: (attributes org.gtk.Property.get=gdk_clipboard_get_display)
|
||||
* GdkClipboard:display:
|
||||
*
|
||||
* The `GdkDisplay` that the clipboard belongs to.
|
||||
*/
|
||||
@@ -366,7 +366,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkClipboard:formats: (attributes org.gtk.Property.get=gdk_clipboard_get_formats)
|
||||
* GdkClipboard:formats:
|
||||
*
|
||||
* The possible formats that the clipboard can provide its data in.
|
||||
*/
|
||||
@@ -378,7 +378,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkClipboard:local: (attributes org.gtk.Property.get=gdk_clipboard_is_local)
|
||||
* GdkClipboard:local: (getter is_local)
|
||||
*
|
||||
* %TRUE if the contents of the clipboard are owned by this process.
|
||||
*/
|
||||
@@ -390,7 +390,7 @@ gdk_clipboard_class_init (GdkClipboardClass *class)
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkClipboard:content: (attributes org.gtk.Property.get=gdk_clipboard_get_content)
|
||||
* GdkClipboard:content:
|
||||
*
|
||||
* The `GdkContentProvider` or %NULL if the clipboard is empty or contents are
|
||||
* provided otherwise.
|
||||
@@ -429,7 +429,7 @@ gdk_clipboard_init (GdkClipboard *clipboard)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_clipboard_get_display: (attributes org.gtk.Method.get_property=display)
|
||||
* gdk_clipboard_get_display:
|
||||
* @clipboard: a `GdkClipboard`
|
||||
*
|
||||
* Gets the `GdkDisplay` that the clipboard was created for.
|
||||
@@ -447,7 +447,7 @@ gdk_clipboard_get_display (GdkClipboard *clipboard)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_clipboard_get_formats: (attributes org.gtk.Method.get_property=formats)
|
||||
* gdk_clipboard_get_formats:
|
||||
* @clipboard: a `GdkClipboard`
|
||||
*
|
||||
* Gets the formats that the clipboard can provide its current contents in.
|
||||
@@ -465,7 +465,7 @@ gdk_clipboard_get_formats (GdkClipboard *clipboard)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_clipboard_is_local: (attributes org.gtk.Method.get_property=local)
|
||||
* gdk_clipboard_is_local: (get-property local)
|
||||
* @clipboard: a `GdkClipboard`
|
||||
*
|
||||
* Returns if the clipboard is local.
|
||||
@@ -489,7 +489,7 @@ gdk_clipboard_is_local (GdkClipboard *clipboard)
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_clipboard_get_content: (attributes org.gtk.Method.get_property=content)
|
||||
* gdk_clipboard_get_content:
|
||||
* @clipboard: a `GdkClipboard`
|
||||
*
|
||||
* Returns the `GdkContentProvider` currently set on @clipboard.
|
||||
@@ -515,8 +515,8 @@ gdk_clipboard_get_content (GdkClipboard *clipboard)
|
||||
* @clipboard: a `GdkClipboard`
|
||||
* @io_priority: the I/O priority of the request
|
||||
* @cancellable: (nullable): optional `GCancellable` object
|
||||
* @callback: (scope async): callback to call when the request is satisfied
|
||||
* @user_data: (closure): the data to pass to callback function
|
||||
* @callback: (scope async) (closure user_data): callback to call when the request is satisfied
|
||||
* @user_data:: the data to pass to callback function
|
||||
*
|
||||
* Asynchronously instructs the @clipboard to store its contents remotely.
|
||||
*
|
||||
@@ -630,8 +630,8 @@ gdk_clipboard_read_internal (GdkClipboard *clipboard,
|
||||
* @mime_types: (array zero-terminated=1): a %NULL-terminated array of mime types to choose from
|
||||
* @io_priority: the I/O priority of the request
|
||||
* @cancellable: (nullable): optional `GCancellable` object
|
||||
* @callback: (scope async): callback to call when the request is satisfied
|
||||
* @user_data: (closure): the data to pass to callback function
|
||||
* @callback: (scope async) (closure user_data): callback to call when the request is satisfied
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* Asynchronously requests an input stream to read the @clipboard's
|
||||
* contents from.
|
||||
@@ -823,8 +823,8 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
|
||||
* @type: a `GType` to read
|
||||
* @io_priority: the I/O priority of the request
|
||||
* @cancellable: (nullable): optional `GCancellable` object
|
||||
* @callback: (scope async): callback to call when the request is satisfied
|
||||
* @user_data: (closure): the data to pass to callback function
|
||||
* @callback: (scope async) (closure user_data): callback to call when the request is satisfied
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* Asynchronously request the @clipboard contents converted to the given
|
||||
* @type.
|
||||
@@ -882,8 +882,8 @@ gdk_clipboard_read_value_finish (GdkClipboard *clipboard,
|
||||
* gdk_clipboard_read_texture_async:
|
||||
* @clipboard: a `GdkClipboard`
|
||||
* @cancellable: (nullable): optional `GCancellable` object, %NULL to ignore.
|
||||
* @callback: (scope async): callback to call when the request is satisfied
|
||||
* @user_data: (closure): the data to pass to callback function
|
||||
* @callback: (scope async) (closure user_data): callback to call when the request is satisfied
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* Asynchronously request the @clipboard contents converted to a `GdkPixbuf`.
|
||||
*
|
||||
@@ -944,8 +944,8 @@ gdk_clipboard_read_texture_finish (GdkClipboard *clipboard,
|
||||
* gdk_clipboard_read_text_async:
|
||||
* @clipboard: a `GdkClipboard`
|
||||
* @cancellable: (nullable): optional `GCancellable` object
|
||||
* @callback: (scope async): callback to call when the request is satisfied
|
||||
* @user_data: (closure): the data to pass to callback function
|
||||
* @callback: (scope async) (closure user_data): callback to call when the request is satisfied
|
||||
* @user_data: the data to pass to callback function
|
||||
*
|
||||
* Asynchronously request the @clipboard contents converted to a string.
|
||||
*
|
||||
|
287
gdk/gdkcolor.c
Normal file
287
gdk/gdkcolor.c
Normal file
@@ -0,0 +1,287 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* Copyright (C) 2021 Benjamin Otte
|
||||
*
|
||||
* 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 "config.h"
|
||||
|
||||
#include "gdkcolorprivate.h"
|
||||
#include "gdkcolorstateprivate.h"
|
||||
#include "gdkrgbaprivate.h"
|
||||
|
||||
/*< private >
|
||||
* GdkColor:
|
||||
* @color_state: the color state to interpret the values in
|
||||
* @values: the 3 coordinates that define the color, followed
|
||||
* by the alpha value
|
||||
*
|
||||
* A `GdkColor` represents a color.
|
||||
*
|
||||
* The color state defines the meaning and range of the values.
|
||||
* E.g., the srgb color state has r, g, b components representing
|
||||
* red, green and blue with a range of [0,1], while the oklch color
|
||||
* state has l, c, h components representing luminosity, chromaticity
|
||||
* and hue, with l ranging from 0 to 1 and c from 0 to about 0.4, while
|
||||
* h is interpreted as angle in degrees.
|
||||
*
|
||||
* value[3] is always the alpha value with a range of [0,1].
|
||||
*
|
||||
* The values are also available under the names red, green, blue
|
||||
* and alpha, or r, g, b and a.
|
||||
*/
|
||||
|
||||
/*< private >
|
||||
* gdk_color_init:
|
||||
* @self: the `GdkColor` struct to initialize
|
||||
* @color_state: the color state
|
||||
* @values: the values
|
||||
*
|
||||
* Initializes the `GdkColor` with the given color state
|
||||
* and values.
|
||||
*
|
||||
* Note that this takes a reference on @color_state that
|
||||
* must be freed by calling [function@Gdk.Color.finish]
|
||||
* when the `GdkColor` is no longer needed.
|
||||
*/
|
||||
void
|
||||
(gdk_color_init) (GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
const float values[4])
|
||||
{
|
||||
_gdk_color_init (self, color_state, values);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_init_copy:
|
||||
* @self: the `GdkColor` struct to initialize
|
||||
* @color: the `GdkColor` to copy
|
||||
*
|
||||
* Initializes the `GdkColor` by copying the contents
|
||||
* of another `GdkColor`.
|
||||
*
|
||||
* Note that this takes a reference on the color state
|
||||
* that must be freed by calling [function@Gdk.Color.finish]
|
||||
* when the `GdkColor` is no longer needed.
|
||||
*/
|
||||
void
|
||||
(gdk_color_init_copy) (GdkColor *self,
|
||||
const GdkColor *color)
|
||||
{
|
||||
_gdk_color_init_copy (self, color);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_init_from_rgba:
|
||||
* @self: the `GdkColor` struct to initialize
|
||||
* @rgba: the `GdkRGBA` to copy
|
||||
*
|
||||
* Initializes the `GdkColor` by copying the contents
|
||||
* of a `GdkRGBA`.
|
||||
*
|
||||
* Note that `GdkRGBA` colors are always in the sRGB
|
||||
* color state.
|
||||
*
|
||||
* Note that this takes a reference on the color state
|
||||
* that must be freed by calling [function@Gdk.Color.finish]
|
||||
* when the `GdkColor` is no longer needed.
|
||||
*/
|
||||
void
|
||||
(gdk_color_init_from_rgba) (GdkColor *self,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
_gdk_color_init_from_rgba (self, rgba);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* @self: a `GdkColor`
|
||||
*
|
||||
* Drop the reference on the color state of @self.
|
||||
*
|
||||
* After this, @self is empty and can be initialized again
|
||||
* with [function@Gdk.Color.init] and its variants.
|
||||
*/
|
||||
void
|
||||
(gdk_color_finish) (GdkColor *self)
|
||||
{
|
||||
_gdk_color_finish (self);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_equal:
|
||||
* @self: a `GdkColor`
|
||||
* @other: another `GdkColor`
|
||||
*
|
||||
* Compares two `GdkColor` structs for equality.
|
||||
*
|
||||
* Returns: `TRUE` if @self and @other are equal
|
||||
*/
|
||||
gboolean
|
||||
(gdk_color_equal) (const GdkColor *self,
|
||||
const GdkColor *other)
|
||||
{
|
||||
return _gdk_color_equal (self, other);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_is_clear:
|
||||
* @self: a `GdkColor`
|
||||
*
|
||||
* Returns whether @self is fully transparent.
|
||||
*
|
||||
* Returns: `TRUE` if @self is transparent
|
||||
*/
|
||||
gboolean
|
||||
(gdk_color_is_clear) (const GdkColor *self)
|
||||
{
|
||||
return _gdk_color_is_clear (self);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_is_opaque:
|
||||
* @self: a `GdkColor`
|
||||
*
|
||||
* Returns whether @self is fully opaque.
|
||||
*
|
||||
* Returns: `TRUE` if @self if opaque
|
||||
*/
|
||||
gboolean
|
||||
(gdk_color_is_opaque) (const GdkColor *self)
|
||||
{
|
||||
return _gdk_color_is_opaque (self);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_convert:
|
||||
* @self: the `GdkColor` to store the result in
|
||||
* @color_state: the target color start
|
||||
* @other: the `GdkColor` to convert
|
||||
*
|
||||
* Converts a given `GdkColor` to another color state.
|
||||
*
|
||||
* After the conversion, @self will represent the same
|
||||
* color as @other in @color_state, to the degree possible.
|
||||
*
|
||||
* Different color states have different gamuts of colors
|
||||
* they can represent, and converting a color to a color
|
||||
* state with a smaller gamut may yield an 'out of gamut'
|
||||
* result.
|
||||
*/
|
||||
void
|
||||
(gdk_color_convert) (GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
const GdkColor *other)
|
||||
{
|
||||
gdk_color_convert (self, color_state, other);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_to_float:
|
||||
* @self: a `GdkColor`
|
||||
* @target: the color state to convert to
|
||||
* @values: the location to store the result in
|
||||
*
|
||||
* Converts a given `GdkColor to another color state
|
||||
* and stores the result in a `float[4]`.
|
||||
*/
|
||||
void
|
||||
(gdk_color_to_float) (const GdkColor *self,
|
||||
GdkColorState *target,
|
||||
float values[4])
|
||||
{
|
||||
gdk_color_to_float (self, target, values);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_from_rgba:
|
||||
* @self: the `GdkColor` to store the result in
|
||||
* @color_state: the target color state
|
||||
* @rgba: the `GdkRGBA` to convert
|
||||
*
|
||||
* Converts a given `GdkRGBA` to the target @color_state.
|
||||
*/
|
||||
void
|
||||
gdk_color_from_rgba (GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
GdkColor tmp = {
|
||||
.color_state = GDK_COLOR_STATE_SRGB,
|
||||
.r = rgba->red,
|
||||
.g = rgba->green,
|
||||
.b = rgba->blue,
|
||||
.a = rgba->alpha
|
||||
};
|
||||
|
||||
gdk_color_convert (self, color_state, &tmp);
|
||||
gdk_color_finish (&tmp);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_print:
|
||||
* @self: the `GdkColor` to print
|
||||
* @string: the string to print to
|
||||
*
|
||||
* Appends a representation of @self to @string.
|
||||
*
|
||||
* The representation is inspired by CSS3 colors,
|
||||
* but not 100% identical, and looks like this:
|
||||
*
|
||||
* color(NAME R G B / A)
|
||||
*
|
||||
* where `NAME` identifies color state, and
|
||||
* `R`, `G`, `B` and `A` are the components of the color.
|
||||
*
|
||||
* The alpha may be omitted if it is 1.
|
||||
*/
|
||||
void
|
||||
gdk_color_print (const GdkColor *self,
|
||||
GString *string)
|
||||
{
|
||||
if (gdk_color_state_equal (self->color_state, GDK_COLOR_STATE_SRGB))
|
||||
{
|
||||
gdk_rgba_print ((const GdkRGBA *) self->values, string);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_string_append_printf (string, "color(%s %g %g %g",
|
||||
gdk_color_state_get_name (self->color_state),
|
||||
self->r, self->g, self->b);
|
||||
if (self->a < 1)
|
||||
g_string_append_printf (string, " / %g", self->a);
|
||||
g_string_append_c (string, ')');
|
||||
}
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_color_print:
|
||||
* @self: the `GdkColor` to print
|
||||
*
|
||||
* Create a string representation of @self.
|
||||
*
|
||||
* See [method@Gdk.Color.print] for details about
|
||||
* the format.
|
||||
|
||||
* Returns: (transfer full): a newly-allocated string
|
||||
*/
|
||||
char *
|
||||
gdk_color_to_string (const GdkColor *self)
|
||||
{
|
||||
GString *string = g_string_new ("");
|
||||
gdk_color_print (self, string);
|
||||
return g_string_free (string, FALSE);
|
||||
}
|
||||
|
||||
|
285
gdk/gdkcolordefs.h
Normal file
285
gdk/gdkcolordefs.h
Normal file
@@ -0,0 +1,285 @@
|
||||
/* gdkcolordefs.h
|
||||
*
|
||||
* Copyright 2024 Matthias Clasen
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/* Note that this header is shared between the color state implementation
|
||||
* and tests, and must not include other headers.
|
||||
*/
|
||||
|
||||
#include <glib.h>
|
||||
#include <math.h>
|
||||
|
||||
static inline int
|
||||
sign (float v)
|
||||
{
|
||||
return v < 0 ? -1 : 1;
|
||||
}
|
||||
|
||||
static inline float
|
||||
srgb_oetf (float v)
|
||||
{
|
||||
if (fabsf (v) > 0.0031308f)
|
||||
return sign (v) * (1.055f * powf (fabsf (v), 1.f / 2.4f) - 0.055f);
|
||||
else
|
||||
return 12.92f * v;
|
||||
}
|
||||
|
||||
static inline float
|
||||
srgb_eotf (float v)
|
||||
{
|
||||
if (fabsf (v) >= 0.04045f)
|
||||
return sign (v) * powf (((fabsf (v) + 0.055f) / (1.f + 0.055f)), 2.4f);
|
||||
else
|
||||
return v / 12.92f;
|
||||
}
|
||||
|
||||
static inline float
|
||||
gamma22_oetf (float v)
|
||||
{
|
||||
return sign (v) * powf (fabsf (v), 1.f / 2.2f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
gamma22_eotf (float v)
|
||||
{
|
||||
return sign (v) * powf (fabsf (v), 2.2f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
gamma28_oetf (float v)
|
||||
{
|
||||
return sign (v) * powf (fabsf (v), 1.f / 2.8f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
gamma28_eotf (float v)
|
||||
{
|
||||
return sign (v) * powf (fabsf (v), 2.8f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
pq_eotf (float v)
|
||||
{
|
||||
float ninv = (1 << 14) / 2610.0;
|
||||
float minv = (1 << 5) / 2523.0;
|
||||
float c1 = 3424.0 / (1 << 12);
|
||||
float c2 = 2413.0 / (1 << 7);
|
||||
float c3 = 2392.0 / (1 << 7);
|
||||
|
||||
float x = powf (fabsf (v), minv);
|
||||
x = powf (MAX ((x - c1), 0) / (c2 - (c3 * x)), ninv);
|
||||
|
||||
return sign (v) * x * 10000 / 203.0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
pq_oetf (float v)
|
||||
{
|
||||
float x = v * 203.0 / 10000.0;
|
||||
float n = 2610.0 / (1 << 14);
|
||||
float m = 2523.0 / (1 << 5);
|
||||
float c1 = 3424.0 / (1 << 12);
|
||||
float c2 = 2413.0 / (1 << 7);
|
||||
float c3 = 2392.0 / (1 << 7);
|
||||
|
||||
x = powf (fabsf (x), n);
|
||||
return sign (v) * powf (((c1 + (c2 * x)) / (1 + (c3 * x))), m);
|
||||
}
|
||||
|
||||
static inline float
|
||||
bt709_eotf (float v)
|
||||
{
|
||||
const float a = 1.099;
|
||||
const float d = 0.0812;
|
||||
|
||||
if (fabsf (v) < d)
|
||||
return v / 4.5f;
|
||||
else
|
||||
return sign (v) * powf ((fabsf (v) + (a - 1)) / a, 1 / 0.45f);
|
||||
}
|
||||
|
||||
static inline float
|
||||
bt709_oetf (float v)
|
||||
{
|
||||
const float a = 1.099;
|
||||
const float b = 0.018;
|
||||
|
||||
if (fabsf (v) < b)
|
||||
return v * 4.5f;
|
||||
else
|
||||
return sign (v) * (a * powf (fabsf (v), 0.45f) - (a - 1));
|
||||
}
|
||||
|
||||
static inline float
|
||||
hlg_eotf (float v)
|
||||
{
|
||||
const float a = 0.17883277;
|
||||
const float b = 0.28466892;
|
||||
const float c = 0.55991073;
|
||||
|
||||
if (fabsf (v) <= 0.5)
|
||||
return sign (v) * (v * v) / 3;
|
||||
else
|
||||
return sign (v) * (expf ((fabsf (v) - c) / a) + b) / 12.0;
|
||||
}
|
||||
|
||||
static inline float
|
||||
hlg_oetf (float v)
|
||||
{
|
||||
const float a = 0.17883277;
|
||||
const float b = 0.28466892;
|
||||
const float c = 0.55991073;
|
||||
|
||||
if (fabsf (v) <= 1/12.0)
|
||||
return sign (v) * sqrtf (3 * fabsf (v));
|
||||
else
|
||||
return sign (v) * (a * logf (12 * fabsf (v) - b) + c);
|
||||
}
|
||||
|
||||
/* See http://www.brucelindbloom.com/index.html?Eqn_RGB_XYZ_Matrix.html
|
||||
* for how to derive the abc_to_xyz matrices from chromaticity coordinates.
|
||||
*/
|
||||
|
||||
static const float identity[9] = {
|
||||
1, 0, 0,
|
||||
0, 1, 0,
|
||||
0, 0, 1,
|
||||
};
|
||||
|
||||
static const float srgb_to_xyz[9] = {
|
||||
0.4124564, 0.3575761, 0.1804375,
|
||||
0.2126729, 0.7151522, 0.0721750,
|
||||
0.0193339, 0.1191920, 0.9503041,
|
||||
};
|
||||
|
||||
static const float xyz_to_srgb[9] = {
|
||||
3.2404542, -1.5371385, -0.4985314,
|
||||
-0.9692660, 1.8760108, 0.0415560,
|
||||
0.0556434, -0.2040259, 1.0572252,
|
||||
};
|
||||
|
||||
static const float rec2020_to_xyz[9] = {
|
||||
0.6369580, 0.1446169, 0.1688810,
|
||||
0.2627002, 0.6779981, 0.0593017,
|
||||
0.0000000, 0.0280727, 1.0609851,
|
||||
};
|
||||
|
||||
static const float xyz_to_rec2020[9] = {
|
||||
1.7166512, -0.3556708, -0.2533663,
|
||||
-0.6666844, 1.6164812, 0.0157685,
|
||||
0.0176399, -0.0427706, 0.9421031,
|
||||
};
|
||||
|
||||
static const float pal_to_xyz[9] = {
|
||||
0.4305538, 0.3415498, 0.1783523,
|
||||
0.2220043, 0.7066548, 0.0713409,
|
||||
0.0201822, 0.1295534, 0.9393222,
|
||||
};
|
||||
|
||||
static const float xyz_to_pal[9] = {
|
||||
3.0633611, -1.3933902, -0.4758237,
|
||||
-0.9692436, 1.8759675, 0.0415551,
|
||||
0.0678610, -0.2287993, 1.0690896,
|
||||
};
|
||||
|
||||
static const float ntsc_to_xyz[9] = {
|
||||
0.3935209, 0.3652581, 0.1916769,
|
||||
0.2123764, 0.7010599, 0.0865638,
|
||||
0.0187391, 0.1119339, 0.9583847,
|
||||
};
|
||||
|
||||
static const float xyz_to_ntsc[9] = {
|
||||
3.5060033, -1.7397907, -0.5440583,
|
||||
-1.0690476, 1.9777789, 0.0351714,
|
||||
0.0563066, -0.1969757, 1.0499523,
|
||||
};
|
||||
|
||||
static const float p3_to_xyz[9] = {
|
||||
0.4865709, 0.2656677, 0.1982173,
|
||||
0.2289746, 0.6917385, 0.0792869,
|
||||
0.0000000, 0.0451134, 1.0439444,
|
||||
};
|
||||
|
||||
static const float xyz_to_p3[9] = {
|
||||
2.4934969, -0.9313836, -0.4027108,
|
||||
-0.8294890, 1.7626641, 0.0236247,
|
||||
0.0358458, -0.0761724, 0.9568845,
|
||||
};
|
||||
|
||||
/* premultiplied matrices for default conversions */
|
||||
|
||||
static const float rec2020_to_srgb[9] = {
|
||||
1.660227, -0.587548, -0.072838,
|
||||
-0.124553, 1.132926, -0.008350,
|
||||
-0.018155, -0.100603, 1.118998,
|
||||
};
|
||||
|
||||
static const float srgb_to_rec2020[9] = {
|
||||
0.627504, 0.329275, 0.043303,
|
||||
0.069108, 0.919519, 0.011360,
|
||||
0.016394, 0.088011, 0.895380,
|
||||
};
|
||||
|
||||
/* oklab conversion */
|
||||
|
||||
static float
|
||||
from_oklab_nl (float v)
|
||||
{
|
||||
return v * v * v;
|
||||
}
|
||||
|
||||
static float
|
||||
to_oklab_nl (float v)
|
||||
{
|
||||
return cbrtf (v);
|
||||
}
|
||||
|
||||
static const float oklab_to_lms[9] = {
|
||||
1, 0.3963377774, 0.2158037573,
|
||||
1, -0.1055613458, -0.0638541728,
|
||||
1, -0.0894841775, -1.2914855480
|
||||
};
|
||||
|
||||
static const float lms_to_srgb[9] = {
|
||||
4.0767416621, -3.3077115913, 0.2309699292,
|
||||
-1.2684380046, 2.6097574011, -0.3413193965,
|
||||
-0.0041960863, -0.7034186147, 1.7076147010,
|
||||
};
|
||||
|
||||
static const float srgb_to_lms[9] = {
|
||||
0.4122214708, 0.5363325363, 0.0514459929,
|
||||
0.2119034982, 0.6806995451, 0.1073969566,
|
||||
0.0883024619, 0.2817188376, 0.6299787005,
|
||||
};
|
||||
|
||||
static const float lms_to_oklab[9] = {
|
||||
0.2104542553, 0.7936177850, -0.0040720468,
|
||||
1.9779984951, -2.4285922050, 0.4505937099,
|
||||
0.0259040371, 0.7827717662, -0.8086757660,
|
||||
};
|
||||
|
||||
static const float rec2020_to_lms[9] = {
|
||||
0.616645, 0.360250, 0.023064,
|
||||
0.265075, 0.635874, 0.099059,
|
||||
0.100076, 0.203907, 0.696161,
|
||||
};
|
||||
|
||||
static const float lms_to_rec2020[9] = {
|
||||
2.140325, -1.246734, 0.106491,
|
||||
-0.884665, 2.163141, -0.278489,
|
||||
-0.048559, -0.454366, 1.502711,
|
||||
};
|
133
gdk/gdkcolorimpl.h
Normal file
133
gdk/gdkcolorimpl.h
Normal file
@@ -0,0 +1,133 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* Copyright (C) 2021 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "gdkcolorprivate.h"
|
||||
|
||||
#include "gdkcolorstateprivate.h"
|
||||
|
||||
|
||||
#define gdk_color_init(...) _gdk_color_init (__VA_ARGS__)
|
||||
static inline void
|
||||
_gdk_color_init (GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
const float values[4])
|
||||
{
|
||||
self->color_state = gdk_color_state_ref (color_state);
|
||||
memcpy (self->values, values, sizeof (float) * 4);
|
||||
}
|
||||
|
||||
#define gdk_color_init_copy(self, color) _gdk_color_init_copy ((self), (color))
|
||||
static inline void
|
||||
_gdk_color_init_copy (GdkColor *self,
|
||||
const GdkColor *color)
|
||||
{
|
||||
_gdk_color_init (self, color->color_state, color->values);
|
||||
}
|
||||
|
||||
#define gdk_color_init_from_rgb(self, rgba) _gdk_color_init_from_rgba ((self), (rgba))
|
||||
static inline void
|
||||
_gdk_color_init_from_rgba (GdkColor *self,
|
||||
const GdkRGBA *rgba)
|
||||
{
|
||||
_gdk_color_init (self, GDK_COLOR_STATE_SRGB, (const float *) rgba);
|
||||
}
|
||||
|
||||
#define gdk_color_finish(self) _gdk_color_finish ((self))
|
||||
static inline void
|
||||
_gdk_color_finish (GdkColor *self)
|
||||
{
|
||||
gdk_color_state_unref (self->color_state);
|
||||
self->color_state = NULL;
|
||||
}
|
||||
|
||||
#define gdk_color_get_color_state(self) _gdk_color_get_color_state ((self))
|
||||
static inline GdkColorState *
|
||||
_gdk_color_get_color_state (const GdkColor *self)
|
||||
{
|
||||
return self->color_state;
|
||||
}
|
||||
|
||||
#define gdk_color_equal(self, other) _gdk_color_equal ((self), (other))
|
||||
static inline gboolean
|
||||
_gdk_color_equal (const GdkColor *self,
|
||||
const GdkColor *other)
|
||||
{
|
||||
return self->values[0] == other->values[0] &&
|
||||
self->values[1] == other->values[1] &&
|
||||
self->values[2] == other->values[2] &&
|
||||
self->values[3] == other->values[3] &&
|
||||
gdk_color_state_equal (self->color_state, other->color_state);
|
||||
}
|
||||
|
||||
#define gdk_color_is_clear(self) _gdk_color_is_clear ((self))
|
||||
static inline gboolean
|
||||
_gdk_color_is_clear (const GdkColor *self)
|
||||
{
|
||||
return self->alpha < (255.f / 65535.f);
|
||||
}
|
||||
|
||||
#define gdk_color_is_opaque(self) _gdk_color_is_opaque ((self))
|
||||
static inline gboolean
|
||||
_gdk_color_is_opaque (const GdkColor *self)
|
||||
{
|
||||
return self->alpha > (65280.f / 65535.f);
|
||||
}
|
||||
|
||||
#define gdk_color_convert(self, cs, other) _gdk_color_convert ((self), (cs), (other))
|
||||
static inline void
|
||||
_gdk_color_convert (GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
const GdkColor *other)
|
||||
{
|
||||
if (gdk_color_state_equal (color_state, other->color_state))
|
||||
{
|
||||
gdk_color_init_copy (self, other);
|
||||
return;
|
||||
}
|
||||
|
||||
self->color_state = gdk_color_state_ref (color_state);
|
||||
|
||||
gdk_color_state_convert_color (other->color_state,
|
||||
other->values,
|
||||
self->color_state,
|
||||
self->values);
|
||||
}
|
||||
|
||||
#define gdk_color_to_float(self, cs, values) _gdk_color_to_float ((self), (cs), (values))
|
||||
static inline void
|
||||
_gdk_color_to_float (const GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
float values[4])
|
||||
{
|
||||
if (gdk_color_state_equal (self->color_state, color_state))
|
||||
{
|
||||
values[0] = self->values[0];
|
||||
values[1] = self->values[1];
|
||||
values[2] = self->values[2];
|
||||
values[3] = self->values[3];
|
||||
return;
|
||||
}
|
||||
|
||||
gdk_color_state_convert_color (self->color_state,
|
||||
self->values,
|
||||
color_state,
|
||||
values);
|
||||
}
|
||||
|
106
gdk/gdkcolorprivate.h
Normal file
106
gdk/gdkcolorprivate.h
Normal file
@@ -0,0 +1,106 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
*
|
||||
* Copyright (C) 2021 Benjamin Otte
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkcolorstate.h>
|
||||
#include <gdk/gdkrgba.h>
|
||||
#include <gdk/gdkmemoryformatprivate.h>
|
||||
|
||||
|
||||
typedef struct _GdkColor GdkColor;
|
||||
|
||||
/* The interpretation of the first 3 components depends on the color state.
|
||||
* values[3] is always alpha.
|
||||
*/
|
||||
struct _GdkColor
|
||||
{
|
||||
GdkColorState *color_state;
|
||||
union {
|
||||
float values[4];
|
||||
struct {
|
||||
float r;
|
||||
float g;
|
||||
float b;
|
||||
float a;
|
||||
};
|
||||
struct {
|
||||
float red;
|
||||
float green;
|
||||
float blue;
|
||||
float alpha;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (GdkColor, r) == G_STRUCT_OFFSET (GdkColor, red));
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (GdkColor, g) == G_STRUCT_OFFSET (GdkColor, green));
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (GdkColor, b) == G_STRUCT_OFFSET (GdkColor, blue));
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (GdkColor, a) == G_STRUCT_OFFSET (GdkColor, alpha));
|
||||
|
||||
/* The committee notes that since all known implementations but one "get it right"
|
||||
* this may well not be a defect at all.
|
||||
* https://open-std.org/JTC1/SC22/WG14/www/docs/n2396.htm#dr_496
|
||||
*/
|
||||
#ifndef _MSC_VER
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (GdkColor, r) == G_STRUCT_OFFSET (GdkColor, values[0]));
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (GdkColor, g) == G_STRUCT_OFFSET (GdkColor, values[1]));
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (GdkColor, b) == G_STRUCT_OFFSET (GdkColor, values[2]));
|
||||
G_STATIC_ASSERT (G_STRUCT_OFFSET (GdkColor, a) == G_STRUCT_OFFSET (GdkColor, values[3]));
|
||||
#endif
|
||||
|
||||
#define GDK_COLOR_SRGB(r,g,b,a) (GdkColor) { \
|
||||
.color_state = GDK_COLOR_STATE_SRGB, \
|
||||
.values = { (r), (g), (b), (a) } \
|
||||
}
|
||||
|
||||
void gdk_color_init (GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
const float values[4]);
|
||||
void gdk_color_init_copy (GdkColor *self,
|
||||
const GdkColor *color);
|
||||
void gdk_color_init_from_rgba (GdkColor *self,
|
||||
const GdkRGBA *rgba);
|
||||
void gdk_color_finish (GdkColor *self);
|
||||
|
||||
gboolean gdk_color_equal (const GdkColor *self,
|
||||
const GdkColor *other);
|
||||
gboolean gdk_color_is_clear (const GdkColor *self);
|
||||
gboolean gdk_color_is_opaque (const GdkColor *self);
|
||||
|
||||
void gdk_color_convert (GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
const GdkColor *other);
|
||||
|
||||
void gdk_color_to_float (const GdkColor *self,
|
||||
GdkColorState *target,
|
||||
float values[4]);
|
||||
|
||||
void gdk_color_from_rgba (GdkColor *self,
|
||||
GdkColorState *color_state,
|
||||
const GdkRGBA *rgba);
|
||||
|
||||
void gdk_color_print (const GdkColor *self,
|
||||
GString *string);
|
||||
|
||||
char * gdk_color_to_string (const GdkColor *self);
|
||||
|
||||
#include "gdkcolorimpl.h"
|
||||
|
||||
G_END_DECLS
|
1048
gdk/gdkcolorstate.c
Normal file
1048
gdk/gdkcolorstate.c
Normal file
File diff suppressed because it is too large
Load Diff
68
gdk/gdkcolorstate.h
Normal file
68
gdk/gdkcolorstate.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/* gdkcolorstate.h
|
||||
*
|
||||
* Copyright 2024 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_COLOR_STATE (gdk_color_state_get_type ())
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GType gdk_color_state_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_ref (GdkColorState *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
void gdk_color_state_unref (GdkColorState *self);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_get_srgb (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_get_srgb_linear (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_get_rec2100_pq (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_get_rec2100_linear (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_get_oklab (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_color_state_get_oklch (void);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
gboolean gdk_color_state_equal (GdkColorState *self,
|
||||
GdkColorState *other);
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkCicpParams *gdk_color_state_create_cicp_params (GdkColorState *self);
|
||||
|
||||
|
||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GdkColorState, gdk_color_state_unref);
|
||||
|
||||
G_END_DECLS
|
230
gdk/gdkcolorstateprivate.h
Normal file
230
gdk/gdkcolorstateprivate.h
Normal file
@@ -0,0 +1,230 @@
|
||||
#pragma once
|
||||
|
||||
#include "gdkcolorstate.h"
|
||||
|
||||
#include "gdkcicpparamsprivate.h"
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
#include "gdkrgba.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_COLOR_STATE_ID_SRGB,
|
||||
GDK_COLOR_STATE_ID_SRGB_LINEAR,
|
||||
GDK_COLOR_STATE_ID_REC2100_PQ,
|
||||
GDK_COLOR_STATE_ID_REC2100_LINEAR,
|
||||
GDK_COLOR_STATE_ID_OKLAB,
|
||||
GDK_COLOR_STATE_ID_OKLCH,
|
||||
|
||||
GDK_COLOR_STATE_N_IDS
|
||||
} GdkColorStateId;
|
||||
|
||||
typedef struct _GdkColorStateClass GdkColorStateClass;
|
||||
|
||||
struct _GdkColorState
|
||||
{
|
||||
const GdkColorStateClass *klass;
|
||||
gatomicrefcount ref_count;
|
||||
|
||||
GdkMemoryDepth depth;
|
||||
GdkColorState *rendering_color_state;
|
||||
GdkColorState *rendering_color_state_linear;
|
||||
};
|
||||
|
||||
/* Note: self may be the source or the target colorstate */
|
||||
typedef void (* GdkFloatColorConvert)(GdkColorState *self,
|
||||
float (*values)[4],
|
||||
gsize n_values);
|
||||
|
||||
struct _GdkColorStateClass
|
||||
{
|
||||
void (* free) (GdkColorState *self);
|
||||
gboolean (* equal) (GdkColorState *self,
|
||||
GdkColorState *other);
|
||||
const char * (* get_name) (GdkColorState *self);
|
||||
GdkColorState * (* get_no_srgb_tf) (GdkColorState *self);
|
||||
GdkFloatColorConvert (* get_convert_to) (GdkColorState *self,
|
||||
GdkColorState *target);
|
||||
GdkFloatColorConvert (* get_convert_from) (GdkColorState *self,
|
||||
GdkColorState *source);
|
||||
const GdkCicp * (* get_cicp) (GdkColorState *self);
|
||||
void (* clamp) (GdkColorState *self,
|
||||
const float src[4],
|
||||
float dest[4]);
|
||||
};
|
||||
|
||||
typedef struct _GdkDefaultColorState GdkDefaultColorState;
|
||||
|
||||
struct _GdkDefaultColorState
|
||||
{
|
||||
GdkColorState parent;
|
||||
|
||||
const char *name;
|
||||
GdkColorState *no_srgb;
|
||||
GdkFloatColorConvert convert_to[GDK_COLOR_STATE_N_IDS];
|
||||
void (* clamp) (GdkColorState *self,
|
||||
const float src[4],
|
||||
float dest[4]);
|
||||
|
||||
GdkCicp cicp;
|
||||
};
|
||||
|
||||
extern GdkDefaultColorState gdk_default_color_states[GDK_COLOR_STATE_N_IDS];
|
||||
|
||||
#define GDK_COLOR_STATE_SRGB ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_SRGB])
|
||||
#define GDK_COLOR_STATE_SRGB_LINEAR ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_SRGB_LINEAR])
|
||||
#define GDK_COLOR_STATE_REC2100_PQ ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_REC2100_PQ])
|
||||
#define GDK_COLOR_STATE_REC2100_LINEAR ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_REC2100_LINEAR])
|
||||
#define GDK_COLOR_STATE_OKLAB ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_OKLAB])
|
||||
#define GDK_COLOR_STATE_OKLCH ((GdkColorState *) &gdk_default_color_states[GDK_COLOR_STATE_ID_OKLCH])
|
||||
|
||||
#define GDK_IS_DEFAULT_COLOR_STATE(c) ((GdkDefaultColorState *) (c) >= &gdk_default_color_states[0] && \
|
||||
(GdkDefaultColorState *) (c) < &gdk_default_color_states[GDK_COLOR_STATE_N_IDS])
|
||||
#define GDK_DEFAULT_COLOR_STATE_ID(c) ((GdkColorStateId) (((GdkDefaultColorState *) c) - gdk_default_color_states))
|
||||
|
||||
const char * gdk_color_state_get_name (GdkColorState *self);
|
||||
GdkColorState * gdk_color_state_get_no_srgb_tf (GdkColorState *self);
|
||||
|
||||
GdkColorState * gdk_color_state_new_for_cicp (const GdkCicp *cicp,
|
||||
GError **error);
|
||||
|
||||
void gdk_color_state_clamp (GdkColorState *self,
|
||||
const float src[4],
|
||||
float dest[4]);
|
||||
|
||||
static inline GdkColorState *
|
||||
gdk_color_state_get_rendering_color_state (GdkColorState *self)
|
||||
{
|
||||
if (GDK_DEBUG_CHECK (HDR))
|
||||
self = GDK_COLOR_STATE_REC2100_PQ;
|
||||
|
||||
if (!GDK_DEBUG_CHECK (LINEAR))
|
||||
return self->rendering_color_state;
|
||||
|
||||
return self->rendering_color_state_linear;
|
||||
}
|
||||
|
||||
static inline GdkMemoryDepth
|
||||
gdk_color_state_get_depth (GdkColorState *self)
|
||||
{
|
||||
if (!GDK_DEBUG_CHECK (LINEAR) && self->depth == GDK_MEMORY_U8_SRGB)
|
||||
return GDK_MEMORY_U8;
|
||||
|
||||
return self->depth;
|
||||
}
|
||||
|
||||
static inline GdkColorState *
|
||||
gdk_color_state_get_by_id (GdkColorStateId id)
|
||||
{
|
||||
return (GdkColorState *) &gdk_default_color_states[id];
|
||||
}
|
||||
|
||||
#define gdk_color_state_ref(self) _gdk_color_state_ref (self)
|
||||
static inline GdkColorState *
|
||||
_gdk_color_state_ref (GdkColorState *self)
|
||||
{
|
||||
if (GDK_IS_DEFAULT_COLOR_STATE (self))
|
||||
return self;
|
||||
|
||||
g_atomic_ref_count_inc (&self->ref_count);
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
#define gdk_color_state_unref(self) _gdk_color_state_unref (self)
|
||||
static inline void
|
||||
_gdk_color_state_unref (GdkColorState *self)
|
||||
{
|
||||
if (GDK_IS_DEFAULT_COLOR_STATE (self))
|
||||
return;
|
||||
|
||||
if (g_atomic_ref_count_dec (&self->ref_count))
|
||||
self->klass->free (self);
|
||||
}
|
||||
|
||||
#define gdk_color_state_equal(a,b) _gdk_color_state_equal ((a), (b))
|
||||
static inline gboolean
|
||||
_gdk_color_state_equal (GdkColorState *self,
|
||||
GdkColorState *other)
|
||||
{
|
||||
if (self == other)
|
||||
return TRUE;
|
||||
|
||||
if (self->klass != other->klass)
|
||||
return FALSE;
|
||||
|
||||
return self->klass->equal (self, other);
|
||||
}
|
||||
|
||||
/* Note: the functions returned from this expect the source
|
||||
* color state to be passed as self
|
||||
*/
|
||||
static inline GdkFloatColorConvert
|
||||
gdk_color_state_get_convert_to (GdkColorState *self,
|
||||
GdkColorState *target)
|
||||
{
|
||||
return self->klass->get_convert_to (self, target);
|
||||
}
|
||||
|
||||
/* Note: the functions returned from this expect the target
|
||||
* color state to be passed as self
|
||||
*/
|
||||
static inline GdkFloatColorConvert
|
||||
gdk_color_state_get_convert_from (GdkColorState *self,
|
||||
GdkColorState *source)
|
||||
{
|
||||
return self->klass->get_convert_from (self, source);
|
||||
}
|
||||
|
||||
static inline const GdkCicp *
|
||||
gdk_color_state_get_cicp (GdkColorState *self)
|
||||
{
|
||||
return self->klass->get_cicp (self);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_color_state_convert_color (GdkColorState *src_cs,
|
||||
const float src[4],
|
||||
GdkColorState *dest_cs,
|
||||
float dest[4])
|
||||
{
|
||||
GdkFloatColorConvert convert = NULL;
|
||||
GdkFloatColorConvert convert2 = NULL;
|
||||
|
||||
dest[0] = src[0];
|
||||
dest[1] = src[1];
|
||||
dest[2] = src[2];
|
||||
dest[3] = src[3];
|
||||
|
||||
if (gdk_color_state_equal (src_cs, dest_cs))
|
||||
return;
|
||||
|
||||
convert = gdk_color_state_get_convert_to (src_cs, dest_cs);
|
||||
|
||||
if (!convert)
|
||||
convert2 = gdk_color_state_get_convert_from (dest_cs, src_cs);
|
||||
|
||||
if (!convert && !convert2)
|
||||
{
|
||||
GdkColorState *connection = GDK_COLOR_STATE_REC2100_LINEAR;
|
||||
convert = gdk_color_state_get_convert_to (src_cs, connection);
|
||||
convert2 = gdk_color_state_get_convert_from (dest_cs, connection);
|
||||
}
|
||||
|
||||
if (convert)
|
||||
convert (src_cs, (float(*)[4]) dest, 1);
|
||||
|
||||
if (convert2)
|
||||
convert2 (dest_cs, (float(*)[4]) dest, 1);
|
||||
}
|
||||
|
||||
static inline void
|
||||
gdk_color_state_from_rgba (GdkColorState *self,
|
||||
const GdkRGBA *rgba,
|
||||
float out_color[4])
|
||||
{
|
||||
gdk_color_state_convert_color (GDK_COLOR_STATE_SRGB,
|
||||
(const float *) rgba,
|
||||
self,
|
||||
out_color);
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user