Compare commits
978 Commits
wip/otte/c
...
font-rende
Author | SHA1 | Date | |
---|---|---|---|
|
e00d393b6a | ||
|
4a87115763 | ||
|
273d60fefa | ||
|
e781f986f7 | ||
|
40b90a16ab | ||
|
f3f32b47cc | ||
|
2c5f2a2bcb | ||
|
b6d990af25 | ||
|
16171a232a | ||
|
031b5cad46 | ||
|
984274497d | ||
|
0cc0714312 | ||
|
766e2b1e63 | ||
|
c8be597b7f | ||
|
4497ac7d75 | ||
|
af21583d4d | ||
|
d398c00d20 | ||
|
cb247276f5 | ||
|
c6141dffd2 | ||
|
755d8f8332 | ||
|
32de29bb68 | ||
|
540cb58169 | ||
|
a1a6e6a36a | ||
|
798ad9f62a | ||
|
ad6255a841 | ||
|
6adaf7c33d | ||
|
95a4eff6ba | ||
|
9675c99043 | ||
|
76d0e1e398 | ||
|
14408b7485 | ||
|
2a11baf6ea | ||
|
51d40ca023 | ||
|
5d9d73b090 | ||
|
5f7e093168 | ||
|
0f70e6d70a | ||
|
259be23ff2 | ||
|
337eedb513 | ||
|
185354555c | ||
|
29905d1ce6 | ||
|
73dd73c859 | ||
|
cfb0df14cc | ||
|
b343abfa51 | ||
|
5df4d27752 | ||
|
bbf5d142b3 | ||
|
1fbbaef49e | ||
|
d88268c142 | ||
|
49ae68c2c7 | ||
|
1d72e3e193 | ||
|
77c3ef48cf | ||
|
20deda2bd6 | ||
|
447b166ed3 | ||
|
1b230324ba | ||
|
806c659efe | ||
|
51873ebe37 | ||
|
827219e214 | ||
|
5c9b25c66e | ||
|
37e4ae2fbd | ||
|
14f86ae24d | ||
|
849ffebc21 | ||
|
7dabc2a42c | ||
|
bef8a3a0e9 | ||
|
31d2638088 | ||
|
40019517cf | ||
|
7a8f5ca970 | ||
|
4063c3dc31 | ||
|
96d0368290 | ||
|
9a0ec5b1e0 | ||
|
7b5a0a829a | ||
|
1030d9e5b1 | ||
|
0750b4fd28 | ||
|
1d4ce5a544 | ||
|
4b2d63167e | ||
|
6fe0a8c6b3 | ||
|
04eb7eef29 | ||
|
480a2c2770 | ||
|
f699fff6e0 | ||
|
4bc145549d | ||
|
cf7fa931d3 | ||
|
392b4d9ac5 | ||
|
3f126c7fc8 | ||
|
960717b273 | ||
|
5386cf89f2 | ||
|
b7d948af69 | ||
|
446b2e25d3 | ||
|
17b1e7bae9 | ||
|
9dc679370c | ||
|
033cf4bfb7 | ||
|
bf5f27c6d5 | ||
|
7a1073c3ae | ||
|
e2fd33f78a | ||
|
89f25d1484 | ||
|
3c8b3cbf41 | ||
|
410d4bca83 | ||
|
168523264c | ||
|
435f143e2e | ||
|
98ccb67277 | ||
|
2d83bb1b91 | ||
|
298b6ee81a | ||
|
5ce3520a2a | ||
|
9cc3e2c8ef | ||
|
034f89b17f | ||
|
1ea09a327a | ||
|
bc2f484ae9 | ||
|
228f813c43 | ||
|
17386b5cf7 | ||
|
288086b899 | ||
|
d148f26658 | ||
|
7ca6440f4d | ||
|
1172810768 | ||
|
9c827cbff4 | ||
|
da3aaf39b9 | ||
|
a8926c9d87 | ||
|
443f8ddf6b | ||
|
6a7de806dd | ||
|
19873e549a | ||
|
05ca6bc189 | ||
|
cbb1e74bb5 | ||
|
6afb6bb9d2 | ||
|
60afd056e0 | ||
|
4456b06853 | ||
|
2f72353e0e | ||
|
88af7b44aa | ||
|
a7cd1918a8 | ||
|
bcfd1bbd24 | ||
|
1a5e60be7c | ||
|
3ce3867403 | ||
|
00a61f92b6 | ||
|
986daa8225 | ||
|
e72ca43a32 | ||
|
f432c937cc | ||
|
1dd15b5237 | ||
|
5cdbbc6e61 | ||
|
0e2ac0ebf2 | ||
|
c73cb2c154 | ||
|
a756caa106 | ||
|
da22ba3b86 | ||
|
7a0a92f2b6 | ||
|
d927c3bee0 | ||
|
59c2efbcd6 | ||
|
94af080fb6 | ||
|
40841ec3be | ||
|
f69bb2fb2b | ||
|
db0b9f61ae | ||
|
63ab523146 | ||
|
b94c3166bf | ||
|
7030e08f9c | ||
|
2cc6a3ee5c | ||
|
3dd188fe7e | ||
|
d41603d82a | ||
|
f7aff03c72 | ||
|
a0b8e32462 | ||
|
50f76eb8cc | ||
|
9959ea98cd | ||
|
8ca3ac1970 | ||
|
27ba2411f0 | ||
|
a6920855ea | ||
|
c85e2401fa | ||
|
6fdcafc94a | ||
|
9bab218314 | ||
|
2854635850 | ||
|
a976aa9740 | ||
|
074eb2a19d | ||
|
96812450fa | ||
|
93c688cd93 | ||
|
53afc4a9d9 | ||
|
c96077590b | ||
|
6e47d0bf4a | ||
|
50b79ae0ab | ||
|
6b4709ea3c | ||
|
f3a83abb54 | ||
|
33166b7357 | ||
|
bb31ce1168 | ||
|
dbf32933bf | ||
|
af8fe182c8 | ||
|
731f0d4d01 | ||
|
e42373df89 | ||
|
da8050979e | ||
|
4dd1ff6dd2 | ||
|
8c403c43f0 | ||
|
2feb5c93ca | ||
|
9924a92e70 | ||
|
6c8988e445 | ||
|
9fb3b84253 | ||
|
3439862634 | ||
|
93c5455796 | ||
|
e665667bff | ||
|
3ca59b8701 | ||
|
fba0b359d4 | ||
|
e1b6496af7 | ||
|
14620423e8 | ||
|
55a1f8ccfd | ||
|
19afe454df | ||
|
7d842cb7fc | ||
|
3137d326c5 | ||
|
12464731f1 | ||
|
269a9d8528 | ||
|
c892d2767a | ||
|
c8e082f296 | ||
|
51981d562b | ||
|
51b77a425a | ||
|
ae3163b5e0 | ||
|
af93646b3e | ||
|
64f5afe608 | ||
|
fb98f939a5 | ||
|
7733f646d6 | ||
|
fd69f1cd79 | ||
|
ca94ff10ce | ||
|
9c3de51412 | ||
|
d9dcfffce3 | ||
|
dfd1372a9b | ||
|
f3c670ab0c | ||
|
8aa4b5150e | ||
|
ecaa16c367 | ||
|
2f8284a386 | ||
|
73cad1e784 | ||
|
0abd01e288 | ||
|
b80942ec88 | ||
|
165dab8265 | ||
|
73d736d800 | ||
|
88b4076fe5 | ||
|
36396093e6 | ||
|
faba0f0145 | ||
|
8755d884f3 | ||
|
010f4e90e3 | ||
|
0c76264953 | ||
|
d13843ee2a | ||
|
7869ffbb49 | ||
|
2f149c378a | ||
|
04367acf9b | ||
|
1a2052a40e | ||
|
e079fad1d5 | ||
|
bada3dbac6 | ||
|
9178423844 | ||
|
9df5171962 | ||
|
b3e91b7111 | ||
|
ffd89d29df | ||
|
686116ba61 | ||
|
7fa3183d7f | ||
|
176fd2fab3 | ||
|
419ee6a451 | ||
|
2c0d2d332f | ||
|
5f8fea08ff | ||
|
f92ec7ce41 | ||
|
ca08cf94d3 | ||
|
3d5dc16d63 | ||
|
7bfc3a5c74 | ||
|
a5414bc404 | ||
|
1d97b5fd3c | ||
|
aa09b0742e | ||
|
c5586f85fb | ||
|
3eb1b22651 | ||
|
4186a85359 | ||
|
aaf1e4995c | ||
|
e08e15ba51 | ||
|
7048362e6e | ||
|
5f0ed088e4 | ||
|
5c46c81067 | ||
|
c6fa3c446c | ||
|
f7ebff6aea | ||
|
8aeced2c91 | ||
|
e8fefd92c5 | ||
|
22390adf11 | ||
|
cf9121977f | ||
|
99099a1053 | ||
|
daba1a7eff | ||
|
f26359db13 | ||
|
945b844b7c | ||
|
f33655fa4e | ||
|
ee8ee313c8 | ||
|
33e113d607 | ||
|
a12d26155f | ||
|
cae382c829 | ||
|
0a5086d94f | ||
|
b103650cb0 | ||
|
337e602143 | ||
|
7ce25293b1 | ||
|
cd99f82e0c | ||
|
29fee2e808 | ||
|
417b1d8335 | ||
|
443a64a38e | ||
|
74455ae75c | ||
|
ec096b417c | ||
|
06bba15f62 | ||
|
c48be6ef96 | ||
|
0b1f0984f5 | ||
|
6918fb2e4e | ||
|
3caf8c86c9 | ||
|
8c8dc3aeab | ||
|
4d4ec2dbfb | ||
|
4f979469f1 | ||
|
87532f0ac3 | ||
|
0ace7ad219 | ||
|
a1bcbdd02a | ||
|
8e3bf65b3b | ||
|
de30a74cdf | ||
|
cbbb7604b6 | ||
|
9a91d3739d | ||
|
a2839d157f | ||
|
b3d424c2d7 | ||
|
bf3ea24489 | ||
|
997e8c1ae1 | ||
|
aa1f0cfd4f | ||
|
45a6146ca6 | ||
|
bc63001deb | ||
|
47b47f5835 | ||
|
1b2dccd143 | ||
|
7e09aa3caa | ||
|
6633d4130a | ||
|
a960641ace | ||
|
f982c9c8f8 | ||
|
a1cee7fa65 | ||
|
d0ebdf00f8 | ||
|
dd30a288f2 | ||
|
005781021e | ||
|
14f0a25531 | ||
|
8db379d85b | ||
|
6b65aaab21 | ||
|
905765eed6 | ||
|
e1206763a8 | ||
|
8a08a325be | ||
|
5e159e2ca0 | ||
|
392071b66d | ||
|
8ee4de804c | ||
|
dcf432d7d0 | ||
|
ea9d6f0a95 | ||
|
018a17fb8e | ||
|
895f381fd5 | ||
|
66bd54d14c | ||
|
ff38d38444 | ||
|
af749532fc | ||
|
7afa0badd8 | ||
|
4eb3a9faaa | ||
|
81e1dc9a66 | ||
|
c67fb57881 | ||
|
81171cc0a2 | ||
|
aa4e4dd0c7 | ||
|
7a9afc3a95 | ||
|
114ab8775a | ||
|
657ebd2a78 | ||
|
05bf87cf14 | ||
|
4aedf3d003 | ||
|
b1f384eec2 | ||
|
d02b185a87 | ||
|
6048b69145 | ||
|
4b85b5299a | ||
|
b00609c21c | ||
|
6d7cb2b781 | ||
|
a862ca41c5 | ||
|
314eaf7d10 | ||
|
316bd6a333 | ||
|
5b0a6a52c1 | ||
|
13ae11ee01 | ||
|
a05af1f0f3 | ||
|
b2dc303e5e | ||
|
2e27967814 | ||
|
18c3b725b4 | ||
|
6573d08b08 | ||
|
74a8ffc4a8 | ||
|
ac44353f9b | ||
|
6919d8c532 | ||
|
f247d268d4 | ||
|
841a29837e | ||
|
7554384b2d | ||
|
64313f4a4b | ||
|
34f556fc3e | ||
|
218b39fe01 | ||
|
70c8cfa480 | ||
|
501efeb6b9 | ||
|
a7d8127d59 | ||
|
beb4cb0e37 | ||
|
346ec706f7 | ||
|
d8274856de | ||
|
3756234708 | ||
|
2d6955285c | ||
|
10a0d6252e | ||
|
f8ddc42638 | ||
|
e9a9bb069f | ||
|
df79f02310 | ||
|
bd99ca2f04 | ||
|
889fcf64b6 | ||
|
3fadb536d9 | ||
|
fb0d8eacc3 | ||
|
fffb3161bc | ||
|
3be2cb8f63 | ||
|
8267605ba2 | ||
|
da4d8b7d94 | ||
|
01d4538223 | ||
|
da27627696 | ||
|
85e49a1051 | ||
|
798944cb26 | ||
|
5a319f66af | ||
|
2d7cfdd7ed | ||
|
35417a5a74 | ||
|
fdfbbc8246 | ||
|
0db6ee9347 | ||
|
8a1106c639 | ||
|
6e085b3bf1 | ||
|
6bf88d90f3 | ||
|
fb4d76d380 | ||
|
dedc1ee1e5 | ||
|
fe76984e89 | ||
|
f6d70f7225 | ||
|
0b12fd9c1b | ||
|
7f8106f2a9 | ||
|
d3ffaa0236 | ||
|
1b208eb457 | ||
|
1528665662 | ||
|
751c1877b1 | ||
|
66e0060836 | ||
|
b2db7bb95b | ||
|
c5fa657631 | ||
|
bdf3b6f64d | ||
|
6033bc56b4 | ||
|
eefd2d6f10 | ||
|
daf72e2e96 | ||
|
7e98741793 | ||
|
d4693b2dc8 | ||
|
b1f934d3b0 | ||
|
fd4bfd5050 | ||
|
07d6c53346 | ||
|
479c341545 | ||
|
938448e0ef | ||
|
ef3427575f | ||
|
0c57e3131f | ||
|
b22f45b2f6 | ||
|
0d46081645 | ||
|
4f632296a5 | ||
|
c047e97cfa | ||
|
bc13a58f3c | ||
|
43f37894b0 | ||
|
0365dadad9 | ||
|
9330be8cf9 | ||
|
43d6fe2583 | ||
|
411c535956 | ||
|
cddc9ff424 | ||
|
e73dc5c779 | ||
|
93f8f3c406 | ||
|
3acd26c64a | ||
|
cacdef8db7 | ||
|
1e2ab40539 | ||
|
f0103eeeb4 | ||
|
8bd6936533 | ||
|
0e1710a372 | ||
|
bc47fa27d4 | ||
|
aaa4e23a77 | ||
|
58fc1229c1 | ||
|
10b2f6540a | ||
|
c02bc22cc5 | ||
|
ef2daa3bdd | ||
|
d8c8a25c2f | ||
|
a34a5df674 | ||
|
299e2ed44c | ||
|
4c961349ab | ||
|
b7ecfbce21 | ||
|
40321d331f | ||
|
ce6227840d | ||
|
896f72d33b | ||
|
884aaa2193 | ||
|
f58c556adb | ||
|
7690c2d042 | ||
|
cbd47fa770 | ||
|
45d78f360f | ||
|
6546ef3459 | ||
|
9d48a95d9a | ||
|
cfbba2c710 | ||
|
a394a86151 | ||
|
8e74eb382f | ||
|
bd2e3f5b9b | ||
|
2f181df1cf | ||
|
542ad4fdc5 | ||
|
085368eb93 | ||
|
1ee23d0d49 | ||
|
ebf042d305 | ||
|
a849ffbd79 | ||
|
547d63d56a | ||
|
ddad5c3ce9 | ||
|
b6c8943bbf | ||
|
46d8c84049 | ||
|
59c8fdff29 | ||
|
932e5ea34e | ||
|
d2d4ea6f0a | ||
|
3396c5e983 | ||
|
c0e1044d5c | ||
|
5c24bbf00c | ||
|
a1e3e9dd17 | ||
|
d53c28b07a | ||
|
a3987f3386 | ||
|
4e9a879de0 | ||
|
9109b0c3f2 | ||
|
758137b5d9 | ||
|
4ab3aada3f | ||
|
7a5567bf41 | ||
|
a70f0356e9 | ||
|
f4c1a40446 | ||
|
8b24d59cde | ||
|
60aeb15116 | ||
|
c83441ae4a | ||
|
83a80ab866 | ||
|
7e574fa98c | ||
|
4d2b39d98c | ||
|
e9765c0405 | ||
|
334c7911c1 | ||
|
d424837496 | ||
|
694d9aa9f9 | ||
|
317abed78e | ||
|
979a7e8afa | ||
|
d638ff3afa | ||
|
c8decbaad0 | ||
|
719b2b0525 | ||
|
f9875040c6 | ||
|
7f9cd9f9d9 | ||
|
251913c80e | ||
|
d8aa8fc6ce | ||
|
d561e52cde | ||
|
e610c02a9e | ||
|
e7809f43ec | ||
|
1e06838c1c | ||
|
4bb3ac3e81 | ||
|
d94ac2ed61 | ||
|
8746322d53 | ||
|
85922f6090 | ||
|
ec2d0edd79 | ||
|
b63def0865 | ||
|
6084a7ea89 | ||
|
c78166e190 | ||
|
576dcf65b3 | ||
|
7644a9cd72 | ||
|
acd05d09aa | ||
|
19ed1b92b0 | ||
|
33b8f087a3 | ||
|
287c900bdb | ||
|
46da8a031b | ||
|
824bbf3117 | ||
|
7928532bc5 | ||
|
3edd24fb01 | ||
|
3a8607190f | ||
|
0aad5da1b3 | ||
|
5c339f2844 | ||
|
8f289227aa | ||
|
662e2b1641 | ||
|
5ff4ef14e6 | ||
|
f13cccd042 | ||
|
c8aa5b8b4e | ||
|
f71b2ee79f | ||
|
a0d0b52034 | ||
|
caaa3f8200 | ||
|
90ac5f3755 | ||
|
84364a7ef4 | ||
|
daca4b9a39 | ||
|
1d368b0cd8 | ||
|
6656130f9c | ||
|
9332237bd4 | ||
|
04b4c077f6 | ||
|
71718b9cd1 | ||
|
d7aa13a8e6 | ||
|
e46d286882 | ||
|
9a79b090df | ||
|
b59a8c2911 | ||
|
0cd9ef8bcf | ||
|
1f82697e99 | ||
|
7ddad8aa62 | ||
|
14e5218753 | ||
|
8410d87eb5 | ||
|
3c7ea78d68 | ||
|
b73857faa9 | ||
|
8e0cc8169e | ||
|
33bacb4150 | ||
|
a5d000cb5c | ||
|
d3885e92a7 | ||
|
47872e5172 | ||
|
65b423eb05 | ||
|
88ddda6d60 | ||
|
e95eeaeef1 | ||
|
c831a77592 | ||
|
8fcc401e05 | ||
|
f07b131362 | ||
|
b702618ed9 | ||
|
1262d0c6e5 | ||
|
547e5bf128 | ||
|
ac6d42a119 | ||
|
bf1c344443 | ||
|
555c6d7ac7 | ||
|
5242073547 | ||
|
772c994fd0 | ||
|
c5976fed9a | ||
|
34d1ebc562 | ||
|
80f5fd8435 | ||
|
2ce2a80d40 | ||
|
fa0a44e811 | ||
|
67becb4510 | ||
|
69644993f6 | ||
|
d056be4ea2 | ||
|
3c05a6662b | ||
|
5469bf0773 | ||
|
335a8aa843 | ||
|
f5a2ab38f3 | ||
|
766185bce5 | ||
|
c7fd3ebbaf | ||
|
e1f1fe9ba6 | ||
|
79e54929a2 | ||
|
f4a0109377 | ||
|
7f8a8f221d | ||
|
03a85ff2a0 | ||
|
f569717a03 | ||
|
7fdf3d1769 | ||
|
702deee799 | ||
|
a34f35d587 | ||
|
901aa59b5b | ||
|
f6a79559e9 | ||
|
64849426ae | ||
|
d1cdb9b5cf | ||
|
e379ea617a | ||
|
f44959fa59 | ||
|
af27199102 | ||
|
613f7609c2 | ||
|
0f0be1ee8e | ||
|
db095f8cdb | ||
|
4a72cab818 | ||
|
e191015aa0 | ||
|
45db4a5550 | ||
|
0069de7e75 | ||
|
be2853e5de | ||
|
0ab4bc80ad | ||
|
35e74a1501 | ||
|
eb9105acea | ||
|
8366ef71c0 | ||
|
fb53568c04 | ||
|
622a150bb4 | ||
|
2815054820 | ||
|
31e0aaf6b0 | ||
|
ee82d73d7a | ||
|
0f4084946a | ||
|
1185b0b447 | ||
|
7fed0b74ed | ||
|
d506799e72 | ||
|
3a5a9d9233 | ||
|
e0205eb27c | ||
|
a54e5844b6 | ||
|
1dcb76bc26 | ||
|
5f19421bc9 | ||
|
a40923b03a | ||
|
2cf55c1686 | ||
|
422262436b | ||
|
97e43715fb | ||
|
50985d922a | ||
|
995b29d8db | ||
|
5166767e8b | ||
|
bf6aafe460 | ||
|
bcb3a32686 | ||
|
01455399e8 | ||
|
3684b72121 | ||
|
059a181f7d | ||
|
a0f591297a | ||
|
b20e68cc91 | ||
|
6b7be6643a | ||
|
5e2103f7f0 | ||
|
8fecee4e41 | ||
|
4aaeb7de19 | ||
|
a86359af2b | ||
|
56cc470663 | ||
|
aca20dbb78 | ||
|
3a4238e199 | ||
|
76855e8999 | ||
|
3675f9ccb2 | ||
|
15e00759c7 | ||
|
ba7849960e | ||
|
c5f12a7326 | ||
|
4f3058f195 | ||
|
74dbb057ed | ||
|
1e6eb1f8b9 | ||
|
bf82149271 | ||
|
4ddc94b293 | ||
|
71991270b0 | ||
|
66223aaa08 | ||
|
91efa37fcb | ||
|
703d5340f1 | ||
|
6fb92a0ab9 | ||
|
31de97749a | ||
|
fa97236b62 | ||
|
c2ec738a2e | ||
|
0d7cf79b00 | ||
|
40a082de10 | ||
|
9c0acf62b4 | ||
|
9af03fa602 | ||
|
8ddba5ffcd | ||
|
e01e9ce092 | ||
|
b0bb7f3da4 | ||
|
9774b9fabd | ||
|
77f4204bf4 | ||
|
b442277fd4 | ||
|
f00361b246 | ||
|
aeda2ad049 | ||
|
23f4724a23 | ||
|
0547c0999f | ||
|
ae7a677346 | ||
|
7002f08cc1 | ||
|
8c5d31d11d | ||
|
b554f4be20 | ||
|
a329de63ea | ||
|
99c46f263e | ||
|
9421cb8b3a | ||
|
83ea0b3714 | ||
|
fd686afeb2 | ||
|
6aa89f2163 | ||
|
a865621519 | ||
|
48fc18c37b | ||
|
c6ae0ff2d1 | ||
|
dbe4f1d766 | ||
|
e7d6648f46 | ||
|
4d481ecb95 | ||
|
4aac0760b3 | ||
|
03e6cefe73 | ||
|
c48d78525e | ||
|
899674d445 | ||
|
54a83d0288 | ||
|
7a6871ea5f | ||
|
a6553b0e20 | ||
|
813e9c95fb | ||
|
a83487a0c4 | ||
|
52de880c1c | ||
|
f396786051 | ||
|
2210b9a302 | ||
|
aa2f415283 | ||
|
db5b8ca997 | ||
|
8756748525 | ||
|
1e5c79ed47 | ||
|
dbdd3bf179 | ||
|
1e0eed79b5 | ||
|
b49dccb86d | ||
|
73b4a62f51 | ||
|
49f9d2108d | ||
|
29d77be03f | ||
|
8be12a2427 | ||
|
f0f2dd743f | ||
|
5d80086470 | ||
|
1104a8fdb7 | ||
|
e283ed5523 | ||
|
3f307c59bd | ||
|
2a87caf529 | ||
|
f57c1a2901 | ||
|
1517114d9f | ||
|
48af688940 | ||
|
e882db2763 | ||
|
7bb98674d0 | ||
|
fc57d3b5a3 | ||
|
9178f74067 | ||
|
e6deaa3a85 | ||
|
5c152192d7 | ||
|
b92e688141 | ||
|
0401e031ad | ||
|
95f65da038 | ||
|
f36c8c219c | ||
|
ae14fa4efd | ||
|
5f7191b31a | ||
|
279344a2e6 | ||
|
f403a311c9 | ||
|
caa9255dd3 | ||
|
1d636dc8d4 | ||
|
bc2fad6842 | ||
|
bef44a0c9d | ||
|
43a7f36993 | ||
|
d3f40dc771 | ||
|
77637dc73b | ||
|
ff1dd5009c | ||
|
f922109a9c | ||
|
7a09cd4cda | ||
|
c5bcc47ce7 | ||
|
8d11e7685a | ||
|
f483fd539e | ||
|
5b453ecd19 | ||
|
9b8ff8d6c3 | ||
|
1313234ae0 | ||
|
c3e02b2b22 | ||
|
1a24a360bd | ||
|
4f3c7cd48a | ||
|
d74be1fcf0 | ||
|
ac268b1c5d | ||
|
fae1bbb3fe | ||
|
bd855c11ab | ||
|
bb412cdda1 | ||
|
840504b60a | ||
|
c948c9e51d | ||
|
746c9dc278 | ||
|
29f38056a9 | ||
|
cfa04805a3 | ||
|
6f4a77bb3c | ||
|
09037b261e | ||
|
9d746d4ec4 | ||
|
c15b64b720 | ||
|
e30176a522 | ||
|
4900c3eb3b | ||
|
f9452957cd | ||
|
06a1477f80 | ||
|
45c8c8f934 | ||
|
6985dde320 | ||
|
bc2a38a59e | ||
|
2db43edbd6 | ||
|
3b2a03367c | ||
|
d13e78831b | ||
|
4fae962a03 | ||
|
8fd0ee96a6 | ||
|
48472a4b04 | ||
|
24953ab1be | ||
|
2a7e5d5137 | ||
|
f6ba206d07 | ||
|
331f9762cc | ||
|
aaf2e30a48 | ||
|
50feed4c28 | ||
|
0fd9362e91 | ||
|
bdb7815b0c | ||
|
59a8ffd35e | ||
|
44682256a9 | ||
|
5b2153ad38 | ||
|
8570d33e08 | ||
|
0abf8efd2f | ||
|
e23b65e434 | ||
|
4bb48212a6 | ||
|
8b188c9b41 | ||
|
0b4bfd5c93 | ||
|
d79f1fdbce | ||
|
f4857da08f | ||
|
3e9a68be83 | ||
|
651e7aa6a1 | ||
|
5b160efc76 | ||
|
b0e9dc4723 | ||
|
4336c6412a | ||
|
172b0e7ea0 | ||
|
bf08537885 | ||
|
be77e0d500 | ||
|
2f95b4dd70 | ||
|
4b02982e1c | ||
|
914656b8b6 | ||
|
5f02caf09b | ||
|
3da9543b63 | ||
|
d48084dad9 | ||
|
968a8e1cf0 | ||
|
e36adbac04 | ||
|
7bd5f8f69c | ||
|
84a30e9524 | ||
|
0a0c909e14 | ||
|
1db1a30339 | ||
|
1195bb3872 | ||
|
b48422d423 | ||
|
add82735bb | ||
|
c18219c5a8 | ||
|
fdfdada362 | ||
|
3a995b41d7 | ||
|
497d2f8c50 | ||
|
26f962eead | ||
|
fc6018f192 | ||
|
4aab8e970b | ||
|
7ef8696a7d | ||
|
9cecf123f3 | ||
|
af6b2cdb37 | ||
|
3a1c69dce6 | ||
|
b9c8c146d2 | ||
|
770866f265 | ||
|
39d930c065 | ||
|
814b7d7bb7 | ||
|
0965812e37 | ||
|
5e81761ad0 | ||
|
0336825537 | ||
|
8c3ee6a38d | ||
|
20f12f9ed7 | ||
|
8fa2db35f8 | ||
|
a2a99d27c9 | ||
|
c542115906 | ||
|
d7af16c8e4 | ||
|
cc66b50dcd | ||
|
d448be007e | ||
|
2dd37e9624 | ||
|
b79c138100 | ||
|
2abf082231 | ||
|
7ef8cb652b | ||
|
5abc4749de | ||
|
5c51a302a4 | ||
|
0af5316f00 | ||
|
2862ee7682 | ||
|
3ee2aa1b22 | ||
|
21f15094fb | ||
|
3df94fe099 | ||
|
e0415fccd7 | ||
|
b591d7bc20 | ||
|
d6477d0894 | ||
|
1738b80efd | ||
|
f26b2469af | ||
|
14c8a603e3 | ||
|
adc0159bdb | ||
|
e44bbeb558 | ||
|
12063fe53e | ||
|
f24d0725ca | ||
|
3db4f805ee | ||
|
3ce6355bf4 | ||
|
3a5b2f54ea | ||
|
5d1f93796e | ||
|
b29ee2dc46 | ||
|
d49d391fcd | ||
|
3593fd2a29 | ||
|
44390c16b2 | ||
|
09f04633ca | ||
|
27d9f233d4 | ||
|
410b20f904 | ||
|
fae064d5f9 | ||
|
c7ef697029 | ||
|
b7291ce533 | ||
|
0afdd84a2a | ||
|
78a9b5d1ed | ||
|
d77ede508c | ||
|
bb8debe925 | ||
|
bb8f6f87ae | ||
|
c8e38c6065 | ||
|
a115f59950 | ||
|
7ed0c85c61 | ||
|
e8fef1147f | ||
|
8d8db89669 | ||
|
15b569e64d | ||
|
53a66c0f41 | ||
|
7fd0d3ec51 | ||
|
08126ffdf2 | ||
|
57c58f880b | ||
|
5bbb185e14 | ||
|
6cd53fc491 | ||
|
5ad31616e8 | ||
|
ff738269b6 | ||
|
58aa93be41 | ||
|
d4e4904604 | ||
|
b7f98314a5 | ||
|
fb33110fd1 | ||
|
3eddbdc191 | ||
|
faaf828c74 | ||
|
acb950ffb5 | ||
|
9a80b9e382 | ||
|
362a6ca469 | ||
|
73fe140b10 | ||
|
b0cd5cd7c8 | ||
|
3361fe1e62 | ||
|
5a34d0f816 | ||
|
d724506abe | ||
|
d5e826a660 | ||
|
f291541769 | ||
|
1fa6239509 | ||
|
0b3b81a8bf | ||
|
20c1e24b60 | ||
|
ad5f0a63a3 | ||
|
6892b5c5ba | ||
|
d74ecfb02e | ||
|
695549d5a7 | ||
|
b55696e551 | ||
|
385fa18c27 | ||
|
cfdf4f650f | ||
|
df386f29ab | ||
|
ec84fb90bf | ||
|
80c3ebe3a0 | ||
|
585aafc2df | ||
|
87b4dc4c67 | ||
|
5118f9817a | ||
|
568054a034 | ||
|
0d884d22fb | ||
|
6f4107c8de | ||
|
5081472d97 | ||
|
b033e30318 | ||
|
f231ac6541 | ||
|
c971ca7c34 | ||
|
4990842981 | ||
|
21d1ab42d1 | ||
|
6d1b21a028 | ||
|
c2bd7fcf35 | ||
|
75024fea60 | ||
|
98f31e61d7 | ||
|
2cc85df62b | ||
|
918d552472 | ||
|
8d396991db | ||
|
19bd57ed1f | ||
|
b1eaeebe7d | ||
|
f0c8e9de4f | ||
|
58eaf5ca16 | ||
|
1ce79b29e3 | ||
|
f876532514 |
@@ -1,43 +1,82 @@
|
||||
stages:
|
||||
- build
|
||||
- flatpak
|
||||
- deploy
|
||||
|
||||
gtk:
|
||||
image: ebassi/gitlab-gtk:latest
|
||||
.cache-paths: &cache-paths
|
||||
paths:
|
||||
- _ccache/
|
||||
- subprojects/gdk-pixbuf/
|
||||
- subprojects/glib/
|
||||
- subprojects/graphene/
|
||||
- subprojects/libepoxy/
|
||||
- subprojects/pango/
|
||||
|
||||
fedora-x86_64:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v1
|
||||
stage: build
|
||||
before_script:
|
||||
- export CCACHE_DISABLE=true_
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/test-docker.sh
|
||||
cache:
|
||||
paths:
|
||||
- subprojects/gdk-pixbuf/
|
||||
- subprojects/glib/
|
||||
- subprojects/graphene/
|
||||
- subprojects/libepoxy/
|
||||
- subprojects/pango/
|
||||
artifacts:
|
||||
when: on_failure
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
|
||||
.mingw-defaults: &mingw-defaults
|
||||
stage: build
|
||||
tags:
|
||||
- win32
|
||||
script:
|
||||
- C:\msys64\usr\bin\pacman --noconfirm -Syyuu
|
||||
- C:\msys64\usr\bin\bash -lc "bash -x ./.gitlab-ci/test-msys2.sh"
|
||||
cache:
|
||||
key: "%CI_JOB_NAME%"
|
||||
<<: *cache-paths
|
||||
|
||||
msys2-mingw32:
|
||||
variables:
|
||||
MSYSTEM: "MINGW32"
|
||||
CHERE_INVOKING: "yes"
|
||||
<<: *mingw-defaults
|
||||
|
||||
.flatpak-defaults: &flatpak-defaults
|
||||
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
|
||||
stage: flatpak
|
||||
artifacts:
|
||||
paths:
|
||||
- "${APPID}-dev.flatpak"
|
||||
expire_in: 1 day
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
|
||||
|
||||
flatpak:demo:
|
||||
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
|
||||
stage: flatpak
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh org.gtk.Demo
|
||||
artifacts:
|
||||
paths:
|
||||
- org.gtk.Demo-dev.flatpak
|
||||
expire_in: 1 day
|
||||
variables:
|
||||
APPID: org.gtk.Demo
|
||||
<<: *flatpak-defaults
|
||||
|
||||
flatpak:widget-factory:
|
||||
image: registry.gitlab.com/alatiera/gnome-nightly-oci/gnome-master:latest
|
||||
stage: flatpak
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory
|
||||
<<: *flatpak-defaults
|
||||
|
||||
pages:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v1
|
||||
stage: deploy
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh org.gtk.WidgetFactory
|
||||
- meson -Ddocumentation=true _build .
|
||||
- ninja -C _build
|
||||
- ninja -C _build gdk4-doc gsk4-doc gtk4-doc
|
||||
|
||||
- mkdir -p public/
|
||||
- mv _build/docs/reference/gtk/html/ public/gtk/
|
||||
- mv _build/docs/reference/gdk/html/ public/gdk/
|
||||
- mv _build/docs/reference/gsk/html/ public/gsk/
|
||||
artifacts:
|
||||
paths:
|
||||
- org.gtk.WidgetFactory-dev.flatpak
|
||||
expire_in: 1 day
|
||||
- public
|
||||
only:
|
||||
- master
|
||||
|
@@ -1,6 +1,7 @@
|
||||
FROM fedora:27
|
||||
FROM fedora:28
|
||||
|
||||
RUN dnf -y install \
|
||||
hicolor-icon-theme \
|
||||
adwaita-icon-theme \
|
||||
atk-devel \
|
||||
at-spi2-atk-devel \
|
||||
@@ -28,6 +29,7 @@ RUN dnf -y install \
|
||||
gstreamer1-plugins-good \
|
||||
gstreamer1-plugins-bad-free-devel \
|
||||
gstreamer1-plugins-base-devel \
|
||||
gtk-doc \
|
||||
iso-codes \
|
||||
itstool \
|
||||
json-glib-devel \
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
TAG="ebassi/gitlab-gtk:latest"
|
||||
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v1"
|
||||
|
||||
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
|
||||
--file "Dockerfile" .
|
||||
|
@@ -4,16 +4,25 @@ set -e
|
||||
|
||||
srcdir=$(pwd)
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
export CCACHE_DISABLE=true
|
||||
meson \
|
||||
-Dx11-backend=true \
|
||||
-Dwayland-backend=true \
|
||||
-Dbroadway-backend=true \
|
||||
-Dvulkan=yes \
|
||||
_build $srcdir
|
||||
unset CCACHE_DISABLE
|
||||
|
||||
cd _build
|
||||
|
||||
ninja
|
||||
ccache --show-stats
|
||||
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
meson test \
|
||||
|
53
.gitlab-ci/test-msys2.sh
Normal file
53
.gitlab-ci/test-msys2.sh
Normal file
@@ -0,0 +1,53 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ "$MSYSTEM" == "MINGW32" ]]; then
|
||||
export MSYS2_ARCH="i686"
|
||||
else
|
||||
export MSYS2_ARCH="x86_64"
|
||||
fi
|
||||
|
||||
# Update everything
|
||||
pacman --noconfirm -Suy
|
||||
|
||||
# Install the required packages
|
||||
pacman --noconfirm -S --needed \
|
||||
base-devel \
|
||||
git \
|
||||
mingw-w64-$MSYS2_ARCH-toolchain \
|
||||
mingw-w64-$MSYS2_ARCH-ccache \
|
||||
mingw-w64-$MSYS2_ARCH-pkg-config \
|
||||
mingw-w64-$MSYS2_ARCH-gobject-introspection \
|
||||
mingw-w64-$MSYS2_ARCH-meson \
|
||||
mingw-w64-$MSYS2_ARCH-adwaita-icon-theme \
|
||||
mingw-w64-$MSYS2_ARCH-atk \
|
||||
mingw-w64-$MSYS2_ARCH-cairo \
|
||||
mingw-w64-$MSYS2_ARCH-gdk-pixbuf2 \
|
||||
mingw-w64-$MSYS2_ARCH-glib2 \
|
||||
mingw-w64-$MSYS2_ARCH-graphene \
|
||||
mingw-w64-$MSYS2_ARCH-json-glib \
|
||||
mingw-w64-$MSYS2_ARCH-libepoxy \
|
||||
mingw-w64-$MSYS2_ARCH-pango \
|
||||
mingw-w64-$MSYS2_ARCH-fribidi \
|
||||
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
|
||||
mingw-w64-$MSYS2_ARCH-shared-mime-info
|
||||
|
||||
mkdir -p _ccache
|
||||
export CCACHE_BASEDIR="$(pwd)"
|
||||
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
|
||||
|
||||
# Build
|
||||
ccache --zero-stats
|
||||
ccache --show-stats
|
||||
export CCACHE_DISABLE=true
|
||||
meson \
|
||||
-Denable-x11-backend=false \
|
||||
-Denable-wayland-backend=false \
|
||||
-Denable-win32-backend=true \
|
||||
-Dvulkan=no \
|
||||
_build
|
||||
unset CCACHE_DISABLE
|
||||
|
||||
ninja -C _build
|
||||
ccache --show-stats
|
@@ -23,17 +23,14 @@
|
||||
|
||||
## Version information
|
||||
<!--
|
||||
- which version of GTK+ you are using
|
||||
- what operating system and version
|
||||
- for Linux, which distribution
|
||||
- if you built GTK+ yourself, the list of options used to configure the build
|
||||
- Which version of GTK+ you are using
|
||||
- What operating system and version
|
||||
- For Linux, which distribution
|
||||
- If you built GTK+ yourself, the list of options used to configure the build
|
||||
-->
|
||||
|
||||
## Additional information
|
||||
<!--
|
||||
- If the bug was a crash, the exact text that was printed out
|
||||
when the crash occurred.
|
||||
- If the bug was a crash, attaching a stack trace obtained using
|
||||
GDB is appreciated; follow the instructions on the wiki:
|
||||
https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces
|
||||
-->
|
||||
- Screenshots or screen recordings are useful for visual errors
|
||||
- Please report any warning or message printed on the terminal
|
||||
-->
|
||||
|
34
.gitlab/issue_templates/Crash.md
Normal file
34
.gitlab/issue_templates/Crash.md
Normal file
@@ -0,0 +1,34 @@
|
||||
## Steps to reproduce
|
||||
|
||||
1. ...
|
||||
2. ...
|
||||
3. ...
|
||||
|
||||
<!--
|
||||
You should try and reproduce with the demos applications available
|
||||
under the `demos` directory, or the test programs in the `tests` directory.
|
||||
Alternatively, please attach a *small and self-contained* example that
|
||||
exhibits the issue.
|
||||
-->
|
||||
|
||||
## Version information
|
||||
<!--
|
||||
- Which version of GTK+ you are using
|
||||
- What operating system and version
|
||||
- for Linux, which distribution
|
||||
- If you built GTK+ yourself, the list of options used to configure the build
|
||||
-->
|
||||
|
||||
## Warnings
|
||||
<!--
|
||||
- If the application generates warning messages before crashing please
|
||||
report them here
|
||||
-->
|
||||
|
||||
## Backtrace
|
||||
<!--
|
||||
- Attaching a stack trace obtained using GDB is appreciated; follow the
|
||||
instructions on the wiki:
|
||||
|
||||
https://wiki.gnome.org/Community/GettingInTouch/Bugzilla/GettingTraces
|
||||
-->
|
@@ -60,4 +60,6 @@ $ git checkout -b your-branch
|
||||
|
||||
Once you've finished working on the bug fix or feature, push the branch
|
||||
to the Git repository and open a new merge request, to let the GTK
|
||||
maintainers review your contribution.
|
||||
maintainers review your contribution. The [CODE-OWNERS](./docs-CODE-OWNERS)
|
||||
document contains the list of core contributors to GTK and the areas for
|
||||
which they are responsible.
|
||||
|
88
NEWS
88
NEWS
@@ -1,3 +1,91 @@
|
||||
Overview of Changes in GTK+ 3.94.0
|
||||
==================================
|
||||
|
||||
* GdkPaintable is a new, powerful abstraction for drawable content.
|
||||
gtk4-demo has a new "Paint" demo to show some of its capabilities.
|
||||
|
||||
* There is support for displaying media, with
|
||||
GtkVideo
|
||||
GtkMediaFile
|
||||
GtkMediaStream
|
||||
GtkMediaControls
|
||||
|
||||
* GtkFontChooser now supports OpenType font variations and features.
|
||||
|
||||
* The Ctrl-Shift-E support in the simple IM context has been replaced
|
||||
by an optional completion popup for Emoji alpha codes. This can be
|
||||
enabled with the GtkEntry::enable-emoji-completion property.
|
||||
|
||||
* Wayland has an input method based on the text protocol now
|
||||
|
||||
* Input methods, print backends and media backends have been converted
|
||||
to GIOModules and extension points, and support for generic loadable
|
||||
modules has been dropped. Platform im modules are always included.
|
||||
|
||||
* GdkWindow has been renamed to GdkSurface.
|
||||
|
||||
* Applications can now create their own GtkSnapshot objects for
|
||||
intermediate rendering.
|
||||
|
||||
* Widget event signals have been replaced by event controllers,
|
||||
and some new event controllers have been introduced for this:
|
||||
GtkEventControllerMotion
|
||||
GtkEventControllerKey
|
||||
GtkGestureStylus
|
||||
|
||||
* Event controllers can now be created in .ui files.
|
||||
|
||||
* Invalidation tracking has been changed, only gtk_widget_queue_draw is left.
|
||||
|
||||
* Observing widget contents and size is now done by using the
|
||||
GtkWidgetPaintable object instead of connecting to widget signals.
|
||||
|
||||
* The GtkWidget::draw signal has been removed, widgets need
|
||||
to implement GtkWidget::snapshot.
|
||||
|
||||
* GdkTexture now has GdkMemoryTexture and GdkGLTexture subclasses.
|
||||
|
||||
* The Vulkan support in GDK can now use a particular device that is
|
||||
specified by the GDK_VULKAN_DEVICE environment variable. use
|
||||
GDK_VULKAN_DEVICE=list to see them all.
|
||||
|
||||
* GTK+ Inspector
|
||||
- has logging support, and the logging settings have been cleaned up
|
||||
- has an fps overlay
|
||||
|
||||
* Removed APIs and features:
|
||||
Individual event signals such as ::proximity-in-event
|
||||
The ::draw signal
|
||||
threading support
|
||||
non-platform IM modules
|
||||
papi and test print backends
|
||||
GtkPlacesSidebar
|
||||
GtkRecentChooser
|
||||
GtkToolPalette
|
||||
GdkStatus
|
||||
gtk_true, gtk_false
|
||||
gtk_widget_show_now
|
||||
gtk_widget_draw
|
||||
gtk_render_icon_surface
|
||||
|
||||
* Incomplete transitions:
|
||||
The ::event signal is not still there, but it will be removed
|
||||
The DND apis are not finalized yet
|
||||
|
||||
* Translation updates:
|
||||
Croatian
|
||||
Esperanto
|
||||
Estonian
|
||||
French
|
||||
Friulian
|
||||
Icelandic
|
||||
Latvian
|
||||
Polish
|
||||
Russian
|
||||
Scottish Gaelic
|
||||
Spanish
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.93.0
|
||||
==================================
|
||||
|
||||
|
@@ -27,12 +27,28 @@
|
||||
"/share/doc"
|
||||
],
|
||||
"modules": [
|
||||
{
|
||||
"name" : "wayland",
|
||||
"buildsystem" : "autotools",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--disable-documentation"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/wayland-project/wayland.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "graphene",
|
||||
"buildsystem": "meson",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"--libdir=/app/lib"
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
|
@@ -27,12 +27,28 @@
|
||||
"/share/doc"
|
||||
],
|
||||
"modules": [
|
||||
{
|
||||
"name" : "wayland",
|
||||
"buildsystem" : "autotools",
|
||||
"builddir" : true,
|
||||
"config-opts" : [
|
||||
"--disable-documentation"
|
||||
],
|
||||
"sources" : [
|
||||
{
|
||||
"type" : "git",
|
||||
"url" : "https://github.com/wayland-project/wayland.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "graphene",
|
||||
"buildsystem": "meson",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"--libdir=/app/lib"
|
||||
"--libdir=/app/lib",
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
|
@@ -286,6 +286,10 @@
|
||||
/* 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
|
||||
@@ -301,3 +305,13 @@
|
||||
#mesondefine HAVE_PANGOFT
|
||||
|
||||
#mesondefine ISO_CODES_PREFIX
|
||||
|
||||
#mesondefine MALLOC_IS_ALIGNED16
|
||||
|
||||
#mesondefine HAVE_POSIX_MEMALIGN
|
||||
|
||||
#mesondefine HAVE_MEMALIGN
|
||||
|
||||
#mesondefine HAVE_ALIGNED_ALLOC
|
||||
|
||||
#mesondefine HAVE__ALIGNED_MALLOC
|
||||
|
@@ -120,7 +120,7 @@ get_image_paintable (GtkImage *image)
|
||||
|
||||
static void
|
||||
drag_begin (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
@@ -128,17 +128,16 @@ drag_begin (GtkWidget *widget,
|
||||
paintable = get_image_paintable (GTK_IMAGE (widget));
|
||||
if (paintable)
|
||||
{
|
||||
gtk_drag_set_icon_paintable (context, paintable, -2, -2);
|
||||
gtk_drag_set_icon_paintable (drag, paintable, -2, -2);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
drag_data_get (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection_data,
|
||||
guint info,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
@@ -150,9 +149,8 @@ drag_data_get (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
drag_data_received (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrop *drop,
|
||||
GtkSelectionData *selection_data,
|
||||
guint32 time,
|
||||
gpointer data)
|
||||
{
|
||||
if (gtk_selection_data_get_length (selection_data) > 0)
|
||||
@@ -321,10 +319,10 @@ do_clipboard (GtkWidget *do_widget)
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
|
||||
/* context menu on image */
|
||||
gesture = gtk_gesture_multi_press_new (image);
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_object_set_data_full (G_OBJECT (image), "gesture", gesture, g_object_unref);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* Create the second image */
|
||||
image = gtk_image_new_from_icon_name ("process-stop");
|
||||
@@ -346,10 +344,10 @@ do_clipboard (GtkWidget *do_widget)
|
||||
G_CALLBACK (drag_data_received), image);
|
||||
|
||||
/* context menu on image */
|
||||
gesture = gtk_gesture_multi_press_new (image);
|
||||
gesture = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), GDK_BUTTON_SECONDARY);
|
||||
g_object_set_data_full (G_OBJECT (image), "gesture", gesture, g_object_unref);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (pressed_cb), image);
|
||||
gtk_widget_add_controller (image, GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -105,9 +105,6 @@
|
||||
<file>gnome-fs-directory.png</file>
|
||||
<file>gnome-fs-regular.png</file>
|
||||
</gresource>
|
||||
<gresource prefix="/stack">
|
||||
<file>stack.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/shortcuts">
|
||||
<file>shortcuts.ui</file>
|
||||
<file>shortcuts-builder.ui</file>
|
||||
@@ -115,6 +112,14 @@
|
||||
<file>shortcuts-clocks.ui</file>
|
||||
<file>shortcuts-boxes.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/sliding_puzzle">
|
||||
<file>puzzlepiece.c</file>
|
||||
<file>puzzlepiece.h</file>
|
||||
<file>portland-rose.jpg</file>
|
||||
</gresource>
|
||||
<gresource prefix="/stack">
|
||||
<file>stack.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/revealer">
|
||||
<file>revealer.ui</file>
|
||||
</gresource>
|
||||
@@ -160,11 +165,11 @@
|
||||
<file>expander.c</file>
|
||||
<file>filtermodel.c</file>
|
||||
<file>fishbowl.c</file>
|
||||
<file>widgetbowl.c</file>
|
||||
<file>flowbox.c</file>
|
||||
<file>foreigndrawing.c</file>
|
||||
<file>font_features.c</file>
|
||||
<file>fontplane.c</file>
|
||||
<file>fontrendering.c</file>
|
||||
<file>gestures.c</file>
|
||||
<file>glarea.c</file>
|
||||
<file>headerbar.c</file>
|
||||
@@ -181,6 +186,7 @@
|
||||
<file>modelbutton.c</file>
|
||||
<file>overlay.c</file>
|
||||
<file>overlay2.c</file>
|
||||
<file>paint.c</file>
|
||||
<file>pagesetup.c</file>
|
||||
<file>paintable.c</file>
|
||||
<file>paintable_animated.c</file>
|
||||
@@ -198,6 +204,7 @@
|
||||
<file>shortcuts.c</file>
|
||||
<file>sizegroup.c</file>
|
||||
<file>sidebar.c</file>
|
||||
<file>sliding_puzzle.c</file>
|
||||
<file>stack.c</file>
|
||||
<file>spinbutton.c</file>
|
||||
<file>spinner.c</file>
|
||||
@@ -256,4 +263,7 @@
|
||||
<gresource prefix="/dnd">
|
||||
<file>dnd.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/fontrendering">
|
||||
<file>fontrendering.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
||||
|
@@ -356,10 +356,11 @@ do_dnd (GtkWidget *do_widget)
|
||||
gtk_widget_set_hexpand (fixed, TRUE);
|
||||
gtk_widget_set_vexpand (fixed, TRUE);
|
||||
|
||||
multipress = gtk_gesture_multi_press_new (fixed);
|
||||
multipress = gtk_gesture_multi_press_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (multipress), 0);
|
||||
g_signal_connect (multipress, "pressed", G_CALLBACK (pressed_cb), NULL);
|
||||
g_signal_connect (multipress, "released", G_CALLBACK (released_cb), NULL);
|
||||
gtk_widget_add_controller (fixed, GTK_EVENT_CONTROLLER (multipress));
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/dnd/dnd.css");
|
||||
|
@@ -244,13 +244,14 @@ do_drawingarea (GtkWidget *do_widget)
|
||||
g_signal_connect (da, "size-allocate",
|
||||
G_CALLBACK (scribble_size_allocate), NULL);
|
||||
|
||||
drag = gtk_gesture_drag_new (da);
|
||||
drag = gtk_gesture_drag_new ();
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (drag), GDK_BUTTON_PRIMARY);
|
||||
g_object_set_data_full (G_OBJECT (da), "drag", drag, g_object_unref);
|
||||
gtk_widget_add_controller (da, GTK_EVENT_CONTROLLER (drag));
|
||||
|
||||
g_signal_connect (drag, "drag-begin", G_CALLBACK (drag_begin), da);
|
||||
g_signal_connect (drag, "drag-update", G_CALLBACK (drag_update), da);
|
||||
g_signal_connect (drag, "drag-end", G_CALLBACK (drag_end), da);
|
||||
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -444,7 +444,7 @@ draw_device_info (GtkWidget *widget,
|
||||
g_string_append_printf (string, "\nTool: %s", tool_type);
|
||||
|
||||
if (serial != 0)
|
||||
g_string_append_printf (string, ", Serial: %lx", serial);
|
||||
g_string_append_printf (string, ", Serial: %" G_GINT64_MODIFIER "x", serial);
|
||||
}
|
||||
|
||||
cairo_move_to (cr, 10, *y);
|
||||
@@ -581,8 +581,7 @@ init_pad_controller (GtkWidget *window,
|
||||
gint i;
|
||||
|
||||
action_group = g_simple_action_group_new ();
|
||||
pad_controller = gtk_pad_controller_new (GTK_WINDOW (window),
|
||||
G_ACTION_GROUP (action_group),
|
||||
pad_controller = gtk_pad_controller_new (G_ACTION_GROUP (action_group),
|
||||
NULL);
|
||||
|
||||
for (i = 0; i < G_N_ELEMENTS (pad_actions); i++)
|
||||
@@ -607,8 +606,7 @@ init_pad_controller (GtkWidget *window,
|
||||
|
||||
gtk_pad_controller_set_action_entries (pad_controller, pad_actions,
|
||||
G_N_ELEMENTS (pad_actions));
|
||||
g_object_set_data_full (G_OBJECT (window), "pad-controller",
|
||||
pad_controller, g_object_unref);
|
||||
gtk_widget_add_controller (window, GTK_EVENT_CONTROLLER (pad_controller));
|
||||
|
||||
g_object_unref (action_group);
|
||||
}
|
||||
|
@@ -8,167 +8,245 @@
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gtkfishbowl.h"
|
||||
#include "gtkgears.h"
|
||||
|
||||
GtkWidget *info_label;
|
||||
GtkWidget *allow_changes;
|
||||
const char *const css =
|
||||
".blurred-button {"
|
||||
" box-shadow: 0px 0px 5px 10px rgba(0, 0, 0, 0.5);"
|
||||
"}"
|
||||
"";
|
||||
|
||||
#define N_STATS 5
|
||||
|
||||
#define STATS_UPDATE_TIME G_USEC_PER_SEC
|
||||
|
||||
typedef struct _Stats Stats;
|
||||
struct _Stats {
|
||||
gint last_suggestion;
|
||||
};
|
||||
|
||||
static Stats *
|
||||
get_stats (GtkWidget *widget)
|
||||
{
|
||||
static GQuark stats_quark = 0;
|
||||
Stats *stats;
|
||||
|
||||
if (G_UNLIKELY (stats_quark == 0))
|
||||
stats_quark = g_quark_from_static_string ("stats");
|
||||
|
||||
stats = g_object_get_qdata (G_OBJECT (widget), stats_quark);
|
||||
if (stats == NULL)
|
||||
{
|
||||
stats = g_new0 (Stats, 1);
|
||||
g_object_set_qdata_full (G_OBJECT (widget), stats_quark, stats, g_free);
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
static gint64
|
||||
guess_refresh_interval (GdkFrameClock *frame_clock)
|
||||
{
|
||||
gint64 interval;
|
||||
gint64 i;
|
||||
|
||||
interval = G_MAXINT64;
|
||||
|
||||
for (i = gdk_frame_clock_get_history_start (frame_clock);
|
||||
i < gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
i++)
|
||||
{
|
||||
GdkFrameTimings *t, *before;
|
||||
gint64 ts, before_ts;
|
||||
|
||||
t = gdk_frame_clock_get_timings (frame_clock, i);
|
||||
before = gdk_frame_clock_get_timings (frame_clock, i - 1);
|
||||
if (t == NULL || before == NULL)
|
||||
continue;
|
||||
|
||||
ts = gdk_frame_timings_get_frame_time (t);
|
||||
before_ts = gdk_frame_timings_get_frame_time (before);
|
||||
if (ts == 0 || before_ts == 0)
|
||||
continue;
|
||||
|
||||
interval = MIN (interval, ts - before_ts);
|
||||
}
|
||||
|
||||
if (interval == G_MAXINT64)
|
||||
return 0;
|
||||
|
||||
return interval;
|
||||
}
|
||||
char **icon_names = NULL;
|
||||
gsize n_icon_names = 0;
|
||||
|
||||
static void
|
||||
do_stats (GtkWidget *widget,
|
||||
gint *suggested_change)
|
||||
init_icon_names (GtkIconTheme *theme)
|
||||
{
|
||||
GdkFrameClock *frame_clock;
|
||||
Stats *stats;
|
||||
GdkFrameTimings *start, *end;
|
||||
gint64 start_counter, end_counter;
|
||||
gint64 n_frames, expected_frames;
|
||||
gint64 start_timestamp, end_timestamp;
|
||||
gint64 interval;
|
||||
char *new_label;
|
||||
GPtrArray *icons;
|
||||
GList *l, *icon_list;
|
||||
|
||||
stats = get_stats (widget);
|
||||
frame_clock = gtk_widget_get_frame_clock (widget);
|
||||
if (frame_clock == NULL)
|
||||
if (icon_names)
|
||||
return;
|
||||
|
||||
start_counter = gdk_frame_clock_get_history_start (frame_clock);
|
||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
end_counter--;
|
||||
if (end_counter - start_counter < 4)
|
||||
icon_list = gtk_icon_theme_list_icons (theme, NULL);
|
||||
icons = g_ptr_array_new ();
|
||||
|
||||
for (l = icon_list; l; l = l->next)
|
||||
{
|
||||
if (g_str_has_suffix (l->data, "symbolic"))
|
||||
continue;
|
||||
|
||||
g_ptr_array_add (icons, g_strdup (l->data));
|
||||
}
|
||||
|
||||
n_icon_names = icons->len;
|
||||
g_ptr_array_add (icons, NULL); /* NULL-terminate the array */
|
||||
icon_names = (char **) g_ptr_array_free (icons, FALSE);
|
||||
|
||||
/* don't free strings, we assigned them to the array */
|
||||
g_list_free_full (icon_list, g_free);
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_random_icon_name (GtkIconTheme *theme)
|
||||
{
|
||||
init_icon_names (theme);
|
||||
|
||||
return icon_names[g_random_int_range(0, n_icon_names)];
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
create_icon (void)
|
||||
{
|
||||
GtkWidget *image;
|
||||
|
||||
image = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()));
|
||||
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_button (void)
|
||||
{
|
||||
return gtk_button_new_with_label ("Button");
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_blurred_button (void)
|
||||
{
|
||||
GtkWidget *w = gtk_button_new ();
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "blurred-button");
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_font_button (void)
|
||||
{
|
||||
return gtk_font_button_new ();
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_level_bar (void)
|
||||
{
|
||||
GtkWidget *w = gtk_level_bar_new_for_interval (0, 100);
|
||||
|
||||
gtk_level_bar_set_value (GTK_LEVEL_BAR (w), 50);
|
||||
|
||||
/* Force them to be a bit larger */
|
||||
gtk_widget_set_size_request (w, 200, -1);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_spinner (void)
|
||||
{
|
||||
GtkWidget *w = gtk_spinner_new ();
|
||||
|
||||
gtk_spinner_start (GTK_SPINNER (w));
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_spinbutton (void)
|
||||
{
|
||||
GtkWidget *w = gtk_spin_button_new_with_range (0, 10, 1);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_label (void)
|
||||
{
|
||||
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
|
||||
|
||||
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
|
||||
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_video (void)
|
||||
{
|
||||
GtkMediaStream *stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
GtkWidget *w = gtk_image_new_from_paintable (GDK_PAINTABLE (stream));
|
||||
gtk_media_stream_set_loop (stream, TRUE);
|
||||
gtk_media_stream_play (stream);
|
||||
g_object_unref (stream);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_gears (void)
|
||||
{
|
||||
GtkWidget *w = gtk_gears_new ();
|
||||
|
||||
gtk_widget_set_size_request (w, 100, 100);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_switch (void)
|
||||
{
|
||||
GtkWidget *w = gtk_switch_new ();
|
||||
|
||||
gtk_switch_set_state (GTK_SWITCH (w), TRUE);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
GtkWidget * (*create_func) (void);
|
||||
} widget_types[] = {
|
||||
{ "Icon", create_icon },
|
||||
{ "Button", create_button },
|
||||
{ "Blurbutton", create_blurred_button },
|
||||
{ "Fontbutton", create_font_button },
|
||||
{ "Levelbar", create_level_bar },
|
||||
{ "Label", create_label },
|
||||
{ "Spinner", create_spinner },
|
||||
{ "Spinbutton", create_spinbutton },
|
||||
{ "Video", create_video },
|
||||
{ "Gears", create_gears },
|
||||
{ "Switch", create_switch },
|
||||
};
|
||||
|
||||
static int selected_widget_type = -1;
|
||||
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
|
||||
|
||||
static void
|
||||
set_widget_type (GtkFishbowl *fishbowl,
|
||||
int widget_type_index)
|
||||
{
|
||||
GtkWidget *window, *headerbar;
|
||||
|
||||
if (widget_type_index == selected_widget_type)
|
||||
return;
|
||||
|
||||
start_timestamp = gdk_frame_timings_get_presentation_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_presentation_time (end);
|
||||
if (start_timestamp == 0 || end_timestamp == 0)
|
||||
{
|
||||
start_timestamp = gdk_frame_timings_get_frame_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_frame_time (end);
|
||||
}
|
||||
selected_widget_type = widget_type_index;
|
||||
|
||||
interval = gdk_frame_timings_get_refresh_interval (end);
|
||||
if (interval == 0)
|
||||
{
|
||||
interval = guess_refresh_interval (frame_clock);
|
||||
if (interval == 0)
|
||||
return;
|
||||
}
|
||||
n_frames = end_counter - start_counter;
|
||||
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
|
||||
gtk_fishbowl_set_creation_func (fishbowl,
|
||||
widget_types[selected_widget_type].create_func);
|
||||
|
||||
new_label = g_strdup_printf ("icons - %.1f fps",
|
||||
((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp));
|
||||
gtk_label_set_label (GTK_LABEL (info_label), new_label);
|
||||
g_free (new_label);
|
||||
|
||||
if (n_frames >= expected_frames)
|
||||
{
|
||||
if (stats->last_suggestion > 0)
|
||||
stats->last_suggestion *= 2;
|
||||
else
|
||||
stats->last_suggestion = 1;
|
||||
}
|
||||
else if (n_frames + 1 < expected_frames)
|
||||
{
|
||||
if (stats->last_suggestion < 0)
|
||||
stats->last_suggestion--;
|
||||
else
|
||||
stats->last_suggestion = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
stats->last_suggestion = 0;
|
||||
}
|
||||
|
||||
if (suggested_change)
|
||||
*suggested_change = stats->last_suggestion;
|
||||
else
|
||||
stats->last_suggestion = 0;
|
||||
window = gtk_widget_get_toplevel (GTK_WIDGET (fishbowl));
|
||||
headerbar = gtk_window_get_titlebar (GTK_WINDOW (window));
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
|
||||
widget_types[selected_widget_type].name);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
move_fish (gpointer bowl)
|
||||
void
|
||||
next_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
gint suggested_change = 0, new_count;
|
||||
|
||||
do_stats (bowl,
|
||||
!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (allow_changes)) ? &suggested_change : NULL);
|
||||
GtkFishbowl *fishbowl = user_data;
|
||||
int new_index;
|
||||
|
||||
new_count = gtk_fishbowl_get_count (GTK_FISHBOWL (bowl)) + suggested_change;
|
||||
new_count = MAX (1, new_count);
|
||||
gtk_fishbowl_set_count (GTK_FISHBOWL (bowl), new_count);
|
||||
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
|
||||
new_index = 0;
|
||||
else
|
||||
new_index = selected_widget_type + 1;
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
|
||||
void
|
||||
prev_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkFishbowl *fishbowl = user_data;
|
||||
int new_index;
|
||||
|
||||
if (selected_widget_type - 1 < 0)
|
||||
new_index = N_WIDGET_TYPES - 1;
|
||||
else
|
||||
new_index = selected_widget_type - 1;
|
||||
|
||||
set_widget_type (fishbowl, new_index);
|
||||
}
|
||||
|
||||
|
||||
GtkWidget *
|
||||
do_fishbowl (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkCssProvider *provider = NULL;
|
||||
|
||||
if (provider == NULL)
|
||||
{
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
|
||||
if (!window)
|
||||
{
|
||||
@@ -178,21 +256,20 @@ do_fishbowl (GtkWidget *do_widget)
|
||||
g_type_ensure (GTK_TYPE_FISHBOWL);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/fishbowl/fishbowl.ui");
|
||||
gtk_builder_add_callback_symbols (builder,
|
||||
"next_button_clicked_cb", G_CALLBACK (next_button_clicked_cb),
|
||||
"prev_button_clicked_cb", G_CALLBACK (prev_button_clicked_cb),
|
||||
NULL);
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
bowl = GTK_WIDGET (gtk_builder_get_object (builder, "bowl"));
|
||||
gtk_fishbowl_set_use_icons (GTK_FISHBOWL (bowl), TRUE);
|
||||
info_label = GTK_WIDGET (gtk_builder_get_object (builder, "info_label"));
|
||||
allow_changes = GTK_WIDGET (gtk_builder_get_object (builder, "changes_allow"));
|
||||
set_widget_type (GTK_FISHBOWL (bowl), 0);
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_widget_realize (window);
|
||||
g_timeout_add_seconds (1,
|
||||
move_fish,
|
||||
bowl);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -7,7 +7,43 @@
|
||||
<object class="GtkHeaderBar" id="">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="info_label">
|
||||
<object class="GtkBox">
|
||||
<style>
|
||||
<class name="linked"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">pan-start-symbolic</property>
|
||||
<signal name="clicked" handler="prev_button_clicked_cb" object="bowl" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">pan-end-symbolic</property>
|
||||
<signal name="clicked" handler="next_button_clicked_cb" object="bowl" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">fps</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" bind-source="bowl" bind-property="framerate"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Icons, </property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
@@ -48,6 +84,7 @@
|
||||
<object class="GtkFishbowl" id="bowl">
|
||||
<property name="visible">True</property>
|
||||
<property name="animating">True</property>
|
||||
<property name="benchmark" bind-source="changes_allow" bind-property="active" bind-flags="invert-boolean">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -133,7 +133,6 @@
|
||||
Разъяренный чтец эгоистично бьёт пятью жердями шустрого фехтовальщика. Наш банк вчера же выплатил Ф.Я. Эйхгольду комиссию за ценные вещи. Эх, чужак, общий съём цен шляп (юфть) – вдрызг! В чащах юга жил бы цитрус? Да, но фальшивый экземпляр!
|
||||
|
||||
Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός</property>
|
||||
<signal name="key-press-event" handler="entry_key_press"/>
|
||||
<signal name="activate" handler="stop_edit"/>
|
||||
<property name="valign">start</property>
|
||||
<property name="width-chars">50</property>
|
||||
|
@@ -1669,12 +1669,12 @@ stop_edit (void)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
entry_key_press (GtkEntry *entry, GdkEventKey *event)
|
||||
entry_key_press (GtkEventController *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType modifiers,
|
||||
GtkEntry *entry)
|
||||
{
|
||||
guint keyval;
|
||||
|
||||
gdk_event_get_keyval ((GdkEvent *)event, &keyval);
|
||||
|
||||
if (keyval == GDK_KEY_Escape)
|
||||
{
|
||||
gtk_entry_set_text (GTK_ENTRY (entry), text);
|
||||
@@ -1694,6 +1694,7 @@ do_font_features (GtkWidget *do_widget)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
GtkWidget *feature_list;
|
||||
GtkEventController *controller;
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/font_features/font-features.ui");
|
||||
|
||||
@@ -1703,7 +1704,6 @@ do_font_features (GtkWidget *do_widget)
|
||||
gtk_builder_add_callback_symbol (builder, "reset", reset_features);
|
||||
gtk_builder_add_callback_symbol (builder, "stop_edit", G_CALLBACK (stop_edit));
|
||||
gtk_builder_add_callback_symbol (builder, "toggle_edit", G_CALLBACK (toggle_edit));
|
||||
gtk_builder_add_callback_symbol (builder, "entry_key_press", G_CALLBACK (entry_key_press));
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
@@ -1718,6 +1718,11 @@ do_font_features (GtkWidget *do_widget)
|
||||
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (entry), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), entry);
|
||||
gtk_widget_add_controller (entry, controller);
|
||||
|
||||
add_check_group (feature_list, _("Kerning"), (const char *[]){ "kern", NULL });
|
||||
add_check_group (feature_list, _("Ligatures"), (const char *[]){ "liga",
|
||||
"dlig",
|
||||
|
@@ -68,8 +68,7 @@ plane_snapshot (GtkWidget *widget,
|
||||
height = gtk_widget_get_allocated_height (widget);
|
||||
|
||||
cr = gtk_snapshot_append_cairo (snapshot,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
"FontPlane");
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
cairo_rectangle (cr, 0, 0, width, height);
|
||||
@@ -208,23 +207,27 @@ plane_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
static void
|
||||
gtk_font_plane_init (GtkFontPlane *plane)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (plane), FALSE);
|
||||
gtk_widget_set_can_focus (GTK_WIDGET (plane), TRUE);
|
||||
|
||||
plane->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->drag_gesture, "drag-begin",
|
||||
gesture = gtk_gesture_drag_new ();
|
||||
g_signal_connect (gesture, "drag-begin",
|
||||
G_CALLBACK (plane_drag_gesture_begin), plane);
|
||||
g_signal_connect (plane->drag_gesture, "drag-update",
|
||||
g_signal_connect (gesture, "drag-update",
|
||||
G_CALLBACK (plane_drag_gesture_update), plane);
|
||||
g_signal_connect (plane->drag_gesture, "drag-end",
|
||||
g_signal_connect (gesture, "drag-end",
|
||||
G_CALLBACK (plane_drag_gesture_end), plane);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (plane->drag_gesture), 0);
|
||||
gtk_gesture_single_set_button (GTK_GESTURE_SINGLE (gesture), 0);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
plane->long_press_gesture = gtk_gesture_long_press_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->long_press_gesture, "pressed",
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (hold_action), plane);
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (plane->long_press_gesture),
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture),
|
||||
TRUE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -235,9 +238,6 @@ plane_finalize (GObject *object)
|
||||
g_clear_object (&plane->weight_adj);
|
||||
g_clear_object (&plane->width_adj);
|
||||
|
||||
g_clear_object (&plane->drag_gesture);
|
||||
g_clear_object (&plane->long_press_gesture);
|
||||
|
||||
G_OBJECT_CLASS (gtk_font_plane_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@@ -41,7 +41,6 @@ struct _GtkFontPlane
|
||||
GtkAdjustment *width_adj;
|
||||
|
||||
GtkGesture *drag_gesture;
|
||||
GtkGesture *long_press_gesture;
|
||||
};
|
||||
|
||||
struct _GtkFontPlaneClass
|
||||
|
222
demos/gtk-demo/fontrendering.c
Normal file
222
demos/gtk-demo/fontrendering.c
Normal file
@@ -0,0 +1,222 @@
|
||||
/* Pango/Font Rendering
|
||||
*
|
||||
* Demonstrates variations in font rendering.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *font_button = NULL;
|
||||
static GtkWidget *entry = NULL;
|
||||
static GtkWidget *image = NULL;
|
||||
static GtkWidget *hinting = NULL;
|
||||
static GtkWidget *hint_metrics = NULL;
|
||||
static GtkWidget *up_button = NULL;
|
||||
static GtkWidget *down_button = NULL;
|
||||
static GtkWidget *text_radio = NULL;
|
||||
|
||||
static PangoContext *context;
|
||||
|
||||
static int scale = 10;
|
||||
|
||||
static void
|
||||
on_destroy (gpointer data)
|
||||
{
|
||||
window = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
update_image (void)
|
||||
{
|
||||
const char *text;
|
||||
PangoFontDescription *desc;
|
||||
PangoLayout *layout;
|
||||
PangoRectangle ink, logical;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixbuf *pixbuf2;
|
||||
const char *hint;
|
||||
cairo_font_options_t *fopt;
|
||||
cairo_hint_style_t hintstyle;
|
||||
cairo_hint_metrics_t hintmetrics;
|
||||
|
||||
if (!context)
|
||||
context = gtk_widget_create_pango_context (image);
|
||||
|
||||
text = gtk_entry_get_text (GTK_ENTRY (entry));
|
||||
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font_button));
|
||||
|
||||
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;
|
||||
cairo_font_options_set_hint_style (fopt, hintstyle);
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (hint_metrics)))
|
||||
hintmetrics = CAIRO_HINT_METRICS_ON;
|
||||
else
|
||||
hintmetrics = CAIRO_HINT_METRICS_OFF;
|
||||
cairo_font_options_set_hint_metrics (fopt, hintmetrics);
|
||||
|
||||
pango_cairo_context_set_font_options (context, fopt);
|
||||
cairo_font_options_destroy (fopt);
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (text_radio)))
|
||||
{
|
||||
layout = pango_layout_new (context);
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
pango_layout_set_text (layout, text, -1);
|
||||
pango_layout_get_extents (layout, &ink, &logical);
|
||||
|
||||
pango_extents_to_pixels (&logical, NULL);
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
MAX(1,logical.width),
|
||||
MAX(1,logical.height));
|
||||
cr = cairo_create (surface);
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
|
||||
cairo_destroy (cr);
|
||||
g_object_unref (layout);
|
||||
}
|
||||
else
|
||||
{
|
||||
PangoLayoutIter *iter;
|
||||
PangoGlyphItem *run;
|
||||
PangoGlyphInfo *g;
|
||||
int i, j;
|
||||
|
||||
layout = pango_layout_new (context);
|
||||
pango_layout_set_font_description (layout, desc);
|
||||
pango_layout_set_text (layout, "aaaa", -1);
|
||||
pango_layout_get_extents (layout, &ink, &logical);
|
||||
pango_extents_to_pixels (&logical, NULL);
|
||||
|
||||
iter = pango_layout_get_iter (layout);
|
||||
run = pango_layout_iter_get_run (iter);
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
MAX(1, logical.width) * 3 / 2,
|
||||
MAX(1, logical.height) * 4);
|
||||
cr = cairo_create (surface);
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_set_source_rgb (cr, 0, 0, 0);
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
g = &(run->glyphs->glyphs[i]);
|
||||
g->geometry.width = PANGO_UNITS_ROUND (g->geometry.width * 3 / 2);
|
||||
}
|
||||
|
||||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
for (i = 0; i < 4; i++)
|
||||
{
|
||||
g = &(run->glyphs->glyphs[i]);
|
||||
g->geometry.x_offset = i * (PANGO_SCALE / 4);
|
||||
g->geometry.y_offset = j * (PANGO_SCALE / 4);
|
||||
}
|
||||
|
||||
cairo_move_to (cr, 0, j * logical.height);
|
||||
pango_cairo_show_layout (cr, layout);
|
||||
}
|
||||
|
||||
cairo_destroy (cr);
|
||||
pango_layout_iter_free (iter);
|
||||
g_object_unref (layout);
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface), cairo_image_surface_get_height (surface));
|
||||
pixbuf2 = gdk_pixbuf_scale_simple (pixbuf, gdk_pixbuf_get_width (pixbuf) * scale, gdk_pixbuf_get_height (pixbuf) * scale, GDK_INTERP_NEAREST);
|
||||
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
g_object_unref (pixbuf2);
|
||||
|
||||
cairo_surface_destroy (surface);
|
||||
pango_font_description_free (desc);
|
||||
}
|
||||
|
||||
static void
|
||||
update_buttons (void)
|
||||
{
|
||||
gtk_widget_set_sensitive (up_button, scale < 32);
|
||||
gtk_widget_set_sensitive (down_button, scale > 1);
|
||||
}
|
||||
|
||||
static void
|
||||
scale_up (void)
|
||||
{
|
||||
scale += 1;
|
||||
update_buttons ();
|
||||
update_image ();
|
||||
}
|
||||
|
||||
static void
|
||||
scale_down (void)
|
||||
{
|
||||
scale -= 1;
|
||||
update_buttons ();
|
||||
update_image ();
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_fontrendering (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GtkBuilder *builder;
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/fontrendering/fontrendering.ui");
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (on_destroy), NULL);
|
||||
g_object_set_data_full (G_OBJECT (window), "builder", builder, g_object_unref);
|
||||
font_button = GTK_WIDGET (gtk_builder_get_object (builder, "font_button"));
|
||||
up_button = GTK_WIDGET (gtk_builder_get_object (builder, "up_button"));
|
||||
down_button = GTK_WIDGET (gtk_builder_get_object (builder, "down_button"));
|
||||
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||
image = GTK_WIDGET (gtk_builder_get_object (builder, "image"));
|
||||
hinting = GTK_WIDGET (gtk_builder_get_object (builder, "hinting"));
|
||||
hint_metrics = GTK_WIDGET (gtk_builder_get_object (builder, "hint_metrics"));
|
||||
text_radio = GTK_WIDGET (gtk_builder_get_object (builder, "text_radio"));
|
||||
|
||||
g_signal_connect (up_button, "clicked", G_CALLBACK (scale_up), NULL);
|
||||
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
|
||||
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
|
||||
|
||||
update_image ();
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
{
|
||||
gtk_widget_destroy (window);
|
||||
}
|
||||
|
||||
return window;
|
||||
}
|
185
demos/gtk-demo/fontrendering.ui
Normal file
185
demos/gtk-demo/fontrendering.ui
Normal file
@@ -0,0 +1,185 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<!-- interface-requires gtk+ 3.94 -->
|
||||
<object class="GtkAdjustment" id="scale_adj">
|
||||
<property name="lower">0</property>
|
||||
<property name="value">0</property>
|
||||
<property name="upper">24</property>
|
||||
<property name="step-increment">1</property>
|
||||
<property name="page-increment">4</property>
|
||||
<property name="page-size">0</property>
|
||||
</object>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">300</property>
|
||||
<property name="title">Font rendering</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="margin-top">10</property>
|
||||
<property name="row-spacing">10</property>
|
||||
<property name="column-spacing">10</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="label">Text</property>
|
||||
<property name="xalign">1</property>
|
||||
<style><class name="dim-label"/></style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry">
|
||||
<property name="text">Fonts render</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin-start">10</property>
|
||||
<property name="label">Font</property>
|
||||
<property name="xalign">1</property>
|
||||
<style><class name="dim-label"/></style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font_button">
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Hinting</property>
|
||||
<property name="xalign">1</property>
|
||||
<style><class name="dim-label"/></style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="hinting">
|
||||
<property name="active">0</property>
|
||||
<property name="valign">center</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="slight">Slight</item>
|
||||
<item translatable="yes" id="medium">Medium</item>
|
||||
<item translatable="yes" id="full">Full</item>
|
||||
</items>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="hint_metrics">
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Hint Metrics</property>
|
||||
<style><class name="dim-label"/></style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="up_button">
|
||||
<property name="icon-name">list-add-symbolic</property>
|
||||
<style><class name="circular"/></style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="down_button">
|
||||
<property name="icon-name">list-remove-symbolic</property>
|
||||
<style><class name="circular"/></style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label"></property>
|
||||
<property name="hexpand">1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">6</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<style><class name="linked"/></style>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="text_radio">
|
||||
<property name="draw-indicator">0</property>
|
||||
<property name="label">Text</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="grid_radio">
|
||||
<property name="draw-indicator">0</property>
|
||||
<property name="label">Grid</property>
|
||||
<property name="group">text_radio</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="width">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">automatic</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<property name="propagate-natural-height">1</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="vexpand">1</property>
|
||||
<child>
|
||||
<object class="GtkPicture" id="image">
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="can-shrink">0</property>
|
||||
<property name="keep-aspect-ratio">1</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
<property name="width">7</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
@@ -157,16 +157,15 @@ do_gestures (GtkWidget *do_widget)
|
||||
NULL, NULL);
|
||||
|
||||
/* Swipe */
|
||||
gesture = gtk_gesture_swipe_new (drawing_area);
|
||||
gesture = gtk_gesture_swipe_new ();
|
||||
g_signal_connect (gesture, "swipe",
|
||||
G_CALLBACK (swipe_gesture_swept), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* 3fg swipe for touchpads */
|
||||
gesture = g_object_new (GTK_TYPE_GESTURE_SWIPE,
|
||||
"widget", drawing_area,
|
||||
"n-points", 3,
|
||||
NULL);
|
||||
g_signal_connect (gesture, "begin",
|
||||
@@ -175,33 +174,34 @@ do_gestures (GtkWidget *do_widget)
|
||||
G_CALLBACK (swipe_gesture_swept), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
|
||||
/* Long press */
|
||||
gesture = gtk_gesture_long_press_new (drawing_area);
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
g_signal_connect (gesture, "pressed",
|
||||
G_CALLBACK (long_press_gesture_pressed), drawing_area);
|
||||
g_signal_connect (gesture, "end",
|
||||
G_CALLBACK (long_press_gesture_end), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* Rotate */
|
||||
rotate = gesture = gtk_gesture_rotate_new (drawing_area);
|
||||
rotate = gesture = gtk_gesture_rotate_new ();
|
||||
g_signal_connect (gesture, "angle-changed",
|
||||
G_CALLBACK (rotation_angle_changed), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
/* Zoom */
|
||||
zoom = gesture = gtk_gesture_zoom_new (drawing_area);
|
||||
zoom = gesture = gtk_gesture_zoom_new ();
|
||||
g_signal_connect (gesture, "scale-changed",
|
||||
G_CALLBACK (zoom_scale_changed), drawing_area);
|
||||
gtk_event_controller_set_propagation_phase (GTK_EVENT_CONTROLLER (gesture),
|
||||
GTK_PHASE_BUBBLE);
|
||||
g_object_weak_ref (G_OBJECT (drawing_area), (GWeakNotify) g_object_unref, gesture);
|
||||
gtk_widget_add_controller (drawing_area, GTK_EVENT_CONTROLLER (gesture));
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -24,13 +24,18 @@ typedef struct _GtkFishbowlChild GtkFishbowlChild;
|
||||
|
||||
struct _GtkFishbowlPrivate
|
||||
{
|
||||
GtkFishCreationFunc creation_func;
|
||||
GList *children;
|
||||
guint count;
|
||||
|
||||
gint64 last_frame_time;
|
||||
gint64 update_delay;
|
||||
guint tick_id;
|
||||
|
||||
guint use_icons: 1;
|
||||
double framerate;
|
||||
int last_benchmark_change;
|
||||
|
||||
guint benchmark : 1;
|
||||
};
|
||||
|
||||
struct _GtkFishbowlChild
|
||||
@@ -45,18 +50,25 @@ struct _GtkFishbowlChild
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_ANIMATING,
|
||||
PROP_BENCHMARK,
|
||||
PROP_COUNT,
|
||||
PROP_FRAMERATE,
|
||||
PROP_UPDATE_DELAY,
|
||||
NUM_PROPERTIES
|
||||
};
|
||||
|
||||
static GParamSpec *props[NUM_PROPERTIES] = { NULL, };
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkFishbowl, gtk_fishbowl, GTK_TYPE_CONTAINER)
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkFishbowl, gtk_fishbowl, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
gtk_fishbowl_init (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (fishbowl), FALSE);
|
||||
|
||||
priv->update_delay = G_USEC_PER_SEC;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,15 +84,6 @@ gtk_fishbowl_new (void)
|
||||
return g_object_new (GTK_TYPE_FISHBOWL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_use_icons (GtkFishbowl *fishbowl,
|
||||
gboolean use_icons)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
priv->use_icons = use_icons;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_measure (GtkWidget *widget,
|
||||
GtkOrientation orientation,
|
||||
@@ -161,10 +164,9 @@ new_speed (void)
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_add (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
gtk_fishbowl_add (GtkFishbowl *fishbowl,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GtkFishbowlChild *child_info;
|
||||
|
||||
@@ -186,13 +188,12 @@ gtk_fishbowl_add (GtkContainer *container,
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_remove (GtkContainer *container,
|
||||
GtkWidget *widget)
|
||||
gtk_fishbowl_remove (GtkFishbowl *fishbowl,
|
||||
GtkWidget *widget)
|
||||
{
|
||||
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GtkFishbowlChild *child;
|
||||
GtkWidget *widget_container = GTK_WIDGET (container);
|
||||
GtkWidget *widget_bowl = GTK_WIDGET (fishbowl);
|
||||
GList *children;
|
||||
|
||||
for (children = priv->children; children; children = children->next)
|
||||
@@ -209,8 +210,8 @@ gtk_fishbowl_remove (GtkContainer *container,
|
||||
g_list_free (children);
|
||||
g_free (child);
|
||||
|
||||
if (was_visible && gtk_widget_get_visible (widget_container))
|
||||
gtk_widget_queue_resize (widget_container);
|
||||
if (was_visible && gtk_widget_get_visible (widget_bowl))
|
||||
gtk_widget_queue_resize (widget_bowl);
|
||||
|
||||
priv->count--;
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_COUNT]);
|
||||
@@ -219,26 +220,6 @@ gtk_fishbowl_remove (GtkContainer *container,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_forall (GtkContainer *container,
|
||||
GtkCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GtkFishbowl *fishbowl = GTK_FISHBOWL (container);
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GtkFishbowlChild *child;
|
||||
GList *children;
|
||||
|
||||
children = priv->children;
|
||||
while (children)
|
||||
{
|
||||
child = children->data;
|
||||
children = children->next;
|
||||
|
||||
(* callback) (child->widget, callback_data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_dispose (GObject *object)
|
||||
{
|
||||
@@ -264,10 +245,18 @@ gtk_fishbowl_set_property (GObject *object,
|
||||
gtk_fishbowl_set_animating (fishbowl, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_BENCHMARK:
|
||||
gtk_fishbowl_set_benchmark (fishbowl, g_value_get_boolean (value));
|
||||
break;
|
||||
|
||||
case PROP_COUNT:
|
||||
gtk_fishbowl_set_count (fishbowl, g_value_get_uint (value));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_DELAY:
|
||||
gtk_fishbowl_set_update_delay (fishbowl, g_value_get_int64 (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -288,10 +277,22 @@ gtk_fishbowl_get_property (GObject *object,
|
||||
g_value_set_boolean (value, gtk_fishbowl_get_animating (fishbowl));
|
||||
break;
|
||||
|
||||
case PROP_BENCHMARK:
|
||||
g_value_set_boolean (value, gtk_fishbowl_get_benchmark (fishbowl));
|
||||
break;
|
||||
|
||||
case PROP_COUNT:
|
||||
g_value_set_uint (value, gtk_fishbowl_get_count (fishbowl));
|
||||
break;
|
||||
|
||||
case PROP_FRAMERATE:
|
||||
g_value_set_double (value, gtk_fishbowl_get_framerate (fishbowl));
|
||||
break;
|
||||
|
||||
case PROP_UPDATE_DELAY:
|
||||
g_value_set_int64 (value, gtk_fishbowl_get_update_delay (fishbowl));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -303,7 +304,6 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GtkContainerClass *container_class = GTK_CONTAINER_CLASS (klass);
|
||||
|
||||
object_class->dispose = gtk_fishbowl_dispose;
|
||||
object_class->set_property = gtk_fishbowl_set_property;
|
||||
@@ -312,10 +312,6 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
|
||||
widget_class->measure = gtk_fishbowl_measure;
|
||||
widget_class->size_allocate = gtk_fishbowl_size_allocate;
|
||||
|
||||
container_class->add = gtk_fishbowl_add;
|
||||
container_class->remove = gtk_fishbowl_remove;
|
||||
container_class->forall = gtk_fishbowl_forall;
|
||||
|
||||
props[PROP_ANIMATING] =
|
||||
g_param_spec_boolean ("animating",
|
||||
"animating",
|
||||
@@ -323,13 +319,36 @@ gtk_fishbowl_class_init (GtkFishbowlClass *klass)
|
||||
FALSE,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
props[PROP_BENCHMARK] =
|
||||
g_param_spec_boolean ("benchmark",
|
||||
"Benchmark",
|
||||
"Adapt the count property to hit the maximum framerate",
|
||||
FALSE,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
props[PROP_COUNT] =
|
||||
g_param_spec_uint ("count",
|
||||
"Count",
|
||||
"Number of widgets",
|
||||
0, G_MAXUINT,
|
||||
0,
|
||||
G_PARAM_READABLE);
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
props[PROP_FRAMERATE] =
|
||||
g_param_spec_double ("framerate",
|
||||
"Framerate",
|
||||
"Framerate of this widget in frames per second",
|
||||
0, G_MAXDOUBLE,
|
||||
0,
|
||||
G_PARAM_READABLE);
|
||||
|
||||
props[PROP_UPDATE_DELAY] =
|
||||
g_param_spec_int64 ("update-delay",
|
||||
"Update delay",
|
||||
"Number of usecs between updates",
|
||||
0, G_MAXINT64,
|
||||
G_USEC_PER_SEC,
|
||||
G_PARAM_READWRITE);
|
||||
|
||||
g_object_class_install_properties (object_class, NUM_PROPERTIES, props);
|
||||
}
|
||||
@@ -342,96 +361,58 @@ gtk_fishbowl_get_count (GtkFishbowl *fishbowl)
|
||||
return priv->count;
|
||||
}
|
||||
|
||||
char **icon_names = NULL;
|
||||
gsize n_icon_names = 0;
|
||||
|
||||
static void
|
||||
init_icon_names (GtkIconTheme *theme)
|
||||
{
|
||||
GPtrArray *icons;
|
||||
GList *l, *icon_list;
|
||||
|
||||
if (icon_names)
|
||||
return;
|
||||
|
||||
icon_list = gtk_icon_theme_list_icons (theme, NULL);
|
||||
icons = g_ptr_array_new ();
|
||||
|
||||
for (l = icon_list; l; l = l->next)
|
||||
{
|
||||
if (g_str_has_suffix (l->data, "symbolic"))
|
||||
continue;
|
||||
|
||||
g_ptr_array_add (icons, g_strdup (l->data));
|
||||
}
|
||||
|
||||
n_icon_names = icons->len;
|
||||
g_ptr_array_add (icons, NULL); /* NULL-terminate the array */
|
||||
icon_names = (char **) g_ptr_array_free (icons, FALSE);
|
||||
|
||||
/* don't free strings, we assigned them to the array */
|
||||
g_list_free_full (icon_list, g_free);
|
||||
}
|
||||
|
||||
static const char *
|
||||
get_random_icon_name (GtkIconTheme *theme)
|
||||
{
|
||||
init_icon_names (theme);
|
||||
|
||||
return icon_names[g_random_int_range(0, n_icon_names)];
|
||||
}
|
||||
|
||||
static GType
|
||||
get_random_widget_type ()
|
||||
{
|
||||
GType types[] = {
|
||||
GTK_TYPE_SWITCH,
|
||||
GTK_TYPE_BUTTON,
|
||||
GTK_TYPE_ENTRY,
|
||||
GTK_TYPE_SPIN_BUTTON,
|
||||
GTK_TYPE_FONT_BUTTON,
|
||||
GTK_TYPE_SCROLLBAR,
|
||||
GTK_TYPE_SCALE,
|
||||
GTK_TYPE_LEVEL_BAR,
|
||||
GTK_TYPE_PROGRESS_BAR,
|
||||
GTK_TYPE_RADIO_BUTTON,
|
||||
GTK_TYPE_CHECK_BUTTON
|
||||
};
|
||||
return types[g_random_int_range (0, G_N_ELEMENTS (types))];
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_count (GtkFishbowl *fishbowl,
|
||||
guint count)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
if (priv->count == count)
|
||||
return;
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (fishbowl));
|
||||
|
||||
while (priv->count > count)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (fishbowl),
|
||||
((GtkFishbowlChild *) priv->children->data)->widget);
|
||||
gtk_fishbowl_remove (fishbowl, gtk_widget_get_first_child (GTK_WIDGET (fishbowl)));
|
||||
}
|
||||
|
||||
while (priv->count < count)
|
||||
{
|
||||
GtkWidget *new_widget;
|
||||
|
||||
if (priv->use_icons)
|
||||
{
|
||||
new_widget = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()));
|
||||
gtk_image_set_icon_size (GTK_IMAGE (new_widget), GTK_ICON_SIZE_LARGE);
|
||||
}
|
||||
else
|
||||
new_widget = g_object_new (get_random_widget_type (), NULL);
|
||||
new_widget = priv->creation_func ();
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (fishbowl), new_widget);
|
||||
gtk_fishbowl_add (fishbowl, new_widget);
|
||||
}
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (fishbowl));
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_fishbowl_get_benchmark (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
return priv->benchmark;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_benchmark (GtkFishbowl *fishbowl,
|
||||
gboolean benchmark)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
if (priv->benchmark == benchmark)
|
||||
return;
|
||||
|
||||
priv->benchmark = benchmark;
|
||||
if (!benchmark)
|
||||
priv->last_benchmark_change = 0;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_BENCHMARK]);
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_fishbowl_get_animating (GtkFishbowl *fishbowl)
|
||||
{
|
||||
@@ -440,6 +421,111 @@ gtk_fishbowl_get_animating (GtkFishbowl *fishbowl)
|
||||
return priv->tick_id != 0;
|
||||
}
|
||||
|
||||
static gint64
|
||||
guess_refresh_interval (GdkFrameClock *frame_clock)
|
||||
{
|
||||
gint64 interval;
|
||||
gint64 i;
|
||||
|
||||
interval = G_MAXINT64;
|
||||
|
||||
for (i = gdk_frame_clock_get_history_start (frame_clock);
|
||||
i < gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
i++)
|
||||
{
|
||||
GdkFrameTimings *t, *before;
|
||||
gint64 ts, before_ts;
|
||||
|
||||
t = gdk_frame_clock_get_timings (frame_clock, i);
|
||||
before = gdk_frame_clock_get_timings (frame_clock, i - 1);
|
||||
if (t == NULL || before == NULL)
|
||||
continue;
|
||||
|
||||
ts = gdk_frame_timings_get_frame_time (t);
|
||||
before_ts = gdk_frame_timings_get_frame_time (before);
|
||||
if (ts == 0 || before_ts == 0)
|
||||
continue;
|
||||
|
||||
interval = MIN (interval, ts - before_ts);
|
||||
}
|
||||
|
||||
if (interval == G_MAXINT64)
|
||||
return 0;
|
||||
|
||||
return interval;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_fishbowl_do_update (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
GdkFrameClock *frame_clock;
|
||||
GdkFrameTimings *start, *end;
|
||||
gint64 start_counter, end_counter;
|
||||
gint64 n_frames, expected_frames;
|
||||
gint64 start_timestamp, end_timestamp;
|
||||
gint64 interval;
|
||||
|
||||
frame_clock = gtk_widget_get_frame_clock (GTK_WIDGET (fishbowl));
|
||||
if (frame_clock == NULL)
|
||||
return;
|
||||
|
||||
start_counter = gdk_frame_clock_get_history_start (frame_clock);
|
||||
end_counter = gdk_frame_clock_get_frame_counter (frame_clock);
|
||||
start = gdk_frame_clock_get_timings (frame_clock, start_counter);
|
||||
for (end = gdk_frame_clock_get_timings (frame_clock, end_counter);
|
||||
end_counter > start_counter && end != NULL && !gdk_frame_timings_get_complete (end);
|
||||
end = gdk_frame_clock_get_timings (frame_clock, end_counter))
|
||||
end_counter--;
|
||||
if (end_counter - start_counter < 4)
|
||||
return;
|
||||
|
||||
start_timestamp = gdk_frame_timings_get_presentation_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_presentation_time (end);
|
||||
if (start_timestamp == 0 || end_timestamp == 0)
|
||||
{
|
||||
start_timestamp = gdk_frame_timings_get_frame_time (start);
|
||||
end_timestamp = gdk_frame_timings_get_frame_time (end);
|
||||
}
|
||||
|
||||
n_frames = end_counter - start_counter;
|
||||
priv->framerate = ((double) n_frames) * G_USEC_PER_SEC / (end_timestamp - start_timestamp);
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
||||
|
||||
if (!priv->benchmark)
|
||||
return;
|
||||
|
||||
interval = gdk_frame_timings_get_refresh_interval (end);
|
||||
if (interval == 0)
|
||||
{
|
||||
interval = guess_refresh_interval (frame_clock);
|
||||
if (interval == 0)
|
||||
return;
|
||||
}
|
||||
expected_frames = round ((double) (end_timestamp - start_timestamp) / interval);
|
||||
|
||||
if (n_frames >= expected_frames)
|
||||
{
|
||||
if (priv->last_benchmark_change > 0)
|
||||
priv->last_benchmark_change *= 2;
|
||||
else
|
||||
priv->last_benchmark_change = 1;
|
||||
}
|
||||
else if (n_frames + 1 < expected_frames)
|
||||
{
|
||||
if (priv->last_benchmark_change < 0)
|
||||
priv->last_benchmark_change--;
|
||||
else
|
||||
priv->last_benchmark_change = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
priv->last_benchmark_change = 0;
|
||||
}
|
||||
|
||||
gtk_fishbowl_set_count (fishbowl, MAX (1, (int) priv->count + priv->last_benchmark_change));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_fishbowl_tick (GtkWidget *widget,
|
||||
GdkFrameClock *frame_clock,
|
||||
@@ -450,9 +536,11 @@ gtk_fishbowl_tick (GtkWidget *widget,
|
||||
GtkFishbowlChild *child;
|
||||
GList *l;
|
||||
gint64 frame_time, elapsed;
|
||||
gboolean do_update;
|
||||
|
||||
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||
elapsed = frame_time - priv->last_frame_time;
|
||||
do_update = frame_time / priv->update_delay != priv->last_frame_time / priv->update_delay;
|
||||
priv->last_frame_time = frame_time;
|
||||
|
||||
/* last frame was 0, so we're just starting to animate */
|
||||
@@ -491,6 +579,9 @@ gtk_fishbowl_tick (GtkWidget *widget,
|
||||
|
||||
gtk_widget_queue_allocate (widget);
|
||||
|
||||
if (do_update)
|
||||
gtk_fishbowl_do_update (fishbowl);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
@@ -515,8 +606,57 @@ gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
|
||||
priv->last_frame_time = 0;
|
||||
gtk_widget_remove_tick_callback (GTK_WIDGET (fishbowl), priv->tick_id);
|
||||
priv->tick_id = 0;
|
||||
priv->framerate = 0;
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_FRAMERATE]);
|
||||
}
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_ANIMATING]);
|
||||
}
|
||||
|
||||
double
|
||||
gtk_fishbowl_get_framerate (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
return priv->framerate;
|
||||
}
|
||||
|
||||
gint64
|
||||
gtk_fishbowl_get_update_delay (GtkFishbowl *fishbowl)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
return priv->update_delay;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_update_delay (GtkFishbowl *fishbowl,
|
||||
gint64 update_delay)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
if (priv->update_delay == update_delay)
|
||||
return;
|
||||
|
||||
priv->update_delay = update_delay;
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (fishbowl), props[PROP_UPDATE_DELAY]);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_fishbowl_set_creation_func (GtkFishbowl *fishbowl,
|
||||
GtkFishCreationFunc creation_func)
|
||||
{
|
||||
GtkFishbowlPrivate *priv = gtk_fishbowl_get_instance_private (fishbowl);
|
||||
|
||||
g_object_freeze_notify (G_OBJECT (fishbowl));
|
||||
|
||||
gtk_fishbowl_set_count (fishbowl, 0);
|
||||
priv->last_benchmark_change = 0;
|
||||
|
||||
priv->creation_func = creation_func;
|
||||
|
||||
gtk_fishbowl_set_count (fishbowl, 1);
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (fishbowl));
|
||||
}
|
||||
|
@@ -32,29 +32,37 @@ G_BEGIN_DECLS
|
||||
typedef struct _GtkFishbowl GtkFishbowl;
|
||||
typedef struct _GtkFishbowlClass GtkFishbowlClass;
|
||||
|
||||
typedef GtkWidget * (* GtkFishCreationFunc) (void);
|
||||
|
||||
struct _GtkFishbowl
|
||||
{
|
||||
GtkContainer container;
|
||||
GtkWidget parent;
|
||||
};
|
||||
|
||||
struct _GtkFishbowlClass
|
||||
{
|
||||
GtkContainerClass parent_class;
|
||||
GtkWidgetClass parent_class;
|
||||
};
|
||||
|
||||
GType gtk_fishbowl_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget* gtk_fishbowl_new (void);
|
||||
|
||||
void gtk_fishbowl_set_use_icons (GtkFishbowl *fishbowl,
|
||||
gboolean use_icons);
|
||||
|
||||
guint gtk_fishbowl_get_count (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_count (GtkFishbowl *fishbowl,
|
||||
guint count);
|
||||
gboolean gtk_fishbowl_get_animating (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_animating (GtkFishbowl *fishbowl,
|
||||
gboolean animating);
|
||||
gboolean gtk_fishbowl_get_benchmark (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_benchmark (GtkFishbowl *fishbowl,
|
||||
gboolean animating);
|
||||
double gtk_fishbowl_get_framerate (GtkFishbowl *fishbowl);
|
||||
gint64 gtk_fishbowl_get_update_delay (GtkFishbowl *fishbowl);
|
||||
void gtk_fishbowl_set_update_delay (GtkFishbowl *fishbowl,
|
||||
gint64 update_delay);
|
||||
void gtk_fishbowl_set_creation_func (GtkFishbowl *fishbowl,
|
||||
GtkFishCreationFunc creation_func);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@@ -105,14 +105,14 @@ follow_if_link (GtkWidget *text_view,
|
||||
/* Links can be activated by pressing Enter.
|
||||
*/
|
||||
static gboolean
|
||||
key_press_event (GtkWidget *text_view,
|
||||
GdkEventKey *event)
|
||||
key_pressed (GtkEventController *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType modifiers,
|
||||
GtkWidget *text_view)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
GtkTextBuffer *buffer;
|
||||
guint keyval;
|
||||
|
||||
gdk_event_get_keyval ((GdkEvent *)event, &keyval);
|
||||
|
||||
switch (keyval)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ key_press_event (GtkWidget *text_view,
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
static void set_cursor_if_appropriate (GtkTextView *text_view,
|
||||
@@ -241,6 +241,7 @@ do_hypertext (GtkWidget *do_widget)
|
||||
GtkWidget *view;
|
||||
GtkWidget *sw;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkEventController *controller;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Hypertext");
|
||||
@@ -255,8 +256,9 @@ do_hypertext (GtkWidget *do_widget)
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 20);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 20);
|
||||
g_signal_connect (view, "key-press-event",
|
||||
G_CALLBACK (key_press_event), NULL);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), view);
|
||||
gtk_widget_add_controller (view, controller);
|
||||
g_signal_connect (view, "event",
|
||||
G_CALLBACK (event_cb), NULL);
|
||||
|
||||
|
@@ -1,15 +1,15 @@
|
||||
/* Images
|
||||
*
|
||||
* GtkImage is used to display an image; the image can be in a number of formats.
|
||||
* Typically, you load an image into a GdkPixbuf, then display the pixbuf.
|
||||
* GtkImage and GtkPicture are used to display an image; the image can be
|
||||
* in a number of formats.
|
||||
*
|
||||
* GtkImage is the widget used to display icons or images that should be
|
||||
* sized and styled like an icon, while GtkPicture is used for images
|
||||
* that should be displayed as-is.
|
||||
*
|
||||
* This demo code shows some of the more obscure cases, in the simple
|
||||
* case a call to gtk_image_new_from_file() is all you need.
|
||||
*
|
||||
* If you want to put image data in your program as a C variable,
|
||||
* use the make-inline-pixbuf program that comes with GTK+.
|
||||
* This way you won't need to depend on loading external files, your
|
||||
* application binary can be self-contained.
|
||||
* case a call to gtk_picture_new_for_file() or
|
||||
* gtk_image_new_from_icon_name() is all you need.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
@@ -27,9 +27,9 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
gpointer data)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *image;
|
||||
GtkWidget *picture;
|
||||
|
||||
image = GTK_WIDGET (data);
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
||||
|
||||
@@ -38,7 +38,7 @@ progressive_prepared_callback (GdkPixbufLoader *loader,
|
||||
*/
|
||||
gdk_pixbuf_fill (pixbuf, 0xaaaaaaff);
|
||||
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -49,21 +49,21 @@ progressive_updated_callback (GdkPixbufLoader *loader,
|
||||
gint height,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *image;
|
||||
GtkWidget *picture;
|
||||
GdkPixbuf *pixbuf;
|
||||
|
||||
image = GTK_WIDGET (data);
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
pixbuf = gdk_pixbuf_loader_get_pixbuf (loader);
|
||||
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
|
||||
gtk_picture_set_pixbuf (GTK_PICTURE (picture), pixbuf);
|
||||
}
|
||||
|
||||
static gint
|
||||
progressive_timeout (gpointer data)
|
||||
{
|
||||
GtkWidget *image;
|
||||
GtkWidget *picture;
|
||||
|
||||
image = GTK_WIDGET (data);
|
||||
picture = GTK_WIDGET (data);
|
||||
|
||||
/* This shows off fully-paranoid error handling, so looks scary.
|
||||
* You could factor out the error handling code into a nice separate
|
||||
@@ -241,10 +241,10 @@ progressive_timeout (gpointer data)
|
||||
pixbuf_loader = gdk_pixbuf_loader_new ();
|
||||
|
||||
g_signal_connect (pixbuf_loader, "area-prepared",
|
||||
G_CALLBACK (progressive_prepared_callback), image);
|
||||
G_CALLBACK (progressive_prepared_callback), picture);
|
||||
|
||||
g_signal_connect (pixbuf_loader, "area-updated",
|
||||
G_CALLBACK (progressive_updated_callback), image);
|
||||
G_CALLBACK (progressive_updated_callback), picture);
|
||||
}
|
||||
|
||||
/* leave timeout installed */
|
||||
@@ -252,7 +252,7 @@ progressive_timeout (gpointer data)
|
||||
}
|
||||
|
||||
static void
|
||||
start_progressive_loading (GtkWidget *image)
|
||||
start_progressive_loading (GtkWidget *picture)
|
||||
{
|
||||
/* This is obviously totally contrived (we slow down loading
|
||||
* on purpose to show how incremental loading works).
|
||||
@@ -261,7 +261,7 @@ start_progressive_loading (GtkWidget *image)
|
||||
* The timeout simply simulates a slow data source by inserting
|
||||
* pauses in the reading process.
|
||||
*/
|
||||
load_timeout = g_timeout_add (150, progressive_timeout, image);
|
||||
load_timeout = g_timeout_add (150, progressive_timeout, picture);
|
||||
g_source_set_name_by_id (load_timeout, "[gtk+] progressive_timeout");
|
||||
}
|
||||
|
||||
@@ -323,6 +323,7 @@ do_images (GtkWidget *do_widget)
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *base_vbox;
|
||||
GtkWidget *image;
|
||||
GtkWidget *picture;
|
||||
GtkWidget *label;
|
||||
GtkWidget *button;
|
||||
GdkPaintable *paintable;
|
||||
@@ -380,9 +381,9 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_widget_set_valign (frame, GTK_ALIGN_CENTER);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame);
|
||||
|
||||
image = gtk_image_new_from_resource ("/images/floppybuddy.gif");
|
||||
picture = gtk_picture_new_for_resource ("/images/floppybuddy.gif");
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (frame), image);
|
||||
gtk_container_add (GTK_CONTAINER (frame), picture);
|
||||
|
||||
/* Symbolic icon */
|
||||
|
||||
@@ -422,10 +423,10 @@ do_images (GtkWidget *do_widget)
|
||||
/* Create an empty image for now; the progressive loader
|
||||
* will create the pixbuf and fill it in.
|
||||
*/
|
||||
image = gtk_image_new_from_pixbuf (NULL);
|
||||
gtk_container_add (GTK_CONTAINER (frame), image);
|
||||
picture = gtk_picture_new ();
|
||||
gtk_container_add (GTK_CONTAINER (frame), picture);
|
||||
|
||||
start_progressive_loading (image);
|
||||
start_progressive_loading (picture);
|
||||
|
||||
/* Video */
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8);
|
||||
@@ -456,11 +457,10 @@ do_images (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), label);
|
||||
|
||||
paintable = gtk_widget_paintable_new (do_widget);
|
||||
image = gtk_image_new_from_paintable (paintable);
|
||||
gtk_image_set_can_shrink (GTK_IMAGE (image), TRUE);
|
||||
gtk_widget_set_size_request (image, 100, 100);
|
||||
gtk_widget_set_valign (image, GTK_ALIGN_START);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), image);
|
||||
picture = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_widget_set_size_request (picture, 100, 100);
|
||||
gtk_widget_set_valign (picture, GTK_ALIGN_START);
|
||||
gtk_container_add (GTK_CONTAINER (vbox), picture);
|
||||
|
||||
/* Sensitivity control */
|
||||
button = gtk_toggle_button_new_with_mnemonic ("_Insensitive");
|
||||
|
@@ -154,6 +154,7 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="extra_buttons_box">
|
||||
<property name="visible">0</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="reply-button">
|
||||
|
@@ -532,7 +532,106 @@ fontify (GtkTextBuffer *source_buffer)
|
||||
}
|
||||
}
|
||||
|
||||
static GtkWidget *create_text (GtkWidget **text_view, gboolean is_source);
|
||||
static GtkWidget *
|
||||
display_image (const char *resource)
|
||||
{
|
||||
GtkWidget *sw, *image;
|
||||
|
||||
image = gtk_image_new_from_resource (resource);
|
||||
gtk_widget_set_halign (image, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (image, GTK_ALIGN_CENTER);
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sw), image);
|
||||
|
||||
return sw;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_text (const char *resource)
|
||||
{
|
||||
GtkTextBuffer *buffer;
|
||||
GtkWidget *textview, *sw;
|
||||
GBytes *bytes;
|
||||
|
||||
bytes = g_resources_lookup_data (resource, 0, NULL);
|
||||
g_assert (bytes);
|
||||
|
||||
g_assert (g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL));
|
||||
|
||||
textview = gtk_text_view_new ();
|
||||
g_object_set (textview,
|
||||
"left-margin", 20,
|
||||
"right-margin", 20,
|
||||
"top-margin", 20,
|
||||
"bottom-margin", 20,
|
||||
NULL);
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (textview), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (textview), FALSE);
|
||||
/* Make it a bit nicer for text. */
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (textview), 2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (textview), 2);
|
||||
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_set_text (buffer, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
|
||||
if (g_str_has_suffix (resource, ".c"))
|
||||
fontify (buffer);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_SHADOW_NONE);
|
||||
gtk_container_add (GTK_CONTAINER (sw), textview);
|
||||
|
||||
return sw;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_video (const char *resource)
|
||||
{
|
||||
GtkWidget *video;
|
||||
|
||||
video = gtk_video_new_for_resource (resource);
|
||||
gtk_video_set_loop (GTK_VIDEO (video), TRUE);
|
||||
|
||||
return video;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
display_nothing (const char *resource)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
char *str;
|
||||
|
||||
str = g_strdup_printf ("The lazy GTK developers forgot to add a way to display the resource '%s'", resource);
|
||||
widget = gtk_label_new (str);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (widget), TRUE);
|
||||
|
||||
g_free (str);
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
static struct {
|
||||
const char *extension;
|
||||
GtkWidget * (* display_func) (const char *resource);
|
||||
} display_funcs[] = {
|
||||
{ ".gif", display_image },
|
||||
{ ".jpg", display_image },
|
||||
{ ".png", display_image },
|
||||
{ ".c", display_text },
|
||||
{ ".css", display_text },
|
||||
{ ".glsl", display_text },
|
||||
{ ".h", display_text },
|
||||
{ ".txt", display_text },
|
||||
{ ".ui", display_text },
|
||||
{ ".webm", display_video }
|
||||
};
|
||||
|
||||
static void
|
||||
add_data_tab (const gchar *demoname)
|
||||
@@ -540,7 +639,7 @@ add_data_tab (const gchar *demoname)
|
||||
gchar *resource_dir, *resource_name;
|
||||
gchar **resources;
|
||||
GtkWidget *widget, *label;
|
||||
guint i;
|
||||
guint i, j;
|
||||
|
||||
resource_dir = g_strconcat ("/", demoname, NULL);
|
||||
resources = g_resources_enumerate_children (resource_dir, 0, NULL);
|
||||
@@ -554,58 +653,22 @@ add_data_tab (const gchar *demoname)
|
||||
{
|
||||
resource_name = g_strconcat (resource_dir, "/", resources[i], NULL);
|
||||
|
||||
widget = gtk_image_new_from_resource (resource_name);
|
||||
if (gtk_image_get_paintable (GTK_IMAGE (widget)) == NULL)
|
||||
for (j = 0; j < G_N_ELEMENTS(display_funcs); j++)
|
||||
{
|
||||
GBytes *bytes;
|
||||
|
||||
/* So we've used the best API available to figure out it's
|
||||
* not an image. Let's try something else then.
|
||||
*/
|
||||
g_object_ref_sink (widget);
|
||||
g_object_unref (widget);
|
||||
|
||||
bytes = g_resources_lookup_data (resource_name, 0, NULL);
|
||||
g_assert (bytes);
|
||||
|
||||
if (g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL))
|
||||
{
|
||||
/* Looks like it parses as text. Dump it into a textview then! */
|
||||
GtkTextBuffer *buffer;
|
||||
GtkWidget *textview;
|
||||
|
||||
widget = create_text (&textview, FALSE);
|
||||
buffer = gtk_text_buffer_new (NULL);
|
||||
gtk_text_buffer_set_text (buffer, g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes));
|
||||
if (g_str_has_suffix (resource_name, ".c"))
|
||||
fontify (buffer);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (textview), buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_warning ("Don't know how to display resource '%s'", resource_name);
|
||||
widget = NULL;
|
||||
}
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
if (g_str_has_suffix (resource_name, display_funcs[j].extension))
|
||||
break;
|
||||
}
|
||||
|
||||
if (GTK_IS_IMAGE (widget))
|
||||
{
|
||||
GtkWidget *sw;
|
||||
|
||||
gtk_widget_set_halign (widget, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sw), widget);
|
||||
widget = sw;
|
||||
}
|
||||
if (j < G_N_ELEMENTS(display_funcs))
|
||||
widget = display_funcs[j].display_func (resource_name);
|
||||
else
|
||||
widget = display_nothing (resource_name);
|
||||
|
||||
label = gtk_label_new (resources[i]);
|
||||
gtk_widget_show (label);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
|
||||
gtk_container_child_set (GTK_CONTAINER (notebook),
|
||||
GTK_WIDGET (widget),
|
||||
widget,
|
||||
"tab-expand", TRUE,
|
||||
NULL);
|
||||
|
||||
@@ -825,49 +888,6 @@ selection_cb (GtkTreeSelection *selection,
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_text (GtkWidget **view,
|
||||
gboolean is_source)
|
||||
{
|
||||
GtkWidget *scrolled_window;
|
||||
GtkWidget *text_view;
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_SHADOW_NONE);
|
||||
|
||||
*view = text_view = gtk_text_view_new ();
|
||||
g_object_set (text_view,
|
||||
"left-margin", 20,
|
||||
"right-margin", 20,
|
||||
"top-margin", 20,
|
||||
"bottom-margin", 20,
|
||||
NULL);
|
||||
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (text_view), FALSE);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
|
||||
|
||||
if (is_source)
|
||||
{
|
||||
gtk_text_view_set_monospace (GTK_TEXT_VIEW (text_view), TRUE);
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_NONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make it a bit nicer for text. */
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_pixels_above_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||
gtk_text_view_set_pixels_below_lines (GTK_TEXT_VIEW (text_view), 2);
|
||||
}
|
||||
|
||||
return scrolled_window;
|
||||
}
|
||||
|
||||
static void
|
||||
populate_model (GtkTreeModel *model)
|
||||
{
|
||||
|
@@ -26,7 +26,7 @@ demos = files([
|
||||
'expander.c',
|
||||
'filtermodel.c',
|
||||
'fishbowl.c',
|
||||
'widgetbowl.c',
|
||||
'fontrendering.c',
|
||||
'foreigndrawing.c',
|
||||
'gestures.c',
|
||||
'glarea.c',
|
||||
@@ -45,6 +45,7 @@ demos = files([
|
||||
'modelbutton.c',
|
||||
'overlay.c',
|
||||
'overlay2.c',
|
||||
'paint.c',
|
||||
'paintable.c',
|
||||
'paintable_animated.c',
|
||||
'paintable_mediastream.c',
|
||||
@@ -61,6 +62,7 @@ demos = files([
|
||||
'shortcuts.c',
|
||||
'sidebar.c',
|
||||
'sizegroup.c',
|
||||
'sliding_puzzle.c',
|
||||
'spinbutton.c',
|
||||
'spinner.c',
|
||||
'stack.c',
|
||||
@@ -76,7 +78,7 @@ demos = files([
|
||||
|
||||
gtkdemo_deps = [ libgtk_dep, ]
|
||||
|
||||
extra_demo_sources = files(['main.c', 'gtkfishbowl.c', 'fontplane.c', 'gtkgears.c'])
|
||||
extra_demo_sources = files(['main.c', 'gtkfishbowl.c', 'fontplane.c', 'gtkgears.c', 'puzzlepiece.c'])
|
||||
|
||||
if harfbuzz_dep.found() and pangoft_dep.found()
|
||||
demos += files('font_features.c')
|
||||
|
@@ -56,6 +56,7 @@
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.color</property>
|
||||
<property name="action-target">'red'</property>
|
||||
<property name="text">Red</property>
|
||||
<property name="inverted">1</property>
|
||||
</object>
|
||||
@@ -63,6 +64,7 @@
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.color</property>
|
||||
<property name="action-target">'green'</property>
|
||||
<property name="text">Green</property>
|
||||
<property name="inverted">1</property>
|
||||
</object>
|
||||
@@ -70,6 +72,7 @@
|
||||
<child>
|
||||
<object class="GtkModelButton">
|
||||
<property name="action-name">win.color</property>
|
||||
<property name="action-target">'blue'</property>
|
||||
<property name="text">Blue</property>
|
||||
<property name="inverted">1</property>
|
||||
</object>
|
||||
|
283
demos/gtk-demo/paint.c
Normal file
283
demos/gtk-demo/paint.c
Normal file
@@ -0,0 +1,283 @@
|
||||
/* Paint
|
||||
*
|
||||
* Demonstrates practical handling of drawing tablets in a real world
|
||||
* usecase.
|
||||
*/
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget parent_instance;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
GdkRGBA draw_color;
|
||||
} DrawingArea;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkWidgetClass parent_class;
|
||||
} DrawingAreaClass;
|
||||
|
||||
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
|
||||
|
||||
static void
|
||||
drawing_area_ensure_surface (DrawingArea *area,
|
||||
gint width,
|
||||
gint height)
|
||||
{
|
||||
if (!area->surface ||
|
||||
cairo_image_surface_get_width (area->surface) != width ||
|
||||
cairo_image_surface_get_height (area->surface) != height)
|
||||
{
|
||||
cairo_surface_t *surface;
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
width, height);
|
||||
if (area->surface)
|
||||
{
|
||||
cairo_t *cr;
|
||||
|
||||
cr = cairo_create (surface);
|
||||
cairo_set_source_surface (cr, area->surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_surface_destroy (area->surface);
|
||||
cairo_destroy (area->cr);
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
area->surface = surface;
|
||||
area->cr = cairo_create (surface);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_size_allocate (GtkWidget *widget,
|
||||
const GtkAllocation *allocation,
|
||||
int baseline)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
|
||||
drawing_area_ensure_surface (area, allocation->width, allocation->height);
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->size_allocate (widget, allocation, baseline);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_map (GtkWidget *widget)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->map (widget);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
drawing_area_ensure_surface ((DrawingArea *) widget,
|
||||
allocation.width, allocation.height);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_unmap (GtkWidget *widget)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
|
||||
g_clear_pointer (&area->cr, cairo_destroy);
|
||||
g_clear_pointer (&area->surface, cairo_surface_destroy);
|
||||
|
||||
GTK_WIDGET_CLASS (drawing_area_parent_class)->unmap (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_snapshot (GtkWidget *widget,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
DrawingArea *area = (DrawingArea *) widget;
|
||||
GtkAllocation allocation;
|
||||
cairo_t *cr;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
cr = gtk_snapshot_append_cairo (snapshot,
|
||||
&GRAPHENE_RECT_INIT (
|
||||
0, 0,
|
||||
allocation.width,
|
||||
allocation.height
|
||||
));
|
||||
|
||||
cairo_set_source_rgb (cr, 1, 1, 1);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_set_source_surface (cr, area->surface, 0, 0);
|
||||
cairo_paint (cr);
|
||||
|
||||
cairo_set_source_rgb (cr, 0.6, 0.6, 0.6);
|
||||
cairo_rectangle (cr, 0, 0, allocation.width, allocation.height);
|
||||
cairo_stroke (cr);
|
||||
|
||||
cairo_destroy (cr);
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_class_init (DrawingAreaClass *klass)
|
||||
{
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
widget_class->size_allocate = drawing_area_size_allocate;
|
||||
widget_class->snapshot = drawing_area_snapshot;
|
||||
widget_class->map = drawing_area_map;
|
||||
widget_class->unmap = drawing_area_unmap;
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_apply_stroke (DrawingArea *area,
|
||||
GdkDeviceTool *tool,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
gdouble pressure)
|
||||
{
|
||||
if (gdk_device_tool_get_tool_type (tool) == GDK_DEVICE_TOOL_TYPE_ERASER)
|
||||
{
|
||||
cairo_set_line_width (area->cr, 10 * pressure);
|
||||
cairo_set_operator (area->cr, CAIRO_OPERATOR_DEST_OUT);
|
||||
}
|
||||
else
|
||||
{
|
||||
cairo_set_line_width (area->cr, 4 * pressure);
|
||||
cairo_set_operator (area->cr, CAIRO_OPERATOR_SATURATE);
|
||||
}
|
||||
|
||||
cairo_set_source_rgba (area->cr, area->draw_color.red,
|
||||
area->draw_color.green, area->draw_color.blue,
|
||||
area->draw_color.alpha * pressure);
|
||||
|
||||
//cairo_set_source_rgba (area->cr, 0, 0, 0, pressure);
|
||||
|
||||
cairo_line_to (area->cr, x, y);
|
||||
cairo_stroke (area->cr);
|
||||
cairo_move_to (area->cr, x, y);
|
||||
}
|
||||
|
||||
static void
|
||||
stylus_gesture_down (GtkGestureStylus *gesture,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
DrawingArea *area)
|
||||
{
|
||||
cairo_new_path (area->cr);
|
||||
}
|
||||
|
||||
static void
|
||||
stylus_gesture_motion (GtkGestureStylus *gesture,
|
||||
gdouble x,
|
||||
gdouble y,
|
||||
DrawingArea *area)
|
||||
{
|
||||
GdkTimeCoord *backlog;
|
||||
GdkDeviceTool *tool;
|
||||
gdouble pressure;
|
||||
guint n_items;
|
||||
|
||||
tool = gtk_gesture_stylus_get_device_tool (gesture);
|
||||
|
||||
if (gtk_gesture_stylus_get_backlog (gesture, &backlog, &n_items))
|
||||
{
|
||||
guint i;
|
||||
|
||||
for (i = 0; i < n_items; i++)
|
||||
{
|
||||
drawing_area_apply_stroke (area, tool,
|
||||
backlog[i].axes[GDK_AXIS_X],
|
||||
backlog[i].axes[GDK_AXIS_Y],
|
||||
backlog[i].axes[GDK_AXIS_PRESSURE]);
|
||||
}
|
||||
|
||||
g_free (backlog);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!gtk_gesture_stylus_get_axis (gesture, GDK_AXIS_PRESSURE, &pressure))
|
||||
pressure = 1;
|
||||
|
||||
drawing_area_apply_stroke (area, tool, x, y, pressure);
|
||||
}
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (area));
|
||||
}
|
||||
|
||||
static void
|
||||
drawing_area_init (DrawingArea *area)
|
||||
{
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (area), FALSE);
|
||||
|
||||
gesture = gtk_gesture_stylus_new ();
|
||||
g_signal_connect (gesture, "down",
|
||||
G_CALLBACK (stylus_gesture_down), area);
|
||||
g_signal_connect (gesture, "motion",
|
||||
G_CALLBACK (stylus_gesture_motion), area);
|
||||
gtk_widget_add_controller (GTK_WIDGET (area), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
area->draw_color = (GdkRGBA) { 0, 0, 0, 1 };
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
drawing_area_new (void)
|
||||
{
|
||||
return g_object_new (drawing_area_get_type (), NULL);
|
||||
}
|
||||
|
||||
void
|
||||
drawing_area_set_color (DrawingArea *area,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
area->draw_color = *color;
|
||||
}
|
||||
|
||||
static void
|
||||
color_button_color_set (GtkColorButton *button,
|
||||
DrawingArea *draw_area)
|
||||
{
|
||||
GdkRGBA color;
|
||||
|
||||
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
|
||||
drawing_area_set_color (draw_area, &color);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_paint (GtkWidget *toplevel)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *draw_area, *headerbar, *colorbutton;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
draw_area = drawing_area_new ();
|
||||
gtk_container_add (GTK_CONTAINER (window), draw_area);
|
||||
|
||||
headerbar = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar), "Paint");
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (headerbar), TRUE);
|
||||
|
||||
colorbutton = gtk_color_button_new ();
|
||||
g_signal_connect (colorbutton, "color-set",
|
||||
G_CALLBACK (color_button_color_set), draw_area);
|
||||
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (colorbutton),
|
||||
&(GdkRGBA) { 0, 0, 0, 1 });
|
||||
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
|
||||
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
@@ -56,15 +56,13 @@ gtk_nuclear_snapshot (GtkSnapshot *snapshot,
|
||||
|
||||
gtk_snapshot_append_color (snapshot,
|
||||
&(GdkRGBA) { 0.9, 0.75, 0.15, 1.0 },
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height),
|
||||
"Yellow background");
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
size = MIN (width, height);
|
||||
cr = gtk_snapshot_append_cairo (snapshot,
|
||||
&GRAPHENE_RECT_INIT ((width - size) / 2.0,
|
||||
(height - size) / 2.0,
|
||||
size, size),
|
||||
"Radioactive Icon");
|
||||
size, size));
|
||||
cairo_translate (cr, width / 2.0, height / 2.0);
|
||||
cairo_scale (cr, size, size);
|
||||
cairo_rotate (cr, rotation);
|
||||
|
@@ -77,7 +77,6 @@ entry_size_allocate_cb (GtkEntry *entry,
|
||||
static void
|
||||
entry_icon_press_cb (GtkEntry *entry,
|
||||
GtkEntryIconPosition icon_pos,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *popover = user_data;
|
||||
@@ -119,7 +118,7 @@ day_selected_cb (GtkCalendar *calendar,
|
||||
|
||||
gtk_widget_show (popover);
|
||||
|
||||
gdk_event_free (event);
|
||||
g_object_unref (event);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
220
demos/gtk-demo/puzzlepiece.c
Normal file
220
demos/gtk-demo/puzzlepiece.c
Normal file
@@ -0,0 +1,220 @@
|
||||
/* Paintable/A simple paintable
|
||||
*
|
||||
* GdkPaintable is an interface used by GTK for drawings of any sort
|
||||
* that do not require layouting or positioning.
|
||||
*
|
||||
* This demo code gives a simple example on how a paintable can
|
||||
* be created.
|
||||
*
|
||||
* Paintables can be used in many places inside GTK widgets, but the
|
||||
* most common usage is inside GtkImage and that's what we're going
|
||||
* to do here.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "puzzlepiece.h"
|
||||
|
||||
/* Declare the struct. */
|
||||
struct _GtkPuzzlePiece
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GdkPaintable *puzzle;
|
||||
guint x;
|
||||
guint y;
|
||||
guint width;
|
||||
guint height;
|
||||
};
|
||||
|
||||
struct _GtkPuzzlePieceClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
/* This is the function that draws the puzzle piece.
|
||||
* It just draws a rectangular cutout of the puzzle by clipping
|
||||
* away the rest.
|
||||
*/
|
||||
static void
|
||||
gtk_puzzle_piece_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkPuzzlePiece *self = GTK_PUZZLE_PIECE (paintable);
|
||||
|
||||
gtk_snapshot_push_clip (snapshot,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
gtk_snapshot_offset (snapshot,
|
||||
- width * self->x,
|
||||
- height * self->y);
|
||||
gdk_paintable_snapshot (self->puzzle,
|
||||
snapshot,
|
||||
width * self->width,
|
||||
height * self->height);
|
||||
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
|
||||
static GdkPaintableFlags
|
||||
gtk_puzzle_piece_get_flags (GdkPaintable *paintable)
|
||||
{
|
||||
GtkPuzzlePiece *self = GTK_PUZZLE_PIECE (paintable);
|
||||
|
||||
/* The flags are the same as the ones of the puzzle.
|
||||
* If the puzzle changes in some way, so do the pieces.
|
||||
*/
|
||||
return gdk_paintable_get_flags (self->puzzle);
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_puzzle_piece_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
GtkPuzzlePiece *self = GTK_PUZZLE_PIECE (paintable);
|
||||
|
||||
/* We can compute our width relative to the puzzle.
|
||||
* This logic even works for the case where the puzzle
|
||||
* has no width, because the 0 return value is unchanged.
|
||||
* Round up the value.
|
||||
*/
|
||||
return (gdk_paintable_get_intrinsic_width (self->puzzle) + self->width - 1) / self->width;
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_puzzle_piece_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
GtkPuzzlePiece *self = GTK_PUZZLE_PIECE (paintable);
|
||||
|
||||
/* Do the same thing we did for the width with the height.
|
||||
*/
|
||||
return (gdk_paintable_get_intrinsic_height (self->puzzle) + self->height - 1) / self->height;
|
||||
}
|
||||
|
||||
static double
|
||||
gtk_puzzle_piece_get_intrinsic_aspect_ratio (GdkPaintable *paintable)
|
||||
{
|
||||
GtkPuzzlePiece *self = GTK_PUZZLE_PIECE (paintable);
|
||||
|
||||
/* We can compute our aspect ratio relative to the puzzle.
|
||||
* This logic again works for the case where the puzzle
|
||||
* has no aspect ratio, because the 0 return value is unchanged.
|
||||
*/
|
||||
return gdk_paintable_get_intrinsic_aspect_ratio (self->puzzle) * self->height / self->width;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_puzzle_piece_paintable_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = gtk_puzzle_piece_snapshot;
|
||||
iface->get_flags = gtk_puzzle_piece_get_flags;
|
||||
iface->get_intrinsic_width = gtk_puzzle_piece_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = gtk_puzzle_piece_get_intrinsic_height;
|
||||
iface->get_intrinsic_aspect_ratio = gtk_puzzle_piece_get_intrinsic_aspect_ratio;
|
||||
}
|
||||
|
||||
/* When defining the GType, we need to implement the GdkPaintable interface */
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkPuzzlePiece, gtk_puzzle_piece, G_TYPE_OBJECT,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
gtk_puzzle_piece_paintable_init))
|
||||
|
||||
/* We need to declare a destructor to release our reference to the
|
||||
* puzzle paintable and disconnect our signal handlers.
|
||||
*/
|
||||
static void
|
||||
gtk_puzzle_piece_dispose (GObject *object)
|
||||
{
|
||||
GtkPuzzlePiece *self = GTK_PUZZLE_PIECE (object);
|
||||
|
||||
if (self->puzzle)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (self->puzzle, gdk_paintable_invalidate_contents, self);
|
||||
g_signal_handlers_disconnect_by_func (self->puzzle, gdk_paintable_invalidate_size, self);
|
||||
g_clear_object (&self->puzzle);
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (gtk_puzzle_piece_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
/* Here's the boilerplate for the GObject declaration.
|
||||
*/
|
||||
static void
|
||||
gtk_puzzle_piece_class_init (GtkPuzzlePieceClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->dispose = gtk_puzzle_piece_dispose;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_puzzle_piece_init (GtkPuzzlePiece *self)
|
||||
{
|
||||
}
|
||||
|
||||
/* And finally, we add a constructor.
|
||||
* It is declared in the header so that the other examples
|
||||
* can use it.
|
||||
*/
|
||||
GdkPaintable *
|
||||
gtk_puzzle_piece_new (GdkPaintable *puzzle,
|
||||
guint x,
|
||||
guint y,
|
||||
guint width,
|
||||
guint height)
|
||||
{
|
||||
GtkPuzzlePiece *self;
|
||||
|
||||
/* These are sanity checks, so that we get warnings if we accidentally
|
||||
* do anything stupid. */
|
||||
g_return_val_if_fail (GDK_IS_PAINTABLE (puzzle), NULL);
|
||||
g_return_val_if_fail (width > 0, NULL);
|
||||
g_return_val_if_fail (height > 0, NULL);
|
||||
g_return_val_if_fail (x < width, NULL);
|
||||
g_return_val_if_fail (y < height, NULL);
|
||||
|
||||
self = g_object_new (GTK_TYPE_PUZZLE_PIECE, NULL);
|
||||
|
||||
self->puzzle = g_object_ref (puzzle);
|
||||
g_signal_connect_swapped (puzzle, "invalidate-contents", G_CALLBACK (gdk_paintable_invalidate_contents), self);
|
||||
g_signal_connect_swapped (puzzle, "invalidate-size", G_CALLBACK (gdk_paintable_invalidate_size), self);
|
||||
self->x = x;
|
||||
self->y = y;
|
||||
self->width = width;
|
||||
self->height = height;
|
||||
|
||||
return GDK_PAINTABLE (self);
|
||||
}
|
||||
|
||||
/* Here are the accessors that we need to inspect the puzzle
|
||||
* pieces in other code.
|
||||
*/
|
||||
GdkPaintable *
|
||||
gtk_puzzle_piece_get_puzzle (GtkPuzzlePiece *self)
|
||||
{
|
||||
/* Add sanity checks here, too.
|
||||
* If you make a habit out of this, you can always rely
|
||||
* on your code having sanity checks, which makes it
|
||||
* way easier to debug.
|
||||
*/
|
||||
g_return_val_if_fail (GTK_IS_PUZZLE_PIECE (self), NULL);
|
||||
|
||||
return self->puzzle;
|
||||
}
|
||||
|
||||
guint
|
||||
gtk_puzzle_piece_get_x (GtkPuzzlePiece *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_PUZZLE_PIECE (self), 0);
|
||||
|
||||
return self->x;
|
||||
}
|
||||
|
||||
guint
|
||||
gtk_puzzle_piece_get_y (GtkPuzzlePiece *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_PUZZLE_PIECE (self), 0);
|
||||
|
||||
return self->y;
|
||||
}
|
||||
|
23
demos/gtk-demo/puzzlepiece.h
Normal file
23
demos/gtk-demo/puzzlepiece.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef __PUZZLE_PIECE_H__
|
||||
#define __PUZZLE_PIECE_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* First, add the boilerplate for the object itself.
|
||||
*/
|
||||
#define GTK_TYPE_PUZZLE_PIECE (gtk_puzzle_piece_get_type ())
|
||||
G_DECLARE_FINAL_TYPE (GtkPuzzlePiece, gtk_puzzle_piece, GTK, PUZZLE_PIECE, GObject)
|
||||
|
||||
/* Then, declare all constructors */
|
||||
GdkPaintable * gtk_puzzle_piece_new (GdkPaintable *puzzle,
|
||||
guint x,
|
||||
guint y,
|
||||
guint width,
|
||||
guint height);
|
||||
|
||||
/* Next, add the getters and setters for object properties */
|
||||
GdkPaintable * gtk_puzzle_piece_get_puzzle (GtkPuzzlePiece *self);
|
||||
guint gtk_puzzle_piece_get_x (GtkPuzzlePiece *self);
|
||||
guint gtk_puzzle_piece_get_y (GtkPuzzlePiece *self);
|
||||
|
||||
#endif /* __PUZZLE_PIECE_H__ */
|
@@ -151,11 +151,10 @@ create_search_menu (GtkWidget *entry)
|
||||
static void
|
||||
icon_press_cb (GtkEntry *entry,
|
||||
gint position,
|
||||
GdkEventButton *event,
|
||||
gpointer data)
|
||||
{
|
||||
if (position == GTK_ENTRY_ICON_PRIMARY)
|
||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), (GdkEvent *) event);
|
||||
gtk_menu_popup_at_pointer (GTK_MENU (menu), NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -27,11 +27,14 @@ changed_cb (GtkEditable *editable)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
window_key_press_event_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
GtkSearchBar *bar)
|
||||
window_event_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
GtkSearchBar *bar)
|
||||
{
|
||||
return gtk_search_bar_handle_event (bar, event);
|
||||
if (gdk_event_get_event_type (event) == GDK_KEY_PRESS)
|
||||
return gtk_search_bar_handle_event (bar, event);
|
||||
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -99,8 +102,7 @@ do_search_entry2 (GtkWidget *do_widget)
|
||||
gtk_box_pack_start (GTK_BOX (vbox), searchbar);
|
||||
|
||||
/* Hook the search bar to key presses */
|
||||
g_signal_connect (window, "key-press-event",
|
||||
G_CALLBACK (window_key_press_event_cb), searchbar);
|
||||
g_signal_connect (window, "event", G_CALLBACK (window_event_cb), searchbar);
|
||||
|
||||
/* Help */
|
||||
label = gtk_label_new ("Start Typing to search");
|
||||
|
486
demos/gtk-demo/sliding_puzzle.c
Normal file
486
demos/gtk-demo/sliding_puzzle.c
Normal file
@@ -0,0 +1,486 @@
|
||||
/* Sliding puzzle
|
||||
*
|
||||
* This demo demonstrates how to use gestures and paintables to create a
|
||||
* small sliding puzzle game.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* Include the header for the puzzle piece */
|
||||
#include "puzzlepiece.h"
|
||||
#include "paintable.h"
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkWidget *frame = NULL;
|
||||
static GtkWidget *choices = NULL;
|
||||
static GtkWidget *size_spin = NULL;
|
||||
static GdkPaintable *puzzle = NULL;
|
||||
|
||||
static gboolean solved = TRUE;
|
||||
static guint width = 3;
|
||||
static guint height = 3;
|
||||
static guint pos_x;
|
||||
static guint pos_y;
|
||||
|
||||
static gboolean
|
||||
move_puzzle (GtkWidget *grid,
|
||||
int dx,
|
||||
int dy)
|
||||
{
|
||||
GtkWidget *pos, *next;
|
||||
GdkPaintable *piece;
|
||||
guint next_x, next_y;
|
||||
|
||||
/* We don't move anything if the puzzle is solved */
|
||||
if (solved)
|
||||
return FALSE;
|
||||
|
||||
/* Return FALSE if we can't move to where the call
|
||||
* wants us to move.
|
||||
*/
|
||||
if ((dx < 0 && pos_x < -dx) ||
|
||||
dx + pos_x >= width ||
|
||||
(dy < 0 && pos_y < -dy) ||
|
||||
dy + pos_y >= height)
|
||||
return FALSE;
|
||||
|
||||
/* Compute the new position */
|
||||
next_x = pos_x + dx;
|
||||
next_y = pos_y + dy;
|
||||
|
||||
/* Get the current and next image */
|
||||
pos = gtk_grid_get_child_at (GTK_GRID (grid), pos_x, pos_y);
|
||||
next = gtk_grid_get_child_at (GTK_GRID (grid), next_x, next_y);
|
||||
|
||||
/* Move the displayed piece. */
|
||||
piece = gtk_picture_get_paintable (GTK_PICTURE (next));
|
||||
gtk_picture_set_paintable (GTK_PICTURE (pos), piece);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (next), NULL);
|
||||
|
||||
/* Update the current position */
|
||||
pos_x = next_x;
|
||||
pos_y = next_y;
|
||||
|
||||
/* Return TRUE because we successfully moved the piece */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
shuffle_puzzle (GtkWidget *grid)
|
||||
{
|
||||
guint i, n_steps;
|
||||
|
||||
/* Do this many random moves */
|
||||
n_steps = width * height * 50;
|
||||
|
||||
for (i = 0; i < n_steps; i++)
|
||||
{
|
||||
/* Get a random number for the direction to move in */
|
||||
switch (g_random_int_range (0, 4))
|
||||
{
|
||||
case 0:
|
||||
/* left */
|
||||
move_puzzle (grid, -1, 0);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
/* up */
|
||||
move_puzzle (grid, 0, -1);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
/* right */
|
||||
move_puzzle (grid, 1, 0);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
/* down */
|
||||
move_puzzle (grid, 0, 1);
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
check_solved (GtkWidget *grid)
|
||||
{
|
||||
GtkWidget *picture;
|
||||
GdkPaintable *piece;
|
||||
guint x, y;
|
||||
|
||||
/* Nothing to check if the puzzle is already solved */
|
||||
if (solved)
|
||||
return TRUE;
|
||||
|
||||
/* If the empty cell isn't in the bottom right,
|
||||
* the puzzle is obviously not solved */
|
||||
if (pos_x != width - 1 ||
|
||||
pos_y != height - 1)
|
||||
return FALSE;
|
||||
|
||||
/* Check that all pieces are in the right position */
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
picture = gtk_grid_get_child_at (GTK_GRID (grid), x, y);
|
||||
piece = gtk_picture_get_paintable (GTK_PICTURE (picture));
|
||||
|
||||
/* empty cell */
|
||||
if (piece == NULL)
|
||||
continue;
|
||||
|
||||
if (gtk_puzzle_piece_get_x (GTK_PUZZLE_PIECE (piece)) != x ||
|
||||
gtk_puzzle_piece_get_y (GTK_PUZZLE_PIECE (piece)) != y)
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
/* We solved the puzzle!
|
||||
*/
|
||||
solved = TRUE;
|
||||
|
||||
/* Fill the empty cell to show that we're done.
|
||||
*/
|
||||
picture = gtk_grid_get_child_at (GTK_GRID (grid), 0, 0);
|
||||
piece = gtk_picture_get_paintable (GTK_PICTURE (picture));
|
||||
|
||||
piece = gtk_puzzle_piece_new (gtk_puzzle_piece_get_puzzle (GTK_PUZZLE_PIECE (piece)),
|
||||
pos_x, pos_y,
|
||||
width, height);
|
||||
picture = gtk_grid_get_child_at (GTK_GRID (grid), pos_x, pos_y);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (picture), piece);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
puzzle_key_pressed (GtkEventControllerKey *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType state,
|
||||
GtkWidget *grid)
|
||||
{
|
||||
int dx, dy;
|
||||
|
||||
dx = 0;
|
||||
dy = 0;
|
||||
|
||||
switch (keyval)
|
||||
{
|
||||
case GDK_KEY_KP_Left:
|
||||
case GDK_KEY_Left:
|
||||
/* left */
|
||||
dx = -1;
|
||||
break;
|
||||
|
||||
case GDK_KEY_KP_Up:
|
||||
case GDK_KEY_Up:
|
||||
/* up */
|
||||
dy = -1;
|
||||
break;
|
||||
|
||||
case GDK_KEY_KP_Right:
|
||||
case GDK_KEY_Right:
|
||||
/* right */
|
||||
dx = 1;
|
||||
break;
|
||||
|
||||
case GDK_KEY_KP_Down:
|
||||
case GDK_KEY_Down:
|
||||
/* down */
|
||||
dy = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
/* We return FALSE here because we didn't handle the key that was pressed */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!move_puzzle (grid, dx, dy))
|
||||
{
|
||||
/* Make the error sound and then return TRUE.
|
||||
* We handled this key, even though we didn't
|
||||
* do anything to the puzzle.
|
||||
*/
|
||||
gtk_widget_error_bell (grid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
check_solved (grid);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
puzzle_button_pressed (GtkGestureMultiPress *gesture,
|
||||
int n_press,
|
||||
double x,
|
||||
double y,
|
||||
GtkWidget *grid)
|
||||
{
|
||||
GtkWidget *child;
|
||||
int l, t, i;
|
||||
int pos;
|
||||
|
||||
child = gtk_widget_pick (grid, x, y);
|
||||
|
||||
if (!child)
|
||||
{
|
||||
gtk_widget_error_bell (grid);
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_container_child_get (GTK_CONTAINER (grid), child,
|
||||
"left-attach", &l,
|
||||
"top-attach", &t,
|
||||
NULL);
|
||||
|
||||
if (l == pos_x && t == pos_y)
|
||||
{
|
||||
gtk_widget_error_bell (grid);
|
||||
}
|
||||
else if (l == pos_x)
|
||||
{
|
||||
pos = pos_y;
|
||||
for (i = t; i < pos; i++)
|
||||
{
|
||||
if (!move_puzzle (grid, 0, -1))
|
||||
gtk_widget_error_bell (grid);
|
||||
}
|
||||
for (i = pos; i < t; i++)
|
||||
{
|
||||
if (!move_puzzle (grid, 0, 1))
|
||||
gtk_widget_error_bell (grid);
|
||||
}
|
||||
}
|
||||
else if (t == pos_y)
|
||||
{
|
||||
pos = pos_x;
|
||||
for (i = l; i < pos; i++)
|
||||
{
|
||||
if (!move_puzzle (grid, -1, 0))
|
||||
gtk_widget_error_bell (grid);
|
||||
}
|
||||
for (i = pos; i < l; i++)
|
||||
{
|
||||
if (!move_puzzle (grid, 1, 0))
|
||||
gtk_widget_error_bell (grid);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_error_bell (grid);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
start_puzzle (GdkPaintable *puzzle)
|
||||
{
|
||||
GtkWidget *picture, *grid;
|
||||
GtkEventController *controller;
|
||||
guint x, y;
|
||||
|
||||
/* Remove the old grid (if there is one) */
|
||||
grid = gtk_bin_get_child (GTK_BIN (frame));
|
||||
if (grid)
|
||||
gtk_container_remove (GTK_CONTAINER (frame), grid);
|
||||
|
||||
/* Create a new grid */
|
||||
grid = gtk_grid_new ();
|
||||
gtk_widget_set_can_focus (grid, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (frame), grid);
|
||||
gtk_aspect_frame_set (GTK_ASPECT_FRAME (frame), 0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
|
||||
|
||||
/* Add a key event controller so people can use the arrow
|
||||
* keys to move the puzzle */
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (puzzle_key_pressed),
|
||||
grid);
|
||||
gtk_widget_add_controller (GTK_WIDGET (grid), controller);
|
||||
|
||||
controller = GTK_EVENT_CONTROLLER (gtk_gesture_multi_press_new ());
|
||||
g_signal_connect (controller, "pressed",
|
||||
G_CALLBACK (puzzle_button_pressed),
|
||||
grid);
|
||||
gtk_widget_add_controller (GTK_WIDGET (grid), controller);
|
||||
|
||||
/* Make sure the cells have equal size */
|
||||
gtk_grid_set_row_homogeneous (GTK_GRID (grid), TRUE);
|
||||
gtk_grid_set_column_homogeneous (GTK_GRID (grid), TRUE);
|
||||
|
||||
/* Reset the variables */
|
||||
solved = FALSE;
|
||||
pos_x = width - 1;
|
||||
pos_y = height - 1;
|
||||
|
||||
/* add a picture for every cell */
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
GdkPaintable *piece;
|
||||
|
||||
/* Don't paint anything for the lsiding part of the video */
|
||||
if (x == pos_x && y == pos_y)
|
||||
piece = NULL;
|
||||
else
|
||||
piece = gtk_puzzle_piece_new (puzzle,
|
||||
x, y,
|
||||
width, height);
|
||||
picture = gtk_picture_new_for_paintable (piece);
|
||||
gtk_picture_set_keep_aspect_ratio (GTK_PICTURE (picture), FALSE);
|
||||
gtk_grid_attach (GTK_GRID (grid),
|
||||
picture,
|
||||
x, y,
|
||||
1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
shuffle_puzzle (grid);
|
||||
}
|
||||
|
||||
static void
|
||||
reshuffle (void)
|
||||
{
|
||||
GtkWidget *grid;
|
||||
|
||||
grid = gtk_bin_get_child (GTK_BIN (frame));
|
||||
if (solved)
|
||||
start_puzzle (puzzle);
|
||||
else
|
||||
shuffle_puzzle (grid);
|
||||
gtk_widget_grab_focus (grid);
|
||||
}
|
||||
|
||||
static void
|
||||
reconfigure (void)
|
||||
{
|
||||
GtkWidget *popover;
|
||||
GtkWidget *grid;
|
||||
GtkWidget *child;
|
||||
GtkWidget *image;
|
||||
GList *selected;
|
||||
|
||||
width = height = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (size_spin));
|
||||
|
||||
selected = gtk_flow_box_get_selected_children (GTK_FLOW_BOX (choices));
|
||||
if (selected == NULL)
|
||||
child = gtk_widget_get_first_child (choices);
|
||||
else
|
||||
{
|
||||
child = selected->data;
|
||||
g_list_free (selected);
|
||||
}
|
||||
image = gtk_bin_get_child (GTK_BIN (child));
|
||||
puzzle = gtk_image_get_paintable (GTK_IMAGE (image));
|
||||
|
||||
start_puzzle (puzzle);
|
||||
popover = gtk_widget_get_ancestor (size_spin, GTK_TYPE_POPOVER);
|
||||
gtk_popover_popdown (GTK_POPOVER (popover));
|
||||
grid = gtk_bin_get_child (GTK_BIN (frame));
|
||||
gtk_widget_grab_focus (grid);
|
||||
}
|
||||
|
||||
static void
|
||||
add_choice (GtkWidget *choices,
|
||||
GdkPaintable *paintable)
|
||||
{
|
||||
GtkWidget *icon;
|
||||
|
||||
icon = gtk_image_new_from_paintable (paintable);
|
||||
gtk_image_set_icon_size (GTK_IMAGE (icon), GTK_ICON_SIZE_LARGE);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (choices), icon);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_sliding_puzzle (GtkWidget *do_widget)
|
||||
{
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *header;
|
||||
GtkWidget *restart;
|
||||
GtkWidget *tweak;
|
||||
GtkWidget *popover;
|
||||
GtkWidget *tweaks;
|
||||
GtkWidget *apply;
|
||||
GtkWidget *label;
|
||||
GtkWidget *sw;
|
||||
GtkMediaStream *media;
|
||||
|
||||
puzzle = GDK_PAINTABLE (gdk_texture_new_from_resource ("/sliding_puzzle/portland-rose.jpg"));
|
||||
|
||||
tweaks = gtk_grid_new ();
|
||||
gtk_grid_set_row_spacing (GTK_GRID (tweaks), 10);
|
||||
gtk_grid_set_column_spacing (GTK_GRID (tweaks), 10);
|
||||
g_object_set (tweaks, "margin", 10, NULL);
|
||||
|
||||
choices = gtk_flow_box_new ();
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (choices), GTK_STYLE_CLASS_VIEW);
|
||||
add_choice (choices, puzzle);
|
||||
add_choice (choices, gtk_nuclear_animation_new ());
|
||||
media = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
gtk_media_stream_set_loop (media, TRUE);
|
||||
gtk_media_stream_set_muted (media, TRUE);
|
||||
gtk_media_stream_play (media);
|
||||
add_choice (choices, GDK_PAINTABLE (media));
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (sw), choices);
|
||||
gtk_grid_attach (GTK_GRID (tweaks), sw, 0, 0, 2, 1);
|
||||
|
||||
label = gtk_label_new ("Size");
|
||||
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
||||
gtk_grid_attach (GTK_GRID (tweaks), label, 0, 1, 1, 1);
|
||||
size_spin = gtk_spin_button_new_with_range (2, 10, 1);
|
||||
gtk_spin_button_set_value (GTK_SPIN_BUTTON (size_spin), width);
|
||||
gtk_grid_attach (GTK_GRID (tweaks), size_spin, 1, 1, 1, 1);
|
||||
|
||||
apply = gtk_button_new_with_label ("Apply");
|
||||
gtk_widget_set_halign (apply, GTK_ALIGN_END);
|
||||
gtk_grid_attach (GTK_GRID (tweaks), apply, 1, 2, 1, 1);
|
||||
g_signal_connect (apply, "clicked", G_CALLBACK (reconfigure), NULL);
|
||||
|
||||
popover = gtk_popover_new (NULL);
|
||||
gtk_popover_set_modal (GTK_POPOVER (popover), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (popover), tweaks);
|
||||
|
||||
tweak = gtk_menu_button_new ();
|
||||
gtk_menu_button_set_popover (GTK_MENU_BUTTON (tweak), popover);
|
||||
gtk_button_set_icon_name (GTK_BUTTON (tweak), "emblem-system-symbolic");
|
||||
|
||||
restart = gtk_button_new_from_icon_name ("view-refresh-symbolic");
|
||||
g_signal_connect (restart, "clicked", G_CALLBACK (reshuffle), NULL);
|
||||
|
||||
header = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), restart);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), tweak);
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
gtk_window_set_title (GTK_WINDOW (window), "Sliding Puzzle");
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), header);
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
frame = gtk_aspect_frame_new (NULL, 0.5, 0.5, (float) gdk_paintable_get_intrinsic_aspect_ratio (puzzle), FALSE);
|
||||
gtk_container_add (GTK_CONTAINER (window), frame);
|
||||
|
||||
start_puzzle (puzzle);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
return window;
|
||||
}
|
@@ -33,14 +33,14 @@ hex_spin_output (GtkSpinButton *spin_button)
|
||||
{
|
||||
GtkAdjustment *adjustment;
|
||||
gchar *buf;
|
||||
gint val;
|
||||
gdouble val;
|
||||
|
||||
adjustment = gtk_spin_button_get_adjustment (spin_button);
|
||||
val = (gint) gtk_adjustment_get_value (adjustment);
|
||||
val = gtk_adjustment_get_value (adjustment);
|
||||
if (fabs (val) < 1e-5)
|
||||
buf = g_strdup ("0x00");
|
||||
else
|
||||
buf = g_strdup_printf ("0x%.2X", val);
|
||||
buf = g_strdup_printf ("0x%.2X", (gint) val);
|
||||
if (strcmp (buf, gtk_spin_button_get_text (spin_button)))
|
||||
gtk_spin_button_set_text (spin_button, buf);
|
||||
g_free (buf);
|
||||
|
@@ -1,412 +0,0 @@
|
||||
/* Benchmark/Widgetbowl
|
||||
*
|
||||
* This is a version of the Fishbowl demo that instead shows different
|
||||
* kinds of widgets, which is useful for comparing the rendering performance
|
||||
* of theme specifics.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gtkfishbowl.h"
|
||||
#include "gtkgears.h"
|
||||
|
||||
const char *const css =
|
||||
".blurred-button {"
|
||||
" box-shadow: 0px 0px 5px 10px rgba(0, 0, 0, 0.5);"
|
||||
"}"
|
||||
"";
|
||||
|
||||
GtkWidget *fishbowl;
|
||||
|
||||
static GtkWidget *
|
||||
create_button (void)
|
||||
{
|
||||
return gtk_button_new_with_label ("Button");
|
||||
}
|
||||
static GtkWidget *
|
||||
create_blurred_button (void)
|
||||
{
|
||||
GtkWidget *w = gtk_button_new ();
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (w), "blurred-button");
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_font_button (void)
|
||||
{
|
||||
return gtk_font_button_new ();
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_level_bar (void)
|
||||
{
|
||||
GtkWidget *w = gtk_level_bar_new_for_interval (0, 100);
|
||||
|
||||
gtk_level_bar_set_value (GTK_LEVEL_BAR (w), 50);
|
||||
|
||||
/* Force them to be a bit larger */
|
||||
gtk_widget_set_size_request (w, 200, -1);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_spinner (void)
|
||||
{
|
||||
GtkWidget *w = gtk_spinner_new ();
|
||||
|
||||
gtk_spinner_start (GTK_SPINNER (w));
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_spinbutton (void)
|
||||
{
|
||||
GtkWidget *w = gtk_spin_button_new_with_range (0, 10, 1);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_label (void)
|
||||
{
|
||||
GtkWidget *w = gtk_label_new ("pLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.");
|
||||
|
||||
gtk_label_set_line_wrap (GTK_LABEL (w), TRUE);
|
||||
gtk_label_set_max_width_chars (GTK_LABEL (w), 100);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_video (void)
|
||||
{
|
||||
GtkMediaStream *stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
|
||||
GtkWidget *w = gtk_image_new_from_paintable (GDK_PAINTABLE (stream));
|
||||
gtk_media_stream_set_loop (stream, TRUE);
|
||||
gtk_media_stream_play (stream);
|
||||
g_object_unref (stream);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_gears (void)
|
||||
{
|
||||
GtkWidget *w = gtk_gears_new ();
|
||||
|
||||
gtk_widget_set_size_request (w, 100, 100);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
static const struct {
|
||||
const char *name;
|
||||
GtkWidget * (*create_func) (void);
|
||||
} widget_types[] = {
|
||||
{ "Button", create_button },
|
||||
{ "Blurbutton", create_blurred_button },
|
||||
{ "Fontbutton", create_font_button },
|
||||
{ "Levelbar" , create_level_bar },
|
||||
{ "Label" , create_label },
|
||||
{ "Spinner" , create_spinner },
|
||||
{ "Spinbutton", create_spinbutton },
|
||||
{ "Video", create_video },
|
||||
{ "Gears", create_gears },
|
||||
};
|
||||
|
||||
static int selected_widget_type = -1;
|
||||
static const int N_WIDGET_TYPES = G_N_ELEMENTS (widget_types);
|
||||
|
||||
#define N_STATS 5
|
||||
|
||||
#define STATS_UPDATE_TIME G_USEC_PER_SEC
|
||||
|
||||
static void
|
||||
set_widget_type (GtkWidget *headerbar,
|
||||
int widget_type_index)
|
||||
{
|
||||
GList *children, *l;
|
||||
|
||||
if (widget_type_index == selected_widget_type)
|
||||
return;
|
||||
|
||||
/* Remove everything */
|
||||
children = gtk_container_get_children (GTK_CONTAINER (fishbowl));
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (fishbowl), (GtkWidget*)l->data);
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
|
||||
selected_widget_type = widget_type_index;
|
||||
|
||||
gtk_header_bar_set_title (GTK_HEADER_BAR (headerbar),
|
||||
widget_types[selected_widget_type].name);
|
||||
}
|
||||
|
||||
|
||||
typedef struct _Stats Stats;
|
||||
struct _Stats {
|
||||
gint64 last_stats;
|
||||
gint64 last_frame;
|
||||
gint last_suggestion;
|
||||
guint frame_counter_max;
|
||||
|
||||
guint stats_index;
|
||||
guint frame_counter[N_STATS];
|
||||
guint item_counter[N_STATS];
|
||||
};
|
||||
|
||||
static Stats *
|
||||
get_stats (GtkWidget *widget)
|
||||
{
|
||||
static GQuark stats_quark = 0;
|
||||
Stats *stats;
|
||||
|
||||
if (G_UNLIKELY (stats_quark == 0))
|
||||
stats_quark = g_quark_from_static_string ("stats");
|
||||
|
||||
stats = g_object_get_qdata (G_OBJECT (widget), stats_quark);
|
||||
if (stats == NULL)
|
||||
{
|
||||
stats = g_new0 (Stats, 1);
|
||||
g_object_set_qdata_full (G_OBJECT (widget), stats_quark, stats, g_free);
|
||||
stats->last_frame = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||
stats->last_stats = stats->last_frame;
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
static void
|
||||
do_stats (GtkWidget *widget,
|
||||
GtkWidget *info_label,
|
||||
gint *suggested_change)
|
||||
{
|
||||
Stats *stats;
|
||||
gint64 frame_time;
|
||||
|
||||
stats = get_stats (widget);
|
||||
frame_time = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||
|
||||
if (stats->last_stats + STATS_UPDATE_TIME < frame_time)
|
||||
{
|
||||
char *new_label;
|
||||
guint i, n_frames;
|
||||
|
||||
n_frames = 0;
|
||||
for (i = 0; i < N_STATS; i++)
|
||||
{
|
||||
n_frames += stats->frame_counter[i];
|
||||
}
|
||||
|
||||
new_label = g_strdup_printf ("widgets - %.1f fps",
|
||||
(double) G_USEC_PER_SEC * n_frames
|
||||
/ (N_STATS * STATS_UPDATE_TIME));
|
||||
gtk_label_set_label (GTK_LABEL (info_label), new_label);
|
||||
g_free (new_label);
|
||||
|
||||
if (stats->frame_counter[stats->stats_index] >= 19 * stats->frame_counter_max / 20)
|
||||
{
|
||||
if (stats->last_suggestion > 0)
|
||||
stats->last_suggestion *= 2;
|
||||
else
|
||||
stats->last_suggestion = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (stats->last_suggestion < 0)
|
||||
stats->last_suggestion--;
|
||||
else
|
||||
stats->last_suggestion = -1;
|
||||
stats->last_suggestion = MAX (stats->last_suggestion, 1 - (int) stats->item_counter[stats->stats_index]);
|
||||
}
|
||||
|
||||
stats->stats_index = (stats->stats_index + 1) % N_STATS;
|
||||
stats->frame_counter[stats->stats_index] = 0;
|
||||
stats->item_counter[stats->stats_index] = stats->item_counter[(stats->stats_index + N_STATS - 1) % N_STATS];
|
||||
stats->last_stats = frame_time;
|
||||
|
||||
if (suggested_change)
|
||||
*suggested_change = stats->last_suggestion;
|
||||
else
|
||||
stats->last_suggestion = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (suggested_change)
|
||||
*suggested_change = 0;
|
||||
}
|
||||
|
||||
stats->last_frame = frame_time;
|
||||
stats->frame_counter[stats->stats_index]++;
|
||||
stats->frame_counter_max = MAX (stats->frame_counter_max, stats->frame_counter[stats->stats_index]);
|
||||
}
|
||||
|
||||
static void
|
||||
stats_update (GtkWidget *widget)
|
||||
{
|
||||
Stats *stats;
|
||||
|
||||
stats = get_stats (widget);
|
||||
|
||||
stats->item_counter[stats->stats_index] = gtk_fishbowl_get_count (GTK_FISHBOWL (widget));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
move_fish (GtkWidget *bowl,
|
||||
GdkFrameClock *frame_clock,
|
||||
gpointer info_label)
|
||||
{
|
||||
gint suggested_change = 0;
|
||||
|
||||
do_stats (bowl, info_label, &suggested_change);
|
||||
|
||||
if (suggested_change > 0)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < suggested_change; i ++)
|
||||
{
|
||||
GtkWidget *new_widget = widget_types[selected_widget_type].create_func ();
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (fishbowl), new_widget);
|
||||
|
||||
}
|
||||
}
|
||||
else if (suggested_change < 0)
|
||||
{
|
||||
GList *children, *l;
|
||||
int n_removed = 0;
|
||||
|
||||
children = gtk_container_get_children (GTK_CONTAINER (fishbowl));
|
||||
for (l = children; l; l = l->next)
|
||||
{
|
||||
gtk_container_remove (GTK_CONTAINER (fishbowl), (GtkWidget *)l->data);
|
||||
n_removed ++;
|
||||
|
||||
if (n_removed >= (-suggested_change))
|
||||
break;
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
stats_update (bowl);
|
||||
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
||||
static void
|
||||
next_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *headerbar = user_data;
|
||||
int new_index;
|
||||
|
||||
if (selected_widget_type + 1 >= N_WIDGET_TYPES)
|
||||
new_index = 0;
|
||||
else
|
||||
new_index = selected_widget_type + 1;
|
||||
|
||||
set_widget_type (headerbar, new_index);
|
||||
}
|
||||
|
||||
static void
|
||||
prev_button_clicked_cb (GtkButton *source,
|
||||
gpointer user_data)
|
||||
{
|
||||
GtkWidget *headerbar = user_data;
|
||||
int new_index;
|
||||
|
||||
if (selected_widget_type - 1 < 0)
|
||||
new_index = N_WIDGET_TYPES - 1;
|
||||
else
|
||||
new_index = selected_widget_type - 1;
|
||||
|
||||
set_widget_type (headerbar, new_index);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
do_widgetbowl (GtkWidget *do_widget)
|
||||
{
|
||||
static GtkWidget *window = NULL;
|
||||
static GtkCssProvider *provider = NULL;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
if (provider == NULL)
|
||||
{
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (provider, css, -1);
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
|
||||
}
|
||||
|
||||
if (!window)
|
||||
{
|
||||
GtkWidget *info_label;
|
||||
GtkWidget *count_label;
|
||||
GtkWidget *titlebar;
|
||||
GtkWidget *title_box;
|
||||
GtkWidget *left_box;
|
||||
GtkWidget *next_button;
|
||||
GtkWidget *prev_button;
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
titlebar = gtk_header_bar_new ();
|
||||
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (titlebar), TRUE);
|
||||
info_label = gtk_label_new ("widget - 00.0 fps");
|
||||
count_label = gtk_label_new ("0");
|
||||
fishbowl = gtk_fishbowl_new ();
|
||||
title_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
|
||||
prev_button = gtk_button_new_from_icon_name ("pan-start-symbolic");
|
||||
next_button = gtk_button_new_from_icon_name ("pan-end-symbolic");
|
||||
left_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
|
||||
g_object_bind_property (fishbowl, "count", count_label, "label", 0);
|
||||
g_signal_connect (next_button, "clicked", G_CALLBACK (next_button_clicked_cb), titlebar);
|
||||
g_signal_connect (prev_button, "clicked", G_CALLBACK (prev_button_clicked_cb), titlebar);
|
||||
|
||||
gtk_fishbowl_set_animating (GTK_FISHBOWL (fishbowl), TRUE);
|
||||
|
||||
gtk_widget_set_hexpand (title_box, TRUE);
|
||||
gtk_widget_set_halign (title_box, GTK_ALIGN_END);
|
||||
|
||||
gtk_window_set_titlebar (GTK_WINDOW (window), titlebar);
|
||||
gtk_container_add (GTK_CONTAINER (title_box), count_label);
|
||||
gtk_container_add (GTK_CONTAINER (title_box), info_label);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (titlebar), title_box);
|
||||
gtk_container_add (GTK_CONTAINER (window), fishbowl);
|
||||
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (left_box), "linked");
|
||||
gtk_container_add (GTK_CONTAINER (left_box), prev_button);
|
||||
gtk_container_add (GTK_CONTAINER (left_box), next_button);
|
||||
gtk_header_bar_pack_start (GTK_HEADER_BAR (titlebar), left_box);
|
||||
|
||||
gtk_window_set_display (GTK_WINDOW (window),
|
||||
gtk_widget_get_display (do_widget));
|
||||
g_signal_connect (window, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed), &window);
|
||||
|
||||
gtk_widget_realize (window);
|
||||
gtk_widget_add_tick_callback (fishbowl, move_fish, info_label, NULL);
|
||||
|
||||
set_widget_type (titlebar, 0);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
gtk_widget_show (window);
|
||||
else
|
||||
gtk_widget_destroy (window);
|
||||
|
||||
|
||||
return window;
|
||||
}
|
@@ -32,7 +32,7 @@ media-view-subtitles=The icon used to show subtitles in a media player
|
||||
|
||||
[network]
|
||||
Name=Network
|
||||
Description=Icons related to network status");
|
||||
Description=Icons related to network status
|
||||
|
||||
network-transmit-receive=The icon used data is being both transmitted and received simultaneously, while the computing device is connected to a network
|
||||
network-transmit=The icon used when data is being transmitted, while the computing device is connected to a network
|
||||
|
@@ -286,13 +286,16 @@ populate (IconBrowserWindow *win)
|
||||
}
|
||||
|
||||
static gboolean
|
||||
key_press_event_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
key_event_cb (GtkEventController *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType state,
|
||||
gpointer data)
|
||||
{
|
||||
IconBrowserWindow *win = data;
|
||||
|
||||
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (win->searchbar), event);
|
||||
return gtk_search_bar_handle_event (GTK_SEARCH_BAR (win->searchbar),
|
||||
gtk_get_current_event ());
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -373,10 +376,9 @@ search_mode_toggled (GObject *searchbar, GParamSpec *pspec, IconBrowserWindow *w
|
||||
|
||||
static void
|
||||
get_image_data (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
GtkWidget *image;
|
||||
@@ -396,10 +398,9 @@ get_image_data (GtkWidget *widget,
|
||||
|
||||
static void
|
||||
get_scalable_image_data (GtkWidget *widget,
|
||||
GdkDragContext *context,
|
||||
GdkDrag *drag,
|
||||
GtkSelectionData *selection,
|
||||
guint target_info,
|
||||
guint time,
|
||||
gpointer data)
|
||||
{
|
||||
gchar *uris[2];
|
||||
@@ -451,6 +452,7 @@ static void
|
||||
icon_browser_window_init (IconBrowserWindow *win)
|
||||
{
|
||||
GdkContentFormats *list;
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
|
||||
@@ -480,12 +482,30 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
|
||||
symbolic_toggled (GTK_TOGGLE_BUTTON (win->symbolic_radio), win);
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_event_cb), win);
|
||||
gtk_widget_add_controller (GTK_WIDGET (win), controller);
|
||||
|
||||
populate (win);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_finalize (GObject *object)
|
||||
{
|
||||
IconBrowserWindow *win = ICON_BROWSER_WINDOW (object);
|
||||
|
||||
g_hash_table_unref (win->contexts);
|
||||
|
||||
G_OBJECT_CLASS (icon_browser_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
icon_browser_window_class_init (IconBrowserWindowClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
|
||||
object_class->finalize = icon_browser_window_finalize;
|
||||
|
||||
g_type_ensure (ICON_STORE_TYPE);
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
@@ -516,7 +536,6 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), item_activated);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), selected_context_changed);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), symbolic_toggled);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), key_press_event_cb);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), copy_to_clipboard);
|
||||
}
|
||||
|
||||
|
@@ -9,7 +9,6 @@
|
||||
<property name="title" translatable="yes">Icon Browser</property>
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
<signal name="key-press-event" handler="key_press_event_cb"/>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="title" translatable="yes">Icon Browser</property>
|
||||
|
@@ -353,7 +353,6 @@ update_pulse_time (GtkAdjustment *adjustment, GtkWidget *widget)
|
||||
static void
|
||||
on_entry_icon_release (GtkEntry *entry,
|
||||
GtkEntryIconPosition icon_pos,
|
||||
GdkEvent *event,
|
||||
gpointer user_data)
|
||||
{
|
||||
if (icon_pos != GTK_ENTRY_ICON_SECONDARY)
|
||||
@@ -967,8 +966,8 @@ background_loaded_cb (GObject *source,
|
||||
return;
|
||||
}
|
||||
|
||||
child = gtk_image_new_from_pixbuf (pixbuf);
|
||||
gtk_widget_show (child);
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
gtk_widget_set_size_request (child, 110, 70);
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (bd->flowbox), child, -1);
|
||||
child = gtk_widget_get_parent (child);
|
||||
g_object_set_data_full (G_OBJECT (child), "filename", bd->filename, g_free);
|
||||
@@ -996,8 +995,7 @@ populate_flowbox (GtkWidget *flowbox)
|
||||
|
||||
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 110, 70);
|
||||
gdk_pixbuf_fill (pixbuf, 0xffffffff);
|
||||
child = gtk_image_new_from_pixbuf (pixbuf);
|
||||
gtk_widget_show (child);
|
||||
child = gtk_picture_new_for_pixbuf (pixbuf);
|
||||
gtk_flow_box_insert (GTK_FLOW_BOX (flowbox), child, -1);
|
||||
|
||||
location = "/usr/share/backgrounds/gnome";
|
||||
@@ -1082,7 +1080,7 @@ set_accel (GtkApplication *app, GtkWidget *widget)
|
||||
typedef struct
|
||||
{
|
||||
GtkTextView tv;
|
||||
cairo_surface_t *surface;
|
||||
GdkTexture *texture;
|
||||
} MyTextView;
|
||||
|
||||
typedef GtkTextViewClass MyTextViewClass;
|
||||
@@ -1095,18 +1093,23 @@ my_text_view_init (MyTextView *tv)
|
||||
}
|
||||
|
||||
static void
|
||||
my_tv_draw_layer (GtkTextView *widget,
|
||||
GtkTextViewLayer layer,
|
||||
cairo_t *cr)
|
||||
my_tv_snapshot_layer (GtkTextView *widget,
|
||||
GtkTextViewLayer layer,
|
||||
GtkSnapshot *snapshot)
|
||||
{
|
||||
MyTextView *tv = (MyTextView *)widget;
|
||||
|
||||
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->surface)
|
||||
if (layer == GTK_TEXT_VIEW_LAYER_BELOW_TEXT && tv->texture)
|
||||
{
|
||||
cairo_save (cr);
|
||||
cairo_set_source_surface (cr, tv->surface, 0.0, 0.0);
|
||||
cairo_paint_with_alpha (cr, 0.333);
|
||||
cairo_restore (cr);
|
||||
gtk_snapshot_push_opacity (snapshot, 0.333);
|
||||
gtk_snapshot_append_texture (snapshot,
|
||||
tv->texture,
|
||||
&GRAPHENE_RECT_INIT(
|
||||
0, 0,
|
||||
gdk_texture_get_width (tv->texture),
|
||||
gdk_texture_get_height (tv->texture)
|
||||
));
|
||||
gtk_snapshot_pop (snapshot);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1115,8 +1118,7 @@ my_tv_finalize (GObject *object)
|
||||
{
|
||||
MyTextView *tv = (MyTextView *)object;
|
||||
|
||||
if (tv->surface)
|
||||
cairo_surface_destroy (tv->surface);
|
||||
g_clear_object (&tv->texture);
|
||||
|
||||
G_OBJECT_CLASS (my_text_view_parent_class)->finalize (object);
|
||||
}
|
||||
@@ -1128,24 +1130,24 @@ my_text_view_class_init (MyTextViewClass *class)
|
||||
GObjectClass *o_class = G_OBJECT_CLASS (class);
|
||||
|
||||
o_class->finalize = my_tv_finalize;
|
||||
tv_class->draw_layer = my_tv_draw_layer;
|
||||
tv_class->snapshot_layer = my_tv_snapshot_layer;
|
||||
}
|
||||
|
||||
static void
|
||||
my_text_view_set_background (MyTextView *tv, const gchar *filename)
|
||||
{
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
GFile *file;
|
||||
|
||||
if (tv->surface)
|
||||
cairo_surface_destroy (tv->surface);
|
||||
|
||||
tv->surface = NULL;
|
||||
g_clear_object (&tv->texture);
|
||||
|
||||
if (filename == NULL)
|
||||
return;
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (filename, &error);
|
||||
file = g_file_new_for_path (filename);
|
||||
tv->texture = gdk_texture_new_from_file (file, &error);
|
||||
g_object_unref (file);
|
||||
|
||||
if (error)
|
||||
{
|
||||
g_warning ("%s", error->message);
|
||||
@@ -1153,10 +1155,6 @@ my_text_view_set_background (MyTextView *tv, const gchar *filename)
|
||||
return;
|
||||
}
|
||||
|
||||
tv->surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
gtk_widget_queue_draw (GTK_WIDGET (tv));
|
||||
}
|
||||
|
||||
@@ -1655,7 +1653,6 @@ activate (GApplication *app)
|
||||
gint i;
|
||||
GPermission *permission;
|
||||
GAction *action;
|
||||
GtkGesture *gesture;
|
||||
|
||||
g_type_ensure (my_text_view_get_type ());
|
||||
|
||||
@@ -1680,6 +1677,7 @@ activate (GApplication *app)
|
||||
gtk_builder_add_callback_symbol (builder, "reset_icon_size", (GCallback)reset_icon_size);
|
||||
gtk_builder_add_callback_symbol (builder, "scale_format_value", (GCallback)scale_format_value);
|
||||
gtk_builder_add_callback_symbol (builder, "scale_format_value_blank", (GCallback)scale_format_value_blank);
|
||||
gtk_builder_add_callback_symbol (builder, "osd_frame_pressed", (GCallback)osd_frame_pressed);
|
||||
|
||||
gtk_builder_connect_signals (builder, NULL);
|
||||
|
||||
@@ -1897,10 +1895,6 @@ activate (GApplication *app)
|
||||
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget);
|
||||
g_signal_connect (adj, "value-changed", G_CALLBACK (adjustment3_value_changed), widget2);
|
||||
|
||||
widget = (GtkWidget *)gtk_builder_get_object (builder, "osd_frame");
|
||||
gesture = gtk_gesture_multi_press_new (widget);
|
||||
g_signal_connect (gesture, "pressed", G_CALLBACK (osd_frame_pressed), widget);
|
||||
|
||||
gtk_widget_show (GTK_WIDGET (window));
|
||||
|
||||
g_object_unref (builder);
|
||||
|
@@ -468,7 +468,8 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<child>
|
||||
<object class="GtkEntry" id="entry1">
|
||||
<property name="can-focus">1</property>
|
||||
<property name="invisible-char">•</property>
|
||||
<property name="enable-emoji-completion">1</property>
|
||||
<property name="invisible_char">•</property>
|
||||
<property name="placeholder-text" translatable="yes">Click icon to change mode</property>
|
||||
<property name="secondary-icon-name">view-refresh-symbolic</property>
|
||||
<property name="secondary-icon-tooltip-text">Change mode</property>
|
||||
@@ -2225,6 +2226,9 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="tooltip-text" translatable="yes">Save the current document</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSeparatorToolItem"/>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<property name="label" translatable="yes">Search</property>
|
||||
@@ -3100,6 +3104,11 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGestureMultiPress">
|
||||
<signal name="pressed" handler="osd_frame_pressed" object="osd_frame" swapped="no"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -3574,4 +3583,4 @@ bad things might happen.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
</interface>
|
68
docs/CODE-OWNERS
Normal file
68
docs/CODE-OWNERS
Normal file
@@ -0,0 +1,68 @@
|
||||
# These are the people responsible for subsystems in GTK; if you're opening
|
||||
# a merge request for files listed here, please add the following people to
|
||||
# the list of reviewers
|
||||
|
||||
# The syntax of this file is similar to the GitHub CODEOWNERS file:
|
||||
# https://help.github.com/articles/about-codeowners/
|
||||
# Which, in turn, is similar to the .gitignore and .gitattributes files:
|
||||
#
|
||||
# - comments start with `#`
|
||||
# - the first column contains paths and globs
|
||||
# - the second column contains GitLab user names or email addresses,
|
||||
# separated by spaces
|
||||
#
|
||||
# If you want to be responsible for code reviews in specific sections of
|
||||
# the GTK code base, add yourself here.
|
||||
|
||||
# Maintainer
|
||||
* @matthiasc
|
||||
|
||||
# Build system
|
||||
meson.build @ebassi @nirbheek
|
||||
*.py @ebassi
|
||||
|
||||
# CSS
|
||||
gtk/gtkcss*.[ch] @otte @baedert
|
||||
gtk/gtkstyle*.[ch] @otte @baedert
|
||||
|
||||
# Gestures
|
||||
gtk/gtkeventcontroller* @carlosg
|
||||
gtk/gtkgesture*.[ch] @carlosg
|
||||
|
||||
# GtkFileChooser
|
||||
gtk/gtkfilechooser* @federico
|
||||
gtk/gtkfilesystem* @federico
|
||||
gtk/gtkfilefilter* @federico
|
||||
|
||||
# GtkFontChooser
|
||||
gtk/gtkfontchooser* @matthiasc
|
||||
|
||||
# Input methods
|
||||
gtk/gtkimcontext* @carlosg
|
||||
|
||||
# Media
|
||||
gtk/gtkmedia* @otte
|
||||
|
||||
# GSK
|
||||
gsk @otte @baedert @ebassi
|
||||
|
||||
# GL rendering
|
||||
gsk/gl @baedert @ebassi
|
||||
|
||||
# Vulkan rendering
|
||||
gsk/vulkan
|
||||
|
||||
# Documentation
|
||||
docs/ @ebassi @dboles
|
||||
|
||||
# Wayland
|
||||
gdk/wayland @jadahl
|
||||
|
||||
# X11
|
||||
gdk/x11 @ofourdan @matthiasc
|
||||
|
||||
# Themes
|
||||
gtk/themes @lapoc @jimmac
|
||||
|
||||
# Inspector
|
||||
gtk/inspector @otte @matthiasc
|
@@ -71,10 +71,7 @@ straightforward manner.
|
||||
void gdk_drag_status (GdkDragContext *context,
|
||||
GdkDragAction action,
|
||||
guint32 time);
|
||||
void gdk_drop_reply (GdkDragContext *context,
|
||||
gboolean ok,
|
||||
guint32 time);
|
||||
void gdk_drop_finish (GdkDragContext *context,
|
||||
void gdk_drag_finish (GdkDragContext *context,
|
||||
gboolean success,
|
||||
guint32 time);
|
||||
GdkAtom gdk_drag_get_selection (GdkDragContext *context);
|
||||
|
@@ -27,12 +27,12 @@
|
||||
<xi:include href="xml/gdkmonitor.xml" />
|
||||
<xi:include href="xml/regions.xml" />
|
||||
<xi:include href="xml/textures.xml" />
|
||||
<xi:include href="xml/gdkpaintable.xml" />
|
||||
<xi:include href="xml/rgba_colors.xml" />
|
||||
<xi:include href="xml/cursors.xml" />
|
||||
<xi:include href="xml/windows.xml" />
|
||||
<xi:include href="xml/gdksurface.xml" />
|
||||
<xi:include href="xml/gdkframeclock.xml" />
|
||||
<xi:include href="xml/gdkframetimings.xml" />
|
||||
<xi:include href="xml/gdkdrawingcontext.xml" />
|
||||
<xi:include href="xml/gdkdrawcontext.xml" />
|
||||
<xi:include href="xml/gdkglcontext.xml" />
|
||||
<xi:include href="xml/gdkvulkancontext.xml" />
|
||||
|
@@ -167,11 +167,10 @@ gdk_rgba_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Windows</TITLE>
|
||||
<FILE>windows</FILE>
|
||||
<TITLE>GdkSurface</TITLE>
|
||||
<FILE>gdksurface</FILE>
|
||||
GdkSurface
|
||||
GdkSurfaceType
|
||||
GdkSurfaceClass
|
||||
GdkSurfaceHints
|
||||
GdkGeometry
|
||||
GdkGravity
|
||||
@@ -194,7 +193,6 @@ gdk_surface_is_visible
|
||||
gdk_surface_is_viewable
|
||||
gdk_surface_is_input_only
|
||||
gdk_surface_get_state
|
||||
gdk_surface_withdraw
|
||||
gdk_surface_iconify
|
||||
gdk_surface_deiconify
|
||||
gdk_surface_stick
|
||||
@@ -233,10 +231,6 @@ gdk_surface_set_opaque_region
|
||||
gdk_surface_create_gl_context
|
||||
gdk_surface_create_vulkan_context
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_surface_begin_draw_frame
|
||||
gdk_surface_end_draw_frame
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_surface_invalidate_rect
|
||||
gdk_surface_invalidate_region
|
||||
@@ -286,8 +280,6 @@ gdk_surface_get_toplevel
|
||||
gdk_surface_get_children
|
||||
gdk_surface_get_children_with_user_data
|
||||
gdk_surface_peek_children
|
||||
gdk_surface_get_events
|
||||
gdk_surface_set_events
|
||||
gdk_surface_set_icon_name
|
||||
gdk_surface_set_transient_for
|
||||
gdk_surface_set_role
|
||||
@@ -305,8 +297,6 @@ gdk_surface_get_support_multidevice
|
||||
gdk_surface_set_support_multidevice
|
||||
gdk_surface_get_device_cursor
|
||||
gdk_surface_set_device_cursor
|
||||
gdk_surface_get_device_events
|
||||
gdk_surface_set_device_events
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_surface_coords_from_parent
|
||||
@@ -408,15 +398,12 @@ gdk_pango_layout_line_get_clip_region
|
||||
<TITLE>Cairo Interaction</TITLE>
|
||||
<FILE>cairo_interaction</FILE>
|
||||
gdk_surface_create_similar_surface
|
||||
gdk_surface_create_similar_image_surface
|
||||
gdk_cairo_get_clip_rectangle
|
||||
gdk_cairo_get_drawing_context
|
||||
gdk_cairo_set_source_rgba
|
||||
gdk_cairo_set_source_pixbuf
|
||||
gdk_cairo_rectangle
|
||||
gdk_cairo_region
|
||||
gdk_cairo_region_create_from_surface
|
||||
gdk_cairo_surface_create_from_pixbuf
|
||||
gdk_cairo_draw_from_gl
|
||||
gdk_cairo_surface_upload_to_gl
|
||||
</SECTION>
|
||||
@@ -634,7 +621,6 @@ GDK_BUTTON_SECONDARY
|
||||
<SUBSECTION>
|
||||
gdk_event_new
|
||||
gdk_event_copy
|
||||
gdk_event_free
|
||||
gdk_event_get_axes
|
||||
gdk_event_get_button
|
||||
gdk_event_get_click_count
|
||||
@@ -660,9 +646,9 @@ gdk_event_get_scancode
|
||||
gdk_event_get_pointer_emulated
|
||||
gdk_event_get_crossing_detail
|
||||
gdk_event_get_crossing_mode
|
||||
gdk_event_get_drag_context
|
||||
gdk_event_get_drop
|
||||
gdk_event_get_focus_in
|
||||
gdk_event_get_grab_window
|
||||
gdk_event_get_grab_surface
|
||||
gdk_event_get_motion_history
|
||||
gdk_event_get_key_group
|
||||
gdk_event_get_key_is_modifier
|
||||
@@ -705,20 +691,27 @@ gdk_event_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Paintable</TITLE>
|
||||
<FILE>paintable</FILE>
|
||||
<FILE>gdkpaintable</FILE>
|
||||
<TITLE>GdkPaintable</TITLE>
|
||||
GdkPaintable
|
||||
gdk_paintable_snapshot
|
||||
GdkPaintableFlags
|
||||
gdk_paintable_get_current_image
|
||||
gdk_paintable_snapshot
|
||||
gdk_paintable_get_flags
|
||||
gdk_paintable_get_intrinsic_width
|
||||
gdk_paintable_get_intrinsic_height
|
||||
gdk_paintable_get_intrinsic_aspect_ratio
|
||||
gdk_paintable_compute_concrete_size
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_paintable_invalidate_contents
|
||||
gdk_paintable_invalidate_size
|
||||
gdk_paintable_new_empty
|
||||
<SECTION>
|
||||
|
||||
<SUBSECTION Private>
|
||||
GDK_TYPE_PAINTABLE
|
||||
gdk_paintable_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<TITLE>Textures</TITLE>
|
||||
@@ -730,8 +723,9 @@ gdk_texture_new_from_file
|
||||
gdk_texture_get_width
|
||||
gdk_texture_get_height
|
||||
gdk_texture_download
|
||||
gdk_texture_save_to_png
|
||||
GdkMemoryFormat
|
||||
GDK_MEMORY_FORMAT_DEFAULT
|
||||
GDK_MEMORY_DEFAULT
|
||||
gdk_memory_texture_new
|
||||
gdk_gl_texture_new
|
||||
gdk_gl_texture_release
|
||||
@@ -779,40 +773,60 @@ gdk_cursor_get_type
|
||||
<SECTION>
|
||||
<TITLE>Drag and Drop</TITLE>
|
||||
<FILE>dnd</FILE>
|
||||
GdkDragContext
|
||||
GdkDrag
|
||||
GdkDrop
|
||||
GdkDragCancelReason
|
||||
gdk_drop_reply
|
||||
gdk_drag_drop_done
|
||||
gdk_drag_begin
|
||||
gdk_drop_finish
|
||||
GdkDragAction
|
||||
gdk_drag_status
|
||||
gdk_drag_drop_succeeded
|
||||
GDK_ACTION_ALL
|
||||
|
||||
gdk_drag_context_get_display
|
||||
gdk_drag_context_get_actions
|
||||
gdk_drag_context_get_suggested_action
|
||||
gdk_drag_context_get_selected_action
|
||||
gdk_drag_context_get_formats
|
||||
gdk_drag_context_get_device
|
||||
gdk_drag_context_get_source_surface
|
||||
gdk_drag_context_get_dest_surface
|
||||
gdk_drag_context_get_drag_surface
|
||||
gdk_drag_context_set_hotspot
|
||||
gdk_drag_get_display
|
||||
gdk_drag_get_actions
|
||||
gdk_drag_get_suggested_action
|
||||
gdk_drag_get_selected_action
|
||||
gdk_drag_get_formats
|
||||
gdk_drag_get_device
|
||||
gdk_drag_get_drag_surface
|
||||
gdk_drag_set_hotspot
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_drag_action_is_unique
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_drop_get_display
|
||||
gdk_drop_get_device
|
||||
gdk_drop_get_surface
|
||||
gdk_drop_get_formats
|
||||
gdk_drop_get_actions
|
||||
gdk_drop_get_drag
|
||||
gdk_drop_status
|
||||
gdk_drop_finish
|
||||
gdk_drop_read_async
|
||||
gdk_drop_read_finish
|
||||
gdk_drop_read_value_async
|
||||
gdk_drop_read_value_finish
|
||||
gdk_drop_read_text_async
|
||||
gdk_drop_read_text_finish
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_DRAG_CONTEXT
|
||||
GDK_TYPE_DRAG_CONTEXT
|
||||
GDK_IS_DRAG_CONTEXT
|
||||
GDK_DRAG_CONTEXT_CLASS
|
||||
GDK_DRAG_CONTEXT_GET_CLASS
|
||||
GDK_IS_DRAG_CONTEXT_CLASS
|
||||
GDK_DRAG
|
||||
GDK_TYPE_DRAG
|
||||
GDK_IS_DRAG
|
||||
GDK_DRAG_CLASS
|
||||
GDK_DRAG_GET_CLASS
|
||||
GDK_IS_DRAG_CLASS
|
||||
GDK_TYPE_DRAG_ACTION
|
||||
GDK_TYPE_DRAG_PROTOCOL
|
||||
GDK_TYPE_DROP
|
||||
GDK_DROP
|
||||
GDK_IS_DROP
|
||||
|
||||
<SUBSECTION Private>
|
||||
GdkDragContextClass
|
||||
gdk_drag_context_get_type
|
||||
GdkDragClass
|
||||
gdk_drag_get_type
|
||||
GdkDropClass
|
||||
gdk_drop_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -855,7 +869,6 @@ gdk_x11_screen_lookup_visual
|
||||
gdk_x11_screen_supports_net_wm_hint
|
||||
gdk_x11_screen_get_number_of_desktops
|
||||
gdk_x11_screen_get_current_desktop
|
||||
gdk_x11_surface_foreign_new_for_display
|
||||
gdk_x11_surface_lookup_for_display
|
||||
gdk_x11_surface_get_xid
|
||||
gdk_x11_surface_set_theme_variant
|
||||
@@ -1108,6 +1121,10 @@ gdk_frame_timings_get_type
|
||||
GdkDrawContext
|
||||
gdk_draw_context_get_display
|
||||
gdk_draw_context_get_surface
|
||||
gdk_draw_context_begin_frame
|
||||
gdk_draw_context_end_frame
|
||||
gdk_draw_context_is_in_frame
|
||||
gdk_draw_context_get_frame_region
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_DRAW_CONTEXT
|
||||
@@ -1141,7 +1158,6 @@ gdk_gl_context_is_legacy
|
||||
<SUBSECTION>
|
||||
GdkGLError
|
||||
gdk_gl_context_realize
|
||||
gdk_gl_context_get_damage
|
||||
gdk_gl_context_make_current
|
||||
gdk_gl_context_get_current
|
||||
gdk_gl_context_clear_current
|
||||
@@ -1186,23 +1202,12 @@ GDK_IS_MONITOR
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gdkdrawingcontext</FILE>
|
||||
GdkDrawingContext
|
||||
gdk_drawing_context_get_surface
|
||||
gdk_drawing_context_get_clip
|
||||
gdk_drawing_context_get_cairo_context
|
||||
gdk_drawing_context_is_valid
|
||||
gdk_drawing_context_get_paint_context
|
||||
<FILE>gdkcairocontext</FILE>
|
||||
GdkCairoContext
|
||||
gdk_cairo_context_cairo_create
|
||||
|
||||
<SUBSECTION Standard>
|
||||
gdk_drawing_context_get_type
|
||||
GdkDrawingContextClass
|
||||
GDK_TYPE_DRAWING_CONTEXT
|
||||
GDK_DRAWING_CONTEXT_CLASS
|
||||
GDK_DRAWING_CONTEXT_GET_CLASS
|
||||
GDK_IS_DRAWING_CONTEXT_CLASS
|
||||
GDK_DRAWING_CONTEXT
|
||||
GDK_IS_DRAWING_CONTEXT
|
||||
gdk_cairo_context_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
@@ -1260,6 +1265,7 @@ gdk_clipboard_get_type
|
||||
<SECTION>
|
||||
<FILE>gdkcontentprovider</FILE>
|
||||
GdkContentProvider
|
||||
GdkContentProviderClass
|
||||
gdk_content_provider_new_for_value
|
||||
gdk_content_provider_new_for_bytes
|
||||
gdk_content_provider_ref_formats
|
||||
@@ -1275,7 +1281,6 @@ GDK_CONTENT_PROVIDER_CLASS
|
||||
GDK_CONTENT_PROVIDER_GET_CLASS
|
||||
GDK_IS_CONTENT_PROVIDER
|
||||
GDK_IS_CONTENT_PROVIDER_CLASS
|
||||
GdkContentProviderClass
|
||||
gdk_content_provider_get_type
|
||||
</SECTION>
|
||||
|
||||
@@ -1334,3 +1339,4 @@ GDK_CONTENT_DESERIALIZER
|
||||
GDK_IS_CONTENT_DESERIALIZER
|
||||
gdk_content_deserializer_get_type
|
||||
</SECTION>
|
||||
|
||||
|
@@ -1,18 +1,28 @@
|
||||
gdk_app_launch_context_get_type
|
||||
gdk_clipboard_get_type
|
||||
gdk_content_deserializer_get_type
|
||||
gdk_content_formats_get_type
|
||||
gdk_content_provider_get_type
|
||||
gdk_content_serializer_get_type
|
||||
gdk_cursor_get_type
|
||||
gdk_device_get_type
|
||||
gdk_device_pad_get_type
|
||||
gdk_device_tool_get_type
|
||||
gdk_display_get_type
|
||||
gdk_display_manager_get_type
|
||||
gdk_drag_context_get_type
|
||||
gdk_drawing_context_get_type
|
||||
gdk_drag_get_type
|
||||
gdk_drop_get_type
|
||||
gdk_event_get_type
|
||||
gdk_frame_clock_get_type
|
||||
gdk_gl_context_get_type
|
||||
gdk_gl_texture_get_type
|
||||
gdk_keymap_get_type
|
||||
gdk_memory_texture_get_type
|
||||
gdk_monitor_get_type
|
||||
gdk_paintable_get_type
|
||||
gdk_rgba_get_type
|
||||
gdk_seat_get_type
|
||||
gdk_snapshot_get_type
|
||||
gdk_surface_get_type
|
||||
gdk_content_serializer_get_type
|
||||
gdk_content_deserializer_get_type
|
||||
gdk_clipboard_get_type
|
||||
gdk_content_formats_get_type
|
||||
gdk_texture_get_type
|
||||
gdk_vulkan_context_get_type
|
||||
|
@@ -3,7 +3,6 @@ private_headers = [
|
||||
'gdkmarshalers.h',
|
||||
'gdkkeysyms.h',
|
||||
'gdkinternals.h',
|
||||
'gdkprivate.h',
|
||||
'gdk-private.h',
|
||||
'gdkapplaunchcontextprivate.h',
|
||||
'gdkclipboardprivate.h',
|
||||
@@ -11,31 +10,39 @@ private_headers = [
|
||||
'gdkcontentproviderprivate.h',
|
||||
'gdkcursorprivate.h',
|
||||
'gdkdeviceprivate.h',
|
||||
'gdkdevicepadprivate.h',
|
||||
'gdkdevicetoolprivate.h',
|
||||
'gdkdisplaymanagerprivate.h',
|
||||
'gdkdisplayprivate.h',
|
||||
'gdkdndprivate.h',
|
||||
'gdkdrawcontextprivate.h',
|
||||
'gdkeventsprivate.h',
|
||||
'gdkframeclockidleprivate.h',
|
||||
'gdkframeclockprivate.h',
|
||||
'gdkglcontextprivate.h',
|
||||
'gdkgltextureprivate.h',
|
||||
'gdkkeysprivate.h',
|
||||
'gdkmonitorprivate.h',
|
||||
'gdkmemorytextureprivate.h',
|
||||
'gdkpipeiostreamprivate.h',
|
||||
'gdkscreenprivate.h',
|
||||
'gdkseatdefaultprivate.h',
|
||||
'gdkseatprivate.h',
|
||||
'gdksnapshotprivate.h',
|
||||
'gdksurfaceimpl.h',
|
||||
'gdktextureprivate.h',
|
||||
'gdkvisualprivate.h',
|
||||
'gdkvulkancontextprivate.h',
|
||||
'keyname-table.h',
|
||||
'x11/gdkprivate-x11.h',
|
||||
'gdkprivate-x11.h',
|
||||
'x11/gdkeventsource.h',
|
||||
'wayland/keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h',
|
||||
'wayland/pointer-gestures-unstable-v1-client-protocol.h',
|
||||
'wayland/server-decoration-client-protocol.h',
|
||||
'wayland/tablet-unstable-v2-client-protocol.h',
|
||||
'wayland/xdg-foreign-unstable-v1-client-protocol.h',
|
||||
'wayland/xdg-shell-unstable-v6-client-protocol.h',
|
||||
'gtk-primary-selection-client-protocol.h',
|
||||
'gtk-shell-client-protocol.h',
|
||||
'keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h',
|
||||
'pointer-gestures-unstable-v1-client-protocol.h',
|
||||
'server-decoration-client-protocol.h',
|
||||
'tablet-unstable-v2-client-protocol.h',
|
||||
'xdg-foreign-unstable-v1-client-protocol.h',
|
||||
'xdg-shell-unstable-v6-client-protocol.h',
|
||||
'win32',
|
||||
'quartz',
|
||||
'broadway',
|
||||
@@ -80,19 +87,24 @@ images = [
|
||||
'images/zoom_out_cursor.png',
|
||||
]
|
||||
|
||||
src_dir = [ gdkinc ]
|
||||
|
||||
if x11_enabled
|
||||
src_dir += [ gdkx11_inc ]
|
||||
endif
|
||||
|
||||
if wayland_enabled
|
||||
src_dir += [ gdkwayland_inc ]
|
||||
endif
|
||||
|
||||
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
|
||||
|
||||
gnome.gtkdoc('gdk4',
|
||||
mode: 'none',
|
||||
main_xml: 'gdk4-docs.xml',
|
||||
src_dir: [
|
||||
join_paths(meson.source_root(), 'gdk'),
|
||||
join_paths(meson.source_root(), 'gdk', 'x11'),
|
||||
join_paths(meson.source_root(), 'gdk', 'wayland'),
|
||||
join_paths(meson.build_root(), 'gdk'),
|
||||
],
|
||||
src_dir: src_dir,
|
||||
dependencies: libgtk_dep,
|
||||
gobject_typesfile: join_paths(meson.source_root(), 'docs/reference/gdk/gdk4.types'),
|
||||
gobject_typesfile: join_paths(meson.current_source_dir(), 'gdk4.types'),
|
||||
scan_args: [
|
||||
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
|
||||
'--ignore-headers=' + ' '.join(private_headers),
|
||||
|
@@ -29,8 +29,6 @@ gsk_render_node_serialize
|
||||
gsk_render_node_deserialize
|
||||
gsk_render_node_write_to_file
|
||||
GskScalingFilter
|
||||
gsk_render_node_set_name
|
||||
gsk_render_node_get_name
|
||||
gsk_render_node_get_bounds
|
||||
|
||||
<SUBSECTION Nodes>
|
||||
@@ -70,6 +68,10 @@ gsk_container_node_get_child
|
||||
gsk_transform_node_new
|
||||
gsk_transform_node_get_child
|
||||
gsk_transform_node_peek_transform
|
||||
gsk_offset_node_new
|
||||
gsk_offset_node_get_child
|
||||
gsk_offset_node_get_x_offset
|
||||
gsk_offset_node_get_y_offset
|
||||
gsk_opacity_node_new
|
||||
gsk_opacity_node_get_child
|
||||
gsk_opacity_node_get_opacity
|
||||
@@ -108,6 +110,9 @@ gsk_text_node_get_y
|
||||
gsk_blur_node_new
|
||||
gsk_blur_node_get_child
|
||||
gsk_blur_node_get_radius
|
||||
gsk_debug_node_new
|
||||
gsk_debug_node_get_child
|
||||
gsk_debug_node_get_message
|
||||
<SUBSECTION Standard>
|
||||
GSK_IS_RENDER_NODE
|
||||
GSK_RENDER_NODE
|
||||
|
@@ -40,11 +40,10 @@ gnome.gtkdoc('gsk4',
|
||||
mode: 'none',
|
||||
main_xml: 'gsk4-docs.xml',
|
||||
src_dir: [
|
||||
join_paths(meson.source_root(), 'gsk'),
|
||||
join_paths(meson.build_root(), 'gsk'),
|
||||
gskinc,
|
||||
],
|
||||
dependencies: libgtk_dep,
|
||||
gobject_typesfile: join_paths(meson.source_root(), 'docs/reference/gsk/gsk4.types'),
|
||||
gobject_typesfile: join_paths(meson.current_source_dir(), 'gsk4.types'),
|
||||
scan_args: [
|
||||
'--ignore-decorators=_GDK_EXTERN',
|
||||
'--ignore-headers=' + ' '.join(private_headers),
|
||||
|
@@ -46,7 +46,7 @@ broadwayd :5
|
||||
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 gtk3-demo
|
||||
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
|
||||
</programlisting>
|
||||
</para>
|
||||
|
||||
|
@@ -294,13 +294,52 @@ How to compile GTK+ itself
|
||||
<command>meson</command>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Ddocumentation=true</arg>
|
||||
<arg choice="plain">-Ddocumentation=false</arg>
|
||||
<arg choice="plain">-Dx11-backend=true</arg>
|
||||
<arg choice="plain">-Dx11-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dman-pages=true</arg>
|
||||
<arg choice="plain">-Dman-pages=false</arg>
|
||||
<arg choice="plain">-Dwayland-backend=true</arg>
|
||||
<arg choice="plain">-Dwayland-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dbroadway-backend=true</arg>
|
||||
<arg choice="plain">-Dbroadway-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dwin32-backend=true</arg>
|
||||
<arg choice="plain">-Dwin32-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dquartz-backend=true</arg>
|
||||
<arg choice="plain">-Dquartz-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dmedia=gstreamer</arg>
|
||||
<arg choice="plain">-Dmedia=ffmpeg</arg>
|
||||
<arg choice="plain">-Dmedia=all</arg>
|
||||
<arg choice="plain">-Dmedia=none</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dvulkan=yes</arg>
|
||||
<arg choice="plain">-Dvulkan=no</arg>
|
||||
<arg choice="plain">-Dvulkan=auto</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dxinerama=yes</arg>
|
||||
<arg choice="plain">-Dxinerama=no</arg>
|
||||
<arg choice="plain">-Dxinerama=auto</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dcloudproviders=true</arg>
|
||||
<arg choice="plain">-Dcloudproviders=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
@@ -316,45 +355,13 @@ How to compile GTK+ itself
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dvulkan=yes</arg>
|
||||
<arg choice="plain">-Dvulkan=no</arg>
|
||||
<arg choice="plain">-Dvulkan=auto</arg>
|
||||
<arg choice="plain">-Ddocumentation=true</arg>
|
||||
<arg choice="plain">-Ddocumentation=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dx11-backend=true</arg>
|
||||
<arg choice="plain">-Dx11-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dcloudproviders=true</arg>
|
||||
<arg choice="plain">-Dcloudproviders=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dxinerama=yes</arg>
|
||||
<arg choice="plain">-Dxinerama=no</arg>
|
||||
<arg choice="plain">-Dxinerama=auto</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dwin32-backend=true</arg>
|
||||
<arg choice="plain">-Dwin32-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dquartz-backend=true</arg>
|
||||
<arg choice="plain">-Dquartz-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dbroadway-backend=true</arg>
|
||||
<arg choice="plain">-Dbroadway-backend=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
<arg choice="plain">-Dwayland-backend=true</arg>
|
||||
<arg choice="plain">-Dwayland-backend=false</arg>
|
||||
<arg choice="plain">-Dman-pages=true</arg>
|
||||
<arg choice="plain">-Dman-pages=false</arg>
|
||||
</group>
|
||||
<sbr/>
|
||||
<group>
|
||||
|
@@ -50,7 +50,7 @@
|
||||
<para>
|
||||
You can compile the program above with GCC using:
|
||||
<literallayout>
|
||||
<literal>gcc `pkg-config --cflags gtk+-3.0` -o example-0 example-0.c `pkg-config --libs gtk+-3.0`</literal>
|
||||
<literal>gcc `pkg-config --cflags gtk+-4.0` -o example-0 example-0.c `pkg-config --libs gtk+-4.0`</literal>
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
@@ -120,7 +120,7 @@
|
||||
here</ulink>.</para>
|
||||
|
||||
<para>Finally the window size is set using gtk_window_set_default_size and
|
||||
the window is then shown by GTK via gtk_widget_show_all().</para>
|
||||
the window is then shown by GTK via gtk_widget_show().</para>
|
||||
|
||||
<para>When you exit the window, by for example pressing the X,
|
||||
the g_application_run() in the main loop returns with a number
|
||||
@@ -160,7 +160,7 @@
|
||||
<para>
|
||||
You can compile the program above with GCC using:
|
||||
<literallayout>
|
||||
<literal>gcc `pkg-config --cflags gtk+-3.0` -o example-1 example-1.c `pkg-config --libs gtk+-3.0`</literal>
|
||||
<literal>gcc `pkg-config --cflags gtk+-4.0` -o example-1 example-1.c `pkg-config --libs gtk+-4.0`</literal>
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
@@ -238,7 +238,7 @@
|
||||
<para>
|
||||
You can compile the program above with GCC using:
|
||||
<literallayout>
|
||||
<literal>gcc `pkg-config --cflags gtk+-3.0` -o example-2 example-2.c `pkg-config --libs gtk+-3.0`</literal>
|
||||
<literal>gcc `pkg-config --cflags gtk+-4.0` -o example-2 example-2.c `pkg-config --libs gtk+-4.0`</literal>
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
@@ -264,7 +264,7 @@
|
||||
<para>
|
||||
You can compile the program above with GCC using:
|
||||
<literallayout>
|
||||
<literal>gcc `pkg-config --cflags gtk+-3.0` -o example-3 example-3.c `pkg-config --libs gtk+-3.0`</literal>
|
||||
<literal>gcc `pkg-config --cflags gtk+-4.0` -o example-3 example-3.c `pkg-config --libs gtk+-4.0`</literal>
|
||||
</literallayout>
|
||||
</para>
|
||||
|
||||
@@ -333,7 +333,7 @@
|
||||
|
||||
<para>The full, buildable sources for these examples can be found
|
||||
in the examples/ directory of the GTK+ source distribution, or
|
||||
<ulink url="https://git.gnome.org/browse/gtk+/tree/examples">online</ulink> in the GTK+ git repository.
|
||||
<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples">online</ulink> in the GTK+ git repository.
|
||||
You can build each example separately by using make with the <filename>Makefile.example</filename>
|
||||
file. For more information, see the <filename>README</filename> included in the
|
||||
examples directory.</para>
|
||||
@@ -450,13 +450,13 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application2/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application2/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>You may have noticed that we used the <literal>_from_resource(<!-- -->)</literal> variant
|
||||
of the function that sets a template. Now we need to use GLib's resource
|
||||
functionality to include the ui file in the binary. This is commonly
|
||||
done by listing all resources in a .gresource.xml file, such as this:
|
||||
of the function that sets a template. Now we need to use <ulink url="https://developer.gnome.org/gio/stable/GResource.html">GLib's resource functionality</ulink>
|
||||
to include the ui file in the binary. This is commonly done by listing
|
||||
all resources in a .gresource.xml file, such as this:
|
||||
</para>
|
||||
|
||||
<informalexample>
|
||||
@@ -488,23 +488,28 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
<para>In this step, we make our application show the content of
|
||||
all the files that it is given on the commandline.</para>
|
||||
|
||||
<para>To this end, we add a private struct to our application
|
||||
<para>To this end, we add a member to the struct in application
|
||||
window subclass and keep a reference to the #GtkStack there.
|
||||
The gtk_widget_class_bind_template_child_private() function
|
||||
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 instantiating the template, the
|
||||
@stack member of the private struct will point to the widget of
|
||||
@stack member of the struct will point to the widget of
|
||||
the same name from the template.</para>
|
||||
|
||||
<informalexample>
|
||||
<programlisting><![CDATA[
|
||||
...
|
||||
|
||||
struct _ExampleAppWindowPrivate
|
||||
struct _ExampleAppWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
|
||||
GtkWidget *stack;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
...
|
||||
|
||||
@@ -513,12 +518,12 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
{
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
}
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application3/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application3/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>Now we revisit the example_app_window_open() function that
|
||||
@@ -533,25 +538,21 @@ void
|
||||
example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
gsize length;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
|
||||
{
|
||||
@@ -567,7 +568,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application3/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application3/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>Note that we did not have to touch the stack switcher
|
||||
@@ -665,7 +666,7 @@ example_app_class_init (ExampleAppClass *class)
|
||||
|
||||
...
|
||||
</programlisting>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application4/exampleapp.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application4/exampleapp.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>Our preferences menu item does not do anything yet,
|
||||
@@ -718,20 +719,17 @@ example_app_class_init (ExampleAppClass *class)
|
||||
static void
|
||||
example_app_window_init (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
win->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->stack, "transition-type",
|
||||
g_settings_bind (win->settings, "transition",
|
||||
win->stack, "transition-type",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
}
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application5/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application5/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>The code to connect the font setting is a little more involved,
|
||||
@@ -780,7 +778,7 @@ preferences_activated (GSimpleAction *action,
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application6/exampleapp.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application6/exampleapp.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>After all this work, our application can now show
|
||||
@@ -823,7 +821,6 @@ static void
|
||||
search_text_changed (GtkEntry *entry,
|
||||
ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
const gchar *text;
|
||||
GtkWidget *tab;
|
||||
GtkWidget *view;
|
||||
@@ -835,9 +832,7 @@ search_text_changed (GtkEntry *entry,
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
|
||||
view = gtk_bin_get_child (GTK_BIN (tab));
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
@@ -866,7 +861,7 @@ example_app_window_init (ExampleAppWindow *win)
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application7/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application7/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>With the search bar, our application now looks like this:</para>
|
||||
@@ -926,7 +921,7 @@ example_app_window_init (ExampleAppWindow *win)
|
||||
|
||||
...
|
||||
]]></programlisting>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application8/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application8/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>What our application looks like now:</para>
|
||||
@@ -978,23 +973,23 @@ example_app_window_init (ExampleAppWindow *win)
|
||||
{
|
||||
...
|
||||
|
||||
action = (GAction*) g_property_action_new ("show-lines", priv->lines, "visible");
|
||||
action = (GAction*) g_property_action_new ("show-lines", win->lines, "visible");
|
||||
g_action_map_add_action (G_ACTION_MAP (win), action);
|
||||
g_object_unref (action);
|
||||
|
||||
g_object_bind_property (priv->lines, "visible",
|
||||
priv->lines_label, "visible",
|
||||
g_object_bind_property (win->lines, "visible",
|
||||
win->lines_label, "visible",
|
||||
G_BINDING_DEFAULT);
|
||||
}
|
||||
|
||||
...
|
||||
</programlisting>
|
||||
<para>(<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application9/exampleappwin.c">full source</ulink>)</para>
|
||||
<para>(<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application9/exampleappwin.c">full source</ulink>)</para>
|
||||
</informalexample>
|
||||
|
||||
<para>We also need a function that counts the lines of the currently
|
||||
active tab, and updates the @lines label. See the
|
||||
<ulink url="https://git.gnome.org/browse/gtk+/tree/examples/application9/exampleappwin.c">full source</ulink>
|
||||
<ulink url="https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application9/exampleappwin.c">full source</ulink>
|
||||
if you are interested in the details.</para>
|
||||
|
||||
<para>This brings our example application to this appearance:</para>
|
||||
@@ -1078,7 +1073,7 @@ example_app_window_init (ExampleAppWindow *win)
|
||||
<para>
|
||||
You can compile the program above with GCC using:
|
||||
<literallayout>
|
||||
<literal>gcc `pkg-config --cflags gtk+-3.0` -o example-4 example-4.c `pkg-config --libs gtk+-3.0`</literal>
|
||||
<literal>gcc `pkg-config --cflags gtk+-4.0` -o example-4 example-4.c `pkg-config --libs gtk+-4.0`</literal>
|
||||
</literallayout>
|
||||
</para>
|
||||
</section>
|
||||
|
@@ -52,7 +52,7 @@ gtk4-broadwayd :5
|
||||
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 gtk3-demo
|
||||
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
|
||||
</programlisting>
|
||||
|
||||
You can add password protection for your session by creating a file in
|
||||
|
@@ -93,12 +93,22 @@
|
||||
<title>Display Widgets</title>
|
||||
<xi:include href="xml/gtklabel.xml" />
|
||||
<xi:include href="xml/gtkimage.xml" />
|
||||
<xi:include href="xml/gtkpicture.xml" />
|
||||
<xi:include href="xml/gtkspinner.xml" />
|
||||
<xi:include href="xml/gtkinfobar.xml" />
|
||||
<xi:include href="xml/gtkprogressbar.xml" />
|
||||
<xi:include href="xml/gtklevelbar.xml" />
|
||||
<xi:include href="xml/gtkstatusbar.xml" />
|
||||
<xi:include href="xml/gtkaccellabel.xml" />
|
||||
<xi:include href="xml/gtkcalendar.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="MediaSupport">
|
||||
<title>Media Support</title>
|
||||
<xi:include href="xml/gtkvideo.xml" />
|
||||
<xi:include href="xml/gtkmediacontrols.xml" />
|
||||
<xi:include href="xml/gtkmediastream.xml" />
|
||||
<xi:include href="xml/gtkmediafile.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="ButtonWidgets">
|
||||
@@ -210,6 +220,12 @@
|
||||
<xi:include href="xml/gtkfontchooserdialog.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="DrawingWidgets">
|
||||
<title>Widgets for custom drawing</title>
|
||||
<xi:include href="xml/gtkdrawingarea.xml" />
|
||||
<xi:include href="xml/gtkglarea.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="Ornaments">
|
||||
<title>Ornaments</title>
|
||||
<xi:include href="xml/gtkframe.xml" />
|
||||
@@ -221,6 +237,7 @@
|
||||
<xi:include href="xml/gtkscrollbar.xml" />
|
||||
<xi:include href="xml/gtkscrolledwindow.xml" />
|
||||
<xi:include href="xml/gtkscrollable.xml" />
|
||||
<xi:include href="xml/gtkviewport.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="Printing">
|
||||
@@ -247,16 +264,12 @@
|
||||
<chapter id="MiscObjects">
|
||||
<title>Miscellaneous</title>
|
||||
<xi:include href="xml/gtkadjustment.xml" />
|
||||
<xi:include href="xml/gtkcalendar.xml" />
|
||||
<xi:include href="xml/gtkdrawingarea.xml" />
|
||||
<xi:include href="xml/gtkglarea.xml" />
|
||||
<xi:include href="xml/gtkimcontextsimple.xml" />
|
||||
<xi:include href="xml/gtkimmulticontext.xml" />
|
||||
<xi:include href="xml/gtksizegroup.xml" />
|
||||
<xi:include href="xml/gtktooltip.xml" />
|
||||
<xi:include href="xml/gtkviewport.xml" />
|
||||
<xi:include href="xml/gtkaccessible.xml" />
|
||||
<xi:include href="xml/gtksnapshot.xml" />
|
||||
<xi:include href="xml/gtkwidgetpaintable.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="AbstractObjects">
|
||||
@@ -268,6 +281,7 @@
|
||||
<xi:include href="xml/gtkrange.xml" />
|
||||
<xi:include href="xml/gtkimcontext.xml" />
|
||||
<xi:include href="xml/gtknativedialog.xml" />
|
||||
<xi:include href="xml/gtkaccessible.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="RecentDocuments">
|
||||
@@ -286,6 +300,7 @@
|
||||
<chapter id="Gestures">
|
||||
<title>Gestures and event handling</title>
|
||||
<xi:include href="xml/gtkeventcontroller.xml" />
|
||||
<xi:include href="xml/gtkeventcontrollerkey.xml" />
|
||||
<xi:include href="xml/gtkeventcontrollerscroll.xml" />
|
||||
<xi:include href="xml/gtkeventcontrollermotion.xml" />
|
||||
<xi:include href="xml/gtkgesture.xml" />
|
||||
@@ -297,6 +312,7 @@
|
||||
<xi:include href="xml/gtkgestureswipe.xml" />
|
||||
<xi:include href="xml/gtkgesturerotate.xml" />
|
||||
<xi:include href="xml/gtkgesturezoom.xml" />
|
||||
<xi:include href="xml/gtkgesturestylus.xml" />
|
||||
<xi:include href="xml/gtkpadcontroller.xml" />
|
||||
</chapter>
|
||||
|
||||
@@ -369,7 +385,6 @@
|
||||
<xi:include href="osx.sgml" />
|
||||
<xi:include href="broadway.xml" />
|
||||
<xi:include href="wayland.xml" />
|
||||
<xi:include href="mir.xml" />
|
||||
</part>
|
||||
|
||||
<xi:include href="glossary.xml" />
|
||||
|
@@ -679,8 +679,6 @@ gtk_combo_box_get_active_id
|
||||
gtk_combo_box_set_active_id
|
||||
gtk_combo_box_get_model
|
||||
gtk_combo_box_set_model
|
||||
gtk_combo_box_popup_for_device
|
||||
gtk_combo_box_popup
|
||||
gtk_combo_box_popdown
|
||||
gtk_combo_box_get_popup_accessible
|
||||
gtk_combo_box_get_row_separator_func
|
||||
@@ -1270,8 +1268,6 @@ gtk_fixed_get_type
|
||||
GtkFontButton
|
||||
gtk_font_button_new
|
||||
gtk_font_button_new_with_font
|
||||
gtk_font_button_set_font_name
|
||||
gtk_font_button_get_font_name
|
||||
gtk_font_button_set_use_font
|
||||
gtk_font_button_get_use_font
|
||||
gtk_font_button_set_use_size
|
||||
@@ -1302,7 +1298,7 @@ gtk_font_chooser_set_font
|
||||
gtk_font_chooser_get_font_desc
|
||||
gtk_font_chooser_set_font_desc
|
||||
gtk_font_chooser_get_font_features
|
||||
gtk_font_chooser_get_font_language
|
||||
gtk_font_chooser_set_language
|
||||
gtk_font_chooser_get_preview_text
|
||||
gtk_font_chooser_set_preview_text
|
||||
gtk_font_chooser_get_show_preview_entry
|
||||
@@ -1483,32 +1479,28 @@ GtkIconViewPrivate
|
||||
<TITLE>GtkImage</TITLE>
|
||||
GtkImage
|
||||
GtkImageType
|
||||
gtk_image_get_texture
|
||||
gtk_image_get_icon_name
|
||||
gtk_image_get_gicon
|
||||
gtk_image_get_storage_type
|
||||
gtk_image_new
|
||||
gtk_image_new_from_file
|
||||
gtk_image_new_from_resource
|
||||
gtk_image_new_from_pixbuf
|
||||
gtk_image_new_from_paintable
|
||||
gtk_image_new_from_icon_name
|
||||
gtk_image_new_from_gicon
|
||||
gtk_image_new_from_resource
|
||||
gtk_image_new_from_texture
|
||||
gtk_image_clear
|
||||
gtk_image_set_from_file
|
||||
gtk_image_set_from_resource
|
||||
gtk_image_set_from_pixbuf
|
||||
gtk_image_set_from_paintable
|
||||
gtk_image_set_from_icon_name
|
||||
gtk_image_set_from_gicon
|
||||
gtk_image_set_from_resource
|
||||
gtk_image_set_from_texture
|
||||
gtk_image_clear
|
||||
gtk_image_new
|
||||
gtk_image_get_storage_type
|
||||
gtk_image_get_paintable
|
||||
gtk_image_get_icon_name
|
||||
gtk_image_get_gicon
|
||||
gtk_image_set_pixel_size
|
||||
gtk_image_get_pixel_size
|
||||
gtk_image_set_icon_size
|
||||
gtk_image_get_icon_size
|
||||
gtk_image_set_keep_aspect_ratio
|
||||
gtk_image_get_keep_aspect_ratio
|
||||
gtk_image_set_can_shrink
|
||||
gtk_image_get_can_shrink
|
||||
<SUBSECTION Standard>
|
||||
GTK_IMAGE
|
||||
GTK_IS_IMAGE
|
||||
@@ -1730,8 +1722,6 @@ gtk_menu_attach
|
||||
gtk_menu_popup_at_rect
|
||||
gtk_menu_popup_at_widget
|
||||
gtk_menu_popup_at_pointer
|
||||
gtk_menu_popup_for_device
|
||||
gtk_menu_popup
|
||||
gtk_menu_set_accel_group
|
||||
gtk_menu_get_accel_group
|
||||
gtk_menu_set_accel_path
|
||||
@@ -1923,8 +1913,8 @@ gtk_info_bar_set_message_type
|
||||
gtk_info_bar_get_message_type
|
||||
gtk_info_bar_get_action_area
|
||||
gtk_info_bar_get_content_area
|
||||
gtk_info_bar_get_show_title_buttons
|
||||
gtk_info_bar_set_show_title_buttons
|
||||
gtk_info_bar_get_show_close_button
|
||||
gtk_info_bar_set_show_close_button
|
||||
gtk_info_bar_get_revealed
|
||||
gtk_info_bar_set_revealed
|
||||
|
||||
@@ -2051,6 +2041,40 @@ GtkPanedPrivate
|
||||
gtk_paned_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkpicture</FILE>
|
||||
<TITLE>GtkPicture</TITLE>
|
||||
GtkPicture
|
||||
gtk_picture_new
|
||||
gtk_picture_new_for_paintable
|
||||
gtk_picture_new_for_pixbuf
|
||||
gtk_picture_new_for_file
|
||||
gtk_picture_new_for_filename
|
||||
gtk_picture_new_for_resource
|
||||
gtk_picture_set_paintable
|
||||
gtk_picture_get_paintable
|
||||
gtk_picture_set_pixbuf
|
||||
gtk_picture_set_file
|
||||
gtk_picture_get_file
|
||||
gtk_picture_set_filename
|
||||
gtk_picture_set_resource
|
||||
gtk_picture_set_keep_aspect_ratio
|
||||
gtk_picture_get_keep_aspect_ratio
|
||||
gtk_picture_set_can_shrink
|
||||
gtk_picture_get_can_shrink
|
||||
gtk_picture_set_alternative_text
|
||||
gtk_picture_get_alternative_text
|
||||
<SUBSECTION Standard>
|
||||
GTK_PICTURE
|
||||
GTK_IS_PICTURE
|
||||
GTK_TYPE_PICTURE
|
||||
GTK_PICTURE_CLASS
|
||||
GTK_IS_PICTURE_CLASS
|
||||
GTK_PICTURE_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
gtk_picture_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkprogressbar</FILE>
|
||||
<TITLE>GtkProgressBar</TITLE>
|
||||
@@ -2397,6 +2421,8 @@ gtk_search_bar_set_search_mode
|
||||
gtk_search_bar_get_show_close_button
|
||||
gtk_search_bar_set_show_close_button
|
||||
gtk_search_bar_handle_event
|
||||
gtk_search_bar_set_key_capture_widget
|
||||
gtk_search_bar_get_key_capture_widget
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_SEARCH_BAR
|
||||
GTK_SEARCH_BAR
|
||||
@@ -2414,6 +2440,8 @@ gtk_search_bar_get_type
|
||||
GtkSearchEntry
|
||||
gtk_search_entry_new
|
||||
gtk_search_entry_handle_event
|
||||
gtk_search_entry_set_key_capture_widget
|
||||
gtk_search_entry_get_key_capture_widget
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_SEARCH_ENTRY
|
||||
GTK_SEARCH_ENTRY
|
||||
@@ -4168,15 +4196,10 @@ gtk_volume_button_get_type
|
||||
<TITLE>GtkSnapshot</TITLE>
|
||||
GtkSnapshot
|
||||
gtk_snapshot_new
|
||||
gtk_snapshot_ref
|
||||
gtk_snapshot_unref
|
||||
gtk_snapshot_to_node
|
||||
gtk_snapshot_to_paintable
|
||||
gtk_snapshot_free_to_node
|
||||
gtk_snapshot_free_to_paintable
|
||||
gtk_snapshot_get_renderer
|
||||
gtk_snapshot_get_record_names
|
||||
gtk_snapshot_push
|
||||
gtk_snapshot_push_transform
|
||||
gtk_snapshot_push_opacity
|
||||
gtk_snapshot_push_color_matrix
|
||||
@@ -4193,7 +4216,6 @@ gtk_snapshot_append_cairo
|
||||
gtk_snapshot_append_texture
|
||||
gtk_snapshot_append_color
|
||||
gtk_snapshot_append_layout
|
||||
gtk_snapshot_clips_rect
|
||||
gtk_snapshot_render_background
|
||||
gtk_snapshot_render_frame
|
||||
gtk_snapshot_render_focus
|
||||
@@ -4269,6 +4291,8 @@ gtk_widget_get_toplevel
|
||||
gtk_widget_get_ancestor
|
||||
gtk_widget_is_ancestor
|
||||
gtk_widget_translate_coordinates
|
||||
gtk_widget_add_controller
|
||||
gtk_widget_remove_controller
|
||||
gtk_widget_set_direction
|
||||
GtkTextDirection
|
||||
gtk_widget_get_direction
|
||||
@@ -4336,6 +4360,7 @@ gtk_widget_get_can_focus
|
||||
gtk_widget_set_can_focus
|
||||
gtk_widget_get_focus_on_click
|
||||
gtk_widget_set_focus_on_click
|
||||
gtk_widget_set_focus_child
|
||||
gtk_widget_get_has_surface
|
||||
gtk_widget_set_has_surface
|
||||
gtk_widget_get_sensitive
|
||||
@@ -4357,7 +4382,6 @@ gtk_widget_set_receives_default
|
||||
gtk_widget_get_receives_default
|
||||
gtk_widget_set_support_multidevice
|
||||
gtk_widget_get_support_multidevice
|
||||
gtk_widget_set_realized
|
||||
gtk_widget_get_realized
|
||||
gtk_widget_get_mapped
|
||||
gtk_widget_device_is_shadowed
|
||||
@@ -4837,7 +4861,6 @@ gtk_style_context_get_parent
|
||||
gtk_style_context_get_path
|
||||
gtk_style_context_get_property
|
||||
gtk_style_context_get_display
|
||||
gtk_style_context_get_frame_clock
|
||||
gtk_style_context_get_state
|
||||
gtk_style_context_get_valist
|
||||
gtk_style_context_get_section
|
||||
@@ -4860,7 +4883,6 @@ gtk_style_context_remove_class
|
||||
gtk_style_context_has_class
|
||||
gtk_style_context_list_classes
|
||||
gtk_style_context_set_display
|
||||
gtk_style_context_set_frame_clock
|
||||
gtk_style_context_set_state
|
||||
gtk_style_context_set_scale
|
||||
gtk_style_context_get_scale
|
||||
@@ -4881,14 +4903,11 @@ gtk_render_check
|
||||
gtk_render_expander
|
||||
gtk_render_focus
|
||||
gtk_render_frame
|
||||
gtk_render_frame_gap
|
||||
gtk_render_handle
|
||||
gtk_render_layout
|
||||
gtk_render_line
|
||||
gtk_render_option
|
||||
gtk_render_slider
|
||||
gtk_render_activity
|
||||
gtk_render_icon_surface
|
||||
gtk_render_icon
|
||||
gtk_render_insertion_cursor
|
||||
|
||||
@@ -4911,7 +4930,6 @@ gtk_border_get_type
|
||||
<FILE>gtkcssprovider</FILE>
|
||||
<TITLE>GtkCssProvider</TITLE>
|
||||
GtkCssProvider
|
||||
gtk_css_provider_get_default
|
||||
gtk_css_provider_get_named
|
||||
gtk_css_provider_load_from_data
|
||||
gtk_css_provider_load_from_file
|
||||
@@ -4988,6 +5006,7 @@ gtk_selection_data_get_type
|
||||
<TITLE>Drag and Drop</TITLE>
|
||||
GtkDestDefaults
|
||||
GtkDragResult
|
||||
|
||||
<SUBSECTION Destination Side>
|
||||
gtk_drag_dest_set
|
||||
gtk_drag_dest_unset
|
||||
@@ -4999,13 +5018,13 @@ gtk_drag_dest_add_image_targets
|
||||
gtk_drag_dest_add_uri_targets
|
||||
gtk_drag_dest_set_track_motion
|
||||
gtk_drag_dest_get_track_motion
|
||||
gtk_drag_finish
|
||||
gtk_drag_get_data
|
||||
gtk_drag_get_source_widget
|
||||
gtk_drag_highlight
|
||||
gtk_drag_unhighlight
|
||||
|
||||
<SUBSECTION Source Side>
|
||||
gtk_drag_begin_with_coordinates
|
||||
gtk_drag_begin
|
||||
gtk_drag_cancel
|
||||
gtk_drag_set_icon_widget
|
||||
gtk_drag_set_icon_paintable
|
||||
@@ -5275,6 +5294,7 @@ gtk_printer_request_details
|
||||
gtk_printer_get_capabilities
|
||||
gtk_printer_get_default_page_size
|
||||
gtk_printer_get_hard_margins
|
||||
gtk_printer_get_hard_margins_for_paper_size
|
||||
GtkPrinterFunc
|
||||
gtk_enumerate_printers
|
||||
|
||||
@@ -5989,6 +6009,8 @@ gtk_overlay_get_overlay_pass_through
|
||||
gtk_overlay_set_overlay_pass_through
|
||||
gtk_overlay_get_measure_overlay
|
||||
gtk_overlay_set_measure_overlay
|
||||
gtk_overlay_get_clip_overlay
|
||||
gtk_overlay_set_clip_overlay
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_OVERLAY
|
||||
@@ -6436,7 +6458,7 @@ gtk_gesture_single_get_type
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkeventcontrollerscroll</FILE>
|
||||
<TITLE>GtkEventControlerScroll</TITLE>
|
||||
<TITLE>GtkEventControllerScroll</TITLE>
|
||||
GtkEventControllerScroll
|
||||
GtkEventControllerScrollFlags
|
||||
gtk_event_controller_scroll_new
|
||||
@@ -6457,7 +6479,7 @@ gtk_event_controller_scroll_get_type
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkeventcontrollermotion</FILE>
|
||||
<TITLE>GtkEventControlerMotion</TITLE>
|
||||
<TITLE>GtkEventControllerMotion</TITLE>
|
||||
GtkEventControllerMotion
|
||||
gtk_event_controller_motion_new
|
||||
|
||||
@@ -6473,6 +6495,24 @@ GTK_EVENT_CONTROLLER_MOTION_GET_CLASS
|
||||
gtk_event_controller_motion_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkeventcontrollerkey</FILE>
|
||||
<TITLE>GtkEventControllerKey</TITLE>
|
||||
GtkEventControllerKey
|
||||
gtk_event_controller_key_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_EVENT_CONTROLLER_KEY
|
||||
GTK_EVENT_CONTROLLER_KEY
|
||||
GTK_EVENT_CONTROLLER_KEY_CLASS
|
||||
GTK_IS_EVENT_CONTROLLER_KEY
|
||||
GTK_IS_EVENT_CONTROLLER_KEY_CLASS
|
||||
GTK_EVENT_CONTROLLER_KEY_GET_CLASS
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_event_controller_key_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgesturedrag</FILE>
|
||||
<TITLE>GtkGestureDrag</TITLE>
|
||||
@@ -6631,15 +6671,39 @@ GTK_PAD_CONTROLLER_GET_CLASS
|
||||
gtk_pad_controller_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgesturestylus</FILE>
|
||||
<TITLE>GtkGestureStylus</TITLE>
|
||||
GtkGestureStylus
|
||||
|
||||
gtk_gesture_stylus_new
|
||||
gtk_gesture_stylus_get_axis
|
||||
gtk_gesture_stylus_get_axes
|
||||
gtk_gesture_stylus_get_backlog
|
||||
gtk_gesture_stylus_get_device_tool
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_GESTURE_STYLUS
|
||||
GTK_GESTURE_STYLUS
|
||||
GTK_GESTURE_STYLUS_CLASS
|
||||
GTK_IS_GESTURE_STYLUS
|
||||
GTK_IS_GESTURE_STYLUS_CLASS
|
||||
GTK_GESTURE_STYLUS_GET_CLASS
|
||||
GtkGestureStylusClass
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_gesture_stylus_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkstacksidebar</FILE>
|
||||
GtkStackSidebar
|
||||
GtkStackSidebarClass
|
||||
gtk_stack_sidebar_new
|
||||
gtk_stack_sidebar_set_stack
|
||||
gtk_stack_sidebar_get_stack
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GtkStackSidebarClass
|
||||
GTK_TYPE_STACK_SIDEBAR
|
||||
GTK_STACK_SIDEBAR
|
||||
GTK_STACK_SIDEBAR_CLASS
|
||||
@@ -6664,8 +6728,6 @@ gtk_gl_area_attach_buffers
|
||||
gtk_gl_area_set_error
|
||||
gtk_gl_area_get_error
|
||||
<SUBSECTION>
|
||||
gtk_gl_area_set_has_alpha
|
||||
gtk_gl_area_get_has_alpha
|
||||
gtk_gl_area_set_has_depth_buffer
|
||||
gtk_gl_area_get_has_depth_buffer
|
||||
gtk_gl_area_set_has_stencil_buffer
|
||||
@@ -6772,3 +6834,102 @@ GTK_SHORTCUT_LABEL_GET_CLASS
|
||||
GTK_IS_SHORTCUT_LABEL
|
||||
GTK_IS_SHORTCUT_LABEL_CLASS
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkvideo</FILE>
|
||||
GtkVideo
|
||||
gtk_video_new
|
||||
gtk_video_new_for_media_stream
|
||||
gtk_video_new_for_file
|
||||
gtk_video_new_for_filename
|
||||
gtk_video_new_for_resource
|
||||
gtk_video_get_media_stream
|
||||
gtk_video_set_media_stream
|
||||
gtk_video_get_file
|
||||
gtk_video_set_file
|
||||
gtk_video_set_filename
|
||||
gtk_video_set_resource
|
||||
gtk_video_get_autoplay
|
||||
gtk_video_set_autoplay
|
||||
gtk_video_get_loop
|
||||
gtk_video_set_loop
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_video_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmediacontrols</FILE>
|
||||
GtkMediaControls
|
||||
gtk_media_controls_new
|
||||
gtk_media_controls_get_media_stream
|
||||
gtk_media_controls_set_media_stream
|
||||
|
||||
<SUBSECTION Private>
|
||||
gtk_media_controls_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmediafile</FILE>
|
||||
GtkMediaFile
|
||||
gtk_media_file_new
|
||||
gtk_media_file_new_for_filename
|
||||
gtk_media_file_new_for_resource
|
||||
gtk_media_file_new_for_file
|
||||
gtk_media_file_new_for_input_stream
|
||||
gtk_media_file_clear
|
||||
gtk_media_file_set_filename
|
||||
gtk_media_file_set_resource
|
||||
gtk_media_file_set_file
|
||||
gtk_media_file_get_file
|
||||
gtk_media_file_set_input_stream
|
||||
gtk_media_file_get_input_stream
|
||||
|
||||
<SUBSECTION Private>
|
||||
GTK_TYPE_MEDIA_FILE
|
||||
gtk_media_file_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkmediastream</FILE>
|
||||
GtkMediaStream
|
||||
GtkMediaStreamClass
|
||||
|
||||
gtk_media_stream_is_prepared
|
||||
gtk_media_stream_get_error
|
||||
gtk_media_stream_has_audio
|
||||
gtk_media_stream_has_video
|
||||
gtk_media_stream_play
|
||||
gtk_media_stream_pause
|
||||
gtk_media_stream_get_playing
|
||||
gtk_media_stream_set_playing
|
||||
gtk_media_stream_get_ended
|
||||
gtk_media_stream_get_timestamp
|
||||
gtk_media_stream_get_duration
|
||||
gtk_media_stream_is_seekable
|
||||
gtk_media_stream_is_seeking
|
||||
gtk_media_stream_seek
|
||||
gtk_media_stream_get_loop
|
||||
gtk_media_stream_set_loop
|
||||
gtk_media_stream_get_muted
|
||||
gtk_media_stream_set_muted
|
||||
gtk_media_stream_get_volume
|
||||
gtk_media_stream_set_volume
|
||||
gtk_media_stream_realize
|
||||
gtk_media_stream_unrealize
|
||||
|
||||
<SUBSECTION>
|
||||
gtk_media_stream_prepared
|
||||
gtk_media_stream_unprepared
|
||||
gtk_media_stream_update
|
||||
gtk_media_stream_ended
|
||||
gtk_media_stream_seek_success
|
||||
gtk_media_stream_seek_failed
|
||||
gtk_media_stream_gerror
|
||||
gtk_media_stream_error
|
||||
gtk_media_stream_error_valist
|
||||
|
||||
<SUBSECTION Private>
|
||||
GTK_TYPE_MEDIA_STREAM
|
||||
gtk_media_stream_get_type
|
||||
</SECTION>
|
||||
|
@@ -53,8 +53,9 @@ gtk_entry_buffer_get_type
|
||||
gtk_entry_completion_get_type
|
||||
gtk_entry_get_type
|
||||
gtk_event_controller_get_type
|
||||
gtk_event_controller_scroll_get_type
|
||||
gtk_event_controller_key_get_type
|
||||
gtk_event_controller_motion_get_type
|
||||
gtk_event_controller_scroll_get_type
|
||||
gtk_expander_get_type
|
||||
gtk_file_chooser_button_get_type
|
||||
gtk_file_chooser_dialog_get_type
|
||||
@@ -76,6 +77,7 @@ gtk_gesture_multi_press_get_type
|
||||
gtk_gesture_pan_get_type
|
||||
gtk_gesture_rotate_get_type
|
||||
gtk_gesture_single_get_type
|
||||
gtk_gesture_stylus_get_type
|
||||
gtk_gesture_swipe_get_type
|
||||
gtk_gesture_zoom_get_type
|
||||
gtk_gl_area_get_type
|
||||
@@ -96,6 +98,9 @@ gtk_list_store_get_type
|
||||
gtk_list_box_get_type
|
||||
gtk_list_box_row_get_type
|
||||
gtk_lock_button_get_type
|
||||
gtk_media_controls_get_type
|
||||
gtk_media_file_get_type
|
||||
gtk_media_stream_get_type
|
||||
gtk_menu_bar_get_type
|
||||
gtk_menu_button_get_type
|
||||
gtk_menu_get_type
|
||||
@@ -113,6 +118,7 @@ gtk_page_setup_get_type
|
||||
@DISABLE_ON_W32@gtk_page_setup_unix_dialog_get_type
|
||||
gtk_paned_get_type
|
||||
gtk_paper_size_get_type
|
||||
gtk_picture_get_type
|
||||
gtk_popover_get_type
|
||||
gtk_popover_menu_get_type
|
||||
@DISABLE_ON_W32@gtk_printer_get_type
|
||||
@@ -179,6 +185,7 @@ gtk_tree_sortable_get_type
|
||||
gtk_tree_store_get_type
|
||||
gtk_tree_view_column_get_type
|
||||
gtk_tree_view_get_type
|
||||
gtk_video_get_type
|
||||
gtk_viewport_get_type
|
||||
gtk_volume_button_get_type
|
||||
gtk_widget_get_type
|
||||
|
@@ -179,41 +179,6 @@
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2 id="event-masks">
|
||||
<title>Event masks</title>
|
||||
|
||||
<para>
|
||||
Each widget instance has a basic event mask and another per input device,
|
||||
which determine the types of input event it receives. Each event mask set
|
||||
on a widget is added to the corresponding (basic or per-device) event mask
|
||||
for the widget’s #GdkSurface, and all child #GdkSurfaces.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Filtering events against event masks happens inside #GdkSurface, which
|
||||
exposes event masks to the windowing system to reduce the number of events
|
||||
GDK receives from it. On receiving an event, it is filtered against the
|
||||
#GdkSurface’s mask for the input device, if set. Otherwise, it is filtered
|
||||
against the #GdkSurface’s basic event mask.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This means that widgets must add to the event mask for each event type
|
||||
they expect to receive, using gtk_widget_set_events() or
|
||||
gtk_widget_add_events() to preserve the existing mask. Widgets which are
|
||||
aware of floating devices should use gtk_widget_set_device_events() or
|
||||
gtk_widget_add_device_events(), and must explicitly enable the device
|
||||
using gtk_widget_set_device_enabled(). See the #GdkDeviceManager
|
||||
documentation for more information.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
All standard widgets set the event mask for all events they expect to
|
||||
receive, and it is not necessary to modify this. Masks should be set when
|
||||
implementing a new widget.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Touch events</title>
|
||||
|
||||
|
@@ -1,4 +1,195 @@
|
||||
private_headers = [
|
||||
'gdkpixbufutilsprivate.h',
|
||||
'gtkaccelgroupprivate.h',
|
||||
'gtkaccelmapprivate.h',
|
||||
'gtkactionhelperprivate.h',
|
||||
'gtkactionmuxerprivate.h',
|
||||
'gtkadjustmentprivate.h',
|
||||
'gtkallocatedbitmaskprivate.h',
|
||||
'gtkappchooserprivate.h',
|
||||
'gtkapplicationaccelsprivate.h',
|
||||
'gtkapplicationprivate.h',
|
||||
'gtkbindingsprivate.h',
|
||||
'gtkbitmaskprivate.h',
|
||||
'gtkboxprivate.h',
|
||||
'gtkbuilderprivate.h',
|
||||
'gtkbuttonprivate.h',
|
||||
'gtkcellareaboxcontextprivate.h',
|
||||
'gtkcheckbuttonprivate.h',
|
||||
'gtkcheckmenuitemprivate.h',
|
||||
'gtkcolorchooserprivate.h',
|
||||
'gtkcoloreditorprivate.h',
|
||||
'gtkcolorplaneprivate.h',
|
||||
'gtkcolorscaleprivate.h',
|
||||
'gtkcolorswatchprivate.h',
|
||||
'gtkcomboboxprivate.h',
|
||||
'gtkcontainerprivate.h',
|
||||
'gtkcssanimatedstyleprivate.h',
|
||||
'gtkcssanimationprivate.h',
|
||||
'gtkcssarrayvalueprivate.h',
|
||||
'gtkcssbgsizevalueprivate.h',
|
||||
'gtkcssbordervalueprivate.h',
|
||||
'gtkcsscalcvalueprivate.h',
|
||||
'gtkcsscolorvalueprivate.h',
|
||||
'gtkcsscornervalueprivate.h',
|
||||
'gtkcssdimensionvalueprivate.h',
|
||||
'gtkcssdynamicprivate.h',
|
||||
'gtkcsseasevalueprivate.h',
|
||||
'gtkcssenumvalueprivate.h',
|
||||
'gtkcssfiltervalueprivate.h',
|
||||
'gtkcssfontfeaturesvalueprivate.h',
|
||||
'gtkcssfontvariationsvalueprivate.h',
|
||||
'gtkcssiconthemevalueprivate.h',
|
||||
'gtkcssimagebuiltinprivate.h',
|
||||
'gtkcssimagecrossfadeprivate.h',
|
||||
'gtkcssimagefallbackprivate.h',
|
||||
'gtkcssimageiconthemeprivate.h',
|
||||
'gtkcssimageinvalidprivate.h',
|
||||
'gtkcssimagelinearprivate.h',
|
||||
'gtkcssimagepaintableprivate.h',
|
||||
'gtkcssimageprivate.h',
|
||||
'gtkcssimageradialprivate.h',
|
||||
'gtkcssimagerecolorprivate.h',
|
||||
'gtkcssimagescaledprivate.h',
|
||||
'gtkcssimageurlprivate.h',
|
||||
'gtkcssimagevalueprivate.h',
|
||||
'gtkcssimagewin32private.h',
|
||||
'gtkcssinheritvalueprivate.h',
|
||||
'gtkcssinitialvalueprivate.h',
|
||||
'gtkcsskeyframesprivate.h',
|
||||
'gtkcsslookupprivate.h',
|
||||
'gtkcssmatcherprivate.h',
|
||||
'gtkcssnodedeclarationprivate.h',
|
||||
'gtkcssnodeprivate.h',
|
||||
'gtkcssnodestylecacheprivate.h',
|
||||
'gtkcssnumbervalueprivate.h',
|
||||
'gtkcsspalettevalueprivate.h',
|
||||
'gtkcssparserprivate.h',
|
||||
'gtkcsspathnodeprivate.h',
|
||||
'gtkcsspositionvalueprivate.h',
|
||||
'gtkcssproviderprivate.h',
|
||||
'gtkcssrepeatvalueprivate.h',
|
||||
'gtkcssrgbavalueprivate.h',
|
||||
'gtkcsssectionprivate.h',
|
||||
'gtkcssselectorprivate.h',
|
||||
'gtkcssshadowsvalueprivate.h',
|
||||
'gtkcssshadowvalueprivate.h',
|
||||
'gtkcssshorthandpropertyprivate.h',
|
||||
'gtkcssstaticstyleprivate.h',
|
||||
'gtkcssstringvalueprivate.h',
|
||||
'gtkcssstylechangeprivate.h',
|
||||
'gtkcssstyleprivate.h',
|
||||
'gtkcssstylepropertyprivate.h',
|
||||
'gtkcsstransformvalueprivate.h',
|
||||
'gtkcsstransientnodeprivate.h',
|
||||
'gtkcsstransitionprivate.h',
|
||||
'gtkcsstypesprivate.h',
|
||||
'gtkcssunsetvalueprivate.h',
|
||||
'gtkcssvalueprivate.h',
|
||||
'gtkcsswidgetnodeprivate.h',
|
||||
'gtkcsswin32sizevalueprivate.h',
|
||||
'gtkdialogprivate.h',
|
||||
'gtkdndprivate.h',
|
||||
'gtkentryprivate.h',
|
||||
'gtkeventcontrollerlegacyprivate.h',
|
||||
'gtkeventcontrollerprivate.h',
|
||||
'gtkfilechoosererrorstackprivate.h',
|
||||
'gtkfilechoosernativeprivate.h',
|
||||
'gtkfilechooserprivate.h',
|
||||
'gtkfilechooserwidgetprivate.h',
|
||||
'gtkfilefilterprivate.h',
|
||||
'gtkfontchooserprivate.h',
|
||||
'gtkfontchooserwidgetprivate.h',
|
||||
'gtkgesturedragprivate.h',
|
||||
'gtkgesturelongpressprivate.h',
|
||||
'gtkgesturemultipressprivate.h',
|
||||
'gtkgesturepanprivate.h',
|
||||
'gtkgestureprivate.h',
|
||||
'gtkgesturerotateprivate.h',
|
||||
'gtkgesturesingleprivate.h',
|
||||
'gtkgesturestylusprivate.h',
|
||||
'gtkgestureswipeprivate.h',
|
||||
'gtkgesturezoomprivate.h',
|
||||
'gtkgizmoprivate.h',
|
||||
'gtkheaderbarprivate.h',
|
||||
'gtkhslaprivate.h',
|
||||
'gtkiconcacheprivate.h',
|
||||
'gtkiconcachevalidatorprivate.h',
|
||||
'gtkiconhelperprivate.h',
|
||||
'gtkiconprivate.h',
|
||||
'gtkiconthemeprivate.h',
|
||||
'gtkiconviewprivate.h',
|
||||
'gtkimagedefinitionprivate.h',
|
||||
'gtkimageprivate.h',
|
||||
'gtkimcontextsimpleprivate.h',
|
||||
'gtkimmoduleprivate.h',
|
||||
'gtkkineticscrollingprivate.h',
|
||||
'gtklabelprivate.h',
|
||||
'gtklockbuttonprivate.h',
|
||||
'gtkmagnifierprivate.h',
|
||||
'gtkmediafileprivate.h',
|
||||
'gtkmenubuttonprivate.h',
|
||||
'gtkmenuitemprivate.h',
|
||||
'gtkmenuprivate.h',
|
||||
'gtkmenushellprivate.h',
|
||||
'gtkmodulesprivate.h',
|
||||
'gtkmountoperationprivate.h',
|
||||
'gtknativedialogprivate.h',
|
||||
'gtknomediafileprivate.h',
|
||||
'gtkorientableprivate.h',
|
||||
'gtkplacessidebarprivate.h',
|
||||
'gtkplacesviewprivate.h',
|
||||
'gtkplacesviewrowprivate.h',
|
||||
'gtkpointerfocusprivate.h',
|
||||
'gtkpopoverprivate.h',
|
||||
'gtkprinter-private.h',
|
||||
'gtkprintoperation-private.h',
|
||||
'gtkprivate.h',
|
||||
'gtkprogresstrackerprivate.h',
|
||||
'gtkrangeprivate.h',
|
||||
'gtkrbtreeprivate.h',
|
||||
'gtkrenderbackgroundprivate.h',
|
||||
'gtkrenderborderprivate.h',
|
||||
'gtkrendericonprivate.h',
|
||||
'gtkrendernodepaintableprivate.h',
|
||||
'gtkroundedboxprivate.h',
|
||||
'gtkscalerprivate.h',
|
||||
'gtksearchentryprivate.h',
|
||||
'gtkselectionprivate.h',
|
||||
'gtksettingsprivate.h',
|
||||
'gtkshortcutsshortcutprivate.h',
|
||||
'gtkshortcutswindowprivate.h',
|
||||
'gtksidebarrowprivate.h',
|
||||
'gtksizegroup-private.h',
|
||||
'gtksizerequestcacheprivate.h',
|
||||
'gtksnapshotprivate.h',
|
||||
'gtkstyleanimationprivate.h',
|
||||
'gtkstylecascadeprivate.h',
|
||||
'gtkstylecontextprivate.h',
|
||||
'gtkstylepropertyprivate.h',
|
||||
'gtkstyleproviderprivate.h',
|
||||
'gtktextbufferprivate.h',
|
||||
'gtktextchildprivate.h',
|
||||
'gtktextdisplayprivate.h',
|
||||
'gtktexthandleprivate.h',
|
||||
'gtktextiterprivate.h',
|
||||
'gtktextlayoutprivate.h',
|
||||
'gtktextmarkprivate.h',
|
||||
'gtktexttagprivate.h',
|
||||
'gtktextviewprivate.h',
|
||||
'gtktogglebuttonprivate.h',
|
||||
'gtktoolbarprivate.h',
|
||||
'gtktooltipprivate.h',
|
||||
'gtktooltipwindowprivate.h',
|
||||
'gtktreeprivate.h',
|
||||
'gtkutilsprivate.h',
|
||||
'gtkwidgetpaintableprivate.h',
|
||||
'gtkwidgetpathprivate.h',
|
||||
'gtkwidgetprivate.h',
|
||||
'gtkwin32drawprivate.h',
|
||||
'gtkwin32themeprivate.h',
|
||||
'gtkwindowprivate.h',
|
||||
'gtk-text-input-client-protocol.h',
|
||||
]
|
||||
|
||||
images = [
|
||||
@@ -164,7 +355,6 @@ content_files = [
|
||||
'input-handling.xml',
|
||||
'migrating-2to4.xml',
|
||||
'migrating-3to4.xml',
|
||||
'mir.xml',
|
||||
'osx.sgml',
|
||||
'other_software.sgml',
|
||||
'overview.xml',
|
||||
@@ -207,17 +397,18 @@ else
|
||||
types_conf.set('DISABLE_ON_QUARTZ', '')
|
||||
endif
|
||||
|
||||
configure_file(input: 'gtk4.types.in', output: 'gtk4.types', configuration: types_conf)
|
||||
|
||||
gnome.gtkdoc('gtk4',
|
||||
mode: 'none',
|
||||
main_xml: 'gtk4-docs.xml',
|
||||
src_dir: [
|
||||
join_paths(meson.source_root(), 'gtk'),
|
||||
join_paths(meson.build_root(), 'gtk'),
|
||||
gtkinc,
|
||||
],
|
||||
dependencies: libgtk_dep,
|
||||
gobject_typesfile: 'gtk4.types',
|
||||
gobject_typesfile: configure_file(
|
||||
input: 'gtk4.types.in',
|
||||
output: 'gtk4.types',
|
||||
configuration: types_conf,
|
||||
),
|
||||
scan_args: [
|
||||
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
|
||||
'--ignore-headers=' + ' '.join(private_headers),
|
||||
|
@@ -20,11 +20,11 @@
|
||||
|
||||
<para>
|
||||
The steps outlined in the following sections assume that your
|
||||
application is working with GTK+ 3.22, which is the final stable
|
||||
application is working with GTK+ 3.24, which is the final stable
|
||||
release of GTK+ 3.x. It includes all the necessary APIs and tools
|
||||
to help you port your application to GTK+ 4. If you are still using
|
||||
an older version of GTK+ 3.x, you should first get your application
|
||||
to build and work with the latest minor release in the 3.22 series.
|
||||
to build and work with the latest minor release in the 3.24 series.
|
||||
</para>
|
||||
|
||||
<section>
|
||||
@@ -34,7 +34,7 @@
|
||||
widgets have been deprecated. These deprecations are clearly spelled
|
||||
out in the API reference, with hints about the recommended replacements.
|
||||
The API reference for GTK+ 3 also includes an
|
||||
<ulink url="https://developer.gnome.org/gtk3/3.22/api-index-deprecated.html">index</ulink> of all deprecated symbols.
|
||||
<ulink url="https://developer.gnome.org/gtk3/3.24/api-index-deprecated.html">index</ulink> of all deprecated symbols.
|
||||
</para>
|
||||
<para>
|
||||
To verify that your program does not use any deprecated symbols,
|
||||
@@ -79,13 +79,13 @@
|
||||
<title>Review your window creation flags</title>
|
||||
<para>
|
||||
GTK+ 4 removes the GDK_WA_CURSOR flag. Instead, just use
|
||||
gdk_surface_set_cursor() to set a cursor on the window after
|
||||
gdk_window_set_cursor() to set a cursor on the window after
|
||||
creating it.
|
||||
</para>
|
||||
<para>
|
||||
GTK+ 4 also removes the GDK_WA_VISUAL flag, and always uses
|
||||
an RGBA visual for windows. To prepare your code for this,
|
||||
use gdk_surface_set_visual (gdk_screen_get_rgba_visual ()) after
|
||||
use gdk_window_set_visual (gdk_screen_get_rgba_visual ()) after
|
||||
creating your window.
|
||||
</para>
|
||||
<para>
|
||||
@@ -169,6 +169,14 @@
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using GtkWidget event signals</title>
|
||||
<para>
|
||||
Event controllers and #GtkGestures replace event signals in GTK+ 4. They
|
||||
have been backported to GTK+ 3.x so you can prepare for this change.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -217,9 +225,12 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Adapt to GdkSurface API changes</title>
|
||||
<title>Adapt to GdkWindow API changes</title>
|
||||
<para>
|
||||
The gdk_surface_new() function has been replaced by a number of more
|
||||
GdkWindow has been renamed to GdkSurface.
|
||||
</para>
|
||||
<para>
|
||||
The gdk_window_new() function has been replaced by a number of more
|
||||
specialized constructors: gdk_surface_new_toplevel(), gdk_surface_new_popup(),
|
||||
gdk_surface_new_temp(), gdk_surface_new_child(), gdk_surface_new_input(),
|
||||
gdk_wayland_surface_new_subsurface(). Use the appropriate ones to create
|
||||
@@ -230,7 +241,7 @@
|
||||
complicating the code and could not be supported across backends.
|
||||
</para>
|
||||
<para>
|
||||
gdk_surface_reparent() is no longer available.
|
||||
gdk_window_reparent() is no longer available.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -416,8 +427,8 @@
|
||||
<title>GdkPixbuf is deemphasized</title>
|
||||
<para>
|
||||
A number of #GdkPixbuf-based APIs have been removed. The available replacements
|
||||
are either using #GIcon, cairo_surface_t or the newly introduced #GdkTexture class
|
||||
instead.
|
||||
are either using #GIcon, or the newly introduced #GdkTexture or #GdkPaintable
|
||||
classes instead.
|
||||
</para>
|
||||
<para>
|
||||
If you are dealing with pixbufs, you can use gdk_texture_new_for_pixbuf()
|
||||
@@ -426,12 +437,36 @@
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>GtkWidget event signals are deemphasized</title>
|
||||
<title>GtkWidget event signals are removed</title>
|
||||
<para>
|
||||
Event controllers and #GtkGestures have already been introduced in GTK+ 3 to handle
|
||||
input for many cases. In GTK+ 4, even more are available, such as #GtkEventControllerScroll
|
||||
and GtkEventControllerMotion, and the traditional widget signals for handling input,
|
||||
such as #GtkWidget::motion-event or #GtkWidget::event have been deprecated.
|
||||
input for many cases. In GTK+ 4, the traditional widget signals for handling input,
|
||||
such as #GtkWidget::motion-event or #GtkWidget::event have been removed.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Invalidation handling has changed</title>
|
||||
<para>
|
||||
Only gtk_widget_queue_draw() is left to mark a widget as needing redraw.
|
||||
Variations like gtk_widget_queue_draw_rectangle() or gtk_widget_queue_draw_region()
|
||||
are no longer available.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Stop using GtkWidget::draw</title>
|
||||
<para>
|
||||
The #GtkWidget::draw signal has been removed. Widgets need to implement the
|
||||
#GtkWidget::snapshot function now. Connecting draw signal handlers is no longer possible.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<title>Window content observation has changed</title>
|
||||
<para>
|
||||
Observing widget contents and widget size is now done by using the
|
||||
#GtkWidgetPaintable object instead of connecting to widget signals.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
@@ -475,6 +510,7 @@
|
||||
#GtkCellRendererPixbuf:icon-size.
|
||||
</para>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
|
||||
</chapter>
|
||||
|
@@ -1,35 +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="gtk-mir">
|
||||
<refmeta>
|
||||
<refentrytitle>Using GTK+ with Mir</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>GTK Library</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>Using GTK+ with Mir</refname>
|
||||
<refpurpose>
|
||||
Mir-specific aspects of using GTK+
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
<refsect1>
|
||||
<title>Using GTK+ with Mir</title>
|
||||
|
||||
<para>
|
||||
The GDK Mir backend provides support for running GTK+ applications
|
||||
under Mir based display servers. To run your application in this way,
|
||||
select the Mir backend by setting <literal>GDK_BACKEND=mir</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Currently, the Mir backend does not use any additional commandline
|
||||
options or environment variables.
|
||||
</para>
|
||||
|
||||
</refsect1>
|
||||
|
||||
</refentry>
|
@@ -162,10 +162,10 @@ additional environment variables.
|
||||
Linux and Unix, and the ';' character on Windows.
|
||||
</para>
|
||||
<warning>
|
||||
Note that this environment variable is read by GTK+ 2.x too, which
|
||||
makes it unsuitable for setting it system-wide (or session-wide),
|
||||
since doing so will cause either GTK+ 2.x applications or GTK+ 3
|
||||
applications to see incompatible modules.
|
||||
Note that this environment variable is read by GTK+ 2.x and GTK+ 3.x too,
|
||||
which makes it unsuitable for setting it system-wide (or session-wide),
|
||||
since doing so will cause applications using different GTK+ versions
|
||||
to see incompatible modules.
|
||||
</warning>
|
||||
</formalpara>
|
||||
|
||||
@@ -309,7 +309,7 @@ nevertheless.
|
||||
<listitem><para>Use a legacy OpenGL context</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>gl-legacy</term>
|
||||
<term>gl-gles</term>
|
||||
<listitem><para>Use a GLES OpenGL context</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -320,11 +320,6 @@ nevertheless.
|
||||
<term>vulkan-validate</term>
|
||||
<listitem><para>Load the Vulkan validation layer, if available</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>cairo-image</term>
|
||||
<listitem><para>Use image surfaces for cairo rendering. This essentially
|
||||
turns off all hardware acceleration with the cairo renderer</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
The special value <literal>all</literal> can be used to turn on all
|
||||
debug options. The special value <literal>help</literal> can be used
|
||||
@@ -352,6 +347,14 @@ nevertheless.
|
||||
<term>opengl</term>
|
||||
<listitem><para>OpenGL renderer information</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>shaders</term>
|
||||
<listitem><para>Shaders</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>ssurface</term>
|
||||
<listitem><para>Surfaces</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>vulkan</term>
|
||||
<listitem><para>Vulkan renderer information</para></listitem>
|
||||
@@ -367,6 +370,10 @@ nevertheless.
|
||||
</variablelist>
|
||||
A number of options affect behavior instead of logging:
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>diff</term>
|
||||
<listitem><para>Show differences</para></listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>geometry</term>
|
||||
<listitem><para>Show borders</para></listitem>
|
||||
@@ -428,11 +435,6 @@ nevertheless.
|
||||
<listitem><para>Selects the Wayland backend for connecting to Wayland display servers</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>mir</term>
|
||||
<listitem><para>Selects the Mir backend for connecting to Mir display servers</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
Since 3.10, this environment variable can contain a comma-separated list
|
||||
of backend names, which are tried in order. The list may also contain
|
||||
@@ -453,6 +455,44 @@ nevertheless.
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><envar>GSK_RENDERER</envar></title>
|
||||
|
||||
<para>
|
||||
If set, selects the GSK renderer to use. The following renderers can
|
||||
be selected, provided they are included in the GTK library you are using
|
||||
and the GDK backend supports them:
|
||||
<variablelist>
|
||||
|
||||
<varlistentry>
|
||||
<term>help</term>
|
||||
<listitem><para>Prints information about available options</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>broadway</term>
|
||||
<listitem><para>Selects the Broadway-backend specific renderer</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>cairo</term>
|
||||
<listitem><para>Selects the fallback Cairo renderer</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>gl</term>
|
||||
<listitem><para>Selects the default OpenGL renderer</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>vulkan</term>
|
||||
<listitem><para>Selects the Vulkan renderer</para></listitem>
|
||||
</varlistentry>
|
||||
|
||||
</variablelist>
|
||||
</para>
|
||||
</formalpara>
|
||||
|
||||
<formalpara>
|
||||
<title><envar>GTK_CSD</envar></title>
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
|
||||
SRC = main.c exampleapp.c exampleappwin.c
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
@@ -7,43 +7,36 @@
|
||||
struct _ExampleAppPrefs
|
||||
{
|
||||
GtkDialog parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppPrefsPrivate ExampleAppPrefsPrivate;
|
||||
|
||||
struct _ExampleAppPrefsPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *font;
|
||||
GtkWidget *transition;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
G_DEFINE_TYPE (ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
example_app_prefs_init (ExampleAppPrefs *prefs)
|
||||
{
|
||||
ExampleAppPrefsPrivate *priv;
|
||||
|
||||
priv = example_app_prefs_get_instance_private (prefs);
|
||||
gtk_widget_init_template (GTK_WIDGET (prefs));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
prefs->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "font",
|
||||
priv->font, "font",
|
||||
g_settings_bind (prefs->settings, "font",
|
||||
prefs->font, "font",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->transition, "active-id",
|
||||
g_settings_bind (prefs->settings, "transition",
|
||||
prefs->transition, "active-id",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_prefs_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppPrefsPrivate *priv;
|
||||
ExampleAppPrefs *prefs;
|
||||
|
||||
priv = example_app_prefs_get_instance_private (EXAMPLE_APP_PREFS (object));
|
||||
g_clear_object (&priv->settings);
|
||||
prefs = EXAMPLE_APP_PREFS (object);
|
||||
|
||||
g_clear_object (&prefs->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_prefs_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -55,8 +48,8 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/prefs.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
}
|
||||
|
||||
ExampleAppPrefs *
|
||||
|
@@ -6,12 +6,7 @@
|
||||
struct _ExampleAppWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
|
||||
|
||||
struct _ExampleAppWindowPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *stack;
|
||||
GtkWidget *search;
|
||||
@@ -24,13 +19,12 @@ struct _ExampleAppWindowPrivate
|
||||
GtkWidget *lines_label;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
static void
|
||||
search_text_changed (GtkEntry *entry)
|
||||
search_text_changed (GtkEntry *entry,
|
||||
ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
const gchar *text;
|
||||
GtkWidget *tab;
|
||||
GtkWidget *view;
|
||||
@@ -42,10 +36,7 @@ search_text_changed (GtkEntry *entry)
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (entry)));
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
|
||||
view = gtk_bin_get_child (GTK_BIN (tab));
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
@@ -64,19 +55,15 @@ static void
|
||||
find_word (GtkButton *button,
|
||||
ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
const gchar *word;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
word = gtk_button_get_label (button);
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->searchentry), word);
|
||||
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
|
||||
}
|
||||
|
||||
static void
|
||||
update_words (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
GHashTable *strings;
|
||||
GHashTableIter iter;
|
||||
GtkWidget *tab, *view, *row;
|
||||
@@ -85,9 +72,7 @@ update_words (ExampleAppWindow *win)
|
||||
GList *children, *l;
|
||||
gchar *word, *key;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
|
||||
|
||||
if (tab == NULL)
|
||||
return;
|
||||
@@ -115,9 +100,9 @@ update_words (ExampleAppWindow *win)
|
||||
}
|
||||
|
||||
done:
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->words));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (win->words));
|
||||
for (l = children; l; l = l->next)
|
||||
gtk_container_remove (GTK_CONTAINER (priv->words), GTK_WIDGET (l->data));
|
||||
gtk_container_remove (GTK_CONTAINER (win->words), GTK_WIDGET (l->data));
|
||||
g_list_free (children);
|
||||
|
||||
g_hash_table_iter_init (&iter, strings);
|
||||
@@ -126,8 +111,7 @@ done:
|
||||
row = gtk_button_new_with_label (key);
|
||||
g_signal_connect (row, "clicked",
|
||||
G_CALLBACK (find_word), win);
|
||||
gtk_widget_show (row);
|
||||
gtk_container_add (GTK_CONTAINER (priv->words), row);
|
||||
gtk_container_add (GTK_CONTAINER (win->words), row);
|
||||
}
|
||||
|
||||
g_hash_table_unref (strings);
|
||||
@@ -136,16 +120,12 @@ done:
|
||||
static void
|
||||
update_lines (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
GtkWidget *tab, *view;
|
||||
GtkTextBuffer *buffer;
|
||||
GtkTextIter iter;
|
||||
int count;
|
||||
gchar *lines;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
|
||||
|
||||
if (tab == NULL)
|
||||
return;
|
||||
@@ -153,34 +133,21 @@ update_lines (ExampleAppWindow *win)
|
||||
view = gtk_bin_get_child (GTK_BIN (tab));
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
count = 0;
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &iter);
|
||||
while (!gtk_text_iter_is_end (&iter))
|
||||
{
|
||||
count++;
|
||||
if (!gtk_text_iter_forward_line (&iter))
|
||||
break;
|
||||
}
|
||||
|
||||
count = gtk_text_buffer_get_line_count (buffer);
|
||||
lines = g_strdup_printf ("%d", count);
|
||||
gtk_label_set_text (GTK_LABEL (priv->lines), lines);
|
||||
gtk_label_set_text (GTK_LABEL (win->lines), lines);
|
||||
g_free (lines);
|
||||
}
|
||||
|
||||
static void
|
||||
visible_child_changed (GObject *stack,
|
||||
GParamSpec *pspec)
|
||||
visible_child_changed (GObject *stack,
|
||||
GParamSpec *pspec,
|
||||
ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
if (gtk_widget_in_destruction (GTK_WIDGET (stack)))
|
||||
return;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (stack)));
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (priv->searchbar), FALSE);
|
||||
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (win->searchbar), FALSE);
|
||||
update_words (win);
|
||||
update_lines (win);
|
||||
}
|
||||
@@ -196,45 +163,43 @@ words_changed (GObject *sidebar,
|
||||
static void
|
||||
example_app_window_init (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *menu;
|
||||
GAction *action;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
win->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->stack, "transition-type",
|
||||
g_settings_bind (win->settings, "transition",
|
||||
win->stack, "transition-type",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
g_settings_bind (priv->settings, "show-words",
|
||||
priv->sidebar, "reveal-child",
|
||||
g_settings_bind (win->settings, "show-words",
|
||||
win->sidebar, "reveal-child",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
g_object_bind_property (priv->search, "active",
|
||||
priv->searchbar, "search-mode-enabled",
|
||||
g_object_bind_property (win->search, "active",
|
||||
win->searchbar, "search-mode-enabled",
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
|
||||
g_signal_connect (priv->sidebar, "notify::reveal-child",
|
||||
g_signal_connect (win->sidebar, "notify::reveal-child",
|
||||
G_CALLBACK (words_changed), win);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/gears-menu.ui");
|
||||
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu"));
|
||||
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->gears), menu);
|
||||
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (win->gears), menu);
|
||||
g_object_unref (builder);
|
||||
|
||||
action = g_settings_create_action (priv->settings, "show-words");
|
||||
action = g_settings_create_action (win->settings, "show-words");
|
||||
g_action_map_add_action (G_ACTION_MAP (win), action);
|
||||
g_object_unref (action);
|
||||
|
||||
action = (GAction*) g_property_action_new ("show-lines", priv->lines, "visible");
|
||||
action = (GAction*) g_property_action_new ("show-lines", win->lines, "visible");
|
||||
g_action_map_add_action (G_ACTION_MAP (win), action);
|
||||
g_object_unref (action);
|
||||
|
||||
g_object_bind_property (priv->lines, "visible",
|
||||
priv->lines_label, "visible",
|
||||
g_object_bind_property (win->lines, "visible",
|
||||
win->lines_label, "visible",
|
||||
G_BINDING_DEFAULT);
|
||||
|
||||
g_object_set (gtk_settings_get_default (), "gtk-shell-shows-app-menu", FALSE, NULL);
|
||||
@@ -245,12 +210,10 @@ static void
|
||||
example_app_window_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (object);
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
g_clear_object (&priv->settings);
|
||||
g_clear_object (&win->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -263,15 +226,15 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, search);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchbar);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchentry);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, gears);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, words);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, sidebar);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines_label);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, search);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchbar);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchentry);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, gears);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, words);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, sidebar);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, lines_label);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), search_text_changed);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), visible_child_changed);
|
||||
@@ -287,7 +250,6 @@ void
|
||||
example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
@@ -296,19 +258,16 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
GtkTextTag *tag;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
@@ -319,7 +278,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
}
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
|
||||
g_settings_bind (priv->settings, "font",
|
||||
g_settings_bind (win->settings, "font",
|
||||
tag, "font",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
@@ -329,7 +288,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
|
||||
g_free (basename);
|
||||
|
||||
gtk_widget_set_sensitive (priv->search, TRUE);
|
||||
gtk_widget_set_sensitive (win->search, TRUE);
|
||||
|
||||
update_words (win);
|
||||
update_lines (win);
|
||||
|
@@ -9,15 +9,13 @@
|
||||
<object class="GtkBox" id="vbox">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fontlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Font:</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">font</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -28,7 +26,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -37,9 +34,8 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="transitionlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Transition:</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">transition</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -50,7 +46,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="transition">
|
||||
<property name="visible">True</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="crossfade">Fade</item>
|
||||
|
@@ -5,107 +5,79 @@
|
||||
<property name="title" translatable="yes">Example Application</property>
|
||||
<property name="default-width">600</property>
|
||||
<property name="default-height">400</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<property name="show-title-buttons">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines_label">
|
||||
<property name="visible">False</property>
|
||||
<property name="label" translatable="yes">Lines:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines">
|
||||
<property name="visible">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="visible">True</property>
|
||||
<property name="direction">none</property>
|
||||
<property name="use-popover">True</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines_label">
|
||||
<property name="visible">0</property>
|
||||
<property name="label" translatable="yes">Lines:</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="lines">
|
||||
<property name="visible">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton" id="gears">
|
||||
<property name="direction">none</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="searchentry">
|
||||
<signal name="search-changed" handler="search_text_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="hbox">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="sidebar">
|
||||
<property name="visible">True</property>
|
||||
<property name="transition-type">slide-right</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="sidebar-sw">
|
||||
<property name="visible">True</property>
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="vscrollbar-policy">automatic</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="words">
|
||||
<property name="visible">True</property>
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkScrolledWindow" id="sidebar-sw">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="words">
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<signal name="notify::visible-child" handler="visible_child_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
|
||||
SRC = exampleapp.c exampleappwin.c main.c
|
||||
|
@@ -7,14 +7,11 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -22,7 +19,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
|
||||
SRC = exampleapp.c exampleappwin.c main.c
|
||||
|
@@ -6,16 +6,11 @@
|
||||
struct _ExampleAppWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
|
||||
|
||||
struct _ExampleAppWindowPrivate
|
||||
{
|
||||
GtkWidget *stack;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
static void
|
||||
example_app_window_init (ExampleAppWindow *win)
|
||||
@@ -28,7 +23,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
{
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
}
|
||||
|
||||
ExampleAppWindow *
|
||||
@@ -41,25 +36,21 @@ void
|
||||
example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
gsize length;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
|
||||
{
|
||||
|
@@ -7,14 +7,11 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -22,7 +19,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
|
||||
SRC = exampleapp.c exampleappwin.c main.c
|
||||
|
@@ -6,16 +6,11 @@
|
||||
struct _ExampleAppWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
|
||||
|
||||
struct _ExampleAppWindowPrivate
|
||||
{
|
||||
GtkWidget *stack;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
static void
|
||||
example_app_window_init (ExampleAppWindow *win)
|
||||
@@ -28,7 +23,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
{
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
}
|
||||
|
||||
ExampleAppWindow *
|
||||
@@ -41,25 +36,21 @@ void
|
||||
example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
gsize length;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
if (g_file_load_contents (file, NULL, &contents, &length, NULL, NULL))
|
||||
{
|
||||
|
@@ -7,14 +7,11 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -22,7 +19,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
@@ -6,29 +6,21 @@
|
||||
struct _ExampleAppWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
|
||||
|
||||
struct _ExampleAppWindowPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *stack;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
static void
|
||||
example_app_window_init (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
win->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->stack, "transition-type",
|
||||
g_settings_bind (win->settings, "transition",
|
||||
win->stack, "transition-type",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
}
|
||||
|
||||
@@ -36,12 +28,10 @@ static void
|
||||
example_app_window_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (object);
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
g_clear_object (&priv->settings);
|
||||
g_clear_object (&win->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -53,7 +43,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
}
|
||||
|
||||
ExampleAppWindow *
|
||||
@@ -66,7 +56,6 @@ void
|
||||
example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
@@ -75,19 +64,16 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
GtkTextTag *tag;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
@@ -98,7 +84,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
}
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
|
||||
g_settings_bind (priv->settings, "font", tag, "font", G_SETTINGS_BIND_DEFAULT);
|
||||
g_settings_bind (win->settings, "font", tag, "font", G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &start_iter);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end_iter);
|
||||
|
@@ -7,14 +7,11 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -22,7 +19,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
@@ -7,43 +7,36 @@
|
||||
struct _ExampleAppPrefs
|
||||
{
|
||||
GtkDialog parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppPrefsPrivate ExampleAppPrefsPrivate;
|
||||
|
||||
struct _ExampleAppPrefsPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *font;
|
||||
GtkWidget *transition;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
G_DEFINE_TYPE (ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
example_app_prefs_init (ExampleAppPrefs *prefs)
|
||||
{
|
||||
ExampleAppPrefsPrivate *priv;
|
||||
|
||||
priv = example_app_prefs_get_instance_private (prefs);
|
||||
gtk_widget_init_template (GTK_WIDGET (prefs));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
prefs->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "font",
|
||||
priv->font, "font",
|
||||
g_settings_bind (prefs->settings, "font",
|
||||
prefs->font, "font",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->transition, "active-id",
|
||||
g_settings_bind (prefs->settings, "transition",
|
||||
prefs->transition, "active-id",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_prefs_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppPrefsPrivate *priv;
|
||||
ExampleAppPrefs *prefs;
|
||||
|
||||
priv = example_app_prefs_get_instance_private (EXAMPLE_APP_PREFS (object));
|
||||
g_clear_object (&priv->settings);
|
||||
prefs = EXAMPLE_APP_PREFS (object);
|
||||
|
||||
g_clear_object (&prefs->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_prefs_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -55,8 +48,8 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/prefs.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
}
|
||||
|
||||
ExampleAppPrefs *
|
||||
|
@@ -6,29 +6,21 @@
|
||||
struct _ExampleAppWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
};
|
||||
|
||||
typedef struct ExampleAppWindowPrivate ExampleAppWindowPrivate;
|
||||
|
||||
struct ExampleAppWindowPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *stack;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
static void
|
||||
example_app_window_init (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
win->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->stack, "transition-type",
|
||||
g_settings_bind (win->settings, "transition",
|
||||
win->stack, "transition-type",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
}
|
||||
|
||||
@@ -36,12 +28,10 @@ static void
|
||||
example_app_window_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (object);
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
g_clear_object (&priv->settings);
|
||||
g_clear_object (&win->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -53,7 +43,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
}
|
||||
|
||||
ExampleAppWindow *
|
||||
@@ -66,7 +56,6 @@ void
|
||||
example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
@@ -75,19 +64,16 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
GtkTextTag *tag;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
@@ -98,7 +84,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
}
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
|
||||
g_settings_bind (priv->settings, "font", tag, "font", G_SETTINGS_BIND_DEFAULT);
|
||||
g_settings_bind (win->settings, "font", tag, "font", G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &start_iter);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end_iter);
|
||||
|
@@ -9,15 +9,13 @@
|
||||
<object class="GtkBox" id="vbox">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fontlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Font:</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">font</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -28,7 +26,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -37,9 +34,8 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="transitionlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Transition:</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">transition</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -50,7 +46,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="transition">
|
||||
<property name="visible">True</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="crossfade">Fade</item>
|
||||
|
@@ -7,14 +7,11 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
@@ -22,7 +19,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
@@ -7,43 +7,36 @@
|
||||
struct _ExampleAppPrefs
|
||||
{
|
||||
GtkDialog parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppPrefsPrivate ExampleAppPrefsPrivate;
|
||||
|
||||
struct _ExampleAppPrefsPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *font;
|
||||
GtkWidget *transition;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
G_DEFINE_TYPE (ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
example_app_prefs_init (ExampleAppPrefs *prefs)
|
||||
{
|
||||
ExampleAppPrefsPrivate *priv;
|
||||
|
||||
priv = example_app_prefs_get_instance_private (prefs);
|
||||
gtk_widget_init_template (GTK_WIDGET (prefs));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
prefs->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "font",
|
||||
priv->font, "font",
|
||||
g_settings_bind (prefs->settings, "font",
|
||||
prefs->font, "font",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->transition, "active-id",
|
||||
g_settings_bind (prefs->settings, "transition",
|
||||
prefs->transition, "active-id",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_prefs_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppPrefsPrivate *priv;
|
||||
ExampleAppPrefs *prefs;
|
||||
|
||||
priv = example_app_prefs_get_instance_private (EXAMPLE_APP_PREFS (object));
|
||||
g_clear_object (&priv->settings);
|
||||
prefs = EXAMPLE_APP_PREFS (object);
|
||||
|
||||
g_clear_object (&prefs->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_prefs_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -55,8 +48,8 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/prefs.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
}
|
||||
|
||||
ExampleAppPrefs *
|
||||
|
@@ -6,25 +6,19 @@
|
||||
struct _ExampleAppWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
|
||||
|
||||
struct _ExampleAppWindowPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *stack;
|
||||
GtkWidget *search;
|
||||
GtkWidget *searchbar;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
static void
|
||||
search_text_changed (GtkEntry *entry)
|
||||
search_text_changed (GtkEntry *entry,
|
||||
ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
const gchar *text;
|
||||
GtkWidget *tab;
|
||||
GtkWidget *view;
|
||||
@@ -36,10 +30,7 @@ search_text_changed (GtkEntry *entry)
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (entry)));
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
|
||||
view = gtk_bin_get_child (GTK_BIN (tab));
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
@@ -55,36 +46,28 @@ search_text_changed (GtkEntry *entry)
|
||||
}
|
||||
|
||||
static void
|
||||
visible_child_changed (GObject *stack,
|
||||
GParamSpec *pspec)
|
||||
visible_child_changed (GObject *stack,
|
||||
GParamSpec *pspec,
|
||||
ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
if (gtk_widget_in_destruction (GTK_WIDGET (stack)))
|
||||
return;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (stack)));
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (priv->searchbar), FALSE);
|
||||
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (win->searchbar), FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_window_init (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
win->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->stack, "transition-type",
|
||||
g_settings_bind (win->settings, "transition",
|
||||
win->stack, "transition-type",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
g_object_bind_property (priv->search, "active",
|
||||
priv->searchbar, "search-mode-enabled",
|
||||
g_object_bind_property (win->search, "active",
|
||||
win->searchbar, "search-mode-enabled",
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
}
|
||||
|
||||
@@ -92,12 +75,10 @@ static void
|
||||
example_app_window_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (object);
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
g_clear_object (&priv->settings);
|
||||
g_clear_object (&win->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -110,9 +91,9 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, search);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchbar);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, search);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchbar);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), search_text_changed);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), visible_child_changed);
|
||||
@@ -128,7 +109,6 @@ void
|
||||
example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
@@ -137,19 +117,16 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
GtkTextTag *tag;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
@@ -160,7 +137,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
}
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
|
||||
g_settings_bind (priv->settings, "font",
|
||||
g_settings_bind (win->settings, "font",
|
||||
tag, "font",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
@@ -170,5 +147,5 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
|
||||
g_free (basename);
|
||||
|
||||
gtk_widget_set_sensitive (priv->search, TRUE);
|
||||
gtk_widget_set_sensitive (win->search, TRUE);
|
||||
}
|
||||
|
@@ -9,15 +9,13 @@
|
||||
<object class="GtkBox" id="vbox">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fontlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Font:</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">font</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -28,7 +26,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -37,9 +34,8 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="transitionlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Transition:</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">transition</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -50,7 +46,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="transition">
|
||||
<property name="visible">True</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="crossfade">Fade</item>
|
||||
|
@@ -7,30 +7,18 @@
|
||||
<property name="default-height">400</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="content_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="visible">True</property>
|
||||
<child type="title">
|
||||
<object class="GtkStackSwitcher" id="tabs">
|
||||
<property name="visible">True</property>
|
||||
<property name="stack">stack</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="search">
|
||||
<property name="visible">True</property>
|
||||
<property name="sensitive">False</property>
|
||||
<style>
|
||||
<class name="image-button"/>
|
||||
</style>
|
||||
<child>
|
||||
<object class="GtkImage" id="search-icon">
|
||||
<property name="visible">True</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="icon-name">edit-find-symbolic</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">end</property>
|
||||
@@ -40,11 +28,9 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSearchBar" id="searchbar">
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkSearchEntry" id="searchentry">
|
||||
<signal name="search-changed" handler="search_text_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
@@ -52,7 +38,6 @@
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
<signal name="notify::visible-child" handler="visible_child_changed"/>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
CC ?= gcc
|
||||
PKGCONFIG = $(shell which pkg-config)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-3.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-3.0)
|
||||
CFLAGS = $(shell $(PKGCONFIG) --cflags gtk+-4.0)
|
||||
LIBS = $(shell $(PKGCONFIG) --libs gtk+-4.0)
|
||||
GLIB_COMPILE_RESOURCES = $(shell $(PKGCONFIG) --variable=glib_compile_resources gio-2.0)
|
||||
GLIB_COMPILE_SCHEMAS = $(shell $(PKGCONFIG) --variable=glib_compile_schemas gio-2.0)
|
||||
|
||||
|
@@ -7,43 +7,36 @@
|
||||
struct _ExampleAppPrefs
|
||||
{
|
||||
GtkDialog parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppPrefsPrivate ExampleAppPrefsPrivate;
|
||||
|
||||
struct _ExampleAppPrefsPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *font;
|
||||
GtkWidget *transition;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
G_DEFINE_TYPE (ExampleAppPrefs, example_app_prefs, GTK_TYPE_DIALOG)
|
||||
|
||||
static void
|
||||
example_app_prefs_init (ExampleAppPrefs *prefs)
|
||||
{
|
||||
ExampleAppPrefsPrivate *priv;
|
||||
|
||||
priv = example_app_prefs_get_instance_private (prefs);
|
||||
gtk_widget_init_template (GTK_WIDGET (prefs));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
prefs->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "font",
|
||||
priv->font, "font",
|
||||
g_settings_bind (prefs->settings, "font",
|
||||
prefs->font, "font",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->transition, "active-id",
|
||||
g_settings_bind (prefs->settings, "transition",
|
||||
prefs->transition, "active-id",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
}
|
||||
|
||||
static void
|
||||
example_app_prefs_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppPrefsPrivate *priv;
|
||||
ExampleAppPrefs *prefs;
|
||||
|
||||
priv = example_app_prefs_get_instance_private (EXAMPLE_APP_PREFS (object));
|
||||
g_clear_object (&priv->settings);
|
||||
prefs = EXAMPLE_APP_PREFS (object);
|
||||
|
||||
g_clear_object (&prefs->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_prefs_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -55,8 +48,8 @@ example_app_prefs_class_init (ExampleAppPrefsClass *class)
|
||||
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/prefs.ui");
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, font);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppPrefs, transition);
|
||||
}
|
||||
|
||||
ExampleAppPrefs *
|
||||
|
@@ -6,12 +6,7 @@
|
||||
struct _ExampleAppWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
};
|
||||
|
||||
typedef struct _ExampleAppWindowPrivate ExampleAppWindowPrivate;
|
||||
|
||||
struct _ExampleAppWindowPrivate
|
||||
{
|
||||
GSettings *settings;
|
||||
GtkWidget *stack;
|
||||
GtkWidget *search;
|
||||
@@ -22,13 +17,12 @@ struct _ExampleAppWindowPrivate
|
||||
GtkWidget *words;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE(ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
G_DEFINE_TYPE (ExampleAppWindow, example_app_window, GTK_TYPE_APPLICATION_WINDOW)
|
||||
|
||||
static void
|
||||
search_text_changed (GtkEntry *entry)
|
||||
search_text_changed (GtkEntry *entry,
|
||||
ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
const gchar *text;
|
||||
GtkWidget *tab;
|
||||
GtkWidget *view;
|
||||
@@ -40,10 +34,7 @@ search_text_changed (GtkEntry *entry)
|
||||
if (text[0] == '\0')
|
||||
return;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (entry)));
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
|
||||
view = gtk_bin_get_child (GTK_BIN (tab));
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
@@ -62,19 +53,15 @@ static void
|
||||
find_word (GtkButton *button,
|
||||
ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
const gchar *word;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
word = gtk_button_get_label (button);
|
||||
gtk_entry_set_text (GTK_ENTRY (priv->searchentry), word);
|
||||
gtk_entry_set_text (GTK_ENTRY (win->searchentry), word);
|
||||
}
|
||||
|
||||
static void
|
||||
update_words (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
GHashTable *strings;
|
||||
GHashTableIter iter;
|
||||
GtkWidget *tab, *view, *row;
|
||||
@@ -83,9 +70,7 @@ update_words (ExampleAppWindow *win)
|
||||
GList *children, *l;
|
||||
gchar *word, *key;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (priv->stack));
|
||||
tab = gtk_stack_get_visible_child (GTK_STACK (win->stack));
|
||||
|
||||
if (tab == NULL)
|
||||
return;
|
||||
@@ -113,9 +98,9 @@ update_words (ExampleAppWindow *win)
|
||||
}
|
||||
|
||||
done:
|
||||
children = gtk_container_get_children (GTK_CONTAINER (priv->words));
|
||||
children = gtk_container_get_children (GTK_CONTAINER (win->words));
|
||||
for (l = children; l; l = l->next)
|
||||
gtk_container_remove (GTK_CONTAINER (priv->words), GTK_WIDGET (l->data));
|
||||
gtk_container_remove (GTK_CONTAINER (win->words), GTK_WIDGET (l->data));
|
||||
g_list_free (children);
|
||||
|
||||
g_hash_table_iter_init (&iter, strings);
|
||||
@@ -124,27 +109,21 @@ done:
|
||||
row = gtk_button_new_with_label (key);
|
||||
g_signal_connect (row, "clicked",
|
||||
G_CALLBACK (find_word), win);
|
||||
gtk_widget_show (row);
|
||||
gtk_container_add (GTK_CONTAINER (priv->words), row);
|
||||
gtk_container_add (GTK_CONTAINER (win->words), row);
|
||||
}
|
||||
|
||||
g_hash_table_unref (strings);
|
||||
}
|
||||
|
||||
static void
|
||||
visible_child_changed (GObject *stack,
|
||||
GParamSpec *pspec)
|
||||
visible_child_changed (GObject *stack,
|
||||
GParamSpec *pspec,
|
||||
ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
if (gtk_widget_in_destruction (GTK_WIDGET (stack)))
|
||||
return;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (stack)));
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (priv->searchbar), FALSE);
|
||||
gtk_search_bar_set_search_mode (GTK_SEARCH_BAR (win->searchbar), FALSE);
|
||||
update_words (win);
|
||||
}
|
||||
|
||||
@@ -159,36 +138,34 @@ words_changed (GObject *sidebar,
|
||||
static void
|
||||
example_app_window_init (ExampleAppWindow *win)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
GtkBuilder *builder;
|
||||
GMenuModel *menu;
|
||||
GAction *action;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
priv->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
win->settings = g_settings_new ("org.gtk.exampleapp");
|
||||
|
||||
g_settings_bind (priv->settings, "transition",
|
||||
priv->stack, "transition-type",
|
||||
g_settings_bind (win->settings, "transition",
|
||||
win->stack, "transition-type",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
g_settings_bind (priv->settings, "show-words",
|
||||
priv->sidebar, "reveal-child",
|
||||
g_settings_bind (win->settings, "show-words",
|
||||
win->sidebar, "reveal-child",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
g_object_bind_property (priv->search, "active",
|
||||
priv->searchbar, "search-mode-enabled",
|
||||
g_object_bind_property (win->search, "active",
|
||||
win->searchbar, "search-mode-enabled",
|
||||
G_BINDING_BIDIRECTIONAL);
|
||||
|
||||
g_signal_connect (priv->sidebar, "notify::reveal-child",
|
||||
g_signal_connect (win->sidebar, "notify::reveal-child",
|
||||
G_CALLBACK (words_changed), win);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/exampleapp/gears-menu.ui");
|
||||
menu = G_MENU_MODEL (gtk_builder_get_object (builder, "menu"));
|
||||
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (priv->gears), menu);
|
||||
gtk_menu_button_set_menu_model (GTK_MENU_BUTTON (win->gears), menu);
|
||||
g_object_unref (builder);
|
||||
|
||||
action = g_settings_create_action (priv->settings, "show-words");
|
||||
action = g_settings_create_action (win->settings, "show-words");
|
||||
g_action_map_add_action (G_ACTION_MAP (win), action);
|
||||
g_object_unref (action);
|
||||
}
|
||||
@@ -197,12 +174,10 @@ static void
|
||||
example_app_window_dispose (GObject *object)
|
||||
{
|
||||
ExampleAppWindow *win;
|
||||
ExampleAppWindowPrivate *priv;
|
||||
|
||||
win = EXAMPLE_APP_WINDOW (object);
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
|
||||
g_clear_object (&priv->settings);
|
||||
g_clear_object (&win->settings);
|
||||
|
||||
G_OBJECT_CLASS (example_app_window_parent_class)->dispose (object);
|
||||
}
|
||||
@@ -215,13 +190,13 @@ example_app_window_class_init (ExampleAppWindowClass *class)
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (class),
|
||||
"/org/gtk/exampleapp/window.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, search);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchbar);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchentry);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, gears);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, words);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (class), ExampleAppWindow, sidebar);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, stack);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, search);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchbar);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, searchentry);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, gears);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, words);
|
||||
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), ExampleAppWindow, sidebar);
|
||||
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), search_text_changed);
|
||||
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), visible_child_changed);
|
||||
@@ -238,7 +213,6 @@ void
|
||||
example_app_window_open (ExampleAppWindow *win,
|
||||
GFile *file)
|
||||
{
|
||||
ExampleAppWindowPrivate *priv;
|
||||
gchar *basename;
|
||||
GtkWidget *scrolled, *view;
|
||||
gchar *contents;
|
||||
@@ -247,19 +221,16 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
GtkTextTag *tag;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
|
||||
priv = example_app_window_get_instance_private (win);
|
||||
basename = g_file_get_basename (file);
|
||||
|
||||
scrolled = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolled);
|
||||
gtk_widget_set_hexpand (scrolled, TRUE);
|
||||
gtk_widget_set_vexpand (scrolled, TRUE);
|
||||
view = gtk_text_view_new ();
|
||||
gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
|
||||
gtk_widget_show (view);
|
||||
gtk_container_add (GTK_CONTAINER (scrolled), view);
|
||||
gtk_stack_add_titled (GTK_STACK (priv->stack), scrolled, basename, basename);
|
||||
gtk_stack_add_titled (GTK_STACK (win->stack), scrolled, basename, basename);
|
||||
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
|
||||
|
||||
@@ -270,7 +241,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
}
|
||||
|
||||
tag = gtk_text_buffer_create_tag (buffer, NULL, NULL);
|
||||
g_settings_bind (priv->settings, "font",
|
||||
g_settings_bind (win->settings, "font",
|
||||
tag, "font",
|
||||
G_SETTINGS_BIND_DEFAULT);
|
||||
|
||||
@@ -280,7 +251,7 @@ example_app_window_open (ExampleAppWindow *win,
|
||||
|
||||
g_free (basename);
|
||||
|
||||
gtk_widget_set_sensitive (priv->search, TRUE);
|
||||
gtk_widget_set_sensitive (win->search, TRUE);
|
||||
|
||||
update_words (win);
|
||||
}
|
||||
|
@@ -9,15 +9,13 @@
|
||||
<object class="GtkBox" id="vbox">
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin">6</property>
|
||||
<property name="row-spacing">12</property>
|
||||
<property name="column-spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fontlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Font:</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">font</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -28,7 +26,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkFontButton" id="font">
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
@@ -37,9 +34,8 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="transitionlabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label">_Transition:</property>
|
||||
<property name="use-underline">True</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">transition</property>
|
||||
<property name="xalign">1</property>
|
||||
</object>
|
||||
@@ -50,7 +46,6 @@
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBoxText" id="transition">
|
||||
<property name="visible">True</property>
|
||||
<items>
|
||||
<item translatable="yes" id="none">None</item>
|
||||
<item translatable="yes" id="crossfade">Fade</item>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user