Compare commits
583 Commits
ebassi/set
...
4.5.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdea3ed979 | ||
|
|
dd7cbb6bb5 | ||
|
|
13defc7ceb | ||
|
|
61d9874ebc | ||
|
|
207437a6ee | ||
|
|
f7c39ae089 | ||
|
|
f1fbd363f8 | ||
|
|
206d7635f7 | ||
|
|
1fa350267f | ||
|
|
9962ef9ac4 | ||
|
|
c97a758aa7 | ||
|
|
68eb601194 | ||
|
|
cadeca27de | ||
|
|
af2d0f188c | ||
|
|
c11a43418e | ||
|
|
d7d4cef66d | ||
|
|
9b71bbac3a | ||
|
|
ac8c4245b2 | ||
|
|
d726ecdb5d | ||
|
|
41919158cc | ||
|
|
4ea84d3144 | ||
|
|
3744cb24e2 | ||
|
|
a6cbeba5f6 | ||
|
|
4cda2aec57 | ||
|
|
33470fd872 | ||
|
|
75bba2b055 | ||
|
|
c953e3cc0f | ||
|
|
83319a3ea6 | ||
|
|
516dc79605 | ||
|
|
2aa2b7f61e | ||
|
|
0053160f28 | ||
|
|
2ac8132499 | ||
|
|
7aa34cb3d2 | ||
|
|
3aee23c172 | ||
|
|
bec9141233 | ||
|
|
131683fdcf | ||
|
|
8176b0c2fc | ||
|
|
513fe87391 | ||
|
|
a07e1bf336 | ||
|
|
ae117d0cfa | ||
|
|
a4e83ec584 | ||
|
|
373ca2389a | ||
|
|
b2f9a907ce | ||
|
|
2b2fd23815 | ||
|
|
2113a18a18 | ||
|
|
1606a41116 | ||
|
|
438bf8596e | ||
|
|
b912e84df7 | ||
|
|
3c9c7a0e72 | ||
|
|
82c0654f76 | ||
|
|
cb3eae1042 | ||
|
|
3dcda782ce | ||
|
|
1d387b5d45 | ||
|
|
74329abf29 | ||
|
|
0afae65c8a | ||
|
|
350a5edb87 | ||
|
|
c11bd57422 | ||
|
|
883b2223c1 | ||
|
|
0898023e6b | ||
|
|
869d2f281a | ||
|
|
cb03fe8f31 | ||
|
|
ea14e94eaf | ||
|
|
2601c39cb2 | ||
|
|
53312cf696 | ||
|
|
9e0494cf4d | ||
|
|
3d536f1293 | ||
|
|
d6f4a0d2cf | ||
|
|
14e6d9555d | ||
|
|
8b02e87529 | ||
|
|
f04e10238b | ||
|
|
e946ee4040 | ||
|
|
46ba4b9d8c | ||
|
|
464f76ce5d | ||
|
|
9965f26d97 | ||
|
|
bf5350e13c | ||
|
|
3742fabae0 | ||
|
|
192e554f3e | ||
|
|
00214cbb4a | ||
|
|
ba44e7a228 | ||
|
|
cad979b734 | ||
|
|
1c5a4de176 | ||
|
|
ad46e65dff | ||
|
|
5dec1b0cc0 | ||
|
|
c80e877c28 | ||
|
|
5ff9f4a435 | ||
|
|
bd1649e5f4 | ||
|
|
b7cab5c5eb | ||
|
|
6067a556d7 | ||
|
|
6a07a853b0 | ||
|
|
886f435fc8 | ||
|
|
96e837ae9f | ||
|
|
bddf9f9ca3 | ||
|
|
5f3062aff0 | ||
|
|
a859471960 | ||
|
|
5b47391162 | ||
|
|
dcba783389 | ||
|
|
7eceed8d4d | ||
|
|
800246402f | ||
|
|
c7e36bcf22 | ||
|
|
79d2a14061 | ||
|
|
085f0171c1 | ||
|
|
e7ac8275ea | ||
|
|
03d4ac1863 | ||
|
|
a61999170e | ||
|
|
beda50f631 | ||
|
|
cf7ee82755 | ||
|
|
f6e5a33952 | ||
|
|
7a50ebaa3f | ||
|
|
aa0c22b648 | ||
|
|
aa258fa17f | ||
|
|
66de8f33fb | ||
|
|
e3ef21f770 | ||
|
|
a7ef4c75ea | ||
|
|
9a2e9c5be4 | ||
|
|
ddc4a40c33 | ||
|
|
52e88ed4c8 | ||
|
|
5199bebdb5 | ||
|
|
31e9072906 | ||
|
|
c2368cc605 | ||
|
|
1e7fb52b21 | ||
|
|
53705a537c | ||
|
|
3481ebdafb | ||
|
|
71eece2f35 | ||
|
|
454ca897bb | ||
|
|
41ca09d645 | ||
|
|
24b7eec687 | ||
|
|
dcbfd61558 | ||
|
|
e98b83dade | ||
|
|
257adb4464 | ||
|
|
7b41738979 | ||
|
|
b65b64628d | ||
|
|
086a3044e3 | ||
|
|
fc32c19ca7 | ||
|
|
d89e82d4a0 | ||
|
|
f40ce51a13 | ||
|
|
e6ae3b8a2b | ||
|
|
dc503897b1 | ||
|
|
49a64da7ec | ||
|
|
922e6add38 | ||
|
|
232003b046 | ||
|
|
cfadca696b | ||
|
|
5311616ca1 | ||
|
|
c7bb4a9678 | ||
|
|
e581c148d9 | ||
|
|
d4959a95c2 | ||
|
|
780ae5232d | ||
|
|
caddea4624 | ||
|
|
27b5dc1452 | ||
|
|
b4ab9f7b8c | ||
|
|
e371bd09c1 | ||
|
|
db167e09c5 | ||
|
|
27573d9576 | ||
|
|
0054f8bd74 | ||
|
|
5c1e402429 | ||
|
|
e974a0412f | ||
|
|
76420d7146 | ||
|
|
f584d4f500 | ||
|
|
8c1f7f7531 | ||
|
|
c6dd3c11fa | ||
|
|
3b9967db48 | ||
|
|
4f53645e5d | ||
|
|
b7eb1d3310 | ||
|
|
222d927e93 | ||
|
|
30164d5b46 | ||
|
|
f868c67429 | ||
|
|
7a1644bc97 | ||
|
|
144f727d5a | ||
|
|
9f1e9b6044 | ||
|
|
70a622ce54 | ||
|
|
0775e21131 | ||
|
|
db37452787 | ||
|
|
c7d6bf733a | ||
|
|
8d9c3920bb | ||
|
|
6f1742970d | ||
|
|
8a24deff97 | ||
|
|
985d2d221c | ||
|
|
9174814686 | ||
|
|
2a08641f59 | ||
|
|
8950c0dc96 | ||
|
|
2e555db9a4 | ||
|
|
3f4fb93379 | ||
|
|
dc6e831524 | ||
|
|
afa004fb8b | ||
|
|
149395c306 | ||
|
|
48781cf7f7 | ||
|
|
db86b3ea2e | ||
|
|
cd2debdfc6 | ||
|
|
cd45e6edee | ||
|
|
4360bc326a | ||
|
|
f819e88e9c | ||
|
|
0969d9db83 | ||
|
|
cdc85232b2 | ||
|
|
5eb42dd9f3 | ||
|
|
7ede468849 | ||
|
|
bc7c0d05f8 | ||
|
|
3ca84c4357 | ||
|
|
2ff1ea555f | ||
|
|
03cc603093 | ||
|
|
64f10eff20 | ||
|
|
111c2769a5 | ||
|
|
482845b027 | ||
|
|
f8b9b309b0 | ||
|
|
d128ffcc14 | ||
|
|
aba37c40d3 | ||
|
|
c8204a902c | ||
|
|
032eb15079 | ||
|
|
70607f56d9 | ||
|
|
bfb158d773 | ||
|
|
ae8de7168a | ||
|
|
9e88275de6 | ||
|
|
3f5107cea5 | ||
|
|
04da2ff7c8 | ||
|
|
9012a032c1 | ||
|
|
38461ee204 | ||
|
|
75370a2fee | ||
|
|
6ec6bcafbf | ||
|
|
e2fb67fdea | ||
|
|
bb5eb3ba55 | ||
|
|
c9ad181ca4 | ||
|
|
289394de30 | ||
|
|
12d4a51679 | ||
|
|
9bd0674672 | ||
|
|
a9c1e1e468 | ||
|
|
42ba6f0a34 | ||
|
|
49603c24ad | ||
|
|
08aa77c243 | ||
|
|
4e6a76e11e | ||
|
|
34037c0550 | ||
|
|
bc086c5a2d | ||
|
|
d939f379f4 | ||
|
|
8079f8ea3c | ||
|
|
f2dbf57104 | ||
|
|
b8622adac5 | ||
|
|
b4bc7983a6 | ||
|
|
f7df384ee1 | ||
|
|
095d531cc6 | ||
|
|
8c227622d7 | ||
|
|
1ddcf7d5c5 | ||
|
|
c93264868b | ||
|
|
5bf1196bd4 | ||
|
|
139aa17af4 | ||
|
|
bfcc2da2ce | ||
|
|
670659bcba | ||
|
|
5f825eb68b | ||
|
|
1efccfcced | ||
|
|
b7ad3bcf96 | ||
|
|
08fd62e328 | ||
|
|
63b73351ae | ||
|
|
a9f401a9a0 | ||
|
|
e9828f1fcd | ||
|
|
169effefc2 | ||
|
|
6339875989 | ||
|
|
802ad39209 | ||
|
|
200a2f5c71 | ||
|
|
d7e117f52b | ||
|
|
72bbc51ba9 | ||
|
|
a816f81ecd | ||
|
|
5c3b368925 | ||
|
|
2a3a1aaf1e | ||
|
|
156650e90a | ||
|
|
bf93537d54 | ||
|
|
f42c61f9d1 | ||
|
|
ce40c64f6b | ||
|
|
f836d2f9f7 | ||
|
|
bdcfb760b5 | ||
|
|
749883835a | ||
|
|
b4d91d5e31 | ||
|
|
dbd0ce30d9 | ||
|
|
a45e1a01fc | ||
|
|
9bff56db9f | ||
|
|
502b3ceaa2 | ||
|
|
01abd1565e | ||
|
|
160aeb4879 | ||
|
|
fd0a5e3c23 | ||
|
|
6f002678be | ||
|
|
da5efea663 | ||
|
|
22ffae1b13 | ||
|
|
62ed3b476d | ||
|
|
4a684a6371 | ||
|
|
18c9727a98 | ||
|
|
e77eaa0ace | ||
|
|
12e8a92608 | ||
|
|
5bc3923bae | ||
|
|
e99ac8f6d8 | ||
|
|
f5db501879 | ||
|
|
8aafee4e35 | ||
|
|
83b434d6a5 | ||
|
|
2c9a2e94c8 | ||
|
|
8f817e67de | ||
|
|
66c80e82ba | ||
|
|
32191bc18e | ||
|
|
c4069fdcee | ||
|
|
b17005ddab | ||
|
|
30a741e6af | ||
|
|
69cf1aa050 | ||
|
|
1b82de1797 | ||
|
|
ec62402908 | ||
|
|
c8f29a689d | ||
|
|
e3ecd5d23e | ||
|
|
eac0e06a7a | ||
|
|
834c72bb0f | ||
|
|
6b86848984 | ||
|
|
68bd94fa25 | ||
|
|
d981694c64 | ||
|
|
4fff68355a | ||
|
|
c79d327b5e | ||
|
|
35abc0725d | ||
|
|
1fab75d789 | ||
|
|
5175b1676b | ||
|
|
fbae56ef45 | ||
|
|
f96c4eb5bb | ||
|
|
9395b28542 | ||
|
|
ef09cbee2f | ||
|
|
5d86f08626 | ||
|
|
ec6a824ef9 | ||
|
|
bbcc818b3d | ||
|
|
7ede54e821 | ||
|
|
b2b7118b8e | ||
|
|
8fba0d209e | ||
|
|
659181f74b | ||
|
|
555993717b | ||
|
|
a29474567a | ||
|
|
279f9aa6d3 | ||
|
|
d4f9d38368 | ||
|
|
47e0539968 | ||
|
|
4e836493cc | ||
|
|
226ecaf9a2 | ||
|
|
bcd9a0141a | ||
|
|
811b5d995b | ||
|
|
c7992884ae | ||
|
|
39f2bb28de | ||
|
|
78d7cb712e | ||
|
|
d61c71c378 | ||
|
|
c317a1b7c4 | ||
|
|
7e48ab4ccd | ||
|
|
2fd0da8788 | ||
|
|
113d546486 | ||
|
|
2c810c747d | ||
|
|
a74d90891a | ||
|
|
381717792b | ||
|
|
610ba1cadf | ||
|
|
e41bf097d0 | ||
|
|
7a82e9f557 | ||
|
|
23acc993cc | ||
|
|
659393049e | ||
|
|
b578c78eff | ||
|
|
d7db3f1546 | ||
|
|
20f6610c61 | ||
|
|
923c944abb | ||
|
|
0b9f6985b1 | ||
|
|
1430142ad8 | ||
|
|
3a5091cb6e | ||
|
|
ece02317b9 | ||
|
|
218a3e3d01 | ||
|
|
d6d7299859 | ||
|
|
5f913e9558 | ||
|
|
a9d7282f00 | ||
|
|
3e20ecd6e1 | ||
|
|
1ef000b1ab | ||
|
|
765e78f72b | ||
|
|
32871f997e | ||
|
|
9fb729ccc0 | ||
|
|
4b582851f7 | ||
|
|
da20c68d48 | ||
|
|
d19f4ad53a | ||
|
|
d17552670c | ||
|
|
6a69b4e475 | ||
|
|
0b4817a1c6 | ||
|
|
e931afdc9b | ||
|
|
7dab5322df | ||
|
|
138fd6f0f3 | ||
|
|
5c3bb42612 | ||
|
|
2c2d03a8d7 | ||
|
|
6474c7af35 | ||
|
|
145a16ff81 | ||
|
|
f079d75d1f | ||
|
|
e1facc548a | ||
|
|
87e4a542eb | ||
|
|
56e6a51ac0 | ||
|
|
da115ad075 | ||
|
|
4a89cfe2c9 | ||
|
|
c9135546b6 | ||
|
|
a94e438a29 | ||
|
|
164443a99a | ||
|
|
d88c4d122d | ||
|
|
d66bc501a4 | ||
|
|
1c2c356ed4 | ||
|
|
1fae91d123 | ||
|
|
24415a6ffb | ||
|
|
ae08aa3622 | ||
|
|
c24b7877a0 | ||
|
|
7b22e37371 | ||
|
|
c2ab1f172d | ||
|
|
136a3f6e5a | ||
|
|
2bc82da34d | ||
|
|
41b810da7f | ||
|
|
155e0f3dfb | ||
|
|
02bb23486f | ||
|
|
bc0d9488ee | ||
|
|
5742483422 | ||
|
|
7f2cb1138a | ||
|
|
1289e68931 | ||
|
|
9e6adaa913 | ||
|
|
9cfce67d0f | ||
|
|
295d406207 | ||
|
|
ece5fd7db5 | ||
|
|
c4e558da46 | ||
|
|
be1a60d5d0 | ||
|
|
a1adaac69b | ||
|
|
7e4b2b971f | ||
|
|
c6cacd2b2d | ||
|
|
2c8e55605b | ||
|
|
06db477847 | ||
|
|
e9cf8c6cc7 | ||
|
|
aad6b2d279 | ||
|
|
cf3830704b | ||
|
|
d962360fa0 | ||
|
|
76d31ff04b | ||
|
|
87af45403a | ||
|
|
15ffd49efb | ||
|
|
37a54eb9fc | ||
|
|
63647cace0 | ||
|
|
bef54a382d | ||
|
|
6a60214e8c | ||
|
|
27d662f1aa | ||
|
|
52a8492887 | ||
|
|
ba5d010e39 | ||
|
|
8c34dd58c0 | ||
|
|
0cce92ab19 | ||
|
|
f95c21b67c | ||
|
|
1d41dc716e | ||
|
|
3914ecbd0f | ||
|
|
0428d8ccd6 | ||
|
|
37a7c6780a | ||
|
|
1b85b5597b | ||
|
|
fae32846c7 | ||
|
|
b271a94f92 | ||
|
|
e58f70d7bb | ||
|
|
4fcf54757f | ||
|
|
b5da07f0e1 | ||
|
|
a85f4ec6c2 | ||
|
|
b226478e8b | ||
|
|
14280b5f5b | ||
|
|
e720f9d35d | ||
|
|
fecb31b706 | ||
|
|
729ad8e64a | ||
|
|
dcd873a6d8 | ||
|
|
679c93e843 | ||
|
|
2d3de8608c | ||
|
|
100b0bf7d9 | ||
|
|
f2ca9ebbd7 | ||
|
|
577bf104c0 | ||
|
|
b1bb7c3258 | ||
|
|
c77b5c46a3 | ||
|
|
5b82cf1145 | ||
|
|
95a0c93839 | ||
|
|
d27bc74481 | ||
|
|
e30b4c61cb | ||
|
|
daf29e174f | ||
|
|
729ba8111a | ||
|
|
d30a029689 | ||
|
|
945c2531ac | ||
|
|
f925e12e1d | ||
|
|
a03594df52 | ||
|
|
d7c8f92733 | ||
|
|
d6ce65f81c | ||
|
|
7949aaabb7 | ||
|
|
a71877bf99 | ||
|
|
f51f7f85eb | ||
|
|
66031fd00b | ||
|
|
698b3542a1 | ||
|
|
83ea623775 | ||
|
|
345faa7250 | ||
|
|
08df891070 | ||
|
|
56b31c3923 | ||
|
|
93323be22a | ||
|
|
9e14de2534 | ||
|
|
62954a0338 | ||
|
|
7cf5e5546b | ||
|
|
58f66ebd07 | ||
|
|
47330598fb | ||
|
|
90ed7b92b2 | ||
|
|
625b5ce91a | ||
|
|
c84d5b1f7f | ||
|
|
46bb160923 | ||
|
|
390a0b2f2a | ||
|
|
0dfab46c15 | ||
|
|
3a8ec683d3 | ||
|
|
de53b0c7a3 | ||
|
|
75dfb4d63b | ||
|
|
64acaf99fb | ||
|
|
551f76ea69 | ||
|
|
a4f3fbbda1 | ||
|
|
b6d3561f4a | ||
|
|
01944d57b7 | ||
|
|
c9aec9b5a2 | ||
|
|
025759e614 | ||
|
|
ed679703b8 | ||
|
|
fe46da1bf4 | ||
|
|
7fd8899092 | ||
|
|
9f8d6ff29c | ||
|
|
1230bce133 | ||
|
|
7c2be93a56 | ||
|
|
eb23e23b03 | ||
|
|
75b45aeabf | ||
|
|
23ffd6923d | ||
|
|
d2eb0288d9 | ||
|
|
a4b976f7a2 | ||
|
|
4930faa984 | ||
|
|
84fdda4f56 | ||
|
|
ec6228b3a4 | ||
|
|
8b85e7f35a | ||
|
|
d7909dccdc | ||
|
|
7773ae4538 | ||
|
|
bec44acdeb | ||
|
|
5bfac597f6 | ||
|
|
423a4d4c3e | ||
|
|
38fce67a9b | ||
|
|
04ef7055cd | ||
|
|
44a031c3c1 | ||
|
|
be885c888f | ||
|
|
6faef4416f | ||
|
|
5f452a5e6c | ||
|
|
060f2d5f65 | ||
|
|
ebca260f2d | ||
|
|
d4b1f85e14 | ||
|
|
4439ff0c12 | ||
|
|
ffab67ac70 | ||
|
|
0120ff3518 | ||
|
|
2e63b53b1e | ||
|
|
878c9da736 | ||
|
|
955d50a080 | ||
|
|
2b4f798e34 | ||
|
|
cda5d2dadd | ||
|
|
b664b2d1fd | ||
|
|
c70fdd6331 | ||
|
|
ddec3dedd0 | ||
|
|
b1a5c3ff55 | ||
|
|
8f9a5175f0 | ||
|
|
099c923679 | ||
|
|
2a12a3e6d9 | ||
|
|
cdc1fa166d | ||
|
|
f572ca52d2 | ||
|
|
193b383739 | ||
|
|
6785461c26 | ||
|
|
b9ee9979e7 | ||
|
|
6bbec87700 | ||
|
|
b35608a351 | ||
|
|
416763bf2d | ||
|
|
9179ebb28e | ||
|
|
bcc17b3033 | ||
|
|
00439f9e5c | ||
|
|
c9d748fc51 | ||
|
|
719eafa60c | ||
|
|
1759d27da9 | ||
|
|
53275481a5 | ||
|
|
cbe6d0da76 | ||
|
|
c349ed9562 | ||
|
|
74ce69a8a1 | ||
|
|
4f17f3ac24 | ||
|
|
9c8e464b04 | ||
|
|
51d0d13a9e | ||
|
|
0ee3b1c861 | ||
|
|
46f88c69a1 | ||
|
|
140976a670 | ||
|
|
9f2b847835 | ||
|
|
9e11ea699c | ||
|
|
1a4eebe022 | ||
|
|
2963468019 | ||
|
|
bfbd95d7d6 | ||
|
|
c1c1d4431d | ||
|
|
155a4fac5c | ||
|
|
76f481eb7b | ||
|
|
0782c8a051 | ||
|
|
3d27ff1177 | ||
|
|
3ada664a89 | ||
|
|
643a91bd08 | ||
|
|
93878da2ca | ||
|
|
3f798dbbcd | ||
|
|
c86733b4fa | ||
|
|
55099b7d0e | ||
|
|
72dc9a21f7 | ||
|
|
bd7b8e87c1 |
32
.editorconfig
Normal file
32
.editorconfig
Normal file
@@ -0,0 +1,32 @@
|
||||
# SPDX-FileCopyrightText: 2021 The GTK Authors
|
||||
# SPDX-License-Identifier: CC0-1.0
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.[ch]]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
# For the legacy tabs which still exist in the code:
|
||||
tab_width = 8
|
||||
|
||||
[*.ui]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
|
||||
[*.xml]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[meson.build]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
|
||||
[*.md]
|
||||
max_line_length = 80
|
||||
@@ -25,7 +25,7 @@ variables:
|
||||
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
|
||||
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
|
||||
MESON_TEST_TIMEOUT_MULTIPLIER: 3
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v33"
|
||||
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v35"
|
||||
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
|
||||
|
||||
.only-default:
|
||||
@@ -91,6 +91,7 @@ fedora-x86_64:
|
||||
- meson compile -C _build_hello
|
||||
- .gitlab-ci/run-tests.sh _build x11
|
||||
- .gitlab-ci/run-tests.sh _build wayland
|
||||
- .gitlab-ci/run-tests.sh _build waylandgles
|
||||
- .gitlab-ci/run-tests.sh _build broadway
|
||||
|
||||
release-build:
|
||||
@@ -157,6 +158,7 @@ msys2-mingw64:
|
||||
CHERE_INVOKING: "yes"
|
||||
|
||||
macos:
|
||||
allow_failure: true
|
||||
extends: .only-default
|
||||
only:
|
||||
- branches@GNOME/gtk
|
||||
|
||||
@@ -53,6 +53,7 @@ RUN dnf -y install \
|
||||
libpng-devel \
|
||||
librsvg2 \
|
||||
libselinux-devel \
|
||||
libtiff-devel \
|
||||
libubsan \
|
||||
libXcomposite-devel \
|
||||
libXcursor-devel \
|
||||
@@ -75,6 +76,7 @@ RUN dnf -y install \
|
||||
pcre-devel \
|
||||
pcre-static \
|
||||
python3 \
|
||||
python3-docutils \
|
||||
python3-gobject \
|
||||
python3-jinja2 \
|
||||
python3-markdown \
|
||||
|
||||
@@ -44,6 +44,24 @@ case "${backend}" in
|
||||
kill ${compositor}
|
||||
;;
|
||||
|
||||
waylandgles)
|
||||
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
|
||||
|
||||
weston --backend=headless-backend.so --socket=wayland-6 --idle-time=0 &
|
||||
compositor=$!
|
||||
export WAYLAND_DISPLAY=wayland-6
|
||||
|
||||
meson test -C ${builddir} \
|
||||
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
|
||||
--print-errorlogs \
|
||||
--setup=${backend} \
|
||||
--suite=gtk \
|
||||
--no-suite=gsk-compare-broadway
|
||||
|
||||
exit_code=$?
|
||||
kill ${compositor}
|
||||
;;
|
||||
|
||||
broadway)
|
||||
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
|
||||
|
||||
@@ -62,6 +80,12 @@ case "${backend}" in
|
||||
exit_code=0
|
||||
kill ${server}
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Failed to add ${backend} to .gitlab-ci/run-tests.sh"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
cd ${builddir}
|
||||
|
||||
112
NEWS
112
NEWS
@@ -1,19 +1,127 @@
|
||||
Overview of Changes
|
||||
===================
|
||||
Overview of Changes in 4.5.0
|
||||
============================
|
||||
|
||||
* gsk:
|
||||
- Drop the GL renderer in favor of NGL
|
||||
- Rename NGL to GL
|
||||
- Fix some coordinate overflow issues
|
||||
- Reimplement texture upload and download for better
|
||||
support of image formats and color spaces
|
||||
- New api:
|
||||
gsk_transform_skew
|
||||
gsk_transform_to_2d_components
|
||||
|
||||
* gdk:
|
||||
- Support HSL in gdk_rgba_parse
|
||||
- Use libpng, libjpeg and libtiff directly when loading
|
||||
textures, and support more image formats (including 16bit
|
||||
and float formats)
|
||||
- New apis:
|
||||
gdk_texture_new_from_bytes
|
||||
gdk_texture_new_from_filename
|
||||
gdk_texture_download_float
|
||||
gdk_texture_save_to_png_bytes
|
||||
gdk_texture_save_to_tiff
|
||||
gdk_texture_save_to_tiff_bytes
|
||||
gdk_display_create_gl_context
|
||||
- Implement GIcon and GLoadableIcon in GdkTexture
|
||||
- Move EGL initialization to the frontend
|
||||
- Use configless EGL contexts, if supported
|
||||
- Use >8bit pixel formats, if supported and requested
|
||||
|
||||
* css:
|
||||
- Add support for line-height
|
||||
- Add support for text-transform
|
||||
|
||||
* theme:
|
||||
- Fixes for buttons in toolbars
|
||||
|
||||
* input:
|
||||
- Update compose sequences from libX11 1.7.2
|
||||
- Accept replacement string longer than 20 characters
|
||||
|
||||
* text:
|
||||
- Implement sloped caret drawing
|
||||
- Add a gtk-hint-font-metrics setting to switch
|
||||
font rendering to be more similar to GTK3
|
||||
|
||||
* GtkTextView:
|
||||
- Add support for line height
|
||||
- Add support for text transforms
|
||||
- Misc fixes for css->pango attribute translations
|
||||
- Invalidate pango contexts when font settings change
|
||||
- Improve undo grouping when overwriting
|
||||
|
||||
* GtkListView:
|
||||
- Make tree indentation more flexible with
|
||||
GtkTreeExpander:indent-for-icon
|
||||
|
||||
* GtkMenuButton:
|
||||
- Support custom children
|
||||
|
||||
* GtkFlowBox:
|
||||
- Add prepend and append
|
||||
|
||||
* GtkCalendar:
|
||||
- Fix handling of weeks starting on Monday
|
||||
|
||||
* GtkWindow:
|
||||
- Add a titlebar property
|
||||
|
||||
* GtkDropDown:
|
||||
- Add a show-arrow property
|
||||
|
||||
* GtkPopoverMenu:
|
||||
- Support a use-markup attribute in menu models
|
||||
|
||||
* Add GtkSymbolicPaintable
|
||||
|
||||
* Tools:
|
||||
- Support DND in gtk4-node-editor and the inspector's recorder
|
||||
|
||||
* Demos:
|
||||
- Improve the font rendering demo
|
||||
|
||||
* Build:
|
||||
- Require Pango 1.49
|
||||
- Require libpng, libtiff and libjpeg
|
||||
- Speed up handling of resources during build
|
||||
|
||||
* X11:
|
||||
- Support touchpad gestures with XInput 2.4
|
||||
|
||||
* Windows:
|
||||
- Fix DND coordinates
|
||||
|
||||
* Translation updates:
|
||||
Basque
|
||||
Brazilian Portuguese
|
||||
Catalan
|
||||
Chinese (China)
|
||||
Croatian
|
||||
Czech
|
||||
Dutch
|
||||
Finnish
|
||||
French
|
||||
Galician
|
||||
German
|
||||
Hebrew
|
||||
Hungarian
|
||||
Icelandic
|
||||
Indonesian
|
||||
Kazakh
|
||||
Korean
|
||||
Latvian
|
||||
Lithuanian
|
||||
Persian
|
||||
Portuguese
|
||||
Romanian
|
||||
Serbian
|
||||
Slovak
|
||||
Spanish
|
||||
Swedish
|
||||
Turkish
|
||||
Ukrainian
|
||||
|
||||
|
||||
Overview of Changes in 4.4.0
|
||||
|
||||
15
README.md
15
README.md
@@ -10,10 +10,12 @@ GTK is a multi-platform toolkit for creating graphical user interfaces.
|
||||
Offering a complete set of widgets, GTK is suitable for projects ranging
|
||||
from small one-off projects to complete application suites.
|
||||
|
||||
GTK is free software and part of the GNU Project. However, the
|
||||
licensing terms for GTK, the GNU LGPL, allow it to be used by all
|
||||
developers, including those developing proprietary software, without any
|
||||
license fees or royalties.
|
||||
GTK is a free and open-source software project. The licensing terms
|
||||
for GTK, the GNU LGPL, allow it to be used by all developers, including those
|
||||
developing proprietary software, without any license fees or royalties.
|
||||
|
||||
GTK is hosted by the GNOME project (thanks!) and used by a wide variety
|
||||
of applications and projects.
|
||||
|
||||
The official download location
|
||||
|
||||
@@ -112,7 +114,7 @@ can be found in the file:
|
||||
docs/reference/gtk/html/gtk-building.html
|
||||
```
|
||||
|
||||
Or [online](https://developer.gnome.org/gtk4/stable/gtk-building.html)
|
||||
Or [online](https://docs.gtk.org/gtk4/building.html)
|
||||
|
||||
How to report bugs
|
||||
------------------
|
||||
@@ -151,6 +153,9 @@ Contributing to GTK
|
||||
Please, follow the [contribution guide](./CONTRIBUTING.md) to know how to
|
||||
start contributing to GTK.
|
||||
|
||||
If you want to support GTK financially, please consider donating to
|
||||
the GNOME project, which runs the infrastructure hosting GTK.
|
||||
|
||||
Release notes
|
||||
-------------
|
||||
|
||||
|
||||
286
config.h.meson
286
config.h.meson
@@ -1,286 +0,0 @@
|
||||
/* always defined to indicate that i18n is enabled */
|
||||
#define ENABLE_NLS 1
|
||||
|
||||
/* Use structured logging */
|
||||
#define G_LOG_STRUCTURED 1
|
||||
|
||||
/* The prefix for our gettext translation domains. */
|
||||
#mesondefine GETTEXT_PACKAGE
|
||||
|
||||
/* Disable deprecation warnings from glib */
|
||||
#mesondefine GLIB_DISABLE_DEPRECATION_WARNINGS
|
||||
|
||||
/* Define the location where the catalogs will be installed */
|
||||
#mesondefine GTK_LOCALEDIR
|
||||
|
||||
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
|
||||
#mesondefine HAVE_BIND_TEXTDOMAIN_CODESET
|
||||
|
||||
/* Have the cloudproviders library */
|
||||
#mesondefine HAVE_CLOUDPROVIDERS
|
||||
|
||||
/* define if we have colord */
|
||||
#mesondefine HAVE_COLORD
|
||||
|
||||
/* Define to 1 if you have the <crt_externs.h> header file. */
|
||||
#mesondefine HAVE_CRT_EXTERNS_H
|
||||
|
||||
/* Define to 1 if you have the `dcgettext' function. */
|
||||
#mesondefine HAVE_DCGETTEXT
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#mesondefine HAVE_DLFCN_H
|
||||
|
||||
/* Have the ffmpeg library */
|
||||
#mesondefine HAVE_FFMPEG
|
||||
|
||||
/* Define to 1 if you have the <ftw.h> header file. */
|
||||
#mesondefine HAVE_FTW_H
|
||||
|
||||
/* Define to 1 if you have the `getpagesize' function. */
|
||||
#mesondefine HAVE_GETPAGESIZE
|
||||
|
||||
/* Define to 1 if you have the `getresuid' function. */
|
||||
#mesondefine HAVE_GETRESUID
|
||||
|
||||
/* Define if gio-unix is available */
|
||||
#mesondefine HAVE_GIO_UNIX
|
||||
|
||||
/* Define if GStreamer support is available */
|
||||
#mesondefine HAVE_GSTREAMER
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#mesondefine HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if the system has the type `IPrintDialogCallback'. */
|
||||
#mesondefine HAVE_IPRINTDIALOGCALLBACK
|
||||
|
||||
/* Define to 1 if you have the <locale.h> header file. */
|
||||
#mesondefine HAVE_LOCALE_H
|
||||
|
||||
/* Define to 1 if you have the `lstat' function. */
|
||||
#mesondefine HAVE_LSTAT
|
||||
|
||||
/* Define to 1 if you have the `mallinfo' function. */
|
||||
#mesondefine HAVE_MALLINFO
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#mesondefine HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `mkstemp' function. */
|
||||
#mesondefine HAVE_MKSTEMP
|
||||
|
||||
/* Define to 1 if you have the `mlock` function. */
|
||||
#mesondefine HAVE_MLOCK
|
||||
|
||||
/* Define to 1 if you have a working `mmap' system call. */
|
||||
#mesondefine HAVE_MMAP
|
||||
|
||||
/* Define to 1 if you have a working `madvise' system call. */
|
||||
#mesondefine HAVE_MADVISE
|
||||
|
||||
/* Define to 1 if you have the `posix_fallocate' function. */
|
||||
#mesondefine HAVE_POSIX_FALLOCATE
|
||||
|
||||
/* Have the Xrandr extension library */
|
||||
#mesondefine HAVE_RANDR
|
||||
|
||||
/* Have the Xrandr 1.5 extension library */
|
||||
#mesondefine HAVE_RANDR15
|
||||
|
||||
/* Define to 1 if you have the `sincos' function. */
|
||||
#mesondefine HAVE_SINCOS
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#mesondefine HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#mesondefine HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#mesondefine HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#mesondefine HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/mman.h> header file. */
|
||||
#mesondefine HAVE_SYS_MMAN_H
|
||||
|
||||
/* Define to 1 if you have the <sys/param.h> header file. */
|
||||
#mesondefine HAVE_SYS_PARAM_H
|
||||
|
||||
/* Have the sysprof-capture library */
|
||||
#mesondefine HAVE_SYSPROF
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#mesondefine HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/time.h> header file. */
|
||||
#mesondefine HAVE_SYS_TIME_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#mesondefine HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#mesondefine HAVE_UNISTD_H
|
||||
|
||||
/* Have the Xcursor library */
|
||||
#mesondefine HAVE_XCURSOR
|
||||
|
||||
/* Have the XDAMAGE X extension */
|
||||
#mesondefine HAVE_XDAMAGE
|
||||
|
||||
/* Have the XFIXES X extension */
|
||||
#mesondefine HAVE_XFIXES
|
||||
|
||||
/* Define to 1 if XFree Xinerama is available */
|
||||
#mesondefine HAVE_XFREE_XINERAMA
|
||||
|
||||
/* Have XGenericEvent */
|
||||
#mesondefine HAVE_XGENERICEVENTS
|
||||
|
||||
/* Define to use XKB extension */
|
||||
#mesondefine HAVE_XKB
|
||||
|
||||
/* Have the SYNC extension library */
|
||||
#mesondefine HAVE_XSYNC
|
||||
|
||||
/* Define to 1 if you have the `_lock_file' function */
|
||||
#mesondefine HAVE__LOCK_FILE
|
||||
|
||||
/* Define to 1 if you have the `flockfile' function */
|
||||
#mesondefine HAVE_FLOCKFILE
|
||||
|
||||
/* Define if _NL_MEASUREMENT_MEASUREMENT is available */
|
||||
#mesondefine HAVE__NL_MEASUREMENT_MEASUREMENT
|
||||
|
||||
/* Define if _NL_PAPER_HEIGHT is available */
|
||||
#mesondefine HAVE__NL_PAPER_HEIGHT
|
||||
|
||||
/* Define if _NL_PAPER_WIDTH is available */
|
||||
#mesondefine HAVE__NL_PAPER_WIDTH
|
||||
|
||||
/* Define if _NL_TIME_FIRST_WEEKDAY is available */
|
||||
#mesondefine HAVE__NL_TIME_FIRST_WEEKDAY
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#mesondefine LT_OBJDIR
|
||||
|
||||
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
|
||||
#mesondefine NO_MINUS_C_MINUS_O
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#mesondefine PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#mesondefine PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#mesondefine PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#mesondefine PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#mesondefine PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#mesondefine PACKAGE_VERSION
|
||||
|
||||
/* Use NSBundle functions to determine load paths for libraries, translations,
|
||||
etc. */
|
||||
#mesondefine QUARTZ_RELOCATION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#mesondefine STDC_HEADERS
|
||||
|
||||
/* Enable extensions on AIX 3, Interix. */
|
||||
#ifndef _ALL_SOURCE
|
||||
# undef _ALL_SOURCE
|
||||
#endif
|
||||
/* Enable GNU extensions on systems that have them. */
|
||||
#ifndef _GNU_SOURCE
|
||||
# undef _GNU_SOURCE
|
||||
#endif
|
||||
/* Enable threading extensions on Solaris. */
|
||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
||||
# undef _POSIX_PTHREAD_SEMANTICS
|
||||
#endif
|
||||
/* Enable extensions on HP NonStop. */
|
||||
#ifndef _TANDEM_SOURCE
|
||||
# undef _TANDEM_SOURCE
|
||||
#endif
|
||||
/* Enable general extensions on Solaris. */
|
||||
#ifndef __EXTENSIONS__
|
||||
# undef __EXTENSIONS__
|
||||
#endif
|
||||
|
||||
|
||||
/* Define to 1 if XInput 2.2 is available */
|
||||
#mesondefine XINPUT_2_2
|
||||
|
||||
/* Define to 1 if the X Window System is missing or not being used. */
|
||||
#mesondefine X_DISPLAY_MISSING
|
||||
|
||||
/* Enable large inode numbers on Mac OS X 10.5. */
|
||||
#ifndef _DARWIN_USE_64_BIT_INODE
|
||||
# define _DARWIN_USE_64_BIT_INODE 1
|
||||
#endif
|
||||
|
||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
||||
#mesondefine _FILE_OFFSET_BITS
|
||||
|
||||
/* defines how to decorate public symbols while building */
|
||||
#mesondefine _GDK_EXTERN
|
||||
|
||||
/* Define for large files, on AIX-style hosts. */
|
||||
#mesondefine _LARGE_FILES
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
#mesondefine _MINIX
|
||||
|
||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
||||
this defined. */
|
||||
#mesondefine _POSIX_1_SOURCE
|
||||
|
||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
||||
#mesondefine _POSIX_SOURCE
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#mesondefine gid_t
|
||||
|
||||
/* Define to `int' if <sys/types.h> doesn't define. */
|
||||
#mesondefine uid_t
|
||||
|
||||
/* Define to 1 if linux/memfd.h exists */
|
||||
#mesondefine HAVE_LINUX_MEMFD_H
|
||||
|
||||
#mesondefine HAVE_LINUX_INPUT_H
|
||||
|
||||
#mesondefine HAVE_DEV_EVDEV_INPUT_H
|
||||
|
||||
#mesondefine GTK_SYSCONFDIR
|
||||
|
||||
#mesondefine GTK_LOCALEDIR
|
||||
|
||||
#mesondefine GTK_DATADIR
|
||||
|
||||
#mesondefine GTK_LIBDIR
|
||||
|
||||
#mesondefine GTK_PRINT_BACKENDS
|
||||
|
||||
#mesondefine HAVE_CAIRO_SCRIPT_INTERPRETER
|
||||
|
||||
#mesondefine HAVE_HARFBUZZ
|
||||
|
||||
#mesondefine HAVE_PANGOFT
|
||||
|
||||
#mesondefine ISO_CODES_PREFIX
|
||||
|
||||
/* Define if tracker3 is available */
|
||||
#mesondefine HAVE_TRACKER3
|
||||
|
||||
#mesondefine HAVE_F16C
|
||||
|
||||
/* Does the OS support GDesktopAppInfo? */
|
||||
#mesondefine HAVE_DESKTOPAPPINFO
|
||||
@@ -37,7 +37,7 @@ update_image (void)
|
||||
const char *text;
|
||||
PangoFontDescription *desc;
|
||||
PangoLayout *layout;
|
||||
PangoRectangle ink, pink, logical;
|
||||
PangoRectangle ink, logical;
|
||||
int baseline;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
@@ -59,16 +59,18 @@ update_image (void)
|
||||
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
|
||||
|
||||
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
|
||||
if (strcmp (hint, "none") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_NONE;
|
||||
else if (strcmp (hint, "slight") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||
else if (strcmp (hint, "medium") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
|
||||
else if (strcmp (hint, "full") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_FULL;
|
||||
else
|
||||
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
|
||||
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
|
||||
if (hint)
|
||||
{
|
||||
if (strcmp (hint, "none") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_NONE;
|
||||
else if (strcmp (hint, "slight") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||
else if (strcmp (hint, "medium") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
|
||||
else if (strcmp (hint, "full") == 0)
|
||||
hintstyle = CAIRO_HINT_STYLE_FULL;
|
||||
}
|
||||
cairo_font_options_set_hint_style (fopt, hintstyle);
|
||||
|
||||
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (hint_metrics)))
|
||||
@@ -94,7 +96,6 @@ update_image (void)
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
pango_layout_set_text (layout, text, -1);
|
||||
pango_layout_get_extents (layout, &ink, &logical);
|
||||
pink = ink;
|
||||
baseline = pango_layout_get_baseline (layout);
|
||||
|
||||
pango_extents_to_pixels (&ink, NULL);
|
||||
@@ -165,10 +166,10 @@ update_image (void)
|
||||
cairo_stroke (cr);
|
||||
cairo_set_source_rgb (cr, 1, 0, 0);
|
||||
cairo_rectangle (cr,
|
||||
scale * (10 + pango_units_to_double (pink.x)) + 0.5,
|
||||
scale * (10 + pango_units_to_double (pink.y)) + 0.5,
|
||||
scale * pango_units_to_double (pink.width) - 1,
|
||||
scale * pango_units_to_double (pink.height) - 1);
|
||||
scale * (10 + ink.x) - 0.5,
|
||||
scale * (10 + ink.y) - 0.5,
|
||||
scale * ink.width + 1,
|
||||
scale * ink.height + 1);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
|
||||
@@ -193,7 +194,7 @@ update_image (void)
|
||||
}
|
||||
}
|
||||
|
||||
cairo_set_source_rgba (cr, 0, 0, 1, outline_alpha);
|
||||
cairo_set_source_rgba (cr, 0, 0, 0, outline_alpha);
|
||||
cairo_move_to (cr, scale * 20 - 0.5, scale * 20 - 0.5);
|
||||
cairo_append_path (cr, path);
|
||||
cairo_stroke (cr);
|
||||
|
||||
@@ -177,6 +177,8 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="up_button">
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
@@ -200,6 +202,8 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="down_button">
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
|
||||
@@ -874,8 +874,8 @@ gtk_gears_tick (GtkWidget *widget,
|
||||
{
|
||||
GtkGears *gears = GTK_GEARS (widget);
|
||||
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
|
||||
GdkFrameTimings *timings, *previous_timings;
|
||||
gint64 previous_frame_time = 0;
|
||||
GdkFrameTimings *previous_timings;
|
||||
gint64 previous_frame_time;
|
||||
gint64 frame_time;
|
||||
gint64 history_start, history_len;
|
||||
gint64 frame;
|
||||
@@ -915,12 +915,6 @@ gtk_gears_tick (GtkWidget *widget,
|
||||
}
|
||||
}
|
||||
|
||||
timings = gdk_frame_clock_get_current_timings (frame_clock);
|
||||
previous_timings = gdk_frame_clock_get_timings (frame_clock,
|
||||
gdk_frame_timings_get_frame_counter (timings) - 1);
|
||||
if (previous_timings != NULL)
|
||||
previous_frame_time = gdk_frame_timings_get_frame_time (previous_timings);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
static GdkPixbuf *avatar_pixbuf_other;
|
||||
static GdkTexture *avatar_texture_other;
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
#define GTK_TYPE_MESSAGE (gtk_message_get_type ())
|
||||
@@ -196,12 +196,9 @@ gtk_message_row_update (GtkMessageRow *row)
|
||||
gtk_button_set_label (GTK_BUTTON (priv->resent_by_button), priv->message->resent_by);
|
||||
|
||||
if (strcmp (priv->message->sender_nick, "@GTKtoolkit") == 0)
|
||||
{
|
||||
gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4");
|
||||
gtk_image_set_icon_size (priv->avatar_image, GTK_ICON_SIZE_LARGE);
|
||||
}
|
||||
gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4");
|
||||
else
|
||||
gtk_image_set_from_pixbuf (priv->avatar_image, avatar_pixbuf_other);
|
||||
gtk_image_set_from_paintable (priv->avatar_image, GDK_PAINTABLE (avatar_texture_other));
|
||||
|
||||
}
|
||||
|
||||
@@ -344,7 +341,7 @@ do_listbox (GtkWidget *do_widget)
|
||||
|
||||
if (!window)
|
||||
{
|
||||
avatar_pixbuf_other = gdk_pixbuf_new_from_resource_at_scale ("/listbox/apple-red.png", 32, 32, FALSE, NULL);
|
||||
avatar_texture_other = gdk_texture_new_from_resource ("/listbox/apple-red.png");
|
||||
|
||||
window = gtk_window_new ();
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
<property name="margin-start">8</property>
|
||||
<property name="margin-end">8</property>
|
||||
<property name="icon-name">image-missing</property>
|
||||
<property name="icon-size">large</property>
|
||||
<layout>
|
||||
<property name="column">0</property>
|
||||
<property name="row">0</property>
|
||||
|
||||
@@ -156,10 +156,74 @@ demos_h = custom_target('gtk4 demo header',
|
||||
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
|
||||
)
|
||||
|
||||
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
|
||||
'demo.gresource.xml',
|
||||
source_dir: '.',
|
||||
)
|
||||
objcopy_supports_add_symbol = false
|
||||
objcopy = find_program('objcopy', required : false)
|
||||
if objcopy.found()
|
||||
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
|
||||
endif
|
||||
|
||||
ld = find_program('ld', required : false)
|
||||
|
||||
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
||||
glib_compile_resources = find_program('glib-compile-resources')
|
||||
|
||||
# Create the resource blob
|
||||
gtkdemo_gresource = custom_target('gtkdemo.gresource',
|
||||
input : 'demo.gresource.xml',
|
||||
output : 'gtkdemo.gresource',
|
||||
depfile : 'gtkdemo.gresource.d',
|
||||
command : [glib_compile_resources,
|
||||
'--generate',
|
||||
'--target=@OUTPUT@',
|
||||
'--dependency-file=@DEPFILE@',
|
||||
'--sourcedir=' + meson.current_source_dir(),
|
||||
'--sourcedir=' + meson.current_build_dir(),
|
||||
'@INPUT@'])
|
||||
|
||||
# Create resource data file
|
||||
gtkdemo_resources_c = custom_target('gtkdemo_resources.c',
|
||||
input : 'demo.gresource.xml',
|
||||
output : 'gtkdemo_resources.c',
|
||||
depfile : 'gtkdemo_resources.c.d',
|
||||
command : [glib_compile_resources,
|
||||
'--generate-source',
|
||||
'--target=@OUTPUT@',
|
||||
'--dependency-file=@DEPFILE@',
|
||||
'--sourcedir=' + meson.current_source_dir(),
|
||||
'--sourcedir=' + meson.current_build_dir(),
|
||||
'--external-data',
|
||||
'--c-name', '_g_binary_gtkdemo',
|
||||
'@INPUT@'])
|
||||
|
||||
# Create object file containing resource data
|
||||
gtkdemo_resources_binary = custom_target('gtkdemo_resources.o',
|
||||
input : gtkdemo_gresource,
|
||||
output : 'gtkdemo_resources.o',
|
||||
command : [ld,
|
||||
'-r',
|
||||
'-b','binary',
|
||||
'@INPUT@',
|
||||
'-o','@OUTPUT@'])
|
||||
|
||||
# Rename symbol to match the one in the C file
|
||||
gtkdemo_resources_o = custom_target('gtkdemo_resources2.o',
|
||||
input : gtkdemo_resources_binary,
|
||||
output : 'gtkdemo_resources2.o',
|
||||
command : [objcopy,
|
||||
'--add-symbol','_g_binary_gtkdemo_resource_data=.data:0',
|
||||
'@INPUT@',
|
||||
'@OUTPUT@'])
|
||||
|
||||
gtkdemo_resources = [
|
||||
gtkdemo_resources_c,
|
||||
gtkdemo_resources_o,
|
||||
]
|
||||
else
|
||||
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
|
||||
'demo.gresource.xml',
|
||||
source_dir: '.',
|
||||
)
|
||||
endif
|
||||
|
||||
# Use a subset of compiler flags
|
||||
demo_cflags = []
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
|
||||
<release version="@BUILD_VERSION@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
|
||||
<release version="@BUILD_VERSION@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
|
||||
@@ -12,19 +12,9 @@ demo_conf_h = declare_dependency(
|
||||
)
|
||||
|
||||
# appdata
|
||||
today = 'unknown'
|
||||
date = find_program('date',
|
||||
required: false)
|
||||
if date.found()
|
||||
r = run_command(date, '-I')
|
||||
if r.returncode() == 0
|
||||
today = r.stdout().strip()
|
||||
endif
|
||||
endif
|
||||
|
||||
appdata_config = configuration_data()
|
||||
appdata_config.set('BUILD_VERSION', meson.project_version())
|
||||
appdata_config.set('BUILD_DATE', today)
|
||||
|
||||
subdir('constraint-editor')
|
||||
subdir('gtk-demo')
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include "gtkrendererpaintableprivate.h"
|
||||
|
||||
#include "gsk/gskrendernodeparserprivate.h"
|
||||
#include "gsk/ngl/gsknglrenderer.h"
|
||||
#include "gsk/gl/gskglrenderer.h"
|
||||
#ifdef GDK_WINDOWING_BROADWAY
|
||||
#include "gsk/broadway/gskbroadwayrenderer.h"
|
||||
#endif
|
||||
@@ -646,7 +646,6 @@ create_cairo_texture (NodeEditorWindow *self)
|
||||
GskRenderer *renderer;
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
GdkSurface *surface;
|
||||
|
||||
paintable = gtk_picture_get_paintable (GTK_PICTURE (self->picture));
|
||||
if (paintable == NULL ||
|
||||
@@ -659,9 +658,8 @@ create_cairo_texture (NodeEditorWindow *self)
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
|
||||
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (self)));
|
||||
renderer = gsk_cairo_renderer_new ();
|
||||
gsk_renderer_realize (renderer, surface, NULL);
|
||||
gsk_renderer_realize (renderer, NULL, NULL);
|
||||
|
||||
texture = gsk_renderer_render_texture (renderer, node, NULL);
|
||||
gsk_render_node_unref (node);
|
||||
@@ -839,16 +837,18 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
|
||||
GskRenderer *renderer,
|
||||
const char *description)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
surface = gtk_native_get_surface (GTK_NATIVE (self));
|
||||
g_assert (surface != NULL);
|
||||
|
||||
if (renderer != NULL && !gsk_renderer_realize (renderer, surface, NULL))
|
||||
if (!gsk_renderer_realize (renderer, NULL, NULL))
|
||||
{
|
||||
g_object_unref (renderer);
|
||||
return;
|
||||
GdkSurface *surface = gtk_native_get_surface (GTK_NATIVE (self));
|
||||
g_assert (surface != NULL);
|
||||
|
||||
if (!gsk_renderer_realize (renderer, surface, NULL))
|
||||
{
|
||||
g_object_unref (renderer);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
paintable = gtk_renderer_paintable_new (renderer, gtk_picture_get_paintable (GTK_PICTURE (self->picture)));
|
||||
@@ -872,7 +872,7 @@ node_editor_window_realize (GtkWidget *widget)
|
||||
"Default");
|
||||
#endif
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_ngl_renderer_new (),
|
||||
gsk_gl_renderer_new (),
|
||||
"OpenGL");
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
node_editor_window_add_renderer (self,
|
||||
|
||||
@@ -198,6 +198,7 @@
|
||||
<child>
|
||||
<object class="GtkPicture" id="picture">
|
||||
<property name="can-shrink">0</property>
|
||||
<property name="keep-aspect-ratio">1</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<child>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 94 KiB |
Binary file not shown.
@@ -1,9 +1,73 @@
|
||||
# demos/widget-factory
|
||||
|
||||
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
|
||||
'widget-factory.gresource.xml',
|
||||
source_dir: '.',
|
||||
)
|
||||
objcopy_supports_add_symbol = false
|
||||
objcopy = find_program('objcopy', required : false)
|
||||
if objcopy.found()
|
||||
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
|
||||
endif
|
||||
|
||||
ld = find_program('ld', required : false)
|
||||
|
||||
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
|
||||
glib_compile_resources = find_program('glib-compile-resources')
|
||||
|
||||
# Create the resource blob
|
||||
widgetfactory_gresource = custom_target('widgetfactory.gresource',
|
||||
input : 'widget-factory.gresource.xml',
|
||||
output : 'widgetfactory.gresource',
|
||||
depfile: 'widgetfactory.gresource.d',
|
||||
command : [glib_compile_resources,
|
||||
'--generate',
|
||||
'--target=@OUTPUT@',
|
||||
'--dependency-file=@DEPFILE@',
|
||||
'--sourcedir=' + meson.current_source_dir(),
|
||||
'--sourcedir=' + meson.current_build_dir(),
|
||||
'@INPUT@'])
|
||||
|
||||
# Create resource data file
|
||||
widgetfactory_resources_c = custom_target('widgetfactory_resources.c',
|
||||
input : 'widget-factory.gresource.xml',
|
||||
output : 'widgetfactory_resources.c',
|
||||
depfile: 'widgetfactory_resources.c.d',
|
||||
command : [glib_compile_resources,
|
||||
'--generate-source',
|
||||
'--target=@OUTPUT@',
|
||||
'--dependency-file=@DEPFILE@',
|
||||
'--sourcedir=' + meson.current_source_dir(),
|
||||
'--sourcedir=' + meson.current_build_dir(),
|
||||
'--external-data',
|
||||
'--c-name', '_g_binary_widgetfactory',
|
||||
'@INPUT@'])
|
||||
|
||||
# Create object file containing resource data
|
||||
widgetfactory_resources_binary = custom_target('widgetfactory_resources.o',
|
||||
input : widgetfactory_gresource,
|
||||
output : 'widgetfactory_resources.o',
|
||||
command : [ld,
|
||||
'-r',
|
||||
'-b','binary',
|
||||
'@INPUT@',
|
||||
'-o','@OUTPUT@'])
|
||||
|
||||
# Rename symbol to match the one in the C file
|
||||
widgetfactory_resources_o = custom_target('widgetfactory_resources2.o',
|
||||
input : widgetfactory_resources_binary,
|
||||
output : 'widgetfactory_resources2.o',
|
||||
command : [objcopy,
|
||||
'--add-symbol','_g_binary_widgetfactory_resource_data=.data:0',
|
||||
'@INPUT@',
|
||||
'@OUTPUT@'])
|
||||
|
||||
widgetfactory_resources = [
|
||||
widgetfactory_resources_c,
|
||||
widgetfactory_resources_o,
|
||||
]
|
||||
else
|
||||
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
|
||||
'widget-factory.gresource.xml',
|
||||
source_dir: '.',
|
||||
)
|
||||
endif
|
||||
|
||||
executable('gtk4-widget-factory',
|
||||
sources: ['widget-factory.c', widgetfactory_resources],
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 MiB After Width: | Height: | Size: 38 KiB |
@@ -34,7 +34,7 @@
|
||||
<developer_name>Matthias Clasen and others</developer_name>
|
||||
<content_rating type="oars-1.1"/>
|
||||
<releases>
|
||||
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
|
||||
<release version="@BUILD_VERSION@">
|
||||
<description>
|
||||
<p>A new build of GTK.</p>
|
||||
</description>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 MiB After Width: | Height: | Size: 59 KiB |
File diff suppressed because it is too large
Load Diff
@@ -13,4 +13,5 @@ baseURLs = [
|
||||
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
|
||||
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
|
||||
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
|
||||
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
|
||||
]
|
||||
|
||||
@@ -13,4 +13,5 @@ baseURLs = [
|
||||
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
|
||||
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
|
||||
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
|
||||
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
|
||||
]
|
||||
|
||||
@@ -3,13 +3,13 @@ Slug: gtk-getting-started
|
||||
|
||||
GTK is a [widget toolkit](http://en.wikipedia.org/wiki/Widget_toolkit).
|
||||
Each user interface created by GTK consists of widgets. This is implemented
|
||||
in C using [GObject](#gobject), an object-oriented framework for C. Widgets
|
||||
in C using [class@GObject.Object], an object-oriented framework for C. Widgets
|
||||
are organized in a hierarchy. The window widget is the main container.
|
||||
The user interface is then built by adding buttons, drop-down menus, input
|
||||
fields, and other widgets to the window. If you are creating complex user
|
||||
interfaces it is recommended to use GtkBuilder and its GTK-specific markup
|
||||
description language, instead of assembling the interface manually. You can
|
||||
also use a visual user interface editor, like [glade](https://glade.gnome.org/).
|
||||
also use a visual user interface editor, like [Glade](https://glade.gnome.org/).
|
||||
|
||||
GTK is event-driven. The toolkit listens for events such as a click
|
||||
on a button, and passes the event to your application.
|
||||
@@ -17,7 +17,7 @@ on a button, and passes the event to your application.
|
||||
This chapter contains some tutorial information to get you started with
|
||||
GTK programming. It assumes that you have GTK, its dependencies and a C
|
||||
compiler installed and ready to use. If you need to build GTK itself first,
|
||||
refer to the [Compiling the GTK libraries](#gtk-compiling) section in this
|
||||
refer to the [Compiling the GTK libraries](building.html) section in this
|
||||
reference.
|
||||
|
||||
## Basics
|
||||
@@ -68,7 +68,7 @@ gcc $( pkg-config --cflags gtk4 ) -o example-0 example-0.c $( pkg-config --libs
|
||||
```
|
||||
|
||||
For more information on how to compile a GTK application, please
|
||||
refer to the [Compiling GTK Applications](#gtk-compiling)
|
||||
refer to the [Compiling GTK Applications](compiling.html)
|
||||
section in this reference.
|
||||
|
||||
All GTK applications will, of course, include `gtk/gtk.h`, which declares
|
||||
@@ -106,16 +106,16 @@ The call to [ctor@Gtk.ApplicationWindow.new] will create a new
|
||||
window will have a frame, a title bar, and window controls depending on the
|
||||
platform.
|
||||
|
||||
A window title is set using [method@Gtk.Window.set_title]. This function
|
||||
A window title is set using [`method@Gtk.Window.set_title`]. This function
|
||||
takes a `GtkWindow` pointer and a string as input. As our `window` pointer
|
||||
is a `GtkWidget` pointer, we need to cast it to `GtkWindow`; instead of
|
||||
casting `window` via a typical C cast like `(GtkWindow*)`, `window` can be
|
||||
cast using the macro `GTK_WINDOW()`. `GTK_WINDOW()` will check if the
|
||||
pointer is an instance of the `GtkWindow` class, before casting, and emit a
|
||||
warning if the check fails. More information about this convention can be
|
||||
found [here](https://developer.gnome.org/gobject/stable/gtype-conventions.html).
|
||||
found [in the GObject documentation](https://docs.gtk.org/gobject/concepts.html#conventions).
|
||||
|
||||
Finally the window size is set using [method@Gtk.Window.set_default_size]
|
||||
Finally the window size is set using [`method@Gtk.Window.set_default_size`]
|
||||
and the window is then shown by GTK via [method@Gtk.Widget.show].
|
||||
|
||||
When you close the window, by (for example) pressing the X button, the
|
||||
@@ -161,19 +161,24 @@ activate (GtkApplication *app,
|
||||
{
|
||||
GtkWidget *window;
|
||||
GtkWidget *button;
|
||||
GtkWidget *box;
|
||||
|
||||
window = gtk_application_window_new (app);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Window");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), box);
|
||||
|
||||
button = gtk_button_new_with_label ("Hello World");
|
||||
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
|
||||
|
||||
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
|
||||
|
||||
gtk_window_set_child (GTK_WINDOW (window), button);
|
||||
gtk_box_append (GTK_BOX (box), button);
|
||||
|
||||
gtk_widget_show (window);
|
||||
}
|
||||
@@ -212,10 +217,10 @@ The `GtkBox` widget is created with [ctor@Gtk.Box.new], which takes a
|
||||
this box will contain can either be laid out horizontally or vertically.
|
||||
This does not matter in this particular case, as we are dealing with only
|
||||
one button. After initializing box with the newly created `GtkBox`, the code
|
||||
adds the box widget to the window widget using [method@Gtk.Window.set_child].
|
||||
adds the box widget to the window widget using [`method@Gtk.Window.set_child`].
|
||||
|
||||
Next the `button` variable is initialized in similar manner.
|
||||
[ctor@Gtk.Button.new_with_label] is called which returns a
|
||||
[`ctor@Gtk.Button.new_with_label`] is called which returns a
|
||||
[class@Gtk.Button] to be stored in `button`. Afterwards `button` is added to
|
||||
our `box`.
|
||||
|
||||
@@ -241,8 +246,8 @@ More information about creating buttons can be found
|
||||
[here](https://wiki.gnome.org/HowDoI/Buttons).
|
||||
|
||||
The rest of the code in `example-1.c` is identical to `example-0.c`. The next
|
||||
section will elaborate further on how to add several GtkWidgets to your GTK
|
||||
application.
|
||||
section will elaborate further on how to add several [class@Gtk.Widget]s to your
|
||||
GTK application.
|
||||
|
||||
## Packing
|
||||
|
||||
@@ -251,10 +256,18 @@ a window. When you do so, it becomes important to control how each widget is
|
||||
positioned and sized. This is where packing comes in.
|
||||
|
||||
GTK comes with a large variety of _layout containers_ whose purpose it
|
||||
is to control the layout of the child widgets that are added to them.
|
||||
See [Layout containers](#LayoutContainers) for an overview.
|
||||
is to control the layout of the child widgets that are added to them, like:
|
||||
|
||||
The following example shows how the GtkGrid container lets you
|
||||
- [class@Gtk.Box]
|
||||
- [class@Gtk.Grid]
|
||||
- [class@Gtk.Revealer]
|
||||
- [class@Gtk.Stack]
|
||||
- [class@Gtk.Overlay]
|
||||
- [class@Gtk.Paned]
|
||||
- [class@Gtk.Expander]
|
||||
- [class@Gtk.Fixed]
|
||||
|
||||
The following example shows how the [class@Gtk.Grid] container lets you
|
||||
arrange several buttons:
|
||||
|
||||

|
||||
@@ -353,11 +366,11 @@ draw function.
|
||||
The contents of a widget often need to be partially or fully redrawn, e.g.
|
||||
when another window is moved and uncovers part of the widget, or when the
|
||||
window containing it is resized. It is also possible to explicitly cause a
|
||||
widget to be redrawn, by calling [method@Gtk.Widget.queue_draw]. GTK takes
|
||||
widget to be redrawn, by calling [`method@Gtk.Widget.queue_draw`]. GTK takes
|
||||
care of most of the details by providing a ready-to-use cairo context to the
|
||||
draw function.
|
||||
|
||||
The following example shows how to use a draw function with GtkDrawingArea.
|
||||
The following example shows how to use a draw function with [class@Gtk.DrawingArea].
|
||||
It is a bit more complicated than the previous examples, since it also
|
||||
demonstrates input event handling with event controllers.
|
||||
|
||||
@@ -402,9 +415,9 @@ resize_cb (GtkWidget *widget,
|
||||
if (gtk_native_get_surface (gtk_widget_get_native (widget)))
|
||||
{
|
||||
surface = gdk_surface_create_similar_surface (gtk_native_get_surface (gtk_widget_get_native (widget)),
|
||||
CAIRO_CONTENT_COLOR,
|
||||
gtk_widget_get_width (widget),
|
||||
gtk_widget_get_height (widget));
|
||||
CAIRO_CONTENT_COLOR,
|
||||
gtk_widget_get_width (widget),
|
||||
gtk_widget_get_height (widget));
|
||||
|
||||
/* Initialize the surface to white */
|
||||
clear_surface ();
|
||||
@@ -690,16 +703,16 @@ gcc $( pkg-config --cflags gtk4 ) -o example-3 example-3.c $( pkg-config --libs
|
||||
|
||||
Note that `GtkBuilder` can also be used to construct objects that are
|
||||
not widgets, such as tree models, adjustments, etc. That is the reason
|
||||
the method we use here is called [method@Gtk.Builder.get_object] and returns
|
||||
a `GObject` instead of a `GtkWidget`.
|
||||
the method we use here is called [`method@Gtk.Builder.get_object`] and
|
||||
returns a `GObject` instead of a `GtkWidget`.
|
||||
|
||||
Normally, you would pass a full path to [method@Gtk.Builder.add_from_file] to
|
||||
Normally, you would pass a full path to [`method@Gtk.Builder.add_from_file`] to
|
||||
make the execution of your program independent of the current directory.
|
||||
A common location to install UI descriptions and similar data is
|
||||
`/usr/share/appname`.
|
||||
|
||||
It is also possible to embed the UI description in the source code as a
|
||||
string and use [method@Gtk.Builder.add_from_string] to load it. But keeping the
|
||||
string and use [`method@Gtk.Builder.add_from_string`] to load it. But keeping the
|
||||
UI description in a separate file has several advantages: It is then possible
|
||||
to make minor adjustments to the UI without recompiling your program, and,
|
||||
more importantly, graphical UI editors such as [Glade](http://glade.gnome.org)
|
||||
@@ -762,17 +775,17 @@ main (int argc, char *argv[])
|
||||
```
|
||||
|
||||
All the application logic is in the application class, which is a subclass of
|
||||
GtkApplication. Our example does not yet have any interesting functionality.
|
||||
`GtkApplication`. Our example does not yet have any interesting functionality.
|
||||
All it does is open a window when it is activated without arguments, and open
|
||||
the files it is given, if it is started with arguments.
|
||||
|
||||
To handle these two cases, we override the activate() vfunc, which gets
|
||||
To handle these two cases, we override the `activate()` vfunc, which gets
|
||||
called when the application is launched without commandline arguments, and
|
||||
the `open()` virtual function, which gets called when the application is
|
||||
launched with commandline arguments.
|
||||
|
||||
To learn more about `GApplication` entry points, consult the GIO
|
||||
[documentation](https://developer.gnome.org/gio/stable/GApplication.html#GApplication.description).
|
||||
[documentation](https://docs.gtk.org/gio/class.Application.html).
|
||||
|
||||
```c
|
||||
#include <gtk/gtk.h>
|
||||
@@ -841,8 +854,8 @@ example_app_new (void)
|
||||
```
|
||||
|
||||
Another important class that is part of the application support in GTK is
|
||||
`GtkApplicationWindow`. It is typically subclassed as well. Our subclass does
|
||||
not do anything yet, so we will just get an empty window.
|
||||
[class@Gtk.ApplicationWindow]. It is typically subclassed as well. Our
|
||||
subclass does not do anything yet, so we will just get an empty window.
|
||||
|
||||
```c
|
||||
#include <gtk/gtk.h>
|
||||
@@ -907,10 +920,10 @@ and it accepts files as commandline arguments.
|
||||
|
||||
### Populating the window
|
||||
|
||||
In this step, we use a GtkBuilder template to associate a
|
||||
GtkBuilder ui file with our application window class.
|
||||
In this step, we use a `GtkBuilder` template to associate a
|
||||
`GtkBuilder` ui file with our application window class.
|
||||
|
||||
Our simple ui file gives the window a title, and puts a GtkStack
|
||||
Our simple ui file gives the window a title, and puts a `GtkStack`
|
||||
widget as the main content.
|
||||
|
||||
```xml
|
||||
@@ -934,9 +947,9 @@ widget as the main content.
|
||||
|
||||
To make use of this file in our application, we revisit our
|
||||
`GtkApplicationWindow` subclass, and call
|
||||
`gtk_widget_class_set_template_from_resource()` from the class init
|
||||
[`method@Gtk.WidgetClass.set_template_from_resource`] from the class init
|
||||
function to set the ui file as template for this class. We also
|
||||
add a call to `gtk_widget_init_template()` in the instance init
|
||||
add a call to [`method@Gtk.Widget.init_template`] in the instance init
|
||||
function to instantiate the template for each instance of our
|
||||
class.
|
||||
|
||||
@@ -963,7 +976,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
|
||||
You may have noticed that we used the `_from_resource()` variant of the function
|
||||
that sets a template. Now we need to use
|
||||
[GLib's resource functionality](https://developer.gnome.org/gio/stable/GResource.html)
|
||||
[GLib's resource functionality](https://docs.gtk.org/gio/struct.Resource.html)
|
||||
to include the ui file in the binary. This is commonly done by listing all resources
|
||||
in a `.gresource.xml` file, such as this:
|
||||
|
||||
@@ -985,7 +998,7 @@ glib-compile-resources exampleapp.gresource.xml --target=resources.c --generate-
|
||||
```
|
||||
|
||||
The gnome module of the [Meson build system](https://mesonbuild.com)
|
||||
provides the [gnome.compile_resources()](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources)
|
||||
provides the [`gnome.compile_resources()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources)
|
||||
method for this task.
|
||||
|
||||
Our application now looks like this:
|
||||
@@ -1001,7 +1014,7 @@ To this end, we add a member to the struct of our application window subclass
|
||||
and keep a reference to the `GtkStack` there. The first member of the struct
|
||||
should be the parent type from which the class is derived. Here,
|
||||
`ExampleAppWindow` is derived from `GtkApplicationWindow`. The
|
||||
`gtk_widget_class_bind_template_child()` function arranges things so that after
|
||||
[`func@Gtk.widget_class_bind_template_child`] function arranges things so that after
|
||||
instantiating the template, the `stack` member of the struct will point to the
|
||||
widget of the same name from the template.
|
||||
|
||||
@@ -1081,7 +1094,7 @@ tell it to display information about our stack.
|
||||
|
||||
The stack switcher gets all its information it needs to display tabs from
|
||||
the stack that it belongs to. Here, we are passing the label to show for
|
||||
each file as the last argument to the [method@Gtk.Stack.add_titled]
|
||||
each file as the last argument to the [`method@Gtk.Stack.add_titled`]
|
||||
function.
|
||||
|
||||
Our application is beginning to take shape:
|
||||
@@ -1121,7 +1134,7 @@ resulting menu model with the menu button that we've added to the headerbar.
|
||||
Since menus work by activating GActions, we also have to add a suitable set
|
||||
of actions to our application.
|
||||
|
||||
Adding the actions is best done in the startup() vfunc, which is guaranteed
|
||||
Adding the actions is best done in the `startup()` vfunc, which is guaranteed
|
||||
to be called once for each primary application instance:
|
||||
|
||||
```c
|
||||
@@ -1179,7 +1192,7 @@ example_app_class_init (ExampleAppClass *class)
|
||||
|
||||
Our preferences menu item does not do anything yet, but the Quit menu item
|
||||
is fully functional. Note that it can also be activated by the usual Ctrl-Q
|
||||
shortcut. The shortcut was added with `gtk_application_set_accels_for_action()`.
|
||||
shortcut. The shortcut was added with [`method@Gtk.Application.set_accels_for_action`].
|
||||
|
||||
The application menu looks like this:
|
||||
|
||||
@@ -1191,7 +1204,7 @@ A typical application will have a some preferences that should be remembered
|
||||
from one run to the next. Even for our simple example application, we may
|
||||
want to change the font that is used for the content.
|
||||
|
||||
We are going to use `GSettings` to store our preferences. `GSettings` requires
|
||||
We are going to use [class@Gio.Settings] to store our preferences. `GSettings` requires
|
||||
a schema that describes our settings:
|
||||
|
||||
```xml
|
||||
@@ -1218,10 +1231,9 @@ a schema that describes our settings:
|
||||
```
|
||||
|
||||
Before we can make use of this schema in our application, we need to compile
|
||||
it into the binary form that GSettings expects. GIO provides
|
||||
[macros](https://developer.gnome.org/gio/2.36/ch31s06.html) to do this in
|
||||
autotools-based projects, and the gnome module of the Meson build system
|
||||
provides the [gnome.compile_schemas()](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas)
|
||||
it into the binary form that GSettings expects. GIO provides macros to do
|
||||
this in Autotools-based projects, and the gnome module of the Meson build
|
||||
system provides the [`gnome.compile_schemas()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas)
|
||||
method for this task.
|
||||
|
||||
Next, we need to connect our settings to the widgets that they are supposed
|
||||
@@ -1681,7 +1693,8 @@ What our application looks like now:
|
||||
Widgets and other objects have many useful properties.
|
||||
|
||||
Here we show some ways to use them in new and flexible ways, by wrapping
|
||||
them in actions with `GPropertyAction` or by binding them with `GBinding`.
|
||||
them in actions with [class@Gio.PropertyAction] or by binding them with
|
||||
[class@GObject.Binding].
|
||||
|
||||
To set this up, we add two labels to the header bar in our window template,
|
||||
named `lines_label` and `lines`, and bind them to struct members in the
|
||||
|
||||
57
docs/reference/gtk/gtk4-broadwayd.rst
Normal file
57
docs/reference/gtk/gtk4-broadwayd.rst
Normal file
@@ -0,0 +1,57 @@
|
||||
.. _gtk4-broadwayd(1):
|
||||
|
||||
==============
|
||||
gtk4-broadwayd
|
||||
==============
|
||||
|
||||
---------------------------
|
||||
The Broadway display server
|
||||
---------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
|
||||
| **gtk4-broadwayd** --port=PORT --address=ADDRESS <DISPLAY>
|
||||
| **gtk4-broadwayd** --unixaddress=ADDRESS <DISPLAY>
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-broadwayd`` is a display server for the Broadway GDK backend. It allows
|
||||
multiple GTK applications to display their windows in the same web browser, by
|
||||
connecting to gtk4-broadwayd.
|
||||
|
||||
When using gtk4-broadwayd, specify the display number to use, prefixed with a
|
||||
colon, similar to X. The default display number is 0.
|
||||
|
||||
::
|
||||
|
||||
gtk4-broadwayd :5
|
||||
|
||||
|
||||
Then point your web browser at ``http://127.0.0.1:8085``.
|
||||
|
||||
Start your applications like this:
|
||||
|
||||
::
|
||||
|
||||
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
|
||||
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``--port PORT``
|
||||
|
||||
Use the given ``PORT`` for the HTTP connection, instead of the default ``8080 + (DISPLAY - 1)``.
|
||||
|
||||
``--address ADDRESS``
|
||||
|
||||
Use the given ``address`` for the HTTP connection, instead of the default ``http://127.0.0.1``.
|
||||
|
||||
``--unixsocket ADDRESS``
|
||||
|
||||
Use the given ``address`` as the unix domain socket address. This option
|
||||
overrides ``--address`` and ``--port``, and it is available only on Unix-like
|
||||
systems.
|
||||
@@ -1,84 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-broadwayd">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-broadwayd</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Alexander</firstname>
|
||||
<surname>Larsson</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-broadwayd</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-broadwayd</refname>
|
||||
<refpurpose>Broadway display server</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-broadwayd</command>
|
||||
<arg choice="opt">--port <replaceable>PORT</replaceable></arg>
|
||||
<arg choice="opt">--address <replaceable>ADDRESS</replaceable></arg>
|
||||
<arg choice="opt">--unixsocket <replaceable>ADDRESS</replaceable></arg>
|
||||
<arg choice="opt"><replaceable>:DISPLAY</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-broadwayd</command> is a display server for the Broadway
|
||||
GDK backend. It allows multiple GTK applications to display their
|
||||
windows in the same web browser, by connecting to gtk4-broadwayd.
|
||||
</para>
|
||||
<para>
|
||||
When using gtk4-broadwayd, specify the display number to use, prefixed
|
||||
with a colon, similar to X. The default display number is 0.
|
||||
<programlisting>
|
||||
gtk4-broadwayd :5
|
||||
</programlisting>
|
||||
Then point your web browser at <literal>http://127.0.0.1:8085</literal>.
|
||||
Start your applications like this:
|
||||
<programlisting>
|
||||
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
|
||||
</programlisting>
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>--port</term>
|
||||
<listitem><para>Use <replaceable>PORT</replaceable> as the HTTP
|
||||
port, instead of the default 8080 + (<replaceable>DISPLAY</replaceable> - 1).
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>--address</term>
|
||||
<listitem><para>Use <replaceable>ADDRESS</replaceable> as the HTTP
|
||||
address, instead of the default <literal>http://127.0.0.1:<replaceable>PORT</replaceable></literal>.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>--unixsocket</term>
|
||||
<listitem><para>Use <replaceable>ADDRESS</replaceable> as the unix domain socket
|
||||
address. This option overrides <literal>--address</literal> and <literal>--port</literal>.
|
||||
It is available only on Unix-like systems.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
85
docs/reference/gtk/gtk4-builder-tool.rst
Normal file
85
docs/reference/gtk/gtk4-builder-tool.rst
Normal file
@@ -0,0 +1,85 @@
|
||||
.. _gtk4-builder-tool(1):
|
||||
|
||||
=================
|
||||
gtk4-builder-tool
|
||||
=================
|
||||
|
||||
-----------------------
|
||||
GtkBuilder File Utility
|
||||
-----------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
||||
|
|
||||
| **gtk4-builder-tool** validate <FILE>
|
||||
| **gtk4-builder-tool** enumerate <FILE>
|
||||
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
|
||||
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-builder-tool`` can perform various operations on GtkBuilder UI definition
|
||||
files.
|
||||
|
||||
COMMANDS
|
||||
--------
|
||||
|
||||
Validation
|
||||
^^^^^^^^^^
|
||||
|
||||
The ``validate`` command validates the given UI definition file and reports
|
||||
errors to ``stderr``.
|
||||
|
||||
Enumeration
|
||||
^^^^^^^^^^^
|
||||
|
||||
The ``enumerate`` command lists all the named objects that are present in the UI
|
||||
definition file.
|
||||
|
||||
Preview
|
||||
^^^^^^^
|
||||
|
||||
The ``preview`` command displays the UI dfinition file.
|
||||
|
||||
This command accepts options to specify the ID of the toplevel object and a CSS
|
||||
file to use.
|
||||
|
||||
``--id=ID``
|
||||
|
||||
The ID of the object to preview. If not specified, gtk4-builder-tool will
|
||||
choose a suitable object on its own.
|
||||
|
||||
``--css=FILE``
|
||||
|
||||
Load style information from the given CSS file.
|
||||
|
||||
Simplification
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
The ``simplify`` command simplifies the UI definition file by removing
|
||||
properties that are set to their default values and writes the resulting XML to
|
||||
the standard output, or back to the input file.
|
||||
|
||||
When the ``--3to4`` option is specified, the ``simplify`` command interprets the
|
||||
input as a GTK 3 UI definuition file and attempts to convert it to GTK 4
|
||||
equivalents. It performs various conversions, such as renaming properties,
|
||||
translating child properties to layout properties, rewriting the setup for
|
||||
GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes.
|
||||
|
||||
You should always test the modified UI definition files produced by
|
||||
gtk4-builder-tool before using them in production.
|
||||
|
||||
Note in particular that the conversion done with ``--3to4`` is meant as a
|
||||
starting point for a port from GTK 3 to GTK 4. It is expected that you will have
|
||||
to do manual fixups after the initial conversion.
|
||||
|
||||
``--replace``
|
||||
|
||||
Write the content back to the UI definition file instead of using the standard
|
||||
output.
|
||||
|
||||
``--3to4``
|
||||
|
||||
Transform a GTK 3 UI definition file to the equivalent GTK 4 definitions.
|
||||
@@ -1,110 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-builder-tool">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-builder-tool</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-builder-tool</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-builder-tool</refname>
|
||||
<refpurpose>GtkBuilder file utility</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-builder-tool</command>
|
||||
<arg choice="opt"><replaceable>COMMAND</replaceable></arg>
|
||||
<arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
|
||||
<arg choice="plain"><replaceable>FILE</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-builder-tool</command> can perform various operations
|
||||
on GtkBuilder .ui files.
|
||||
</para>
|
||||
<para>
|
||||
The <option>validate</option> command validates the .ui file and reports
|
||||
errors to stderr.
|
||||
</para>
|
||||
<para>
|
||||
The <option>enumerate</option> command lists all the named objects that
|
||||
are created in the .ui file.
|
||||
</para>
|
||||
<para>
|
||||
The <option>preview</option> command displays the .ui file. This command
|
||||
accepts options to specify the ID of the toplevel object and a .css file
|
||||
to use.
|
||||
</para>
|
||||
<para>
|
||||
The <option>simplify</option> command simplifies the .ui file by removing
|
||||
properties that are set to their default values and writes the resulting XML
|
||||
to stdout, or back to the input file.
|
||||
</para>
|
||||
<para>
|
||||
When the <option>--3to4</option> is specified, <option>simplify</option>
|
||||
interprets the input as a GTK 3 ui file and attempts to convert it to GTK 4
|
||||
equivalents. It performs various conversions, such as renaming properties,
|
||||
translating child properties to layout properties, rewriting the setup for
|
||||
GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes.
|
||||
</para>
|
||||
<para>
|
||||
You should always test the modified .ui files produced by gtk4-builder-tool
|
||||
before using them in production.
|
||||
</para>
|
||||
<para>
|
||||
Note in particular that the conversion
|
||||
done with <option>--3to4</option> is meant as a starting point for a port
|
||||
from GTK 3 to GTK 4. It is expected that you will have to do manual fixups
|
||||
after the initial conversion.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Simplify Options</title>
|
||||
<para>The <option>simplify</option> command accepts the following options:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>--replace</option></term>
|
||||
<listitem><para>Write the content back to the .ui file instead of stdout.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--3to4</option></term>
|
||||
<listitem><para>Transform a GTK 3 ui file to GTK 4</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Preview Options</title>
|
||||
<para>The <option>preview</option> command accepts the following options:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>--id=<arg choice="plain">ID</arg></option></term>
|
||||
<listitem><para>The ID of the object to preview. If not specified,
|
||||
gtk4-builder-tool will choose a suitable object on its own.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--css=<arg choice="plain">FILE</arg></option></term>
|
||||
<listitem><para>Load style information from the given .css file.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
22
docs/reference/gtk/gtk4-demo-application.rst
Normal file
22
docs/reference/gtk/gtk4-demo-application.rst
Normal file
@@ -0,0 +1,22 @@
|
||||
.. _gtk4-demo-application(1):
|
||||
|
||||
=====================
|
||||
gtk4-demo-application
|
||||
=====================
|
||||
|
||||
--------------------------
|
||||
Demonstrate GtkApplication
|
||||
--------------------------
|
||||
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
| **gtk4-demo-application**
|
||||
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-demo-application`` is an example application used by ``gtk4-demo``.
|
||||
|
||||
There is no need to call it manually.
|
||||
@@ -1,44 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-demo-application">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-demo-application</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-demo-application</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-demo-application</refname>
|
||||
<refpurpose>Demonstrate GtkApplication</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-demo-application</command>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-demo-application</command> is an example application
|
||||
used by <command>gtk4-demo</command>. There is no need to call it
|
||||
manually.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
48
docs/reference/gtk/gtk4-demo.rst
Normal file
48
docs/reference/gtk/gtk4-demo.rst
Normal file
@@ -0,0 +1,48 @@
|
||||
.. _gtk4-demo(1):
|
||||
|
||||
=========
|
||||
gtk4-demo
|
||||
=========
|
||||
|
||||
-----------------------
|
||||
Demonstrate GTK widgets
|
||||
-----------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-demo** [OPTIONS...]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-demo`` is a collection of examples.
|
||||
|
||||
Its purpose is to demonstrate many GTK widgets in a form that is useful to
|
||||
application developers.
|
||||
|
||||
The application shows the source code for each example, as well as other used
|
||||
resources, such as UI description files and image assets.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-h, --help``
|
||||
|
||||
Show help options.
|
||||
|
||||
``--version``
|
||||
|
||||
Show program version.
|
||||
|
||||
``--list``
|
||||
|
||||
List available examples.
|
||||
|
||||
``--run EXAMPLE``
|
||||
|
||||
Run the named example. Use ``--list`` to see the available examples.
|
||||
|
||||
``--autoquit``
|
||||
|
||||
Quit after a short timeout. This is intended for use with ``--run``, e.g. when profiling.
|
||||
@@ -1,81 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-demo">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-demo</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-demo</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-demo</refname>
|
||||
<refpurpose>Demonstrate GTK widgets</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-demo</command>
|
||||
<arg choice="opt">--help</arg>
|
||||
<arg choice="opt">--version</arg>
|
||||
<arg choice="opt">--list</arg>
|
||||
<arg choice="opt">--run <replaceable>EXAMPLE</replaceable></arg>
|
||||
<arg choice="opt">--autoquit</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-demo</command> is a collection of examples.
|
||||
Its purpose is to demonstrate many GTK widgets in a form
|
||||
that is useful to application developers.
|
||||
</para>
|
||||
<para>
|
||||
The application shows the source code for each example, as well as
|
||||
other used resources, such as ui files and icons.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<para>The following options are understood:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem><para>Show help options</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--version</option></term>
|
||||
<listitem><para>Show program version</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--list</option></term>
|
||||
<listitem><para>List available examples.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>-run <replaceable>EXAMPLE</replaceable></option></term>
|
||||
<listitem><para>Run the named example. Use <option>--list</option> to
|
||||
see the available examples.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--autoquit</option></term>
|
||||
<listitem><para>Quit after a short timeout. This is intended for use
|
||||
with <option>--run</option>, e.g. when profiling.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
40
docs/reference/gtk/gtk4-encode-symbolic-svg.rst
Normal file
40
docs/reference/gtk/gtk4-encode-symbolic-svg.rst
Normal file
@@ -0,0 +1,40 @@
|
||||
.. _gtk4-encode-symbolic-svg(1):
|
||||
|
||||
========================
|
||||
gtk4-encode-symbolic-svg
|
||||
========================
|
||||
|
||||
--------------------------------
|
||||
Symbolic icon conversion utility
|
||||
--------------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-encode-symbolic-svg** [OPTIONS...] <PATH> <WIDTH>x<HEIGHT>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-encode-symbolic-svg`` converts symbolic SVG icons into specially prepared
|
||||
PNG files. GTK can load and recolor these PNGs, just like original SVGs, but
|
||||
loading them is much faster.
|
||||
|
||||
``PATH`` is the name of a symbolic SVG file, ``WIDTH`` x ``HEIGHT`` are the
|
||||
desired dimensions for the generated PNG file.
|
||||
|
||||
To distinguish them from ordinary PNGs, the generated files have the extension
|
||||
``.symbolic.png``.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-o, --output DIRECTORY``
|
||||
|
||||
Write png files to ``DIRECTORY`` instead of the current working directory.
|
||||
|
||||
``--debug``
|
||||
|
||||
Generate PNG files of the various channels during the conversion. If these
|
||||
files are not monochrome green, they are often helpful in pinpointing the
|
||||
problematic parts of the source SVG.
|
||||
@@ -1,74 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-encode-symbolic-svg">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-encode-symbolic-svg</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Alexander</firstname>
|
||||
<surname>Larsson</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-encode-symbolic-svg</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-encode-symbolic-svg</refname>
|
||||
<refpurpose>Symbolic icon conversion utility</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-encode-symbolic-svg</command>
|
||||
<arg choice="opt">OPTION...</arg>
|
||||
<arg choice="plain"><replaceable>PATH</replaceable></arg>
|
||||
<arg choice="plain"><replaceable>WIDTH</replaceable>x<replaceable>HEIGHT</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-encode-symbolic-svg</command> converts symbolic svg icons into
|
||||
specially prepared png files. GTK can load and recolor these pngs, just like
|
||||
original svgs, but loading them is much faster.
|
||||
</para>
|
||||
<para>
|
||||
<replaceable>PATH</replaceable> is the name of a symbolic svg file,
|
||||
<replaceable>WIDTH</replaceable>x<replaceable>HEIGHT</replaceable> are the
|
||||
desired dimensions for the generated png file.
|
||||
</para>
|
||||
<para>
|
||||
To distinguish them from ordinary pngs, the generated files have the extension
|
||||
<filename>.symbolic.png</filename>.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>-o <replaceable>DIRECTORY</replaceable></term>
|
||||
<term>--output <replaceable>DIRECTORY</replaceable></term>
|
||||
<listitem><para>Write png files to <replaceable>DIRECTORY</replaceable>
|
||||
instead of the current working directory.</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>--debug</term>
|
||||
<listitem><para>Generate png files of the various channels during
|
||||
the conversion. If these files are not monochrome green, they
|
||||
are often helpful in pinpointing the problematic parts of
|
||||
the source svg.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
28
docs/reference/gtk/gtk4-icon-browser.rst
Normal file
28
docs/reference/gtk/gtk4-icon-browser.rst
Normal file
@@ -0,0 +1,28 @@
|
||||
.. _gtk4-icon-browser(1):
|
||||
|
||||
=================
|
||||
gtk4-icon-browser
|
||||
=================
|
||||
|
||||
-----------------
|
||||
List themed icons
|
||||
-----------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-icon-browser** [OPTIONS...]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-icon-browser`` is a utility to explore the icons in the current icon
|
||||
theme. It shows icons in various sizes, their symbolic variants where available,
|
||||
as well as a description of the icon and its context.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-h, --help``
|
||||
|
||||
Show the application help.
|
||||
@@ -1,55 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-icon-browser">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-icon-browser</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-icon-browser</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-icon-browser</refname>
|
||||
<refpurpose>List themed icons</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-icon-browser</command>
|
||||
<arg choice="opt">--help</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-icon-browser</command> is a utility to explore the icons
|
||||
in the current icon theme. It shows icons in various sizes, their symbolic
|
||||
variants where available, as well as a description of the icon and its context.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<para>The following options are understood:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem><para>Show help options</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
50
docs/reference/gtk/gtk4-launch.rst
Normal file
50
docs/reference/gtk/gtk4-launch.rst
Normal file
@@ -0,0 +1,50 @@
|
||||
.. _gtk4-launch(1):
|
||||
|
||||
===========
|
||||
gtk4-launch
|
||||
===========
|
||||
|
||||
---------------------
|
||||
Launch an application
|
||||
---------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-launch** [OPTIONS...] <APPLICATION> [URI...]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-launch`` launches an application using the given name. The application is
|
||||
started with proper startup notification on a default display, unless specified
|
||||
otherwise.
|
||||
|
||||
``gtk4-launch`` takes at least one argument, the name of the application to
|
||||
launch. The name should match application desktop file name, as residing in the
|
||||
applications subdirectories of the XDG data directories, with or without the
|
||||
``.desktop`` suffix.
|
||||
|
||||
If called with more than one argument, the rest of them besides the application
|
||||
name are considered URI locations and are passed as arguments to the launched
|
||||
application.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-?, -h, --help``
|
||||
|
||||
Print the command's help and exit.
|
||||
|
||||
``--version``
|
||||
|
||||
Print the command's version and exit.
|
||||
|
||||
ENVIRONMENT
|
||||
-----------
|
||||
|
||||
Some environment variables affect the behavior of ``gtk4-launch``:
|
||||
|
||||
``XDG_DATA_HOME, XDG_DATA_DIRS``
|
||||
|
||||
The environment variables specifying the XDG data directories.
|
||||
@@ -1,85 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-launch">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-launch</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Tomáš</firstname>
|
||||
<surname>Bžatek</surname>
|
||||
<email>tbzatek@redhat.com</email>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-launch</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-launch</refname>
|
||||
<refpurpose>Launch an application</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-launch</command>
|
||||
<arg choice="opt" rep="repeat">OPTION</arg>
|
||||
<arg choice="plain">APPLICATION</arg>
|
||||
<arg choice="opt" rep="repeat">URI</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-launch</command> launches an application using the given name.
|
||||
The application is started with proper startup notification on a default
|
||||
display, unless specified otherwise.
|
||||
</para>
|
||||
<para>
|
||||
<command>gtk4-launch</command> takes at least one argument, the name of
|
||||
the application to launch. The name should match application desktop file name,
|
||||
as residing in the applications subdirectories of the XDG data directories, with
|
||||
or without the '.desktop' suffix.
|
||||
</para>
|
||||
<para>
|
||||
If called with more than one argument, the rest of them besides the application
|
||||
name are considered URI locations and are passed as arguments to the launched
|
||||
application.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<para>The following options are understood:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-?</option>, <option>--help</option></term>
|
||||
<listitem><para>Prints a short help text and exits.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>--version</option></term>
|
||||
<listitem><para>Prints the program version and exits.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Environment</title>
|
||||
<para>Some environment variables affect the behavior of <command>gtk4-launch</command>.</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>XDG_DATA_HOME</option>, <option>XDG_DATA_DIRS</option></term>
|
||||
<listitem><para>The environment variables specifying the XDG dta directories.</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
21
docs/reference/gtk/gtk4-query-settings.rst
Normal file
21
docs/reference/gtk/gtk4-query-settings.rst
Normal file
@@ -0,0 +1,21 @@
|
||||
.. _gtk4-query-settings(1):
|
||||
|
||||
===================
|
||||
gtk4-query-settings
|
||||
===================
|
||||
|
||||
------------------------------------
|
||||
Print name and value of GTK settings
|
||||
------------------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-query-settings** [PATTERN]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-query-settings`` prints both name and value of all properties available
|
||||
in the ``GtkSettings`` class. Optionally, you can filter which properties to
|
||||
list by specifying a ``PATTERN``.
|
||||
@@ -1,45 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-query-settings">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-query-settings</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Timm</firstname>
|
||||
<surname>Bäder</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-query-settings</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-query-settings</refname>
|
||||
<refpurpose>Utility to print name and value of all GtkSettings properties</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-query-settings</command>
|
||||
<arg choice="opt"><replaceable>PATTERN</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-query-settings</command> prints both name and value of all properties
|
||||
available in the GtkSettings class. Optionally, you can filter which properties
|
||||
to list by specifying a PATTERN.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
65
docs/reference/gtk/gtk4-update-icon-cache.rst
Normal file
65
docs/reference/gtk/gtk4-update-icon-cache.rst
Normal file
@@ -0,0 +1,65 @@
|
||||
.. _gtk4-update-icon-cache(1):
|
||||
|
||||
======================
|
||||
gtk4-update-icon-cache
|
||||
======================
|
||||
|
||||
--------------------------
|
||||
Icon theme caching utility
|
||||
--------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-update-icon-cache** [OPTIONS...] <PATH>
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-update-icon-cache`` creates ``mmap(2)``-able cache files for icon themes.
|
||||
|
||||
It expects to be given the ``PATH`` to an icon theme directory containing an
|
||||
``index.theme``, e.g. ``/usr/share/icons/hicolor``, and writes a
|
||||
``icon-theme.cache`` containing cached information about the icons in the
|
||||
directory tree below the given directory.
|
||||
|
||||
GTK can use the cache files created by ``gtk4-update-icon-cache`` to avoid a lot
|
||||
of system call and disk seek overhead when the application starts. Since the
|
||||
format of the cache files allows them to be shared across multiple processes,
|
||||
for instance using the POSIX ``mmap(2)`` system call, the overall memory
|
||||
consumption is reduced as well.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-f, --force``
|
||||
|
||||
Overwrite an existing cache file even if it appears to be up-to-date.
|
||||
|
||||
``-t, --ignore-theme-index``
|
||||
|
||||
Don't check for the existence of ``index.theme`` in the icon theme directory.
|
||||
Without this option, ``gtk4-update-icon-cache`` refuses to create an icon
|
||||
cache in a directory which does not appear to be the toplevel directory of an
|
||||
icon theme.
|
||||
|
||||
``-i, --index-only``
|
||||
|
||||
Don't include image data in the cache.
|
||||
|
||||
``--include-image-data``
|
||||
|
||||
Include image data in the cache.
|
||||
|
||||
``-c, --source <NAME>``
|
||||
|
||||
Output a C header file declaring a constant ``NAME`` with the contents of the
|
||||
icon cache.
|
||||
|
||||
``-q, --quiet``
|
||||
|
||||
Turn off verbose output.
|
||||
|
||||
``-v, --validate``
|
||||
|
||||
Validate existing icon cache.
|
||||
@@ -1,123 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-update-icon-cache">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-update-icon-cache</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-update-icon-cache</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-update-icon-cache</refname>
|
||||
<refpurpose>Icon theme caching utility</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-update-icon-cache</command>
|
||||
<arg choice="opt">--force</arg>
|
||||
<arg choice="opt">--ignore-theme-index</arg>
|
||||
<group>
|
||||
<arg choice="plain">--index-only</arg>
|
||||
<arg choice="plain">--include-image-data</arg>
|
||||
</group>
|
||||
<arg choice="opt">--source <arg choice="plain"><replaceable>NAME</replaceable></arg></arg>
|
||||
<arg choice="opt">--quiet</arg>
|
||||
<arg choice="opt">--validate</arg>
|
||||
<arg choice="plain"><replaceable>PATH</replaceable></arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-update-icon-cache</command> creates mmapable cache
|
||||
files for icon themes.
|
||||
</para>
|
||||
<para>
|
||||
It expects to be given the <replaceable>PATH</replaceable> to an icon theme
|
||||
directory containing an <filename>index.theme</filename>, e.g.
|
||||
<filename>/usr/share/icons/hicolor</filename>, and writes a
|
||||
<filename>icon-theme.cache</filename> containing cached information about
|
||||
the icons in the directory tree below the given directory.
|
||||
</para>
|
||||
<para>
|
||||
GTK can use the cache files created by <command>gtk4-update-icon-cache</command>
|
||||
to avoid a lot of system call and disk seek overhead when the application
|
||||
starts. Since the format of the cache files allows them to be shared across
|
||||
multiple processes, for instance using the POSIX <command>mmap()</command> system
|
||||
call, the overall memory consumption is reduced as well.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>--force</term>
|
||||
<term>-f</term>
|
||||
<listitem><para>Overwrite an existing cache file even if it appears to be
|
||||
up-to-date.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--ignore-theme-index</term>
|
||||
<term>-t</term>
|
||||
<listitem><para>Don't check for the existence of <filename>index.theme</filename>
|
||||
in the icon theme directory. Without this option, <command>gtk4-update-icon-cache</command>
|
||||
refuses to create an icon cache in a directory which does not appear to
|
||||
be the toplevel directory of an icon theme.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--index-only</term>
|
||||
<term>-i</term>
|
||||
<listitem><para>Don't include image data in the cache.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--include-image-data</term>
|
||||
<listitem><para>Include image data in the cache.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--source</term>
|
||||
<term>-c</term>
|
||||
<listitem><para>Output a C header file declaring a constant
|
||||
<replaceable>NAME</replaceable> with the contents of the icon
|
||||
cache.</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--quiet</term>
|
||||
<term>-q</term>
|
||||
<listitem><para>Turn off verbose output.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>--validate</term>
|
||||
<term>-v</term>
|
||||
<listitem><para>Validate existing icon cache.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
34
docs/reference/gtk/gtk4-widget-factory.rst
Normal file
34
docs/reference/gtk/gtk4-widget-factory.rst
Normal file
@@ -0,0 +1,34 @@
|
||||
.. _gtk4-widget-factory(1):
|
||||
|
||||
===================
|
||||
gtk4-widget-factory
|
||||
===================
|
||||
|
||||
-------------------------------
|
||||
Showcase GTK widgets and styles
|
||||
-------------------------------
|
||||
|
||||
SYNOPSIS
|
||||
--------
|
||||
|
||||
| **gtk4-widget-factory** [OPTIONS...]
|
||||
|
||||
DESCRIPTION
|
||||
-----------
|
||||
|
||||
``gtk4-widget-factory`` is a collection of examples.
|
||||
|
||||
Its purpose is to demonstrate many GTK widgets in a form that is useful to GTK theme developers.
|
||||
|
||||
The application shows widgets in different, typical combinations and states.
|
||||
|
||||
OPTIONS
|
||||
-------
|
||||
|
||||
``-h, --help``
|
||||
|
||||
Show the application help.
|
||||
|
||||
``--version``
|
||||
|
||||
Show the application version.
|
||||
@@ -1,63 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<refentry id="gtk4-widget-factory">
|
||||
|
||||
<refentryinfo>
|
||||
<title>gtk4-widget-factory</title>
|
||||
<productname>GTK</productname>
|
||||
<authorgroup>
|
||||
<author>
|
||||
<contrib>Developer</contrib>
|
||||
<firstname>Matthias</firstname>
|
||||
<surname>Clasen</surname>
|
||||
</author>
|
||||
</authorgroup>
|
||||
</refentryinfo>
|
||||
|
||||
<refmeta>
|
||||
<refentrytitle>gtk4-widget-factory</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="manual">User Commands</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>gtk4-widget-factory</refname>
|
||||
<refpurpose>Demonstrate GTK widgets</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>gtk4-widget-factory</command>
|
||||
<arg choice="opt">--help</arg>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
|
||||
<refsect1><title>Description</title>
|
||||
<para>
|
||||
<command>gtk4-widget-factory</command> is a collection of examples.
|
||||
Its purpose is to demonstrate many GTK widgets in a form
|
||||
that is useful to GTK theme developers.
|
||||
</para>
|
||||
<para>
|
||||
The application shows widgets in different, typical combinations
|
||||
and states.
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
<refsect1><title>Options</title>
|
||||
<para>The following options are understood:</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>-h</option>, <option>--help</option></term>
|
||||
<listitem><para>Show help options</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--version</option></term>
|
||||
<listitem><para>Show program version</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
||||
@@ -59,24 +59,15 @@ if get_option('gtk_doc')
|
||||
)
|
||||
endif
|
||||
|
||||
xsltproc = find_program('xsltproc', required: false)
|
||||
if get_option('man-pages') and not xsltproc.found()
|
||||
error('No xsltproc found, but man pages were explicitly enabled')
|
||||
rst2man = find_program('rst2man', required: false)
|
||||
if get_option('man-pages') and not rst2man.found()
|
||||
error('No rst2man found, but man pages were explicitly enabled')
|
||||
endif
|
||||
|
||||
if get_option('man-pages') and xsltproc.found()
|
||||
xlstproc_flags = [
|
||||
'--nonet',
|
||||
'--stringparam', 'man.output.quietly', '1',
|
||||
'--stringparam', 'funcsynopsis.style', 'ansi',
|
||||
'--stringparam', 'man.th.extra1.suppress', '1',
|
||||
'--stringparam', 'man.authors.section.enabled', '0',
|
||||
'--stringparam', 'man.copyright.section.enabled', '0',
|
||||
]
|
||||
|
||||
man_files = [
|
||||
[ 'gtk4-broadwayd', '1', ],
|
||||
[ 'gtk4-builder-tool', '1', ],
|
||||
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', ],
|
||||
@@ -84,7 +75,7 @@ if get_option('man-pages') and xsltproc.found()
|
||||
]
|
||||
|
||||
if get_option('demos')
|
||||
man_files += [
|
||||
rst_files += [
|
||||
[ 'gtk4-demo', '1', ],
|
||||
[ 'gtk4-demo-application', '1', ],
|
||||
[ 'gtk4-widget-factory', '1', ],
|
||||
@@ -92,21 +83,25 @@ if get_option('man-pages') and xsltproc.found()
|
||||
]
|
||||
endif
|
||||
|
||||
foreach man: man_files
|
||||
man_name = man.get(0)
|
||||
man_section = man.get(1, '1')
|
||||
custom_target('@0@.@1@'.format(man_name, man_section),
|
||||
input: '@0@.xml'.format(man_name),
|
||||
rst2man_flags = [
|
||||
'--syntax-highlight=none',
|
||||
]
|
||||
|
||||
foreach rst: rst_files
|
||||
man_name = rst[0]
|
||||
man_section = rst.get(1, '1')
|
||||
|
||||
custom_target('man-@0@'.format(man_name),
|
||||
input: '@0@.rst'.format(man_name),
|
||||
output: '@0@.@1@'.format(man_name, man_section),
|
||||
command: [
|
||||
xsltproc,
|
||||
xlstproc_flags,
|
||||
'-o', '@OUTPUT@',
|
||||
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
|
||||
rst2man,
|
||||
rst2man_flags,
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true,
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)),
|
||||
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
|
||||
)
|
||||
endforeach
|
||||
endif
|
||||
|
||||
@@ -668,18 +668,21 @@ box children as necessary.
|
||||
### Adapt to `GtkWindow` API changes
|
||||
|
||||
Following the `GdkSurface` changes, a number of `GtkWindow` APIs that were
|
||||
X11-specific have been removed. This includes `gtk_window_set_geometry_hints()`,
|
||||
`gtk_window_set_gravity()`, `gtk_window_move()`, `gtk_window_parse_geometry()`,
|
||||
X11-specific have been removed. This includes `gtk_window_set_position()`,
|
||||
`gtk_window_set_geometry_hints()`, `gtk_window_set_gravity()`,
|
||||
`gtk_window_move()`, `gtk_window_parse_geometry()`,
|
||||
`gtk_window_set_keep_above()`, `gtk_window_set_keep_below()`,
|
||||
`gtk_window_begin_resize_drag()`, `gtk_window_begin_move_drag()`.
|
||||
Most likely, you should just stop using them. In some cases, you can
|
||||
fall back to using the underlying `GdkToplevel` APIs (for example,
|
||||
[method@Gdk.Toplevel.begin_resize]).
|
||||
[`method@Gdk.Toplevel.begin_resize`]); alternatively, you will need to get
|
||||
the native windowing system surface from the `GtkWindow` and call platform
|
||||
specific API.
|
||||
|
||||
The APIs for controlling `GtkWindow` size have changed to be better aligned
|
||||
with the way size changes are integrated in the frame cycle. `gtk_window_resize()`
|
||||
and `gtk_window_get_size()` have been removed. Instead, use
|
||||
[method@Gtk.Window.set_default_size] and [method@Gtk.Window.get_default_size].
|
||||
[`method@Gtk.Window.set_default_size`] and [`method@Gtk.Window.get_default_size`].
|
||||
|
||||
### Adapt to `GtkHeaderBar` and `GtkActionBar` API changes
|
||||
|
||||
@@ -1332,6 +1335,18 @@ pointer coordinates as inout arguments any more, but as normal in ones.
|
||||
|
||||
See: [method@Gtk.TreeView.get_tooltip_context], [method@Gtk.IconView.get_tooltip_context]
|
||||
|
||||
### Adapt to GtkPopover changes
|
||||
|
||||
In GTK 3, a `GtkPopover` could be attached to any widget, using the `relative-to`
|
||||
property. This is no longer possible in GTK 4. The parent widget has to be aware
|
||||
of its popover children, and manage their size allocation. Therefore, only widgets
|
||||
with dedicated popover support can have them, such as [class@Gtk.MenuButton] or
|
||||
[class@Gtk.PopoverMenuBar].
|
||||
|
||||
If you want to make a custom widget that has an attached popover, you need to call
|
||||
[method@Gtk.Popover.present] in your [vfunc@Gtk.Widget.size_allocate] vfunc, in order
|
||||
to update the positioning of the popover.
|
||||
|
||||
### Stop using GtkFileChooserButton
|
||||
|
||||
The `GtkFileChooserButton` widget was removed, due to its shortcomings in
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
|
||||
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
|
||||
]>
|
||||
<partintro>
|
||||
<para>
|
||||
GTK is a library for creating graphical user interfaces. It
|
||||
works on many UNIX-like platforms, Windows, and OS X.
|
||||
GTK is released under the GNU Library General Public License
|
||||
(GNU LGPL), which allows for flexible licensing of client
|
||||
applications. GTK has a C-based object-oriented architecture that
|
||||
allows for maximum flexibility. Bindings for many other languages have
|
||||
been written, including C++, Objective-C, Guile/Scheme, Perl, Python,
|
||||
TOM, Ada95, Free Pascal, and Eiffel. The GTK library itself contains
|
||||
<firstterm>widgets</firstterm>, that is, GUI components such as GtkButton
|
||||
or GtkTextView.
|
||||
|
||||
</para>
|
||||
<para>
|
||||
GTK depends on the following libraries:
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>GLib</term>
|
||||
<listitem><para>
|
||||
A general-purpose utility library, not specific to graphical user interfaces.
|
||||
GLib provides many useful data types, macros, type conversions,
|
||||
string utilities, file utilities, a main loop abstraction, and so on.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GObject</term>
|
||||
<listitem><para>A library that provides a type system, a collection of
|
||||
fundamental types including an object type, a signal system.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GIO</term>
|
||||
<listitem><para>A modern, easy-to-use VFS API including abstractions for
|
||||
files, drives, volumes, stream IO, as well as network programming and
|
||||
DBus communication.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>cairo</term>
|
||||
<listitem><para>Cairo is a 2D graphics library with support for multiple
|
||||
output devices.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>Pango</term>
|
||||
<listitem><para>
|
||||
Pango is a library for internationalized text handling. It centers
|
||||
around the PangoLayout object, representing a paragraph of text.
|
||||
Pango provides the engine for GtkTextView, GtkLabel, GtkEntry, and
|
||||
other widgets that display text.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GdkPixbuf</term>
|
||||
<listitem><para>
|
||||
This is a small library which allows you to create GdkPixbuf
|
||||
("pixel buffer") objects from image data or image files.
|
||||
Use a GdkPixbuf in combination with GtkImage to display images.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>graphene</term>
|
||||
<listitem><para>
|
||||
This is a small library which provides vector and matrix datatypes
|
||||
and operations. graphene provides optimized implementations using
|
||||
various SIMD instruction sets such as SSE.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GDK</term>
|
||||
<listitem><para>
|
||||
GDK is the abstraction layer that allows GTK to support multiple
|
||||
windowing systems. GDK provides window system facilities on Wayland,
|
||||
X11, Windows, and OS X.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>GSK</term>
|
||||
<listitem><para>
|
||||
GSK is a library for creating a scene graph from render nodes,
|
||||
and rendering it using different rendering APIs. GSK provides renderers
|
||||
for OpenGL, Vulkan and cairo.
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
</partintro>
|
||||
@@ -13,4 +13,5 @@ baseURLs = [
|
||||
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
|
||||
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
|
||||
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
|
||||
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
|
||||
]
|
||||
|
||||
@@ -603,8 +603,8 @@ bloat_pad_startup (GApplication *application)
|
||||
g_object_unref (icon);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
icon = G_ICON (gdk_pixbuf_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/folder-new.png", NULL));
|
||||
item = g_menu_item_new ("Pixbuf", NULL);
|
||||
icon = G_ICON (gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/folder-new.png"));
|
||||
item = g_menu_item_new ("Texture", NULL);
|
||||
g_menu_item_set_icon (item, icon);
|
||||
g_menu_append_item (menu, item);
|
||||
g_object_unref (item);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <glib.h>
|
||||
#include <glib/gprintf.h>
|
||||
#include "gdktypes.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -609,56 +609,46 @@ open_shared_memory (void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
int fd;
|
||||
gsize size;
|
||||
} PngData;
|
||||
|
||||
static cairo_status_t
|
||||
write_png_cb (void *closure,
|
||||
const guchar *data,
|
||||
unsigned int length)
|
||||
{
|
||||
PngData *png_data = closure;
|
||||
int fd = png_data->fd;
|
||||
|
||||
while (length)
|
||||
{
|
||||
gssize ret = write (fd, data, length);
|
||||
|
||||
if (ret <= 0)
|
||||
return CAIRO_STATUS_WRITE_ERROR;
|
||||
|
||||
png_data->size += ret;
|
||||
length -= ret;
|
||||
data += ret;
|
||||
}
|
||||
|
||||
return CAIRO_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
guint32
|
||||
gdk_broadway_server_upload_texture (GdkBroadwayServer *server,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
guint32 id;
|
||||
cairo_surface_t *surface = gdk_texture_download_surface (texture);
|
||||
BroadwayRequestUploadTexture msg;
|
||||
PngData data;
|
||||
GBytes *bytes;
|
||||
const guchar *data;
|
||||
gsize size;
|
||||
int fd;
|
||||
|
||||
bytes = gdk_texture_save_to_png_bytes (texture);
|
||||
fd = open_shared_memory ();
|
||||
data = g_bytes_get_data (bytes, &size);
|
||||
|
||||
id = server->next_texture_id++;
|
||||
|
||||
data.fd = open_shared_memory ();
|
||||
data.size = 0;
|
||||
cairo_surface_write_to_png_stream (surface, write_png_cb, &data);
|
||||
|
||||
msg.id = id;
|
||||
msg.offset = 0;
|
||||
msg.size = data.size;
|
||||
msg.size = 0;
|
||||
|
||||
while (msg.size < size)
|
||||
{
|
||||
gssize ret = write (fd, data + msg.size, size - msg.size);
|
||||
|
||||
if (ret <= 0)
|
||||
{
|
||||
if (errno == EINTR)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
msg.size += ret;
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
/* This passes ownership of fd */
|
||||
gdk_broadway_server_send_fd_message (server, msg,
|
||||
BROADWAY_REQUEST_UPLOAD_TEXTURE, data.fd);
|
||||
BROADWAY_REQUEST_UPLOAD_TEXTURE, fd);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@
|
||||
#define __GDK_BROADWAY_SERVER__
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
#include "gdkdeviceprivate.h"
|
||||
|
||||
#include "broadway-protocol.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
typedef struct _GdkBroadwayServer GdkBroadwayServer;
|
||||
typedef struct _GdkBroadwayServerClass GdkBroadwayServerClass;
|
||||
|
||||
@@ -34,6 +34,7 @@ gdk_broadway_cairo_context_dispose (GObject *object)
|
||||
|
||||
static void
|
||||
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean prefers_high_depth,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "gdkmonitor-broadway.h"
|
||||
#include "gdkseatdefaultprivate.h"
|
||||
#include "gdkdevice-broadway.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
#include "gdk-private.h"
|
||||
@@ -214,7 +213,7 @@ _gdk_broadway_display_open (const char *display_name)
|
||||
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
|
||||
if (broadway_display->server == NULL)
|
||||
{
|
||||
g_printerr ("Unable to init Broadway server: %s\n", error->message);
|
||||
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
|
||||
g_error_free (error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkkeys.h"
|
||||
#include "gdksurface.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkbroadway-server.h"
|
||||
#include "gdkmonitorprivate.h"
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
@@ -34,6 +34,7 @@ gdk_broadway_draw_context_dispose (GObject *object)
|
||||
|
||||
static void
|
||||
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
|
||||
gboolean prefers_high_depth,
|
||||
cairo_region_t *region)
|
||||
{
|
||||
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
|
||||
#include "gdkeventsource.h"
|
||||
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkkeysyms.h"
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#define __GDK_PRIVATE_BROADWAY_H__
|
||||
|
||||
#include <gdk/gdkcursor.h>
|
||||
#include <gdk/gdkinternals.h>
|
||||
#include "gdksurface-broadway.h"
|
||||
#include "gdkdisplay-broadway.h"
|
||||
#include "gdkdrawcontext-broadway.h"
|
||||
|
||||
@@ -35,13 +35,12 @@
|
||||
#include "gdkdragsurfaceprivate.h"
|
||||
#include "gdkeventsource.h"
|
||||
#include "gdkframeclockidleprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkpopupprivate.h"
|
||||
#include "gdkprivate-broadway.h"
|
||||
#include "gdkseatprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdktoplevelprivate.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <graphene.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
#include <gdk/gdksurfaceprivate.h>
|
||||
#include "gdkbroadwaysurface.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ libgdk_broadway = static_library('gdk-broadway',
|
||||
|
||||
# gtk4-broadwayd
|
||||
|
||||
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
|
||||
broadwayd_syslib = os_win32 ? cc.find_library('ws2_32') : shmlib
|
||||
|
||||
executable('gtk4-broadwayd',
|
||||
sources: [
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
#ifndef __GDK__PRIVATE_H__
|
||||
#define __GDK__PRIVATE_H__
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include "gdk/gdkinternals.h"
|
||||
#include "gdk/gdktypes.h"
|
||||
|
||||
/* Private API for use in GTK+ */
|
||||
|
||||
@@ -29,14 +28,10 @@ gboolean gdk_should_use_portal (void);
|
||||
|
||||
const char * gdk_get_startup_notification_id (void);
|
||||
|
||||
PangoDirection gdk_unichar_direction (gunichar ch);
|
||||
PangoDirection gdk_unichar_direction (gunichar ch) G_GNUC_CONST;
|
||||
PangoDirection gdk_find_base_dir (const char *text,
|
||||
int len);
|
||||
|
||||
void gdk_surface_set_widget (GdkSurface *surface,
|
||||
gpointer widget);
|
||||
gpointer gdk_surface_get_widget (GdkSurface *surface);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char *key;
|
||||
|
||||
25
gdk/gdk.c
25
gdk/gdk.c
@@ -26,18 +26,14 @@
|
||||
|
||||
#include "gdkversionmacros.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
#include "gdkresources.h"
|
||||
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include "gdkconstructor.h"
|
||||
|
||||
#ifndef HAVE_XCONVERTCASE
|
||||
#include "gdkkeysyms.h"
|
||||
#endif
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
@@ -125,7 +121,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
|
||||
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
|
||||
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Use a GLES OpenGL context" },
|
||||
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" },
|
||||
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
|
||||
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
|
||||
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
|
||||
@@ -133,6 +129,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
|
||||
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
|
||||
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
|
||||
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
|
||||
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
|
||||
};
|
||||
|
||||
|
||||
@@ -299,6 +296,14 @@ gdk_pre_parse (void)
|
||||
gdk_debug_keys,
|
||||
G_N_ELEMENTS (gdk_debug_keys));
|
||||
|
||||
/* These are global */
|
||||
if (GDK_DEBUG_CHECK (GL_EGL))
|
||||
gdk_gl_backend_use (GDK_GL_EGL);
|
||||
else if (GDK_DEBUG_CHECK (GL_GLX))
|
||||
gdk_gl_backend_use (GDK_GL_GLX);
|
||||
else if (GDK_DEBUG_CHECK (GL_WGL))
|
||||
gdk_gl_backend_use (GDK_GL_WGL);
|
||||
|
||||
#ifndef G_HAS_CONSTRUCTORS
|
||||
stash_desktop_startup_notification_id ();
|
||||
#endif
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <gdk/gdkdragsurface.h>
|
||||
#include <gdk/gdkdrawcontext.h>
|
||||
#include <gdk/gdkdrop.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdkenumtypes.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
#include <gdk/gdkframeclock.h>
|
||||
|
||||
@@ -32,7 +32,7 @@ G_BEGIN_DECLS
|
||||
|
||||
#define GDK_TYPE_APP_LAUNCH_CONTEXT (gdk_app_launch_context_get_type ())
|
||||
#define GDK_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContext))
|
||||
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
|
||||
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
|
||||
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
||||
@@ -17,9 +17,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkcairo.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkcairoprivate.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -93,11 +91,7 @@ void
|
||||
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
const GdkPixbuf *pixbuf)
|
||||
{
|
||||
int width, height;
|
||||
guchar *gdk_pixels, *cairo_pixels;
|
||||
int gdk_rowstride, cairo_stride;
|
||||
int n_channels;
|
||||
int j;
|
||||
GdkTexture *texture;
|
||||
|
||||
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
|
||||
return;
|
||||
@@ -113,71 +107,11 @@ gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
|
||||
|
||||
cairo_surface_flush (surface);
|
||||
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
|
||||
gdk_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
|
||||
n_channels = gdk_pixbuf_get_n_channels (pixbuf);
|
||||
cairo_stride = cairo_image_surface_get_stride (surface);
|
||||
cairo_pixels = cairo_image_surface_get_data (surface);
|
||||
|
||||
for (j = height; j; j--)
|
||||
{
|
||||
guchar *p = gdk_pixels;
|
||||
guchar *q = cairo_pixels;
|
||||
|
||||
if (n_channels == 3)
|
||||
{
|
||||
guchar *end = p + 3 * width;
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
q[0] = p[2];
|
||||
q[1] = p[1];
|
||||
q[2] = p[0];
|
||||
q[3] = 0xFF;
|
||||
#else
|
||||
q[0] = 0xFF;
|
||||
q[1] = p[0];
|
||||
q[2] = p[1];
|
||||
q[3] = p[2];
|
||||
#endif
|
||||
p += 3;
|
||||
q += 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
guchar *end = p + 4 * width;
|
||||
guint t1,t2,t3;
|
||||
|
||||
#define MULT(d,c,a,t) G_STMT_START { t = c * a + 0x80; d = ((t >> 8) + t) >> 8; } G_STMT_END
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
|
||||
MULT(q[0], p[2], p[3], t1);
|
||||
MULT(q[1], p[1], p[3], t2);
|
||||
MULT(q[2], p[0], p[3], t3);
|
||||
q[3] = p[3];
|
||||
#else
|
||||
q[0] = p[3];
|
||||
MULT(q[1], p[0], p[3], t1);
|
||||
MULT(q[2], p[1], p[3], t2);
|
||||
MULT(q[3], p[2], p[3], t3);
|
||||
#endif
|
||||
|
||||
p += 4;
|
||||
q += 4;
|
||||
}
|
||||
|
||||
#undef MULT
|
||||
}
|
||||
|
||||
gdk_pixels += gdk_rowstride;
|
||||
cairo_pixels += cairo_stride;
|
||||
}
|
||||
texture = gdk_texture_new_for_pixbuf (GDK_PIXBUF (pixbuf));
|
||||
gdk_texture_download (texture,
|
||||
cairo_image_surface_get_data (surface),
|
||||
cairo_image_surface_get_stride (surface));
|
||||
g_object_unref (texture);
|
||||
|
||||
cairo_surface_mark_dirty (surface);
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ cairo_region_t *
|
||||
gdk_cairo_region_create_from_surface
|
||||
(cairo_surface_t *surface);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GDK_DEPRECATED_IN_4_6_FOR(gdk_gl_texture_new)
|
||||
void gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
GdkSurface *surface,
|
||||
int source,
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "gdkcairocontextprivate.h"
|
||||
|
||||
#include "gdkcairo.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
/**
|
||||
* GdkCairoContext:
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
#ifndef __GDK_CAIRO_PRIVATE_H__
|
||||
#define __GDK_CAIRO_PRIVATE_H__
|
||||
|
||||
#include "gdkcairo.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <cairo.h>
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdkrgbaprivate.h"
|
||||
#include "loaders/gdkpngprivate.h"
|
||||
#include "loaders/gdktiffprivate.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
@@ -655,6 +657,56 @@ pixbuf_deserializer (GdkContentDeserializer *deserializer)
|
||||
deserializer);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
gpointer deserializer)
|
||||
{
|
||||
GOutputStream *stream = G_OUTPUT_STREAM (source);
|
||||
GBytes *bytes;
|
||||
GError *error = NULL;
|
||||
GdkTexture *texture = NULL;
|
||||
gssize written;
|
||||
|
||||
written = g_output_stream_splice_finish (stream, result, &error);
|
||||
if (written < 0)
|
||||
{
|
||||
gdk_content_deserializer_return_error (deserializer, error);
|
||||
return;
|
||||
}
|
||||
|
||||
bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (stream));
|
||||
|
||||
texture = gdk_texture_new_from_bytes (bytes, &error);
|
||||
g_bytes_unref (bytes);
|
||||
if (texture == NULL)
|
||||
{
|
||||
gdk_content_deserializer_return_error (deserializer, error);
|
||||
return;
|
||||
}
|
||||
|
||||
g_value_take_object (gdk_content_deserializer_get_value (deserializer), texture);
|
||||
gdk_content_deserializer_return_success (deserializer);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_deserializer (GdkContentDeserializer *deserializer)
|
||||
{
|
||||
GOutputStream *output;
|
||||
|
||||
output = g_memory_output_stream_new_resizable ();
|
||||
|
||||
g_output_stream_splice_async (output,
|
||||
gdk_content_deserializer_get_input_stream (deserializer),
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE
|
||||
| G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
|
||||
gdk_content_deserializer_get_priority (deserializer),
|
||||
gdk_content_deserializer_get_cancellable (deserializer),
|
||||
texture_deserializer_finish,
|
||||
deserializer);
|
||||
g_object_unref (output);
|
||||
}
|
||||
|
||||
static void
|
||||
string_deserializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
@@ -863,48 +915,71 @@ init (void)
|
||||
|
||||
initialized = TRUE;
|
||||
|
||||
gdk_content_register_deserializer ("image/png",
|
||||
GDK_TYPE_TEXTURE,
|
||||
texture_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_deserializer ("image/tiff",
|
||||
GDK_TYPE_TEXTURE,
|
||||
texture_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_deserializer ("image/jpeg",
|
||||
GDK_TYPE_TEXTURE,
|
||||
texture_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
|
||||
formats = gdk_pixbuf_get_formats ();
|
||||
|
||||
/* Make sure png comes first */
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char *name;
|
||||
|
||||
char *name;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
if (g_str_equal (name, "png"))
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
|
||||
g_free (name);
|
||||
|
||||
break;
|
||||
}
|
||||
g_free (name);
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
}
|
||||
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char **mimes, **m;
|
||||
char *name;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
mimes = gdk_pixbuf_format_get_mime_types (fmt);
|
||||
for (m = mimes; *m; m++)
|
||||
{
|
||||
gdk_content_register_deserializer (*m,
|
||||
GDK_TYPE_TEXTURE,
|
||||
pixbuf_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
{
|
||||
/* Turning pngs, jpegs and tiffs into textures is handled above */
|
||||
if (!g_str_equal (name, "png") &&
|
||||
!g_str_equal (name, "jpeg") &&
|
||||
!g_str_equal (name, "tiff"))
|
||||
gdk_content_register_deserializer (*m,
|
||||
GDK_TYPE_TEXTURE,
|
||||
pixbuf_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
gdk_content_register_deserializer (*m,
|
||||
GDK_TYPE_PIXBUF,
|
||||
pixbuf_deserializer,
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
g_strfreev (mimes);
|
||||
g_free (name);
|
||||
}
|
||||
|
||||
g_slist_free (formats);
|
||||
@@ -933,11 +1008,13 @@ init (void)
|
||||
if (!g_get_charset (&charset))
|
||||
{
|
||||
char *mime = g_strdup_printf ("text/plain;charset=%s", charset);
|
||||
|
||||
gdk_content_register_deserializer (mime,
|
||||
G_TYPE_STRING,
|
||||
string_deserializer,
|
||||
(gpointer) charset,
|
||||
g_free);
|
||||
g_free (mime);
|
||||
}
|
||||
gdk_content_register_deserializer ("text/plain",
|
||||
G_TYPE_STRING,
|
||||
|
||||
@@ -808,8 +808,13 @@ gdk_content_formats_builder_add_mime_type (GdkContentFormatsBuilder *builder,
|
||||
builder->n_mime_types++;
|
||||
}
|
||||
|
||||
/* G_DEFINE_BOXED wants this */
|
||||
typedef gpointer GdkFileList;
|
||||
/* {{{ GdkFileList */
|
||||
|
||||
/* We're using GdkFileList* and GSList* interchangeably, counting on the
|
||||
* fact that we're just passing around gpointers; the only reason why we
|
||||
* have a GdkFileList opaque type is for language bindings, because they
|
||||
* can have no idea what a GSList of GFiles is.
|
||||
*/
|
||||
|
||||
static gpointer
|
||||
gdk_file_list_copy (gpointer list)
|
||||
@@ -824,3 +829,23 @@ gdk_file_list_free (gpointer list)
|
||||
}
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GdkFileList, gdk_file_list, gdk_file_list_copy, gdk_file_list_free)
|
||||
|
||||
/**
|
||||
* gdk_file_list_get_files:
|
||||
* @file_list: the file list
|
||||
*
|
||||
* Retrieves the list of files inside a `GdkFileList`.
|
||||
*
|
||||
* This function is meant for language bindings.
|
||||
*
|
||||
* Returns: (transfer container) (element-type GFile): the files inside the list
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
GSList *
|
||||
gdk_file_list_get_files (GdkFileList *file_list)
|
||||
{
|
||||
return g_slist_copy ((GSList *) file_list);
|
||||
}
|
||||
|
||||
/* }}} */
|
||||
|
||||
@@ -109,8 +109,19 @@ void gdk_content_formats_builder_add_gtype (GdkContentForma
|
||||
/* dunno where else to put this */
|
||||
#define GDK_TYPE_FILE_LIST (gdk_file_list_get_type ())
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gdk_file_list_get_type (void) G_GNUC_CONST;
|
||||
GType gdk_file_list_get_type (void) G_GNUC_CONST;
|
||||
|
||||
/**
|
||||
* GdkFileList:
|
||||
*
|
||||
* An opaque type representing a list of files.
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
typedef struct _GdkFileList GdkFileList;
|
||||
|
||||
GDK_AVAILABLE_IN_4_6
|
||||
GSList * gdk_file_list_get_files (GdkFileList *file_list);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
||||
@@ -26,6 +26,10 @@
|
||||
#include "filetransferportalprivate.h"
|
||||
#include "gdktextureprivate.h"
|
||||
#include "gdkrgba.h"
|
||||
#include "loaders/gdkpngprivate.h"
|
||||
#include "loaders/gdktiffprivate.h"
|
||||
#include "loaders/gdkjpegprivate.h"
|
||||
#include "gdkmemorytextureprivate.h"
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <string.h>
|
||||
@@ -606,6 +610,7 @@ gdk_content_serialize_finish (GAsyncResult *result,
|
||||
|
||||
/*** SERIALIZERS ***/
|
||||
|
||||
|
||||
static void
|
||||
pixbuf_serializer_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
@@ -636,11 +641,7 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
|
||||
{
|
||||
GdkTexture *texture = g_value_get_object (value);
|
||||
cairo_surface_t *surface = gdk_texture_download_surface (texture);
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface,
|
||||
0, 0,
|
||||
gdk_texture_get_width (texture), gdk_texture_get_height (texture));
|
||||
cairo_surface_destroy (surface);
|
||||
pixbuf = gdk_pixbuf_get_from_texture (texture);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -658,6 +659,77 @@ pixbuf_serializer (GdkContentSerializer *serializer)
|
||||
g_object_unref (pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_serializer_finish (GObject *source,
|
||||
GAsyncResult *res,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkContentSerializer *serializer = GDK_CONTENT_SERIALIZER (source);
|
||||
GError *error = NULL;
|
||||
|
||||
if (!g_task_propagate_boolean (G_TASK (res), &error))
|
||||
gdk_content_serializer_return_error (serializer, error);
|
||||
else
|
||||
gdk_content_serializer_return_success (serializer);
|
||||
}
|
||||
|
||||
static void
|
||||
serialize_texture_in_thread (GTask *task,
|
||||
gpointer source_object,
|
||||
gpointer task_data,
|
||||
GCancellable *cancellable)
|
||||
{
|
||||
GdkContentSerializer *serializer = source_object;
|
||||
const GValue *value;
|
||||
GdkTexture *texture;
|
||||
GBytes *bytes = NULL;
|
||||
GError *error = NULL;
|
||||
gboolean result = FALSE;
|
||||
GInputStream *input;
|
||||
gssize spliced;
|
||||
|
||||
value = gdk_content_serializer_get_value (serializer);
|
||||
texture = g_value_get_object (value);
|
||||
|
||||
if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/png") == 0)
|
||||
bytes = gdk_save_png (texture);
|
||||
else if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/tiff") == 0)
|
||||
bytes = gdk_save_tiff (texture);
|
||||
else if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/jpeg") == 0)
|
||||
bytes = gdk_save_jpeg (texture);
|
||||
else
|
||||
g_assert_not_reached ();
|
||||
|
||||
input = g_memory_input_stream_new_from_bytes (bytes);
|
||||
spliced = g_output_stream_splice (gdk_content_serializer_get_output_stream (serializer),
|
||||
input,
|
||||
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
&error);
|
||||
g_object_unref (input);
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
result = spliced != -1;
|
||||
|
||||
if (result)
|
||||
g_task_return_boolean (task, result);
|
||||
else
|
||||
g_task_return_error (task, error);
|
||||
}
|
||||
|
||||
static void
|
||||
texture_serializer (GdkContentSerializer *serializer)
|
||||
{
|
||||
GTask *task;
|
||||
|
||||
task = g_task_new (serializer,
|
||||
gdk_content_serializer_get_cancellable (serializer),
|
||||
texture_serializer_finish,
|
||||
NULL);
|
||||
g_task_run_in_thread (task, serialize_texture_in_thread);
|
||||
g_object_unref (task);
|
||||
}
|
||||
|
||||
static void
|
||||
string_serializer_finish (GObject *source,
|
||||
GAsyncResult *result,
|
||||
@@ -877,51 +949,72 @@ init (void)
|
||||
|
||||
initialized = TRUE;
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
"image/png",
|
||||
texture_serializer,
|
||||
NULL, NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
"image/tiff",
|
||||
texture_serializer,
|
||||
NULL, NULL);
|
||||
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
"image/jpeg",
|
||||
texture_serializer,
|
||||
NULL, NULL);
|
||||
|
||||
formats = gdk_pixbuf_get_formats ();
|
||||
|
||||
/* Make sure png comes first */
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char *name;
|
||||
|
||||
char *name;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
if (g_str_equal (name, "png"))
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
{
|
||||
formats = g_slist_delete_link (formats, f);
|
||||
formats = g_slist_prepend (formats, fmt);
|
||||
|
||||
g_free (name);
|
||||
|
||||
break;
|
||||
}
|
||||
g_free (name);
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
}
|
||||
}
|
||||
|
||||
for (f = formats; f; f = f->next)
|
||||
{
|
||||
GdkPixbufFormat *fmt = f->data;
|
||||
char **mimes, **m;
|
||||
char *name;
|
||||
|
||||
if (!gdk_pixbuf_format_is_writable (fmt))
|
||||
continue;
|
||||
continue;
|
||||
|
||||
name = gdk_pixbuf_format_get_name (fmt);
|
||||
mimes = gdk_pixbuf_format_get_mime_types (fmt);
|
||||
for (m = mimes; *m; m++)
|
||||
{
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
*m,
|
||||
pixbuf_serializer,
|
||||
gdk_pixbuf_format_get_name (fmt),
|
||||
g_free);
|
||||
{
|
||||
/* Turning textures into pngs, tiffs or jpegs is handled above */
|
||||
if (!g_str_equal (name, "png") &&
|
||||
!g_str_equal (name, "tiff") &&
|
||||
!g_str_equal (name, "jpeg"))
|
||||
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
|
||||
*m,
|
||||
pixbuf_serializer,
|
||||
gdk_pixbuf_format_get_name (fmt),
|
||||
g_free);
|
||||
gdk_content_register_serializer (GDK_TYPE_PIXBUF,
|
||||
*m,
|
||||
pixbuf_serializer,
|
||||
gdk_pixbuf_format_get_name (fmt),
|
||||
g_free);
|
||||
}
|
||||
}
|
||||
g_strfreev (mimes);
|
||||
g_free (name);
|
||||
}
|
||||
|
||||
g_slist_free (formats);
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#include "gdkcursorprivate.h"
|
||||
#include "gdktexture.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -18,8 +18,11 @@
|
||||
#ifndef __GDK_DEBUG_H__
|
||||
#define __GDK_DEBUG_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
#include <glib.h>
|
||||
|
||||
#include "gdktypes.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef enum {
|
||||
GDK_DEBUG_MISC = 1 << 0,
|
||||
@@ -47,6 +50,7 @@ typedef enum {
|
||||
GDK_DEBUG_VULKAN_DISABLE = 1 << 21,
|
||||
GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
|
||||
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
|
||||
GDK_DEBUG_HIGH_DEPTH = 1 << 24,
|
||||
} GdkDebugFlags;
|
||||
|
||||
extern guint _gdk_debug_flags;
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdevicetool.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
|
||||
@@ -331,7 +330,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
|
||||
* GdkDevice::changed:
|
||||
* @device: the `GdkDevice`
|
||||
*
|
||||
* Emitted either when the the number of either axes or keys changes.
|
||||
* Emitted either when the number of either axes or keys changes.
|
||||
*
|
||||
* On X11 this will normally happen when the physical device
|
||||
* routing events through the logical device changes (for
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#include <math.h>
|
||||
|
||||
#include "gdkdevicetoolprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -22,8 +22,9 @@
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
487
gdk/gdkdisplay.c
487
gdk/gdkdisplay.c
@@ -27,16 +27,20 @@
|
||||
#include "gdkintl.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include "gdkapplaunchcontext.h"
|
||||
#include "gdkclipboardprivate.h"
|
||||
#include "gdkdeviceprivate.h"
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkevents.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkmonitorprivate.h"
|
||||
#include "gdkframeclockidleprivate.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdkmonitorprivate.h"
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#include <epoxy/egl.h>
|
||||
#endif
|
||||
#include <math.h>
|
||||
#include <glib.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
* GdkDisplay:
|
||||
@@ -87,6 +91,12 @@ struct _GdkDisplayPrivate {
|
||||
GdkGLContext *gl_context;
|
||||
GError *gl_error;
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
EGLDisplay egl_display;
|
||||
EGLConfig egl_config;
|
||||
EGLConfig egl_config_high_depth;
|
||||
#endif
|
||||
|
||||
guint rgba : 1;
|
||||
guint composited : 1;
|
||||
guint input_shapes : 1;
|
||||
@@ -146,6 +156,26 @@ gdk_display_default_init_gl (GdkDisplay *display,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static guint
|
||||
gdk_display_default_rate_egl_config (GdkDisplay *display,
|
||||
gpointer egl_display,
|
||||
gpointer config)
|
||||
{
|
||||
guint distance = 0;
|
||||
#ifdef HAVE_EGL
|
||||
int tmp;
|
||||
|
||||
if (!eglGetConfigAttrib (egl_display, config, EGL_SAMPLE_BUFFERS, &tmp) || tmp != 0)
|
||||
distance += 0x20000;
|
||||
|
||||
if (!eglGetConfigAttrib (egl_display, config, EGL_DEPTH_SIZE, &tmp) || tmp != 0 ||
|
||||
!eglGetConfigAttrib (egl_display, config, EGL_STENCIL_SIZE, &tmp) || tmp != 0)
|
||||
distance += 0x10000;
|
||||
#endif
|
||||
|
||||
return distance;
|
||||
}
|
||||
|
||||
static GdkSeat *
|
||||
gdk_display_real_get_default_seat (GdkDisplay *display)
|
||||
{
|
||||
@@ -173,6 +203,7 @@ gdk_display_class_init (GdkDisplayClass *class)
|
||||
class->make_default = gdk_display_real_make_default;
|
||||
class->get_app_launch_context = gdk_display_real_get_app_launch_context;
|
||||
class->init_gl = gdk_display_default_init_gl;
|
||||
class->rate_egl_config = gdk_display_default_rate_egl_config;
|
||||
class->get_default_seat = gdk_display_real_get_default_seat;
|
||||
class->opened = gdk_display_real_opened;
|
||||
|
||||
@@ -352,6 +383,9 @@ gdk_display_dispose (GObject *object)
|
||||
g_queue_clear (&display->queued_events);
|
||||
|
||||
g_clear_object (&priv->gl_context);
|
||||
#ifdef HAVE_EGL
|
||||
g_clear_pointer (&priv->egl_display, eglTerminate);
|
||||
#endif
|
||||
g_clear_error (&priv->gl_error);
|
||||
|
||||
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
|
||||
@@ -1233,6 +1267,8 @@ gdk_display_init_gl (GdkDisplay *self)
|
||||
*/
|
||||
priv->gl_context = context;
|
||||
|
||||
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
|
||||
|
||||
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
|
||||
}
|
||||
|
||||
@@ -1289,6 +1325,38 @@ gdk_display_prepare_gl (GdkDisplay *self,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_display_create_gl_context:
|
||||
* @self: a `GdkDisplay`
|
||||
* @error: return location for an error
|
||||
*
|
||||
* Creates a new `GdkGLContext` for the `GdkDisplay`.
|
||||
*
|
||||
* The context is disconnected from any particular surface or surface
|
||||
* and cannot be used to draw to any surface. It can only be used to
|
||||
* draw to non-surface framebuffers like textures.
|
||||
*
|
||||
* If the creation of the `GdkGLContext` failed, @error will be set.
|
||||
* Before using the returned `GdkGLContext`, you will need to
|
||||
* call [method@Gdk.GLContext.make_current] or [method@Gdk.GLContext.realize].
|
||||
*
|
||||
* Returns: (transfer full): the newly created `GdkGLContext`
|
||||
*
|
||||
* Since: 4.6
|
||||
*/
|
||||
GdkGLContext *
|
||||
gdk_display_create_gl_context (GdkDisplay *self,
|
||||
GError **error)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
|
||||
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
|
||||
|
||||
if (!gdk_display_prepare_gl (self, error))
|
||||
return NULL;
|
||||
|
||||
return gdk_gl_context_new (self, NULL);
|
||||
}
|
||||
|
||||
/*< private >
|
||||
* gdk_display_get_gl_context:
|
||||
* @self: the `GdkDisplay`
|
||||
@@ -1310,6 +1378,417 @@ gdk_display_get_gl_context (GdkDisplay *self)
|
||||
return priv->gl_context;
|
||||
}
|
||||
|
||||
#ifdef HAVE_EGL
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static int
|
||||
strvcmp (gconstpointer p1,
|
||||
gconstpointer p2)
|
||||
{
|
||||
const char * const *s1 = p1;
|
||||
const char * const *s2 = p2;
|
||||
|
||||
return strcmp (*s1, *s2);
|
||||
}
|
||||
|
||||
static char *
|
||||
describe_extensions (EGLDisplay egl_display)
|
||||
{
|
||||
const char *extensions;
|
||||
char **exts;
|
||||
char *ext;
|
||||
|
||||
extensions = eglQueryString (egl_display, EGL_EXTENSIONS);
|
||||
|
||||
exts = g_strsplit (extensions, " ", -1);
|
||||
qsort (exts, g_strv_length (exts), sizeof (char *), strvcmp);
|
||||
|
||||
ext = g_strjoinv ("\n\t", exts);
|
||||
if (ext[0] == '\n')
|
||||
ext[0] = ' ';
|
||||
|
||||
g_strfreev (exts);
|
||||
|
||||
return g_strstrip (ext);
|
||||
}
|
||||
|
||||
static char *
|
||||
describe_egl_config (EGLDisplay egl_display,
|
||||
EGLConfig egl_config)
|
||||
{
|
||||
EGLint red, green, blue, alpha, type;
|
||||
|
||||
if (egl_config == NULL)
|
||||
return g_strdup ("-");
|
||||
|
||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_RED_SIZE, &red) ||
|
||||
!eglGetConfigAttrib (egl_display, egl_config, EGL_GREEN_SIZE, &green) ||
|
||||
!eglGetConfigAttrib (egl_display, egl_config, EGL_BLUE_SIZE, &blue) ||
|
||||
!eglGetConfigAttrib (egl_display, egl_config, EGL_ALPHA_SIZE, &alpha))
|
||||
return g_strdup ("Unknown");
|
||||
|
||||
if (epoxy_has_egl_extension (egl_display, "EGL_EXT_pixel_format_float"))
|
||||
{
|
||||
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_COLOR_COMPONENT_TYPE_EXT, &type))
|
||||
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
|
||||
}
|
||||
else
|
||||
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
|
||||
|
||||
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
|
||||
}
|
||||
#endif
|
||||
|
||||
/*<private>
|
||||
* gdk_display_get_egl_display:
|
||||
* @self: a display
|
||||
*
|
||||
* Retrieves the EGL display connection object for the given GDK display.
|
||||
*
|
||||
* This function returns `NULL` if GL is not supported or GDK is using
|
||||
* a different OpenGL framework than EGL.
|
||||
*
|
||||
* Returns: (nullable): the EGL display object
|
||||
*/
|
||||
gpointer
|
||||
gdk_display_get_egl_display (GdkDisplay *self)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
|
||||
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
|
||||
|
||||
if (!priv->egl_display &&
|
||||
!gdk_display_prepare_gl (self, NULL))
|
||||
return NULL;
|
||||
|
||||
return priv->egl_display;
|
||||
}
|
||||
|
||||
gpointer
|
||||
gdk_display_get_egl_config (GdkDisplay *self)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
|
||||
return priv->egl_config;
|
||||
}
|
||||
|
||||
gpointer
|
||||
gdk_display_get_egl_config_high_depth (GdkDisplay *self)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
|
||||
return priv->egl_config_high_depth;
|
||||
}
|
||||
|
||||
static EGLDisplay
|
||||
gdk_display_create_egl_display (EGLenum platform,
|
||||
gpointer native_display)
|
||||
{
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
EGLDisplay egl_display = NULL;
|
||||
|
||||
if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
|
||||
{
|
||||
PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
|
||||
|
||||
if (getPlatformDisplay != NULL)
|
||||
egl_display = getPlatformDisplay (platform, native_display, NULL);
|
||||
if (egl_display != NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
|
||||
{
|
||||
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
|
||||
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
|
||||
|
||||
if (getPlatformDisplay != NULL)
|
||||
egl_display = getPlatformDisplay (platform, native_display, NULL);
|
||||
if (egl_display != NULL)
|
||||
goto out;
|
||||
}
|
||||
|
||||
egl_display = eglGetDisplay ((EGLNativeDisplayType) native_display);
|
||||
|
||||
out:
|
||||
gdk_profiler_end_mark (start_time, "Create EGL display", NULL);
|
||||
|
||||
return egl_display;
|
||||
}
|
||||
|
||||
#define MAX_EGL_ATTRS 30
|
||||
|
||||
typedef enum {
|
||||
GDK_EGL_CONFIG_PERFECT = (1 << 0),
|
||||
GDK_EGL_CONFIG_HDR = (1 << 1),
|
||||
} GdkEGLConfigCreateFlags;
|
||||
|
||||
static EGLConfig
|
||||
gdk_display_create_egl_config (GdkDisplay *self,
|
||||
GdkEGLConfigCreateFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
EGLint attrs[MAX_EGL_ATTRS];
|
||||
EGLConfig *configs;
|
||||
EGLint count, alloced;
|
||||
EGLConfig best_config;
|
||||
guint best_score;
|
||||
|
||||
int i = 0;
|
||||
|
||||
attrs[i++] = EGL_SURFACE_TYPE;
|
||||
attrs[i++] = EGL_WINDOW_BIT;
|
||||
|
||||
attrs[i++] = EGL_COLOR_BUFFER_TYPE;
|
||||
attrs[i++] = EGL_RGB_BUFFER;
|
||||
|
||||
attrs[i++] = EGL_RED_SIZE;
|
||||
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
|
||||
attrs[i++] = EGL_GREEN_SIZE;
|
||||
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
|
||||
attrs[i++] = EGL_BLUE_SIZE;
|
||||
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
|
||||
attrs[i++] = EGL_ALPHA_SIZE;
|
||||
attrs[i++] = 8;
|
||||
|
||||
if (flags & GDK_EGL_CONFIG_HDR &&
|
||||
self->have_egl_pixel_format_float)
|
||||
{
|
||||
attrs[i++] = EGL_COLOR_COMPONENT_TYPE_EXT;
|
||||
attrs[i++] = EGL_DONT_CARE;
|
||||
}
|
||||
|
||||
attrs[i++] = EGL_NONE;
|
||||
g_assert (i < MAX_EGL_ATTRS);
|
||||
|
||||
if (!eglChooseConfig (priv->egl_display, attrs, NULL, -1, &alloced) || alloced == 0)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No EGL configuration available"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
configs = g_new (EGLConfig, alloced);
|
||||
if (!eglChooseConfig (priv->egl_display, attrs, configs, alloced, &count))
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Failed to get EGL configurations"));
|
||||
return NULL;
|
||||
}
|
||||
g_warn_if_fail (alloced == count);
|
||||
|
||||
best_score = G_MAXUINT;
|
||||
best_config = NULL;
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
guint score = GDK_DISPLAY_GET_CLASS (self)->rate_egl_config (self, priv->egl_display, configs[i]);
|
||||
|
||||
if (score < best_score)
|
||||
{
|
||||
best_score = score;
|
||||
best_config = configs[i];
|
||||
}
|
||||
|
||||
if (score == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
g_free (configs);
|
||||
|
||||
gdk_profiler_end_mark (start_time, "Create EGL config", NULL);
|
||||
|
||||
if (best_score == G_MAXUINT)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No EGL configuration with required features found"));
|
||||
return NULL;
|
||||
}
|
||||
else if ((flags & GDK_EGL_CONFIG_PERFECT) && best_score != 0)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("No perfect EGL configuration found"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return best_config;
|
||||
}
|
||||
|
||||
#undef MAX_EGL_ATTRS
|
||||
|
||||
static gboolean
|
||||
gdk_display_check_egl_extensions (EGLDisplay egl_display,
|
||||
const char **extensions,
|
||||
GError **error)
|
||||
{
|
||||
GString *missing = NULL;
|
||||
gsize i, n_missing;
|
||||
|
||||
n_missing = 0;
|
||||
|
||||
for (i = 0; extensions[i] != NULL; i++)
|
||||
{
|
||||
if (!epoxy_has_egl_extension (egl_display, extensions[i]))
|
||||
{
|
||||
if (missing == NULL)
|
||||
{
|
||||
missing = g_string_new (extensions[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_string_append (missing, ", ");
|
||||
g_string_append (missing, extensions[i]);
|
||||
}
|
||||
n_missing++;
|
||||
}
|
||||
}
|
||||
|
||||
if (n_missing)
|
||||
{
|
||||
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_UNSUPPORTED_PROFILE,
|
||||
/* translators: Arguments are the number of missing extensions
|
||||
* followed by a comma-separated list of their names */
|
||||
g_dngettext (GETTEXT_PACKAGE,
|
||||
"EGL implementation is missing extension %2$s",
|
||||
"EGL implementation is missing %d extensions: %s",
|
||||
n_missing),
|
||||
(int) n_missing, missing->str);
|
||||
|
||||
g_string_free (missing, TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gdk_display_init_egl (GdkDisplay *self,
|
||||
int platform,
|
||||
gpointer native_display,
|
||||
gboolean allow_any,
|
||||
GError **error)
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
|
||||
G_GNUC_UNUSED gint64 start_time2;
|
||||
int major, minor;
|
||||
|
||||
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
|
||||
return FALSE;
|
||||
|
||||
if (!epoxy_has_egl ())
|
||||
{
|
||||
gboolean sandboxed = gdk_running_in_sandbox ();
|
||||
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
sandboxed ? _("libEGL not available in this sandbox")
|
||||
: _("libEGL not available"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
priv->egl_display = gdk_display_create_egl_display (platform, native_display);
|
||||
|
||||
if (priv->egl_display == NULL)
|
||||
{
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Failed to create EGL display"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
start_time2 = GDK_PROFILER_CURRENT_TIME;
|
||||
if (!eglInitialize (priv->egl_display, &major, &minor))
|
||||
{
|
||||
priv->egl_display = NULL;
|
||||
g_set_error_literal (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("Could not initialize EGL display"));
|
||||
return FALSE;
|
||||
}
|
||||
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
|
||||
|
||||
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
|
||||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
|
||||
{
|
||||
g_clear_pointer (&priv->egl_display, eglTerminate);
|
||||
g_set_error (error, GDK_GL_ERROR,
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
_("EGL version %d.%d is too old. GTK requires %d.%d"),
|
||||
major, minor, GDK_EGL_MIN_VERSION_MAJOR, GDK_EGL_MIN_VERSION_MINOR);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!gdk_display_check_egl_extensions (priv->egl_display,
|
||||
(const char *[]) {
|
||||
"EGL_KHR_create_context",
|
||||
"EGL_KHR_surfaceless_context",
|
||||
NULL
|
||||
},
|
||||
error))
|
||||
{
|
||||
g_clear_pointer (&priv->egl_display, eglTerminate);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
priv->egl_config = gdk_display_create_egl_config (self,
|
||||
allow_any ? 0 : GDK_EGL_CONFIG_PERFECT,
|
||||
error);
|
||||
if (priv->egl_config == NULL)
|
||||
{
|
||||
g_clear_pointer (&priv->egl_display, eglTerminate);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
self->have_egl_buffer_age =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_buffer_age");
|
||||
self->have_egl_swap_buffers_with_damage =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_swap_buffers_with_damage");
|
||||
self->have_egl_no_config_context =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context");
|
||||
self->have_egl_pixel_format_float =
|
||||
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float");
|
||||
|
||||
if (self->have_egl_no_config_context)
|
||||
priv->egl_config_high_depth = gdk_display_create_egl_config (self,
|
||||
GDK_EGL_CONFIG_HDR,
|
||||
error);
|
||||
if (priv->egl_config_high_depth == NULL)
|
||||
priv->egl_config_high_depth = priv->egl_config;
|
||||
|
||||
GDK_DISPLAY_NOTE (self, OPENGL, {
|
||||
char *ext = describe_extensions (priv->egl_display);
|
||||
char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
|
||||
char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
|
||||
g_message ("EGL API version %d.%d found\n"
|
||||
" - Vendor: %s\n"
|
||||
" - Version: %s\n"
|
||||
" - Client APIs: %s\n"
|
||||
" - Extensions:\n"
|
||||
"\t%s\n"
|
||||
" - Selected fbconfig: %s\n"
|
||||
" high depth: %s",
|
||||
major, minor,
|
||||
eglQueryString (priv->egl_display, EGL_VENDOR),
|
||||
eglQueryString (priv->egl_display, EGL_VERSION),
|
||||
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
|
||||
ext, std_cfg,
|
||||
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
|
||||
g_free (hd_cfg);
|
||||
g_free (std_cfg);
|
||||
g_free (ext);
|
||||
});
|
||||
|
||||
gdk_profiler_end_mark (start_time, "init EGL", NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
GdkDebugFlags
|
||||
gdk_display_get_debug_flags (GdkDisplay *display)
|
||||
{
|
||||
|
||||
@@ -71,6 +71,9 @@ gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
|
||||
GDK_AVAILABLE_IN_4_4
|
||||
gboolean gdk_display_prepare_gl (GdkDisplay *self,
|
||||
GError **error);
|
||||
GDK_AVAILABLE_IN_4_6
|
||||
GdkGLContext *gdk_display_create_gl_context(GdkDisplay *self,
|
||||
GError **error);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDisplay *gdk_display_get_default (void);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
#include "gdkconfig.h"
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
|
||||
@@ -92,6 +92,8 @@ struct _GdkDisplay
|
||||
guint double_click_time; /* Maximum time between clicks in msecs */
|
||||
guint double_click_distance; /* Maximum distance between clicks in pixels */
|
||||
|
||||
GList *seats;
|
||||
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
VkInstance vk_instance;
|
||||
VkDebugReportCallbackEXT vk_debug_callback;
|
||||
@@ -103,7 +105,11 @@ struct _GdkDisplay
|
||||
guint vulkan_refcount;
|
||||
#endif /* GDK_RENDERING_VULKAN */
|
||||
|
||||
GList *seats;
|
||||
/* egl info */
|
||||
guint have_egl_buffer_age : 1;
|
||||
guint have_egl_swap_buffers_with_damage : 1;
|
||||
guint have_egl_no_config_context : 1;
|
||||
guint have_egl_pixel_format_float : 1;
|
||||
};
|
||||
|
||||
struct _GdkDisplayClass
|
||||
@@ -140,10 +146,15 @@ struct _GdkDisplayClass
|
||||
|
||||
GdkKeymap * (*get_keymap) (GdkDisplay *display);
|
||||
|
||||
GdkGLContext * (*init_gl) (GdkDisplay *display,
|
||||
GdkGLContext * (* init_gl) (GdkDisplay *display,
|
||||
GError **error);
|
||||
/* Returns the distance from a perfect score EGL config.
|
||||
* GDK chooses the one with the *LOWEST* score */
|
||||
guint (* rate_egl_config) (GdkDisplay *display,
|
||||
gpointer egl_display,
|
||||
gpointer egl_config);
|
||||
|
||||
GdkSeat * (*get_default_seat) (GdkDisplay *display);
|
||||
GdkSeat * (*get_default_seat) (GdkDisplay *display);
|
||||
|
||||
GListModel * (*get_monitors) (GdkDisplay *self);
|
||||
GdkMonitor * (*get_monitor_at_surface) (GdkDisplay *display,
|
||||
@@ -208,6 +219,16 @@ GdkSurface * gdk_display_create_surface (GdkDisplay *display
|
||||
|
||||
GdkGLContext * gdk_display_get_gl_context (GdkDisplay *display);
|
||||
|
||||
gboolean gdk_display_init_egl (GdkDisplay *display,
|
||||
int /*EGLenum*/ platform,
|
||||
gpointer native_display,
|
||||
gboolean allow_any,
|
||||
GError **error);
|
||||
gpointer gdk_display_get_egl_display (GdkDisplay *display);
|
||||
gpointer gdk_display_get_egl_config (GdkDisplay *display);
|
||||
gpointer gdk_display_get_egl_config_high_depth
|
||||
(GdkDisplay *display);
|
||||
|
||||
void gdk_display_set_rgba (GdkDisplay *display,
|
||||
gboolean rgba);
|
||||
void gdk_display_set_composited (GdkDisplay *display,
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdkevents.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@@ -69,7 +70,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GdkDragAction gdk_drag_get_selected_action (GdkDrag *drag);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gdk_drag_action_is_unique (GdkDragAction action);
|
||||
gboolean gdk_drag_action_is_unique (GdkDragAction action) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GdkDrag * gdk_drag_begin (GdkSurface *surface,
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
|
||||
#include "gdkdrawcontextprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
|
||||
/**
|
||||
* GdkDrawContext:
|
||||
@@ -275,7 +276,8 @@ gdk_draw_context_get_surface (GdkDrawContext *context)
|
||||
|
||||
/**
|
||||
* gdk_draw_context_begin_frame:
|
||||
* @context: the `GdkDrawContext` used to draw the frame
|
||||
* @context: the `GdkDrawContext` used to draw the frame. The context must
|
||||
* have a surface.
|
||||
* @region: minimum region that should be drawn
|
||||
*
|
||||
* Indicates that you are beginning the process of redrawing @region
|
||||
@@ -310,8 +312,41 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
|
||||
g_return_if_fail (priv->surface != NULL);
|
||||
g_return_if_fail (region != NULL);
|
||||
|
||||
gdk_draw_context_begin_frame_full (context, FALSE, region);
|
||||
}
|
||||
|
||||
/*
|
||||
* @prefers_high_depth: %TRUE to request a higher bit depth
|
||||
*
|
||||
* If high depth is preferred, GDK will see about providing a rendering target
|
||||
* that supports higher bit depth than 8 bits per channel. Typically this means
|
||||
* a target supporting 16bit floating point pixels, but that is not guaranteed.
|
||||
*
|
||||
* This is only a request and if the GDK backend does not support HDR rendering
|
||||
* or does not consider it worthwhile, it may choose to not honor the request.
|
||||
* It may also choose to provide high depth even if it was not requested.
|
||||
* Typically the steps undertaken by a backend are:
|
||||
* 1. Check if high depth is supported by this drawing backend.
|
||||
* 2. Check if the compositor supports high depth.
|
||||
* 3. Check if the compositor prefers regular bit depth. This is usually the case
|
||||
* when the attached monitors do not support high depth content or when the
|
||||
* system is resource constrained.
|
||||
* In either of those cases, the context will usually choose to not honor the request.
|
||||
*
|
||||
* The rendering code must be able to deal with content in any bit depth, no matter
|
||||
* the preference. The prefers_high_depth argument is only a hint and GDK is free
|
||||
* to choose.
|
||||
*/
|
||||
void
|
||||
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
gboolean prefers_high_depth,
|
||||
const cairo_region_t *region)
|
||||
{
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (priv->surface))
|
||||
return;
|
||||
|
||||
@@ -333,10 +368,13 @@ gdk_draw_context_begin_frame (GdkDrawContext *context,
|
||||
return;
|
||||
}
|
||||
|
||||
if (GDK_DISPLAY_DEBUG_CHECK (priv->display, HIGH_DEPTH))
|
||||
prefers_high_depth = TRUE;
|
||||
|
||||
priv->frame_region = cairo_region_copy (region);
|
||||
priv->surface->paint_context = g_object_ref (context);
|
||||
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, priv->frame_region);
|
||||
GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYSPROF
|
||||
@@ -377,6 +415,7 @@ gdk_draw_context_end_frame (GdkDrawContext *context)
|
||||
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
|
||||
|
||||
g_return_if_fail (GDK_IS_DRAW_CONTEXT (context));
|
||||
g_return_if_fail (priv->surface != NULL);
|
||||
|
||||
if (GDK_SURFACE_DESTROYED (priv->surface))
|
||||
return;
|
||||
|
||||
@@ -41,6 +41,7 @@ struct _GdkDrawContextClass
|
||||
GObjectClass parent_class;
|
||||
|
||||
void (* begin_frame) (GdkDrawContext *context,
|
||||
gboolean prefers_high_depth,
|
||||
cairo_region_t *update_area);
|
||||
void (* end_frame) (GdkDrawContext *context,
|
||||
cairo_region_t *painted);
|
||||
@@ -49,6 +50,9 @@ struct _GdkDrawContextClass
|
||||
|
||||
void gdk_draw_context_surface_resized (GdkDrawContext *context);
|
||||
|
||||
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
|
||||
gboolean prefers_high_depth,
|
||||
const cairo_region_t *region);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK__DRAW_CONTEXT_PRIVATE__ */
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
#include "gdkcontentserializer.h"
|
||||
#include "gdkcursor.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkenumtypes.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkpipeiostreamprivate.h"
|
||||
#include "gdksurface.h"
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
|
||||
|
||||
336
gdk/gdkenums.h
Normal file
336
gdk/gdkenums.h
Normal file
@@ -0,0 +1,336 @@
|
||||
/* GDK - The GIMP Drawing Kit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GDK_ENUMS_H__
|
||||
#define __GDK_ENUMS_H__
|
||||
|
||||
#if !defined (__GDK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* Currently, these are the same values numerically as in the
|
||||
* X protocol. If you change that, gdksurface-x11.c/gdk_surface_set_geometry_hints()
|
||||
* will need fixing.
|
||||
*/
|
||||
/**
|
||||
* GdkGravity:
|
||||
* @GDK_GRAVITY_NORTH_WEST: the reference point is at the top left corner.
|
||||
* @GDK_GRAVITY_NORTH: the reference point is in the middle of the top edge.
|
||||
* @GDK_GRAVITY_NORTH_EAST: the reference point is at the top right corner.
|
||||
* @GDK_GRAVITY_WEST: the reference point is at the middle of the left edge.
|
||||
* @GDK_GRAVITY_CENTER: the reference point is at the center of the surface.
|
||||
* @GDK_GRAVITY_EAST: the reference point is at the middle of the right edge.
|
||||
* @GDK_GRAVITY_SOUTH_WEST: the reference point is at the lower left corner.
|
||||
* @GDK_GRAVITY_SOUTH: the reference point is at the middle of the lower edge.
|
||||
* @GDK_GRAVITY_SOUTH_EAST: the reference point is at the lower right corner.
|
||||
* @GDK_GRAVITY_STATIC: the reference point is at the top left corner of the
|
||||
* surface itself, ignoring window manager decorations.
|
||||
*
|
||||
* Defines the reference point of a surface and is used in `GdkPopupLayout`.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_GRAVITY_NORTH_WEST = 1,
|
||||
GDK_GRAVITY_NORTH,
|
||||
GDK_GRAVITY_NORTH_EAST,
|
||||
GDK_GRAVITY_WEST,
|
||||
GDK_GRAVITY_CENTER,
|
||||
GDK_GRAVITY_EAST,
|
||||
GDK_GRAVITY_SOUTH_WEST,
|
||||
GDK_GRAVITY_SOUTH,
|
||||
GDK_GRAVITY_SOUTH_EAST,
|
||||
GDK_GRAVITY_STATIC
|
||||
} GdkGravity;
|
||||
|
||||
/* Types of modifiers.
|
||||
*/
|
||||
/**
|
||||
* GdkModifierType:
|
||||
* @GDK_SHIFT_MASK: the Shift key.
|
||||
* @GDK_LOCK_MASK: a Lock key (depending on the modifier mapping of the
|
||||
* X server this may either be CapsLock or ShiftLock).
|
||||
* @GDK_CONTROL_MASK: the Control key.
|
||||
* @GDK_ALT_MASK: the fourth modifier key (it depends on the modifier
|
||||
* mapping of the X server which key is interpreted as this modifier, but
|
||||
* normally it is the Alt key).
|
||||
* @GDK_BUTTON1_MASK: the first mouse button.
|
||||
* @GDK_BUTTON2_MASK: the second mouse button.
|
||||
* @GDK_BUTTON3_MASK: the third mouse button.
|
||||
* @GDK_BUTTON4_MASK: the fourth mouse button.
|
||||
* @GDK_BUTTON5_MASK: the fifth mouse button.
|
||||
* @GDK_SUPER_MASK: the Super modifier
|
||||
* @GDK_HYPER_MASK: the Hyper modifier
|
||||
* @GDK_META_MASK: the Meta modifier
|
||||
*
|
||||
* Flags to indicate the state of modifier keys and mouse buttons
|
||||
* in events.
|
||||
*
|
||||
* Typical modifier keys are Shift, Control, Meta, Super, Hyper, Alt, Compose,
|
||||
* Apple, CapsLock or ShiftLock.
|
||||
*
|
||||
* Note that GDK may add internal values to events which include values outside
|
||||
* of this enumeration. Your code should preserve and ignore them. You can use
|
||||
* %GDK_MODIFIER_MASK to remove all private values.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_SHIFT_MASK = 1 << 0,
|
||||
GDK_LOCK_MASK = 1 << 1,
|
||||
GDK_CONTROL_MASK = 1 << 2,
|
||||
GDK_ALT_MASK = 1 << 3,
|
||||
|
||||
GDK_BUTTON1_MASK = 1 << 8,
|
||||
GDK_BUTTON2_MASK = 1 << 9,
|
||||
GDK_BUTTON3_MASK = 1 << 10,
|
||||
GDK_BUTTON4_MASK = 1 << 11,
|
||||
GDK_BUTTON5_MASK = 1 << 12,
|
||||
|
||||
GDK_SUPER_MASK = 1 << 26,
|
||||
GDK_HYPER_MASK = 1 << 27,
|
||||
GDK_META_MASK = 1 << 28,
|
||||
} GdkModifierType;
|
||||
|
||||
|
||||
/**
|
||||
* GDK_MODIFIER_MASK:
|
||||
*
|
||||
* A mask covering all entries in `GdkModifierType`.
|
||||
*/
|
||||
#define GDK_MODIFIER_MASK (GDK_SHIFT_MASK|GDK_LOCK_MASK|GDK_CONTROL_MASK| \
|
||||
GDK_ALT_MASK|GDK_SUPER_MASK|GDK_HYPER_MASK|GDK_META_MASK| \
|
||||
GDK_BUTTON1_MASK|GDK_BUTTON2_MASK|GDK_BUTTON3_MASK| \
|
||||
GDK_BUTTON4_MASK|GDK_BUTTON5_MASK)
|
||||
|
||||
|
||||
/**
|
||||
* GdkGLError:
|
||||
* @GDK_GL_ERROR_NOT_AVAILABLE: OpenGL support is not available
|
||||
* @GDK_GL_ERROR_UNSUPPORTED_FORMAT: The requested visual format is not supported
|
||||
* @GDK_GL_ERROR_UNSUPPORTED_PROFILE: The requested profile is not supported
|
||||
* @GDK_GL_ERROR_COMPILATION_FAILED: The shader compilation failed
|
||||
* @GDK_GL_ERROR_LINK_FAILED: The shader linking failed
|
||||
*
|
||||
* Error enumeration for `GdkGLContext`.
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_GL_ERROR_NOT_AVAILABLE,
|
||||
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
|
||||
GDK_GL_ERROR_UNSUPPORTED_PROFILE,
|
||||
GDK_GL_ERROR_COMPILATION_FAILED,
|
||||
GDK_GL_ERROR_LINK_FAILED
|
||||
} GdkGLError;
|
||||
|
||||
/**
|
||||
* GdkVulkanError:
|
||||
* @GDK_VULKAN_ERROR_UNSUPPORTED: Vulkan is not supported on this backend or has not been
|
||||
* compiled in.
|
||||
* @GDK_VULKAN_ERROR_NOT_AVAILABLE: Vulkan support is not available on this Surface
|
||||
*
|
||||
* Error enumeration for `GdkVulkanContext`.
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_VULKAN_ERROR_UNSUPPORTED,
|
||||
GDK_VULKAN_ERROR_NOT_AVAILABLE,
|
||||
} GdkVulkanError;
|
||||
|
||||
/**
|
||||
* GdkAxisUse:
|
||||
* @GDK_AXIS_IGNORE: the axis is ignored.
|
||||
* @GDK_AXIS_X: the axis is used as the x axis.
|
||||
* @GDK_AXIS_Y: the axis is used as the y axis.
|
||||
* @GDK_AXIS_DELTA_X: the axis is used as the scroll x delta
|
||||
* @GDK_AXIS_DELTA_Y: the axis is used as the scroll y delta
|
||||
* @GDK_AXIS_PRESSURE: the axis is used for pressure information.
|
||||
* @GDK_AXIS_XTILT: the axis is used for x tilt information.
|
||||
* @GDK_AXIS_YTILT: the axis is used for y tilt information.
|
||||
* @GDK_AXIS_WHEEL: the axis is used for wheel information.
|
||||
* @GDK_AXIS_DISTANCE: the axis is used for pen/tablet distance information
|
||||
* @GDK_AXIS_ROTATION: the axis is used for pen rotation information
|
||||
* @GDK_AXIS_SLIDER: the axis is used for pen slider information
|
||||
* @GDK_AXIS_LAST: a constant equal to the numerically highest axis value.
|
||||
*
|
||||
* Defines how device axes are interpreted by GTK.
|
||||
*
|
||||
* Note that the X and Y axes are not really needed; pointer devices
|
||||
* report their location via the x/y members of events regardless. Whether
|
||||
* X and Y are present as axes depends on the GDK backend.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_AXIS_IGNORE,
|
||||
GDK_AXIS_X,
|
||||
GDK_AXIS_Y,
|
||||
GDK_AXIS_DELTA_X,
|
||||
GDK_AXIS_DELTA_Y,
|
||||
GDK_AXIS_PRESSURE,
|
||||
GDK_AXIS_XTILT,
|
||||
GDK_AXIS_YTILT,
|
||||
GDK_AXIS_WHEEL,
|
||||
GDK_AXIS_DISTANCE,
|
||||
GDK_AXIS_ROTATION,
|
||||
GDK_AXIS_SLIDER,
|
||||
GDK_AXIS_LAST
|
||||
} GdkAxisUse;
|
||||
|
||||
/**
|
||||
* GdkAxisFlags:
|
||||
* @GDK_AXIS_FLAG_X: X axis is present
|
||||
* @GDK_AXIS_FLAG_Y: Y axis is present
|
||||
* @GDK_AXIS_FLAG_DELTA_X: Scroll X delta axis is present
|
||||
* @GDK_AXIS_FLAG_DELTA_Y: Scroll Y delta axis is present
|
||||
* @GDK_AXIS_FLAG_PRESSURE: Pressure axis is present
|
||||
* @GDK_AXIS_FLAG_XTILT: X tilt axis is present
|
||||
* @GDK_AXIS_FLAG_YTILT: Y tilt axis is present
|
||||
* @GDK_AXIS_FLAG_WHEEL: Wheel axis is present
|
||||
* @GDK_AXIS_FLAG_DISTANCE: Distance axis is present
|
||||
* @GDK_AXIS_FLAG_ROTATION: Z-axis rotation is present
|
||||
* @GDK_AXIS_FLAG_SLIDER: Slider axis is present
|
||||
*
|
||||
* Flags describing the current capabilities of a device/tool.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_AXIS_FLAG_X = 1 << GDK_AXIS_X,
|
||||
GDK_AXIS_FLAG_Y = 1 << GDK_AXIS_Y,
|
||||
GDK_AXIS_FLAG_DELTA_X = 1 << GDK_AXIS_DELTA_X,
|
||||
GDK_AXIS_FLAG_DELTA_Y = 1 << GDK_AXIS_DELTA_Y,
|
||||
GDK_AXIS_FLAG_PRESSURE = 1 << GDK_AXIS_PRESSURE,
|
||||
GDK_AXIS_FLAG_XTILT = 1 << GDK_AXIS_XTILT,
|
||||
GDK_AXIS_FLAG_YTILT = 1 << GDK_AXIS_YTILT,
|
||||
GDK_AXIS_FLAG_WHEEL = 1 << GDK_AXIS_WHEEL,
|
||||
GDK_AXIS_FLAG_DISTANCE = 1 << GDK_AXIS_DISTANCE,
|
||||
GDK_AXIS_FLAG_ROTATION = 1 << GDK_AXIS_ROTATION,
|
||||
GDK_AXIS_FLAG_SLIDER = 1 << GDK_AXIS_SLIDER,
|
||||
} GdkAxisFlags;
|
||||
|
||||
/**
|
||||
* GdkDragAction:
|
||||
* @GDK_ACTION_COPY: Copy the data.
|
||||
* @GDK_ACTION_MOVE: Move the data, i.e. first copy it, then delete
|
||||
* it from the source using the DELETE target of the X selection protocol.
|
||||
* @GDK_ACTION_LINK: Add a link to the data. Note that this is only
|
||||
* useful if source and destination agree on what it means, and is not
|
||||
* supported on all platforms.
|
||||
* @GDK_ACTION_ASK: Ask the user what to do with the data.
|
||||
*
|
||||
* Used in `GdkDrop` and `GdkDrag` to indicate the actions that the
|
||||
* destination can and should do with the dropped data.
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
GDK_ACTION_COPY = 1 << 0,
|
||||
GDK_ACTION_MOVE = 1 << 1,
|
||||
GDK_ACTION_LINK = 1 << 2,
|
||||
GDK_ACTION_ASK = 1 << 3
|
||||
} GdkDragAction;
|
||||
|
||||
/**
|
||||
* GDK_ACTION_ALL:
|
||||
*
|
||||
* Defines all possible DND actions.
|
||||
*
|
||||
* This can be used in [method@Gdk.Drop.status] messages when any drop
|
||||
* can be accepted or a more specific drop method is not yet known.
|
||||
*/
|
||||
#define GDK_ACTION_ALL (GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK)
|
||||
|
||||
/**
|
||||
* GdkMemoryFormat:
|
||||
* @GDK_MEMORY_B8G8R8A8_PREMULTIPLIED: 4 bytes; for blue, green, red, alpha.
|
||||
* The color values are premultiplied with the alpha value.
|
||||
* @GDK_MEMORY_A8R8G8B8_PREMULTIPLIED: 4 bytes; for alpha, red, green, blue.
|
||||
* The color values are premultiplied with the alpha value.
|
||||
* @GDK_MEMORY_R8G8B8A8_PREMULTIPLIED: 4 bytes; for red, green, blue, alpha
|
||||
* The color values are premultiplied with the alpha value.
|
||||
* @GDK_MEMORY_B8G8R8A8: 4 bytes; for blue, green, red, alpha.
|
||||
* @GDK_MEMORY_A8R8G8B8: 4 bytes; for alpha, red, green, blue.
|
||||
* @GDK_MEMORY_R8G8B8A8: 4 bytes; for red, green, blue, alpha.
|
||||
* @GDK_MEMORY_A8B8G8R8: 4 bytes; for alpha, blue, green, red.
|
||||
* @GDK_MEMORY_R8G8B8: 3 bytes; for red, green, blue. The data is opaque.
|
||||
* @GDK_MEMORY_B8G8R8: 3 bytes; for blue, green, red. The data is opaque.
|
||||
* @GDK_MEMORY_R16G16B16: 3 guint16 values; for red, green, blue. Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16_PREMULTIPLIED: 4 guint16 values; for red, green,
|
||||
* blue, alpha. The color values are premultiplied with the alpha value.
|
||||
* Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16: 4 guint16 values; for red, green, blue, alpha.
|
||||
* Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16_FLOAT: 3 half-float values; for red, green, blue.
|
||||
* The data is opaque. Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED: 4 half-float values; for
|
||||
* red, green, blue and alpha. The color values are premultiplied with
|
||||
* the alpha value. Since: 4.6
|
||||
* @GDK_MEMORY_R16G16B16A16_FLOAT: 4 half-float values; for red, green,
|
||||
* blue and alpha. Since: 4.6
|
||||
* @GDK_MEMORY_B32G32R32_FLOAT: 3 float values; for blue, green, red.
|
||||
* The data is opaque. Since: 4.6
|
||||
* @GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED: 4 float values; for
|
||||
* red, green, blue and alpha. The color values are premultiplied with
|
||||
* the alpha value. Since: 4.6
|
||||
* @GDK_MEMORY_R32G32B32A32_FLOAT: 4 float values; for red, green, blue and
|
||||
* alpha. Since: 4.6
|
||||
* @GDK_MEMORY_N_FORMATS: The number of formats. This value will change as
|
||||
* more formats get added, so do not rely on its concrete integer.
|
||||
*
|
||||
* `GdkMemoryFormat` describes formats that image data can have in memory.
|
||||
*
|
||||
* It describes formats by listing the contents of the memory passed to it.
|
||||
* So GDK_MEMORY_A8R8G8B8 will be 1 byte (8 bits) of alpha, followed by a
|
||||
* byte each of red, green and blue. It is not endian-dependent, so
|
||||
* CAIRO_FORMAT_ARGB32 is represented by different `GdkMemoryFormats`
|
||||
* on architectures with different endiannesses.
|
||||
*
|
||||
* Its naming is modelled after
|
||||
* [VkFormat](https://www.khronos.org/registry/vulkan/specs/1.0/html/vkspec.html#VkFormat)
|
||||
* for details).
|
||||
*/
|
||||
typedef enum {
|
||||
GDK_MEMORY_B8G8R8A8_PREMULTIPLIED,
|
||||
GDK_MEMORY_A8R8G8B8_PREMULTIPLIED,
|
||||
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
GDK_MEMORY_B8G8R8A8,
|
||||
GDK_MEMORY_A8R8G8B8,
|
||||
GDK_MEMORY_R8G8B8A8,
|
||||
GDK_MEMORY_A8B8G8R8,
|
||||
GDK_MEMORY_R8G8B8,
|
||||
GDK_MEMORY_B8G8R8,
|
||||
GDK_MEMORY_R16G16B16,
|
||||
GDK_MEMORY_R16G16B16A16_PREMULTIPLIED,
|
||||
GDK_MEMORY_R16G16B16A16,
|
||||
GDK_MEMORY_R16G16B16_FLOAT,
|
||||
GDK_MEMORY_R16G16B16A16_FLOAT_PREMULTIPLIED,
|
||||
GDK_MEMORY_R16G16B16A16_FLOAT,
|
||||
GDK_MEMORY_R32G32B32_FLOAT,
|
||||
GDK_MEMORY_R32G32B32A32_FLOAT_PREMULTIPLIED,
|
||||
GDK_MEMORY_R32G32B32A32_FLOAT,
|
||||
|
||||
GDK_MEMORY_N_FORMATS
|
||||
} GdkMemoryFormat;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_ENUMS_H__ */
|
||||
@@ -24,13 +24,13 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkintl.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdisplayprivate.h"
|
||||
#include "gdkdragprivate.h"
|
||||
#include "gdkdropprivate.h"
|
||||
#include "gdkeventsprivate.h"
|
||||
#include "gdkintl.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkkeysyms.h"
|
||||
#include "gdk-private.h"
|
||||
|
||||
#include <gobject/gvaluecollector.h>
|
||||
|
||||
@@ -29,11 +29,12 @@
|
||||
#error "Only <gdk/gdk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkdrag.h>
|
||||
#include <gdk/gdkdevice.h>
|
||||
#include <gdk/gdkdevicetool.h>
|
||||
#include <gdk/gdkdrag.h>
|
||||
#include <gdk/gdkenums.h>
|
||||
#include <gdk/gdktypes.h>
|
||||
#include <gdk/gdkversionmacros.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkframeclockprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
|
||||
/**
|
||||
* GdkFrameClock:
|
||||
|
||||
@@ -26,9 +26,8 @@
|
||||
|
||||
#include "gdkframeclockidleprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkdebug.h"
|
||||
#include "gdkframeclockprivate.h"
|
||||
#include "gdk.h"
|
||||
#include "gdk-private.h"
|
||||
#include "gdkprofilerprivate.h"
|
||||
|
||||
|
||||
279
gdk/gdkgl.c
279
gdk/gdkgl.c
@@ -18,273 +18,14 @@
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkcairo.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkglcontextprivate.h"
|
||||
#include "gdksurfaceprivate.h"
|
||||
|
||||
#include <epoxy/gl.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
|
||||
static const char *
|
||||
get_shader_type_name (int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GL_VERTEX_SHADER:
|
||||
return "vertex";
|
||||
case GL_GEOMETRY_SHADER:
|
||||
return "geometry";
|
||||
case GL_FRAGMENT_SHADER:
|
||||
return "fragment";
|
||||
default:
|
||||
return "unknown";
|
||||
}
|
||||
}
|
||||
|
||||
static guint
|
||||
create_shader (int type,
|
||||
const char *code)
|
||||
{
|
||||
guint shader;
|
||||
int status;
|
||||
|
||||
shader = glCreateShader (type);
|
||||
glShaderSource (shader, 1, &code, NULL);
|
||||
glCompileShader (shader);
|
||||
|
||||
glGetShaderiv (shader, GL_COMPILE_STATUS, &status);
|
||||
if (status == GL_FALSE)
|
||||
{
|
||||
int log_len;
|
||||
char *buffer;
|
||||
|
||||
glGetShaderiv (shader, GL_INFO_LOG_LENGTH, &log_len);
|
||||
|
||||
buffer = g_malloc (log_len + 1);
|
||||
glGetShaderInfoLog (shader, log_len, NULL, buffer);
|
||||
|
||||
g_warning ("Compile failure in %s shader:\n%s", get_shader_type_name (type), buffer);
|
||||
g_free (buffer);
|
||||
|
||||
glDeleteShader (shader);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
return shader;
|
||||
}
|
||||
|
||||
static void
|
||||
make_program (GdkGLContextProgram *program,
|
||||
const char *vertex_shader_path,
|
||||
const char *fragment_shader_path)
|
||||
{
|
||||
guint vertex_shader, fragment_shader;
|
||||
GBytes *source;
|
||||
int status;
|
||||
|
||||
source = g_resources_lookup_data (vertex_shader_path, 0, NULL);
|
||||
g_assert (source != NULL);
|
||||
vertex_shader = create_shader (GL_VERTEX_SHADER, g_bytes_get_data (source, NULL));
|
||||
g_bytes_unref (source);
|
||||
if (vertex_shader == 0)
|
||||
return;
|
||||
|
||||
source = g_resources_lookup_data (fragment_shader_path, 0, NULL);
|
||||
g_assert (source != NULL);
|
||||
fragment_shader = create_shader (GL_FRAGMENT_SHADER, g_bytes_get_data (source, NULL));
|
||||
g_bytes_unref (source);
|
||||
if (fragment_shader == 0)
|
||||
{
|
||||
glDeleteShader (vertex_shader);
|
||||
return;
|
||||
}
|
||||
|
||||
program->program = glCreateProgram ();
|
||||
glAttachShader (program->program, vertex_shader);
|
||||
glAttachShader (program->program, fragment_shader);
|
||||
|
||||
glLinkProgram (program->program);
|
||||
|
||||
glDetachShader (program->program, vertex_shader);
|
||||
glDetachShader (program->program, fragment_shader);
|
||||
|
||||
glDeleteShader (vertex_shader);
|
||||
glDeleteShader (fragment_shader);
|
||||
|
||||
glGetProgramiv (program->program, GL_LINK_STATUS, &status);
|
||||
if (status == GL_FALSE)
|
||||
{
|
||||
int log_len;
|
||||
char *buffer;
|
||||
|
||||
glGetProgramiv (program->program, GL_INFO_LOG_LENGTH, &log_len);
|
||||
|
||||
buffer = g_malloc (log_len + 1);
|
||||
glGetProgramInfoLog (program->program, log_len, NULL, buffer);
|
||||
g_warning ("Linker failure: %s\n", buffer);
|
||||
g_free (buffer);
|
||||
|
||||
glDeleteProgram (program->program);
|
||||
}
|
||||
|
||||
program->position_location = glGetAttribLocation (program->program, "position");
|
||||
program->uv_location = glGetAttribLocation (program->program, "uv");
|
||||
program->map_location = glGetUniformLocation (program->program, "map");
|
||||
program->flip_location = glGetUniformLocation (program->program, "flipColors");
|
||||
}
|
||||
|
||||
static void
|
||||
bind_vao (GdkGLContextPaintData *paint_data)
|
||||
{
|
||||
if (paint_data->vertex_array_object == 0)
|
||||
{
|
||||
glGenVertexArrays (1, &paint_data->vertex_array_object);
|
||||
/* ATM we only use one VAO, so always bind it */
|
||||
glBindVertexArray (paint_data->vertex_array_object);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
use_texture_gles_program (GdkGLContextPaintData *paint_data)
|
||||
{
|
||||
if (paint_data->texture_2d_quad_program.program == 0)
|
||||
make_program (&paint_data->texture_2d_quad_program,
|
||||
"/org/gtk/libgdk/glsl/gles2-texture.vs.glsl",
|
||||
"/org/gtk/libgdk/glsl/gles2-texture.fs.glsl");
|
||||
|
||||
if (paint_data->current_program != &paint_data->texture_2d_quad_program)
|
||||
{
|
||||
paint_data->current_program = &paint_data->texture_2d_quad_program;
|
||||
glUseProgram (paint_data->current_program->program);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
use_texture_2d_program (GdkGLContextPaintData *paint_data)
|
||||
{
|
||||
const char *vertex_shader_path = paint_data->is_legacy
|
||||
? "/org/gtk/libgdk/glsl/gl2-texture-2d.vs.glsl"
|
||||
: "/org/gtk/libgdk/glsl/gl3-texture-2d.vs.glsl";
|
||||
|
||||
const char *fragment_shader_path = paint_data->is_legacy
|
||||
? "/org/gtk/libgdk/glsl/gl2-texture-2d.fs.glsl"
|
||||
: "/org/gtk/libgdk/glsl/gl3-texture-2d.fs.glsl";
|
||||
|
||||
if (paint_data->texture_2d_quad_program.program == 0)
|
||||
make_program (&paint_data->texture_2d_quad_program, vertex_shader_path, fragment_shader_path);
|
||||
|
||||
if (paint_data->current_program != &paint_data->texture_2d_quad_program)
|
||||
{
|
||||
paint_data->current_program = &paint_data->texture_2d_quad_program;
|
||||
glUseProgram (paint_data->current_program->program);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
use_texture_rect_program (GdkGLContextPaintData *paint_data)
|
||||
{
|
||||
const char *vertex_shader_path = paint_data->is_legacy
|
||||
? "/org/gtk/libgdk/glsl/gl2-texture-rect.vs.glsl"
|
||||
: "/org/gtk/libgdk/glsl/gl3-texture-rect.vs.glsl";
|
||||
|
||||
const char *fragment_shader_path = paint_data->is_legacy
|
||||
? "/org/gtk/libgdk/glsl/gl2-texture-rect.fs.glsl"
|
||||
: "/org/gtk/libgdk/glsl/gl3-texture-rect.vs.glsl";
|
||||
|
||||
if (paint_data->texture_rect_quad_program.program == 0)
|
||||
make_program (&paint_data->texture_rect_quad_program, vertex_shader_path, fragment_shader_path);
|
||||
|
||||
if (paint_data->current_program != &paint_data->texture_rect_quad_program)
|
||||
{
|
||||
paint_data->current_program = &paint_data->texture_rect_quad_program;
|
||||
glUseProgram (paint_data->current_program->program);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gdk_gl_texture_quads (GdkGLContext *paint_context,
|
||||
guint texture_target,
|
||||
int n_quads,
|
||||
GdkTexturedQuad *quads,
|
||||
gboolean flip_colors)
|
||||
{
|
||||
GdkGLContextPaintData *paint_data = gdk_gl_context_get_paint_data (paint_context);
|
||||
GdkGLContextProgram *program;
|
||||
GdkSurface *surface = gdk_gl_context_get_surface (paint_context);
|
||||
int surface_scale = gdk_surface_get_scale_factor (surface);
|
||||
float w = gdk_surface_get_width (surface) * surface_scale;
|
||||
float h = gdk_surface_get_height (surface) * surface_scale;
|
||||
int i;
|
||||
float *vertex_buffer_data;
|
||||
|
||||
bind_vao (paint_data);
|
||||
|
||||
if (paint_data->tmp_vertex_buffer == 0)
|
||||
glGenBuffers(1, &paint_data->tmp_vertex_buffer);
|
||||
|
||||
if (paint_data->use_es)
|
||||
use_texture_gles_program (paint_data);
|
||||
else
|
||||
{
|
||||
if (texture_target == GL_TEXTURE_RECTANGLE_ARB)
|
||||
use_texture_rect_program (paint_data);
|
||||
else
|
||||
use_texture_2d_program (paint_data);
|
||||
}
|
||||
|
||||
program = paint_data->current_program;
|
||||
|
||||
/* Use texture unit 0 */
|
||||
glActiveTexture (GL_TEXTURE0);
|
||||
glUniform1i(program->map_location, 0);
|
||||
|
||||
/* Flip 'R' and 'B' colors on GLES, if necessary */
|
||||
if (gdk_gl_context_get_use_es (paint_context))
|
||||
glUniform1i (program->flip_location, flip_colors ? 1 : 0);
|
||||
|
||||
glEnableVertexAttribArray (program->position_location);
|
||||
glEnableVertexAttribArray (program->uv_location);
|
||||
glBindBuffer (GL_ARRAY_BUFFER, paint_data->tmp_vertex_buffer);
|
||||
|
||||
glVertexAttribPointer (program->position_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, NULL);
|
||||
glVertexAttribPointer (program->uv_location, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 4, (void *) (sizeof(float) * 2));
|
||||
|
||||
#define VERTEX_SIZE 4
|
||||
|
||||
#define QUAD_N_VERTICES 6
|
||||
|
||||
#define QUAD_SIZE (VERTEX_SIZE * QUAD_N_VERTICES)
|
||||
|
||||
vertex_buffer_data = g_new (float, n_quads * QUAD_SIZE);
|
||||
|
||||
for (i = 0; i < n_quads; i++)
|
||||
{
|
||||
GdkTexturedQuad *quad = &quads[i];
|
||||
float vertex_data[] = {
|
||||
(quad->x1 * 2) / w - 1, (quad->y1 * 2) / h - 1, quad->u1, quad->v1,
|
||||
(quad->x1 * 2) / w - 1, (quad->y2 * 2) / h - 1, quad->u1, quad->v2,
|
||||
(quad->x2 * 2) / w - 1, (quad->y1 * 2) / h - 1, quad->u2, quad->v1,
|
||||
|
||||
(quad->x2 * 2) / w - 1, (quad->y2 * 2) / h - 1, quad->u2, quad->v2,
|
||||
(quad->x1 * 2) / w - 1, (quad->y2 * 2) / h - 1, quad->u1, quad->v2,
|
||||
(quad->x2 * 2) / w - 1, (quad->y1 * 2) / h - 1, quad->u2, quad->v1,
|
||||
};
|
||||
|
||||
float *vertex = &vertex_buffer_data[i * QUAD_SIZE];
|
||||
memcpy (vertex, vertex_data, sizeof(vertex_data));
|
||||
}
|
||||
|
||||
glBufferData (GL_ARRAY_BUFFER, sizeof(float) * n_quads * QUAD_SIZE, vertex_buffer_data, GL_STREAM_DRAW);
|
||||
glDrawArrays (GL_TRIANGLES, 0, n_quads * QUAD_N_VERTICES);
|
||||
|
||||
g_free (vertex_buffer_data);
|
||||
|
||||
glDisableVertexAttribArray (program->position_location);
|
||||
glDisableVertexAttribArray (program->uv_location);
|
||||
}
|
||||
|
||||
/* x,y,width,height describes a rectangle in the gl render buffer
|
||||
coordinate space, and its top left corner is drawn at the current
|
||||
position according to the cairo translation. */
|
||||
@@ -301,7 +42,7 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
|
||||
* @width: The width of the region to draw
|
||||
* @height: The height of the region to draw
|
||||
*
|
||||
* The main way to draw GL content in GTK.
|
||||
* The main way to not draw GL content in GTK.
|
||||
*
|
||||
* It takes a render buffer ID (@source_type == GL_RENDERBUFFER) or a texture
|
||||
* id (@source_type == GL_TEXTURE) and draws it onto @cr with an OVER operation,
|
||||
@@ -319,6 +60,12 @@ gdk_gl_texture_quads (GdkGLContext *paint_context,
|
||||
* with alpha components, so make sure you use GL_TEXTURE if using alpha.
|
||||
*
|
||||
* Calling this may change the current GL context.
|
||||
*
|
||||
* Deprecated: 4.6: The function is overly complex and produces broken output
|
||||
* in various combinations of arguments. If you want to draw with GL textures
|
||||
* in GTK, use [ctor@Gdk.GLTexture.new]; if you want to use that texture in
|
||||
* Cairo, use [method@Gdk.Texture.download] to download the data into a Cairo
|
||||
* image surface.
|
||||
*/
|
||||
void
|
||||
gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
@@ -335,7 +82,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
cairo_surface_t *image;
|
||||
guint framebuffer;
|
||||
int alpha_size = 0;
|
||||
GdkGLContextPaintData *paint_data;
|
||||
int major, minor, version;
|
||||
gboolean es_use_bgra = FALSE;
|
||||
|
||||
@@ -349,10 +95,8 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
es_use_bgra = gdk_gl_context_use_es_bgra (paint_context);
|
||||
|
||||
gdk_gl_context_make_current (paint_context);
|
||||
paint_data = gdk_gl_context_get_paint_data (paint_context);
|
||||
|
||||
if (paint_data->tmp_framebuffer == 0)
|
||||
glGenFramebuffers (1, &paint_data->tmp_framebuffer);
|
||||
glGenFramebuffers (1, &framebuffer);
|
||||
|
||||
if (source_type == GL_RENDERBUFFER)
|
||||
{
|
||||
@@ -391,7 +135,6 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
|
||||
cairo_surface_set_device_scale (image, buffer_scale, buffer_scale);
|
||||
|
||||
framebuffer = paint_data->tmp_framebuffer;
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, framebuffer);
|
||||
|
||||
if (source_type == GL_RENDERBUFFER)
|
||||
@@ -422,6 +165,8 @@ gdk_cairo_draw_from_gl (cairo_t *cr,
|
||||
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
|
||||
glDeleteFramebuffers (1, &framebuffer);
|
||||
|
||||
cairo_surface_mark_dirty (image);
|
||||
|
||||
cairo_set_source_surface (cr, image, 0, 0);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user