Compare commits
730 Commits
offload-li
...
linear-com
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f8076a085 | ||
|
|
ca6fe07b27 | ||
|
|
bdb6552408 | ||
|
|
7626f8262d | ||
|
|
05e470f2cd | ||
|
|
c5883853d7 | ||
|
|
2250761474 | ||
|
|
d35df199b0 | ||
|
|
87f9c26414 | ||
|
|
d2cc2b6ea8 | ||
|
|
f73a34e71a | ||
|
|
b5f5e6e34b | ||
|
|
7f71443d6b | ||
|
|
bb130960e2 | ||
|
|
0ebc7660a2 | ||
|
|
fe885d9f41 | ||
|
|
3076cd9a47 | ||
|
|
b710e72e1e | ||
|
|
c6bb894507 | ||
|
|
a6351ea8be | ||
|
|
68e132d2c0 | ||
|
|
dd79dd0a52 | ||
|
|
f7ff943d08 | ||
|
|
6f37b64e4c | ||
|
|
7f7b104438 | ||
|
|
c76a22224b | ||
|
|
531ca56a20 | ||
|
|
5eaba3b123 | ||
|
|
d697cce5b0 | ||
|
|
ccc646dda7 | ||
|
|
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 | ||
|
|
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 | ||
|
|
1080822ffa | ||
|
|
3fef45683c | ||
|
|
cfcc5c5c0b | ||
|
|
856f1808de | ||
|
|
4341344545 | ||
|
|
20392e8840 | ||
|
|
426fefff81 | ||
|
|
13013053f7 | ||
|
|
62b9a4af75 | ||
|
|
76caf2c812 | ||
|
|
3d5fce1b9f | ||
|
|
bfe8adbee4 | ||
|
|
827642303c | ||
|
|
6b6a0e1257 | ||
|
|
7a98176a02 | ||
|
|
a93a986ef2 | ||
|
|
39dbc5ea87 | ||
|
|
cf4d13bee3 | ||
|
|
0bacde8e0a | ||
|
|
949cd45bb7 | ||
|
|
2e9e216641 | ||
|
|
1ab8ffaceb | ||
|
|
3cc1726856 | ||
|
|
30eaa2c3cc | ||
|
|
ba5993195a | ||
|
|
bf42351ebf | ||
|
|
ee277f4d92 | ||
|
|
00acc7957f | ||
|
|
a931335f24 | ||
|
|
1ef320a9ec | ||
|
|
411b7f12b5 | ||
|
|
611fcfb1c7 | ||
|
|
6257a51f4f | ||
|
|
e24630bd18 | ||
|
|
6b0b3a4db7 | ||
|
|
fd19c7c2ab | ||
|
|
4aa2206699 | ||
|
|
eae23ebf69 | ||
|
|
ecd27f6c3c | ||
|
|
01f3c72338 | ||
|
|
87be414c05 | ||
|
|
f6d676cc8a | ||
|
|
4961241f26 | ||
|
|
60c944bb94 | ||
|
|
740c10282f | ||
|
|
3a4c69f370 | ||
|
|
c3083572fb | ||
|
|
8ecb00be66 | ||
|
|
48e707aceb | ||
|
|
e2f9ff2304 | ||
|
|
fa3a72c8f6 | ||
|
|
fc45d90834 | ||
|
|
fcd95cd5c6 | ||
|
|
b8c1ac41d2 | ||
|
|
90e1ce0906 | ||
|
|
d121fd5b7d | ||
|
|
4d88fcc1db | ||
|
|
85fcda178e | ||
|
|
ecc678454b | ||
|
|
5a85bc691e | ||
|
|
d506a5eea8 | ||
|
|
aefa79413b | ||
|
|
73e4eb7552 | ||
|
|
dff340530a | ||
|
|
f6ea3e1684 | ||
|
|
f790441505 | ||
|
|
0c307f7563 | ||
|
|
f89dc9644c | ||
|
|
735455b523 | ||
|
|
d037cfaf44 | ||
|
|
293d63425a | ||
|
|
38f9bb87bc | ||
|
|
64abadb370 | ||
|
|
6f85827fcb | ||
|
|
b0e321cfb8 | ||
|
|
46d0569365 | ||
|
|
2eea911a0f | ||
|
|
ee4a817121 | ||
|
|
3d1f914271 | ||
|
|
7bb0639a75 | ||
|
|
f8f38aab63 | ||
|
|
75c2bd53aa | ||
|
|
83921750ae | ||
|
|
413512eba7 | ||
|
|
e824764dc3 | ||
|
|
61b12abdab | ||
|
|
07bd5c7b05 | ||
|
|
1dc20eda28 | ||
|
|
5a9299f626 | ||
|
|
9c86c67f06 | ||
|
|
e6ca7668be | ||
|
|
0b540b9ad1 | ||
|
|
514cdf7398 | ||
|
|
2ab52d73ab | ||
|
|
b3ae172c1e | ||
|
|
a6d1df66ec | ||
|
|
ba92ce342e | ||
|
|
9f4c715516 | ||
|
|
5aa47b6e45 | ||
|
|
3b40d95581 | ||
|
|
3ad2d91e1c | ||
|
|
d4c586e882 | ||
|
|
612c547ed3 | ||
|
|
1a777ce7f3 | ||
|
|
7ec4f6e297 | ||
|
|
afaa0f3afd | ||
|
|
8841a002ed | ||
|
|
6da606aaad | ||
|
|
51bd155670 | ||
|
|
8fa16ec1cc | ||
|
|
04e5a0006d | ||
|
|
a1d2169992 | ||
|
|
778976f8da | ||
|
|
f81dea58a2 | ||
|
|
e82606a538 | ||
|
|
fe5b28f5b8 | ||
|
|
82fd0d7eef | ||
|
|
16761fcb49 | ||
|
|
4fac5680fb | ||
|
|
4ec4280e51 | ||
|
|
15bb77472d | ||
|
|
5c92d5e081 | ||
|
|
1626c5f1e7 | ||
|
|
3b5f0ed05e | ||
|
|
d2298f1c8f | ||
|
|
085062ab89 | ||
|
|
9741082467 | ||
|
|
3db4a05493 | ||
|
|
e3b9df2cec | ||
|
|
4a4e445a35 | ||
|
|
db0f9b60ac | ||
|
|
d51de390ba | ||
|
|
c14e167a11 | ||
|
|
2837a85461 | ||
|
|
282510e113 | ||
|
|
accabe3eee | ||
|
|
9dbdbaca43 | ||
|
|
5935bc95b7 | ||
|
|
4c677e4dcd | ||
|
|
d4c25c9ec0 | ||
|
|
b69df2bc4d | ||
|
|
7f9363d471 | ||
|
|
01d86eab66 | ||
|
|
09e85aa809 | ||
|
|
d49816d2e6 | ||
|
|
59a00d6768 | ||
|
|
6bd6c6acba | ||
|
|
be2ff60787 | ||
|
|
070b9a87b6 | ||
|
|
ecbe6a421e | ||
|
|
317e68a58c | ||
|
|
9b42377347 | ||
|
|
7372a845fb | ||
|
|
cf8c3be030 | ||
|
|
4eb715cf81 | ||
|
|
d4899fdf1f | ||
|
|
4142c4d79e | ||
|
|
ca442f8641 | ||
|
|
3c1491423a | ||
|
|
eb4993d3fb | ||
|
|
aa057da1ca | ||
|
|
1de09d59fb | ||
|
|
130a6fe0cf | ||
|
|
e1f7c027d7 | ||
|
|
396ef5ebe5 | ||
|
|
840a20db3b | ||
|
|
8c6f7d1ae9 | ||
|
|
c69fa6221b | ||
|
|
3c92c81705 | ||
|
|
297de981c4 | ||
|
|
53beb054b6 | ||
|
|
0431492284 | ||
|
|
aed9cc1874 | ||
|
|
c15804d124 | ||
|
|
1bd208d937 | ||
|
|
b70bcd6bfe | ||
|
|
74a1d45238 | ||
|
|
3ada35460d | ||
|
|
1f133c3d64 | ||
|
|
4440ce874e | ||
|
|
db302df82a | ||
|
|
b550b58e8f | ||
|
|
ed889b951b | ||
|
|
b603479fe2 | ||
|
|
7c39b2cea3 | ||
|
|
b1bce7a62b | ||
|
|
fa73e17fba | ||
|
|
dee2150a04 | ||
|
|
f647fc3fe2 | ||
|
|
6bae80c331 | ||
|
|
2aeb80f490 | ||
|
|
8a2f434443 | ||
|
|
d4134430fc | ||
|
|
73f64971c8 | ||
|
|
ecc2c953e5 | ||
|
|
e353117937 | ||
|
|
492ae6df35 | ||
|
|
a19d0471e9 | ||
|
|
5b5ba36999 | ||
|
|
89b64cbf47 | ||
|
|
e65d1f2122 | ||
|
|
2756496d47 | ||
|
|
8b653f21cc | ||
|
|
4e6759a126 | ||
|
|
d20e0b0370 | ||
|
|
ed8255993f | ||
|
|
f5d69fa0c5 | ||
|
|
e1431f31c1 | ||
|
|
f191fc0047 | ||
|
|
b60c60f03b | ||
|
|
af0c277bba | ||
|
|
88203fbf4d | ||
|
|
970c9eef63 | ||
|
|
2439876bd3 | ||
|
|
97582ae9ad | ||
|
|
a5b85f0dc5 | ||
|
|
aefb16510b | ||
|
|
4360d433b5 | ||
|
|
5927319589 | ||
|
|
25db645f65 | ||
|
|
b3c6a98132 | ||
|
|
031109aec3 | ||
|
|
18d2f9c8a4 | ||
|
|
0ae721f144 | ||
|
|
7898d1b46d | ||
|
|
3648398f6d | ||
|
|
019916c5b9 | ||
|
|
ebb31590ae | ||
|
|
32ea1cf32d | ||
|
|
172cdf8e21 | ||
|
|
dc07bcf3a3 | ||
|
|
bd96c10563 | ||
|
|
76299396cf | ||
|
|
a96dd2ad0a | ||
|
|
1e210e83bb | ||
|
|
14f1a91bff | ||
|
|
3f2bcdf82e | ||
|
|
c61d8bc188 | ||
|
|
4e5976427b | ||
|
|
7fcdb0205f | ||
|
|
4814c5f653 | ||
|
|
eb24e3548f | ||
|
|
87f0f374a9 | ||
|
|
0cd95951e6 | ||
|
|
c45815c217 | ||
|
|
b914869715 | ||
|
|
ff5699e097 | ||
|
|
8846f85874 | ||
|
|
fc1c6cfb1a | ||
|
|
77028362ab | ||
|
|
496aee5b02 | ||
|
|
b2fb624496 | ||
|
|
f2ef5d85ea | ||
|
|
7eca32edf0 | ||
|
|
7775bcf2fb | ||
|
|
ed35f6f8b8 | ||
|
|
307942e1f7 | ||
|
|
92b7231168 | ||
|
|
14d7eb97d2 | ||
|
|
fed1c3d3fc | ||
|
|
e1ac97a185 | ||
|
|
08a48dd97e | ||
|
|
50df3ebb46 | ||
|
|
df77f22740 | ||
|
|
2437a551ec | ||
|
|
46ab71fc8a | ||
|
|
f922ff8597 | ||
|
|
690c06109e | ||
|
|
94505987fe | ||
|
|
c6d7b704cb | ||
|
|
349509c332 | ||
|
|
84fd420271 | ||
|
|
0c40defaf1 | ||
|
|
cda1733fc7 | ||
|
|
0ee851c8c7 | ||
|
|
d665274eb1 | ||
|
|
ed3b73871f | ||
|
|
e570eb4f86 | ||
|
|
81b6251073 | ||
|
|
cfaf619620 | ||
|
|
de5b6764bc | ||
|
|
bc17dfa83d | ||
|
|
84a98f74c1 | ||
|
|
50facedc47 | ||
|
|
32a4f805b8 | ||
|
|
200cacc3ad | ||
|
|
eed3cab29f | ||
|
|
76b0687467 | ||
|
|
5039dc40f8 | ||
|
|
7c3de4a2da | ||
|
|
b486e9b760 | ||
|
|
ce2fd8a0d0 | ||
|
|
99b1b26fdb | ||
|
|
b7e4bbaf74 | ||
|
|
f579b171a9 | ||
|
|
f9929d15eb | ||
|
|
c45a6ad52d | ||
|
|
7233e38aa8 | ||
|
|
73ba97acd9 | ||
|
|
7d2ad604d2 | ||
|
|
45e64b915c | ||
|
|
ebaef9f18b | ||
|
|
c73fe8ac4a | ||
|
|
8ed8f883d1 | ||
|
|
032a5afc20 | ||
|
|
0064500146 | ||
|
|
4582ddcad9 | ||
|
|
8bb2720494 | ||
|
|
3b8218a99e | ||
|
|
9a8fa8dd82 | ||
|
|
d6892c85dc | ||
|
|
d3c20c3269 | ||
|
|
9904259661 | ||
|
|
a8fcde11de | ||
|
|
d2d4cd64cd | ||
|
|
2c7e68d98f | ||
|
|
6f42f8ef2c | ||
|
|
152dd70cde | ||
|
|
8ec1045c87 | ||
|
|
46866b8a66 | ||
|
|
9df6f802f2 | ||
|
|
ad8613876c | ||
|
|
1bbca0cd25 | ||
|
|
83784c17a3 | ||
|
|
3f46d0f2fa | ||
|
|
ef1ff8313f | ||
|
|
119a07e055 | ||
|
|
abfd94d2d9 | ||
|
|
6022fbcdf8 | ||
|
|
744016e768 | ||
|
|
d39f50a4ee | ||
|
|
c23d3c4406 | ||
|
|
1e2eae4ddf | ||
|
|
77eb3df7c0 | ||
|
|
e540022869 | ||
|
|
e6700405c9 | ||
|
|
5bbd8e12fa | ||
|
|
8b59771cd1 | ||
|
|
8a0a08e4ce | ||
|
|
bef6352401 | ||
|
|
60a43ddce0 | ||
|
|
90c9e88ee9 | ||
|
|
d860bf95ab | ||
|
|
a3bd0a3e17 | ||
|
|
d274c7df06 | ||
|
|
9a5f482e1a | ||
|
|
2f6140c066 | ||
|
|
9ce4471527 | ||
|
|
cda4ec48b2 | ||
|
|
d9582c123e | ||
|
|
4d30aacb0c | ||
|
|
4862c3f779 | ||
|
|
08d1353cde | ||
|
|
585dadf575 | ||
|
|
d069eb173a | ||
|
|
6015560b63 | ||
|
|
5a776389d7 | ||
|
|
6c2dfed5a5 | ||
|
|
7dec24c2cc | ||
|
|
c20e7a0c5d | ||
|
|
719021e1f4 | ||
|
|
4856e115a9 | ||
|
|
bfb5bbe862 | ||
|
|
b98c86fb7b | ||
|
|
e01c3f581e | ||
|
|
c45199e388 | ||
|
|
27fb9917d8 | ||
|
|
b5d6613a3f | ||
|
|
5dc77edbe3 | ||
|
|
a3d63b3579 | ||
|
|
57c12a8661 | ||
|
|
f1ccb9b81a | ||
|
|
2711cb8dcd | ||
|
|
c79925bd4a | ||
|
|
05d5860dc0 | ||
|
|
a1fdf06d80 | ||
|
|
36d7ca058e | ||
|
|
2e08db91ca | ||
|
|
2c9b47ff3c | ||
|
|
62ad1a61dc | ||
|
|
3fc9de7539 | ||
|
|
1c9a55d185 | ||
|
|
492940205e | ||
|
|
985e4906c8 | ||
|
|
e9dcf8167c | ||
|
|
3aa6c27c26 | ||
|
|
f537a55b71 | ||
|
|
7075e6be89 | ||
|
|
54a86a2a7e | ||
|
|
016354b6dd | ||
|
|
1dfc6d65df | ||
|
|
b7d0295481 | ||
|
|
a2854af325 | ||
|
|
320496b039 | ||
|
|
b0450d4b1b | ||
|
|
91ff8bf336 | ||
|
|
7b145f72dc | ||
|
|
0dcc21b605 | ||
|
|
bd43a9e868 | ||
|
|
9bf23d80a1 | ||
|
|
38fd66dc04 | ||
|
|
f004f14b89 | ||
|
|
8f15f6959c | ||
|
|
f26efd9adf | ||
|
|
3f342d75b2 | ||
|
|
3ab189404e | ||
|
|
48fc8d6606 | ||
|
|
2e0f411de9 | ||
|
|
f08e36e225 | ||
|
|
9f358ac655 | ||
|
|
33d1349e53 | ||
|
|
6b2b6ceb74 | ||
|
|
76421847a5 | ||
|
|
840cd6e44c | ||
|
|
f81038e99a | ||
|
|
007e7c68dc | ||
|
|
e5e147ad53 | ||
|
|
58e00040e0 | ||
|
|
5d1b8399fb | ||
|
|
deec2b6c6c | ||
|
|
246eb8ea25 | ||
|
|
815df9a76a | ||
|
|
f896dddadc | ||
|
|
d733e94a8b | ||
|
|
59db0ca328 | ||
|
|
3bd97590a1 | ||
|
|
722a0fa36d | ||
|
|
b21708c5e4 | ||
|
|
b5fb584316 | ||
|
|
fd1e1b9b7c | ||
|
|
c0caae0ff0 | ||
|
|
5c972e4786 | ||
|
|
1a3c5cf420 | ||
|
|
eb7affd911 | ||
|
|
a05dbff2c9 | ||
|
|
4b0d17b332 | ||
|
|
2d8f677e63 | ||
|
|
b5c9b6aa25 | ||
|
|
86924c2f9a | ||
|
|
af0f5e3f30 | ||
|
|
9e6c72210d | ||
|
|
ce0b2d6953 | ||
|
|
d1bb3f66ac | ||
|
|
70cd0e28ab | ||
|
|
2e00bcc580 | ||
|
|
db68c1f2c6 | ||
|
|
e3fa60a070 | ||
|
|
c9c29d8bde | ||
|
|
cd59d62947 | ||
|
|
4f4fe4ef44 | ||
|
|
06f83847c6 | ||
|
|
941b5c2aeb | ||
|
|
d661b7f258 | ||
|
|
f86d996d58 | ||
|
|
fe3031fb99 | ||
|
|
4b001a24db | ||
|
|
4727fea631 | ||
|
|
7ff4cba624 | ||
|
|
0363cc83b9 | ||
|
|
c1327e2c1b | ||
|
|
9971707544 | ||
|
|
02115912aa | ||
|
|
e29571e6a6 | ||
|
|
582ad79088 | ||
|
|
3fac42fd3c | ||
|
|
8f0b38b462 | ||
|
|
6c5a106d7e | ||
|
|
5f7cab4632 | ||
|
|
558db5a3a7 | ||
|
|
bc94b4f235 | ||
|
|
4c809281b2 | ||
|
|
81faf7caa3 | ||
|
|
7477e8626d | ||
|
|
47f30d208c | ||
|
|
74a1c0916a | ||
|
|
06351844bb | ||
|
|
ee67edbe3a | ||
|
|
ec9cdb74ef | ||
|
|
ad0f9144ec | ||
|
|
3e8215a971 | ||
|
|
8df7487e2a | ||
|
|
633692b53e | ||
|
|
e0a5c65003 | ||
|
|
e4753791c0 | ||
|
|
a57f7e3935 | ||
|
|
8de5a94eb7 | ||
|
|
88872d1986 | ||
|
|
ab33b56ec9 | ||
|
|
c37e88d561 | ||
|
|
2638700435 | ||
|
|
0a5a720fe1 | ||
|
|
0e5f7601e4 | ||
|
|
e583e823b5 | ||
|
|
a96358046f | ||
|
|
40f26ea09b | ||
|
|
71a7f0771b | ||
|
|
00739718ab | ||
|
|
19881c8c06 | ||
|
|
8b0aae8536 | ||
|
|
fbe000734a | ||
|
|
0c67b367ac | ||
|
|
f75b4aac1d | ||
|
|
d563d158c0 | ||
|
|
5c892fa4ea | ||
|
|
4aac64edf0 | ||
|
|
c97bbfdfb1 | ||
|
|
a44598772d | ||
|
|
933a0e5a98 | ||
|
|
e33e9c506d | ||
|
|
0108a5f56d | ||
|
|
c995473407 | ||
|
|
3f9bdaa4c8 | ||
|
|
a70998aa50 | ||
|
|
0fb1f44eec | ||
|
|
26cc96bb7f | ||
|
|
1c8b22cf05 | ||
|
|
abbbd08931 | ||
|
|
587cf28dd3 | ||
|
|
53231a137c | ||
|
|
104a264d8b | ||
|
|
75fd582b97 | ||
|
|
89977412e9 | ||
|
|
ce030b1b36 | ||
|
|
6c5dc8cd1f | ||
|
|
fb4b38e5ea | ||
|
|
fc405f8882 | ||
|
|
afe61e28e0 | ||
|
|
4f3f3c9ae2 | ||
|
|
e699685003 | ||
|
|
9583195e96 | ||
|
|
a526f0770e | ||
|
|
707e492f0d | ||
|
|
680dba6524 | ||
|
|
d1bb1d091c | ||
|
|
6510b876d1 | ||
|
|
e376941e49 | ||
|
|
4889199b14 | ||
|
|
2e15225446 | ||
|
|
9dad71513c | ||
|
|
ed072b4b5d | ||
|
|
7ffc4e0a21 | ||
|
|
b9403f4f5b | ||
|
|
9f1aa3141b | ||
|
|
06e905f87d | ||
|
|
2ba8dcebff | ||
|
|
95a8def7c2 | ||
|
|
777799070d | ||
|
|
0f83a9550b | ||
|
|
17f2443350 | ||
|
|
6bfc995097 | ||
|
|
8068111c6e | ||
|
|
6e1c47b021 | ||
|
|
aed4ced032 | ||
|
|
96160ea5dc | ||
|
|
c76c07ddfe | ||
|
|
7b82dc7ac5 | ||
|
|
a63e9d38fb | ||
|
|
cc8db1805d | ||
|
|
948532f3c9 | ||
|
|
8f39f8d827 | ||
|
|
5e28c05121 | ||
|
|
32d15a5858 | ||
|
|
c0b813940e | ||
|
|
d90dc7f75e | ||
|
|
3c94e91e5e | ||
|
|
8a1bee1d79 | ||
|
|
9297439de4 | ||
|
|
bcf78aeb39 | ||
|
|
02cdb36421 | ||
|
|
b3d4d70bc1 | ||
|
|
715c0bfc0a |
@@ -445,9 +445,8 @@ reference:
|
||||
--force-fallback-for=gdk-pixbuf,pango
|
||||
-Dintrospection=enabled
|
||||
-Ddocumentation=true
|
||||
-Dgtk_doc=true
|
||||
-Dgdk-pixbuf:gtk_doc=true
|
||||
-Dpango:gtk_doc=true
|
||||
-Dpango:documentation=true
|
||||
-Dbuild-demos=false
|
||||
-Dbuild-examples=false
|
||||
-Dbuild-tests=false
|
||||
@@ -460,6 +459,7 @@ reference:
|
||||
- mv _build/docs/reference/gdk/gdk4-wayland/ _reference/gdk4-wayland/
|
||||
- mv _build/docs/reference/gsk/gsk4/ _reference/gsk4/
|
||||
- mv _build/docs/reference/gtk/gtk4/ _reference/gtk4/
|
||||
- mv _build/docs/reference/gtk/*.html _reference/gtk4/
|
||||
- mv _build/subprojects/pango/docs/Pango/ _reference/Pango/
|
||||
- mv _build/subprojects/pango/docs/PangoCairo/ _reference/PangoCairo/
|
||||
- mv _build/subprojects/pango/docs/PangoFc/ _reference/PangoFc/
|
||||
|
||||
@@ -24,7 +24,7 @@ flatpak build ${builddir} meson \
|
||||
-Dbuild-examples=false \
|
||||
-Dintrospection=disabled \
|
||||
-Dbuild-demos=true \
|
||||
-Ddemo-profile=devel \
|
||||
-Dprofile=devel \
|
||||
_flatpak_build
|
||||
|
||||
flatpak build --env=CI_COMMIT_SHORT_SHA=$CI_COMMIT_SHORT_SHA ${builddir} ninja -C _flatpak_build install
|
||||
|
||||
@@ -35,7 +35,7 @@ The issue tracker is meant to be used for actionable issues only.
|
||||
|
||||
You should not open a new issue for security related questions.
|
||||
|
||||
When in doubt, follow [security](https://security.gnome.org/).
|
||||
When in doubt, follow the process for [GNOME security issues](https://security.gnome.org/).
|
||||
|
||||
### Bug reports
|
||||
|
||||
@@ -144,33 +144,28 @@ $ git clone https://gitlab.gnome.org/yourusername/gtk.git
|
||||
$ cd gtk
|
||||
```
|
||||
|
||||
**Note**: if you plan to push changes to back to the main repository and
|
||||
have a GNOME account, you can skip the fork, and use the following instead:
|
||||
|
||||
```sh
|
||||
$ git clone git@gitlab.gnome.org:GNOME/gtk.git
|
||||
$ cd gtk
|
||||
```
|
||||
|
||||
To compile the Git version of GTK on your system, you will need to
|
||||
configure your build using Meson:
|
||||
|
||||
```sh
|
||||
$ meson _builddir .
|
||||
$ cd _builddir
|
||||
$ ninja
|
||||
$ meson setup _builddir .
|
||||
$ meson compile -C _builddir
|
||||
```
|
||||
|
||||
Typically, you should work on your own branch:
|
||||
|
||||
```sh
|
||||
$ git checkout -b your-branch
|
||||
$ git switch -C your-branch
|
||||
```
|
||||
|
||||
Once you've finished working on the bug fix or feature, push the branch
|
||||
to the Git repository and open a new merge request, to let the GTK
|
||||
maintainers review your contribution.
|
||||
|
||||
**Important**: Do **not** attach a diff or a patch file to a GitLab issue.
|
||||
Patches cannot be reviewed, and do not not go through the CI pipeline. If
|
||||
you wish to submit your changes to GTK, always use a merge request.
|
||||
|
||||
### Code reviews
|
||||
|
||||
Each contribution is reviewed by the core developers of the GTK project.
|
||||
@@ -262,4 +257,4 @@ people committing to GTK to follow a few rules:
|
||||
|
||||
If you have been contributing to GTK for a while and you don't have commit
|
||||
access to the repository, you may ask to obtain it following the [GNOME account
|
||||
process](https://wiki.gnome.org/AccountsTeam/NewAccounts).
|
||||
process](https://handbook.gnome.org/infrastructure/developer-access.html).
|
||||
|
||||
210
NEWS
210
NEWS
@@ -1,6 +1,214 @@
|
||||
Overview of Changes in 4.15.0, xx-xx-xxxx
|
||||
Overview of Changes in 4.15.2, xx-xx-xxxx
|
||||
=========================================
|
||||
|
||||
* GtkFileChooserWidget:
|
||||
- Plug some memory leaks
|
||||
- Make Ctrl-Shift-N create a new folder
|
||||
|
||||
* 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/)
|
||||
|
||||
* Accessibility:
|
||||
- Avoid markup when reading labels
|
||||
|
||||
* GSK:
|
||||
- Subset fonts when serializing node trees
|
||||
|
||||
* Wayland:
|
||||
- Use xdg-dialog protocol for attached dialogs
|
||||
|
||||
* Windows:
|
||||
- Build with UNICODE
|
||||
|
||||
* Debugging:
|
||||
- Add GTK_DEBUG=css for warning about deprecated css syntax
|
||||
|
||||
* Tools:
|
||||
- nodeparser: Add an extract command for data urls
|
||||
|
||||
* Deprecations:
|
||||
- CSS Color functions shade(), lighter(), darker(), alpha(), mix()
|
||||
|
||||
* Translation updates:
|
||||
Hebrew
|
||||
|
||||
|
||||
Overview of Changes in 4.15.1, 21-05-2024
|
||||
=========================================
|
||||
|
||||
* GtkGraphicsOffload:
|
||||
- Don't crash without a child
|
||||
|
||||
* GtkSpinner:
|
||||
- Don't animate when unmapped
|
||||
|
||||
* CSS:
|
||||
- Support the :root selector
|
||||
- Support variables and custom properties (https://www.w3.org/TR/css-variables-1/)
|
||||
- Implement math functions (https://www.w3.org/TR/css-values-4/)
|
||||
- Support modern syntax and calc in rgb() and hsl()
|
||||
|
||||
* Icontheme:
|
||||
- Make symbolic svg loading more efficient
|
||||
- Handle color-free symbolics more efficiently
|
||||
|
||||
* Accessibility:
|
||||
- Make the gtk-demo sidebar search more accessible
|
||||
- Stop emitting focus events
|
||||
- Realize child contexts when necessary
|
||||
|
||||
* GDK:
|
||||
- Support XDG_ACTIVATION_TOKEN
|
||||
- dmabuf: Be more defensive when importing unknown formats to GL
|
||||
- dmabuf: Use narrow range for YUV
|
||||
- vulkan: Recreate swapchains when necessary or beneficial
|
||||
|
||||
* GSK:
|
||||
- Improve logging for GDK_DEBUG=offload
|
||||
- Improve logging for GSK_DEBUG=renderer
|
||||
- gpu: Warn about inefficient texture import
|
||||
- gpu: Handle tiny offscreens correctly
|
||||
- vulkan: Add profiler marks in various places
|
||||
- vulkan: Fix a problem with imported dmabufs showing up black
|
||||
- cairo: Speed up mask nodes, since we use them for symbolic icons
|
||||
|
||||
* Wayland:
|
||||
- Use wl_compositor version 6
|
||||
|
||||
* X11:
|
||||
- Implement a missing method
|
||||
|
||||
* Build:
|
||||
- Fix many ubsan warnings
|
||||
|
||||
* Debugging:
|
||||
- Show more texture details in the recorder
|
||||
- Use GTK_DEBUG=css to see CSS deprecations
|
||||
|
||||
* macOS:
|
||||
- Fix problems with events handed back to the OS
|
||||
- Respect GDK_DEBUG=default-settings
|
||||
- Allow applictions to handle Dock > Quit
|
||||
|
||||
* Deprecations:
|
||||
- Use of @name colors in CSS
|
||||
|
||||
* Translation updates:
|
||||
Catalan
|
||||
Georgian
|
||||
Hungarian
|
||||
Korean
|
||||
Portuguese
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.15.0, 21-04-2024
|
||||
=========================================
|
||||
|
||||
This release changes the default GSK renderer to be Vulkan, on
|
||||
Wayland. Other platforms still use ngl.
|
||||
|
||||
The intent of this change is to get wider testing and verify that
|
||||
Vulkan drivers are good enough for us to rely on. If significant
|
||||
problems show up, we will revert this change for 4.16.
|
||||
|
||||
You can still override the renderer choice using the GSK_RENDERER
|
||||
environment variable.
|
||||
|
||||
---
|
||||
|
||||
This release also changes font rendering settings by introducing
|
||||
a new high-level gtk-font-rendering settings which gives GTK more
|
||||
freedom to decide on font rendering.
|
||||
|
||||
You can still use the low-level font-related settings by changing
|
||||
the new property to 'manual'.
|
||||
|
||||
---
|
||||
|
||||
* GtkColumnView:
|
||||
- Fix infinite loops in dispose
|
||||
- Fix problems with weak ref cycles in GtkExpression
|
||||
|
||||
* GtkListView:
|
||||
* GtkShortcutManager:
|
||||
- Track the propagation phase of added controllers
|
||||
|
||||
* GtkGLArea:
|
||||
- Produce dmabuf textures, so graphics offload is possible
|
||||
|
||||
* GtkTextView:
|
||||
- Support text shadows
|
||||
|
||||
* GtkGraphicsOffload:
|
||||
- Add a black-background property
|
||||
|
||||
* Settings:
|
||||
- Add a new gtk-font-rendering setting
|
||||
|
||||
* Accessibility:
|
||||
- Add support for GetRangeExtents to GtkAccessibleText
|
||||
- Add support for GetOffsetAtPoint to GtkAccessibleText
|
||||
- Implement GtkAccessibleRange for scrollbars
|
||||
|
||||
* GDK:
|
||||
- Add a callback-based cursor API
|
||||
|
||||
* GSK:
|
||||
- Use the Vulkan renderer by default
|
||||
- Avoid an infinite recursion with offscreens in some cases
|
||||
- Optimize graphics offload to make it more likely that compositors
|
||||
can use direct scanout
|
||||
|
||||
* X11:
|
||||
- Fix some confusing debug messages
|
||||
- Drop a no-longer-relevant optimization that was interfering with
|
||||
getting the current window manager capabilities
|
||||
|
||||
* macOS:
|
||||
- Implement the color picker for macOS 10.15+
|
||||
|
||||
* Debugging:
|
||||
- Snow monitor resolution in the inspector
|
||||
|
||||
* Demos:
|
||||
- Use graphics offload in the shadertoy demo
|
||||
- Show more reliable fps numbers in the fishbowl demo
|
||||
|
||||
* Tools:
|
||||
- Support generating pdf in gtk4-rendernode-tool
|
||||
|
||||
* Build:
|
||||
- Require pango 1.52
|
||||
- Require cairo 1.18
|
||||
- Add a missing dependency that was causing build failures
|
||||
- Drop deprecated build options:
|
||||
gtk_doc -> documentation
|
||||
update_screenshots -> screenshots
|
||||
demo-profile -> profile
|
||||
demos -> build-demos
|
||||
|
||||
* Deprecations:
|
||||
- gdk_widget_set/get_font_options
|
||||
- gdk_wayland/x11_display_set_cursor_theme
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
British English
|
||||
Chinese (China)
|
||||
Hebrew
|
||||
Kabyle
|
||||
Persian
|
||||
Polish
|
||||
Russian
|
||||
Slovenian
|
||||
Swedish
|
||||
Turkish
|
||||
|
||||
|
||||
Overview of Changes in 4.14.2, 03-04-2024
|
||||
=========================================
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
"config-opts" : [
|
||||
"--libdir=/app/lib",
|
||||
"-Dbuildtype=debugoptimized",
|
||||
"-Ddemo-profile=devel"
|
||||
"-Dprofile=devel"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
|
||||
@@ -363,7 +363,9 @@ insert_markup_idle (gpointer data)
|
||||
|
||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||
{
|
||||
g_idle_add (insert_markup_idle, data);
|
||||
guint id;
|
||||
id = g_idle_add (insert_markup_idle, data);
|
||||
g_source_set_name_by_id (id, "[gtk-demo] insert_markup_idle");
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
@@ -398,7 +400,9 @@ parse_markup_idle (gpointer data)
|
||||
do {
|
||||
if (g_get_monotonic_time () - begin > G_TIME_SPAN_MILLISECOND)
|
||||
{
|
||||
g_idle_add (parse_markup_idle, data);
|
||||
guint id;
|
||||
id = g_idle_add (parse_markup_idle, data);
|
||||
g_source_set_name_by_id (id, "[gtk-demo] parse_markup_idle");
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
|
||||
{
|
||||
wchar_t *langname_w = NULL;
|
||||
wchar_t locale_abbrev_w[9];
|
||||
gchar *langname, *locale_abbrev, *locale, *p;
|
||||
gchar *langname, *locale_abbrev, *locale;
|
||||
gint i;
|
||||
const LCTYPE iso639_lctypes[] = { LOCALE_SISO639LANGNAME, LOCALE_SISO639LANGNAME2 };
|
||||
GHashTable *ht_scripts_langs = (GHashTable *) param;
|
||||
@@ -59,7 +59,6 @@ get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
|
||||
GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, langname_size);
|
||||
langname = g_utf16_to_utf8 (langname_w, -1, NULL, NULL, NULL);
|
||||
locale = g_utf16_to_utf8 (locale_w, -1, NULL, NULL, NULL);
|
||||
p = strchr (locale, '-');
|
||||
lang = pango_language_from_string (locale);
|
||||
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
|
||||
g_hash_table_insert (ht_scripts_langs, lang, langname);
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "config.h"
|
||||
#include <gtk/gtk.h>
|
||||
#include <glib/gstdio.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "demos.h"
|
||||
#include "fontify.h"
|
||||
@@ -923,6 +924,34 @@ clear_search (GtkSearchBar *bar)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
search_results_update (GObject *filter_model,
|
||||
GParamSpec *pspec,
|
||||
GtkEntry *entry)
|
||||
{
|
||||
gsize n_items = g_list_model_get_n_items (G_LIST_MODEL (filter_model));
|
||||
|
||||
if (strlen (gtk_editable_get_text (GTK_EDITABLE (entry))) > 0)
|
||||
{
|
||||
char *text;
|
||||
|
||||
if (n_items > 0)
|
||||
text = g_strdup_printf (ngettext ("%ld search result", "%ld search results", n_items), n_items);
|
||||
else
|
||||
text = g_strdup (_("No search results"));
|
||||
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (entry),
|
||||
GTK_ACCESSIBLE_PROPERTY_DESCRIPTION, text,
|
||||
-1);
|
||||
|
||||
g_free (text);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_accessible_reset_property (GTK_ACCESSIBLE (entry), GTK_ACCESSIBLE_PROPERTY_DESCRIPTION);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
activate (GApplication *app)
|
||||
{
|
||||
@@ -970,6 +999,7 @@ activate (GApplication *app)
|
||||
|
||||
search_entry = GTK_WIDGET (gtk_builder_get_object (builder, "search-entry"));
|
||||
g_signal_connect (search_entry, "search-changed", G_CALLBACK (demo_search_changed_cb), filter);
|
||||
g_signal_connect (filter_model, "notify::n-items", G_CALLBACK (search_results_update), search_entry);
|
||||
|
||||
selection = gtk_single_selection_new (G_LIST_MODEL (filter_model));
|
||||
g_signal_connect (selection, "notify::selected-item", G_CALLBACK (selection_cb), NULL);
|
||||
|
||||
@@ -299,7 +299,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);
|
||||
|
||||
@@ -330,6 +330,7 @@ stroke bounds of the path.
|
||||
| offset | `<point>` | 0 0 | non-default |
|
||||
| hint-style | `<hint style>` | slight | non-default |
|
||||
| antialias | `<antialias>` | gray | non-default |
|
||||
| hint-metrics | `<hint metrics>` | off | non-default |
|
||||
|
||||
Creates a node like `gsk_text_node_new()` with the given properties.
|
||||
|
||||
@@ -346,6 +347,7 @@ 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.
|
||||
|
||||
### texture
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@ Title: Cairo interaction
|
||||
[Cairo](http://cairographics.org) is a graphics library that supports vector
|
||||
graphics and image compositing that can be used with GTK.
|
||||
|
||||
GDK does not wrap the Cairo API; instead it allows to create Cairo
|
||||
drawing contexts which can be used to draw on [class@Gdk.Surface]s.
|
||||
GDK does not wrap the Cairo API and it is not possible to use cairo directly
|
||||
to draw on a [class@Gdk.Surface]. You can either use a
|
||||
[GtkDrawingArea](../gtk4/class.DrawingArea.html) widget or
|
||||
[gtk_snapshot_append_cairo](../gtk4/func.Snapshot.append_cairo.html)
|
||||
for drawing with cairo in a GTK4 application.
|
||||
|
||||
Additional functions allow use [struct@Gdk.Rectangle]s with Cairo
|
||||
and to use [struct@Gdk.RGBA], `GdkPixbuf`, and [class@Gdk.Surface]
|
||||
|
||||
@@ -74,6 +74,7 @@ in a selector, widget names must be prefixed with a # character.
|
||||
| E:not(selector) | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#negation) | |
|
||||
| E:dir(ltr), E:dir(rtl) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#the-dir-pseudo) | |
|
||||
| E:drop(active) | [CSS Selector Level 4](https://drafts.csswg.org/selectors/#drag-pseudos) | |
|
||||
| E:root | [CSS Selector Level 3](https://www.w3.org/TR/selectors-3/#root-pseudo) | |
|
||||
| E F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#descendent-combinators) | |
|
||||
| E > F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#child-combinators) | |
|
||||
| E ~ F | [CSS Selector Level 3](https://www.w3.org/TR/css3-selectors/#general-sibling-combinators) | |
|
||||
|
||||
@@ -15,16 +15,16 @@ spec.
|
||||
The following units are supported for basic datatypes:
|
||||
|
||||
Length
|
||||
: px, pt, em, ex, rem, pc, in, cm, mm, calc()
|
||||
: px, pt, em, ex, rem, pc, in, cm, mm
|
||||
|
||||
Percentage
|
||||
: %, calc()
|
||||
: %
|
||||
|
||||
Angle
|
||||
: deg, grad, turn, calc()
|
||||
: deg, rad, grad, turn
|
||||
|
||||
Time
|
||||
: s, ms, calc()
|
||||
: s, ms
|
||||
|
||||
Length values with the em or ex units are resolved using the font
|
||||
size value, unless they occur in setting the font-size itself, in
|
||||
@@ -33,11 +33,15 @@ which case they are resolved using the inherited font size value.
|
||||
The rem unit is resolved using the initial font size value, which is
|
||||
not quite the same as the CSS definition of rem.
|
||||
|
||||
The calc() notation adds considerable expressive power. There are limits
|
||||
on what types can be combined in such an expression (e.g. it does not make
|
||||
sense to add a number and a time). For the full details, see the
|
||||
[CSS3 Values and Units](https://www.w3.org/TR/css3-values/#calc-notation)
|
||||
spec.
|
||||
Length values using physical units (pt, pc, in, cm, mm) are translated
|
||||
to px using the dpi value specified by the -gtk-dpi property, which is
|
||||
different from the CSS definition, which uses a fixed dpi of 96.
|
||||
|
||||
The calc() notation adds considerable expressive power to all of these
|
||||
datatypes. There are limits on what types can be combined in such an
|
||||
expression (e.g. it does not make sense to add a number and a time).
|
||||
For the full details, see the
|
||||
[CSS Values and Units](https://www.w3.org/TR/css-values-4/) spec.
|
||||
|
||||
A common pattern among shorthand properties (called 'four sides') is one
|
||||
where one to four values can be specified, to determine a value for each
|
||||
@@ -56,38 +60,80 @@ follows:
|
||||
1 value:
|
||||
: all
|
||||
|
||||
## Custom Properties
|
||||
|
||||
GTK supports custom properties as defined in the
|
||||
[CSS Custom Properties for Cascading Variables](https://www.w3.org/TR/css-variables-1)
|
||||
spec.
|
||||
|
||||
Custom properties are defined as follows:
|
||||
|
||||
```css
|
||||
--prop: red;
|
||||
```
|
||||
|
||||
and used via the `var` keyword:
|
||||
|
||||
```css
|
||||
color: var(--prop);
|
||||
```
|
||||
|
||||
Custom properties can have a fallback for when the referred property is invalid:
|
||||
|
||||
```css
|
||||
color: var(--prop, green);
|
||||
```
|
||||
|
||||
## Colors
|
||||
|
||||
GTK extends the CSS syntax with several additional ways to specify colors.
|
||||
### CSS Colors
|
||||
|
||||
Colors can be expressed in numerous ways in CSS (see the
|
||||
[Color Module](https://www.w3.org/TR/css-color-5/). GTK supports
|
||||
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. 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.
|
||||
|
||||
These extensions are deprecated and should be replaced by the equivalent
|
||||
standard CSS notions.
|
||||
|
||||
The first is a reference to a color defined via a @define-color rule in CSS.
|
||||
The syntax for @define-color rules is as follows:
|
||||
|
||||
```
|
||||
@define-color Name Color
|
||||
@define-color name color
|
||||
```
|
||||
|
||||
To refer to the color defined by a @define-color rule, prefix the name with @.
|
||||
|
||||
The standard CSS mechanisms that should be used instead of @define-color are
|
||||
custom properties, :root and var().
|
||||
|
||||
GTK also supports color expressions, which allow colors to be transformed to
|
||||
new ones. Color expressions can be nested, providing a rich language to
|
||||
define colors. Color expressions resemble functions, taking 1 or more colors
|
||||
and in some cases a number as arguments.
|
||||
|
||||
`lighter(Color)`
|
||||
: produces a brighter variant of Color
|
||||
`lighter(color)`
|
||||
: produces a brighter variant of `color`.
|
||||
|
||||
`darker(Color)`
|
||||
: produces a darker variant of Color
|
||||
`darker(color)`
|
||||
: produces a darker variant of `color`.
|
||||
|
||||
`shade(Color, Number)`
|
||||
: changes the lightness of Color. The number ranges from 0 for black to 2 for white.
|
||||
`shade(color, number)`
|
||||
: changes the lightness of `color`. The `number` ranges from 0 for black to 2 for white.
|
||||
|
||||
`alpha(Color, Number)`
|
||||
: replaces the alpha value of color with number (between 0 and 1)
|
||||
`alpha(color, number)`
|
||||
: multiplies the alpha value of `color` by `number` (between 0 and 1).
|
||||
|
||||
`mix(Color1, Color2, Number)`
|
||||
: interpolates between the two colors
|
||||
`mix(color1, color2, number)`
|
||||
: interpolates between the two colors.
|
||||
|
||||
## Images
|
||||
|
||||
@@ -95,7 +141,7 @@ GTK extends the CSS syntax for images and also uses it for specifying icons.
|
||||
To load a themed icon, use
|
||||
|
||||
```
|
||||
-gtk-icontheme(Name)
|
||||
-gtk-icontheme(name)
|
||||
```
|
||||
|
||||
The specified icon name is used to look up a themed icon, while taking into
|
||||
@@ -124,14 +170,14 @@ and the
|
||||
syntax makes this available. -gtk-recolor requires a url as first argument.
|
||||
The remaining arguments specify the color palette to use. If the palette is
|
||||
not explicitly specified, the current value of the -gtk-icon-palette property
|
||||
is used.
|
||||
is used.
|
||||
|
||||
GTK supports scaled rendering on hi-resolution displays. This works best if
|
||||
images can specify normal and hi-resolution variants. From CSS, this can be
|
||||
done with
|
||||
|
||||
```
|
||||
-gtk-scaled(Image1, Image2)
|
||||
-gtk-scaled(image1, image2)
|
||||
```
|
||||
|
||||
## GTK CSS Properties
|
||||
|
||||
@@ -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).
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-broadwayd
|
||||
The Broadway display server
|
||||
---------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-builder-tool
|
||||
GtkBuilder File Utility
|
||||
-----------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
||||
@@ -8,6 +8,9 @@ gtk4-demo-application
|
||||
Demonstrate GtkApplication
|
||||
--------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-demo
|
||||
Demonstrate GTK widgets
|
||||
-----------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-encode-symbolic-svg
|
||||
Symbolic icon conversion utility
|
||||
--------------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-icon-browser
|
||||
List themed icons
|
||||
-----------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-launch
|
||||
Launch an application
|
||||
---------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-node-editor
|
||||
Editor render nodes
|
||||
-----------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-path-tool
|
||||
GskPath Utility
|
||||
-----------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-path-tool** <COMMAND> [OPTIONS...] <PATH>
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-query-settings
|
||||
Print name and value of GTK settings
|
||||
------------------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,12 +8,17 @@ gtk4-rendernode-tool
|
||||
GskRenderNode Utility
|
||||
-----------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-rendernode-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
|
||||
| **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>
|
||||
@@ -45,13 +50,14 @@ without any titlebar.
|
||||
Rendering
|
||||
^^^^^^^^^
|
||||
|
||||
The ``render`` command saves a rendering of the rendernode as a png or tiff image.
|
||||
The name of the file to write can be specified as a second FILE argument.
|
||||
The ``render`` command saves a rendering of the rendernode as a png, tiff or svg
|
||||
image or as pdf document. The name of the file to write can be specified as a second
|
||||
FILE argument.
|
||||
|
||||
``--renderer=RENDERER``
|
||||
|
||||
Use the given renderer. Use ``--renderer=help`` to get a information
|
||||
about poassible values for the ``RENDERER``.
|
||||
about possible values for the ``RENDERER``.
|
||||
|
||||
Benchmark
|
||||
^^^^^^^^^
|
||||
@@ -93,4 +99,16 @@ exit code is 1. If the images are identical, it is 0.
|
||||
|
||||
``--quiet``
|
||||
|
||||
Don't write results to stdout.`
|
||||
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).
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-update-icon-cache
|
||||
Icon theme caching utility
|
||||
--------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -8,6 +8,10 @@ gtk4-widget-factory
|
||||
Showcase GTK widgets and styles
|
||||
-------------------------------
|
||||
|
||||
:Version: GTK
|
||||
:Manual section: 1
|
||||
:Manual group: GTK commands
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
|
||||
@@ -77,11 +77,13 @@ content_files = [
|
||||
"section-tree-widget.md",
|
||||
"migrating-2to4.md",
|
||||
"migrating-3to4.md",
|
||||
"migrating-4to5.md",
|
||||
"broadway.md",
|
||||
"osx.md",
|
||||
"wayland.md",
|
||||
"windows.md",
|
||||
"x11.md",
|
||||
"tools.md",
|
||||
"visual_index.md",
|
||||
]
|
||||
content_images = [
|
||||
|
||||
@@ -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',
|
||||
@@ -25,7 +26,8 @@ expand_content_md_files = [
|
||||
'section-tree-widget.md',
|
||||
'section-list-widget.md',
|
||||
'question_index.md',
|
||||
'visual_index.md'
|
||||
'visual_index.md',
|
||||
'tools.md',
|
||||
]
|
||||
|
||||
gtk_images = []
|
||||
@@ -60,39 +62,39 @@ if get_option('documentation')
|
||||
build_by_default: true,
|
||||
install: true,
|
||||
install_dir: docs_dir,
|
||||
install_tag: 'doc',
|
||||
)
|
||||
endif
|
||||
|
||||
rst2man = find_program('rst2man', 'rst2man.py', required: false)
|
||||
if get_option('man-pages') and not rst2man.found()
|
||||
error('No rst2man found, but man pages were explicitly enabled')
|
||||
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('man-pages'))
|
||||
rst2html5 = find_program('rst2html5', 'rst2html5.py', required: get_option('documentation'))
|
||||
|
||||
rst_files = [
|
||||
[ 'gtk4-broadwayd', '1' ],
|
||||
[ 'gtk4-builder-tool', '1' ],
|
||||
[ 'gtk4-encode-symbolic-svg', '1', ],
|
||||
[ 'gtk4-launch', '1', ],
|
||||
[ 'gtk4-query-settings', '1', ],
|
||||
[ 'gtk4-rendernode-tool', '1' ],
|
||||
[ 'gtk4-update-icon-cache', '1', ],
|
||||
[ 'gtk4-path-tool', '1', ],
|
||||
]
|
||||
|
||||
if get_option('build-demos')
|
||||
rst_files += [
|
||||
[ 'gtk4-demo', '1', ],
|
||||
[ 'gtk4-demo-application', '1', ],
|
||||
[ 'gtk4-widget-factory', '1', ],
|
||||
[ 'gtk4-icon-browser', '1', ],
|
||||
[ 'gtk4-node-editor', '1', ],
|
||||
]
|
||||
endif
|
||||
|
||||
if get_option('man-pages') and rst2man.found()
|
||||
rst_files = [
|
||||
[ 'gtk4-broadwayd', '1' ],
|
||||
[ 'gtk4-builder-tool', '1' ],
|
||||
[ 'gtk4-encode-symbolic-svg', '1', ],
|
||||
[ 'gtk4-launch', '1', ],
|
||||
[ 'gtk4-query-settings', '1', ],
|
||||
[ 'gtk4-rendernode-tool', '1' ],
|
||||
[ 'gtk4-update-icon-cache', '1', ],
|
||||
[ 'gtk4-path-tool', '1', ],
|
||||
]
|
||||
rst2x_flags = [
|
||||
'--syntax-highlight=none',
|
||||
]
|
||||
|
||||
if get_option('demos')
|
||||
rst_files += [
|
||||
[ 'gtk4-demo', '1', ],
|
||||
[ 'gtk4-demo-application', '1', ],
|
||||
[ 'gtk4-widget-factory', '1', ],
|
||||
[ 'gtk4-icon-browser', '1', ],
|
||||
[ 'gtk4-node-editor', '1', ],
|
||||
]
|
||||
endif
|
||||
|
||||
rst2man_flags = [
|
||||
'--syntax-highlight=none',
|
||||
]
|
||||
if get_option('man-pages')
|
||||
|
||||
foreach rst: rst_files
|
||||
man_name = rst[0]
|
||||
@@ -103,12 +105,34 @@ if get_option('man-pages') and rst2man.found()
|
||||
output: '@0@.@1@'.format(man_name, man_section),
|
||||
command: [
|
||||
rst2man,
|
||||
rst2man_flags,
|
||||
rst2x_flags,
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true,
|
||||
install: true,
|
||||
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
|
||||
install_tag: 'doc',
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
||||
if get_option('documentation')
|
||||
|
||||
foreach rst: rst_files
|
||||
man_name = rst[0]
|
||||
|
||||
custom_target(
|
||||
input: '@0@.rst'.format(man_name),
|
||||
output: '@0@.html'.format(man_name),
|
||||
command: [
|
||||
rst2html5,
|
||||
rst2x_flags,
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true,
|
||||
install: true,
|
||||
install_dir: docs_dir / 'gtk4',
|
||||
install_tag: 'doc',
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
||||
@@ -58,7 +58,7 @@ use a GtkLabel.
|
||||
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
|
||||
|
||||
@@ -73,6 +73,103 @@ 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())
|
||||
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().
|
||||
|
||||
ligher(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
|
||||
|
||||
@@ -58,12 +58,12 @@ GTK is divided into three parts:
|
||||
storage types for efficient use in GUI applications, and much more.
|
||||
|
||||
[gnu-lgpl]: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
|
||||
[glib]: https://developer.gnome.org/glib/stable/
|
||||
[gobject]: https://developer.gnome.org/gobject/stable/
|
||||
[gio]: https://developer.gnome.org/gio/stable/
|
||||
[glib]: https://docs.gtk.org/glib/
|
||||
[gobject]: https://docs.gtk.org/gobject/
|
||||
[gio]: https://docs.gtk.org/gio/
|
||||
[cairo]: https://www.cairographics.org/manual/
|
||||
[opengl]: https://www.opengl.org/about/
|
||||
[vulkan]: https://www.vulkan.org/
|
||||
[pango]: https://pango.gnome.org/
|
||||
[gdkpixbuf]: https://developer.gnome.org/gdk-pixbuf/stable/
|
||||
[pango]: https://docs.gtk.org/Pango/
|
||||
[gdkpixbuf]: https://docs.gtk.org/gdk-pixbuf/
|
||||
[graphene]: https://ebassi.github.io/graphene/
|
||||
|
||||
@@ -217,6 +217,10 @@ A number of options affect behavior instead of logging:
|
||||
`no-portals`
|
||||
: Disable use of [portals](https://docs.flatpak.org/en/latest/portals.html)
|
||||
|
||||
`force-offload`
|
||||
: Force graphics offload for all textures, even when slower. This allows
|
||||
to debug offloading in the absence of dmabufs.
|
||||
|
||||
`gl-disable`
|
||||
: Disable OpenGL support
|
||||
|
||||
|
||||
@@ -155,6 +155,7 @@ Each property name is part of the `GtkAccessibleProperty` enumeration.
|
||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_MIN | “aria-valuemin” | double |
|
||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_NOW | “aria-valuenow” | double |
|
||||
| %GTK_ACCESSIBLE_PROPERTY_VALUE_TEXT | “aria-valuetext” | translatable string |
|
||||
| %GTK_ACCESSIBLE_PROPERTY_HELP_TEXT | N/A | translatable string |
|
||||
|
||||
#### List of accessible relations
|
||||
|
||||
@@ -216,6 +217,10 @@ are accessible as part of the development process. The GTK Inspector shows
|
||||
the accessible attributes of each widget, and also provides an overlay that
|
||||
can highlight accessibility issues.
|
||||
|
||||
If you support some non-standard keyboard interactions for a widget, you
|
||||
**should** set an appropriate `GTK_ACCESSIBLE_PROPERTY_HELP_TEXT` to help
|
||||
discoverability of the behavior.
|
||||
|
||||
It is possible to set accessible attributes in UI files as well:
|
||||
```xml
|
||||
<object class="GtkButton" id="button1">
|
||||
|
||||
18
docs/reference/gtk/tools.md
Normal file
18
docs/reference/gtk/tools.md
Normal file
@@ -0,0 +1,18 @@
|
||||
Title: Tools and Demos
|
||||
|
||||
GTK ships with a number of tools and demos that come with their own
|
||||
documentation in the form of man pages.
|
||||
|
||||
- [gtk4-broadwayd](gtk4-broadwayd.html)
|
||||
- [gtk4-builder-tool](gtk4-builder-tool.html)
|
||||
- [gtk4-demo](gtk4-demo.html)
|
||||
- [gtk4-demo-application](gtk4-demo-application.html)
|
||||
- [gtk4-encode-symbolic-svg](gtk4-encode-symbolic-svg.html)
|
||||
- [gtk4-icon-browser](gtk4-icon-browser.html)
|
||||
- [gtk4-launch](gtk4-launch.html)
|
||||
- [gtk4-node-editor](gtk4-node-editor.html)
|
||||
- [gtk4-path-tool](gtk4-path-tool.html)
|
||||
- [gtk4-query-settings](gtk4-query-settings.html)
|
||||
- [gtk4-rendernode-tool](gtk4-rendernode-tool.html)
|
||||
- [gtk4-update-icon-cache](gtk4-update-icon-cache.html)
|
||||
- [gtk4-widget-factory](gtk4-widget-factory.html)
|
||||
@@ -91,6 +91,31 @@ const GDK_META_MASK = 1 << 28;
|
||||
|
||||
var useDataUrls = window.location.search.includes("datauri");
|
||||
|
||||
/* check if we are on Android and using Chrome */
|
||||
var isAndroidChrome = false;
|
||||
{
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
if (ua.indexOf("android") > -1 && ua.indexOf("chrom") > -1) {
|
||||
isAndroidChrome = true;
|
||||
}
|
||||
}
|
||||
/* check for the passive option for Event listener */
|
||||
let passiveSupported = false;
|
||||
try {
|
||||
const options = {
|
||||
get passive() { // This function will be called when the browser
|
||||
// attempts to access the passive property.
|
||||
passiveSupported = true;
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener("test", null, options);
|
||||
window.removeEventListener("test", null, options);
|
||||
} catch(err) {
|
||||
passiveSupported = false;
|
||||
}
|
||||
|
||||
/* This base64code is based on https://github.com/beatgammit/base64-js/blob/master/index.js which is MIT licensed */
|
||||
|
||||
var b64_lookup = [];
|
||||
@@ -215,11 +240,32 @@ function logStackTrace(len) {
|
||||
log(callstack[i]);
|
||||
}
|
||||
|
||||
/* Helper functions for touch identifier to make it unique on Android */
|
||||
var globalTouchIdentifier = Math.round(Date.now() / 1000);
|
||||
function touchIdentifierStart(tId)
|
||||
{
|
||||
if (isAndroidChrome) {
|
||||
if (tId == 0) {
|
||||
return ++globalTouchIdentifier;
|
||||
}
|
||||
return globalTouchIdentifier + tId;
|
||||
}
|
||||
return tId;
|
||||
}
|
||||
function touchIdentifier(tId)
|
||||
{
|
||||
if (isAndroidChrome) {
|
||||
return globalTouchIdentifier + tId;
|
||||
}
|
||||
return tId;
|
||||
}
|
||||
|
||||
var grab = new Object();
|
||||
grab.surface = null;
|
||||
grab.ownerEvents = false;
|
||||
grab.implicit = false;
|
||||
var keyDownList = [];
|
||||
var inputList = [];
|
||||
var lastSerial = 0;
|
||||
var lastX = 0;
|
||||
var lastY = 0;
|
||||
@@ -987,7 +1033,14 @@ function handleDisplayCommands(display_commands)
|
||||
break;
|
||||
case DISPLAY_OP_DELETE_SURFACE:
|
||||
var id = cmd[1];
|
||||
delete surfaces[id];
|
||||
if (id == surfaceWithMouse) {
|
||||
surfaceWithMouse = 0;
|
||||
}
|
||||
if (id == realSurfaceWithMouse) {
|
||||
realSurfaceWithMouse = 0;
|
||||
firstTouchDownId = null;
|
||||
}
|
||||
delete surfaces[id];
|
||||
break;
|
||||
case DISPLAY_OP_CHANGE_TEXTURE:
|
||||
var image = cmd[1];
|
||||
@@ -1371,8 +1424,14 @@ function getEffectiveEventTarget (id) {
|
||||
function updateKeyboardStatus() {
|
||||
if (fakeInput != null && showKeyboardChanged) {
|
||||
showKeyboardChanged = false;
|
||||
if (showKeyboard)
|
||||
if (showKeyboard) {
|
||||
if (isAndroidChrome) {
|
||||
fakeInput.blur();
|
||||
fakeInput.value = ' '.repeat(80); // TODO: Should be exchange with broadway server
|
||||
// to bring real value here.
|
||||
}
|
||||
fakeInput.focus();
|
||||
}
|
||||
else
|
||||
fakeInput.blur();
|
||||
}
|
||||
@@ -2924,6 +2983,19 @@ function pushKeyEvent(fev) {
|
||||
keyDownList.push(fev);
|
||||
}
|
||||
|
||||
function copyInputEvent(ev) {
|
||||
var members = ['inputType', 'data'], i, obj = {};
|
||||
for (i = 0; i < members.length; i++) {
|
||||
if (typeof ev[members[i]] !== "undefined")
|
||||
obj[members[i]] = ev[members[i]];
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
|
||||
function pushInputEvent(fev) {
|
||||
inputList.push(fev);
|
||||
}
|
||||
|
||||
function getKeyEvent(keyCode, pop) {
|
||||
var i, fev = null;
|
||||
for (i = keyDownList.length-1; i >= 0; i--) {
|
||||
@@ -3022,6 +3094,29 @@ function handleKeyUp(e) {
|
||||
keysym = fev.keysym;
|
||||
else {
|
||||
//log("Key event (keyCode = " + ev.keyCode + ") not found on keyDownList");
|
||||
if (isAndroidChrome && (ev.keyCode == 229)) {
|
||||
var i, fev = null, len = inputList.length, str;
|
||||
for (i = 0; i < len; i++) {
|
||||
fev = inputList[i];
|
||||
switch(fev.inputType) {
|
||||
case "deleteContentBackward":
|
||||
sendInput(BROADWAY_EVENT_KEY_PRESS, [65288, lastState]);
|
||||
sendInput(BROADWAY_EVENT_KEY_RELEASE, [65288, lastState]);
|
||||
break;
|
||||
case "insertText":
|
||||
if (fev.data !== undefined) {
|
||||
for (let sym of fev.data) {
|
||||
sendInput(BROADWAY_EVENT_KEY_PRESS, [sym.codePointAt(0), lastState]);
|
||||
sendInput(BROADWAY_EVENT_KEY_RELEASE, [sym.codePointAt(0), lastState]);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
inputList.splice(0, len);
|
||||
}
|
||||
keysym = 0;
|
||||
}
|
||||
|
||||
@@ -3030,6 +3125,16 @@ function handleKeyUp(e) {
|
||||
return cancelEvent(ev);
|
||||
}
|
||||
|
||||
function handleInput (e) {
|
||||
var fev = null, ev = (e ? e : window.event), keysym = null, suppress = false;
|
||||
|
||||
fev = copyInputEvent(ev);
|
||||
pushInputEvent(fev);
|
||||
|
||||
// Stop keypress events just in case
|
||||
return cancelEvent(ev);
|
||||
}
|
||||
|
||||
function onKeyDown (ev) {
|
||||
updateForEvent(ev);
|
||||
return handleKeyDown(ev);
|
||||
@@ -3045,6 +3150,11 @@ function onKeyUp (ev) {
|
||||
return handleKeyUp(ev);
|
||||
}
|
||||
|
||||
function onInput (ev) {
|
||||
updateForEvent(ev);
|
||||
return handleInput(ev);
|
||||
}
|
||||
|
||||
function cancelEvent(ev)
|
||||
{
|
||||
ev = ev ? ev : window.event;
|
||||
@@ -3076,13 +3186,14 @@ function onMouseWheel(ev)
|
||||
}
|
||||
|
||||
function onTouchStart(ev) {
|
||||
event.preventDefault();
|
||||
ev.preventDefault();
|
||||
|
||||
updateKeyboardStatus();
|
||||
updateForEvent(ev);
|
||||
|
||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||
var touch = ev.changedTouches.item(i);
|
||||
var touchId = touchIdentifierStart(touch.identifier);
|
||||
|
||||
var origId = getSurfaceId(touch);
|
||||
var id = getEffectiveEventTarget (origId);
|
||||
@@ -3090,7 +3201,7 @@ function onTouchStart(ev) {
|
||||
var isEmulated = 0;
|
||||
|
||||
if (firstTouchDownId == null) {
|
||||
firstTouchDownId = touch.identifier;
|
||||
firstTouchDownId = touchId;
|
||||
isEmulated = 1;
|
||||
|
||||
if (realSurfaceWithMouse != origId || id != surfaceWithMouse) {
|
||||
@@ -3105,52 +3216,54 @@ function onTouchStart(ev) {
|
||||
}
|
||||
}
|
||||
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [0, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchMove(ev) {
|
||||
event.preventDefault();
|
||||
ev.preventDefault();
|
||||
|
||||
updateKeyboardStatus();
|
||||
updateForEvent(ev);
|
||||
|
||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||
var touch = ev.changedTouches.item(i);
|
||||
var touchId = touchIdentifier(touch.identifier);
|
||||
|
||||
var origId = getSurfaceId(touch);
|
||||
var id = getEffectiveEventTarget (origId);
|
||||
var pos = getPositionsFromEvent(touch, id);
|
||||
|
||||
var isEmulated = 0;
|
||||
if (firstTouchDownId == touch.identifier) {
|
||||
if (firstTouchDownId == touchId) {
|
||||
isEmulated = 1;
|
||||
}
|
||||
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [1, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
}
|
||||
}
|
||||
|
||||
function onTouchEnd(ev) {
|
||||
event.preventDefault();
|
||||
ev.preventDefault();
|
||||
|
||||
updateKeyboardStatus();
|
||||
updateForEvent(ev);
|
||||
|
||||
for (var i = 0; i < ev.changedTouches.length; i++) {
|
||||
var touch = ev.changedTouches.item(i);
|
||||
var touchId = touchIdentifier(touch.identifier);
|
||||
|
||||
var origId = getSurfaceId(touch);
|
||||
var id = getEffectiveEventTarget (origId);
|
||||
var pos = getPositionsFromEvent(touch, id);
|
||||
|
||||
var isEmulated = 0;
|
||||
if (firstTouchDownId == touch.identifier) {
|
||||
if (firstTouchDownId == touchId) {
|
||||
isEmulated = 1;
|
||||
firstTouchDownId = null;
|
||||
}
|
||||
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touch.identifier, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
sendInput (BROADWAY_EVENT_TOUCH, [2, id, touchId, isEmulated, pos.rootX, pos.rootY, pos.winX, pos.winY, lastState]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3167,11 +3280,11 @@ function setupDocument(document)
|
||||
document.onkeyup = onKeyUp;
|
||||
|
||||
if (document.addEventListener) {
|
||||
document.addEventListener('DOMMouseScroll', onMouseWheel, false);
|
||||
document.addEventListener('mousewheel', onMouseWheel, false);
|
||||
document.addEventListener('touchstart', onTouchStart, false);
|
||||
document.addEventListener('touchmove', onTouchMove, false);
|
||||
document.addEventListener('touchend', onTouchEnd, false);
|
||||
document.addEventListener('DOMMouseScroll', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
||||
document.addEventListener('mousewheel', onMouseWheel, passiveSupported ? { passive: false, capture: false } : false);
|
||||
document.addEventListener('touchstart', onTouchStart, passiveSupported ? { passive: false, capture: false } : false);
|
||||
document.addEventListener('touchmove', onTouchMove, passiveSupported ? { passive: false, capture: false } : false);
|
||||
document.addEventListener('touchend', onTouchEnd, passiveSupported ? { passive: false, capture: false } : false);
|
||||
} else if (document.attachEvent) {
|
||||
element.attachEvent("onmousewheel", onMouseWheel);
|
||||
}
|
||||
@@ -3237,12 +3350,14 @@ function connect()
|
||||
};
|
||||
|
||||
var iOS = /(iPad|iPhone|iPod)/g.test( navigator.userAgent );
|
||||
if (iOS) {
|
||||
if (iOS || isAndroidChrome) {
|
||||
fakeInput = document.createElement("input");
|
||||
fakeInput.type = "text";
|
||||
fakeInput.style.position = "absolute";
|
||||
fakeInput.style.left = "-1000px";
|
||||
fakeInput.style.top = "-1000px";
|
||||
document.body.appendChild(fakeInput);
|
||||
if (isAndroidChrome)
|
||||
fakeInput.addEventListener('input', onInput, passiveSupported ? { passive: false, capture: false } : false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,8 +52,7 @@ broadwayjs_h = custom_target('broadwayjs.h',
|
||||
)
|
||||
|
||||
libgdk_broadway = static_library('gdk-broadway',
|
||||
clienthtml_h, broadwayjs_h,
|
||||
gdk_broadway_sources, gdkconfig, gdkenum_h,
|
||||
sources: [ clienthtml_h, broadwayjs_h, gdk_broadway_sources, gdk_gen_headers ],
|
||||
include_directories: [confinc, gdkinc],
|
||||
c_args: [
|
||||
'-DGTK_COMPILATION',
|
||||
|
||||
65
gdk/gdk.c
65
gdk/gdk.c
@@ -122,6 +122,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
|
||||
{ "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" },
|
||||
@@ -142,31 +143,50 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
|
||||
#ifdef G_HAS_CONSTRUCTORS
|
||||
#ifdef G_DEFINE_CONSTRUCTOR_NEEDS_PRAGMA
|
||||
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_desktop_startup_notification_id)
|
||||
#pragma G_DEFINE_CONSTRUCTOR_PRAGMA_ARGS(stash_and_unset_environment)
|
||||
#endif
|
||||
G_DEFINE_CONSTRUCTOR(stash_desktop_startup_notification_id)
|
||||
G_DEFINE_CONSTRUCTOR(stash_and_unset_environment)
|
||||
#endif
|
||||
|
||||
static char *startup_notification_id = NULL;
|
||||
static char *xdg_activation_token = NULL;
|
||||
|
||||
static void
|
||||
stash_desktop_startup_notification_id (void)
|
||||
stash_and_unset_environment (void)
|
||||
{
|
||||
const char *desktop_startup_id;
|
||||
|
||||
desktop_startup_id = g_getenv ("DESKTOP_STARTUP_ID");
|
||||
if (desktop_startup_id && *desktop_startup_id != '\0')
|
||||
{
|
||||
if (!g_utf8_validate (desktop_startup_id, -1, NULL))
|
||||
g_warning ("DESKTOP_STARTUP_ID contains invalid UTF-8");
|
||||
else
|
||||
startup_notification_id = g_strdup (desktop_startup_id);
|
||||
}
|
||||
|
||||
/* Clear the environment variable so it won't be inherited by
|
||||
/* Copies environment variables and unsets them so they won't be inherited by
|
||||
* child processes and confuse things.
|
||||
*
|
||||
* Changing environment variables can be racy so we try to do this as early as
|
||||
* possible in the program flow and before any printing that might involve
|
||||
* environment variables.
|
||||
*/
|
||||
g_unsetenv ("DESKTOP_STARTUP_ID");
|
||||
struct {
|
||||
const char *key;
|
||||
char **dst;
|
||||
} vars[] = {
|
||||
{ "DESKTOP_STARTUP_ID", &startup_notification_id },
|
||||
{ "XDG_ACTIVATION_TOKEN", &xdg_activation_token },
|
||||
};
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
||||
*vars[i].dst = g_strdup (g_getenv (vars[i].key));
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
||||
g_unsetenv (vars[i].key);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (vars); i++)
|
||||
{
|
||||
if (*vars[i].dst == NULL)
|
||||
continue;
|
||||
|
||||
if (!g_utf8_validate (*vars[i].dst, -1, NULL))
|
||||
{
|
||||
g_warning ("%s contains invalid UTF-8", vars[i].key);
|
||||
g_clear_pointer (vars[i].dst, g_free);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gpointer
|
||||
@@ -291,7 +311,7 @@ gdk_pre_parse (void)
|
||||
gdk_gl_backend_use (GDK_GL_WGL);
|
||||
|
||||
#ifndef G_HAS_CONSTRUCTORS
|
||||
stash_desktop_startup_notification_id ();
|
||||
stash_and_unset_environment ();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -325,15 +345,20 @@ gdk_display_open_default (void)
|
||||
/*< private >
|
||||
* gdk_get_startup_notification_id:
|
||||
*
|
||||
* Returns the original value of the DESKTOP_STARTUP_ID environment
|
||||
* variable if it was defined and valid, or %NULL otherwise.
|
||||
* Returns the original value of the XDG_ACTIVATION_TOKEN environment
|
||||
* variable if it was defined and valid, otherwise it returns the original
|
||||
* value of the DESKTOP_STARTUP_ID environment variable if it was defined
|
||||
* and valid, or %NULL if neither of them were defined and valid.
|
||||
*
|
||||
* Returns: (nullable) (transfer none): the original value of the
|
||||
* DESKTOP_STARTUP_ID environment variable
|
||||
* XDG_ACTIVATION_TOKEN or DESKTOP_STARTUP_ID environment variable
|
||||
*/
|
||||
const char *
|
||||
gdk_get_startup_notification_id (void)
|
||||
{
|
||||
if (xdg_activation_token)
|
||||
return xdg_activation_token;
|
||||
|
||||
return startup_notification_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <gdk/gdkcairo.h>
|
||||
#include <gdk/gdkcairocontext.h>
|
||||
#include <gdk/gdkclipboard.h>
|
||||
#include <gdk/gdkcolorstate.h>
|
||||
#include <gdk/gdkconfig.h>
|
||||
#include <gdk/gdkcontentdeserializer.h>
|
||||
#include <gdk/gdkcontentformats.h>
|
||||
|
||||
@@ -41,8 +41,10 @@ G_BEGIN_DECLS
|
||||
|
||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||
#define GDK_ARRAY_REAL_SIZE(_size) ((_size) + 1)
|
||||
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_) - 1)
|
||||
#else
|
||||
#define GDK_ARRAY_REAL_SIZE(_size) (_size)
|
||||
#define GDK_ARRAY_MAX_SIZE (G_MAXSIZE / sizeof (_T_))
|
||||
#endif
|
||||
|
||||
/* make this readable */
|
||||
@@ -177,18 +179,23 @@ G_GNUC_UNUSED static inline void
|
||||
gdk_array(reserve) (GdkArray *self,
|
||||
gsize n)
|
||||
{
|
||||
gsize new_size, size;
|
||||
gsize new_capacity, size, capacity;
|
||||
|
||||
if (n <= gdk_array(get_capacity) (self))
|
||||
return;
|
||||
if (G_UNLIKELY (n > GDK_ARRAY_MAX_SIZE))
|
||||
g_error ("requesting array size of %zu, but maximum size is %zu", n, GDK_ARRAY_MAX_SIZE);
|
||||
|
||||
capacity = gdk_array(get_capacity) (self);
|
||||
if (n <= capacity)
|
||||
return;
|
||||
|
||||
size = gdk_array(get_size) (self);
|
||||
new_size = ((gsize) 1) << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
|
||||
/* capacity * 2 can overflow, that's why we MAX() */
|
||||
new_capacity = MAX (GDK_ARRAY_REAL_SIZE (n), capacity * 2);
|
||||
|
||||
#ifdef GDK_ARRAY_PREALLOC
|
||||
if (self->start == self->preallocated)
|
||||
{
|
||||
self->start = g_new (_T_, new_size);
|
||||
self->start = g_new (_T_, new_capacity);
|
||||
memcpy (self->start, self->preallocated, sizeof (_T_) * GDK_ARRAY_REAL_SIZE (size));
|
||||
}
|
||||
else
|
||||
@@ -196,15 +203,15 @@ gdk_array(reserve) (GdkArray *self,
|
||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||
if (self->start == NULL)
|
||||
{
|
||||
self->start = g_new (_T_, new_size);
|
||||
self->start = g_new (_T_, new_capacity);
|
||||
*self->start = *(_T_[1]) { 0 };
|
||||
}
|
||||
else
|
||||
#endif
|
||||
self->start = g_renew (_T_, self->start, new_size);
|
||||
self->start = g_renew (_T_, self->start, new_capacity);
|
||||
|
||||
self->end = self->start + size;
|
||||
self->end_allocation = self->start + new_size;
|
||||
self->end_allocation = self->start + new_capacity;
|
||||
#ifdef GDK_ARRAY_NULL_TERMINATED
|
||||
self->end_allocation--;
|
||||
#endif
|
||||
@@ -312,6 +319,7 @@ gdk_array(get) (const GdkArray *self,
|
||||
#undef gdk_array_paste
|
||||
#undef gdk_array
|
||||
#undef GDK_ARRAY_REAL_SIZE
|
||||
#undef GDK_ARRAY_MAX_SIZE
|
||||
|
||||
#undef GDK_ARRAY_BY_VALUE
|
||||
#undef GDK_ARRAY_ELEMENT_TYPE
|
||||
|
||||
@@ -522,8 +522,6 @@ gdk_clipboard_get_content (GdkClipboard *clipboard)
|
||||
*
|
||||
* If the clipboard is not local, this function does nothing but report success.
|
||||
*
|
||||
* The @callback must call [method@Gdk.Clipboard.store_finish].
|
||||
*
|
||||
* The purpose of this call is to preserve clipboard contents beyond the
|
||||
* lifetime of an application, so this function is typically called on
|
||||
* exit. Depending on the platform, the functionality may not be available
|
||||
@@ -638,9 +636,6 @@ gdk_clipboard_read_internal (GdkClipboard *clipboard,
|
||||
* Asynchronously requests an input stream to read the @clipboard's
|
||||
* contents from.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then
|
||||
* call [method@Gdk.Clipboard.read_finish] to get the result of the operation.
|
||||
*
|
||||
* The clipboard will choose the most suitable mime type from the given list
|
||||
* to fulfill the request, preferring the ones listed first.
|
||||
*/
|
||||
@@ -834,9 +829,6 @@ gdk_clipboard_read_value_internal (GdkClipboard *clipboard,
|
||||
* Asynchronously request the @clipboard contents converted to the given
|
||||
* @type.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then call
|
||||
* [method@Gdk.Clipboard.read_value_finish] to get the resulting `GValue`.
|
||||
*
|
||||
* For local clipboard contents that are available in the given `GType`,
|
||||
* the value will be copied directly. Otherwise, GDK will try to use
|
||||
* [func@content_deserialize_async] to convert the clipboard's data.
|
||||
@@ -895,9 +887,6 @@ gdk_clipboard_read_value_finish (GdkClipboard *clipboard,
|
||||
*
|
||||
* Asynchronously request the @clipboard contents converted to a `GdkPixbuf`.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then
|
||||
* call [method@Gdk.Clipboard.read_texture_finish] to get the result.
|
||||
*
|
||||
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||
* need more control over the operation.
|
||||
@@ -960,9 +949,6 @@ gdk_clipboard_read_texture_finish (GdkClipboard *clipboard,
|
||||
*
|
||||
* Asynchronously request the @clipboard contents converted to a string.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then
|
||||
* call [method@Gdk.Clipboard.read_text_finish] to get the result.
|
||||
*
|
||||
* This is a simple wrapper around [method@Gdk.Clipboard.read_value_async].
|
||||
* Use that function or [method@Gdk.Clipboard.read_async] directly if you
|
||||
* need more control over the operation.
|
||||
|
||||
183
gdk/gdkcolorstate.c
Normal file
183
gdk/gdkcolorstate.c
Normal file
@@ -0,0 +1,183 @@
|
||||
/* gdkcolorstate.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 "gdkcolorstateprivate.h"
|
||||
|
||||
#include <glib/gi18n-lib.h>
|
||||
|
||||
/**
|
||||
* GdkColorState:
|
||||
*
|
||||
* A `GdkColorState` object provides the information to interpret
|
||||
* colors and pixels in a variety of ways.
|
||||
*
|
||||
* They are also known as
|
||||
* [*color spaces*](https://en.wikipedia.org/wiki/Color_space).
|
||||
*
|
||||
* Crucially, GTK knows how to convert colors from one color
|
||||
* state to another.
|
||||
*
|
||||
* `GdkColorState objects are immutable and therefore threadsafe.
|
||||
*
|
||||
* Since 4.16
|
||||
*/
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GdkColorState, gdk_color_state,
|
||||
gdk_color_state_ref, gdk_color_state_unref);
|
||||
|
||||
/* {{{ Public API */
|
||||
|
||||
/**
|
||||
* gdk_color_state_ref:
|
||||
* @self: a `GdkColorState`
|
||||
*
|
||||
* Increase the reference count of @self.
|
||||
*
|
||||
* Returns: the object that was passed in
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
GdkColorState *
|
||||
(gdk_color_state_ref) (GdkColorState *self)
|
||||
{
|
||||
return _gdk_color_state_ref (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_color_state_unref:
|
||||
* @self:a `GdkColorState`
|
||||
*
|
||||
* Decrease the reference count of @self.
|
||||
*
|
||||
* Unless @self is static, it will be freed
|
||||
* when the reference count reaches zero.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
void
|
||||
(gdk_color_state_unref) (GdkColorState *self)
|
||||
{
|
||||
_gdk_color_state_unref (self);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_color_state_get_srgb:
|
||||
*
|
||||
* Returns the color state object representing the sRGB color space.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
GdkColorState *
|
||||
gdk_color_state_get_srgb (void)
|
||||
{
|
||||
return GDK_COLOR_STATE_SRGB;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_color_state_get_srgb_linear:
|
||||
*
|
||||
* Returns the color state object representing the linearized sRGB color space.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
GdkColorState *
|
||||
gdk_color_state_get_srgb_linear (void)
|
||||
{
|
||||
return GDK_COLOR_STATE_SRGB_LINEAR;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_color_state_equal:
|
||||
* @self: a `GdkColorState`
|
||||
* @other: another `GdkColorStatee`
|
||||
*
|
||||
* Compares two `GdkColorStates` for equality.
|
||||
*
|
||||
* Note that this function is not guaranteed to be perfect and two objects
|
||||
* describing the same color state may compare not equal. However, different
|
||||
* color states will never compare equal.
|
||||
*
|
||||
* Returns: %TRUE if the two color states compare equal
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
gboolean
|
||||
(gdk_color_state_equal) (GdkColorState *self,
|
||||
GdkColorState *other)
|
||||
{
|
||||
return _gdk_color_state_equal (self, other);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Default implementation */
|
||||
|
||||
const char *
|
||||
gdk_color_state_get_name_from_id (GdkColorStateId id)
|
||||
{
|
||||
const char *names[] = {
|
||||
"srgb", "srgb-linear",
|
||||
};
|
||||
|
||||
return names[id];
|
||||
}
|
||||
|
||||
GdkColorState gdk_default_color_states[] = {
|
||||
{ NULL, 0 },
|
||||
{ NULL, 0 },
|
||||
};
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Private API */
|
||||
|
||||
const char *
|
||||
gdk_color_state_get_name (GdkColorState *self)
|
||||
{
|
||||
if (GDK_IS_DEFAULT_COLOR_STATE (self))
|
||||
{
|
||||
switch (GDK_DEFAULT_COLOR_STATE_ID (self))
|
||||
{
|
||||
case GDK_COLOR_STATE_ID_SRGB: return "srgb";
|
||||
case GDK_COLOR_STATE_ID_SRGB_LINEAR: return "srgb-linear";
|
||||
default: g_assert_not_reached ();
|
||||
}
|
||||
}
|
||||
|
||||
return self->klass->get_name (self);
|
||||
}
|
||||
|
||||
void
|
||||
gdk_color_state_print (GdkColorState *self,
|
||||
GString *string)
|
||||
{
|
||||
g_string_append (string, gdk_color_state_get_name (self));
|
||||
}
|
||||
|
||||
GdkMemoryDepth
|
||||
gdk_color_state_get_min_depth (GdkColorState *self)
|
||||
{
|
||||
if (self == GDK_COLOR_STATE_SRGB || self == GDK_COLOR_STATE_SRGB_LINEAR)
|
||||
return GDK_MEMORY_U8;
|
||||
|
||||
return GDK_MEMORY_FLOAT16;
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
/* vim:set foldmethod=marker expandtab: */
|
||||
50
gdk/gdkcolorstate.h
Normal file
50
gdk/gdkcolorstate.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/* 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
|
||||
gboolean gdk_color_state_equal (GdkColorState *self,
|
||||
GdkColorState *other);
|
||||
|
||||
G_END_DECLS
|
||||
84
gdk/gdkcolorstateprivate.h
Normal file
84
gdk/gdkcolorstateprivate.h
Normal file
@@ -0,0 +1,84 @@
|
||||
#pragma once
|
||||
|
||||
#include "gdkcolorstate.h"
|
||||
#include "gdkmemoryformatprivate.h"
|
||||
|
||||
typedef enum
|
||||
{
|
||||
GDK_COLOR_STATE_ID_SRGB,
|
||||
GDK_COLOR_STATE_ID_SRGB_LINEAR,
|
||||
} GdkColorStateId;
|
||||
|
||||
typedef struct _GdkColorStateClass GdkColorStateClass;
|
||||
|
||||
struct _GdkColorState
|
||||
{
|
||||
GdkColorStateClass *klass;
|
||||
int ref_count;
|
||||
};
|
||||
|
||||
struct _GdkColorStateClass
|
||||
{
|
||||
void (* free) (GdkColorState *self);
|
||||
gboolean (* equal) (GdkColorState *self,
|
||||
GdkColorState *other);
|
||||
const char * (* get_name) (GdkColorState *self);
|
||||
};
|
||||
|
||||
extern GdkColorState gdk_default_color_states[];
|
||||
|
||||
#define GDK_COLOR_STATE_SRGB (&gdk_default_color_states[GDK_COLOR_STATE_ID_SRGB])
|
||||
#define GDK_COLOR_STATE_SRGB_LINEAR (&gdk_default_color_states[GDK_COLOR_STATE_ID_SRGB_LINEAR])
|
||||
|
||||
#define GDK_IS_DEFAULT_COLOR_STATE(c) (GDK_COLOR_STATE_SRGB <= (c) && (c) <= GDK_COLOR_STATE_SRGB_LINEAR)
|
||||
#define GDK_DEFAULT_COLOR_STATE_ID(c) ((GdkColorStateId) (c - gdk_default_color_states))
|
||||
|
||||
const char * gdk_color_state_get_name (GdkColorState *color_state);
|
||||
const char * gdk_color_state_get_name_from_id (GdkColorStateId id);
|
||||
void gdk_color_state_print (GdkColorState *color_state,
|
||||
GString *string);
|
||||
|
||||
GdkMemoryDepth gdk_color_state_get_min_depth (GdkColorState *color_state);
|
||||
|
||||
#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;
|
||||
|
||||
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;
|
||||
|
||||
self->ref_count--;
|
||||
|
||||
if (self->ref_count == 0)
|
||||
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 (GDK_IS_DEFAULT_COLOR_STATE (self) || GDK_IS_DEFAULT_COLOR_STATE (other))
|
||||
return FALSE;
|
||||
|
||||
if (self->klass != other->klass)
|
||||
return FALSE;
|
||||
|
||||
return self->klass->equal (self, other);
|
||||
}
|
||||
|
||||
@@ -540,9 +540,6 @@ deserialize_not_found (GdkContentDeserializer *deserializer)
|
||||
*
|
||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||
* indicate a higher priority.
|
||||
*
|
||||
* When the operation is finished, @callback will be called. You must then
|
||||
* call [func@Gdk.content_deserialize_finish] to get the result of the operation.
|
||||
*/
|
||||
void
|
||||
gdk_content_deserialize_async (GInputStream *stream,
|
||||
|
||||
@@ -279,10 +279,6 @@ gdk_content_provider_content_changed (GdkContentProvider *provider)
|
||||
* Asynchronously writes the contents of @provider to @stream in the given
|
||||
* @mime_type.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must then call
|
||||
* [method@Gdk.ContentProvider.write_mime_type_finish] to get the result
|
||||
* of the operation.
|
||||
*
|
||||
* The given mime type does not need to be listed in the formats returned by
|
||||
* [method@Gdk.ContentProvider.ref_formats]. However, if the given `GType` is
|
||||
* not supported, `G_IO_ERROR_NOT_SUPPORTED` will be reported.
|
||||
|
||||
@@ -546,9 +546,6 @@ serialize_not_found (GdkContentSerializer *serializer)
|
||||
*
|
||||
* The default I/O priority is %G_PRIORITY_DEFAULT (i.e. 0), and lower numbers
|
||||
* indicate a higher priority.
|
||||
*
|
||||
* When the operation is finished, @callback will be called. You must then
|
||||
* call [func@Gdk.content_serialize_finish] to get the result of the operation.
|
||||
*/
|
||||
void
|
||||
gdk_content_serialize_async (GOutputStream *stream,
|
||||
|
||||
@@ -52,7 +52,7 @@ GdkCursor* gdk_cursor_new_from_name (const char *name,
|
||||
GdkCursor *fallback);
|
||||
|
||||
/**
|
||||
* GdkCursorGetTestureCallback:
|
||||
* GdkCursorGetTextureCallback:
|
||||
* @cursor: the `GdkCursor`
|
||||
* @cursor_size: the nominal cursor size, in application pixels
|
||||
* @scale: the device scale
|
||||
|
||||
@@ -44,7 +44,7 @@ typedef enum {
|
||||
GDK_DEBUG_NO_PORTALS = 1 << 15,
|
||||
GDK_DEBUG_GL_DISABLE = 1 << 16,
|
||||
GDK_DEBUG_GL_NO_FRACTIONAL= 1 << 17,
|
||||
|
||||
GDK_DEBUG_FORCE_OFFLOAD = 1 << 18,
|
||||
GDK_DEBUG_GL_DISABLE_GL = 1 << 19,
|
||||
GDK_DEBUG_GL_DISABLE_GLES = 1 << 20,
|
||||
GDK_DEBUG_GL_PREFER_GL = 1 << 21,
|
||||
|
||||
@@ -1874,6 +1874,8 @@ gdk_display_init_egl (GdkDisplay *self,
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_image_dma_buf_import_modifiers");
|
||||
self->have_egl_dma_buf_export =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_MESA_image_dma_buf_export");
|
||||
self->have_egl_gl_colorspace =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_gl_colorspace");
|
||||
|
||||
if (self->have_egl_no_config_context)
|
||||
priv->egl_config_high_depth = gdk_display_create_egl_config (self,
|
||||
|
||||
@@ -130,6 +130,7 @@ struct _GdkDisplay
|
||||
guint have_egl_pixel_format_float : 1;
|
||||
guint have_egl_dma_buf_import : 1;
|
||||
guint have_egl_dma_buf_export : 1;
|
||||
guint have_egl_gl_colorspace : 1;
|
||||
|
||||
GdkDmabufFormats *dmabuf_formats;
|
||||
GdkDmabufDownloader *dmabuf_downloaders[4];
|
||||
|
||||
@@ -144,8 +144,8 @@ struct _YUVCoefficients
|
||||
};
|
||||
|
||||
/* multiplied by 65536 */
|
||||
//static const YUVCoefficients itu601_narrow = { 104597, -25675, -53279, 132201 };
|
||||
static const YUVCoefficients itu601_wide = { 74711, -25864, -38050, 133176 };
|
||||
static const YUVCoefficients itu601_narrow = { 104597, -25675, -53279, 132201 };
|
||||
//static const YUVCoefficients itu601_wide = { 74711, -25864, -38050, 133176 };
|
||||
|
||||
static inline void
|
||||
get_uv_values (const YUVCoefficients *coeffs,
|
||||
@@ -229,7 +229,7 @@ download_nv12 (guchar *dst_data,
|
||||
int r, g, b;
|
||||
gsize xs, ys;
|
||||
|
||||
get_uv_values (&itu601_wide, uv_data[x / X_SUB * 2 + U], uv_data[x / X_SUB * 2 + V], &r, &g, &b);
|
||||
get_uv_values (&itu601_narrow, uv_data[x / X_SUB * 2 + U], uv_data[x / X_SUB * 2 + V], &r, &g, &b);
|
||||
|
||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||
@@ -309,7 +309,7 @@ download_yuv_3 (guchar *dst_data,
|
||||
int r, g, b;
|
||||
gsize xs, ys;
|
||||
|
||||
get_uv_values (&itu601_wide, u_data[x / X_SUB], v_data[x / X_SUB], &r, &g, &b);
|
||||
get_uv_values (&itu601_narrow, u_data[x / X_SUB], v_data[x / X_SUB], &r, &g, &b);
|
||||
|
||||
for (ys = 0; ys < Y_SUB && y + ys < height; ys++)
|
||||
for (xs = 0; xs < X_SUB && x + xs < width; xs++)
|
||||
@@ -365,7 +365,7 @@ download_yuyv (guchar *dst_data,
|
||||
{
|
||||
int r, g, b;
|
||||
|
||||
get_uv_values (&itu601_wide, src_data[2 * x + U], src_data[2 * x + V], &r, &g, &b);
|
||||
get_uv_values (&itu601_narrow, src_data[2 * x + U], src_data[2 * x + V], &r, &g, &b);
|
||||
set_rgb_values (&dst_data[3 * x], src_data[2 * x + Y1], r, g, b);
|
||||
if (x + 1 < width)
|
||||
set_rgb_values (&dst_data[3 * (x + 1)], src_data[2 * x + Y2], r, g, b);
|
||||
|
||||
@@ -163,6 +163,8 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
return NULL;
|
||||
|
||||
previous = gdk_gl_context_get_current ();
|
||||
if (previous)
|
||||
g_object_ref (previous);
|
||||
formats = gdk_dmabuf_formats_builder_new ();
|
||||
external = gdk_dmabuf_formats_builder_new ();
|
||||
|
||||
@@ -194,7 +196,10 @@ gdk_dmabuf_get_egl_downloader (GdkDisplay *display,
|
||||
}
|
||||
|
||||
if (previous)
|
||||
gdk_gl_context_make_current (previous);
|
||||
{
|
||||
gdk_gl_context_make_current (previous);
|
||||
g_object_unref (previous);
|
||||
}
|
||||
|
||||
return GDK_DMABUF_DOWNLOADER (renderer);
|
||||
}
|
||||
@@ -239,7 +244,7 @@ gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
||||
attribs[i++] = EGL_YUV_COLOR_SPACE_HINT_EXT;
|
||||
attribs[i++] = EGL_ITU_REC601_EXT;
|
||||
attribs[i++] = EGL_SAMPLE_RANGE_HINT_EXT;
|
||||
attribs[i++] = EGL_YUV_FULL_RANGE_EXT;
|
||||
attribs[i++] = EGL_YUV_NARROW_RANGE_EXT;
|
||||
|
||||
#define ADD_PLANE(plane) \
|
||||
{ \
|
||||
@@ -265,6 +270,7 @@ gdk_dmabuf_egl_create_image (GdkDisplay *display,
|
||||
if (dmabuf->n_planes > 3) ADD_PLANE (3);
|
||||
|
||||
attribs[i++] = EGL_NONE;
|
||||
g_assert (i < G_N_ELEMENTS (attribs));
|
||||
|
||||
image = eglCreateImageKHR (egl_display,
|
||||
EGL_NO_CONTEXT,
|
||||
|
||||
@@ -62,6 +62,13 @@ struct _GdkDmabufTextureClass
|
||||
GdkTextureClass parent_class;
|
||||
};
|
||||
|
||||
/**
|
||||
* gdk_dmabuf_error_quark:
|
||||
*
|
||||
* Registers an error quark for [class@Gdk.DmabufTexture] errors.
|
||||
*
|
||||
* Returns: the error quark
|
||||
**/
|
||||
G_DEFINE_QUARK (gdk-dmabuf-error-quark, gdk_dmabuf_error)
|
||||
|
||||
G_DEFINE_TYPE (GdkDmabufTexture, gdk_dmabuf_texture, GDK_TYPE_TEXTURE)
|
||||
@@ -72,7 +79,10 @@ gdk_dmabuf_texture_dispose (GObject *object)
|
||||
GdkDmabufTexture *self = GDK_DMABUF_TEXTURE (object);
|
||||
|
||||
if (self->destroy)
|
||||
self->destroy (self->data);
|
||||
{
|
||||
self->destroy (self->data);
|
||||
self->destroy = NULL;
|
||||
}
|
||||
|
||||
g_clear_object (&self->downloader);
|
||||
g_clear_object (&self->display);
|
||||
|
||||
@@ -134,7 +134,7 @@ gdk_drop_read_local_async (GdkDrop *self,
|
||||
|
||||
g_object_get (priv->drag, "content", &content, NULL);
|
||||
content_formats = gdk_content_provider_ref_formats (content);
|
||||
g_object_unref (content);
|
||||
g_object_unref (content);
|
||||
content_formats = gdk_content_formats_union_serialize_mime_types (content_formats);
|
||||
mime_type = gdk_content_formats_match_mime_type (content_formats, formats);
|
||||
|
||||
@@ -784,7 +784,7 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
||||
GdkContentFormats *formats;
|
||||
GValue *value;
|
||||
GTask *task;
|
||||
|
||||
|
||||
g_return_if_fail (priv->state != GDK_DROP_STATE_FINISHED);
|
||||
|
||||
task = g_task_new (self, cancellable, callback, user_data);
|
||||
@@ -849,10 +849,6 @@ gdk_drop_read_value_internal (GdkDrop *self,
|
||||
* Asynchronously request the drag operation's contents converted
|
||||
* to the given @type.
|
||||
*
|
||||
* When the operation is finished @callback will be called. You must
|
||||
* then call [method@Gdk.Drop.read_value_finish] to get the resulting
|
||||
* `GValue`.
|
||||
*
|
||||
* For local drag-and-drop operations that are available in the given
|
||||
* `GType`, the value will be copied directly. Otherwise, GDK will
|
||||
* try to use [func@Gdk.content_deserialize_async] to convert the data.
|
||||
|
||||
@@ -1371,6 +1371,8 @@ gdk_event_get_modifier_state (GdkEvent *event)
|
||||
* Extract the event surface relative x/y coordinates from an event.
|
||||
*
|
||||
* This position is in [surface coordinates](coordinates.html).
|
||||
*
|
||||
* Returns: whether the positions were set
|
||||
*/
|
||||
gboolean
|
||||
gdk_event_get_position (GdkEvent *event,
|
||||
|
||||
@@ -192,13 +192,6 @@ compute_smooth_frame_time (GdkFrameClock *clock,
|
||||
* and new_frame_time >= old_frame_time. */
|
||||
frames_passed = (new_frame_time - smoothed_frame_time_base + frame_interval / 2) / frame_interval;
|
||||
|
||||
if (frames_passed > 1)
|
||||
gdk_profiler_add_markf ((smoothed_frame_time_base - (frame_interval * (frames_passed-1))) * 1000L,
|
||||
frame_interval * (frames_passed-1) * 1000L,
|
||||
"Dropped Frames",
|
||||
"%u frames may have been dropped",
|
||||
frames_passed-1);
|
||||
|
||||
/* We use an approximately whole number of frames in the future from
|
||||
* last smoothed frame time. This way we avoid minor jitter in the
|
||||
* frame times making the animation speed uneven, but still animate
|
||||
|
||||
@@ -152,6 +152,13 @@ enum {
|
||||
|
||||
static GParamSpec *properties[LAST_PROP] = { NULL, };
|
||||
|
||||
/**
|
||||
* gdk_gl_error_quark:
|
||||
*
|
||||
* Registers an error quark for [class@Gdk.GLContext] errors.
|
||||
*
|
||||
* Returns: the error quark
|
||||
**/
|
||||
G_DEFINE_QUARK (gdk-gl-error-quark, gdk_gl_error)
|
||||
|
||||
G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GdkGLContext, gdk_gl_context, GDK_TYPE_DRAW_CONTEXT)
|
||||
@@ -1751,6 +1758,8 @@ gdk_gl_context_check_extensions (GdkGLContext *context)
|
||||
|
||||
priv->features = supported_features & ~disabled_features;
|
||||
|
||||
glEnable (GL_FRAMEBUFFER_SRGB);
|
||||
|
||||
gdk_gl_context_init_memory_flags (context);
|
||||
|
||||
if ((priv->features & GDK_GL_FEATURE_DEBUG) && gl_debug)
|
||||
@@ -1956,8 +1965,6 @@ gdk_gl_context_get_glsl_version_string (GdkGLContext *self)
|
||||
return "#version 310 es";
|
||||
else if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
return "#version 300 es";
|
||||
else if (gdk_gl_version_greater_equal (&priv->gl_version, &GDK_GL_VERSION_INIT (3, 0)))
|
||||
return "#version 300 es";
|
||||
else
|
||||
return "#version 100";
|
||||
}
|
||||
@@ -2198,12 +2205,78 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
|
||||
gdk_display_init_dmabuf (display);
|
||||
|
||||
if (!gdk_dmabuf_formats_contains (display->egl_external_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||
if (gdk_dmabuf_formats_contains (display->egl_dmabuf_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||
{
|
||||
/* This is the path for modern drivers that support modifiers */
|
||||
|
||||
if (!gdk_dmabuf_formats_contains (display->egl_external_formats, dmabuf->fourcc, dmabuf->modifier))
|
||||
{
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
GL_TEXTURE_2D);
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Import of %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_2D texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
*external = FALSE;
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
if (!gdk_gl_context_get_use_es (self))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Can't import external_only %.4s:%#" G_GINT64_MODIFIER "x outside of GLES",
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
GL_TEXTURE_2D);
|
||||
GL_TEXTURE_EXTERNAL_OES);
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Import of external_only %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_EXTERNAL_OES texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
*external = TRUE;
|
||||
return texture_id;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is the opportunistic path.
|
||||
* We hit it both for drivers that do not support modifiers as well as for dmabufs
|
||||
* that the driver did not explicitly advertise. */
|
||||
int target;
|
||||
|
||||
if (gdk_gl_context_get_use_es (self))
|
||||
target = GL_TEXTURE_EXTERNAL_OES;
|
||||
else
|
||||
target = GL_TEXTURE_2D;
|
||||
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
target);
|
||||
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
@@ -2214,40 +2287,13 @@ gdk_gl_context_import_dmabuf (GdkGLContext *self,
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_2D texture",
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as %s texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
*external = FALSE;
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier,
|
||||
target == GL_TEXTURE_EXTERNAL_OES ? "GL_TEXTURE_EXTERNAL_OES" : "GL_TEXTURE_2D");
|
||||
*external = target == GL_TEXTURE_EXTERNAL_OES;
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
if (!gdk_gl_context_get_use_es (self))
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Can't import external_only %.4s:%#" G_GINT64_MODIFIER "x outside of GLES",
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
texture_id = gdk_gl_context_import_dmabuf_for_target (self,
|
||||
width, height,
|
||||
dmabuf,
|
||||
GL_TEXTURE_EXTERNAL_OES);
|
||||
if (texture_id == 0)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Import of external_only %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf failed",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
return 0;
|
||||
}
|
||||
|
||||
GDK_DISPLAY_DEBUG (display, DMABUF,
|
||||
"Imported %dx%d %.4s:%#" G_GINT64_MODIFIER "x dmabuf as GL_TEXTURE_EXTERNAL_OES texture",
|
||||
width, height,
|
||||
(char *) &dmabuf->fourcc, dmabuf->modifier);
|
||||
*external = TRUE;
|
||||
return texture_id;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
||||
@@ -151,7 +151,7 @@ gdk_gl_texture_find_format (GdkGLContext *context,
|
||||
|
||||
for (format = 0; format < GDK_MEMORY_N_FORMATS; format++)
|
||||
{
|
||||
GLint q_internal_format;
|
||||
GLint q_internal_format, q_internal_srgb_format;
|
||||
GLenum q_format, q_type;
|
||||
GLint q_swizzle[4];
|
||||
|
||||
@@ -164,6 +164,7 @@ gdk_gl_texture_find_format (GdkGLContext *context,
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&q_internal_format,
|
||||
&q_internal_srgb_format,
|
||||
&q_format,
|
||||
&q_type,
|
||||
q_swizzle);
|
||||
@@ -187,7 +188,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
GdkMemoryFormat format;
|
||||
gsize expected_stride;
|
||||
Download *download = download_;
|
||||
GLint gl_internal_format;
|
||||
GLint gl_internal_format, gl_internal_srgb_format;
|
||||
GLenum gl_format, gl_type;
|
||||
GLint gl_swizzle[4];
|
||||
|
||||
@@ -199,7 +200,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
{
|
||||
gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_format, &gl_type, gl_swizzle);
|
||||
if (download->stride == expected_stride &&
|
||||
download->format == format)
|
||||
@@ -262,7 +263,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
}
|
||||
@@ -274,7 +275,7 @@ gdk_gl_texture_do_download (GdkGLTexture *self,
|
||||
|
||||
gdk_memory_format_gl_format (actual_format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
&gl_internal_format,
|
||||
&gl_internal_format, &gl_internal_srgb_format,
|
||||
&gl_read_format, &gl_read_type, gl_swizzle);
|
||||
}
|
||||
|
||||
@@ -471,8 +472,7 @@ gdk_gl_texture_release (GdkGLTexture *self)
|
||||
g_return_if_fail (self->saved == NULL);
|
||||
|
||||
texture = GDK_TEXTURE (self);
|
||||
self->saved = GDK_TEXTURE (gdk_memory_texture_from_texture (texture,
|
||||
gdk_texture_get_format (texture)));
|
||||
self->saved = GDK_TEXTURE (gdk_memory_texture_from_texture (texture));
|
||||
|
||||
drop_gl_resources (self);
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "gdkdmabuffourccprivate.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkcolorstateprivate.h"
|
||||
#include "gtk/gtkcolorutilsprivate.h"
|
||||
|
||||
#include "gsk/gl/fp16private.h"
|
||||
|
||||
@@ -327,6 +329,7 @@ ADD_ALPHA_FUNC(r8g8b8_to_a8b8g8r8, 0, 1, 2, 3, 2, 1, 0)
|
||||
|
||||
struct _GdkMemoryFormatDescription
|
||||
{
|
||||
const char *name;
|
||||
GdkMemoryAlpha alpha;
|
||||
GdkMemoryFormat premultiplied;
|
||||
GdkMemoryFormat straight;
|
||||
@@ -337,7 +340,9 @@ struct _GdkMemoryFormatDescription
|
||||
struct {
|
||||
GLint internal_gl_format;
|
||||
GLint internal_gles_format;
|
||||
GLint internal_srgb_format;
|
||||
GLenum format;
|
||||
GLenum srgb_format;
|
||||
GLenum type;
|
||||
GLint swizzle[4];
|
||||
/* -1 if none exists, ie the format is already RGBA
|
||||
@@ -347,6 +352,7 @@ struct _GdkMemoryFormatDescription
|
||||
} gl;
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
VkFormat vk_format;
|
||||
VkFormat vk_srgb_format;
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
guint32 dmabuf_fourcc;
|
||||
@@ -366,6 +372,7 @@ struct _GdkMemoryFormatDescription
|
||||
|
||||
static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
[GDK_MEMORY_B8G8R8A8_PREMULTIPLIED] = {
|
||||
.name = "*BGRA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_B8G8R8A8,
|
||||
@@ -378,6 +385,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -386,6 +394,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_B8G8R8A8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_B8G8R8A8_SRGB,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_ARGB8888,
|
||||
@@ -394,6 +403,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8R8G8B8_PREMULTIPLIED] = {
|
||||
.name = "*ARGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8R8G8B8,
|
||||
@@ -406,6 +416,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -414,6 +425,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_UNDEFINED,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_BGRA8888,
|
||||
@@ -422,6 +434,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8r8g8b8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8A8_PREMULTIPLIED] = {
|
||||
.name = "*RGBA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R8G8B8A8,
|
||||
@@ -434,6 +447,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -441,6 +455,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R8G8B8A8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_R8G8B8A8_SRGB,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_ABGR8888,
|
||||
@@ -449,6 +464,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8B8G8R8_PREMULTIPLIED] = {
|
||||
.name = "*ABGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8B8G8R8,
|
||||
@@ -461,6 +477,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -469,6 +486,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_UNDEFINED,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_RGBA8888,
|
||||
@@ -477,6 +495,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8b8g8r8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_B8G8R8A8] = {
|
||||
.name = "BGRA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_B8G8R8A8,
|
||||
@@ -489,6 +508,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -497,6 +517,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_B8G8R8A8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_B8G8R8A8_SRGB,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_ARGB8888,
|
||||
@@ -505,6 +526,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8R8G8B8] = {
|
||||
.name = "ARGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8R8G8B8,
|
||||
@@ -517,6 +539,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -525,6 +548,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_UNDEFINED,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_BGRA8888,
|
||||
@@ -533,6 +557,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8r8g8b8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8A8] = {
|
||||
.name = "RGBA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R8G8B8A8,
|
||||
@@ -545,6 +570,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -552,6 +578,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R8G8B8A8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_R8G8B8A8_SRGB,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_ABGR8888,
|
||||
@@ -560,6 +587,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8B8G8R8] = {
|
||||
.name = "ABGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_A8B8G8R8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_A8B8G8R8,
|
||||
@@ -572,6 +600,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -580,6 +609,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_UNDEFINED,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_RGBA8888,
|
||||
@@ -588,6 +618,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8b8g8r8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_B8G8R8X8] = {
|
||||
.name = "BGRX8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8X8,
|
||||
.straight = GDK_MEMORY_B8G8R8X8,
|
||||
@@ -601,6 +632,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_BGRA,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_BGRA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -609,6 +641,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_B8G8R8A8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_B8G8R8A8_SRGB,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_XRGB8888,
|
||||
@@ -617,6 +650,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8x8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_X8R8G8B8] = {
|
||||
.name = "XRGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_X8R8G8B8,
|
||||
.straight = GDK_MEMORY_X8R8G8B8,
|
||||
@@ -630,6 +664,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_BGRA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -638,6 +673,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_UNDEFINED,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_BGRX8888,
|
||||
@@ -646,6 +682,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = x8r8g8b8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8X8] = {
|
||||
.name = "RGBX8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8X8,
|
||||
.straight = GDK_MEMORY_R8G8B8X8,
|
||||
@@ -659,6 +696,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -666,6 +704,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R8G8B8A8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_R8G8B8A8_SRGB,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_XBGR8888,
|
||||
@@ -674,6 +713,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8x8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_X8B8G8R8] = {
|
||||
.name = "XBGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_X8B8G8R8,
|
||||
.straight = GDK_MEMORY_X8B8G8R8,
|
||||
@@ -687,6 +727,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA8,
|
||||
.internal_gles_format = GL_RGBA8,
|
||||
.internal_srgb_format = GL_SRGB8_ALPHA8,
|
||||
.format = GL_RGBA,
|
||||
.type = GDK_GL_UNSIGNED_BYTE_FLIPPED,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ONE },
|
||||
@@ -695,6 +736,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_UNDEFINED,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_RGBX8888,
|
||||
@@ -703,6 +745,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = x8b8g8r8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R8G8B8] = {
|
||||
.name = "RGB8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R8G8B8,
|
||||
.straight = GDK_MEMORY_R8G8B8,
|
||||
@@ -716,6 +759,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.internal_srgb_format = GL_SRGB8,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -723,6 +767,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R8G8B8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_R8G8B8_SRGB,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_BGR888,
|
||||
@@ -731,6 +776,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r8g8b8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_B8G8R8] = {
|
||||
.name = "BGR8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_B8G8R8,
|
||||
.straight = GDK_MEMORY_B8G8R8,
|
||||
@@ -744,6 +790,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB8,
|
||||
.internal_gles_format = GL_RGB8,
|
||||
.internal_srgb_format = GL_SRGB8,
|
||||
.format = GL_BGR,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -752,6 +799,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_B8G8R8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_B8G8R8_SRGB,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_RGB888,
|
||||
@@ -760,6 +808,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = b8g8r8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16] = {
|
||||
.name = "RGB16",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16,
|
||||
.straight = GDK_MEMORY_R16G16B16,
|
||||
@@ -776,6 +825,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB16,
|
||||
.internal_gles_format = GL_RGB16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGB,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -783,6 +833,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16G16B16_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -791,6 +842,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16_PREMULTIPLIED] = {
|
||||
.name = "*RGBA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16,
|
||||
@@ -806,6 +858,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -813,6 +866,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16G16B16A16_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_ABGR16161616,
|
||||
@@ -821,6 +875,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16] = {
|
||||
.name = "RGBA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16,
|
||||
@@ -836,6 +891,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16,
|
||||
.internal_gles_format = GL_RGBA16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -843,6 +899,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16G16B16A16_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_ABGR16161616,
|
||||
@@ -851,6 +908,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16_FLOAT] = {
|
||||
.name = "RGBA16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16_FLOAT,
|
||||
.straight = GDK_MEMORY_R16G16B16_FLOAT,
|
||||
@@ -866,6 +924,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB16F,
|
||||
.internal_gles_format = GL_RGB16F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGB,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -873,6 +932,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16G16B16_SFLOAT,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -881,6 +941,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED] = {
|
||||
.name = "*RGBA16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16_FLOAT,
|
||||
@@ -895,6 +956,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -902,6 +964,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16G16B16A16_SFLOAT,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_ABGR16161616F,
|
||||
@@ -910,6 +973,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R16G16B16A16_FLOAT] = {
|
||||
.name = "RGBA16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R16G16B16A16_FLOAT,
|
||||
@@ -924,6 +988,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA16F,
|
||||
.internal_gles_format = GL_RGBA16F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -931,6 +996,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16G16B16A16_SFLOAT,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_ABGR16161616F,
|
||||
@@ -939,6 +1005,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r16g16b16a16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R32G32B32_FLOAT] = {
|
||||
.name = "RGB32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_R32G32B32_FLOAT,
|
||||
.straight = GDK_MEMORY_R32G32B32_FLOAT,
|
||||
@@ -954,6 +1021,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGB32F,
|
||||
.internal_gles_format = GL_RGB32F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGB,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -961,6 +1029,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R32G32B32_SFLOAT,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -969,6 +1038,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r32g32b32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED] = {
|
||||
.name = "*RGBA32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R32G32B32A32_FLOAT,
|
||||
@@ -983,6 +1053,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -990,6 +1061,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -998,6 +1070,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r32g32b32a32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_R32G32B32A32_FLOAT] = {
|
||||
.name = "RGBA32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_R32G32B32A32_FLOAT,
|
||||
@@ -1012,6 +1085,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RGBA32F,
|
||||
.internal_gles_format = GL_RGBA32F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RGBA,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA },
|
||||
@@ -1019,6 +1093,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R32G32B32A32_SFLOAT,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -1027,6 +1102,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = r32g32b32a32_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8A8_PREMULTIPLIED] = {
|
||||
.name = "*GA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_G8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G8A8,
|
||||
@@ -1040,6 +1116,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1047,6 +1124,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R8G8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -1055,6 +1133,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g8a8_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8A8] = {
|
||||
.name = "GA8",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_G8A8_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G8A8,
|
||||
@@ -1068,6 +1147,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG8,
|
||||
.internal_gles_format = GL_RG8,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1075,6 +1155,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R8G8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -1083,6 +1164,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g8a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G8] = {
|
||||
.name = "G8",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_G8,
|
||||
.straight = GDK_MEMORY_G8,
|
||||
@@ -1096,6 +1178,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@@ -1103,6 +1186,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_R8_SRGB,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_R8,
|
||||
@@ -1111,6 +1195,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16A16_PREMULTIPLIED] = {
|
||||
.name = "*GA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_G16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G16A16,
|
||||
@@ -1127,6 +1212,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1134,6 +1220,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16G16_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -1142,6 +1229,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g16a16_premultiplied_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16A16] = {
|
||||
.name = "GA16",
|
||||
.alpha = GDK_MEMORY_ALPHA_STRAIGHT,
|
||||
.premultiplied = GDK_MEMORY_G16A16_PREMULTIPLIED,
|
||||
.straight = GDK_MEMORY_G16A16,
|
||||
@@ -1158,6 +1246,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_RG16,
|
||||
.internal_gles_format = GL_RG16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RG,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_GREEN },
|
||||
@@ -1165,6 +1254,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16G16_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -1173,6 +1263,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g16a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_G16] = {
|
||||
.name = "G16",
|
||||
.alpha = GDK_MEMORY_ALPHA_OPAQUE,
|
||||
.premultiplied = GDK_MEMORY_G16,
|
||||
.straight = GDK_MEMORY_G16,
|
||||
@@ -1189,6 +1280,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_ONE },
|
||||
@@ -1196,6 +1288,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = DRM_FORMAT_R16,
|
||||
@@ -1204,6 +1297,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = g16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A8] = {
|
||||
.name = "A8",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A8,
|
||||
.straight = GDK_MEMORY_A8,
|
||||
@@ -1217,6 +1311,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R8,
|
||||
.internal_gles_format = GL_R8,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_BYTE,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1224,6 +1319,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R8_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -1232,6 +1328,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a8_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A16] = {
|
||||
.name = "A16",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A16,
|
||||
.straight = GDK_MEMORY_A16,
|
||||
@@ -1248,6 +1345,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R16,
|
||||
.internal_gles_format = GL_R16,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_UNSIGNED_SHORT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1255,6 +1353,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16_UNORM,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -1263,6 +1362,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a16_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A16_FLOAT] = {
|
||||
.name = "A16f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A16_FLOAT,
|
||||
.straight = GDK_MEMORY_A16_FLOAT,
|
||||
@@ -1278,6 +1378,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R16F,
|
||||
.internal_gles_format = GL_R16F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_HALF_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1285,6 +1386,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R16_SFLOAT,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -1293,6 +1395,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.from_float = a16_float_from_float,
|
||||
},
|
||||
[GDK_MEMORY_A32_FLOAT] = {
|
||||
.name = "A32f",
|
||||
.alpha = GDK_MEMORY_ALPHA_PREMULTIPLIED,
|
||||
.premultiplied = GDK_MEMORY_A32_FLOAT,
|
||||
.straight = GDK_MEMORY_A32_FLOAT,
|
||||
@@ -1308,6 +1411,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
.gl = {
|
||||
.internal_gl_format = GL_R32F,
|
||||
.internal_gles_format = GL_R32F,
|
||||
.internal_srgb_format = -1,
|
||||
.format = GL_RED,
|
||||
.type = GL_FLOAT,
|
||||
.swizzle = { GL_RED, GL_RED, GL_RED, GL_RED },
|
||||
@@ -1315,6 +1419,7 @@ static const GdkMemoryFormatDescription memory_formats[] = {
|
||||
},
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
.vk_format = VK_FORMAT_R32_SFLOAT,
|
||||
.vk_srgb_format = VK_FORMAT_UNDEFINED,
|
||||
#endif
|
||||
#ifdef HAVE_DMABUF
|
||||
.dmabuf_fourcc = 0,
|
||||
@@ -1509,6 +1614,7 @@ void
|
||||
gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GLint *out_internal_format,
|
||||
GLint *out_internal_srgb_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4])
|
||||
@@ -1517,6 +1623,7 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
*out_internal_format = memory_formats[format].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[format].gl.internal_gl_format;
|
||||
*out_internal_srgb_format = memory_formats[format].gl.internal_srgb_format;
|
||||
*out_format = memory_formats[format].gl.format;
|
||||
*out_type = memory_formats[format].gl.type;
|
||||
memcpy (out_swizzle, memory_formats[format].gl.swizzle, sizeof(GLint) * 4);
|
||||
@@ -1528,6 +1635,8 @@ gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
* @gles: TRUE for GLES, FALSE for GL
|
||||
* @out_actual_format: The actual RGBA format
|
||||
* @out_internal_format: the GL internal format
|
||||
* @out_internal_srgb_format: the GL internal format to use for automatic
|
||||
* sRGB<=>linear conversion
|
||||
* @out_format: the GL format
|
||||
* @out_type: the GL type
|
||||
* @out_swizzle: The swizzle to use
|
||||
@@ -1546,6 +1655,7 @@ gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GdkMemoryFormat *out_actual_format,
|
||||
GLint *out_internal_format,
|
||||
GLint *out_internal_srgb_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4])
|
||||
@@ -1560,6 +1670,7 @@ gdk_memory_format_gl_rgba_format (GdkMemoryFormat format,
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gles_format;
|
||||
else
|
||||
*out_internal_format = memory_formats[actual].gl.internal_gl_format;
|
||||
*out_internal_srgb_format = memory_formats[actual].gl.internal_srgb_format;
|
||||
*out_format = memory_formats[actual].gl.format;
|
||||
*out_type = memory_formats[actual].gl.type;
|
||||
memcpy (out_swizzle, memory_formats[format].gl.rgba_swizzle, sizeof(GLint) * 4);
|
||||
@@ -1613,6 +1724,14 @@ gdk_memory_format_vk_format (GdkMemoryFormat format,
|
||||
return memory_formats[format].vk_format;
|
||||
}
|
||||
|
||||
/* Gets the matching SRGB version of a VkFormat
|
||||
* Returns VK_FORMAT_UNDEFINED if none exists */
|
||||
VkFormat
|
||||
gdk_memory_format_vk_srgb_format (GdkMemoryFormat format)
|
||||
{
|
||||
return memory_formats[format].vk_srgb_format;
|
||||
}
|
||||
|
||||
/* Vulkan version of gdk_memory_format_gl_rgba_format()
|
||||
* Returns VK_FORMAT_UNDEFINED on failure */
|
||||
VkFormat
|
||||
@@ -1661,6 +1780,12 @@ gdk_memory_format_get_dmabuf_fourcc (GdkMemoryFormat format)
|
||||
#endif
|
||||
}
|
||||
|
||||
const char *
|
||||
gdk_memory_format_get_name (GdkMemoryFormat format)
|
||||
{
|
||||
return memory_formats[format].name;
|
||||
}
|
||||
|
||||
static void
|
||||
premultiply (float *rgba,
|
||||
gsize n)
|
||||
@@ -1708,6 +1833,10 @@ gdk_memory_convert (guchar *dest_data,
|
||||
|
||||
g_assert (dest_format < GDK_MEMORY_N_FORMATS);
|
||||
g_assert (src_format < GDK_MEMORY_N_FORMATS);
|
||||
/* We don't allow overlap here. If you want to do in-place color state conversions,
|
||||
* use gdk_memory_convert_color_state.
|
||||
*/
|
||||
g_assert (dest_data + height * dest_stride < src_data || src_data + height * src_stride < dest_data);
|
||||
|
||||
if (src_format == dest_format)
|
||||
{
|
||||
@@ -1793,3 +1922,201 @@ gdk_memory_convert (guchar *dest_data,
|
||||
|
||||
g_free (tmp);
|
||||
}
|
||||
|
||||
static const guchar srgb_lookup[] = {
|
||||
0, 12, 21, 28, 33, 38, 42, 46, 49, 52, 55, 58, 61, 63, 66, 68,
|
||||
70, 73, 75, 77, 79, 81, 82, 84, 86, 88, 89, 91, 93, 94, 96, 97,
|
||||
99, 100, 102, 103, 104, 106, 107, 109, 110, 111, 112, 114, 115, 116, 117, 118,
|
||||
120, 121, 122, 123, 124, 125, 126, 127, 129, 130, 131, 132, 133, 134, 135, 136,
|
||||
137, 138, 139, 140, 141, 142, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151,
|
||||
151, 152, 153, 154, 155, 156, 157, 157, 158, 159, 160, 161, 161, 162, 163, 164,
|
||||
165, 165, 166, 167, 168, 168, 169, 170, 171, 171, 172, 173, 174, 174, 175, 176,
|
||||
176, 177, 178, 179, 179, 180, 181, 181, 182, 183, 183, 184, 185, 185, 186, 187,
|
||||
187, 188, 189, 189, 190, 191, 191, 192, 193, 193, 194, 194, 195, 196, 196, 197,
|
||||
197, 198, 199, 199, 200, 201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206,
|
||||
207, 208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, 214, 215, 215,
|
||||
216, 217, 217, 218, 218, 219, 219, 220, 220, 221, 221, 222, 222, 223, 223, 224,
|
||||
224, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232,
|
||||
233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 237, 238, 238, 239, 239, 240,
|
||||
240, 241, 241, 242, 242, 243, 243, 244, 244, 245, 245, 245, 246, 246, 247, 247,
|
||||
248, 248, 249, 249, 250, 250, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255
|
||||
};
|
||||
|
||||
static const guchar srgb_inverse_lookup[] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3,
|
||||
3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7,
|
||||
7, 7, 8, 8, 8, 9, 9, 9, 10, 10, 10, 11, 11, 11, 12, 12,
|
||||
13, 13, 13, 14, 14, 15, 15, 16, 16, 16, 17, 17, 18, 18, 19, 19,
|
||||
20, 20, 21, 22, 22, 23, 23, 24, 24, 25, 26, 26, 27, 27, 28, 29,
|
||||
29, 30, 31, 31, 32, 33, 33, 34, 35, 36, 36, 37, 38, 38, 39, 40,
|
||||
41, 42, 42, 43, 44, 45, 46, 47, 47, 48, 49, 50, 51, 52, 53, 54,
|
||||
55, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 70,
|
||||
71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 84, 85, 87, 88,
|
||||
89, 90, 92, 93, 94, 95, 97, 98, 99, 101, 102, 103, 105, 106, 107, 109,
|
||||
110, 112, 113, 114, 116, 117, 119, 120, 122, 123, 125, 126, 128, 129, 131, 132,
|
||||
134, 135, 137, 139, 140, 142, 144, 145, 147, 148, 150, 152, 153, 155, 157, 159,
|
||||
160, 162, 164, 166, 167, 169, 171, 173, 175, 176, 178, 180, 182, 184, 186, 188,
|
||||
190, 192, 193, 195, 197, 199, 201, 203, 205, 207, 209, 211, 213, 215, 218, 220,
|
||||
222, 224, 226, 228, 230, 232, 235, 237, 239, 241, 243, 245, 248, 250, 252, 255
|
||||
};
|
||||
|
||||
static void
|
||||
convert_srgb_to_srgb_linear (guchar *data,
|
||||
gsize n)
|
||||
{
|
||||
for (gsize i = 0; i < n; i++)
|
||||
{
|
||||
guint8 r = data[0];
|
||||
guint8 g = data[1];
|
||||
guint8 b = data[2];
|
||||
guchar a = data[3];
|
||||
float f = a / 255.0;
|
||||
if (a < 255)
|
||||
{
|
||||
r = r / f;
|
||||
g = g / f;
|
||||
b = b / f;
|
||||
}
|
||||
r = srgb_inverse_lookup[r];
|
||||
g = srgb_inverse_lookup[g];
|
||||
b = srgb_inverse_lookup[b];
|
||||
|
||||
data[0] = r * f;
|
||||
data[1] = g * f;
|
||||
data[2] = b * f;
|
||||
data += 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
convert_srgb_linear_to_srgb (guchar *data,
|
||||
gsize n)
|
||||
{
|
||||
for (gsize i = 0; i < n; i++)
|
||||
{
|
||||
guint8 r = data[0];
|
||||
guint8 g = data[1];
|
||||
guint8 b = data[2];
|
||||
guchar a = data[3];
|
||||
float f = a / 255.0;
|
||||
if (a < 255)
|
||||
{
|
||||
r = r / f;
|
||||
g = g / f;
|
||||
b = b / f;
|
||||
}
|
||||
r = srgb_lookup[r];
|
||||
g = srgb_lookup[g];
|
||||
b = srgb_lookup[b];
|
||||
|
||||
data[0] = r * f;
|
||||
data[1] = g * f;
|
||||
data[2] = b * f;
|
||||
data += 4;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
convert_srgb_to_srgb_linear_in_place (guchar *data,
|
||||
gsize stride,
|
||||
gsize width,
|
||||
gsize height)
|
||||
{
|
||||
if (stride == width * 4)
|
||||
{
|
||||
convert_srgb_to_srgb_linear (data, height * width);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (gsize y = 0; y < height; y++)
|
||||
{
|
||||
convert_srgb_to_srgb_linear (data, width);
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
convert_srgb_linear_to_srgb_in_place (guchar *data,
|
||||
gsize stride,
|
||||
gsize width,
|
||||
gsize height)
|
||||
{
|
||||
if (stride == width * 4)
|
||||
{
|
||||
convert_srgb_linear_to_srgb (data, height * width);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (gsize y = 0; y < height; y++)
|
||||
{
|
||||
convert_srgb_linear_to_srgb (data, width);
|
||||
data += stride;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef void (* StepFunc) (float s0, float s1, float s2,
|
||||
float *d0, float *d1, float *d2);
|
||||
|
||||
void
|
||||
gdk_memory_convert_color_state (guchar *data,
|
||||
gsize stride,
|
||||
GdkMemoryFormat format,
|
||||
GdkColorState *src_color_state,
|
||||
GdkColorState *dest_color_state,
|
||||
gsize width,
|
||||
gsize height)
|
||||
{
|
||||
if (format == GDK_MEMORY_B8G8R8A8_PREMULTIPLIED &&
|
||||
src_color_state == GDK_COLOR_STATE_SRGB &&
|
||||
dest_color_state == GDK_COLOR_STATE_SRGB_LINEAR)
|
||||
{
|
||||
convert_srgb_to_srgb_linear_in_place (data, stride, width, height);
|
||||
}
|
||||
else if (format == GDK_MEMORY_B8G8R8A8_PREMULTIPLIED &&
|
||||
src_color_state == GDK_COLOR_STATE_SRGB_LINEAR &&
|
||||
dest_color_state == GDK_COLOR_STATE_SRGB)
|
||||
{
|
||||
convert_srgb_linear_to_srgb_in_place (data, stride, width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* General case, treat it just like gdk_memory_convert */
|
||||
|
||||
const GdkMemoryFormatDescription *desc = &memory_formats[format];
|
||||
StepFunc func;
|
||||
float *tmp;
|
||||
|
||||
if (src_color_state == GDK_COLOR_STATE_SRGB &&
|
||||
dest_color_state == GDK_COLOR_STATE_SRGB_LINEAR)
|
||||
func = gtk_rgb_to_linear_srgb;
|
||||
else if (src_color_state == GDK_COLOR_STATE_SRGB_LINEAR &&
|
||||
dest_color_state == GDK_COLOR_STATE_SRGB)
|
||||
func = gtk_linear_srgb_to_rgb;
|
||||
else
|
||||
return;
|
||||
|
||||
tmp = g_new (float, width * 4);
|
||||
|
||||
for (gsize y = 0; y < height; y++)
|
||||
{
|
||||
desc->to_float (tmp, data, width);
|
||||
|
||||
if (desc->alpha == GDK_MEMORY_ALPHA_PREMULTIPLIED)
|
||||
unpremultiply (tmp, width);
|
||||
|
||||
for (gsize x = 0; x < 4 * width; x += 4)
|
||||
func (tmp[x], tmp[x+1], tmp[x+2], &tmp[x], &tmp[x+1], &tmp[x+2]);
|
||||
|
||||
if (desc->alpha != GDK_MEMORY_ALPHA_STRAIGHT)
|
||||
premultiply (tmp, width);
|
||||
|
||||
desc->from_float (data, tmp, width);
|
||||
data += stride;
|
||||
}
|
||||
|
||||
g_free (tmp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,7 @@ GdkMemoryFormat gdk_memory_depth_get_alpha_format (GdkMemoryDepth
|
||||
void gdk_memory_format_gl_format (GdkMemoryFormat format,
|
||||
gboolean gles,
|
||||
GLint *out_internal_format,
|
||||
GLint *out_internal_srgb_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4]);
|
||||
@@ -64,18 +65,20 @@ gboolean gdk_memory_format_gl_rgba_format (GdkMemoryFormat
|
||||
gboolean gles,
|
||||
GdkMemoryFormat *out_actual_format,
|
||||
GLint *out_internal_format,
|
||||
GLint *out_internal_srgb_format,
|
||||
GLenum *out_format,
|
||||
GLenum *out_type,
|
||||
GLint out_swizzle[4]);
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
VkFormat gdk_memory_format_vk_format (GdkMemoryFormat format,
|
||||
VkComponentMapping *out_swizzle);
|
||||
VkFormat gdk_memory_format_vk_srgb_format (GdkMemoryFormat format);
|
||||
VkFormat gdk_memory_format_vk_rgba_format (GdkMemoryFormat format,
|
||||
GdkMemoryFormat *out_rgba_format,
|
||||
VkComponentMapping *out_swizzle);
|
||||
#endif
|
||||
guint32 gdk_memory_format_get_dmabuf_fourcc (GdkMemoryFormat format);
|
||||
|
||||
const char * gdk_memory_format_get_name (GdkMemoryFormat format);
|
||||
|
||||
void gdk_memory_convert (guchar *dest_data,
|
||||
gsize dest_stride,
|
||||
@@ -85,6 +88,13 @@ void gdk_memory_convert (guchar
|
||||
GdkMemoryFormat src_format,
|
||||
gsize width,
|
||||
gsize height);
|
||||
void gdk_memory_convert_color_state (guchar *data,
|
||||
gsize stride,
|
||||
GdkMemoryFormat format,
|
||||
GdkColorState *src_color_state,
|
||||
GdkColorState *dest_color_state,
|
||||
gsize width,
|
||||
gsize height);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@@ -202,8 +202,7 @@ gdk_memory_texture_new_subtexture (GdkMemoryTexture *source,
|
||||
}
|
||||
|
||||
GdkMemoryTexture *
|
||||
gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
GdkMemoryFormat format)
|
||||
gdk_memory_texture_from_texture (GdkTexture *texture)
|
||||
{
|
||||
GdkTexture *result;
|
||||
GBytes *bytes;
|
||||
@@ -213,21 +212,16 @@ gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), NULL);
|
||||
|
||||
if (GDK_IS_MEMORY_TEXTURE (texture))
|
||||
{
|
||||
GdkMemoryTexture *memtex = GDK_MEMORY_TEXTURE (texture);
|
||||
return g_object_ref (GDK_MEMORY_TEXTURE (texture));
|
||||
|
||||
if (gdk_texture_get_format (texture) == format)
|
||||
return g_object_ref (memtex);
|
||||
}
|
||||
|
||||
stride = texture->width * gdk_memory_format_bytes_per_pixel (format);
|
||||
stride = texture->width * gdk_memory_format_bytes_per_pixel (texture->format);
|
||||
data = g_malloc_n (stride, texture->height);
|
||||
|
||||
gdk_texture_do_download (texture, format, data, stride);
|
||||
gdk_texture_do_download (texture, texture->format, data, stride);
|
||||
bytes = g_bytes_new_take (data, stride * texture->height);
|
||||
result = gdk_memory_texture_new (texture->width,
|
||||
texture->height,
|
||||
format,
|
||||
texture->format,
|
||||
bytes,
|
||||
stride);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
@@ -28,8 +28,7 @@ G_BEGIN_DECLS
|
||||
#define GDK_MEMORY_GDK_PIXBUF_OPAQUE GDK_MEMORY_R8G8B8
|
||||
#define GDK_MEMORY_GDK_PIXBUF_ALPHA GDK_MEMORY_R8G8B8A8
|
||||
|
||||
GdkMemoryTexture * gdk_memory_texture_from_texture (GdkTexture *texture,
|
||||
GdkMemoryFormat format);
|
||||
GdkMemoryTexture * gdk_memory_texture_from_texture (GdkTexture *texture);
|
||||
GdkTexture * gdk_memory_texture_new_subtexture (GdkMemoryTexture *texture,
|
||||
int x,
|
||||
int y,
|
||||
|
||||
@@ -744,3 +744,11 @@ gdk_monitor_set_description (GdkMonitor *monitor,
|
||||
g_object_notify_by_pspec (G_OBJECT (monitor), props[PROP_DESCRIPTION]);
|
||||
}
|
||||
|
||||
#define MM_PER_INCH 25.4
|
||||
|
||||
double
|
||||
gdk_monitor_get_dpi (GdkMonitor *monitor)
|
||||
{
|
||||
return MAX ((monitor->geometry.width * monitor->scale) / (monitor->width_mm / MM_PER_INCH),
|
||||
(monitor->geometry.height * monitor->scale) / (monitor->height_mm / MM_PER_INCH));
|
||||
}
|
||||
|
||||
@@ -76,6 +76,7 @@ void gdk_monitor_set_subpixel_layout (GdkMonitor *monitor,
|
||||
void gdk_monitor_invalidate (GdkMonitor *monitor);
|
||||
void gdk_monitor_set_description (GdkMonitor *monitor,
|
||||
const char *description);
|
||||
double gdk_monitor_get_dpi (GdkMonitor *monitor);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -98,9 +98,9 @@ gdk_rgba_free (GdkRGBA *rgba)
|
||||
* Returns: %TRUE if the @rgba is clear
|
||||
*/
|
||||
gboolean
|
||||
gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||
(gdk_rgba_is_clear) (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
|
||||
return _gdk_rgba_is_clear (rgba);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,9 +115,9 @@ gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||
* Returns: %TRUE if the @rgba is opaque
|
||||
*/
|
||||
gboolean
|
||||
gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
||||
(gdk_rgba_is_opaque) (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha > ((float)0xff00 / (float)0xffff);
|
||||
return _gdk_rgba_is_opaque (rgba);
|
||||
}
|
||||
|
||||
#define SKIP_WHITESPACES(s) while (*(s) == ' ') (s)++;
|
||||
@@ -368,21 +368,10 @@ gdk_rgba_hash (gconstpointer p)
|
||||
* Returns: %TRUE if the two colors compare equal
|
||||
*/
|
||||
gboolean
|
||||
gdk_rgba_equal (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
(gdk_rgba_equal) (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
{
|
||||
const GdkRGBA *rgba1, *rgba2;
|
||||
|
||||
rgba1 = p1;
|
||||
rgba2 = p2;
|
||||
|
||||
if (rgba1->red == rgba2->red &&
|
||||
rgba1->green == rgba2->green &&
|
||||
rgba1->blue == rgba2->blue &&
|
||||
rgba1->alpha == rgba2->alpha)
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
return _gdk_rgba_equal (p1, p2);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -407,10 +396,18 @@ gdk_rgba_equal (gconstpointer p1,
|
||||
*/
|
||||
char *
|
||||
gdk_rgba_to_string (const GdkRGBA *rgba)
|
||||
{
|
||||
return g_string_free (gdk_rgba_print (rgba, g_string_new ("")), FALSE);
|
||||
}
|
||||
|
||||
GString *
|
||||
gdk_rgba_print (const GdkRGBA *rgba,
|
||||
GString *string)
|
||||
{
|
||||
if (rgba->alpha > 0.999)
|
||||
{
|
||||
return g_strdup_printf ("rgb(%d,%d,%d)",
|
||||
g_string_append_printf (string,
|
||||
"rgb(%d,%d,%d)",
|
||||
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
||||
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
||||
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.));
|
||||
@@ -421,12 +418,15 @@ gdk_rgba_to_string (const GdkRGBA *rgba)
|
||||
|
||||
g_ascii_formatd (alpha, G_ASCII_DTOSTR_BUF_SIZE, "%g", CLAMP (rgba->alpha, 0, 1));
|
||||
|
||||
return g_strdup_printf ("rgba(%d,%d,%d,%s)",
|
||||
g_string_append_printf (string,
|
||||
"rgba(%d,%d,%d,%s)",
|
||||
(int)(0.5 + CLAMP (rgba->red, 0., 1.) * 255.),
|
||||
(int)(0.5 + CLAMP (rgba->green, 0., 1.) * 255.),
|
||||
(int)(0.5 + CLAMP (rgba->blue, 0., 1.) * 255.),
|
||||
alpha);
|
||||
}
|
||||
|
||||
return string;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
||||
@@ -43,5 +43,37 @@
|
||||
gboolean gdk_rgba_parser_parse (GtkCssParser *parser,
|
||||
GdkRGBA *rgba);
|
||||
|
||||
#define gdk_rgba_is_clear(rgba) _gdk_rgba_is_clear (rgba)
|
||||
#define gdk_rgba_is_opaque(rgba) _gdk_rgba_is_opaque (rgba)
|
||||
#define gdk_rgba_equal(p1, p2) _gdk_rgba_equal (p1, p2)
|
||||
|
||||
static inline gboolean
|
||||
_gdk_rgba_is_clear (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha < ((float) 0x00ff / (float) 0xffff);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
_gdk_rgba_is_opaque (const GdkRGBA *rgba)
|
||||
{
|
||||
return rgba->alpha > ((float)0xff00 / (float)0xffff);
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
_gdk_rgba_equal (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
{
|
||||
const GdkRGBA *rgba1 = p1;
|
||||
const GdkRGBA *rgba2 = p2;
|
||||
|
||||
return rgba1->red == rgba2->red &&
|
||||
rgba1->green == rgba2->green &&
|
||||
rgba1->blue == rgba2->blue &&
|
||||
rgba1->alpha == rgba2->alpha;
|
||||
}
|
||||
|
||||
GString * gdk_rgba_print (const GdkRGBA *rgba,
|
||||
GString *string);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -48,6 +48,14 @@ gdk_subsurface_class_init (GdkSubsurfaceClass *class)
|
||||
object_class->finalize = gdk_subsurface_finalize;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_parent:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Returns the parent surface of @subsurface.
|
||||
*
|
||||
* Returns: the parent surface
|
||||
*/
|
||||
GdkSurface *
|
||||
gdk_subsurface_get_parent (GdkSubsurface *subsurface)
|
||||
{
|
||||
@@ -108,16 +116,41 @@ insert_subsurface (GdkSubsurface *subsurface,
|
||||
}
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_attach:
|
||||
* @subsurface: the `GdkSubsurface`
|
||||
* @texture: the texture to attach. This typically has to be a `GdkDmabufTexture`
|
||||
* @source: the source rectangle (i.e. the subset of the texture) to display
|
||||
* @dest: the dest rectangle, in application pixels, relative to the parent surface.
|
||||
* It must be integral in application and device pixels, or attaching will fail
|
||||
* @transform: the transform to apply to the texture contents before displaying
|
||||
* @background: (nullable): the background rectangle, in application pixels relative
|
||||
* to the parent surface. This tells GDK to put a black background of this
|
||||
* size below the subsurface. It must be integral in application and device pixels,
|
||||
* or attaching will fail
|
||||
* @above: whether the subsurface should be above its sibling
|
||||
* @sibling: (nullable): the sibling subsurface to stack relative to, or `NULL` to
|
||||
* stack relative to the parent surface
|
||||
*
|
||||
* Attaches content to a subsurface.
|
||||
*
|
||||
* This function takes all the necessary arguments to determine the subsurface
|
||||
* configuration, including its position, size, content, background and stacking.
|
||||
*
|
||||
* Returns: `TRUE` if the attaching succeeded
|
||||
*/
|
||||
gboolean
|
||||
gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
const graphene_rect_t *background,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling)
|
||||
{
|
||||
GdkSurface *parent = subsurface->parent;
|
||||
gboolean result;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), FALSE);
|
||||
@@ -131,6 +164,15 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
g_return_val_if_fail (sibling == NULL || GDK_IS_SUBSURFACE (sibling), FALSE);
|
||||
g_return_val_if_fail (sibling == NULL || sibling->parent == subsurface->parent, FALSE);
|
||||
|
||||
result = GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface,
|
||||
texture,
|
||||
source,
|
||||
dest,
|
||||
transform,
|
||||
background,
|
||||
above,
|
||||
sibling);
|
||||
|
||||
remove_subsurface (subsurface);
|
||||
|
||||
if (sibling)
|
||||
@@ -156,9 +198,17 @@ gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
}
|
||||
}
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->attach (subsurface, texture, source, dest, transform, above, sibling);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_detach:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Hides the subsurface.
|
||||
*
|
||||
* To show it again, you need to call gdk_subsurface_attach().
|
||||
*/
|
||||
void
|
||||
gdk_subsurface_detach (GdkSubsurface *subsurface)
|
||||
{
|
||||
@@ -169,6 +219,14 @@ gdk_subsurface_detach (GdkSubsurface *subsurface)
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->detach (subsurface);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_texture:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Gets the texture that is currently displayed by the subsurface.
|
||||
*
|
||||
* Returns: (nullable): the texture that is displayed
|
||||
*/
|
||||
GdkTexture *
|
||||
gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
||||
{
|
||||
@@ -177,34 +235,91 @@ gdk_subsurface_get_texture (GdkSubsurface *subsurface)
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture (subsurface);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_source_rect:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
* @rect: (out caller-allocates): return location for the rectangle
|
||||
*
|
||||
* Returns the source rect that was specified in the most recent
|
||||
* gdk_subsurface_attach() call for @subsurface.
|
||||
*/
|
||||
void
|
||||
gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source)
|
||||
gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (source != NULL);
|
||||
g_return_if_fail (rect != NULL);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source (subsurface, source);
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_source_rect (subsurface, rect);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_texture_rect:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
* @rect: (out caller-allocates): return location for the rectangle
|
||||
*
|
||||
* Returns the texture rect that was specified in the most recent
|
||||
* gdk_subsurface_attach() call for @subsurface.
|
||||
*/
|
||||
void
|
||||
gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest)
|
||||
gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (dest != NULL);
|
||||
g_return_if_fail (rect != NULL);
|
||||
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_dest (subsurface, dest);
|
||||
GDK_SUBSURFACE_GET_CLASS (subsurface)->get_texture_rect (subsurface, rect);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_is_above_parent:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Returns whether the subsurface is above the parent surface
|
||||
* or below. Note that a subsurface can be above its parent
|
||||
* surface, and still be covered by sibling subsurfaces.
|
||||
*
|
||||
* Returns: `TRUE` if @subsurface is above its parent
|
||||
*/
|
||||
gboolean
|
||||
gdk_subsurface_is_above_parent (GdkSubsurface *subsurface)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), TRUE);
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
|
||||
return subsurface->above_parent;
|
||||
}
|
||||
|
||||
/*< private>
|
||||
* gdk_subsurface_get_sibling:
|
||||
* @subsurface: the `GdkSubsurface`
|
||||
* @above: whether to get the subsurface above
|
||||
*
|
||||
* Returns the subsurface above (or below) @subsurface in
|
||||
* the stacking order.
|
||||
*
|
||||
* Returns: the sibling, or `NULL` if there is none.
|
||||
*/
|
||||
GdkSubsurface *
|
||||
gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
|
||||
gboolean above)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), NULL);
|
||||
|
||||
if (above)
|
||||
return subsurface->sibling_above;
|
||||
else
|
||||
return subsurface->sibling_below;
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_transform:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
*
|
||||
* Returns the transform that was specified in the most recent call to
|
||||
* gdk_subsurface_attach() call for @subsurface.
|
||||
*
|
||||
* Returns: the transform
|
||||
*/
|
||||
GdkTextureTransform
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
||||
{
|
||||
@@ -213,3 +328,45 @@ gdk_subsurface_get_transform (GdkSubsurface *subsurface)
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_transform (subsurface);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_background_rect:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
* @rect: (out caller-allocates): return location for the rectangle
|
||||
*
|
||||
* Obtains the background rect that was specified in the most recent
|
||||
* gdk_subsurface_attach() call for @subsurface.
|
||||
*
|
||||
* Returns: `TRUE` if @subsurface has a background
|
||||
*/
|
||||
gboolean
|
||||
gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_SUBSURFACE (subsurface), FALSE);
|
||||
g_return_val_if_fail (rect != NULL, FALSE);
|
||||
|
||||
return GDK_SUBSURFACE_GET_CLASS (subsurface)->get_background_rect (subsurface, rect);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_subsurface_get_bounds:
|
||||
* @subsurface: a `GdkSubsurface`
|
||||
* @bounds: (out caller-allocates): return location for the bounds
|
||||
*
|
||||
* Returns the bounds of the subsurface.
|
||||
*
|
||||
* The bounds are the union of the texture and background rects.
|
||||
*/
|
||||
void
|
||||
gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *bounds)
|
||||
{
|
||||
graphene_rect_t background;
|
||||
|
||||
g_return_if_fail (GDK_IS_SUBSURFACE (subsurface));
|
||||
g_return_if_fail (bounds != NULL);
|
||||
|
||||
gdk_subsurface_get_texture_rect (subsurface, bounds);
|
||||
if (gdk_subsurface_get_background_rect (subsurface, &background))
|
||||
graphene_rect_union (bounds, &background, bounds);
|
||||
}
|
||||
|
||||
@@ -62,44 +62,53 @@ struct _GdkSubsurfaceClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
||||
gboolean (* attach) (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void (* detach) (GdkSubsurface *subsurface);
|
||||
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
||||
void (* get_source) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void (* get_dest) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
gboolean (* attach) (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
const graphene_rect_t *bg,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void (* detach) (GdkSubsurface *subsurface);
|
||||
GdkTexture * (* get_texture) (GdkSubsurface *subsurface);
|
||||
void (* get_source_rect) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
void (* get_texture_rect) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
GdkTextureTransform
|
||||
(* get_transform) (GdkSubsurface *subsurface);
|
||||
(* get_transform) (GdkSubsurface *subsurface);
|
||||
gboolean (* get_background_rect) (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
};
|
||||
|
||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
GType gdk_subsurface_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||
GdkSurface * gdk_subsurface_get_parent (GdkSubsurface *subsurface);
|
||||
|
||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
||||
void gdk_subsurface_get_source (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *source);
|
||||
void gdk_subsurface_get_dest (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *dest);
|
||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||
gboolean gdk_subsurface_attach (GdkSubsurface *subsurface,
|
||||
GdkTexture *texture,
|
||||
const graphene_rect_t *source,
|
||||
const graphene_rect_t *dest,
|
||||
GdkTextureTransform transform,
|
||||
const graphene_rect_t *background,
|
||||
gboolean above,
|
||||
GdkSubsurface *sibling);
|
||||
void gdk_subsurface_detach (GdkSubsurface *subsurface);
|
||||
GdkTexture * gdk_subsurface_get_texture (GdkSubsurface *subsurface);
|
||||
void gdk_subsurface_get_source_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
void gdk_subsurface_get_texture_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
gboolean gdk_subsurface_is_above_parent (GdkSubsurface *subsurface);
|
||||
GdkSubsurface * gdk_subsurface_get_sibling (GdkSubsurface *subsurface,
|
||||
gboolean above);
|
||||
GdkTextureTransform
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
|
||||
|
||||
gdk_subsurface_get_transform (GdkSubsurface *subsurface);
|
||||
gboolean gdk_subsurface_get_background_rect (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *rect);
|
||||
void gdk_subsurface_get_bounds (GdkSubsurface *subsurface,
|
||||
graphene_rect_t *bounds);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -1148,9 +1148,11 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
|
||||
|
||||
g_return_if_fail (priv->egl_native_window != NULL);
|
||||
|
||||
if (gdk_display_get_egl_config_high_depth (display) == gdk_display_get_egl_config (display))
|
||||
high_depth = FALSE;
|
||||
|
||||
if (priv->egl_surface_high_depth != high_depth &&
|
||||
priv->egl_surface != NULL &&
|
||||
gdk_display_get_egl_config_high_depth (display) != gdk_display_get_egl_config (display))
|
||||
priv->egl_surface != NULL)
|
||||
{
|
||||
gdk_gl_context_clear_current_if_surface (self);
|
||||
eglDestroySurface (gdk_display_get_egl_display (display), priv->egl_surface);
|
||||
@@ -1159,16 +1161,35 @@ gdk_surface_ensure_egl_surface (GdkSurface *self,
|
||||
|
||||
if (priv->egl_surface == NULL)
|
||||
{
|
||||
EGLint attribs[4];
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
if (!high_depth && display->have_egl_gl_colorspace)
|
||||
{
|
||||
attribs[i++] = EGL_GL_COLORSPACE_KHR;
|
||||
attribs[i++] = EGL_GL_COLORSPACE_SRGB_KHR;
|
||||
}
|
||||
g_assert (i < G_N_ELEMENTS (attribs));
|
||||
attribs[i++] = EGL_NONE;
|
||||
|
||||
priv->egl_surface = eglCreateWindowSurface (gdk_display_get_egl_display (display),
|
||||
high_depth ? gdk_display_get_egl_config_high_depth (display)
|
||||
: gdk_display_get_egl_config (display),
|
||||
(EGLNativeWindowType) priv->egl_native_window,
|
||||
NULL);
|
||||
attribs);
|
||||
priv->egl_surface_high_depth = high_depth;
|
||||
self->is_srgb = !high_depth && display->have_egl_gl_colorspace;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_surface_get_gl_is_srgb (GdkSurface *self)
|
||||
{
|
||||
return self->is_srgb;
|
||||
}
|
||||
|
||||
GdkGLContext *
|
||||
gdk_surface_get_paint_gl_context (GdkSurface *surface,
|
||||
GError **error)
|
||||
|
||||
@@ -70,6 +70,7 @@ struct _GdkSurface
|
||||
guint shortcuts_inhibited : 1;
|
||||
guint request_motion : 1;
|
||||
guint has_pointer : 1;
|
||||
guint is_srgb : 1;
|
||||
|
||||
guint request_motion_id;
|
||||
|
||||
@@ -302,6 +303,8 @@ void gdk_surface_ensure_egl_surface (GdkSurface
|
||||
gboolean hdr);
|
||||
gpointer /*EGLSurface*/ gdk_surface_get_egl_surface (GdkSurface *self);
|
||||
|
||||
gboolean gdk_surface_get_gl_is_srgb (GdkSurface *self);
|
||||
|
||||
void gdk_surface_set_widget (GdkSurface *self,
|
||||
gpointer widget);
|
||||
gpointer gdk_surface_get_widget (GdkSurface *self);
|
||||
|
||||
@@ -44,12 +44,20 @@
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
#include "gdkpaintable.h"
|
||||
#include "gdksnapshot.h"
|
||||
#include "gdkcolorstateprivate.h"
|
||||
|
||||
#include <graphene.h>
|
||||
#include "loaders/gdkpngprivate.h"
|
||||
#include "loaders/gdktiffprivate.h"
|
||||
#include "loaders/gdkjpegprivate.h"
|
||||
|
||||
/**
|
||||
* gdk_texture_error_quark:
|
||||
*
|
||||
* Registers an error quark for [class@Gdk.Texture] errors.
|
||||
*
|
||||
* Returns: the error quark
|
||||
**/
|
||||
G_DEFINE_QUARK (gdk-texture-error-quark, gdk_texture_error)
|
||||
|
||||
/* HACK: So we don't need to include any (not-yet-created) GSK or GTK headers */
|
||||
@@ -62,6 +70,7 @@ enum {
|
||||
PROP_0,
|
||||
PROP_WIDTH,
|
||||
PROP_HEIGHT,
|
||||
PROP_COLOR_STATE,
|
||||
|
||||
N_PROPS
|
||||
};
|
||||
@@ -275,6 +284,15 @@ gdk_texture_set_property (GObject *gobject,
|
||||
self->height = g_value_get_int (value);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
if (self->color_state)
|
||||
gdk_color_state_unref (self->color_state);
|
||||
if (g_value_get_boxed (value))
|
||||
self->color_state = gdk_color_state_ref (g_value_get_boxed (value));
|
||||
else
|
||||
self->color_state = GDK_COLOR_STATE_SRGB;
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@@ -299,6 +317,10 @@ gdk_texture_get_property (GObject *gobject,
|
||||
g_value_set_int (value, self->height);
|
||||
break;
|
||||
|
||||
case PROP_COLOR_STATE:
|
||||
g_value_set_boxed (value, self->color_state);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec);
|
||||
break;
|
||||
@@ -337,6 +359,8 @@ gdk_texture_dispose (GObject *object)
|
||||
|
||||
gdk_texture_clear_render_data (self);
|
||||
|
||||
g_clear_pointer (&self->color_state, gdk_color_state_unref);
|
||||
|
||||
G_OBJECT_CLASS (gdk_texture_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@@ -381,12 +405,28 @@ gdk_texture_class_init (GdkTextureClass *klass)
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
/**
|
||||
* GdkTexture:color-state: (attributes org.gtk.Property.get=gdk_texture_get_color_state)
|
||||
*
|
||||
* The color state of the texture.
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
properties[PROP_COLOR_STATE] =
|
||||
g_param_spec_boxed ("color-state", NULL, NULL,
|
||||
GDK_TYPE_COLOR_STATE,
|
||||
G_PARAM_READWRITE |
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
G_PARAM_STATIC_STRINGS |
|
||||
G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_texture_init (GdkTexture *self)
|
||||
{
|
||||
self->color_state = GDK_COLOR_STATE_SRGB;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -563,7 +603,7 @@ gdk_texture_new_from_bytes_internal (GBytes *bytes,
|
||||
{
|
||||
if (gdk_is_png (bytes))
|
||||
{
|
||||
return gdk_load_png (bytes, error);
|
||||
return gdk_load_png (bytes, NULL, error);
|
||||
}
|
||||
else if (gdk_is_jpeg (bytes))
|
||||
{
|
||||
@@ -720,6 +760,23 @@ gdk_texture_get_height (GdkTexture *texture)
|
||||
return texture->height;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_texture_get_color_state: (attributes org.gtk.Method.get_property=color-state)
|
||||
* @texture: a `GdkTexture`
|
||||
*
|
||||
* Returns the color state associsated with @texture.
|
||||
*
|
||||
* Returns: (transfer none): the color state of the `GdkTexture`
|
||||
*
|
||||
* Since: 4.16
|
||||
*/
|
||||
GdkColorState *
|
||||
gdk_texture_get_color_state (GdkTexture *texture)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_TEXTURE (texture), NULL);
|
||||
|
||||
return texture->color_state;
|
||||
}
|
||||
void
|
||||
gdk_texture_do_download (GdkTexture *texture,
|
||||
GdkMemoryFormat format,
|
||||
|
||||
@@ -83,6 +83,9 @@ int gdk_texture_get_height (GdkTexture
|
||||
GDK_AVAILABLE_IN_4_10
|
||||
GdkMemoryFormat gdk_texture_get_format (GdkTexture *self) G_GNUC_PURE;
|
||||
|
||||
GDK_AVAILABLE_IN_4_16
|
||||
GdkColorState * gdk_texture_get_color_state (GdkTexture *self);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gdk_texture_download (GdkTexture *texture,
|
||||
guchar *data,
|
||||
|
||||
@@ -26,6 +26,8 @@ struct _GdkTexture
|
||||
int width;
|
||||
int height;
|
||||
|
||||
GdkColorState *color_state;
|
||||
|
||||
gpointer render_key;
|
||||
gpointer render_data;
|
||||
GDestroyNotify render_notify;
|
||||
|
||||
@@ -767,9 +767,6 @@ gdk_toplevel_titlebar_gesture (GdkToplevel *toplevel,
|
||||
* This function asynchronously obtains a handle for a toplevel surface
|
||||
* that can be passed to other processes.
|
||||
*
|
||||
* When a handle has been obtained, @callback will be called, and can
|
||||
* receive the handle via [method@Gdk.Toplevel.export_handle_finish].
|
||||
*
|
||||
* It is an error to call this function on a surface that is already
|
||||
* exported.
|
||||
*
|
||||
|
||||
@@ -118,9 +118,12 @@ typedef enum
|
||||
|
||||
/**
|
||||
* GdkTitlebarGesture:
|
||||
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK:
|
||||
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK:
|
||||
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK:
|
||||
* @GDK_TITLEBAR_GESTURE_DOUBLE_CLICK: double click gesture
|
||||
* @GDK_TITLEBAR_GESTURE_RIGHT_CLICK: right click gesture
|
||||
* @GDK_TITLEBAR_GESTURE_MIDDLE_CLICK: middle click gesture
|
||||
*
|
||||
* The kind of title bar gesture to emit with
|
||||
* [method@Gdk.Toplevel.titlebar_gesture].
|
||||
*
|
||||
* Since: 4.4
|
||||
*/
|
||||
|
||||
@@ -74,6 +74,7 @@ typedef cairo_rectangle_int_t GdkRectangle;
|
||||
|
||||
/* Forward declarations of commonly used types */
|
||||
typedef struct _GdkRGBA GdkRGBA;
|
||||
typedef struct _GdkColorState GdkColorState;
|
||||
typedef struct _GdkContentFormats GdkContentFormats;
|
||||
typedef struct _GdkContentProvider GdkContentProvider;
|
||||
typedef struct _GdkCursor GdkCursor;
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "gdkdmabuffourccprivate.h"
|
||||
#include "gdkdmabuftextureprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdkmemorytexture.h"
|
||||
#include <glib/gi18n-lib.h>
|
||||
#include <math.h>
|
||||
|
||||
@@ -57,6 +59,9 @@ static const GdkDebugKey gsk_vulkan_feature_keys[] = {
|
||||
*
|
||||
* Support for `GdkVulkanContext` is platform-specific and context creation
|
||||
* can fail, returning %NULL context.
|
||||
*
|
||||
* Deprecated: 4.14: GTK does not expose any Vulkan internals. This
|
||||
* struct is a leftover that was accidentally exposed.
|
||||
*/
|
||||
|
||||
typedef struct _GdkVulkanContextPrivate GdkVulkanContextPrivate;
|
||||
@@ -90,6 +95,13 @@ enum {
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
/**
|
||||
* gdk_vulkan_error_quark:
|
||||
*
|
||||
* Registers an error quark for [class@Gdk.VulkanContext] errors.
|
||||
*
|
||||
* Returns: the error quark
|
||||
**/
|
||||
G_DEFINE_QUARK (gdk-vulkan-error-quark, gdk_vulkan_error)
|
||||
|
||||
static guint signals[LAST_SIGNAL] = { 0 };
|
||||
@@ -603,7 +615,8 @@ physical_device_check_features (VkPhysicalDevice device)
|
||||
features |= GDK_VULKAN_FEATURE_YCBCR;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME) &&
|
||||
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME))
|
||||
physical_device_supports_extension (device, VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME) &&
|
||||
physical_device_supports_extension (device, VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME))
|
||||
features |= GDK_VULKAN_FEATURE_DMABUF;
|
||||
|
||||
if (physical_device_supports_extension (device, VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME))
|
||||
@@ -628,33 +641,54 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||
{
|
||||
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
VkResult acquire_result;
|
||||
guint i;
|
||||
|
||||
if (depth != priv->current_format)
|
||||
{
|
||||
if (priv->formats[depth].gdk_format != priv->formats[priv->current_format].gdk_format)
|
||||
{
|
||||
GdkMemoryDepth old_format = priv->current_format;
|
||||
GError *error = NULL;
|
||||
|
||||
priv->current_format = depth;
|
||||
if (!gdk_vulkan_context_check_swapchain (context, &error))
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
priv->current_format = old_format;
|
||||
return;
|
||||
}
|
||||
}
|
||||
priv->current_format = depth;
|
||||
}
|
||||
for (i = 0; i < priv->n_images; i++)
|
||||
{
|
||||
cairo_region_union (priv->regions[i], region);
|
||||
}
|
||||
|
||||
GDK_VK_CHECK (vkAcquireNextImageKHR, gdk_vulkan_context_get_device (context),
|
||||
priv->swapchain,
|
||||
UINT64_MAX,
|
||||
priv->draw_semaphore,
|
||||
VK_NULL_HANDLE,
|
||||
&priv->draw_index);
|
||||
acquire_next_image:
|
||||
acquire_result = GDK_VK_CHECK (vkAcquireNextImageKHR, gdk_vulkan_context_get_device (context),
|
||||
priv->swapchain,
|
||||
UINT64_MAX,
|
||||
priv->draw_semaphore,
|
||||
VK_NULL_HANDLE,
|
||||
&priv->draw_index);
|
||||
if ((acquire_result == VK_ERROR_OUT_OF_DATE_KHR) ||
|
||||
(acquire_result == VK_SUBOPTIMAL_KHR))
|
||||
{
|
||||
GError *error = NULL;
|
||||
|
||||
GDK_DEBUG (VULKAN, "Recreating the swapchain");
|
||||
|
||||
if (!gdk_vulkan_context_check_swapchain (context, &error))
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
g_error_free (error);
|
||||
return;
|
||||
}
|
||||
|
||||
goto acquire_next_image;
|
||||
}
|
||||
|
||||
cairo_region_union (region, priv->regions[priv->draw_index]);
|
||||
}
|
||||
@@ -850,7 +884,9 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
switch ((int) formats[i].format)
|
||||
{
|
||||
case VK_FORMAT_B8G8R8A8_UNORM:
|
||||
if (priv->formats[GDK_MEMORY_U8].vk_format.format == VK_FORMAT_UNDEFINED)
|
||||
case VK_FORMAT_B8G8R8A8_SRGB:
|
||||
if (priv->formats[GDK_MEMORY_U8].vk_format.format == VK_FORMAT_UNDEFINED ||
|
||||
priv->formats[GDK_MEMORY_U8].vk_format.format == VK_FORMAT_B8G8R8A8_UNORM)
|
||||
{
|
||||
priv->formats[GDK_MEMORY_U8].vk_format = formats[i];
|
||||
priv->formats[GDK_MEMORY_U8].gdk_format = GDK_MEMORY_B8G8R8A8_PREMULTIPLIED;
|
||||
@@ -859,7 +895,9 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
break;
|
||||
|
||||
case VK_FORMAT_R8G8B8A8_UNORM:
|
||||
if (priv->formats[GDK_MEMORY_U8].vk_format.format == VK_FORMAT_UNDEFINED)
|
||||
case VK_FORMAT_R8G8B8A8_SRGB:
|
||||
if (priv->formats[GDK_MEMORY_U8].vk_format.format == VK_FORMAT_UNDEFINED ||
|
||||
priv->formats[GDK_MEMORY_U8].vk_format.format == VK_FORMAT_R8G8B8A8_UNORM)
|
||||
{
|
||||
priv->formats[GDK_MEMORY_U8].vk_format = formats[i];
|
||||
priv->formats[GDK_MEMORY_U8].gdk_format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||
@@ -1107,6 +1145,7 @@ gdk_display_load_pipeline_cache (GdkDisplay *display)
|
||||
static gboolean
|
||||
gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
||||
{
|
||||
G_GNUC_UNUSED gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
|
||||
GError *error = NULL;
|
||||
VkDevice device;
|
||||
VkPipelineCache cache;
|
||||
@@ -1121,14 +1160,13 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
||||
GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, NULL);
|
||||
if (size == 0)
|
||||
return TRUE;
|
||||
|
||||
|
||||
if (size == display->vk_pipeline_cache_size)
|
||||
{
|
||||
GDK_DEBUG (VULKAN, "pipeline cache size (%zu bytes) unchanged, skipping save", size);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
data = g_malloc (size);
|
||||
if (GDK_VK_CHECK (vkGetPipelineCacheData, device, cache, &size, data) != VK_SUCCESS)
|
||||
{
|
||||
@@ -1148,7 +1186,7 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
||||
|
||||
file = gdk_vulkan_get_pipeline_cache_file (display);
|
||||
|
||||
GDK_DEBUG (VULKAN, "Saving pipeline cache to %s", g_file_peek_path (file));
|
||||
GDK_DEBUG (VULKAN, "Saving pipeline cache of size %lu to %s", size, g_file_peek_path (file));
|
||||
|
||||
if (!g_file_replace_contents (file,
|
||||
data,
|
||||
@@ -1163,7 +1201,7 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
||||
if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_WRONG_ETAG))
|
||||
{
|
||||
VkPipelineCache new_cache;
|
||||
|
||||
|
||||
GDK_DEBUG (VULKAN, "Pipeline cache file modified, merging into current");
|
||||
new_cache = gdk_display_load_pipeline_cache (display);
|
||||
if (new_cache)
|
||||
@@ -1190,10 +1228,15 @@ gdk_vulkan_save_pipeline_cache (GdkDisplay *display)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gdk_profiler_end_markf (begin_time,
|
||||
"Save Vulkan pipeline cache", "%s size %lu",
|
||||
g_file_peek_path (file), size);
|
||||
|
||||
g_object_unref (file);
|
||||
g_free (data);
|
||||
g_free (display->vk_pipeline_cache_etag);
|
||||
display->vk_pipeline_cache_etag = etag;
|
||||
display->vk_pipeline_cache_size = size;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -1233,6 +1276,11 @@ gdk_display_create_pipeline_cache (GdkDisplay *display)
|
||||
},
|
||||
NULL,
|
||||
&display->vk_pipeline_cache);
|
||||
GDK_DEBUG (VULKAN, "Creating empty pipeline cache");
|
||||
}
|
||||
else
|
||||
{
|
||||
GDK_DEBUG (VULKAN, "Loading pipeline cache (%lu bytes)", display->vk_pipeline_cache_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1254,6 +1302,15 @@ gdk_vulkan_context_get_image_format (GdkVulkanContext *context)
|
||||
return priv->formats[priv->current_format].vk_format.format;
|
||||
}
|
||||
|
||||
GdkMemoryFormat
|
||||
gdk_vulkan_context_get_memory_format (GdkVulkanContext *context)
|
||||
{
|
||||
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_VULKAN_CONTEXT (context), GDK_MEMORY_DEFAULT);
|
||||
|
||||
return priv->formats[priv->current_format].gdk_format;
|
||||
}
|
||||
/**
|
||||
* gdk_vulkan_context_get_n_images:
|
||||
* @context: a `GdkVulkanContext`
|
||||
@@ -1342,6 +1399,7 @@ static gboolean
|
||||
gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
uint32_t i, j, k;
|
||||
const char *override;
|
||||
gboolean list_devices;
|
||||
@@ -1484,6 +1542,7 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME);
|
||||
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME);
|
||||
g_ptr_array_add (device_extensions, (gpointer) VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME);
|
||||
@@ -1550,6 +1609,8 @@ gdk_display_create_vulkan_device (GdkDisplay *display,
|
||||
"Hum, what? This should not happen.")));
|
||||
}
|
||||
|
||||
gdk_profiler_end_mark (start_time, "Create Vulkan device", NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@@ -1588,6 +1649,7 @@ static gboolean
|
||||
gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
GError **error)
|
||||
{
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
uint32_t i;
|
||||
GPtrArray *used_extensions;
|
||||
GPtrArray *used_layers;
|
||||
@@ -1749,6 +1811,8 @@ gdk_display_create_vulkan_instance (GdkDisplay *display,
|
||||
|
||||
display->vk_shader_modules = g_hash_table_new (g_str_hash, g_str_equal);
|
||||
|
||||
gdk_profiler_end_mark (start_time, "Create Vulkan instance", NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -1819,8 +1883,9 @@ gdk_display_unref_vulkan (GdkDisplay *display)
|
||||
{
|
||||
g_free (key);
|
||||
vkDestroyShaderModule (display->vk_device,
|
||||
value,
|
||||
*((VkShaderModule *)value),
|
||||
NULL);
|
||||
g_free (value);
|
||||
}
|
||||
g_hash_table_unref (display->vk_shader_modules);
|
||||
|
||||
@@ -1948,13 +2013,13 @@ VkShaderModule
|
||||
gdk_display_get_vk_shader_module (GdkDisplay *self,
|
||||
const char *resource_name)
|
||||
{
|
||||
VkShaderModule shader;
|
||||
VkShaderModule *shader;
|
||||
GError *error = NULL;
|
||||
GBytes *bytes;
|
||||
|
||||
shader = g_hash_table_lookup (self->vk_shader_modules, resource_name);
|
||||
if (shader)
|
||||
return shader;
|
||||
return *shader;
|
||||
|
||||
bytes = g_resources_lookup_data (resource_name, 0, &error);
|
||||
if (bytes == NULL)
|
||||
@@ -1964,6 +2029,7 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
shader = g_new0 (VkShaderModule, 1);
|
||||
if (GDK_VK_CHECK (vkCreateShaderModule, self->vk_device,
|
||||
&(VkShaderModuleCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO,
|
||||
@@ -1971,18 +2037,20 @@ gdk_display_get_vk_shader_module (GdkDisplay *self,
|
||||
.pCode = (uint32_t *) g_bytes_get_data (bytes, NULL),
|
||||
},
|
||||
NULL,
|
||||
&shader) == VK_SUCCESS)
|
||||
shader) == VK_SUCCESS)
|
||||
{
|
||||
g_hash_table_insert (self->vk_shader_modules, g_strdup (resource_name), shader);
|
||||
}
|
||||
else
|
||||
{
|
||||
shader = VK_NULL_HANDLE;
|
||||
g_free (shader);
|
||||
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
return shader;
|
||||
return *shader;
|
||||
}
|
||||
|
||||
#else /* GDK_RENDERING_VULKAN */
|
||||
|
||||
@@ -94,6 +94,7 @@ VkDevice gdk_vulkan_context_get_device (GdkVulk
|
||||
VkQueue gdk_vulkan_context_get_queue (GdkVulkanContext *context);
|
||||
uint32_t gdk_vulkan_context_get_queue_family_index (GdkVulkanContext *context);
|
||||
VkFormat gdk_vulkan_context_get_image_format (GdkVulkanContext *context);
|
||||
GdkMemoryFormat gdk_vulkan_context_get_memory_format (GdkVulkanContext *context);
|
||||
uint32_t gdk_vulkan_context_get_n_images (GdkVulkanContext *context);
|
||||
VkImage gdk_vulkan_context_get_image (GdkVulkanContext *context,
|
||||
guint id);
|
||||
|
||||
@@ -127,15 +127,18 @@ png_simple_warning_callback (png_structp png,
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
/* {{{ Public API */
|
||||
/* {{{ Public API */
|
||||
|
||||
GdkTexture *
|
||||
gdk_load_png (GBytes *bytes,
|
||||
GError **error)
|
||||
gdk_load_png (GBytes *bytes,
|
||||
GHashTable *options,
|
||||
GError **error)
|
||||
{
|
||||
png_io io;
|
||||
png_struct *png = NULL;
|
||||
png_info *info;
|
||||
png_textp text;
|
||||
int num_texts;
|
||||
guint width, height;
|
||||
gsize i, stride;
|
||||
int depth, color_type;
|
||||
@@ -297,6 +300,17 @@ gdk_load_png (GBytes *bytes,
|
||||
texture = gdk_memory_texture_new (width, height, format, out_bytes, stride);
|
||||
g_bytes_unref (out_bytes);
|
||||
|
||||
if (options && png_get_text (png, info, &text, &num_texts))
|
||||
{
|
||||
for (i = 0; i < num_texts; i++)
|
||||
{
|
||||
if (text->compression != -1)
|
||||
continue;
|
||||
|
||||
g_hash_table_insert (options, g_strdup (text->key), g_strdup (text->text));
|
||||
}
|
||||
}
|
||||
|
||||
g_free (row_pointers);
|
||||
png_destroy_read_struct (&png, &info, NULL);
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define PNG_SIGNATURE "\x89PNG"
|
||||
|
||||
GdkTexture *gdk_load_png (GBytes *bytes,
|
||||
GHashTable *options,
|
||||
GError **error);
|
||||
|
||||
GBytes *gdk_save_png (GdkTexture *texture);
|
||||
|
||||
@@ -161,7 +161,8 @@ void _gdk_macos_display_send_event (GdkMacosDisp
|
||||
void _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
||||
int x,
|
||||
int y);
|
||||
NSEvent *_gdk_macos_display_get_nsevent (GdkEvent *event);
|
||||
NSEvent *_gdk_macos_display_get_matching_nsevent (GdkEvent *event);
|
||||
NSEvent *_gdk_macos_display_get_exact_nsevent (GdkEvent *event);
|
||||
NSEvent *_gdk_macos_display_get_last_nsevent (void);
|
||||
GdkDrag *_gdk_macos_display_find_drag (GdkMacosDisplay *self,
|
||||
NSInteger sequence_number);
|
||||
|
||||
@@ -77,6 +77,9 @@ gdk_macos_display_get_setting (GdkDisplay *display,
|
||||
const char *setting,
|
||||
GValue *value)
|
||||
{
|
||||
if (gdk_display_get_debug_flags (display) & GDK_DEBUG_DEFAULT_SETTINGS)
|
||||
return FALSE;
|
||||
|
||||
return _gdk_macos_display_get_setting (GDK_MACOS_DISPLAY (display), setting, value);
|
||||
}
|
||||
|
||||
@@ -991,17 +994,41 @@ _gdk_macos_display_warp_pointer (GdkMacosDisplay *self,
|
||||
CGWarpMouseCursorPosition ((CGPoint) { x, y });
|
||||
}
|
||||
|
||||
/* Find the matching `NSEvent` for an `GdkEvent`. This function
|
||||
* return the `NSEvent`, also for rewritten `GdkEvent`'s.
|
||||
*/
|
||||
NSEvent *
|
||||
_gdk_macos_display_get_nsevent (GdkEvent *event)
|
||||
_gdk_macos_display_get_matching_nsevent (GdkEvent *event)
|
||||
{
|
||||
for (const GList *iter = event_map.head; iter; iter = iter->next)
|
||||
for (GList *iter = event_map.head; iter; iter = iter->next)
|
||||
{
|
||||
const GdkToNSEventMap *map = iter->data;
|
||||
GdkToNSEventMap *map = iter->data;
|
||||
|
||||
if (map->gdk_event->event_type == event->event_type &&
|
||||
map->gdk_event->device == event->device &&
|
||||
map->gdk_event->time == event->time)
|
||||
return map->nsevent;
|
||||
{
|
||||
return map->nsevent;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Find the matching `NSEvent` for the original `GdkEvent`.
|
||||
* If an event was rewritten, it returns `NULL`.
|
||||
*/
|
||||
NSEvent *
|
||||
_gdk_macos_display_get_exact_nsevent (GdkEvent *event)
|
||||
{
|
||||
for (GList *iter = event_map.head; iter; iter = iter->next)
|
||||
{
|
||||
GdkToNSEventMap *map = iter->data;
|
||||
|
||||
if (map->gdk_event == event)
|
||||
{
|
||||
return map->nsevent;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -96,12 +96,12 @@ _gdk_macos_drag_surface_constructed (GObject *object)
|
||||
defer:NO
|
||||
screen:screen];
|
||||
|
||||
_gdk_macos_surface_set_native (self, window);
|
||||
|
||||
[window setOpaque:NO];
|
||||
[window setBackgroundColor:[NSColor clearColor]];
|
||||
[window setDecorated:NO];
|
||||
|
||||
_gdk_macos_surface_set_native (self, window);
|
||||
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||
g_object_unref (frame_clock);
|
||||
|
||||
@@ -738,7 +738,7 @@ gdk_macos_event_source_dispatch (GSource *source,
|
||||
|
||||
if (!handled)
|
||||
{
|
||||
NSEvent *nsevent = _gdk_macos_display_get_nsevent (event);
|
||||
NSEvent *nsevent = _gdk_macos_display_get_exact_nsevent (event);
|
||||
if (nsevent != NULL)
|
||||
[NSApp sendEvent: nsevent];
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
||||
GdkRectangle bounds;
|
||||
GdkRectangle final_rect;
|
||||
int x, y;
|
||||
int shadow_left, shadow_right, shadow_top, shadow_bottom;
|
||||
|
||||
g_assert (GDK_IS_MACOS_POPUP_SURFACE (self));
|
||||
g_assert (layout != NULL);
|
||||
@@ -68,10 +69,19 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
|
||||
monitor = _gdk_macos_surface_get_best_monitor (GDK_MACOS_SURFACE (self));
|
||||
gdk_macos_monitor_get_workarea (monitor, &bounds);
|
||||
|
||||
gdk_popup_layout_get_shadow_width (layout,
|
||||
&shadow_left,
|
||||
&shadow_right,
|
||||
&shadow_top,
|
||||
&shadow_bottom);
|
||||
|
||||
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
|
||||
width,
|
||||
height,
|
||||
0, 0, 0, 0, /* shadow-left/right/top/bottom */
|
||||
shadow_left,
|
||||
shadow_right,
|
||||
shadow_top,
|
||||
shadow_bottom,
|
||||
monitor,
|
||||
&bounds,
|
||||
self->layout,
|
||||
@@ -306,14 +316,14 @@ _gdk_macos_popup_surface_constructed (GObject *object)
|
||||
defer:NO
|
||||
screen:screen];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
[window setOpaque:NO];
|
||||
[window setBackgroundColor:[NSColor clearColor]];
|
||||
[window setDecorated:NO];
|
||||
[window setExcludedFromWindowsMenu:YES];
|
||||
[window setLevel:NSPopUpMenuWindowLevel];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
gdk_surface_set_frame_clock (surface, gdk_surface_get_frame_clock (surface->parent));
|
||||
|
||||
GDK_END_MACOS_ALLOC_POOL;
|
||||
|
||||
@@ -591,11 +591,11 @@ _gdk_macos_toplevel_surface_constructed (GObject *object)
|
||||
defer:NO
|
||||
screen:screen];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
/* Allow NSWindow to go fullscreen */
|
||||
[window setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
|
||||
|
||||
_gdk_macos_surface_set_native (GDK_MACOS_SURFACE (self), window);
|
||||
|
||||
frame_clock = _gdk_frame_clock_idle_new ();
|
||||
gdk_surface_set_frame_clock (surface, frame_clock);
|
||||
g_object_unref (frame_clock);
|
||||
|
||||
@@ -61,7 +61,7 @@ gdk_macos_deps = [
|
||||
libgdk_c_args += ['-xobjective-c']
|
||||
|
||||
libgdk_macos = static_library('gdk-macos',
|
||||
gdk_macos_sources, gdkconfig, gdkenum_h,
|
||||
sources: [ gdk_macos_sources, gdk_gen_headers ],
|
||||
include_directories: [ confinc, gdkinc, ],
|
||||
c_args: [ libgdk_c_args, common_cflags, ],
|
||||
link_with: [],
|
||||
|
||||
@@ -6,6 +6,7 @@ gdk_public_sources = files([
|
||||
'gdkcairo.c',
|
||||
'gdkcairocontext.c',
|
||||
'gdkclipboard.c',
|
||||
'gdkcolorstate.c',
|
||||
'gdkcontentdeserializer.c',
|
||||
'gdkcontentformats.c',
|
||||
'gdkcontentprovider.c',
|
||||
@@ -75,6 +76,7 @@ gdk_public_headers = files([
|
||||
'gdkcairo.h',
|
||||
'gdkcairocontext.h',
|
||||
'gdkclipboard.h',
|
||||
'gdkcolorstate.h',
|
||||
'gdkcontentdeserializer.h',
|
||||
'gdkcontentformats.h',
|
||||
'gdkcontentprovider.h',
|
||||
@@ -128,8 +130,8 @@ install_headers(gdk_deprecated_headers, subdir: 'gtk-4.0/gdk/deprecated')
|
||||
gdk_sources = gdk_public_sources + gdk_deprecated_sources
|
||||
|
||||
gdk_private_h_sources = files([
|
||||
'gdkeventsprivate.h',
|
||||
'gdkdevicetoolprivate.h',
|
||||
'gdkeventsprivate.h',
|
||||
'gdkhslaprivate.h',
|
||||
'gdkmonitorprivate.h',
|
||||
'gdkseatdefaultprivate.h',
|
||||
@@ -202,7 +204,13 @@ gdkwayland_inc = include_directories('wayland')
|
||||
wlinc = include_directories('.')
|
||||
win32rcinc = include_directories('win32/rc')
|
||||
|
||||
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros_h, gdk_visibility_h]
|
||||
gdk_gen_headers = [
|
||||
gdkenum_h,
|
||||
gdkmarshal_h,
|
||||
gdkconfig,
|
||||
gdkversionmacros_h,
|
||||
gdk_visibility_h,
|
||||
]
|
||||
|
||||
gdk_deps = [
|
||||
libm,
|
||||
@@ -278,7 +286,7 @@ if gdk_backends.length() == 0
|
||||
endif
|
||||
|
||||
libgdk = static_library('gdk',
|
||||
sources: [gdk_sources, gdk_backends_gen_headers, gdkconfig],
|
||||
sources: [gdk_sources, gdk_backends_gen_headers, gdk_gen_headers],
|
||||
dependencies: gdk_deps + [libgtk_css_dep],
|
||||
link_with: [libgtk_css],
|
||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||
@@ -290,7 +298,7 @@ libgdk = static_library('gdk',
|
||||
# list the dependencies and generated headers and such, for use in the
|
||||
# "public" libgtk_dep used by internal executables.
|
||||
libgdk_dep = declare_dependency(
|
||||
sources: ['gdk.h', gdkconfig, gdkenum_h],
|
||||
sources: ['gdk.h', gdk_gen_headers],
|
||||
include_directories: [confinc, gdkx11_inc, wlinc],
|
||||
dependencies: gdk_deps + [libgtk_css_dep],
|
||||
)
|
||||
|
||||
@@ -198,17 +198,8 @@ static void
|
||||
gdk_wayland_cairo_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
|
||||
|
||||
if (!impl->has_pending_subsurface_commits)
|
||||
return;
|
||||
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_profiler_add_mark (GDK_PROFILER_CURRENT_TIME, 0, "Wayland surface commit", NULL);
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
gdk_wayland_surface_handle_empty_frame (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -165,25 +165,29 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
double *scale)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
int desired_scale_factor;
|
||||
|
||||
desired_scale_factor = (int) ceil (desired_scale);
|
||||
|
||||
if (gdk_cursor_get_name (cursor))
|
||||
{
|
||||
struct wl_cursor *c;
|
||||
int scale_factor;
|
||||
|
||||
if (g_str_equal (gdk_cursor_get_name (cursor), "none"))
|
||||
goto none;
|
||||
{
|
||||
*hotspot_x = *hotspot_y = 0;
|
||||
*width = *height = 0;
|
||||
*scale = 1;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
scale_factor = (int) ceil (desired_scale);
|
||||
|
||||
c = gdk_wayland_cursor_load_for_name (display,
|
||||
_gdk_wayland_display_get_cursor_theme (display),
|
||||
desired_scale_factor,
|
||||
display->cursor_theme,
|
||||
scale_factor,
|
||||
gdk_cursor_get_name (cursor));
|
||||
if (c && c->image_count > 0)
|
||||
{
|
||||
struct wl_cursor_image *image;
|
||||
int cursor_scale;
|
||||
|
||||
if (image_index >= c->image_count)
|
||||
{
|
||||
@@ -195,23 +199,23 @@ _gdk_wayland_cursor_get_buffer (GdkWaylandDisplay *display,
|
||||
|
||||
image = c->images[image_index];
|
||||
|
||||
cursor_scale = desired_scale_factor;
|
||||
if ((image->width % cursor_scale != 0) ||
|
||||
(image->height % cursor_scale != 0))
|
||||
*width = display->cursor_theme_size;
|
||||
*height = display->cursor_theme_size;
|
||||
*scale = image->width / (double) *width;
|
||||
*hotspot_x = image->hotspot_x / scale_factor;
|
||||
*hotspot_y = image->hotspot_y / scale_factor;
|
||||
|
||||
if (*scale != scale_factor && !use_viewporter)
|
||||
{
|
||||
g_warning (G_STRLOC " cursor image size (%dx%d) not an integer "
|
||||
"multiple of scale (%d)", image->width, image->height,
|
||||
cursor_scale);
|
||||
cursor_scale = 1;
|
||||
g_warning (G_STRLOC " cursor image size (%d) not an integer "
|
||||
"multiple of theme size (%d)", image->width, *width);
|
||||
*width = image->width;
|
||||
*height = image->height;
|
||||
*hotspot_x = image->hotspot_x;
|
||||
*hotspot_y = image->hotspot_y;
|
||||
*scale = 1;
|
||||
}
|
||||
|
||||
*hotspot_x = image->hotspot_x / cursor_scale;
|
||||
*hotspot_y = image->hotspot_y / cursor_scale;
|
||||
|
||||
*width = image->width / cursor_scale;
|
||||
*height = image->height / cursor_scale;
|
||||
*scale = cursor_scale;
|
||||
|
||||
return wl_cursor_image_get_buffer (image);
|
||||
}
|
||||
}
|
||||
@@ -257,7 +261,7 @@ from_texture:
|
||||
else
|
||||
{
|
||||
if (!use_viewporter)
|
||||
*scale = desired_scale_factor;
|
||||
*scale = ceil (desired_scale);
|
||||
else
|
||||
*scale = desired_scale;
|
||||
|
||||
@@ -294,28 +298,23 @@ from_texture:
|
||||
}
|
||||
|
||||
if (gdk_cursor_get_fallback (cursor))
|
||||
return _gdk_wayland_cursor_get_buffer (display,
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
desired_scale,
|
||||
use_viewporter,
|
||||
image_index,
|
||||
hotspot_x, hotspot_y,
|
||||
width, height,
|
||||
scale);
|
||||
{
|
||||
return _gdk_wayland_cursor_get_buffer (display,
|
||||
gdk_cursor_get_fallback (cursor),
|
||||
desired_scale,
|
||||
use_viewporter,
|
||||
image_index,
|
||||
hotspot_x, hotspot_y,
|
||||
width, height,
|
||||
scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = gdk_texture_new_from_resource ("/org/gtk/libgdk/cursor/default");
|
||||
goto from_texture;
|
||||
}
|
||||
|
||||
none:
|
||||
*hotspot_x = 0;
|
||||
*hotspot_y = 0;
|
||||
*width = 0;
|
||||
*height = 0;
|
||||
*scale = 1;
|
||||
|
||||
return NULL;
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
guint
|
||||
|
||||
@@ -97,6 +97,7 @@
|
||||
#define OUTPUT_VERSION_WITH_DONE 2
|
||||
#define NO_XDG_OUTPUT_DONE_SINCE_VERSION 3
|
||||
#define OUTPUT_VERSION 3
|
||||
#define XDG_WM_DIALOG_VERSION 1
|
||||
|
||||
#ifdef HAVE_TOPLEVEL_STATE_SUSPENDED
|
||||
#define XDG_WM_BASE_VERSION 6
|
||||
@@ -105,6 +106,9 @@
|
||||
#endif
|
||||
|
||||
static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland);
|
||||
static void _gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *name,
|
||||
int size);
|
||||
|
||||
G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY)
|
||||
|
||||
@@ -284,93 +288,6 @@ static const struct wl_shm_listener wl_shm_listener = {
|
||||
wl_shm_format
|
||||
};
|
||||
|
||||
static void
|
||||
linux_dmabuf_done (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)
|
||||
{
|
||||
GDK_DEBUG (MISC, "dmabuf feedback done");
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_format_table (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||
int32_t fd,
|
||||
uint32_t size)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = data;
|
||||
|
||||
display_wayland->linux_dmabuf_n_formats = size / 16;
|
||||
display_wayland->linux_dmabuf_formats = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
|
||||
GDK_DEBUG (MISC, "got dmabuf format table (%lu entries)", display_wayland->linux_dmabuf_n_formats);
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_main_device (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||
struct wl_array *device)
|
||||
{
|
||||
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
|
||||
|
||||
GDK_DEBUG (MISC, "got dmabuf main device: %u %u", major (dev), minor (dev));
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_tranche_done (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1)
|
||||
{
|
||||
GDK_DEBUG (MISC, "dmabuf feedback tranche done");
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_tranche_target_device (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||
struct wl_array *device)
|
||||
{
|
||||
dev_t dev G_GNUC_UNUSED = *(dev_t *)device->data;
|
||||
|
||||
GDK_DEBUG (MISC, "got dmabuf tranche target device: %u %u", major (dev), minor (dev));
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_tranche_formats (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||
struct wl_array *indices)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = data;
|
||||
|
||||
GDK_DEBUG (MISC, "got dmabuf tranche formats (%lu entries):", indices->size / sizeof (guint16));
|
||||
guint16 *pos;
|
||||
|
||||
wl_array_for_each (pos, indices)
|
||||
{
|
||||
LinuxDmabufFormat *fmt G_GNUC_UNUSED = &display_wayland->linux_dmabuf_formats[*pos];
|
||||
uint32_t f G_GNUC_UNUSED = fmt->fourcc;
|
||||
uint64_t m G_GNUC_UNUSED = fmt->modifier;
|
||||
GDK_DEBUG (MISC, " %.4s:%#" G_GINT64_MODIFIER "x", (char *) &f, m);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_tranche_flags (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *zwp_linux_dmabuf_feedback_v1,
|
||||
uint32_t flags)
|
||||
{
|
||||
GDK_DEBUG (MISC,
|
||||
"got dmabuf tranche flags: %s",
|
||||
flags & ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT ? "scanout" : "");
|
||||
}
|
||||
|
||||
static const struct zwp_linux_dmabuf_feedback_v1_listener linux_dmabuf_feedback_listener = {
|
||||
linux_dmabuf_done,
|
||||
linux_dmabuf_format_table,
|
||||
linux_dmabuf_main_device,
|
||||
linux_dmabuf_tranche_done,
|
||||
linux_dmabuf_tranche_target_device,
|
||||
linux_dmabuf_tranche_formats,
|
||||
linux_dmabuf_tranche_flags,
|
||||
};
|
||||
|
||||
static void
|
||||
server_decoration_manager_default_mode (void *data,
|
||||
struct org_kde_kwin_server_decoration_manager *manager,
|
||||
@@ -437,7 +354,7 @@ gdk_registry_handle_global (void *data,
|
||||
{
|
||||
display_wayland->compositor =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&wl_compositor_interface, MIN (version, 5));
|
||||
&wl_compositor_interface, MIN (version, 6));
|
||||
}
|
||||
else if (strcmp (interface, "wl_shm") == 0)
|
||||
{
|
||||
@@ -447,12 +364,14 @@ gdk_registry_handle_global (void *data,
|
||||
}
|
||||
else if (strcmp (interface, "zwp_linux_dmabuf_v1") == 0 && version >= 4)
|
||||
{
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback;
|
||||
|
||||
display_wayland->linux_dmabuf =
|
||||
wl_registry_bind (display_wayland->wl_registry, id, &zwp_linux_dmabuf_v1_interface, version);
|
||||
display_wayland->linux_dmabuf_feedback =
|
||||
zwp_linux_dmabuf_v1_get_default_feedback (display_wayland->linux_dmabuf);
|
||||
zwp_linux_dmabuf_feedback_v1_add_listener (display_wayland->linux_dmabuf_feedback,
|
||||
&linux_dmabuf_feedback_listener, display_wayland);
|
||||
feedback = zwp_linux_dmabuf_v1_get_default_feedback (display_wayland->linux_dmabuf);
|
||||
display_wayland->dmabuf_formats_info = dmabuf_formats_info_new (GDK_DISPLAY (display_wayland),
|
||||
"default",
|
||||
feedback);
|
||||
_gdk_wayland_display_async_roundtrip (display_wayland);
|
||||
}
|
||||
else if (strcmp (interface, "xdg_wm_base") == 0)
|
||||
@@ -464,6 +383,13 @@ gdk_registry_handle_global (void *data,
|
||||
{
|
||||
display_wayland->zxdg_shell_v6_id = id;
|
||||
}
|
||||
else if (strcmp (interface, "xdg_wm_dialog_v1") == 0)
|
||||
{
|
||||
display_wayland->xdg_wm_dialog =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&xdg_wm_dialog_v1_interface,
|
||||
MIN (version, XDG_WM_DIALOG_VERSION));
|
||||
}
|
||||
else if (strcmp (interface, "gtk_shell1") == 0)
|
||||
{
|
||||
display_wayland->gtk_shell =
|
||||
@@ -606,7 +532,13 @@ gdk_registry_handle_global (void *data,
|
||||
&wp_presentation_interface,
|
||||
MIN (version, 1));
|
||||
}
|
||||
|
||||
else if (strcmp (interface, wp_single_pixel_buffer_manager_v1_interface.name) == 0)
|
||||
{
|
||||
display_wayland->single_pixel_buffer =
|
||||
wl_registry_bind (display_wayland->wl_registry, id,
|
||||
&wp_single_pixel_buffer_manager_v1_interface,
|
||||
MIN (version, 1));
|
||||
}
|
||||
|
||||
g_hash_table_insert (display_wayland->known_globals,
|
||||
GUINT_TO_POINTER (id), g_strdup (interface));
|
||||
@@ -817,10 +749,9 @@ gdk_wayland_display_dispose (GObject *object)
|
||||
g_clear_pointer (&display_wayland->fractional_scale, wp_fractional_scale_manager_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->viewporter, wp_viewporter_destroy);
|
||||
g_clear_pointer (&display_wayland->presentation, wp_presentation_destroy);
|
||||
g_clear_pointer (&display_wayland->single_pixel_buffer, wp_single_pixel_buffer_manager_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->linux_dmabuf, zwp_linux_dmabuf_v1_destroy);
|
||||
g_clear_pointer (&display_wayland->linux_dmabuf_feedback, zwp_linux_dmabuf_feedback_v1_destroy);
|
||||
if (display_wayland->linux_dmabuf_formats)
|
||||
munmap (display_wayland->linux_dmabuf_formats, display_wayland->linux_dmabuf_n_formats * 16);
|
||||
g_clear_pointer (&display_wayland->dmabuf_formats_info, dmabuf_formats_info_free);
|
||||
|
||||
g_clear_pointer (&display_wayland->shm, wl_shm_destroy);
|
||||
g_clear_pointer (&display_wayland->wl_registry, wl_registry_destroy);
|
||||
@@ -1122,7 +1053,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
display_class->get_monitors = gdk_wayland_display_get_monitors;
|
||||
display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface;
|
||||
display_class->get_setting = gdk_wayland_display_get_setting;
|
||||
display_class->set_cursor_theme = gdk_wayland_display_set_cursor_theme;
|
||||
display_class->set_cursor_theme = _gdk_wayland_display_set_cursor_theme;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1195,11 +1126,22 @@ get_cursor_theme (GdkWaylandDisplay *display_wayland,
|
||||
* @size: the size to use for cursors
|
||||
*
|
||||
* Sets the cursor theme for the given @display.
|
||||
*
|
||||
* Deprecated: 4.16: Use the cursor-related properties of
|
||||
* [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme
|
||||
*/
|
||||
void
|
||||
gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *name,
|
||||
int size)
|
||||
{
|
||||
_gdk_wayland_display_set_cursor_theme (display, name, size);
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_wayland_display_set_cursor_theme (GdkDisplay *display,
|
||||
const char *name,
|
||||
int size)
|
||||
{
|
||||
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display);
|
||||
struct wl_cursor_theme *theme;
|
||||
@@ -1268,7 +1210,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland)
|
||||
else
|
||||
name = "default";
|
||||
|
||||
gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||
_gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size);
|
||||
g_value_unset (&v);
|
||||
|
||||
gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL);
|
||||
@@ -1804,6 +1746,7 @@ static TranslationEntry translations[] = {
|
||||
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
||||
{ FALSE, "org.gnome.desktop.interface", "font-hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
||||
{ FALSE, "org.gnome.desktop.interface", "font-rgba-order", "gtk-xft-rgba", G_TYPE_NONE, { .i = 0 } },
|
||||
{ FALSE, "org.gnome.desktop.interface", "font-rendering", "gtk-font-rendering", G_TYPE_ENUM, { .i = 0 } },
|
||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "antialiasing", "gtk-xft-antialias", G_TYPE_NONE, { .i = 1 } },
|
||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hinting", G_TYPE_NONE, { .i = 1 } },
|
||||
{ FALSE, "org.gnome.settings-daemon.plugins.xsettings", "hinting", "gtk-xft-hintstyle", G_TYPE_NONE, { .i = 1 } },
|
||||
@@ -1895,6 +1838,7 @@ apply_portal_setting (TranslationEntry *entry,
|
||||
entry->fallback.s = g_intern_string (g_variant_get_string (value, NULL));
|
||||
break;
|
||||
case G_TYPE_INT:
|
||||
case G_TYPE_ENUM:
|
||||
entry->fallback.i = g_variant_get_int32 (value);
|
||||
break;
|
||||
case G_TYPE_BOOLEAN:
|
||||
@@ -2144,6 +2088,9 @@ set_value_from_entry (GdkDisplay *display,
|
||||
case G_TYPE_BOOLEAN:
|
||||
g_value_set_boolean (value, entry->fallback.b);
|
||||
break;
|
||||
case G_TYPE_ENUM:
|
||||
g_value_set_enum (value, entry->fallback.i);
|
||||
break;
|
||||
case G_TYPE_NONE:
|
||||
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
||||
g_value_set_uint (value, (guint)entry->fallback.i);
|
||||
@@ -2194,6 +2141,11 @@ set_value_from_entry (GdkDisplay *display,
|
||||
? g_settings_get_boolean (settings, entry->key)
|
||||
: entry->fallback.b);
|
||||
break;
|
||||
case G_TYPE_ENUM:
|
||||
g_value_set_enum (value, settings && entry->valid
|
||||
? g_settings_get_enum (settings, entry->key)
|
||||
: entry->fallback.i);
|
||||
break;
|
||||
case G_TYPE_NONE:
|
||||
if (g_str_equal (entry->setting, "gtk-fontconfig-timestamp"))
|
||||
g_value_set_uint (value, (guint)entry->fallback.i);
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include <gdk/wayland/fractional-scale-v1-client-protocol.h>
|
||||
#include <gdk/wayland/viewporter-client-protocol.h>
|
||||
#include <gdk/wayland/presentation-time-client-protocol.h>
|
||||
#include <gdk/wayland/single-pixel-buffer-v1-client-protocol.h>
|
||||
#include <gdk/wayland/xdg-dialog-v1-client-protocol.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdkkeys.h>
|
||||
@@ -48,6 +50,7 @@
|
||||
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkwaylanddevice.h"
|
||||
#include "gdkdmabuf-wayland-private.h"
|
||||
#include "cursor/wayland-cursor.h"
|
||||
|
||||
#include <epoxy/egl.h>
|
||||
@@ -72,13 +75,6 @@ typedef enum _GdkWaylandShellVariant
|
||||
GDK_WAYLAND_SHELL_VARIANT_ZXDG_SHELL_V6
|
||||
} GdkWaylandShellVariant;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t fourcc;
|
||||
uint32_t padding;
|
||||
uint64_t modifier;
|
||||
} LinuxDmabufFormat;
|
||||
|
||||
struct _GdkWaylandDisplay
|
||||
{
|
||||
GdkDisplay parent_instance;
|
||||
@@ -104,11 +100,10 @@ struct _GdkWaylandDisplay
|
||||
struct wl_compositor *compositor;
|
||||
struct wl_shm *shm;
|
||||
struct zwp_linux_dmabuf_v1 *linux_dmabuf;
|
||||
struct zwp_linux_dmabuf_feedback_v1 *linux_dmabuf_feedback;
|
||||
gsize linux_dmabuf_n_formats;
|
||||
LinuxDmabufFormat *linux_dmabuf_formats;
|
||||
DmabufFormatsInfo *dmabuf_formats_info;
|
||||
struct xdg_wm_base *xdg_wm_base;
|
||||
struct zxdg_shell_v6 *zxdg_shell_v6;
|
||||
struct xdg_wm_dialog_v1 *xdg_wm_dialog;
|
||||
struct gtk_shell1 *gtk_shell;
|
||||
struct wl_data_device_manager *data_device_manager;
|
||||
struct wl_subcompositor *subcompositor;
|
||||
@@ -127,6 +122,7 @@ struct _GdkWaylandDisplay
|
||||
struct wp_fractional_scale_manager_v1 *fractional_scale;
|
||||
struct wp_viewporter *viewporter;
|
||||
struct wp_presentation *presentation;
|
||||
struct wp_single_pixel_buffer_manager_v1 *single_pixel_buffer;
|
||||
|
||||
GList *async_roundtrips;
|
||||
|
||||
|
||||
77
gdk/wayland/gdkdmabuf-wayland-private.h
Normal file
77
gdk/wayland/gdkdmabuf-wayland-private.h
Normal file
@@ -0,0 +1,77 @@
|
||||
/*
|
||||
* gdkdmabuf-wayland.h
|
||||
*
|
||||
* Copyright 2023 Red Hat, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library 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
|
||||
* Library General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-egl.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <gdk/gdkkeys.h>
|
||||
#include <gdk/gdksurface.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint32_t fourcc;
|
||||
uint32_t padding;
|
||||
uint64_t modifier;
|
||||
} DmabufFormat;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
dev_t target_device;
|
||||
guint32 flags;
|
||||
gsize n_formats;
|
||||
DmabufFormat *formats;
|
||||
} DmabufTranche;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
dev_t main_device;
|
||||
GPtrArray *tranches;
|
||||
} DmabufFormats;
|
||||
|
||||
typedef struct DmabufFormatsInfo DmabufFormatsInfo;
|
||||
|
||||
struct DmabufFormatsInfo
|
||||
{
|
||||
GdkDisplay *display;
|
||||
char *name;
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback;
|
||||
|
||||
gsize n_dmabuf_formats;
|
||||
DmabufFormat *dmabuf_format_table;
|
||||
|
||||
DmabufFormats *dmabuf_formats;
|
||||
DmabufFormats *pending_dmabuf_formats;
|
||||
DmabufTranche *pending_tranche;
|
||||
};
|
||||
|
||||
DmabufFormatsInfo * dmabuf_formats_info_new (GdkDisplay *display,
|
||||
const char *name,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback);
|
||||
|
||||
void dmabuf_formats_info_free (DmabufFormatsInfo *info);
|
||||
|
||||
G_END_DECLS
|
||||
241
gdk/wayland/gdkdmabuf-wayland.c
Normal file
241
gdk/wayland/gdkdmabuf-wayland.c
Normal file
@@ -0,0 +1,241 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkdmabuf-wayland-private.h"
|
||||
|
||||
#include "gdkdebugprivate.h"
|
||||
#include "gdkdmabufformatsprivate.h"
|
||||
#include "gdkdmabufformatsbuilderprivate.h"
|
||||
#include "gdkdmabufformatsprivate.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/sysmacros.h>
|
||||
|
||||
#include "linux-dmabuf-unstable-v1-client-protocol.h"
|
||||
|
||||
|
||||
static DmabufTranche *
|
||||
dmabuf_tranche_new (void)
|
||||
{
|
||||
return g_new0 (DmabufTranche, 1);
|
||||
}
|
||||
|
||||
static void
|
||||
dmabuf_tranche_free (DmabufTranche *tranche)
|
||||
{
|
||||
g_free (tranche->formats);
|
||||
g_free (tranche);
|
||||
}
|
||||
|
||||
static DmabufFormats *
|
||||
dmabuf_formats_new (void)
|
||||
{
|
||||
DmabufFormats *formats;
|
||||
|
||||
formats = g_new0 (DmabufFormats, 1);
|
||||
formats->tranches = g_ptr_array_new_with_free_func ((GDestroyNotify) dmabuf_tranche_free);
|
||||
|
||||
return formats;
|
||||
}
|
||||
|
||||
static void
|
||||
dmabuf_formats_free (DmabufFormats *formats)
|
||||
{
|
||||
g_ptr_array_unref (formats->tranches);
|
||||
g_free (formats);
|
||||
}
|
||||
|
||||
static void
|
||||
update_dmabuf_formats (DmabufFormatsInfo *info)
|
||||
{
|
||||
DmabufFormats *formats = info->dmabuf_formats;
|
||||
|
||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||
"dmabuf format table (%lu entries)", info->n_dmabuf_formats);
|
||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||
"dmabuf main device: %u %u",
|
||||
major (formats->main_device),
|
||||
minor (formats->main_device));
|
||||
|
||||
for (gsize i = 0; i < formats->tranches->len; i++)
|
||||
{
|
||||
DmabufTranche *tranche = g_ptr_array_index (formats->tranches, i);
|
||||
|
||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||
"dmabuf tranche target device: %u %u",
|
||||
major (tranche->target_device),
|
||||
minor (tranche->target_device));
|
||||
|
||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||
"dmabuf%s tranche (%lu entries):",
|
||||
tranche->flags & ZWP_LINUX_DMABUF_FEEDBACK_V1_TRANCHE_FLAGS_SCANOUT ? " scanout" : "",
|
||||
tranche->n_formats);
|
||||
|
||||
for (gsize j = 0; j < tranche->n_formats; j++)
|
||||
{
|
||||
GDK_DISPLAY_DEBUG (info->display, MISC,
|
||||
" %.4s:%#" G_GINT64_MODIFIER "x",
|
||||
(char *) &(tranche->formats[j].fourcc),
|
||||
tranche->formats[j].modifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_done (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback)
|
||||
{
|
||||
DmabufFormatsInfo *info = data;
|
||||
|
||||
g_clear_pointer (&info->dmabuf_formats, dmabuf_formats_free);
|
||||
|
||||
info->dmabuf_formats = info->pending_dmabuf_formats;
|
||||
info->pending_dmabuf_formats = NULL;
|
||||
|
||||
update_dmabuf_formats (info);
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_format_table (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||
int32_t fd,
|
||||
uint32_t size)
|
||||
{
|
||||
DmabufFormatsInfo *info = data;
|
||||
|
||||
if (info->dmabuf_formats)
|
||||
munmap (info->dmabuf_formats, sizeof (DmabufFormat) * info->n_dmabuf_formats);
|
||||
|
||||
info->n_dmabuf_formats = size / 16;
|
||||
info->dmabuf_format_table = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_main_device (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||
struct wl_array *device)
|
||||
{
|
||||
DmabufFormatsInfo *info = data;
|
||||
dev_t dev;
|
||||
|
||||
memcpy (&dev, device->data, sizeof (dev_t));
|
||||
|
||||
g_assert (info->pending_dmabuf_formats == NULL);
|
||||
|
||||
info->pending_dmabuf_formats = dmabuf_formats_new ();
|
||||
info->pending_dmabuf_formats->main_device = dev;
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_tranche_done (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback)
|
||||
{
|
||||
DmabufFormatsInfo *info = data;
|
||||
|
||||
g_ptr_array_add (info->pending_dmabuf_formats->tranches,
|
||||
info->pending_tranche);
|
||||
|
||||
info->pending_tranche = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_tranche_target_device (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||
struct wl_array *device)
|
||||
{
|
||||
DmabufFormatsInfo *info = data;
|
||||
dev_t dev;
|
||||
DmabufTranche *tranche;
|
||||
|
||||
memcpy (&dev, device->data, sizeof (dev_t));
|
||||
|
||||
g_assert (info->pending_tranche == NULL);
|
||||
|
||||
tranche = dmabuf_tranche_new ();
|
||||
tranche->target_device = dev;
|
||||
|
||||
info->pending_tranche = tranche;
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_tranche_formats (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||
struct wl_array *indices)
|
||||
{
|
||||
DmabufFormatsInfo *info = data;
|
||||
DmabufTranche *tranche;
|
||||
int i;
|
||||
guint16 *pos;
|
||||
|
||||
g_assert (info->pending_tranche != NULL);
|
||||
tranche = info->pending_tranche;
|
||||
|
||||
tranche->n_formats = indices->size / sizeof (guint16);
|
||||
tranche->formats = g_new (DmabufFormat, tranche->n_formats);
|
||||
|
||||
i = 0;
|
||||
wl_array_for_each (pos, indices)
|
||||
{
|
||||
tranche->formats[i++] = info->dmabuf_format_table[*pos];
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
linux_dmabuf_tranche_flags (void *data,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback,
|
||||
uint32_t flags)
|
||||
{
|
||||
DmabufFormatsInfo *info = data;
|
||||
DmabufTranche *tranche;
|
||||
|
||||
g_assert (info->pending_tranche != NULL);
|
||||
tranche = info->pending_tranche;
|
||||
tranche->flags = flags;
|
||||
}
|
||||
|
||||
static const struct zwp_linux_dmabuf_feedback_v1_listener feedback_listener = {
|
||||
linux_dmabuf_done,
|
||||
linux_dmabuf_format_table,
|
||||
linux_dmabuf_main_device,
|
||||
linux_dmabuf_tranche_done,
|
||||
linux_dmabuf_tranche_target_device,
|
||||
linux_dmabuf_tranche_formats,
|
||||
linux_dmabuf_tranche_flags,
|
||||
};
|
||||
|
||||
DmabufFormatsInfo *
|
||||
dmabuf_formats_info_new (GdkDisplay *display,
|
||||
const char *name,
|
||||
struct zwp_linux_dmabuf_feedback_v1 *feedback)
|
||||
{
|
||||
DmabufFormatsInfo *info;
|
||||
|
||||
info = g_new0 (DmabufFormatsInfo, 1);
|
||||
|
||||
info->display = display;
|
||||
info->name = g_strdup (name);
|
||||
info->feedback = feedback;
|
||||
|
||||
if (info->feedback)
|
||||
zwp_linux_dmabuf_feedback_v1_add_listener (info->feedback,
|
||||
&feedback_listener, info);
|
||||
|
||||
return info;
|
||||
}
|
||||
|
||||
void
|
||||
dmabuf_formats_info_free (DmabufFormatsInfo *info)
|
||||
{
|
||||
g_free (info->name);
|
||||
g_clear_pointer (&info->feedback, zwp_linux_dmabuf_feedback_v1_destroy);
|
||||
if (info->dmabuf_format_table)
|
||||
{
|
||||
munmap (info->dmabuf_format_table, info->n_dmabuf_formats * 16);
|
||||
info->dmabuf_format_table = NULL;
|
||||
}
|
||||
g_clear_pointer (&info->dmabuf_formats, dmabuf_formats_free);
|
||||
g_clear_pointer (&info->pending_dmabuf_formats, dmabuf_formats_free);
|
||||
g_clear_pointer (&info->pending_tranche, dmabuf_tranche_free);
|
||||
|
||||
g_free (info);
|
||||
}
|
||||
@@ -88,14 +88,7 @@ gdk_wayland_gl_context_empty_frame (GdkDrawContext *draw_context)
|
||||
{
|
||||
GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
|
||||
|
||||
if (gdk_wayland_surface_needs_commit (surface))
|
||||
{
|
||||
gdk_wayland_surface_sync (surface);
|
||||
gdk_wayland_surface_request_frame (surface);
|
||||
|
||||
gdk_wayland_surface_commit (surface);
|
||||
gdk_wayland_surface_notify_committed (surface);
|
||||
}
|
||||
gdk_wayland_surface_handle_empty_frame (surface);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -131,7 +131,7 @@ guint _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
|
||||
guint *next_image_delay);
|
||||
|
||||
void gdk_wayland_surface_sync (GdkSurface *surface);
|
||||
gboolean gdk_wayland_surface_needs_commit (GdkSurface *surface);
|
||||
void gdk_wayland_surface_handle_empty_frame (GdkSurface *surface);
|
||||
void gdk_wayland_surface_commit (GdkSurface *surface);
|
||||
void gdk_wayland_surface_notify_committed (GdkSurface *surface);
|
||||
void gdk_wayland_surface_request_frame (GdkSurface *surface);
|
||||
|
||||
@@ -781,8 +781,8 @@ pointer_handle_motion (void *data,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("motion %f %f, seat %p state %d",
|
||||
x, y, seat, gdk_event_get_modifier_state (event));
|
||||
gdk_debug_message ("motion %f %f, seat %p state %d",
|
||||
x, y, seat, gdk_event_get_modifier_state (event));
|
||||
}
|
||||
|
||||
if (wl_seat_get_version (seat->wl_seat) < WL_POINTER_HAS_FRAME)
|
||||
@@ -1664,7 +1664,7 @@ touch_handle_down (void *data,
|
||||
{
|
||||
double xx, yy;
|
||||
gdk_event_get_position (event, &xx, &yy);
|
||||
g_message ("touch begin %f %f", xx, yy);
|
||||
gdk_debug_message ("touch begin %f %f", xx, yy);
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -1699,7 +1699,7 @@ touch_handle_up (void *data,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("touch end %f %f", x, y);
|
||||
gdk_debug_message ("touch end %f %f", x, y);
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -1747,7 +1747,7 @@ touch_handle_motion (void *data,
|
||||
{
|
||||
double xx, yy;
|
||||
gdk_event_get_position (event, &xx, &yy);
|
||||
g_message ("touch update %f %f", xx, yy);
|
||||
gdk_debug_message ("touch update %f %f", xx, yy);
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -1841,9 +1841,9 @@ emit_gesture_swipe_event (GdkWaylandSeat *seat,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("swipe event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event), x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
gdk_debug_message ("swipe event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event), x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -1936,10 +1936,10 @@ emit_gesture_pinch_event (GdkWaylandSeat *seat,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("pinch event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event),
|
||||
x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
gdk_debug_message ("pinch event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event),
|
||||
x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -2030,10 +2030,10 @@ emit_gesture_hold_event (GdkWaylandSeat *seat,
|
||||
{
|
||||
double x, y;
|
||||
gdk_event_get_position (event, &x, &y);
|
||||
g_message ("hold event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event),
|
||||
x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
gdk_debug_message ("hold event %d, coords: %f %f, seat %p state %d",
|
||||
gdk_event_get_event_type (event),
|
||||
x, y, seat,
|
||||
gdk_event_get_modifier_state (event));
|
||||
}
|
||||
|
||||
_gdk_wayland_display_deliver_event (seat->display, event);
|
||||
@@ -3866,9 +3866,25 @@ pointer_surface_leave (void *data,
|
||||
pointer_surface_update_scale (device);
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_surface_preferred_buffer_scale (void *data,
|
||||
struct wl_surface *wl_surface,
|
||||
int32_t factor)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
pointer_surface_preferred_buffer_transform (void *data,
|
||||
struct wl_surface *wl_surface,
|
||||
uint32_t transform)
|
||||
{
|
||||
}
|
||||
|
||||
static const struct wl_surface_listener pointer_surface_listener = {
|
||||
pointer_surface_enter,
|
||||
pointer_surface_leave
|
||||
pointer_surface_leave,
|
||||
pointer_surface_preferred_buffer_scale,
|
||||
pointer_surface_preferred_buffer_transform,
|
||||
};
|
||||
|
||||
static void
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user