Compare commits
695 Commits
cube-spin
...
tracing-fo
Author | SHA1 | Date | |
---|---|---|---|
|
10dc86b33c | ||
|
958d21171c | ||
|
c8a3713148 | ||
|
6b6b4d70f6 | ||
|
195221e99f | ||
|
1d13305f08 | ||
|
0d692efd73 | ||
|
8fa58ccfef | ||
|
3377133d19 | ||
|
ed31ea3773 | ||
|
feddf5a694 | ||
|
e847c030bd | ||
|
b3c4320bc2 | ||
|
730b52b084 | ||
|
4ff578db10 | ||
|
248c07c65e | ||
|
b01cf6be65 | ||
|
a0c6d88858 | ||
|
68560a941a | ||
|
77b7817266 | ||
|
c6a42e92bb | ||
|
73ff7baa1b | ||
|
e29cf84ac4 | ||
|
7ae675b469 | ||
|
b87b281df1 | ||
|
4869013a8d | ||
|
3e2107846d | ||
|
c8865459fc | ||
|
8559593a18 | ||
|
759a97403c | ||
|
a8aa7afa13 | ||
|
ecc8f9cf72 | ||
|
fe473dbef8 | ||
|
59c6862a03 | ||
|
e98973e2c0 | ||
|
c6b2184aa0 | ||
|
562e492056 | ||
|
15b8ee4564 | ||
|
d61e77dab4 | ||
|
d8e92d4859 | ||
|
4eb00a3e41 | ||
|
82eee65334 | ||
|
4f6cc46278 | ||
|
84d3848c01 | ||
|
b4093e59ee | ||
|
c4013eeb26 | ||
|
96cce3ae23 | ||
|
09b6dbb7ef | ||
|
cfea8de6b5 | ||
|
d5d48af7f7 | ||
|
43a5ff8e01 | ||
|
00b947124f | ||
|
3f24ad741a | ||
|
cc5f2f8995 | ||
|
6594ccf716 | ||
|
559ae8b326 | ||
|
da5b99f807 | ||
|
008b7bc94f | ||
|
b4f5baf4fa | ||
|
8c04129b94 | ||
|
5010461066 | ||
|
dde69802cd | ||
|
5530331b35 | ||
|
a55ebf2350 | ||
|
fb63364f30 | ||
|
58666c6210 | ||
|
3a9fa035ee | ||
|
1000d971f9 | ||
|
349e6af2c8 | ||
|
44b3b8937a | ||
|
9598e16753 | ||
|
61a963d78d | ||
|
e31856fe1b | ||
|
1d6134f87d | ||
|
08e9725797 | ||
|
4d98e96124 | ||
|
50e10cd771 | ||
|
b6838cb9f4 | ||
|
01a7c7a8b2 | ||
|
3c6aa84e44 | ||
|
bf2ae5aa81 | ||
|
44b0a893fc | ||
|
32fd55a66d | ||
|
9af01bea5e | ||
|
40fe3d94ac | ||
|
6fe203d0e2 | ||
|
7b6f652630 | ||
|
1a4c988a22 | ||
|
d936a9ae89 | ||
|
67e6d1087e | ||
|
29bafd1e15 | ||
|
65697e3324 | ||
|
bceca277ea | ||
|
16c8fb52df | ||
|
d702bfe7b7 | ||
|
596c9a3c0b | ||
|
c675d1c9e1 | ||
|
bd490ed511 | ||
|
bcf180642d | ||
|
5882e22f89 | ||
|
6f25168db3 | ||
|
2a4b5862ae | ||
|
7037ff8f3d | ||
|
1c9a486d60 | ||
|
eb9284e9ca | ||
|
77e3b72b15 | ||
|
05cb7e7412 | ||
|
299422994a | ||
|
b1d90cc171 | ||
|
af2207bc0b | ||
|
522bbc182d | ||
|
65233726f8 | ||
|
19227d9789 | ||
|
8915d60900 | ||
|
ed52c029a0 | ||
|
7b1201cd4d | ||
|
3f940715e4 | ||
|
f6225901e8 | ||
|
eff4b6377d | ||
|
a18647af0e | ||
|
c7df0c907a | ||
|
b74407a343 | ||
|
cd5c39834d | ||
|
574a25b09c | ||
|
6e0b13b81f | ||
|
bea8025fb5 | ||
|
965d0e04d1 | ||
|
d7c54920ee | ||
|
33a8108f19 | ||
|
78d254370c | ||
|
377ec33069 | ||
|
2952ba07e1 | ||
|
62b7ea7611 | ||
|
c9eca55c5e | ||
|
435bc269e9 | ||
|
0d2a7f876b | ||
|
737400ddbc | ||
|
134e159bc9 | ||
|
6f0b47681b | ||
|
d53981fdbb | ||
|
e09beee62a | ||
|
724ec3ca92 | ||
|
3ce6a710a3 | ||
|
e41596d6a1 | ||
|
0fa4d54316 | ||
|
e7cbb7a76c | ||
|
b2a23a9a90 | ||
|
6878c2bae0 | ||
|
5b8f1aa2ee | ||
|
6b4a82224c | ||
|
1f30b7742b | ||
|
54e7a94d70 | ||
|
f1919c706f | ||
|
26b17473aa | ||
|
99eee5cea9 | ||
|
074a0014c1 | ||
|
091cac00b2 | ||
|
175e3d751d | ||
|
83e9361005 | ||
|
17bb1248b5 | ||
|
8211e79be9 | ||
|
d5282862e5 | ||
|
26b6d18563 | ||
|
31fb5cc2d4 | ||
|
90301c6813 | ||
|
ccdf50aafd | ||
|
af5c80248d | ||
|
1d81a58cf1 | ||
|
09cec2e6a1 | ||
|
efed2641f4 | ||
|
97a5ca74d2 | ||
|
5b5b215dea | ||
|
7a06859f38 | ||
|
24fa104b61 | ||
|
89861faa04 | ||
|
5fd94e2027 | ||
|
1f4d02740e | ||
|
0023b9036b | ||
|
89d1f8c3ca | ||
|
7d9364655d | ||
|
86d2fcef16 | ||
|
5f8543fe81 | ||
|
aae7816557 | ||
|
6fbf13965c | ||
|
484e330e4a | ||
|
f27ecde1e2 | ||
|
c06d1a69ae | ||
|
cf9deb7cf5 | ||
|
40beb69487 | ||
|
f1cadee196 | ||
|
f6594ff073 | ||
|
478fdaa632 | ||
|
6c472ed2b8 | ||
|
30942c4e3d | ||
|
bf7d1e7b5a | ||
|
92e21c3f1c | ||
|
8880d27460 | ||
|
59d50be737 | ||
|
6d73443131 | ||
|
fe3796ed5b | ||
|
89f7b974f2 | ||
|
0ae958d45b | ||
|
3d1fdf77dc | ||
|
0ae71cacb4 | ||
|
218d635ca2 | ||
|
7553d0c471 | ||
|
f4880f5df5 | ||
|
3ccdad76de | ||
|
e464c08545 | ||
|
56e95ddfc8 | ||
|
65052a5d6c | ||
|
1364eb2f62 | ||
|
aa8ada3fed | ||
|
3643a9fe86 | ||
|
25f4bb2e17 | ||
|
3b62d9c027 | ||
|
c92938b378 | ||
|
c98313016e | ||
|
e43839114d | ||
|
b6c1786165 | ||
|
3a40555202 | ||
|
ff604e1906 | ||
|
34974a8a66 | ||
|
7c15daf99e | ||
|
b9467a4dc7 | ||
|
5a1c37a8c8 | ||
|
b75bc8aa64 | ||
|
ed4c08d9b3 | ||
|
929cdd9259 | ||
|
78049f452a | ||
|
cf2ef4863b | ||
|
2bd348558e | ||
|
0f6d83bb5f | ||
|
7e20232607 | ||
|
dcc55e3a73 | ||
|
59fd48cee0 | ||
|
c848b9014b | ||
|
1e16cb088a | ||
|
f4cf43359d | ||
|
6c8a5f5e2f | ||
|
da64d687d1 | ||
|
aab803b7ae | ||
|
936aba884a | ||
|
e1200230c4 | ||
|
d3ad816d63 | ||
|
eea1388cf4 | ||
|
f3747d1776 | ||
|
6277f2fccc | ||
|
931b0b3752 | ||
|
6f3e608331 | ||
|
cc4b3798e5 | ||
|
8634a51aa5 | ||
|
7420f9c34a | ||
|
1a7c280ebb | ||
|
4bb6e70d01 | ||
|
2bd9b42479 | ||
|
b8127670df | ||
|
3a1ef7aa2c | ||
|
8dd26b6b8a | ||
|
0526775ff4 | ||
|
1ad406e15d | ||
|
249f6a85b3 | ||
|
32edf29c0a | ||
|
4f7171885f | ||
|
b1eedbeb58 | ||
|
a98f857a82 | ||
|
b9770fa752 | ||
|
52d4bcf1be | ||
|
fe3b5ba545 | ||
|
33f034d0d7 | ||
|
2516f1142d | ||
|
ec37e1e462 | ||
|
79180f62d7 | ||
|
5cd4ec510d | ||
|
ea95aea246 | ||
|
e13d242320 | ||
|
c21063e71e | ||
|
477ad2505b | ||
|
91bbe6ef95 | ||
|
34fcfb154a | ||
|
28815bc7e4 | ||
|
8eaa8aaaf8 | ||
|
491829a2b5 | ||
|
28be1c5d3a | ||
|
65ff19d149 | ||
|
3da6e83609 | ||
|
2a7e4ae7f6 | ||
|
cc878ec00f | ||
|
1f5649e1ce | ||
|
ca19b940ce | ||
|
3f70d20bb3 | ||
|
304e06541e | ||
|
c91371951a | ||
|
6e59c5c843 | ||
|
f5a8b79cfb | ||
|
c723893f09 | ||
|
a247529bc8 | ||
|
51b2759eb1 | ||
|
fed2db1493 | ||
|
77ff83cdd1 | ||
|
37fee8c52f | ||
|
08c84bc830 | ||
|
9b6f822f15 | ||
|
70fb29e81a | ||
|
0e26e95b00 | ||
|
ba1c5cf43f | ||
|
f3821031e0 | ||
|
e37f4d0ea6 | ||
|
b26087845d | ||
|
891b343197 | ||
|
8727b0708e | ||
|
1932a50d36 | ||
|
5a5da91785 | ||
|
de2e0f451f | ||
|
8400d8e75d | ||
|
50eb11a2a0 | ||
|
e8f898508a | ||
|
638a3c142c | ||
|
ecdad20827 | ||
|
5cd8e0f7f1 | ||
|
83696639a7 | ||
|
1aa1610611 | ||
|
0c87b62251 | ||
|
69f12ed6a5 | ||
|
a8db330341 | ||
|
2681f7c7af | ||
|
836b5a217a | ||
|
802c426d89 | ||
|
7c3eadf169 | ||
|
6c6fd13034 | ||
|
4ce217b1a5 | ||
|
2656f5b4eb | ||
|
bc8ecef605 | ||
|
33eb72a69b | ||
|
21be06310c | ||
|
6e27e79c8b | ||
|
e2d821fa59 | ||
|
8d001e3573 | ||
|
f6afa3d03f | ||
|
3286221870 | ||
|
f4e32f29e1 | ||
|
226e0eadf0 | ||
|
1f58e0ed6b | ||
|
1ee5c2cac4 | ||
|
97fb1c7757 | ||
|
dff9a5a195 | ||
|
b9fb2f0933 | ||
|
0791924bf7 | ||
|
90870194ff | ||
|
c593f86ac6 | ||
|
ad3ded7ba0 | ||
|
3f9b8f25d8 | ||
|
8ad38e5ae5 | ||
|
0cd2946676 | ||
|
5473d13470 | ||
|
31ccb7ca70 | ||
|
dba1926a42 | ||
|
b1b12a239f | ||
|
44ce36bef5 | ||
|
84d2150077 | ||
|
3f61360fa1 | ||
|
7fb9f21ee0 | ||
|
d733078766 | ||
|
cb6e48e22b | ||
|
f39ae35e4b | ||
|
daea92ea00 | ||
|
b98c7214ef | ||
|
3412d18dc2 | ||
|
3bc8ab91a2 | ||
|
f9d5869774 | ||
|
20ccb53c42 | ||
|
f9a589c7fd | ||
|
ddd044f283 | ||
|
3569348f9c | ||
|
9e8e3eb0ca | ||
|
87121998a2 | ||
|
68d6c51dbc | ||
|
4551aef081 | ||
|
0249bd4f8a | ||
|
b11c69b4a8 | ||
|
84351ba9e5 | ||
|
9a1da43890 | ||
|
c78ba42051 | ||
|
e0730bc118 | ||
|
7d9a8a6ec0 | ||
|
07e0411b98 | ||
|
b66e4cd64c | ||
|
254feda16b | ||
|
c6471ee874 | ||
|
261b8c7ee6 | ||
|
f58f0732c2 | ||
|
c5a4a26f06 | ||
|
faff08193a | ||
|
3046358d38 | ||
|
e81f033ece | ||
|
5c608fe070 | ||
|
a2db956492 | ||
|
8d51038cb1 | ||
|
86c86e0860 | ||
|
324f5472a2 | ||
|
c20360dd98 | ||
|
1b6252ebf0 | ||
|
b4c8ba4de7 | ||
|
ad34f731e9 | ||
|
198207f1ff | ||
|
6120f11ed3 | ||
|
0a440a804f | ||
|
117fc68195 | ||
|
f310609a66 | ||
|
8001c7d972 | ||
|
023b695422 | ||
|
ec6ce0707a | ||
|
f37573f8dc | ||
|
49f8b571b9 | ||
|
e1cd996617 | ||
|
24cc721bc6 | ||
|
d41580adfc | ||
|
3ab65b7da2 | ||
|
79238b0d8f | ||
|
2e0a56665a | ||
|
76826cfa2f | ||
|
37671d2bd0 | ||
|
04d24b7cd2 | ||
|
085d34cbb0 | ||
|
46143492a2 | ||
|
a475d72d47 | ||
|
a8f712b09a | ||
|
2fb202187c | ||
|
207c0b32b4 | ||
|
35f60dc918 | ||
|
1cd9396154 | ||
|
de73ac980f | ||
|
acaec5f186 | ||
|
c8589a9a2f | ||
|
a31e5f7a8c | ||
|
e0a01ba174 | ||
|
98e076b51e | ||
|
f3db19d694 | ||
|
607502ef43 | ||
|
acddc317da | ||
|
7f99c1e588 | ||
|
5f3e5a0406 | ||
|
23080d47b5 | ||
|
f0d2f99239 | ||
|
e7b9ecc99a | ||
|
dce8c11b07 | ||
|
7ccec19501 | ||
|
93b643c44d | ||
|
21616f6e2e | ||
|
8157004068 | ||
|
8d69bda27a | ||
|
dbdb81f411 | ||
|
28fbcf6abe | ||
|
1fd339c46f | ||
|
b830bdca37 | ||
|
45bc4ed321 | ||
|
3988847a05 | ||
|
9c862d7736 | ||
|
d99ae4b6c2 | ||
|
96f9cbcabf | ||
|
3597f7e8b1 | ||
|
38227dc972 | ||
|
aa50e92c65 | ||
|
753ad64cbc | ||
|
3fb44ae651 | ||
|
76fb80f46c | ||
|
684b6459f1 | ||
|
904a9d0c98 | ||
|
32e256e5ab | ||
|
d4d46e8125 | ||
|
661720ef8b | ||
|
013591d68d | ||
|
a938c14d11 | ||
|
d6cc10ea74 | ||
|
f25832455f | ||
|
42ea95c54e | ||
|
46e7b44ffa | ||
|
a27737b04e | ||
|
bd2d07e671 | ||
|
fde21b57cd | ||
|
637bd13f3f | ||
|
eadd90c22e | ||
|
279cb5717c | ||
|
b91fbfd5a0 | ||
|
88086ea91a | ||
|
0842d084dd | ||
|
838b25177f | ||
|
b39d0cec3c | ||
|
f0c72bdc3b | ||
|
427d216081 | ||
|
dc8b5f75a4 | ||
|
b6f2969872 | ||
|
6eed78e3de | ||
|
c4aa060118 | ||
|
0bf4c2420d | ||
|
aac2556762 | ||
|
f813bc1823 | ||
|
ca233ad9ae | ||
|
e6631a7b66 | ||
|
fbe0e32813 | ||
|
2594593de2 | ||
|
ef982b7d46 | ||
|
0432b850c5 | ||
|
1b362d1f01 | ||
|
7ce968f297 | ||
|
0e15b4a367 | ||
|
de0942b0b8 | ||
|
b804235aea | ||
|
6bc32a3d5d | ||
|
5e24454764 | ||
|
d9cf0ff684 | ||
|
5b78a3048f | ||
|
676ac380cd | ||
|
dce2c58799 | ||
|
f3d1666394 | ||
|
8af0782261 | ||
|
df18223487 | ||
|
b678d12c2d | ||
|
a0e6353667 | ||
|
bea7ccb41f | ||
|
9895f2bd3a | ||
|
721a12826d | ||
|
4b40cc27a9 | ||
|
c92e53622f | ||
|
c31185b419 | ||
|
5ff59c12b0 | ||
|
d3c0899000 | ||
|
32334b2e83 | ||
|
ea527812a0 | ||
|
01851e04fc | ||
|
299c53201d | ||
|
bfb5e6e72f | ||
|
1fab3d9e20 | ||
|
f950172731 | ||
|
9c9b4e6832 | ||
|
2deb0e7e1d | ||
|
6f6ea51290 | ||
|
11428fb869 | ||
|
d465523f65 | ||
|
14d97cf547 | ||
|
cb3d61bb0e | ||
|
f756c3b8a0 | ||
|
220c516691 | ||
|
ba07279c95 | ||
|
ef9dc43474 | ||
|
c6aa90f176 | ||
|
74352e0bee | ||
|
5c8a870510 | ||
|
7a29462ca6 | ||
|
c3c36d45e5 | ||
|
d89df8a980 | ||
|
7699b43ffe | ||
|
ea7a43beb4 | ||
|
70bf6d4b97 | ||
|
7cd9ea497b | ||
|
0a4a7b310d | ||
|
a26f400576 | ||
|
a97845c380 | ||
|
7f6213291d | ||
|
f184393f07 | ||
|
1f37600c4c | ||
|
08d8f2bb80 | ||
|
b14f0b8987 | ||
|
edbc99104f | ||
|
285293ac17 | ||
|
6f7d9f9613 | ||
|
fe822a0a24 | ||
|
69d4081ff8 | ||
|
c9d8ff21d2 | ||
|
824743a395 | ||
|
5d778175ee | ||
|
358ad227d5 | ||
|
9700543e02 | ||
|
ecc4c4f368 | ||
|
31b65e6721 | ||
|
cfcca335b1 | ||
|
3ea39210cd | ||
|
b79220ca19 | ||
|
faafd23225 | ||
|
62acb80671 | ||
|
cf6f9ad4cf | ||
|
c6ea37144c | ||
|
89c1a66403 | ||
|
c4c897f921 | ||
|
0d4ad02353 | ||
|
d21546d79b | ||
|
624c30ecd2 | ||
|
25abd88fc4 | ||
|
e493b9b702 | ||
|
6e0f1800c8 | ||
|
528f1f085e | ||
|
09cd6e3b5f | ||
|
2cc30f75a0 | ||
|
222805d580 | ||
|
56b42a2ee9 | ||
|
c9839b2069 | ||
|
b842bf7bf5 | ||
|
edccf89020 | ||
|
1825aa377b | ||
|
e59c6abd91 | ||
|
dc88a1ebc4 | ||
|
165a21f4bc | ||
|
9cb9843367 | ||
|
95754aa71f | ||
|
f559de112b | ||
|
9d1f348129 | ||
|
cf3aa570c2 | ||
|
7c2ce72b5f | ||
|
5371055495 | ||
|
4d6acd5d76 | ||
|
285e67c044 | ||
|
d7987e73c9 | ||
|
e13a8102b4 | ||
|
e720006110 | ||
|
12c4766dd0 | ||
|
df19224b20 | ||
|
167208c811 | ||
|
0187e91843 | ||
|
c70c677b5a | ||
|
5c31c721af | ||
|
7a08177a3d | ||
|
ad4142df19 | ||
|
ff4d61c087 | ||
|
fabef39f7f | ||
|
64fd5158bf | ||
|
8e4e4401c5 | ||
|
167f49caf7 | ||
|
6e7748b266 | ||
|
447dfc029f | ||
|
aed70a82c7 | ||
|
5b6031f7e4 | ||
|
e54e72b290 | ||
|
e5ea6cfcb5 | ||
|
998c1f83a6 | ||
|
41bb875221 | ||
|
365400c13e | ||
|
e2fcca4e60 | ||
|
0189b0c903 | ||
|
aacab81a3e | ||
|
4152e14e32 | ||
|
57b3cd56d7 | ||
|
7a45768efe | ||
|
3a56da60dd | ||
|
896104939b | ||
|
19f4fce931 | ||
|
19d9d69343 | ||
|
68af572ba4 | ||
|
0eb837e4ca | ||
|
5b5a68c5db | ||
|
d2e0553384 | ||
|
c2c4133eb0 | ||
|
058986714c | ||
|
91bbce3fef | ||
|
0230cc55bc | ||
|
6f5675ef3c | ||
|
396513183b | ||
|
720fd2cd40 | ||
|
da7cd6ae25 | ||
|
8bae5348f9 | ||
|
fb4ffa468c | ||
|
0245ac2106 | ||
|
b2089b89cc | ||
|
56a88f107c | ||
|
96bf90abe4 | ||
|
081210688c | ||
|
fcde8aa94f | ||
|
bcac81eed9 | ||
|
0c7e7184e7 | ||
|
1e372f57f9 | ||
|
1ea1decfd6 | ||
|
04dfbf7513 | ||
|
f273eca7e3 | ||
|
53a28f7672 | ||
|
5261bc6585 | ||
|
ba3a502079 | ||
|
7c369f309a | ||
|
50906baee1 | ||
|
5bc8f8826f | ||
|
4e7eccbb49 | ||
|
27e47d5df6 | ||
|
7002688398 | ||
|
54167ec3fa | ||
|
a966fe1ed5 | ||
|
ab801fe782 | ||
|
43778bef4d | ||
|
f1ba94843e | ||
|
f932d35c95 | ||
|
b58a366dc6 | ||
|
f30ba56323 | ||
|
4dfe2e6e2f | ||
|
90c5a5ff6b | ||
|
6040a7370c | ||
|
c8d7b4a79a | ||
|
fad21d8dda | ||
|
8385543e1c |
@@ -13,15 +13,21 @@ stages:
|
||||
- subprojects/pango/
|
||||
|
||||
fedora-x86_64:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v3
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v5
|
||||
stage: build
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/test-docker.sh
|
||||
artifacts:
|
||||
when: on_failure
|
||||
when: always
|
||||
reports:
|
||||
junit:
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
name: "gtk-${CI_COMMIT_REF_NAME}"
|
||||
paths:
|
||||
- "${CI_PROJECT_DIR}/_build/meson-logs"
|
||||
- "${CI_PROJECT_DIR}/_build/report.xml"
|
||||
- "${CI_PROJECT_DIR}/_build/report.html"
|
||||
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*.png"
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
<<: *cache-paths
|
||||
@@ -53,18 +59,49 @@ msys2-mingw32:
|
||||
script:
|
||||
- bash -x ./.gitlab-ci/flatpak-build.sh "${APPID}"
|
||||
|
||||
flatpak:demo:
|
||||
variables:
|
||||
APPID: org.gtk.Demo
|
||||
# Manual jobs, for branches and MRs
|
||||
.flatpak-manual: &flatpak-manual
|
||||
<<: *flatpak-defaults
|
||||
when: manual
|
||||
|
||||
flatpak:widget-factory:
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory
|
||||
# Only build Flatpak bundles automatically on master
|
||||
.flatpak-master: &flatpak-master
|
||||
<<: *flatpak-defaults
|
||||
only:
|
||||
- master
|
||||
|
||||
flatpak-manual:demo:
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
<<: *flatpak-manual
|
||||
|
||||
flatpak-master:demo:
|
||||
variables:
|
||||
APPID: org.gtk.Demo4
|
||||
<<: *flatpak-master
|
||||
|
||||
flatpak-manual:widget-factory:
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
<<: *flatpak-manual
|
||||
|
||||
flatpak-master:widget-factory:
|
||||
variables:
|
||||
APPID: org.gtk.WidgetFactory4
|
||||
<<: *flatpak-master
|
||||
|
||||
flatpak-manual:icon-browser:
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
<<: *flatpak-manual
|
||||
|
||||
flatpak-master:icon-browser:
|
||||
variables:
|
||||
APPID: org.gtk.IconBrowser4
|
||||
<<: *flatpak-master
|
||||
|
||||
pages:
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v3
|
||||
image: registry.gitlab.gnome.org/gnome/gtk/master:v4
|
||||
stage: deploy
|
||||
script:
|
||||
- meson -Ddocumentation=true _build .
|
||||
|
@@ -11,6 +11,7 @@ RUN dnf -y install \
|
||||
ccache \
|
||||
colord-devel \
|
||||
cups-devel \
|
||||
dejavu-sans-mono-fonts \
|
||||
desktop-file-utils \
|
||||
elfutils-libelf-devel \
|
||||
fribidi-devel \
|
||||
@@ -72,6 +73,8 @@ RUN dnf -y install \
|
||||
|
||||
RUN pip3 install meson==0.50.0
|
||||
|
||||
RUN pip3 install jinja2
|
||||
|
||||
ARG HOST_USER_ID=5555
|
||||
ENV HOST_USER_ID ${HOST_USER_ID}
|
||||
RUN useradd -u $HOST_USER_ID -ms /bin/bash user
|
||||
|
363
.gitlab-ci/meson-html-report.py
Executable file
@@ -0,0 +1,363 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Turns a Mason testlog.json file into an HTML report
|
||||
#
|
||||
# Copyright 2019 GNOME Foundation
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# Original author: Emmanuele Bassi
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from jinja2 import Template
|
||||
|
||||
REPORT_TEMPLATE = '''
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<title>{{ report.project_name }} Test Report</title>
|
||||
<meta charset="utf-8" />
|
||||
<style type="text/css">
|
||||
body {
|
||||
background: white;
|
||||
color: #333;
|
||||
font-family: 'Cantarell', sans-serif;
|
||||
}
|
||||
|
||||
h1 {
|
||||
color: #333333;
|
||||
font-size: 1.9em;
|
||||
font-weight: normal;
|
||||
margin-bottom: 1em;
|
||||
border-bottom: 1px solid #333333;
|
||||
}
|
||||
|
||||
header {
|
||||
position: fixed;
|
||||
padding-bottom: 12px;
|
||||
margin-bottom: 24px;
|
||||
background: rgba(255, 255, 255, 0.85);
|
||||
box-shadow: 0 0 1px rgba(0, 0, 0, 0.15);
|
||||
z-index: 500;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
color: rgba(0, 0, 0, 0.3);
|
||||
transform: translateY(0px);
|
||||
transition: .2s background-color, color;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
visibility: visible;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
article {
|
||||
padding-top: 200px;
|
||||
margin: 2em;
|
||||
}
|
||||
|
||||
div.report-meta {
|
||||
width: auto;
|
||||
border: 1px solid #ccc;
|
||||
padding: .5em 2em;
|
||||
color: #3c3c3c;
|
||||
}
|
||||
|
||||
span.result {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
span.pass {
|
||||
color: rgb(51, 209, 122);
|
||||
}
|
||||
|
||||
span.skip {
|
||||
color: rgb(255, 163, 72);
|
||||
}
|
||||
|
||||
span.fail {
|
||||
color: rgb(224, 27, 36);
|
||||
}
|
||||
|
||||
span.xfail {
|
||||
color: rgb(163, 71, 186);
|
||||
}
|
||||
|
||||
div.result {
|
||||
border-top: 1px solid #c0c0c0;
|
||||
padding-top: 1em;
|
||||
padding-bottom: 1em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.result h4 {
|
||||
border-bottom: 1px solid #c0c0c0;
|
||||
margin-bottom: 0.7em;
|
||||
}
|
||||
|
||||
pre {
|
||||
color: #fafafa;
|
||||
background-color: black;
|
||||
border-radius: 6px;
|
||||
box-shadow: 0px 5px 8px 0px rgba(0, 0, 0, 0.25);
|
||||
font-family: monospace;
|
||||
line-height: 1.2em;
|
||||
border: none;
|
||||
padding: 10px 1em;
|
||||
font-size: 0.9em;
|
||||
overflow: auto;
|
||||
white-space: pre;
|
||||
word-break: normal;
|
||||
word-wrap: normal;
|
||||
}
|
||||
|
||||
ul.passed li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
ul.passed li:after {
|
||||
content: ",";
|
||||
}
|
||||
|
||||
ul.passed li:last-child:after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
ul.images {
|
||||
padding-bottom: 1em;
|
||||
}
|
||||
|
||||
ul.images li {
|
||||
display: inline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>{{ report.project_name }} :: Test Reports</h1>
|
||||
<div class="report-meta">
|
||||
<p><strong>Branch:</strong> {{ report.branch_name }}</p>
|
||||
<p><strong>Date:</strong> <time datetime="{{ report.date.isoformat() }}">{{ report.locale_date }}</time></p>
|
||||
{% if report.job_id %}<p><strong>Job ID:</strong> {{ report.job_id }}</p>{% endif %}
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<article>
|
||||
<section>
|
||||
<div class="summary">
|
||||
<h3>Summary</h3>
|
||||
<ul>
|
||||
<li><strong>Total units:</strong> {{ report.total_units }}</li>
|
||||
<li><strong>Passed:</strong> {{ report.total_successes }}</li>
|
||||
<li><strong>Failed:</strong> {{ report.total_failures }}</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% for suite_result in report.results_list %}
|
||||
<section>
|
||||
<div class="result">
|
||||
<h3>Suite: {{ suite_result.suite_name }}</h3>
|
||||
<ul>
|
||||
<li><strong>Units:</strong> {{ suite_result.n_units }}</li>
|
||||
<li><strong>Passed:</strong> {{ suite_result.n_successes }}</li>
|
||||
<li><strong>Failed:</strong> {{ suite_result.n_failures }}</li>
|
||||
</ul>
|
||||
|
||||
<div class="successes">
|
||||
<h4>Passed</h4>
|
||||
<ul class="passed">
|
||||
{% for success in suite_result.successes if success.result == 'OK' %}
|
||||
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4>Skipped</h4>
|
||||
<ul>
|
||||
{% for success in suite_result.successes if success.result == 'SKIP' %}
|
||||
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4>Expected failures</h4>
|
||||
<ul>
|
||||
{% for success in suite_result.successes if success.result == 'EXPECTEDFAIL' %}
|
||||
<li>{{ success.name }} - result: <span class="result xfail">{{ success.result }}</span><br/>
|
||||
{% if success.stdout %}
|
||||
Output: <pre>{{ success.stdout }}</pre>
|
||||
{% endif %}
|
||||
{% if success.image_data is defined %}
|
||||
<ul class="images">
|
||||
<li><img alt="ref" src="{{ success.image_data.ref }}" /></li>
|
||||
<li><img alt="out" src="{{ success.image_data.out }}" /></li>
|
||||
<li><img alt="diff" src="{{ success.image_data.diff }}" /></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div class="failures">
|
||||
<h4>Failed</h4>
|
||||
<ul class="failed">
|
||||
{% for failure in suite_result.failures if failure.result == 'FAIL' %}
|
||||
<li>{{ failure.name }} - result: <span class="result fail">{{ failure.result }}</span><br/>
|
||||
{% if failure.stdout %}
|
||||
Output: <pre>{{ failure.stdout }}</pre>
|
||||
{% endif %}
|
||||
{% if failure.image_data is defined %}
|
||||
<ul class="images">
|
||||
<li><img alt="ref" src="{{ failure.image_data.ref }}" /></li>
|
||||
<li><img alt="out" src="{{ failure.image_data.out }}" /></li>
|
||||
<li><img alt="diff" src="{{ failure.image_data.diff }}" /></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h4>Timed out</h4>
|
||||
<ul class="failed">
|
||||
{% for failure in suite_result.failures if failure.result == 'TIMEOUT' %}
|
||||
<li>{{ failure.name }} - result: <span class="result fail">{{ failure.result }}</span><br/>
|
||||
{% if failure.stdout %}
|
||||
Output: <pre>{{ failure.stdout }}</pre>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</section>
|
||||
{% endfor %}
|
||||
|
||||
</article>
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
|
||||
aparser = argparse.ArgumentParser(description='Turns a Meson test log into an HTML report')
|
||||
aparser.add_argument('--project-name', metavar='NAME',
|
||||
help='The project name',
|
||||
default='Unknown')
|
||||
aparser.add_argument('--job-id', metavar='ID',
|
||||
help='The job ID for the report',
|
||||
default=None)
|
||||
aparser.add_argument('--branch', metavar='NAME',
|
||||
help='Branch of the project being tested',
|
||||
default='master')
|
||||
aparser.add_argument('--output', metavar='FILE',
|
||||
help='The output HTML file, stdout by default',
|
||||
type=argparse.FileType('w', encoding='UTF-8'),
|
||||
default=sys.stdout)
|
||||
aparser.add_argument('--reftest-suite', metavar='NAME',
|
||||
help='The name of the reftests suite',
|
||||
default='reftest')
|
||||
aparser.add_argument('--reftest-output-dir', metavar='DIR',
|
||||
help='The output directory for reftests data',
|
||||
default=None)
|
||||
aparser.add_argument('infile', metavar='FILE',
|
||||
help='The input testlog.json, stdin by default',
|
||||
type=argparse.FileType('r', encoding='UTF-8'),
|
||||
default=sys.stdin)
|
||||
|
||||
args = aparser.parse_args()
|
||||
|
||||
outfile = args.output
|
||||
|
||||
suites = {}
|
||||
for line in args.infile:
|
||||
data = json.loads(line)
|
||||
(full_suite, unit_name) = data['name'].split(' / ')
|
||||
(project_name, suite_name) = full_suite.split(':')
|
||||
|
||||
unit = {
|
||||
'project-name': project_name,
|
||||
'suite': suite_name,
|
||||
'name': unit_name,
|
||||
'duration': data['duration'],
|
||||
'returncode': data['returncode'],
|
||||
'result': data['result'],
|
||||
'stdout': data['stdout'],
|
||||
}
|
||||
|
||||
if args.reftest_output_dir is not None and suite_name == args.reftest_suite:
|
||||
filename = unit_name.split(' ')[1]
|
||||
basename = os.path.splitext(filename)[0]
|
||||
|
||||
image_data = {
|
||||
'ref': os.path.join(args.reftest_output_dir, '{}.ref.png'.format(basename)),
|
||||
'out': os.path.join(args.reftest_output_dir, '{}.out.png'.format(basename)),
|
||||
'diff': os.path.join(args.reftest_output_dir, '{}.diff.png'.format(basename)),
|
||||
}
|
||||
|
||||
unit['image_data'] = image_data
|
||||
|
||||
units = suites.setdefault(full_suite, [])
|
||||
units.append(unit)
|
||||
|
||||
report = {}
|
||||
report['date'] = datetime.datetime.utcnow()
|
||||
report['locale_date'] = report['date'].strftime("%c")
|
||||
report['project_name'] = args.project_name
|
||||
report['job_id'] = args.job_id
|
||||
report['branch_name'] = args.branch
|
||||
report['total_successes'] = 0
|
||||
report['total_failures'] = 0
|
||||
report['total_units'] = 0
|
||||
report['results_list'] = []
|
||||
|
||||
for name, units in suites.items():
|
||||
(project_name, suite_name) = name.split(':')
|
||||
print('Processing {} suite {}:'.format(project_name, suite_name))
|
||||
|
||||
def if_failed(unit):
|
||||
if unit['result'] in ['FAIL', 'TIMEOUT']:
|
||||
return True
|
||||
return False
|
||||
|
||||
def if_succeded(unit):
|
||||
if unit['result'] in ['OK', 'EXPECTEDFAIL', 'SKIP']:
|
||||
return True
|
||||
return False
|
||||
|
||||
successes = list(filter(if_succeded, units))
|
||||
failures = list(filter(if_failed, units))
|
||||
|
||||
n_units = len(units)
|
||||
n_successes = len(successes)
|
||||
n_failures = len(failures)
|
||||
|
||||
report['total_units'] += n_units
|
||||
report['total_successes'] += n_successes
|
||||
report['total_failures'] += n_failures
|
||||
print(' - {}: {} total, {} pass, {} fail'.format(suite_name, n_units, n_successes, n_failures))
|
||||
|
||||
suite_report = {
|
||||
'suite_name': suite_name,
|
||||
'n_units': n_units,
|
||||
'successes': successes,
|
||||
'n_successes': n_successes,
|
||||
'failures': failures,
|
||||
'n_failures': n_failures,
|
||||
}
|
||||
report['results_list'].append(suite_report)
|
||||
|
||||
template = Template(REPORT_TEMPLATE)
|
||||
outfile.write(template.render({'report': report}))
|
109
.gitlab-ci/meson-junit-report.py
Executable file
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Turns a Meson testlog.json file into a JUnit XML report
|
||||
#
|
||||
# Copyright 2019 GNOME Foundation
|
||||
#
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
#
|
||||
# Original author: Emmanuele Bassi
|
||||
|
||||
import argparse
|
||||
import datetime
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
aparser = argparse.ArgumentParser(description='Turns a Meson test log into a JUnit report')
|
||||
aparser.add_argument('--project-name', metavar='NAME',
|
||||
help='The project name',
|
||||
default='unknown')
|
||||
aparser.add_argument('--job-id', metavar='ID',
|
||||
help='The job ID for the report',
|
||||
default='Unknown')
|
||||
aparser.add_argument('--branch', metavar='NAME',
|
||||
help='Branch of the project being tested',
|
||||
default='master')
|
||||
aparser.add_argument('--output', metavar='FILE',
|
||||
help='The output file, stdout by default',
|
||||
type=argparse.FileType('w', encoding='UTF-8'),
|
||||
default=sys.stdout)
|
||||
aparser.add_argument('infile', metavar='FILE',
|
||||
help='The input testlog.json, stdin by default',
|
||||
type=argparse.FileType('r', encoding='UTF-8'),
|
||||
default=sys.stdin)
|
||||
|
||||
args = aparser.parse_args()
|
||||
|
||||
outfile = args.output
|
||||
|
||||
testsuites = ET.Element('testsuites')
|
||||
testsuites.set('id', '{}/{}'.format(args.job_id, args.branch))
|
||||
testsuites.set('package', args.project_name)
|
||||
testsuites.set('timestamp', datetime.datetime.utcnow().isoformat(timespec='minutes'))
|
||||
|
||||
suites = {}
|
||||
for line in args.infile:
|
||||
data = json.loads(line)
|
||||
(full_suite, unit_name) = data['name'].split(' / ')
|
||||
(project_name, suite_name) = full_suite.split(':')
|
||||
|
||||
duration = data['duration']
|
||||
return_code = data['returncode']
|
||||
log = data['stdout']
|
||||
|
||||
unit = {
|
||||
'suite': suite_name,
|
||||
'name': unit_name,
|
||||
'duration': duration,
|
||||
'returncode': return_code,
|
||||
'stdout': log,
|
||||
}
|
||||
|
||||
units = suites.setdefault(suite_name, [])
|
||||
units.append(unit)
|
||||
|
||||
for name, units in suites.items():
|
||||
print('Processing suite {} (units: {})'.format(name, len(units)))
|
||||
|
||||
def if_failed(unit):
|
||||
if unit['returncode'] != 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
def if_succeded(unit):
|
||||
if unit['returncode'] == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
successes = list(filter(if_succeded, units))
|
||||
failures = list(filter(if_failed, units))
|
||||
print(' - {}: {} pass, {} fail'.format(name, len(successes), len(failures)))
|
||||
|
||||
testsuite = ET.SubElement(testsuites, 'testsuite')
|
||||
testsuite.set('name', '{}/{}'.format(args.project_name, name))
|
||||
testsuite.set('tests', str(len(units)))
|
||||
testsuite.set('errors', str(len(failures)))
|
||||
testsuite.set('failures', str(len(failures)))
|
||||
|
||||
for unit in successes:
|
||||
testcase = ET.SubElement(testsuite, 'testcase')
|
||||
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
|
||||
testcase.set('name', unit['name'])
|
||||
testcase.set('time', str(unit['duration']))
|
||||
|
||||
for unit in failures:
|
||||
testcase = ET.SubElement(testsuite, 'testcase')
|
||||
testcase.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
|
||||
testcase.set('name', unit['name'])
|
||||
testcase.set('time', str(unit['duration']))
|
||||
|
||||
failure = ET.SubElement(testcase, 'failure')
|
||||
failure.set('classname', '{}/{}'.format(args.project_name, unit['suite']))
|
||||
failure.set('name', unit['name'])
|
||||
failure.set('type', 'error')
|
||||
failure.text = unit['stdout']
|
||||
|
||||
output = ET.tostring(testsuites, encoding='unicode')
|
||||
outfile.write(output)
|
@@ -2,7 +2,7 @@
|
||||
|
||||
set -e
|
||||
|
||||
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v3"
|
||||
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v4"
|
||||
|
||||
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
|
||||
--file "Dockerfile" .
|
||||
|
@@ -16,6 +16,7 @@ meson \
|
||||
-Dwayland-backend=true \
|
||||
-Dbroadway-backend=true \
|
||||
-Dvulkan=yes \
|
||||
--werror \
|
||||
_build $srcdir
|
||||
unset CCACHE_DISABLE
|
||||
|
||||
@@ -24,11 +25,30 @@ cd _build
|
||||
ninja
|
||||
ccache --show-stats
|
||||
|
||||
set +e
|
||||
|
||||
xvfb-run -a -s "-screen 0 1024x768x24" \
|
||||
meson test \
|
||||
--timeout-multiplier 2 \
|
||||
--print-errorlogs \
|
||||
--suite=gtk \
|
||||
--no-suite=gtk:gsk \
|
||||
--no-suite=gtk:reftest \
|
||||
--no-suite=gtk:a11y
|
||||
|
||||
# Save the exit code
|
||||
exit_code=$?
|
||||
|
||||
# We always want to run the report generators
|
||||
$srcdir/.gitlab-ci/meson-junit-report.py \
|
||||
--project-name=gtk \
|
||||
--job-id="${CI_JOB_NAME}" \
|
||||
--output=report.xml \
|
||||
meson-logs/testlog.json
|
||||
|
||||
$srcdir/.gitlab-ci/meson-html-report.py \
|
||||
--project-name=GTK \
|
||||
--job-id="${CI_JOB_NAME}" \
|
||||
--reftest-output-dir="testsuite/reftests/output" \
|
||||
--output=report.html \
|
||||
meson-logs/testlog.json
|
||||
|
||||
exit $exit_code
|
||||
|
@@ -26,7 +26,7 @@
|
||||
- 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
|
||||
- If you built GTK yourself, the list of options used to configure the build
|
||||
-->
|
||||
|
||||
## Additional information
|
||||
|
@@ -16,7 +16,7 @@
|
||||
- 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
|
||||
- If you built GTK yourself, the list of options used to configure the build
|
||||
-->
|
||||
|
||||
## Warnings
|
||||
|
102
NEWS
@@ -1,3 +1,105 @@
|
||||
Overview of Changes in GTK+ 3.96.0
|
||||
==================================
|
||||
|
||||
* DND has been refactored. There are now separate GdkDrag and GdkDrop
|
||||
objects. This work is still incomplete
|
||||
|
||||
* The GDK_SURFACE_SUBSURFACE surface type has been removed.
|
||||
|
||||
* Use of child surfaces has been greatly reduced. This work is still
|
||||
incomplete
|
||||
|
||||
* The use of global coordinates in GDK apis has been reduced. This
|
||||
work is still incomplete
|
||||
|
||||
* Events have been simplified and are used just for input
|
||||
- expose events have been replaced by a GdkSurface::render signal
|
||||
- configure events have been replaced by a GdkSurface::size-changed signal
|
||||
- map events have been replaced by a GdkSurface::mapped property
|
||||
- gdk_event_handler_set has been replaced by a GdkSurface::event signal
|
||||
- key events no longer contain a string
|
||||
- events on unmapped widgets are ignored
|
||||
|
||||
* Warping the pointer is no longer supported
|
||||
|
||||
* The Wayland backend now uses the Settings portal for GtkSettings
|
||||
|
||||
* The Wayland input module uses the text-input-unstable-v3 protocol
|
||||
|
||||
* The Broadway backend has been rewritten to work well with GSK
|
||||
|
||||
* The color chooser has a color picker
|
||||
|
||||
* GtkApplication tracks screensaver state and has a ::query-end signal
|
||||
|
||||
* The file chooser portal backend supports file filters
|
||||
|
||||
* A number of list models have been introduced, for internal use
|
||||
and as public api:
|
||||
- GtkMapListModel
|
||||
- GtkSliceListModel
|
||||
- GtkSortListModel
|
||||
- GtkSelectionModel
|
||||
- GtkSingleSelection
|
||||
|
||||
* Support for tabular menus and combo boxes has been dropped
|
||||
|
||||
* Key themes are no longer supported
|
||||
|
||||
* GtkInvisible has been dropped
|
||||
|
||||
* A GtkRoot interface has been added that is currently implemented
|
||||
just by GtkWindow. This work is incomplete
|
||||
|
||||
* GtkWidgets can transform their children using projective linear
|
||||
transformations. This functionality is available in CSS and
|
||||
as GskTransform argument to gtk_widget_allocate. GtkFixed is
|
||||
a container that exposes this functionality. For examples of this,
|
||||
see the swing transition of GtkRevealer, the rotate transitions
|
||||
of GtkStack or the Fixed Layout example in gtk-demo.
|
||||
|
||||
* GtkEntry functionality has been moved into a new GtkText widget,
|
||||
the GtkEditable interface has been expanded, and new a new
|
||||
GtkPasswordEntry widget has been introduced.
|
||||
|
||||
* Focus handling has been rewritten, and focus-change event
|
||||
generation has been unified with crossing events.
|
||||
|
||||
* All demos and settings schemas have been renamed to avoid collisions
|
||||
with GTK3.
|
||||
|
||||
* GtkWidget can now use a GtkLayoutManager for size allocation.
|
||||
Layout managers can optionally use layout children holding layout
|
||||
properties. A number of layout managers are available:
|
||||
- GtkBinLayout
|
||||
- GtkBoxLayout
|
||||
- GtkGridLayout
|
||||
- GtkFixedLayout
|
||||
- GtkCustomLayout
|
||||
More layout manager implementations will appear in the future.
|
||||
|
||||
* GtkAssistant, GtkStack and GtkNotebook now have publicly
|
||||
accessible page objects for their children. The page objects
|
||||
are also exposed via a list model.
|
||||
|
||||
* GtkContainer no longer supports child properties. All existing
|
||||
child properties have been removed, converted to regular properties,
|
||||
moved to layout properties or moved to child meta objects.
|
||||
|
||||
* GtkListBox has gained a ::show-separators property that gets
|
||||
translated into a CSS style class.
|
||||
|
||||
* A number of X11-specific GtkWindow and GdkSurface apis have been
|
||||
removed or changed to backend APIs.
|
||||
|
||||
* GtkBuilder can specify object-valued properties inline.
|
||||
|
||||
* The gtk4-builder-tool simplify command has gained a --3to4 option
|
||||
to convert GTK3 ui files to GTK4.
|
||||
|
||||
* The inspector can show child meta objects and layout properties.
|
||||
|
||||
|
||||
Overview of Changes in GTK+ 3.94.0
|
||||
==================================
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"app-id": "org.gtk.Demo",
|
||||
"app-id": "org.gtk.Demo4",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "master",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
@@ -9,10 +9,9 @@
|
||||
"finish-args": [
|
||||
"--device=dri",
|
||||
"--share=ipc",
|
||||
"--socket=x11",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*",
|
||||
"--talk-name=ca.desrt.conf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
|
||||
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
|
||||
],
|
||||
"cleanup": [
|
||||
"/include",
|
72
build-aux/flatpak/org.gtk.IconBrowser4.json
Normal file
@@ -0,0 +1,72 @@
|
||||
{
|
||||
"app-id": "org.gtk.IconBrowser4",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "master",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
"command": "gtk4-icon-browser",
|
||||
"tags": ["devel", "development", "nightly"],
|
||||
"desktop-file-name-prefix": "(Development) ",
|
||||
"finish-args": [
|
||||
"--device=dri",
|
||||
"--share=ipc",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
|
||||
],
|
||||
"cleanup": [
|
||||
"/include",
|
||||
"/lib/pkgconfig", "/share/pkgconfig",
|
||||
"/share/aclocal",
|
||||
"/man", "/share/man", "/share/gtk-doc",
|
||||
"*.la", ".a",
|
||||
"/lib/girepository-1.0",
|
||||
"/share/gir-1.0",
|
||||
"/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",
|
||||
"-Dtests=false",
|
||||
"-Dbenchmarks=false"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://github.com/ebassi/graphene.git"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "gtk",
|
||||
"buildsystem": "meson",
|
||||
"builddir": true,
|
||||
"config-opts": [
|
||||
"--libdir=/app/lib"
|
||||
],
|
||||
"sources": [
|
||||
{
|
||||
"type": "git",
|
||||
"url": "https://gitlab.gnome.org/GNOME/gtk.git"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"app-id": "org.gtk.WidgetFactory",
|
||||
"app-id": "org.gtk.WidgetFactory4",
|
||||
"runtime": "org.gnome.Platform",
|
||||
"runtime-version": "master",
|
||||
"sdk": "org.gnome.Sdk",
|
||||
@@ -9,10 +9,9 @@
|
||||
"finish-args": [
|
||||
"--device=dri",
|
||||
"--share=ipc",
|
||||
"--socket=x11",
|
||||
"--socket=fallback-x11",
|
||||
"--socket=wayland",
|
||||
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*",
|
||||
"--talk-name=ca.desrt.conf", "--env=DCONF_USER_CONFIG_DIR=.config/dconf"
|
||||
"--talk-name=org.gtk.vfs", "--talk-name=org.gtk.vfs.*"
|
||||
],
|
||||
"cleanup": [
|
||||
"/include",
|
@@ -19,7 +19,7 @@ if 'DESTDIR' not in os.environ:
|
||||
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
|
||||
|
||||
print('Updating icon cache...')
|
||||
subprocess.call(['gtk-update-icon-cache', '-q', '-t' ,'-f',
|
||||
subprocess.call(['gtk4-update-icon-cache', '-q', '-t' ,'-f',
|
||||
os.path.join(gtk_datadir, 'icons', 'hicolor')])
|
||||
|
||||
print('Updating module cache for print backends...')
|
||||
|
@@ -24,9 +24,6 @@
|
||||
/* Define to 1 if you have the <crt_externs.h> header file. */
|
||||
#mesondefine HAVE_CRT_EXTERNS_H
|
||||
|
||||
/* Define to 1 if CUPS 1.6 API is available */
|
||||
#mesondefine HAVE_CUPS_API_1_6
|
||||
|
||||
/* Define to 1 if you have the `dcgettext' function. */
|
||||
#mesondefine HAVE_DCGETTEXT
|
||||
|
||||
@@ -305,13 +302,3 @@
|
||||
#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
|
||||
|
@@ -212,7 +212,7 @@ activate_about (GSimpleAction *action,
|
||||
"comments", "Program to demonstrate GTK functions.",
|
||||
"authors", authors,
|
||||
"documenters", documentors,
|
||||
"logo-icon-name", "org.gtk.Demo",
|
||||
"logo-icon-name", "org.gtk.Demo4",
|
||||
"title", "About GTK Code Demos",
|
||||
NULL);
|
||||
}
|
||||
@@ -370,7 +370,7 @@ demo_application_init (DemoApplication *app)
|
||||
GSettings *settings;
|
||||
GAction *action;
|
||||
|
||||
settings = g_settings_new ("org.gtk.Demo");
|
||||
settings = g_settings_new ("org.gtk.Demo4");
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
@@ -397,7 +397,7 @@ demo_application_window_store_state (DemoApplicationWindow *win)
|
||||
{
|
||||
GSettings *settings;
|
||||
|
||||
settings = g_settings_new ("org.gtk.Demo");
|
||||
settings = g_settings_new ("org.gtk.Demo4");
|
||||
g_settings_set (settings, "window-size", "(ii)", win->width, win->height);
|
||||
g_settings_set_boolean (settings, "maximized", win->maximized);
|
||||
g_settings_set_boolean (settings, "fullscreen", win->fullscreen);
|
||||
@@ -409,7 +409,7 @@ demo_application_window_load_state (DemoApplicationWindow *win)
|
||||
{
|
||||
GSettings *settings;
|
||||
|
||||
settings = g_settings_new ("org.gtk.Demo");
|
||||
settings = g_settings_new ("org.gtk.Demo4");
|
||||
g_settings_get (settings, "window-size", "(ii)", &win->width, &win->height);
|
||||
win->maximized = g_settings_get_boolean (settings, "maximized");
|
||||
win->fullscreen = g_settings_get_boolean (settings, "fullscreen");
|
||||
@@ -541,7 +541,7 @@ main (int argc, char *argv[])
|
||||
GtkApplication *app;
|
||||
|
||||
app = GTK_APPLICATION (g_object_new (demo_application_get_type (),
|
||||
"application-id", "org.gtk.Demo2",
|
||||
"application-id", "org.gtk.Demo4.App",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL));
|
||||
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="DemoApplicationWindow" parent="GtkApplicationWindow">
|
||||
<property name="title" translatable="yes">Application Class</property>
|
||||
@@ -32,11 +33,11 @@
|
||||
<property name="action-name">win.logo</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkInfoBar" id="infobar">
|
||||
@@ -63,11 +64,11 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
@@ -79,20 +80,20 @@
|
||||
<property name="buffer">buffer</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStatusbar" id="status">
|
||||
<property name="hexpand">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -52,7 +52,7 @@ do_application_demo (GtkWidget *toplevel)
|
||||
|
||||
if (watch == 0)
|
||||
watch = g_bus_watch_name (G_BUS_TYPE_SESSION,
|
||||
"org.gtk.Demo2",
|
||||
"org.gtk.Demo4.App",
|
||||
0,
|
||||
on_name_appeared,
|
||||
on_name_vanished,
|
||||
@@ -80,8 +80,8 @@ do_application_demo (GtkWidget *toplevel)
|
||||
else
|
||||
{
|
||||
g_dbus_connection_call_sync (g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, NULL),
|
||||
"org.gtk.Demo2",
|
||||
"/org/gtk/Demo2",
|
||||
"org.gtk.Demo4.App",
|
||||
"/org/gtk/Demo4/App",
|
||||
"org.gtk.Actions",
|
||||
"Activate",
|
||||
g_variant_new ("(sava{sv})", "quit", NULL, NULL),
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<menu id="appmenu">
|
||||
<section>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<object class="GtkWindow" id="window">
|
||||
@@ -16,11 +17,11 @@
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow">
|
||||
@@ -28,22 +29,22 @@
|
||||
<property name="vexpand">1</property>
|
||||
<property name="shadow-type">in</property>
|
||||
<property name="min-content-width">150</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStackSwitcher">
|
||||
<property name="halign">center</property>
|
||||
<property name="hexpand">1</property>
|
||||
<property name="stack">stack</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
@@ -66,53 +67,53 @@
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Duck</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Background</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<style>
|
||||
<class name="duck"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<style>
|
||||
<class name="gradient"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">
|
||||
Blended picture</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
@@ -120,12 +121,12 @@ Blended picture</property>
|
||||
<style>
|
||||
<class name="blend0"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
@@ -145,53 +146,53 @@ Blended picture</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Red</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">Blue</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<style>
|
||||
<class name="red"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<style>
|
||||
<class name="blue"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">
|
||||
Blended picture</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
@@ -199,12 +200,12 @@ Blended picture</property>
|
||||
<style>
|
||||
<class name="blend1"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
<property name="width">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
@@ -227,33 +228,33 @@ Blended picture</property>
|
||||
<style>
|
||||
<class name="cyan"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<style>
|
||||
<class name="magenta"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
<style>
|
||||
<class name="yellow"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage">
|
||||
@@ -261,11 +262,11 @@ Blended picture</property>
|
||||
<style>
|
||||
<class name="blend2"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -274,11 +275,11 @@ Blended picture</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -287,11 +288,11 @@ Blended picture</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -300,11 +301,11 @@ Blended picture</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -313,21 +314,21 @@ Blended picture</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"></attribute>
|
||||
</attributes>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -13,19 +13,22 @@ show_parsing_error (GtkCssProvider *provider,
|
||||
const GError *error,
|
||||
GtkTextBuffer *buffer)
|
||||
{
|
||||
const GtkCssLocation *start_location, *end_location;
|
||||
GtkTextIter start, end;
|
||||
const char *tag_name;
|
||||
|
||||
start_location = gtk_css_section_get_start_location (section);
|
||||
gtk_text_buffer_get_iter_at_line_index (buffer,
|
||||
&start,
|
||||
gtk_css_section_get_start_line (section),
|
||||
gtk_css_section_get_start_position (section));
|
||||
start_location->lines,
|
||||
start_location->line_bytes);
|
||||
end_location = gtk_css_section_get_end_location (section);
|
||||
gtk_text_buffer_get_iter_at_line_index (buffer,
|
||||
&end,
|
||||
gtk_css_section_get_end_line (section),
|
||||
gtk_css_section_get_end_position (section));
|
||||
end_location->lines,
|
||||
end_location->line_bytes);
|
||||
|
||||
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
|
||||
if (error->domain == GTK_CSS_PARSER_WARNING)
|
||||
tag_name = "warning";
|
||||
else
|
||||
tag_name = "error";
|
||||
|
@@ -13,19 +13,23 @@ show_parsing_error (GtkCssProvider *provider,
|
||||
const GError *error,
|
||||
GtkTextBuffer *buffer)
|
||||
{
|
||||
const GtkCssLocation *start_location, *end_location;
|
||||
GtkTextIter start, end;
|
||||
const char *tag_name;
|
||||
|
||||
start_location = gtk_css_section_get_start_location (section);
|
||||
gtk_text_buffer_get_iter_at_line_index (buffer,
|
||||
&start,
|
||||
gtk_css_section_get_start_line (section),
|
||||
gtk_css_section_get_start_position (section));
|
||||
start_location->lines,
|
||||
start_location->line_bytes);
|
||||
end_location = gtk_css_section_get_end_location (section);
|
||||
gtk_text_buffer_get_iter_at_line_index (buffer,
|
||||
&end,
|
||||
gtk_css_section_get_end_line (section),
|
||||
gtk_css_section_get_end_position (section));
|
||||
end_location->lines,
|
||||
end_location->line_bytes);
|
||||
|
||||
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
|
||||
|
||||
if (error->domain == GTK_CSS_PARSER_WARNING)
|
||||
tag_name = "warning";
|
||||
else
|
||||
tag_name = "error";
|
||||
|
@@ -12,19 +12,23 @@ show_parsing_error (GtkCssProvider *provider,
|
||||
const GError *error,
|
||||
GtkTextBuffer *buffer)
|
||||
{
|
||||
const GtkCssLocation *start_location, *end_location;
|
||||
GtkTextIter start, end;
|
||||
const char *tag_name;
|
||||
|
||||
start_location = gtk_css_section_get_start_location (section);
|
||||
gtk_text_buffer_get_iter_at_line_index (buffer,
|
||||
&start,
|
||||
gtk_css_section_get_start_line (section),
|
||||
gtk_css_section_get_start_position (section));
|
||||
start_location->lines,
|
||||
start_location->line_bytes);
|
||||
end_location = gtk_css_section_get_end_location (section);
|
||||
gtk_text_buffer_get_iter_at_line_index (buffer,
|
||||
&end,
|
||||
gtk_css_section_get_end_line (section),
|
||||
gtk_css_section_get_end_position (section));
|
||||
end_location->lines,
|
||||
end_location->line_bytes);
|
||||
|
||||
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
|
||||
|
||||
if (error->domain == GTK_CSS_PARSER_WARNING)
|
||||
tag_name = "warning";
|
||||
else
|
||||
tag_name = "error";
|
||||
|
@@ -11,19 +11,22 @@ show_parsing_error (GtkCssProvider *provider,
|
||||
const GError *error,
|
||||
GtkTextBuffer *buffer)
|
||||
{
|
||||
const GtkCssLocation *start_location, *end_location;
|
||||
GtkTextIter start, end;
|
||||
const char *tag_name;
|
||||
|
||||
start_location = gtk_css_section_get_start_location (section);
|
||||
gtk_text_buffer_get_iter_at_line_index (buffer,
|
||||
&start,
|
||||
gtk_css_section_get_start_line (section),
|
||||
gtk_css_section_get_start_position (section));
|
||||
start_location->lines,
|
||||
start_location->line_bytes);
|
||||
end_location = gtk_css_section_get_end_location (section);
|
||||
gtk_text_buffer_get_iter_at_line_index (buffer,
|
||||
&end,
|
||||
gtk_css_section_get_end_line (section),
|
||||
gtk_css_section_get_end_position (section));
|
||||
end_location->lines,
|
||||
end_location->line_bytes);
|
||||
|
||||
if (g_error_matches (error, GTK_CSS_PROVIDER_ERROR, GTK_CSS_PROVIDER_ERROR_DEPRECATED))
|
||||
if (error->domain == GTK_CSS_PARSER_WARNING)
|
||||
tag_name = "warning";
|
||||
else
|
||||
tag_name = "error";
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GdkCursor" id="default_cursor">
|
||||
<property name="name">default</property>
|
||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
@@ -10,7 +10,7 @@
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="org.gtk.Demo-symbolic.svg"
|
||||
sodipodi:docname="org.gtk.Demo4-symbolic.svg"
|
||||
height="16.03125"
|
||||
id="svg7384"
|
||||
inkscape:version="0.92.4 5da689c313, 2019-01-14"
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
@@ -163,6 +163,7 @@
|
||||
<file>expander.c</file>
|
||||
<file>filtermodel.c</file>
|
||||
<file>fishbowl.c</file>
|
||||
<file>fixed.c</file>
|
||||
<file>flowbox.c</file>
|
||||
<file>foreigndrawing.c</file>
|
||||
<file>font_features.c</file>
|
||||
@@ -270,7 +271,10 @@
|
||||
<file>demotaggedentry.c</file>
|
||||
<file>demotaggedentry.h</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/Demo">
|
||||
<gresource prefix="/fixed">
|
||||
<file>fixed.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/Demo4">
|
||||
<file>icons/16x16/actions/application-exit.png</file>
|
||||
<file>icons/16x16/actions/document-new.png</file>
|
||||
<file>icons/16x16/actions/document-open.png</file>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
|
@@ -243,7 +243,7 @@ pressed_cb (GtkGesture *gesture,
|
||||
GtkWidget *child;
|
||||
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
child = gtk_widget_pick (widget, x, y);
|
||||
child = gtk_widget_pick (widget, x, y, GTK_PICK_DEFAULT);
|
||||
|
||||
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_SECONDARY)
|
||||
{
|
||||
@@ -320,7 +320,7 @@ released_cb (GtkGesture *gesture,
|
||||
GtkWidget *child;
|
||||
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (gesture));
|
||||
child = gtk_widget_pick (widget, x, y);
|
||||
child = gtk_widget_pick (widget, x, y, 0);
|
||||
|
||||
if (gtk_gesture_single_get_current_button (GTK_GESTURE_SINGLE (gesture)) == GDK_BUTTON_PRIMARY)
|
||||
{
|
||||
|
@@ -31,6 +31,7 @@ do_expander (GtkWidget *do_widget)
|
||||
GtkWidget *toplevel;
|
||||
GtkWidget *area;
|
||||
GtkWidget *expander;
|
||||
GtkWidget *label;
|
||||
GtkWidget *sw;
|
||||
GtkWidget *tv;
|
||||
GtkTextBuffer *buffer;
|
||||
@@ -50,13 +51,19 @@ do_expander (GtkWidget *do_widget)
|
||||
|
||||
area = gtk_message_dialog_get_message_area (GTK_MESSAGE_DIALOG (window));
|
||||
|
||||
label = gtk_widget_get_last_child (area);
|
||||
gtk_label_set_line_wrap (GTK_LABEL (label), FALSE);
|
||||
gtk_widget_set_vexpand (label, FALSE);
|
||||
|
||||
expander = gtk_expander_new ("Details:");
|
||||
gtk_widget_set_vexpand (expander, TRUE);
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (sw), 100);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
|
||||
GTK_POLICY_NEVER,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_scrolled_window_set_propagate_natural_height (GTK_SCROLLED_WINDOW (sw), TRUE);
|
||||
|
||||
tv = gtk_text_view_new ();
|
||||
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (tv));
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.16"/>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
@@ -44,11 +45,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview1">
|
||||
@@ -83,11 +84,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview2">
|
||||
@@ -134,11 +135,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
@@ -150,11 +151,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
@@ -166,11 +167,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="treeview3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeView" id="treeview3">
|
||||
@@ -199,11 +200,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="title" translatable="yes">Fishbowl</property>
|
||||
@@ -27,25 +28,21 @@
|
||||
<object class="GtkLabel">
|
||||
<property name="label">fps</property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" bind-source="bowl" bind-property="framerate"/>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Icons, </property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" bind-source="bowl" bind-property="count"/>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="changes_allow">
|
||||
@@ -53,7 +50,6 @@
|
||||
<property name="icon-name">changes-allow</property>
|
||||
<property name="relief">none</property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkToggleButton" id="changes_prevent">
|
||||
@@ -62,7 +58,6 @@
|
||||
<property name="icon-name">changes-prevent</property>
|
||||
<property name="relief">none</property>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
167
demos/gtk-demo/fixed.c
Normal file
@@ -0,0 +1,167 @@
|
||||
/* Fixed layout
|
||||
*
|
||||
* GtkFixed is a container that allows placing and transforming
|
||||
* widgets manually.
|
||||
*/
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/* This enumeration determines the paint order */
|
||||
enum {
|
||||
FACE_BACK,
|
||||
FACE_LEFT,
|
||||
FACE_BOTTOM,
|
||||
FACE_RIGHT,
|
||||
FACE_TOP,
|
||||
FACE_FRONT,
|
||||
|
||||
N_FACES
|
||||
};
|
||||
|
||||
/* Map face widgets to CSS classes */
|
||||
static struct {
|
||||
GtkWidget *face;
|
||||
const char *css_class;
|
||||
} faces[N_FACES] = {
|
||||
[FACE_BACK] = { NULL, "back", },
|
||||
[FACE_LEFT] = { NULL, "left", },
|
||||
[FACE_RIGHT] = { NULL, "right", },
|
||||
[FACE_TOP] = { NULL, "top", },
|
||||
[FACE_BOTTOM] = { NULL, "bottom", },
|
||||
[FACE_FRONT] = { NULL, "front", },
|
||||
};
|
||||
|
||||
static GtkWidget *
|
||||
create_faces (void)
|
||||
{
|
||||
GtkWidget *fixed = gtk_fixed_new ();
|
||||
int face_size = 200;
|
||||
float w, h, d, p;
|
||||
|
||||
gtk_widget_set_overflow (fixed, GTK_OVERFLOW_VISIBLE);
|
||||
|
||||
w = (float) face_size / 2.f;
|
||||
h = (float) face_size / 2.f;
|
||||
d = (float) face_size / 2.f;
|
||||
p = face_size * 3.f;
|
||||
|
||||
for (int i = 0; i < N_FACES; i++)
|
||||
{
|
||||
GskTransform *transform = NULL;
|
||||
|
||||
/* Add a face */
|
||||
faces[i].face = gtk_frame_new (NULL);
|
||||
gtk_widget_set_size_request (faces[i].face, face_size, face_size);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (faces[i].face), faces[i].css_class);
|
||||
gtk_container_add (GTK_CONTAINER (fixed), faces[i].face);
|
||||
|
||||
/* Set up the transformation for each face */
|
||||
transform = gsk_transform_translate (transform, &GRAPHENE_POINT_INIT (w, h));
|
||||
transform = gsk_transform_perspective (transform, p);
|
||||
transform = gsk_transform_rotate_3d (transform, -30.f, graphene_vec3_x_axis ());
|
||||
transform = gsk_transform_rotate_3d (transform, 135.f, graphene_vec3_y_axis ());
|
||||
transform = gsk_transform_translate_3d (transform, &GRAPHENE_POINT3D_INIT (0, 0, -face_size / 6.f));
|
||||
|
||||
switch (i)
|
||||
{
|
||||
case FACE_FRONT:
|
||||
transform = gsk_transform_rotate_3d (transform, 0.f, graphene_vec3_y_axis ());
|
||||
break;
|
||||
|
||||
case FACE_BACK:
|
||||
transform = gsk_transform_rotate_3d (transform, -180.f, graphene_vec3_y_axis ());
|
||||
break;
|
||||
|
||||
case FACE_RIGHT:
|
||||
transform = gsk_transform_rotate_3d (transform, 90.f, graphene_vec3_y_axis ());
|
||||
break;
|
||||
|
||||
case FACE_LEFT:
|
||||
transform = gsk_transform_rotate_3d (transform, -90.f, graphene_vec3_y_axis ());
|
||||
break;
|
||||
|
||||
case FACE_TOP:
|
||||
transform = gsk_transform_rotate_3d (transform, 90.f, graphene_vec3_x_axis ());
|
||||
break;
|
||||
|
||||
case FACE_BOTTOM:
|
||||
transform = gsk_transform_rotate_3d (transform, -90.f, graphene_vec3_x_axis ());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
transform = gsk_transform_translate_3d (transform, &GRAPHENE_POINT3D_INIT (0, 0, d));
|
||||
transform = gsk_transform_translate_3d (transform, &GRAPHENE_POINT3D_INIT (-w, -h, 0));
|
||||
|
||||
gtk_fixed_set_child_transform (GTK_FIXED (fixed), faces[i].face, transform);
|
||||
gsk_transform_unref (transform);
|
||||
}
|
||||
|
||||
return fixed;
|
||||
}
|
||||
|
||||
static GtkWidget *demo_window = NULL;
|
||||
static GtkCssProvider *provider = NULL;
|
||||
|
||||
static void
|
||||
close_window (GtkWidget *widget)
|
||||
{
|
||||
/* Reset the state */
|
||||
for (int i = 0; i < N_FACES; i++)
|
||||
faces[i].face = NULL;
|
||||
|
||||
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider));
|
||||
provider = NULL;
|
||||
|
||||
demo_window = NULL;
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
create_demo_window (GtkWidget *do_widget)
|
||||
{
|
||||
GtkWidget *window, *sw, *fixed, *cube;
|
||||
|
||||
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), "Fixed layout");
|
||||
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
|
||||
g_signal_connect (window, "destroy", G_CALLBACK (close_window), NULL);
|
||||
|
||||
sw = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_container_add (GTK_CONTAINER (window), sw);
|
||||
|
||||
fixed = gtk_fixed_new ();
|
||||
gtk_container_add (GTK_CONTAINER (sw), fixed);
|
||||
gtk_widget_set_halign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (GTK_WIDGET (fixed), GTK_ALIGN_CENTER);
|
||||
|
||||
cube = create_faces ();
|
||||
gtk_container_add (GTK_CONTAINER (fixed), cube);
|
||||
gtk_widget_set_overflow (fixed, GTK_OVERFLOW_VISIBLE);
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/fixed/fixed.css");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
800);
|
||||
g_object_unref (provider);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
do_fixed (GtkWidget *do_widget)
|
||||
{
|
||||
if (demo_window == NULL)
|
||||
demo_window = create_demo_window (do_widget);
|
||||
|
||||
if (!gtk_widget_get_visible (demo_window))
|
||||
gtk_widget_show (demo_window);
|
||||
else
|
||||
gtk_widget_destroy (demo_window);
|
||||
|
||||
return demo_window;
|
||||
}
|
29
demos/gtk-demo/fixed.css
Normal file
@@ -0,0 +1,29 @@
|
||||
frame.front {
|
||||
border: 2px solid white;
|
||||
background-color: rgba(228, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
frame.back {
|
||||
border: 2px solid white;
|
||||
background-color: rgba(228, 0, 0, 0.8);
|
||||
}
|
||||
|
||||
frame.right {
|
||||
border: 2px solid white;
|
||||
background-color: rgba(127, 231, 25, 0.8);
|
||||
}
|
||||
|
||||
frame.left {
|
||||
border: 2px solid white;
|
||||
background-color: rgba(127, 231, 25, 0.8);
|
||||
}
|
||||
|
||||
frame.top {
|
||||
border: 2px solid white;
|
||||
background-color: rgba(114, 159, 207, 0.8);
|
||||
}
|
||||
|
||||
frame.bottom {
|
||||
border: 2px solid white;
|
||||
background-color: rgba(114, 159, 207, 0.8);
|
||||
}
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.12"/>
|
||||
<object class="GtkWindow" id="window">
|
||||
|
@@ -495,7 +495,11 @@ update_script_combo (void)
|
||||
gboolean have_active = FALSE;
|
||||
|
||||
lang = gtk_font_chooser_get_language (GTK_FONT_CHOOSER (font));
|
||||
|
||||
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
|
||||
active = hb_ot_tag_from_language (hb_language_from_string (lang, -1));
|
||||
G_GNUC_END_IGNORE_DEPRECATIONS
|
||||
|
||||
g_free (lang);
|
||||
|
||||
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface domain="gtk40">
|
||||
<object class="GtkMenu" id="menu1">
|
||||
<child>
|
||||
@@ -28,12 +29,12 @@
|
||||
<property name="margin-start">8</property>
|
||||
<property name="margin-end">8</property>
|
||||
<property name="icon-name">image-missing</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="row-span">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="height">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box1">
|
||||
@@ -74,11 +75,11 @@
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="content_label">
|
||||
@@ -91,11 +92,11 @@
|
||||
<accessibility>
|
||||
<role type="static"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="resent_box">
|
||||
@@ -118,11 +119,11 @@
|
||||
<property name="uri">http://www.gtk.org</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="box3">
|
||||
@@ -181,11 +182,11 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="details_revealer">
|
||||
@@ -250,11 +251,11 @@ FAVORITES</property>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -45,22 +45,43 @@ activate_about (GSimpleAction *action,
|
||||
"The GTK Team",
|
||||
NULL
|
||||
};
|
||||
char *version;
|
||||
GString *s;
|
||||
|
||||
s = g_string_new ("");
|
||||
|
||||
g_string_append (s, "System libraries\n");
|
||||
g_string_append_printf (s, "\tGLib\t%d.%d.%d\n",
|
||||
glib_major_version,
|
||||
glib_minor_version,
|
||||
glib_micro_version);
|
||||
g_string_append_printf (s, "\tGTK\t%d.%d.%d\n",
|
||||
gtk_get_major_version (),
|
||||
gtk_get_minor_version (),
|
||||
gtk_get_micro_version ());
|
||||
g_string_append_printf (s, "\nA link can apppear here: <http://www.gtk.org>");
|
||||
|
||||
version = g_strdup_printf ("%s\nRunning against GTK %d.%d.%d",
|
||||
PACKAGE_VERSION,
|
||||
gtk_get_major_version (),
|
||||
gtk_get_minor_version (),
|
||||
gtk_get_micro_version ());
|
||||
|
||||
gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
|
||||
"program-name", "GTK Demo",
|
||||
"version", g_strdup_printf ("%s,\nRunning against GTK %d.%d.%d",
|
||||
PACKAGE_VERSION,
|
||||
gtk_get_major_version (),
|
||||
gtk_get_minor_version (),
|
||||
gtk_get_micro_version ()),
|
||||
"copyright", "(C) 1997-2013 The GTK Team",
|
||||
"version", version,
|
||||
"copyright", "© 1997—2019 The GTK Team",
|
||||
"license-type", GTK_LICENSE_LGPL_2_1,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to demonstrate GTK widgets",
|
||||
"authors", authors,
|
||||
"logo-icon-name", "org.gtk.Demo",
|
||||
"logo-icon-name", "org.gtk.Demo4",
|
||||
"title", "About GTK Demo",
|
||||
"system-information", s->str,
|
||||
NULL);
|
||||
|
||||
g_string_free (s, TRUE);
|
||||
g_free (version);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -84,6 +105,14 @@ activate_quit (GSimpleAction *action,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
activate_inspector (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_window_set_interactive_debugging (TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
window_closed_cb (GtkWidget *window, gpointer data)
|
||||
{
|
||||
@@ -668,7 +697,7 @@ add_data_tab (const gchar *demoname)
|
||||
gtk_widget_show (label);
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
|
||||
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
|
||||
"tab-expand", TRUE,
|
||||
"tab-expand", FALSE,
|
||||
NULL);
|
||||
|
||||
g_free (resource_name);
|
||||
@@ -1200,6 +1229,7 @@ main (int argc, char **argv)
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "about", activate_about, NULL, NULL, NULL },
|
||||
{ "quit", activate_quit, NULL, NULL, NULL },
|
||||
{ "inspector", activate_inspector, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
/* Most code in gtk-demo is intended to be exemplary, but not
|
||||
@@ -1212,7 +1242,7 @@ main (int argc, char **argv)
|
||||
}
|
||||
/* -- End of hack -- */
|
||||
|
||||
app = gtk_application_new ("org.gtk.Demo", G_APPLICATION_NON_UNIQUE|G_APPLICATION_HANDLES_COMMAND_LINE);
|
||||
app = gtk_application_new ("org.gtk.Demo4", G_APPLICATION_NON_UNIQUE|G_APPLICATION_HANDLES_COMMAND_LINE);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
|
@@ -1,4 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<menu id="gear_menu">
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Inspector</attribute>
|
||||
<attribute name="action">app.inspector</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_About GTK Demo</attribute>
|
||||
<attribute name="action">app.about</attribute>
|
||||
</item>
|
||||
</section>
|
||||
</menu>
|
||||
<object class="GtkTreeStore" id="treestore">
|
||||
<columns>
|
||||
<column type="gchararray"/>
|
||||
@@ -34,6 +47,13 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="end">
|
||||
<object class="GtkMenuButton" id="gear_menu_button">
|
||||
<property name="valign">center</property>
|
||||
<property name="menu-model">gear_menu</property>
|
||||
<property name="icon-name">open-menu-symbolic</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
|
@@ -70,12 +70,6 @@ change_orientation (GtkWidget *button,
|
||||
parent = gtk_widget_get_parent (menubar);
|
||||
orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
|
||||
gtk_orientable_set_orientation (GTK_ORIENTABLE (parent), 1 - orientation);
|
||||
|
||||
if (orientation == GTK_ORIENTATION_VERTICAL)
|
||||
g_object_set (menubar, "pack-direction", GTK_PACK_DIRECTION_TTB, NULL);
|
||||
else
|
||||
g_object_set (menubar, "pack-direction", GTK_PACK_DIRECTION_LTR, NULL);
|
||||
|
||||
}
|
||||
|
||||
static GtkWidget *window = NULL;
|
||||
@@ -107,51 +101,41 @@ do_menus (GtkWidget *do_widget)
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (window), box);
|
||||
gtk_widget_show (box);
|
||||
|
||||
box1 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_container_add (GTK_CONTAINER (box), box1);
|
||||
gtk_widget_show (box1);
|
||||
|
||||
menubar = gtk_menu_bar_new ();
|
||||
gtk_widget_set_hexpand (menubar, TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (box1), menubar);
|
||||
gtk_widget_show (menubar);
|
||||
|
||||
menu = create_menu (2);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("test\nline2");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), menu);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("foo");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (3));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
menuitem = gtk_menu_item_new_with_label ("bar");
|
||||
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), create_menu (4));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menubar), menuitem);
|
||||
gtk_widget_show (menuitem);
|
||||
|
||||
box2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_container_add (GTK_CONTAINER (box1), box2);
|
||||
gtk_widget_show (box2);
|
||||
|
||||
button = gtk_button_new_with_label ("Flip");
|
||||
g_signal_connect (button, "clicked",
|
||||
G_CALLBACK (change_orientation), menubar);
|
||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label ("Close");
|
||||
g_signal_connect_swapped (button, "clicked",
|
||||
G_CALLBACK(gtk_widget_destroy), window);
|
||||
gtk_container_add (GTK_CONTAINER (box2), button);
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
gtk_widget_grab_default (button);
|
||||
gtk_widget_show (button);
|
||||
gtk_window_set_default_widget (GTK_WINDOW (window), button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<menu id="appmenu">
|
||||
<section>
|
||||
|
@@ -24,6 +24,7 @@ demos = files([
|
||||
'expander.c',
|
||||
'filtermodel.c',
|
||||
'fishbowl.c',
|
||||
'fixed.c',
|
||||
'foreigndrawing.c',
|
||||
'gestures.c',
|
||||
'glarea.c',
|
||||
@@ -134,11 +135,11 @@ foreach size: ['scalable', 'symbolic']
|
||||
endforeach
|
||||
|
||||
# desktop file
|
||||
install_data('org.gtk.Demo.desktop', install_dir: gtk_applicationsdir)
|
||||
install_data('org.gtk.Demo4.desktop', install_dir: gtk_applicationsdir)
|
||||
|
||||
# GSettings
|
||||
install_data('org.gtk.Demo.gschema.xml', install_dir: gtk_schemasdir)
|
||||
install_data('org.gtk.Demo4.gschema.xml', install_dir: gtk_schemasdir)
|
||||
gnome.compile_schemas()
|
||||
|
||||
# appdata
|
||||
install_data('org.gtk.Demo.appdata.xml', install_dir: gtk_appdatadir)
|
||||
install_data('org.gtk.Demo4.appdata.xml', install_dir: gtk_appdatadir)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<child type="titlebar">
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>org.gtk.Demo.desktop</id>
|
||||
<id>org.gtk.Demo4.desktop</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>LGPL-2.0+</project_license>
|
||||
<name>GTK Demo</name>
|
@@ -2,7 +2,7 @@
|
||||
Name=GTK Demo
|
||||
Comment=GTK code examples and demonstrations
|
||||
Exec=gtk4-demo
|
||||
Icon=org.gtk.Demo
|
||||
Icon=org.gtk.Demo4
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
@@ -2,14 +2,14 @@
|
||||
|
||||
<schemalist>
|
||||
|
||||
<enum id='org.gtk.Demo.Color'>
|
||||
<enum id='org.gtk.Demo4.Color'>
|
||||
<value nick='red' value='0'/>
|
||||
<value nick='green' value='1'/>
|
||||
<value nick='blue' value='2'/>
|
||||
</enum>
|
||||
|
||||
<schema id='org.gtk.Demo' path='/org/gtk/Demo/'>
|
||||
<key name='color' enum='org.gtk.Demo.Color'>
|
||||
<schema id='org.gtk.Demo4' path='/org/gtk/Demo4/'>
|
||||
<key name='color' enum='org.gtk.Demo4.Color'>
|
||||
<default>'red'</default>
|
||||
</key>
|
||||
<key name='window-size' type='(ii)'>
|
@@ -57,7 +57,7 @@ do_overlay (GtkWidget *do_widget)
|
||||
|
||||
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 10);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), vbox);
|
||||
gtk_widget_set_can_pick (vbox, FALSE);
|
||||
gtk_widget_set_can_target (vbox, FALSE);
|
||||
gtk_widget_set_halign (vbox, GTK_ALIGN_CENTER);
|
||||
gtk_widget_set_valign (vbox, GTK_ALIGN_CENTER);
|
||||
|
||||
|
@@ -66,13 +66,13 @@ do_overlay2 (GtkWidget *do_widget)
|
||||
|
||||
image = gtk_picture_new_for_resource ("/overlay2/decor1.png");
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), image);
|
||||
gtk_widget_set_can_pick (image, FALSE);
|
||||
gtk_widget_set_can_target (image, FALSE);
|
||||
gtk_widget_set_halign (image, GTK_ALIGN_START);
|
||||
gtk_widget_set_valign (image, GTK_ALIGN_START);
|
||||
|
||||
image = gtk_picture_new_for_resource ("/overlay2/decor2.png");
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (overlay), image);
|
||||
gtk_widget_set_can_pick (image, FALSE);
|
||||
gtk_widget_set_can_target (image, FALSE);
|
||||
gtk_widget_set_halign (image, GTK_ALIGN_END);
|
||||
gtk_widget_set_valign (image, GTK_ALIGN_END);
|
||||
|
||||
|
@@ -27,10 +27,16 @@ toggle_resize (GtkWidget *widget,
|
||||
|
||||
is_child1 = (child == gtk_paned_get_child1 (paned));
|
||||
|
||||
gtk_container_child_get (GTK_CONTAINER (paned), child,
|
||||
"resize", &resize,
|
||||
"shrink", &shrink,
|
||||
NULL);
|
||||
if (is_child1)
|
||||
g_object_get (paned,
|
||||
"resize-child1", &resize,
|
||||
"shrink-child1", &shrink,
|
||||
NULL);
|
||||
else
|
||||
g_object_get (paned,
|
||||
"resize-child2", &resize,
|
||||
"shrink-child2", &shrink,
|
||||
NULL);
|
||||
|
||||
g_object_ref (child);
|
||||
gtk_container_remove (GTK_CONTAINER (parent), child);
|
||||
@@ -55,10 +61,16 @@ toggle_shrink (GtkWidget *widget,
|
||||
|
||||
is_child1 = (child == gtk_paned_get_child1 (paned));
|
||||
|
||||
gtk_container_child_get (GTK_CONTAINER (paned), child,
|
||||
"resize", &resize,
|
||||
"shrink", &shrink,
|
||||
NULL);
|
||||
if (is_child1)
|
||||
g_object_get (paned,
|
||||
"resize-child1", &resize,
|
||||
"shrink-child1", &shrink,
|
||||
NULL);
|
||||
else
|
||||
g_object_get (paned,
|
||||
"resize-child2", &resize,
|
||||
"shrink-child2", &shrink,
|
||||
NULL);
|
||||
|
||||
g_object_ref (child);
|
||||
gtk_container_remove (GTK_CONTAINER (parent), child);
|
||||
|
@@ -76,8 +76,7 @@ do_password_entry (GtkWidget *do_widget)
|
||||
gtk_widget_set_sensitive (button, FALSE);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
gtk_window_set_default (GTK_WINDOW (window), button);
|
||||
gtk_window_set_default_widget (GTK_WINDOW (window), button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkListStore" id="liststore1">
|
||||
<columns>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window">
|
||||
<property name="default-width">300</property>
|
||||
@@ -17,11 +18,11 @@
|
||||
<property name="icon-size">large</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="revealer1">
|
||||
@@ -33,11 +34,11 @@
|
||||
<property name="icon-size">large</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="revealer2">
|
||||
@@ -49,11 +50,11 @@
|
||||
<property name="icon-size">large</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="revealer3">
|
||||
@@ -64,11 +65,11 @@
|
||||
<property name="icon-size">large</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="revealer4">
|
||||
@@ -80,11 +81,11 @@
|
||||
<property name="icon-size">large</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="revealer5">
|
||||
@@ -96,11 +97,11 @@
|
||||
<property name="icon-size">large</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="revealer6">
|
||||
@@ -112,11 +113,11 @@
|
||||
<property name="icon-size">large</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="revealer7">
|
||||
@@ -127,11 +128,11 @@
|
||||
<property name="icon-size">large</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRevealer" id="revealer8">
|
||||
@@ -143,11 +144,11 @@
|
||||
<property name="icon-size">large</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkAdjustment" id="adjustment1">
|
||||
<property name="upper">4</property>
|
||||
@@ -31,11 +32,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_plain"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale_plain">
|
||||
@@ -47,11 +48,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_plain"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_marks">
|
||||
@@ -60,11 +61,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_marks"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale_marks">
|
||||
@@ -83,11 +84,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label_marks"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_discrete">
|
||||
@@ -96,11 +97,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="scale_discrete"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="scale_discrete">
|
||||
@@ -120,11 +121,11 @@
|
||||
<mark value="3" position="bottom"/>
|
||||
<mark value="4" position="bottom"/>
|
||||
</marks>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkShortcutsWindow" id="shortcuts-boxes">
|
||||
<property name="modal">1</property>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkShortcutsWindow" id="shortcuts-builder">
|
||||
<property name="modal">1</property>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkShortcutsWindow" id="shortcuts-clocks">
|
||||
<property name="modal">1</property>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkShortcutsWindow" id="shortcuts-gedit">
|
||||
<property name="modal">1</property>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="title" translatable="yes">Shortcuts</property>
|
||||
|
@@ -65,7 +65,7 @@ do_sidebar (GtkWidget *do_widget)
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
widget = gtk_image_new_from_icon_name ("org.gtk.Demo");
|
||||
widget = gtk_image_new_from_icon_name ("org.gtk.Demo4");
|
||||
gtk_image_set_pixel_size (GTK_IMAGE (widget), 256);
|
||||
}
|
||||
else
|
||||
|
@@ -228,7 +228,7 @@ puzzle_button_pressed (GtkGestureMultiPress *gesture,
|
||||
int l, t, i;
|
||||
int pos;
|
||||
|
||||
child = gtk_widget_pick (grid, x, y);
|
||||
child = gtk_widget_pick (grid, x, y, GTK_PICK_DEFAULT);
|
||||
|
||||
if (!child)
|
||||
{
|
||||
@@ -236,10 +236,7 @@ puzzle_button_pressed (GtkGestureMultiPress *gesture,
|
||||
return;
|
||||
}
|
||||
|
||||
gtk_container_child_get (GTK_CONTAINER (grid), child,
|
||||
"left-attach", &l,
|
||||
"top-attach", &t,
|
||||
NULL);
|
||||
gtk_grid_query_child (GTK_GRID (grid), child, &l, &t, NULL, NULL);
|
||||
|
||||
if (l == pos_x && t == pos_y)
|
||||
{
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkAdjustment" id="basic_adjustment">
|
||||
<property name="lower">-10000</property>
|
||||
@@ -35,11 +36,11 @@
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">basic_spin</property>
|
||||
<property name="xalign">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="basic_spin">
|
||||
@@ -49,21 +50,21 @@
|
||||
<property name="climb-rate">1</property>
|
||||
<property name="digits">2</property>
|
||||
<property name="numeric">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="basic_label">
|
||||
<property name="width-chars">10</property>
|
||||
<property name="xalign">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -71,11 +72,11 @@
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">hex_spin</property>
|
||||
<property name="xalign">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="hex_spin">
|
||||
@@ -85,21 +86,21 @@
|
||||
<signal name="input" handler="hex_spin_input"/>
|
||||
<signal name="output" handler="hex_spin_output"/>
|
||||
<property name="wrap">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="hex_label">
|
||||
<property name="width-chars">10</property>
|
||||
<property name="xalign">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -107,11 +108,11 @@
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">time_spin</property>
|
||||
<property name="xalign">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="time_spin">
|
||||
@@ -121,21 +122,21 @@
|
||||
<signal name="input" handler="time_spin_input"/>
|
||||
<signal name="output" handler="time_spin_output"/>
|
||||
<property name="wrap">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="time_label">
|
||||
<property name="width-chars">10</property>
|
||||
<property name="xalign">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -143,11 +144,11 @@
|
||||
<property name="use-underline">1</property>
|
||||
<property name="mnemonic-widget">month_spin</property>
|
||||
<property name="xalign">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinButton" id="month_spin">
|
||||
@@ -158,21 +159,21 @@
|
||||
<property name="adjustment">month_adjustment</property>
|
||||
<property name="wrap">1</property>
|
||||
<property name="update-policy">if-valid</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="month_label">
|
||||
<property name="width-chars">10</property>
|
||||
<property name="xalign">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="title" translatable="yes">Stack</property>
|
||||
@@ -7,11 +8,11 @@
|
||||
<object class="GtkStackSwitcher">
|
||||
<property name="stack">stack</property>
|
||||
<property name="halign">center</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkStack" id="stack">
|
||||
@@ -25,7 +26,7 @@
|
||||
<object class="GtkImage">
|
||||
<property name="margin-top">20</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="icon-name">org.gtk.Demo</property>
|
||||
<property name="icon-name">org.gtk.Demo4</property>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
@@ -57,11 +58,11 @@
|
||||
</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -99,8 +99,7 @@ do_tagged_entry (GtkWidget *do_widget)
|
||||
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_widget_destroy), window);
|
||||
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), button);
|
||||
|
||||
gtk_widget_set_can_default (button, TRUE);
|
||||
gtk_window_set_default (GTK_WINDOW (window), button);
|
||||
gtk_window_set_default_widget (GTK_WINDOW (window), button);
|
||||
}
|
||||
|
||||
if (!gtk_widget_get_visible (window))
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkGrid" id="grid">
|
||||
<property name="row-spacing">10</property>
|
||||
|
Before Width: | Height: | Size: 5.2 KiB After Width: | Height: | Size: 5.2 KiB |
@@ -10,7 +10,7 @@
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
sodipodi:docname="org.gtk.IconBrowser-symbolic.svg"
|
||||
sodipodi:docname="org.gtk.IconBrowser4-symbolic.svg"
|
||||
height="16.03125"
|
||||
id="svg7384"
|
||||
inkscape:version="0.92.4 5da689c313, 2019-01-14"
|
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
@@ -68,6 +68,6 @@ IconBrowserApp *
|
||||
icon_browser_app_new (void)
|
||||
{
|
||||
return g_object_new (ICON_BROWSER_APP_TYPE,
|
||||
"application-id", "org.gtk.IconBrowser",
|
||||
"application-id", "org.gtk.IconBrowser4",
|
||||
NULL);
|
||||
}
|
||||
|
@@ -205,6 +205,7 @@ add_context (IconBrowserWindow *win,
|
||||
g_hash_table_insert (win->contexts, c->id, c);
|
||||
|
||||
row = gtk_label_new (name);
|
||||
gtk_label_set_xalign (GTK_LABEL (row), 0);
|
||||
g_object_set_data (G_OBJECT (row), "context", c);
|
||||
gtk_widget_show (row);
|
||||
g_object_set (row, "margin", 10, NULL);
|
||||
@@ -285,19 +286,6 @@ populate (IconBrowserWindow *win)
|
||||
g_strfreev (groups);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
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),
|
||||
gtk_get_current_event ());
|
||||
}
|
||||
|
||||
static void
|
||||
copy_to_clipboard (GtkButton *button,
|
||||
IconBrowserWindow *win)
|
||||
@@ -452,7 +440,6 @@ static void
|
||||
icon_browser_window_init (IconBrowserWindow *win)
|
||||
{
|
||||
GdkContentFormats *list;
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
|
||||
@@ -479,13 +466,11 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
|
||||
g_signal_connect (win->searchbar, "notify::search-mode-enabled",
|
||||
G_CALLBACK (search_mode_toggled), win);
|
||||
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (win->searchbar),
|
||||
GTK_WIDGET (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);
|
||||
}
|
||||
|
||||
|
@@ -17,7 +17,7 @@ executable('gtk4-icon-browser',
|
||||
link_args: extra_demo_ldflags,
|
||||
install: true)
|
||||
|
||||
install_data('org.gtk.IconBrowser.desktop', install_dir: gtk_applicationsdir)
|
||||
install_data('org.gtk.IconBrowser4.desktop', install_dir: gtk_applicationsdir)
|
||||
|
||||
# icons
|
||||
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
|
||||
|
@@ -2,7 +2,7 @@
|
||||
Name=Icon Browser
|
||||
Comment=An application that shows themed icons
|
||||
Exec=gtk4-icon-browser
|
||||
Icon=org.gtk.IconBrowser
|
||||
Icon=org.gtk.IconBrowser4
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="IconStore" id="store"/>
|
||||
<object class="GtkTreeModelFilter" id="filter_model">
|
||||
@@ -46,7 +47,6 @@
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -121,6 +121,7 @@
|
||||
<property name="hide-on-close">1</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkGrid">
|
||||
<property name="margin">10</property>
|
||||
@@ -134,11 +135,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2">
|
||||
@@ -147,11 +148,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image3">
|
||||
@@ -160,11 +161,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image4">
|
||||
@@ -173,11 +174,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label4"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image5">
|
||||
@@ -186,11 +187,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label5"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image6">
|
||||
@@ -199,11 +200,11 @@
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="label6"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
@@ -216,11 +217,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image1"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label2">
|
||||
@@ -233,11 +234,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image2"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label3">
|
||||
@@ -250,11 +251,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image3"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label4">
|
||||
@@ -267,11 +268,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image4"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">3</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
@@ -284,11 +285,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image5"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">4</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label6">
|
||||
@@ -301,11 +302,11 @@
|
||||
<accessibility>
|
||||
<relation type="label-for" target="image6"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">5</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
subdir('gtk-demo')
|
||||
subdir('icon-browser')
|
||||
subdir('node-editor')
|
||||
subdir('widget-factory')
|
||||
|
323
demos/node-editor/gtkrendererpaintable.c
Normal file
@@ -0,0 +1,323 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gtkrendererpaintableprivate.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
struct _GtkRendererPaintable
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
GskRenderer *renderer;
|
||||
GdkPaintable *paintable;
|
||||
};
|
||||
|
||||
struct _GtkRendererPaintableClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
};
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_PAINTABLE,
|
||||
PROP_RENDERER,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
static GParamSpec *properties[N_PROPS] = { NULL, };
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_paintable_snapshot (GdkPaintable *paintable,
|
||||
GdkSnapshot *snapshot,
|
||||
double width,
|
||||
double height)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (paintable);
|
||||
GtkSnapshot *node_snapshot;
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return;
|
||||
|
||||
if (self->renderer == NULL ||
|
||||
!gsk_renderer_is_realized (self->renderer))
|
||||
{
|
||||
gdk_paintable_snapshot (self->paintable, snapshot, width, height);
|
||||
return;
|
||||
}
|
||||
|
||||
node_snapshot = gtk_snapshot_new ();
|
||||
gdk_paintable_snapshot (self->paintable, node_snapshot, width, height);
|
||||
node = gtk_snapshot_free_to_node (node_snapshot);
|
||||
if (node == NULL)
|
||||
return;
|
||||
|
||||
texture = gsk_renderer_render_texture (self->renderer,
|
||||
node,
|
||||
&GRAPHENE_RECT_INIT (0, 0, width, height));
|
||||
|
||||
gdk_paintable_snapshot (GDK_PAINTABLE (texture), snapshot, width, height);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_renderer_paintable_paintable_get_intrinsic_width (GdkPaintable *paintable)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (paintable);
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return 0;
|
||||
|
||||
return gdk_paintable_get_intrinsic_width (self->paintable);
|
||||
}
|
||||
|
||||
static int
|
||||
gtk_renderer_paintable_paintable_get_intrinsic_height (GdkPaintable *paintable)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (paintable);
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return 0;
|
||||
|
||||
return gdk_paintable_get_intrinsic_height (self->paintable);
|
||||
}
|
||||
|
||||
static double
|
||||
gtk_renderer_paintable_paintable_get_intrinsic_aspect_ratio (GdkPaintable *paintable)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (paintable);
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return 0.0;
|
||||
|
||||
return gdk_paintable_get_intrinsic_aspect_ratio (self->paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_paintable_init (GdkPaintableInterface *iface)
|
||||
{
|
||||
iface->snapshot = gtk_renderer_paintable_paintable_snapshot;
|
||||
iface->get_intrinsic_width = gtk_renderer_paintable_paintable_get_intrinsic_width;
|
||||
iface->get_intrinsic_height = gtk_renderer_paintable_paintable_get_intrinsic_height;
|
||||
iface->get_intrinsic_aspect_ratio = gtk_renderer_paintable_paintable_get_intrinsic_aspect_ratio;
|
||||
}
|
||||
|
||||
G_DEFINE_TYPE_EXTENDED (GtkRendererPaintable, gtk_renderer_paintable, G_TYPE_OBJECT, 0,
|
||||
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
|
||||
gtk_renderer_paintable_paintable_init))
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec)
|
||||
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PAINTABLE:
|
||||
gtk_renderer_paintable_set_paintable (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
case PROP_RENDERER:
|
||||
gtk_renderer_paintable_set_renderer (self, g_value_get_object (value));
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_get_property (GObject *object,
|
||||
guint prop_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (object);
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_PAINTABLE:
|
||||
g_value_set_object (value, self->paintable);
|
||||
break;
|
||||
|
||||
case PROP_RENDERER:
|
||||
g_value_set_object (value, self->renderer);
|
||||
break;
|
||||
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_unset_paintable (GtkRendererPaintable *self)
|
||||
{
|
||||
guint flags;
|
||||
|
||||
if (self->paintable == NULL)
|
||||
return;
|
||||
|
||||
flags = gdk_paintable_get_flags (self->paintable);
|
||||
|
||||
if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0)
|
||||
g_signal_handlers_disconnect_by_func (self->paintable,
|
||||
gdk_paintable_invalidate_contents,
|
||||
self);
|
||||
|
||||
if ((flags & GDK_PAINTABLE_STATIC_SIZE) == 0)
|
||||
g_signal_handlers_disconnect_by_func (self->paintable,
|
||||
gdk_paintable_invalidate_size,
|
||||
self);
|
||||
|
||||
g_clear_object (&self->paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_dispose (GObject *object)
|
||||
{
|
||||
GtkRendererPaintable *self = GTK_RENDERER_PAINTABLE (object);
|
||||
|
||||
g_clear_object (&self->renderer);
|
||||
gtk_renderer_paintable_unset_paintable (self);
|
||||
|
||||
G_OBJECT_CLASS (gtk_renderer_paintable_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_class_init (GtkRendererPaintableClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
gobject_class->get_property = gtk_renderer_paintable_get_property;
|
||||
gobject_class->set_property = gtk_renderer_paintable_set_property;
|
||||
gobject_class->dispose = gtk_renderer_paintable_dispose;
|
||||
|
||||
properties[PROP_PAINTABLE] =
|
||||
g_param_spec_object ("paintable",
|
||||
"Paintable",
|
||||
"The paintable to be shown",
|
||||
GDK_TYPE_PAINTABLE,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
properties[PROP_RENDERER] =
|
||||
g_param_spec_object ("renderer",
|
||||
"Renderer",
|
||||
"Renderer used to render the paintable",
|
||||
GSK_TYPE_RENDERER,
|
||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY);
|
||||
|
||||
g_object_class_install_properties (gobject_class, N_PROPS, properties);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_renderer_paintable_init (GtkRendererPaintable *self)
|
||||
{
|
||||
}
|
||||
|
||||
GdkPaintable *
|
||||
gtk_renderer_paintable_new (GskRenderer *renderer,
|
||||
GdkPaintable *paintable)
|
||||
{
|
||||
g_return_val_if_fail (renderer == NULL || GSK_IS_RENDERER (renderer), NULL);
|
||||
g_return_val_if_fail (paintable == NULL || GDK_IS_PAINTABLE (paintable), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_RENDERER_PAINTABLE,
|
||||
"renderer", renderer,
|
||||
"paintable", paintable,
|
||||
NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gtk_renderer_paintable_set_renderer (GtkRendererPaintable *self,
|
||||
GskRenderer *renderer)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_RENDERER_PAINTABLE (self));
|
||||
g_return_if_fail (renderer == NULL || GSK_IS_RENDERER (renderer));
|
||||
|
||||
if (!g_set_object (&self->renderer, renderer))
|
||||
return;
|
||||
|
||||
if (self->paintable)
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_RENDERER]);
|
||||
}
|
||||
|
||||
GskRenderer *
|
||||
gtk_renderer_paintable_get_renderer (GtkRendererPaintable *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_RENDERER_PAINTABLE (self), NULL);
|
||||
|
||||
return self->renderer;
|
||||
}
|
||||
|
||||
void
|
||||
gtk_renderer_paintable_set_paintable (GtkRendererPaintable *self,
|
||||
GdkPaintable *paintable)
|
||||
{
|
||||
g_return_if_fail (GTK_IS_RENDERER_PAINTABLE (self));
|
||||
g_return_if_fail (paintable == NULL || GDK_IS_PAINTABLE (paintable));
|
||||
|
||||
if (self->paintable == paintable)
|
||||
return;
|
||||
|
||||
gtk_renderer_paintable_unset_paintable (self);
|
||||
|
||||
if (paintable)
|
||||
{
|
||||
const guint flags = gdk_paintable_get_flags (paintable);
|
||||
|
||||
self->paintable = g_object_ref (paintable);
|
||||
|
||||
if ((flags & GDK_PAINTABLE_STATIC_CONTENTS) == 0)
|
||||
g_signal_connect_swapped (paintable,
|
||||
"invalidate-contents",
|
||||
G_CALLBACK (gdk_paintable_invalidate_contents),
|
||||
self);
|
||||
if ((flags & GDK_PAINTABLE_STATIC_SIZE) == 0)
|
||||
g_signal_connect_swapped (paintable,
|
||||
"invalidate-size",
|
||||
G_CALLBACK (gdk_paintable_invalidate_size),
|
||||
self);
|
||||
}
|
||||
|
||||
gdk_paintable_invalidate_size (GDK_PAINTABLE (self));
|
||||
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_PAINTABLE]);
|
||||
}
|
||||
|
||||
GdkPaintable *
|
||||
gtk_renderer_paintable_get_paintable (GtkRendererPaintable *self)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_RENDERER_PAINTABLE (self), NULL);
|
||||
|
||||
return self->paintable;
|
||||
}
|
||||
|
43
demos/node-editor/gtkrendererpaintableprivate.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __GTK_RENDERER_PAINTABLE_H__
|
||||
#define __GTK_RENDERER_PAINTABLE_H__
|
||||
|
||||
#include <gsk/gsk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GTK_TYPE_RENDERER_PAINTABLE (gtk_renderer_paintable_get_type ())
|
||||
|
||||
G_DECLARE_FINAL_TYPE (GtkRendererPaintable, gtk_renderer_paintable, GTK, RENDERER_PAINTABLE, GObject)
|
||||
|
||||
GdkPaintable * gtk_renderer_paintable_new (GskRenderer *renderer,
|
||||
GdkPaintable *paintable);
|
||||
|
||||
void gtk_renderer_paintable_set_renderer (GtkRendererPaintable *self,
|
||||
GskRenderer *renderer);
|
||||
GskRenderer * gtk_renderer_paintable_get_renderer (GtkRendererPaintable *self) G_GNUC_PURE;
|
||||
void gtk_renderer_paintable_set_paintable (GtkRendererPaintable *self,
|
||||
GdkPaintable *paintable);
|
||||
GdkPaintable * gtk_renderer_paintable_get_paintable (GtkRendererPaintable *self) G_GNUC_PURE;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_RENDERER_PAINTABLE_H__ */
|
28
demos/node-editor/main.c
Normal file
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <node-editor-application.h>
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
return g_application_run (G_APPLICATION (node_editor_application_new ()), argc, argv);
|
||||
}
|
18
demos/node-editor/meson.build
Normal file
@@ -0,0 +1,18 @@
|
||||
node_editor_sources = [
|
||||
'gtkrendererpaintable.c',
|
||||
'main.c',
|
||||
'node-editor-application.c',
|
||||
'node-editor-window.c',
|
||||
]
|
||||
|
||||
node_editor_resources = gnome.compile_resources('node_editor_resources',
|
||||
'node-editor.gresource.xml',
|
||||
source_dir: '.')
|
||||
|
||||
executable('gtk4-node-editor',
|
||||
node_editor_sources, node_editor_resources,
|
||||
dependencies: libgtk_dep,
|
||||
include_directories: confinc,
|
||||
gui_app: true,
|
||||
link_args: extra_demo_ldflags,
|
||||
install: false)
|
132
demos/node-editor/node-editor-application.c
Normal file
@@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "node-editor-application.h"
|
||||
|
||||
#include "node-editor-window.h"
|
||||
|
||||
static const char *css =
|
||||
"textview.editor {"
|
||||
" color: rgb(192, 197, 206);"
|
||||
" caret-color: white;"
|
||||
"}"
|
||||
"textview.editor text {"
|
||||
" background-color: rgb(43, 48, 59);"
|
||||
"}"
|
||||
;
|
||||
|
||||
struct _NodeEditorApplication
|
||||
{
|
||||
GtkApplication parent;
|
||||
};
|
||||
|
||||
struct _NodeEditorApplicationClass
|
||||
{
|
||||
GtkApplicationClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(NodeEditorApplication, node_editor_application, GTK_TYPE_APPLICATION);
|
||||
|
||||
static void
|
||||
node_editor_application_init (NodeEditorApplication *app)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
quit_activated (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer data)
|
||||
{
|
||||
g_application_quit (G_APPLICATION (data));
|
||||
}
|
||||
|
||||
static GActionEntry app_entries[] =
|
||||
{
|
||||
{ "quit", quit_activated, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
node_editor_application_startup (GApplication *app)
|
||||
{
|
||||
const char *quit_accels[2] = { "<Ctrl>Q", NULL };
|
||||
const char *open_accels[2] = { "<Ctrl>O", NULL };
|
||||
GtkCssProvider *provider;
|
||||
|
||||
G_APPLICATION_CLASS (node_editor_application_parent_class)->startup (app);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
app);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app), "app.quit", quit_accels);
|
||||
gtk_application_set_accels_for_action (GTK_APPLICATION (app), "win.open", open_accels);
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_application_activate (GApplication *app)
|
||||
{
|
||||
NodeEditorWindow *win;
|
||||
|
||||
win = node_editor_window_new (NODE_EDITOR_APPLICATION (app));
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_application_open (GApplication *app,
|
||||
GFile **files,
|
||||
gint n_files,
|
||||
const gchar *hint)
|
||||
{
|
||||
NodeEditorWindow *win;
|
||||
gint i;
|
||||
|
||||
for (i = 0; i < n_files; i++)
|
||||
{
|
||||
win = node_editor_window_new (NODE_EDITOR_APPLICATION (app));
|
||||
node_editor_window_load (win, files[i]);
|
||||
gtk_window_present (GTK_WINDOW (win));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_application_class_init (NodeEditorApplicationClass *class)
|
||||
{
|
||||
GApplicationClass *application_class = G_APPLICATION_CLASS (class);
|
||||
|
||||
application_class->startup = node_editor_application_startup;
|
||||
application_class->activate = node_editor_application_activate;
|
||||
application_class->open = node_editor_application_open;
|
||||
}
|
||||
|
||||
NodeEditorApplication *
|
||||
node_editor_application_new (void)
|
||||
{
|
||||
return g_object_new (NODE_EDITOR_APPLICATION_TYPE,
|
||||
"application-id", "org.gtk.gtk4.NodeEditor",
|
||||
"flags", G_APPLICATION_HANDLES_OPEN,
|
||||
NULL);
|
||||
}
|
38
demos/node-editor/node-editor-application.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __NODE_EDITOR_APPLICATION_H__
|
||||
#define __NODE_EDITOR_APPLICATION_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
#define NODE_EDITOR_APPLICATION_TYPE (node_editor_application_get_type ())
|
||||
#define NODE_EDITOR_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NODE_EDITOR_APPLICATION_TYPE, NodeEditorApplication))
|
||||
|
||||
|
||||
typedef struct _NodeEditorApplication NodeEditorApplication;
|
||||
typedef struct _NodeEditorApplicationClass NodeEditorApplicationClass;
|
||||
|
||||
|
||||
GType node_editor_application_get_type (void);
|
||||
NodeEditorApplication *node_editor_application_new (void);
|
||||
|
||||
|
||||
#endif /* __NODE_EDITOR_APPLICATION_H__ */
|
701
demos/node-editor/node-editor-window.c
Normal file
@@ -0,0 +1,701 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "node-editor-window.h"
|
||||
|
||||
#include "gtkrendererpaintableprivate.h"
|
||||
|
||||
#include "gsk/gskrendernodeparserprivate.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gsize start_chars;
|
||||
gsize end_chars;
|
||||
char *message;
|
||||
} TextViewError;
|
||||
|
||||
struct _NodeEditorWindow
|
||||
{
|
||||
GtkApplicationWindow parent;
|
||||
|
||||
GtkWidget *picture;
|
||||
GtkWidget *text_view;
|
||||
GtkTextBuffer *text_buffer;
|
||||
GtkTextTagTable *tag_table;
|
||||
|
||||
GtkWidget *renderer_listbox;
|
||||
GListStore *renderers;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
GArray *errors;
|
||||
};
|
||||
|
||||
struct _NodeEditorWindowClass
|
||||
{
|
||||
GtkApplicationWindowClass parent_class;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE(NodeEditorWindow, node_editor_window, GTK_TYPE_APPLICATION_WINDOW);
|
||||
|
||||
static void
|
||||
text_view_error_free (TextViewError *e)
|
||||
{
|
||||
g_free (e->message);
|
||||
}
|
||||
|
||||
static gchar *
|
||||
get_current_text (GtkTextBuffer *buffer)
|
||||
{
|
||||
GtkTextIter start, end;
|
||||
|
||||
gtk_text_buffer_get_start_iter (buffer, &start);
|
||||
gtk_text_buffer_get_end_iter (buffer, &end);
|
||||
gtk_text_buffer_remove_all_tags (buffer, &start, &end);
|
||||
|
||||
return gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
deserialize_error_func (const GtkCssSection *section,
|
||||
const GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
const GtkCssLocation *start_location = gtk_css_section_get_start_location (section);
|
||||
const GtkCssLocation *end_location = gtk_css_section_get_end_location (section);
|
||||
NodeEditorWindow *self = user_data;
|
||||
GtkTextIter start_iter, end_iter;
|
||||
TextViewError text_view_error;
|
||||
|
||||
gtk_text_buffer_get_iter_at_line_offset (self->text_buffer, &start_iter,
|
||||
start_location->lines,
|
||||
start_location->line_chars);
|
||||
gtk_text_buffer_get_iter_at_line_offset (self->text_buffer, &end_iter,
|
||||
end_location->lines,
|
||||
end_location->line_chars);
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "error",
|
||||
&start_iter, &end_iter);
|
||||
|
||||
text_view_error.start_chars = start_location->chars;
|
||||
text_view_error.end_chars = end_location->chars;
|
||||
text_view_error.message = g_strdup (error->message);
|
||||
g_array_append_val (self->errors, text_view_error);
|
||||
}
|
||||
|
||||
static void
|
||||
text_iter_skip_alpha_backward (GtkTextIter *iter)
|
||||
{
|
||||
/* Just skip to the previous non-whitespace char */
|
||||
|
||||
while (!gtk_text_iter_is_start (iter))
|
||||
{
|
||||
gunichar c = gtk_text_iter_get_char (iter);
|
||||
|
||||
if (g_unichar_isspace (c))
|
||||
{
|
||||
gtk_text_iter_forward_char (iter);
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_text_iter_backward_char (iter);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
text_iter_skip_whitespace_backward (GtkTextIter *iter)
|
||||
{
|
||||
while (!gtk_text_iter_is_start (iter))
|
||||
{
|
||||
gunichar c = gtk_text_iter_get_char (iter);
|
||||
|
||||
if (g_unichar_isalpha (c))
|
||||
{
|
||||
gtk_text_iter_forward_char (iter);
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_text_iter_backward_char (iter);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
text_changed (GtkTextBuffer *buffer,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GskRenderNode *node;
|
||||
char *text;
|
||||
GBytes *bytes;
|
||||
|
||||
g_array_remove_range (self->errors, 0, self->errors->len);
|
||||
text = get_current_text (self->text_buffer);
|
||||
bytes = g_bytes_new_take (text, strlen (text));
|
||||
|
||||
/* If this is too slow, go fix the parser performance */
|
||||
node = gsk_render_node_deserialize (bytes, deserialize_error_func, self);
|
||||
g_bytes_unref (bytes);
|
||||
if (node)
|
||||
{
|
||||
/* XXX: Is this code necessary or can we have API to turn nodes into paintables? */
|
||||
GtkSnapshot *snapshot;
|
||||
GdkPaintable *paintable;
|
||||
graphene_rect_t bounds;
|
||||
guint i;
|
||||
|
||||
snapshot = gtk_snapshot_new ();
|
||||
gsk_render_node_get_bounds (node, &bounds);
|
||||
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (- bounds.origin.x, - bounds.origin.y));
|
||||
gtk_snapshot_append_node (snapshot, node);
|
||||
gsk_render_node_unref (node);
|
||||
paintable = gtk_snapshot_free_to_paintable (snapshot, &bounds.size);
|
||||
gtk_picture_set_paintable (GTK_PICTURE (self->picture), paintable);
|
||||
for (i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (self->renderers)); i++)
|
||||
{
|
||||
gpointer item = g_list_model_get_item (G_LIST_MODEL (self->renderers), i);
|
||||
gtk_renderer_paintable_set_paintable (item, paintable);
|
||||
g_object_unref (item);
|
||||
}
|
||||
g_clear_object (&paintable);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_picture_set_paintable (GTK_PICTURE (self->picture), NULL);
|
||||
}
|
||||
|
||||
GtkTextIter iter;
|
||||
|
||||
gtk_text_buffer_get_start_iter (self->text_buffer, &iter);
|
||||
|
||||
while (!gtk_text_iter_is_end (&iter))
|
||||
{
|
||||
gunichar c = gtk_text_iter_get_char (&iter);
|
||||
|
||||
if (c == '{')
|
||||
{
|
||||
GtkTextIter word_end = iter;
|
||||
GtkTextIter word_start;
|
||||
|
||||
gtk_text_iter_backward_char (&word_end);
|
||||
text_iter_skip_whitespace_backward (&word_end);
|
||||
|
||||
word_start = word_end;
|
||||
gtk_text_iter_backward_word_start (&word_start);
|
||||
text_iter_skip_alpha_backward (&word_start);
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "nodename",
|
||||
&word_start, &word_end);
|
||||
}
|
||||
else if (c == ':')
|
||||
{
|
||||
GtkTextIter word_end = iter;
|
||||
GtkTextIter word_start;
|
||||
|
||||
gtk_text_iter_backward_char (&word_end);
|
||||
text_iter_skip_whitespace_backward (&word_end);
|
||||
|
||||
word_start = word_end;
|
||||
gtk_text_iter_backward_word_start (&word_start);
|
||||
text_iter_skip_alpha_backward (&word_start);
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "propname",
|
||||
&word_start, &word_end);
|
||||
}
|
||||
else if (c == '"')
|
||||
{
|
||||
GtkTextIter string_start = iter;
|
||||
GtkTextIter string_end = iter;
|
||||
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
while (!gtk_text_iter_is_end (&iter))
|
||||
{
|
||||
c = gtk_text_iter_get_char (&iter);
|
||||
|
||||
if (c == '"')
|
||||
{
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
string_end = iter;
|
||||
break;
|
||||
}
|
||||
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
}
|
||||
|
||||
gtk_text_buffer_apply_tag_by_name (self->text_buffer, "string",
|
||||
&string_start, &string_end);
|
||||
}
|
||||
|
||||
gtk_text_iter_forward_char (&iter);
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
text_view_query_tooltip_cb (GtkWidget *widget,
|
||||
int x,
|
||||
int y,
|
||||
gboolean keyboard_tip,
|
||||
GtkTooltip *tooltip,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GtkTextIter iter;
|
||||
guint i;
|
||||
|
||||
if (keyboard_tip)
|
||||
{
|
||||
gint offset;
|
||||
|
||||
g_object_get (self->text_buffer, "cursor-position", &offset, NULL);
|
||||
gtk_text_buffer_get_iter_at_offset (self->text_buffer, &iter, offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
gint bx, by, trailing;
|
||||
|
||||
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (self->text_view), GTK_TEXT_WINDOW_TEXT,
|
||||
x, y, &bx, &by);
|
||||
gtk_text_view_get_iter_at_position (GTK_TEXT_VIEW (self->text_view), &iter, &trailing, bx, by);
|
||||
}
|
||||
|
||||
for (i = 0; i < self->errors->len; i ++)
|
||||
{
|
||||
const TextViewError *e = &g_array_index (self->errors, TextViewError, i);
|
||||
GtkTextIter start_iter, end_iter;
|
||||
|
||||
gtk_text_buffer_get_iter_at_offset (self->text_buffer, &start_iter, e->start_chars);
|
||||
gtk_text_buffer_get_iter_at_offset (self->text_buffer, &end_iter, e->end_chars);
|
||||
|
||||
if (gtk_text_iter_in_range (&iter, &start_iter, &end_iter))
|
||||
{
|
||||
gtk_tooltip_set_text (tooltip, e->message);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
node_editor_window_load (NodeEditorWindow *self,
|
||||
GFile *file)
|
||||
{
|
||||
GtkTextIter end;
|
||||
GBytes *bytes;
|
||||
|
||||
bytes = g_file_load_bytes (file, NULL, NULL, NULL);
|
||||
if (bytes == NULL)
|
||||
return FALSE;
|
||||
|
||||
if (!g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL))
|
||||
{
|
||||
g_bytes_unref (bytes);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gtk_text_buffer_get_end_iter (self->text_buffer, &end);
|
||||
gtk_text_buffer_insert (self->text_buffer,
|
||||
&end,
|
||||
g_bytes_get_data (bytes, NULL),
|
||||
g_bytes_get_size (bytes));
|
||||
|
||||
g_bytes_unref (bytes);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
open_response_cb (GtkWidget *dialog,
|
||||
gint response,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
GFile *file;
|
||||
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
node_editor_window_load (self, file);
|
||||
g_object_unref (file);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
show_open_filechooser (NodeEditorWindow *self)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Open node file",
|
||||
GTK_WINDOW (self),
|
||||
GTK_FILE_CHOOSER_ACTION_OPEN,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Load", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), ".");
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
open_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
show_open_filechooser (self);
|
||||
}
|
||||
|
||||
static void
|
||||
save_response_cb (GtkWidget *dialog,
|
||||
gint response,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
char *text, *filename;
|
||||
GError *error = NULL;
|
||||
|
||||
text = get_current_text (self->text_buffer);
|
||||
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
if (!g_file_set_contents (filename, text, -1, &error))
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (self))),
|
||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"Saving failed");
|
||||
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
|
||||
"%s", error->message);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
gtk_widget_show (dialog);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
save_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GtkWidget *dialog;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("Save node",
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Save", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), ".");
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
static GdkTexture *
|
||||
create_texture (NodeEditorWindow *self)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
GtkSnapshot *snapshot;
|
||||
GskRenderer *renderer;
|
||||
GskRenderNode *node;
|
||||
GdkTexture *texture;
|
||||
|
||||
paintable = gtk_picture_get_paintable (GTK_PICTURE (self->picture));
|
||||
if (paintable == NULL ||
|
||||
gdk_paintable_get_intrinsic_width (paintable) <= 0 ||
|
||||
gdk_paintable_get_intrinsic_height (paintable) <= 0)
|
||||
return NULL;
|
||||
snapshot = gtk_snapshot_new ();
|
||||
gdk_paintable_snapshot (paintable, snapshot, gdk_paintable_get_intrinsic_width (paintable), gdk_paintable_get_intrinsic_height (paintable));
|
||||
node = gtk_snapshot_free_to_node (snapshot);
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
|
||||
/* ahem */
|
||||
renderer = GTK_ROOT_GET_IFACE (gtk_widget_get_root (GTK_WIDGET (self)))->get_renderer (gtk_widget_get_root (GTK_WIDGET (self)));
|
||||
texture = gsk_renderer_render_texture (renderer, node, NULL);
|
||||
gsk_render_node_unref (node);
|
||||
|
||||
return texture;
|
||||
}
|
||||
|
||||
static void
|
||||
export_image_response_cb (GtkWidget *dialog,
|
||||
gint response,
|
||||
GdkTexture *texture)
|
||||
{
|
||||
gtk_widget_hide (dialog);
|
||||
|
||||
if (response == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
char *filename;
|
||||
|
||||
filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
|
||||
if (!gdk_texture_save_to_png (texture, filename))
|
||||
{
|
||||
GtkWidget *message_dialog;
|
||||
|
||||
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_window_get_transient_for (GTK_WINDOW (dialog))),
|
||||
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
|
||||
GTK_MESSAGE_INFO,
|
||||
GTK_BUTTONS_OK,
|
||||
"Exporting to image failed");
|
||||
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_widget_destroy), NULL);
|
||||
gtk_widget_show (message_dialog);
|
||||
}
|
||||
g_free (filename);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
g_object_unref (texture);
|
||||
}
|
||||
|
||||
static void
|
||||
export_image_cb (GtkWidget *button,
|
||||
NodeEditorWindow *self)
|
||||
{
|
||||
GdkTexture *texture;
|
||||
GtkWidget *dialog;
|
||||
|
||||
texture = create_texture (self);
|
||||
if (texture == NULL)
|
||||
return;
|
||||
|
||||
dialog = gtk_file_chooser_dialog_new ("",
|
||||
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
"_Cancel", GTK_RESPONSE_CANCEL,
|
||||
"_Save", GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
|
||||
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
|
||||
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
|
||||
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
|
||||
g_signal_connect (dialog, "response", G_CALLBACK (export_image_response_cb), texture);
|
||||
gtk_widget_show (dialog);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_finalize (GObject *object)
|
||||
{
|
||||
NodeEditorWindow *self = (NodeEditorWindow *)object;
|
||||
|
||||
g_array_free (self->errors, TRUE);
|
||||
|
||||
g_clear_object (&self->renderers);
|
||||
|
||||
G_OBJECT_CLASS (node_editor_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_add_renderer (NodeEditorWindow *self,
|
||||
GskRenderer *renderer,
|
||||
const char *description)
|
||||
{
|
||||
GdkSurface *surface;
|
||||
GdkPaintable *paintable;
|
||||
|
||||
surface = gtk_widget_get_surface (GTK_WIDGET (self));
|
||||
g_assert (surface != NULL);
|
||||
|
||||
if (renderer != NULL && !gsk_renderer_realize (renderer, surface, NULL))
|
||||
{
|
||||
g_object_unref (renderer);
|
||||
return;
|
||||
}
|
||||
|
||||
paintable = gtk_renderer_paintable_new (renderer, gtk_picture_get_paintable (GTK_PICTURE (self->picture)));
|
||||
g_object_set_data_full (G_OBJECT (paintable), "description", g_strdup (description), g_free);
|
||||
g_clear_object (&renderer);
|
||||
|
||||
g_list_store_append (self->renderers, paintable);
|
||||
g_object_unref (paintable);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_realize (GtkWidget *widget)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||
|
||||
GTK_WIDGET_CLASS (node_editor_window_parent_class)->realize (widget);
|
||||
|
||||
#if 0
|
||||
node_editor_window_add_renderer (self,
|
||||
NULL,
|
||||
"Default");
|
||||
#endif
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_gl_renderer_new (),
|
||||
"OpenGL");
|
||||
#ifdef GDK_RENDERING_VULKAN
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_vulkan_renderer_new (),
|
||||
"Vulkan");
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_BROADWAY
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_broadway_renderer_new (),
|
||||
"Broadway");
|
||||
#endif
|
||||
node_editor_window_add_renderer (self,
|
||||
gsk_cairo_renderer_new (),
|
||||
"Cairo");
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_unrealize (GtkWidget *widget)
|
||||
{
|
||||
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
|
||||
|
||||
g_list_store_remove_all (self->renderers);
|
||||
|
||||
GTK_WIDGET_CLASS (node_editor_window_parent_class)->unrealize (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
node_editor_window_class_init (NodeEditorWindowClass *class)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
|
||||
|
||||
object_class->finalize = node_editor_window_finalize;
|
||||
|
||||
gtk_widget_class_set_template_from_resource (widget_class,
|
||||
"/org/gtk/gtk4/node-editor/node-editor-window.ui");
|
||||
|
||||
widget_class->realize = node_editor_window_realize;
|
||||
widget_class->unrealize = node_editor_window_unrealize;
|
||||
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, text_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, picture);
|
||||
gtk_widget_class_bind_template_child (widget_class, NodeEditorWindow, renderer_listbox);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, text_view_query_tooltip_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, open_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, save_cb);
|
||||
gtk_widget_class_bind_template_callback (widget_class, export_image_cb);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
node_editor_window_create_renderer_widget (gpointer item,
|
||||
gpointer user_data)
|
||||
{
|
||||
GdkPaintable *paintable = item;
|
||||
GtkWidget *box, *label, *picture;
|
||||
GtkWidget *row;
|
||||
|
||||
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
|
||||
gtk_widget_set_size_request (box, 120, 90);
|
||||
|
||||
label = gtk_label_new (g_object_get_data (G_OBJECT (paintable), "description"));
|
||||
gtk_container_add (GTK_CONTAINER (box), label);
|
||||
|
||||
picture = gtk_picture_new_for_paintable (paintable);
|
||||
gtk_container_add (GTK_CONTAINER (box), picture);
|
||||
|
||||
row = gtk_list_box_row_new ();
|
||||
gtk_container_add (GTK_CONTAINER (row), box);
|
||||
gtk_list_box_row_set_activatable (GTK_LIST_BOX_ROW (row), FALSE);
|
||||
|
||||
return row;
|
||||
}
|
||||
|
||||
static void
|
||||
window_open (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
NodeEditorWindow *self = user_data;
|
||||
|
||||
show_open_filechooser (self);
|
||||
}
|
||||
|
||||
static GActionEntry win_entries[] = {
|
||||
{ "open", window_open, NULL, NULL, NULL },
|
||||
};
|
||||
|
||||
static void
|
||||
node_editor_window_init (NodeEditorWindow *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
self->renderers = g_list_store_new (GDK_TYPE_PAINTABLE);
|
||||
gtk_list_box_bind_model (GTK_LIST_BOX (self->renderer_listbox),
|
||||
G_LIST_MODEL (self->renderers),
|
||||
node_editor_window_create_renderer_widget,
|
||||
self,
|
||||
NULL);
|
||||
|
||||
self->errors = g_array_new (FALSE, TRUE, sizeof (TextViewError));
|
||||
g_array_set_clear_func (self->errors, (GDestroyNotify)text_view_error_free);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (self), win_entries, G_N_ELEMENTS (win_entries), self);
|
||||
|
||||
self->tag_table = gtk_text_tag_table_new ();
|
||||
gtk_text_tag_table_add (self->tag_table,
|
||||
g_object_new (GTK_TYPE_TEXT_TAG,
|
||||
"name", "error",
|
||||
"underline", PANGO_UNDERLINE_ERROR,
|
||||
NULL));
|
||||
gtk_text_tag_table_add (self->tag_table,
|
||||
g_object_new (GTK_TYPE_TEXT_TAG,
|
||||
"name", "nodename",
|
||||
"foreground-rgba", &(GdkRGBA) { 0.9, 0.78, 0.53, 1},
|
||||
NULL));
|
||||
gtk_text_tag_table_add (self->tag_table,
|
||||
g_object_new (GTK_TYPE_TEXT_TAG,
|
||||
"name", "propname",
|
||||
"foreground-rgba", &(GdkRGBA) { 0.7, 0.55, 0.67, 1},
|
||||
NULL));
|
||||
gtk_text_tag_table_add (self->tag_table,
|
||||
g_object_new (GTK_TYPE_TEXT_TAG,
|
||||
"name", "string",
|
||||
"foreground-rgba", &(GdkRGBA) { 0.63, 0.73, 0.54, 1},
|
||||
NULL));
|
||||
gtk_text_tag_table_add (self->tag_table,
|
||||
g_object_new (GTK_TYPE_TEXT_TAG,
|
||||
"name", "number",
|
||||
"foreground-rgba", &(GdkRGBA) { 0.8, 0.52, 0.43, 1},
|
||||
NULL));
|
||||
|
||||
self->text_buffer = gtk_text_buffer_new (self->tag_table);
|
||||
g_signal_connect (self->text_buffer, "changed", G_CALLBACK (text_changed), self);
|
||||
gtk_text_view_set_buffer (GTK_TEXT_VIEW (self->text_view), self->text_buffer);
|
||||
}
|
||||
|
||||
NodeEditorWindow *
|
||||
node_editor_window_new (NodeEditorApplication *application)
|
||||
{
|
||||
return g_object_new (NODE_EDITOR_WINDOW_TYPE,
|
||||
"application", application,
|
||||
NULL);
|
||||
}
|
42
demos/node-editor/node-editor-window.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright © 2019 Benjamin Otte
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Authors: Benjamin Otte <otte@gnome.org>
|
||||
*/
|
||||
|
||||
#ifndef __NODE_EDITOR_WINDOW_H__
|
||||
#define __NODE_EDITOR_WINDOW_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "node-editor-application.h"
|
||||
|
||||
#define NODE_EDITOR_WINDOW_TYPE (node_editor_window_get_type ())
|
||||
#define NODE_EDITOR_WINDOW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NODE_EDITOR_WINDOW_TYPE, NodeEditorWindow))
|
||||
|
||||
|
||||
typedef struct _NodeEditorWindow NodeEditorWindow;
|
||||
typedef struct _NodeEditorWindowClass NodeEditorWindowClass;
|
||||
|
||||
|
||||
GType node_editor_window_get_type (void);
|
||||
|
||||
NodeEditorWindow * node_editor_window_new (NodeEditorApplication *application);
|
||||
|
||||
gboolean node_editor_window_load (NodeEditorWindow *self,
|
||||
GFile *file);
|
||||
|
||||
#endif /* __NODE_EDITOR_WINDOW_H__ */
|
103
demos/node-editor/node-editor-window.ui
Normal file
@@ -0,0 +1,103 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
|
||||
<style>
|
||||
<class name="devel"/>
|
||||
</style>
|
||||
<property name="title" translatable="yes">GTK Node Editor</property>
|
||||
<property name="default-width">1024</property>
|
||||
<property name="default-height">768</property>
|
||||
<child type="titlebar">
|
||||
<object class="GtkHeaderBar" id="header">
|
||||
<property name="title" translatable="yes">GTK Node Editor</property>
|
||||
<property name="show-title-buttons">1</property>
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">document-open-symbolic</property>
|
||||
<property name="tooltip-text">Open node file</property>
|
||||
<signal name="clicked" handler="open_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">document-save-symbolic</property>
|
||||
<property name="tooltip-text">Save to node file</property>
|
||||
<signal name="clicked" handler="save_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child type="start">
|
||||
<object class="GtkButton">
|
||||
<property name="icon-name">insert-image-symbolic</property>
|
||||
<property name="tooltip-text">Export to image</property>
|
||||
<signal name="clicked" handler="export_image_cb"/>
|
||||
</object>
|
||||
</child>
|
||||
<child type="title">
|
||||
<object class="GtkLabel">
|
||||
<property name="label" translatable="yes">GTK Node Editor</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkPaned">
|
||||
<property name="shrink-child2">false</property>
|
||||
<property name="position">400</property>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<property name="expand">1</property>
|
||||
<child>
|
||||
<object class="GtkTextView" id="text_view">
|
||||
<property name="wrap-mode">word</property>
|
||||
<property name="monospace">1</property>
|
||||
<property name="has-focus">1</property>
|
||||
<property name="top-margin">6</property>
|
||||
<property name="left-margin">6</property>
|
||||
<property name="right-margin">6</property>
|
||||
<property name="bottom-margin">6</property>
|
||||
<property name="has-tooltip">1</property>
|
||||
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
|
||||
<style>
|
||||
<class name="editor" />
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="expand">1</property>
|
||||
<property name="min-content-height">100</property>
|
||||
<property name="min-content-width">100</property>
|
||||
<child>
|
||||
<object class="GtkViewport">
|
||||
<child>
|
||||
<object class="GtkPicture" id="picture">
|
||||
<property name="can-shrink">0</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
<property name="hscrollbar-policy">never</property>
|
||||
<child>
|
||||
<object class="GtkListBox" id="renderer_listbox">
|
||||
<property name="selection-mode">none</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</template>
|
||||
</interface>
|
6
demos/node-editor/node-editor.gresource.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/org/gtk/gtk4/node-editor">
|
||||
<file preprocess="xml-stripblanks">node-editor-window.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 2.7 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
@@ -13,7 +13,7 @@ executable('gtk4-widget-factory',
|
||||
install: true)
|
||||
|
||||
# desktop file
|
||||
install_data('org.gtk.WidgetFactory.desktop', install_dir: gtk_applicationsdir)
|
||||
install_data('org.gtk.WidgetFactory4.desktop', install_dir: gtk_applicationsdir)
|
||||
|
||||
# icons
|
||||
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
|
||||
@@ -25,4 +25,4 @@ foreach size: ['scalable', 'symbolic']
|
||||
endforeach
|
||||
|
||||
# appdata
|
||||
install_data('org.gtk.WidgetFactory.appdata.xml', install_dir: gtk_appdatadir)
|
||||
install_data('org.gtk.WidgetFactory4.appdata.xml', install_dir: gtk_appdatadir)
|
||||
|
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop">
|
||||
<id>org.gtk.WidgetFactory.desktop</id>
|
||||
<id>org.gtk.WidgetFactory4.desktop</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>LGPL-2.0+</project_license>
|
||||
<name>GTK Widget Factory</name>
|
@@ -2,7 +2,7 @@
|
||||
Name=Widget Factory
|
||||
Comment=A showcase for GTK widgets, designed for testing themes.
|
||||
Exec=gtk4-widget-factory
|
||||
Icon=org.gtk.WidgetFactory
|
||||
Icon=org.gtk.WidgetFactory4
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=true
|
@@ -227,12 +227,12 @@ activate_about (GSimpleAction *action,
|
||||
gtk_show_about_dialog (GTK_WINDOW (gtk_application_get_active_window (app)),
|
||||
"program-name", "GTK Widget Factory",
|
||||
"version", version,
|
||||
"copyright", "(C) 1997-2013 The GTK Team",
|
||||
"copyright", "© 1997—2019 The GTK Team",
|
||||
"license-type", GTK_LICENSE_LGPL_2_1,
|
||||
"website", "http://www.gtk.org",
|
||||
"comments", "Program to demonstrate GTK themes and widgets",
|
||||
"authors", authors,
|
||||
"logo-icon-name", "org.gtk.WidgetFactory",
|
||||
"logo-icon-name", "org.gtk.WidgetFactory4",
|
||||
"title", "About GTK Widget Factory",
|
||||
"system-information", s->str,
|
||||
NULL);
|
||||
@@ -262,6 +262,14 @@ activate_quit (GSimpleAction *action,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
activate_inspector (GSimpleAction *action,
|
||||
GVariant *parameter,
|
||||
gpointer user_data)
|
||||
{
|
||||
gtk_window_set_interactive_debugging (TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
spin_value_changed (GtkAdjustment *adjustment, GtkWidget *label)
|
||||
{
|
||||
@@ -1657,13 +1665,13 @@ activate (GApplication *app)
|
||||
g_type_ensure (my_text_view_get_type ());
|
||||
|
||||
provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory/widget-factory.css");
|
||||
gtk_css_provider_load_from_resource (provider, "/org/gtk/WidgetFactory4/widget-factory.css");
|
||||
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
|
||||
GTK_STYLE_PROVIDER (provider),
|
||||
GTK_STYLE_PROVIDER_PRIORITY_USER);
|
||||
g_object_unref (provider);
|
||||
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/WidgetFactory/widget-factory.ui");
|
||||
builder = gtk_builder_new_from_resource ("/org/gtk/WidgetFactory4/widget-factory.ui");
|
||||
gtk_builder_add_callback_symbol (builder, "on_entry_icon_release", (GCallback)on_entry_icon_release);
|
||||
gtk_builder_add_callback_symbol (builder, "on_scale_button_value_changed", (GCallback)on_scale_button_value_changed);
|
||||
gtk_builder_add_callback_symbol (builder, "on_scale_button_query_tooltip", (GCallback)on_scale_button_query_tooltip);
|
||||
@@ -1935,6 +1943,7 @@ main (int argc, char *argv[])
|
||||
static GActionEntry app_entries[] = {
|
||||
{ "about", activate_about, NULL, NULL, NULL },
|
||||
{ "quit", activate_quit, NULL, NULL, NULL },
|
||||
{ "inspector", activate_inspector, NULL, NULL, NULL },
|
||||
{ "main", NULL, "s", "'steak'", NULL },
|
||||
{ "wine", NULL, NULL, "false", NULL },
|
||||
{ "beer", NULL, NULL, "false", NULL },
|
||||
@@ -1944,7 +1953,7 @@ main (int argc, char *argv[])
|
||||
};
|
||||
gint status;
|
||||
|
||||
app = gtk_application_new ("org.gtk.WidgetFactory", G_APPLICATION_NON_UNIQUE);
|
||||
app = gtk_application_new ("org.gtk.WidgetFactory4", G_APPLICATION_NON_UNIQUE);
|
||||
|
||||
g_action_map_add_action_entries (G_ACTION_MAP (app),
|
||||
app_entries, G_N_ELEMENTS (app_entries),
|
||||
|
@@ -1,15 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<gresources>
|
||||
<gresource prefix="/org/gtk/WidgetFactory">
|
||||
<gresource prefix="/org/gtk/WidgetFactory4">
|
||||
<file preprocess="xml-stripblanks">widget-factory.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/WidgetFactory">
|
||||
<gresource prefix="/org/gtk/WidgetFactory4">
|
||||
<file>widget-factory.css</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/WidgetFactory/gtk">
|
||||
<gresource prefix="/org/gtk/WidgetFactory4/gtk">
|
||||
<file preprocess="xml-stripblanks">help-overlay.ui</file>
|
||||
</gresource>
|
||||
<gresource prefix="/org/gtk/WidgetFactory">
|
||||
<gresource prefix="/org/gtk/WidgetFactory4">
|
||||
<file>icons/16x16/actions/document-new.png</file>
|
||||
<file>icons/16x16/actions/document-save.png</file>
|
||||
<file>icons/16x16/actions/edit-find.png</file>
|
||||
|
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<menu id="gear_menu">
|
||||
<section>
|
||||
@@ -15,6 +16,10 @@
|
||||
</item>
|
||||
</section>
|
||||
<section>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Inspector</attribute>
|
||||
<attribute name="action">app.inspector</attribute>
|
||||
</item>
|
||||
<item>
|
||||
<attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
|
||||
<attribute name="action">win.show-help-overlay</attribute>
|
||||
@@ -593,32 +598,32 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton2">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="can-focus">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton3">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="can-focus">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton4">
|
||||
@@ -626,22 +631,22 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton5">
|
||||
<property name="label" translatable="yes">checkbutton</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="checkbutton6">
|
||||
@@ -649,22 +654,22 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="inconsistent">1</property>
|
||||
<property name="can-focus">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radiobutton1">
|
||||
<property name="label" translatable="yes">radiobutton</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radiobutton2">
|
||||
@@ -672,11 +677,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radiobutton3">
|
||||
@@ -685,11 +690,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<property name="group">radiobutton1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radiobutton4">
|
||||
@@ -697,11 +702,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radiobutton5">
|
||||
@@ -710,11 +715,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<property name="group">radiobutton3</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkRadioButton" id="radiobutton6">
|
||||
@@ -724,46 +729,47 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="can-focus">1</property>
|
||||
<property name="active">1</property>
|
||||
<property name="group">radiobutton3</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">5</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="spinner1">
|
||||
<property name="active">1</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="spinner2"/>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
<object class="GtkSpinner" id="spinner2">
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="spinner3">
|
||||
<property name="active">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSpinner" id="spinner4">
|
||||
<property name="sensitive">0</property>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">4</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -1502,11 +1508,11 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="value">.5</property>
|
||||
<property name="halign">center</property>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScaleButton" id="mic-button">
|
||||
@@ -1520,11 +1526,11 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="halign">center</property>
|
||||
<signal name="query-tooltip" handler="on_scale_button_query_tooltip" swapped="no"/>
|
||||
<signal name="value-changed" handler="on_scale_button_value_changed" swapped="no"/>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -1569,7 +1575,7 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<property name="title">Logo</property>
|
||||
<property name="child">
|
||||
<object class="GtkImage" id="imageo">
|
||||
<property name="icon-name">gtk3-widget-factory</property>
|
||||
<property name="icon-name">org.gtk.WidgetFactory4</property>
|
||||
<property name="pixel-size">256</property>
|
||||
</object>
|
||||
</property>
|
||||
@@ -2874,6 +2880,17 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<child>
|
||||
<object class="GtkNotebook">
|
||||
<property name="show-border">0</property>
|
||||
<child type="action-end">
|
||||
<object class="GtkMenuButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="popover">notebook_info_popover2</property>
|
||||
<property name="icon-name">emblem-important-symbolic</property>
|
||||
<property name="relief">none</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkNotebookPage">
|
||||
<property name="tab-expand">1</property>
|
||||
@@ -3137,6 +3154,7 @@ bad things might happen.</property>
|
||||
<property name="use-header-bar">1</property>
|
||||
<property name="title" translatable="yes">Zelda</property>
|
||||
<property name="hide-on-close">1</property>
|
||||
<property name="default-widget">act_action_dialog</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
@@ -3158,8 +3176,6 @@ bad things might happen.</property>
|
||||
</child>
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="act_action_dialog">
|
||||
<property name="can-default">1</property>
|
||||
<property name="has-default">1</property>
|
||||
<property name="label" translatable="yes">_Act</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
@@ -3193,20 +3209,20 @@ bad things might happen.</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="details_entry">
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -3218,20 +3234,20 @@ bad things might happen.</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="more_details_entry">
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -3243,22 +3259,22 @@ bad things might happen.</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScale" id="level_scale">
|
||||
<property name="valign">baseline</property>
|
||||
<property name="draw-value">0</property>
|
||||
<property name="adjustment">adjustment1</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
@@ -3270,21 +3286,21 @@ bad things might happen.</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="mode_switch">
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -3297,6 +3313,7 @@ bad things might happen.</property>
|
||||
<property name="use-header-bar">1</property>
|
||||
<property name="title" translatable="yes">Choose one</property>
|
||||
<property name="hide-on-close">1</property>
|
||||
<property name="default-widget">select_selection_dialog</property>
|
||||
<child internal-child="content_area">
|
||||
<object class="GtkBox">
|
||||
<child>
|
||||
@@ -3318,8 +3335,6 @@ bad things might happen.</property>
|
||||
</child>
|
||||
<child type="action">
|
||||
<object class="GtkButton" id="select_selection_dialog">
|
||||
<property name="can-default">1</property>
|
||||
<property name="has-default">1</property>
|
||||
<property name="label" translatable="yes">_Select</property>
|
||||
<property name="use-underline">1</property>
|
||||
</object>
|
||||
@@ -3342,11 +3357,11 @@ bad things might happen.</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="open_popover_entry"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="description_label">
|
||||
@@ -3356,11 +3371,11 @@ bad things might happen.</property>
|
||||
<accessibility>
|
||||
<relation type="label-for" target="open_popover_textview"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">0</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow">
|
||||
@@ -3377,11 +3392,12 @@ bad things might happen.</property>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="open_popover_entry">
|
||||
@@ -3389,27 +3405,57 @@ bad things might happen.</property>
|
||||
<accessibility>
|
||||
<relation type="labelled-by" target="title_label"/>
|
||||
</accessibility>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander">
|
||||
<child type="label">
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Extra Info</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry">
|
||||
<property name="placeholder-text">Tell me anything…</property>
|
||||
</object>
|
||||
</child>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
<property name="column-span">2</property>
|
||||
</layout>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="halign">end</property>
|
||||
<property name="icon-name">emblem-system-symbolic</property>
|
||||
<property name="menu-model">gear_menu</property>
|
||||
<layout>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="open_popover_button">
|
||||
<property name="halign">end</property>
|
||||
<property name="halign">fill</property>
|
||||
<property name="label">_Open</property>
|
||||
<property name="use-underline">1</property>
|
||||
<property name="sensitive">0</property>
|
||||
<property name="can-default">1</property>
|
||||
<style>
|
||||
<class name="suggested-action"/>
|
||||
</style>
|
||||
<layout>
|
||||
<property name="left-attach">2</property>
|
||||
<property name="top-attach">3</property>
|
||||
</layout>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left-attach">1</property>
|
||||
<property name="top-attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
@@ -3433,8 +3479,9 @@ bad things might happen.</property>
|
||||
</widgets>
|
||||
</object>
|
||||
<object class="GtkPopover" id="notebook_info_popover">
|
||||
<property name="modal">0</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="notebook_info_label">
|
||||
<object class="GtkLabel">
|
||||
<property name="label">No updates at this time</property>
|
||||
<accessibility>
|
||||
<role type="static"/>
|
||||
@@ -3442,4 +3489,39 @@ bad things might happen.</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="notebook_info_popover3">
|
||||
<property name="modal">0</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">You're in too deep!</property>
|
||||
<accessibility>
|
||||
<role type="static"/>
|
||||
</accessibility>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<object class="GtkPopover" id="notebook_info_popover2">
|
||||
<property name="modal">0</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="orientation">horizontal</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="label">Hidden gems:</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkMenuButton">
|
||||
<property name="valign">center</property>
|
||||
<property name="popover">notebook_info_popover3</property>
|
||||
<property name="icon-name">emblem-important-symbolic</property>
|
||||
<property name="relief">none</property>
|
||||
<style>
|
||||
<class name="circular"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
||||
|
@@ -231,10 +231,9 @@ gdk_surface_get_scale_factor
|
||||
gdk_surface_set_opaque_region
|
||||
gdk_surface_create_gl_context
|
||||
gdk_surface_create_vulkan_context
|
||||
gdk_surface_create_cairo_context
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_surface_invalidate_rect
|
||||
gdk_surface_invalidate_region
|
||||
gdk_surface_queue_expose
|
||||
gdk_surface_freeze_updates
|
||||
gdk_surface_thaw_updates
|
||||
@@ -262,9 +261,6 @@ gdk_surface_get_modal_hint
|
||||
gdk_surface_set_type_hint
|
||||
gdk_surface_get_type_hint
|
||||
gdk_surface_set_shadow_width
|
||||
gdk_surface_set_skip_taskbar_hint
|
||||
gdk_surface_set_skip_pager_hint
|
||||
gdk_surface_set_urgency_hint
|
||||
gdk_surface_get_position
|
||||
gdk_surface_get_root_origin
|
||||
gdk_surface_get_frame_extents
|
||||
@@ -280,8 +276,6 @@ gdk_surface_peek_children
|
||||
gdk_surface_set_icon_name
|
||||
gdk_surface_set_transient_for
|
||||
gdk_surface_set_startup_id
|
||||
gdk_surface_set_group
|
||||
gdk_surface_get_group
|
||||
gdk_surface_set_decorations
|
||||
gdk_surface_get_decorations
|
||||
GdkWMDecoration
|
||||
@@ -502,10 +496,6 @@ gdk_device_get_n_keys
|
||||
gdk_device_get_axes
|
||||
gdk_device_get_seat
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_device_grab
|
||||
gdk_device_ungrab
|
||||
|
||||
<SUBSECTION>
|
||||
gdk_device_get_state
|
||||
gdk_device_get_position
|
||||
@@ -999,9 +989,7 @@ gdk_wayland_device_get_wl_seat
|
||||
gdk_wayland_display_get_wl_compositor
|
||||
gdk_wayland_display_get_wl_display
|
||||
gdk_wayland_display_query_registry
|
||||
gdk_wayland_surface_new_subsurface
|
||||
gdk_wayland_surface_get_wl_surface
|
||||
gdk_wayland_surface_set_use_custom_surface
|
||||
GdkWaylandSurfaceExported
|
||||
gdk_wayland_surface_export_handle
|
||||
gdk_wayland_surface_unexport_handle
|
||||
|
@@ -1,12 +1,17 @@
|
||||
<SECTION>
|
||||
<FILE>GskRenderer</FILE>
|
||||
gsk_renderer_new_for_surface
|
||||
gsk_renderer_get_surface
|
||||
gsk_renderer_realize
|
||||
gsk_renderer_unrealize
|
||||
gsk_renderer_is_realized
|
||||
gsk_renderer_render
|
||||
gsk_renderer_render_texture
|
||||
<SUBSECTION>
|
||||
gsk_renderer_new_for_surface
|
||||
gsk_gl_renderer_new
|
||||
gsk_cairo_renderer_new
|
||||
gsk_vulkan_renderer_new
|
||||
gsk_broadway_renderer_new
|
||||
<SUBSECTION Standard>
|
||||
GSK_IS_RENDERER
|
||||
GSK_RENDERER
|
||||
@@ -62,6 +67,7 @@ gsk_outset_shadow_node_get_spread
|
||||
gsk_outset_shadow_node_get_blur_radius
|
||||
gsk_cairo_node_new
|
||||
gsk_cairo_node_get_draw_context
|
||||
gsk_cairo_node_peek_surface
|
||||
gsk_container_node_new
|
||||
gsk_container_node_get_n_children
|
||||
gsk_container_node_get_child
|
||||
@@ -88,6 +94,7 @@ GskShadow
|
||||
gsk_shadow_node_new
|
||||
gsk_shadow_node_peek_shadow
|
||||
gsk_shadow_node_get_n_shadows
|
||||
gsk_shadow_node_get_child
|
||||
GskBlendMode
|
||||
gsk_blend_node_new
|
||||
gsk_blend_node_get_bottom_child
|
||||
@@ -103,6 +110,7 @@ gsk_text_node_peek_glyphs
|
||||
gsk_text_node_peek_color
|
||||
gsk_text_node_get_x
|
||||
gsk_text_node_get_y
|
||||
gsk_text_node_get_num_glyphs
|
||||
gsk_blur_node_new
|
||||
gsk_blur_node_get_child
|
||||
gsk_blur_node_get_radius
|
||||
@@ -152,6 +160,8 @@ gsk_transform_get_category
|
||||
<SUBSECTION>
|
||||
gsk_transform_print
|
||||
gsk_transform_to_string
|
||||
gsk_transform_parse
|
||||
<SUBSECTION>
|
||||
gsk_transform_to_matrix
|
||||
gsk_transform_to_2d
|
||||
gsk_transform_to_affine
|
||||
@@ -160,6 +170,7 @@ gsk_transform_to_translate
|
||||
gsk_transform_transform
|
||||
gsk_transform_invert
|
||||
gsk_transform_matrix
|
||||
gsk_transform_matrix_with_category
|
||||
gsk_transform_translate
|
||||
gsk_transform_translate_3d
|
||||
gsk_transform_rotate
|
||||
|
373
docs/reference/gtk/actions.xml
Normal file
@@ -0,0 +1,373 @@
|
||||
<?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="chap-actions">
|
||||
<refmeta>
|
||||
<refentrytitle>The GTK Action Model</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>GTK Library</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>The GTK Action Model</refname>
|
||||
<refpurpose>
|
||||
How actions are used in GTK
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
|
||||
<refsect1 id="actions-overview">
|
||||
<title>Overview of actions in GTK</title>
|
||||
|
||||
<para>
|
||||
This chapter describes in detail how GTK uses actions to connect
|
||||
activatable UI elements to callbacks. GTK inherits the underlying
|
||||
architecture of GAction and GMenu for describing abstract actions
|
||||
and menus from the GIO library.
|
||||
</para>
|
||||
|
||||
<refsect2>
|
||||
<title>Basics about actions</title>
|
||||
|
||||
<para>
|
||||
A GAction is essentially a way to tell the toolkit about a
|
||||
piece of functionality in your program, and to give it a name.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Actions are purely functional. They do not contain any
|
||||
presentational information.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
An action has four pieces of information associated with it:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
a name as an identifier (usually all-lowercase, untranslated
|
||||
English string)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
an enabled flag indicating if the action can be activated or
|
||||
not (like the "sensitive" property on widgets)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
an optional state value, for stateful actions (like a boolean
|
||||
for toggles)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
an optional parameter type, used when activating the action
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
An action supports two operations. You can activate it, which
|
||||
requires passing a parameter of the correct type
|
||||
And you can request to change the actions state (for stateful
|
||||
actions) to a new state value of the correct type.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Here are some rules about an action:
|
||||
<itemizedlist>
|
||||
<listitem><para>
|
||||
the name is immutable (in the sense that it will never
|
||||
change) and it is never %NULL
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
the enabled flag can change
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
the parameter type is immutable
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
the parameter type is optional: it can be %NULL
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
if the parameter type is %NULL then action activation must
|
||||
be done without a parameter (ie: a %NULL GVariant pointer)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
if the parameter type is non-%NULL then the parameter must
|
||||
have this type
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
the state can change, but it cannot change type
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
if the action was stateful when it was created, it will
|
||||
always have a state and it will always have exactly the same
|
||||
type (such as boolean or string)
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
if the action was stateless when it was created, it can never
|
||||
have a state
|
||||
</para></listitem>
|
||||
<listitem><para>
|
||||
you can only request state changes on stateful actions and it
|
||||
is only possible to request that the state change to a value
|
||||
of the same type as the existing state
|
||||
</para></listitem>
|
||||
</itemizedlist>
|
||||
</para>
|
||||
|
||||
<para>
|
||||
An action does not have any sort of presentational information
|
||||
such as a label, an icon or a way of creating a widget from it.
|
||||
</para>
|
||||
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Action state and parameters</title>
|
||||
|
||||
<para>
|
||||
Most actions in your application will be stateless actions with
|
||||
no parameters. These typically appear as menu items with no
|
||||
special decoration. An example is "quit".
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Stateful actions are used to represent an action which has a
|
||||
closely-associated state of some kind. A good example is a
|
||||
"fullscreen" action. For this case, you'd expect to see a
|
||||
checkmark next to the menu item when the fullscreen option
|
||||
is active. This is usually called a toggle action, and it has
|
||||
a boolean state. By convention, toggle actions have no parameter
|
||||
type for activation: activating the action always toggles the
|
||||
state.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Another common case is to have an action representing a
|
||||
enumeration of possible values of a given type (typically
|
||||
string). This is often called a radio action and is usually
|
||||
represented in the user interface with radio buttons or radio
|
||||
menu items, or sometimes a combobox. A good example is
|
||||
"text-justify" with possible values "left", "center", and
|
||||
"right". By convention, these types of actions have a parameter
|
||||
type equal to their state type, and activating them with a
|
||||
particular parameter value is equivalent to changing their
|
||||
state to that value.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
This approach to handling radio buttons is different than many
|
||||
other action systems such as GtkAction. With GAction, there is
|
||||
only one action for "text-justify" and "left", "center" and
|
||||
"right" are possible states on that action. There are not three
|
||||
separate "justify-left", "justify-center" and "justify-right"
|
||||
actions.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The final common type of action is a stateless action with a
|
||||
parameter. This is typically used for actions like
|
||||
"open-bookmark" where the parameter to the action would be
|
||||
the identifier of the bookmark to open.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Because some types of actions cannot be invoked without a
|
||||
parameter, it is often important to specify a parameter when
|
||||
referring to the action from a place where it will be invoked
|
||||
(such as from a radio button that sets the state to a particular
|
||||
value or from a menu item that opens a specific bookmark). In
|
||||
these contexts, the value used for the action parameter is
|
||||
typically called the target of the action.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Even though toggle actions have a state, they do not have a
|
||||
parameter. Therefore, a target value is not needed when
|
||||
referring to them — they will always be toggled on activation.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Most APIs that allow using a GAction (such as GMenuModel and
|
||||
GtkActionable) allow use of detailed action names. This is a
|
||||
convenient way of specifying an action name and an action target
|
||||
with a single string.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In the case that the action target is a string with no unusual
|
||||
characters (ie: only alpha-numeric, plus '-' and '.') then you
|
||||
can use a detailed action name of the form "justify::left" to
|
||||
specify the justify action with a target of left.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In the case that the action target is not a string, or contains
|
||||
unusual characters, you can use the more general format
|
||||
"action-name(5)", where the "5" here is any valid text-format
|
||||
GVariant (ie: a string that can be parsed by g_variant_parse()).
|
||||
Another example is "open-bookmark('http://gnome.org/')".
|
||||
</para>
|
||||
|
||||
<para>
|
||||
You can convert between detailed action names and split-out
|
||||
action names and target values using g_action_parse_detailed_action_name()
|
||||
and g_action_print_detailed_action_name() but usually you will
|
||||
not need to. Most APIs will provide both ways of specifying
|
||||
actions with targets.
|
||||
</para>
|
||||
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Action scopes</title>
|
||||
|
||||
<para>
|
||||
Actions are always scoped to a particular object on which they
|
||||
operate.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
In GTK, actions are typically scoped to either an application
|
||||
or a window, but any widget can have actions associated with it.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Actions scoped to windows should be the actions that
|
||||
specifically impact that window. These are actions like
|
||||
"fullscreen" and "close", or in the case that a window contains
|
||||
a document, "save" and "print".
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Actions that impact the application as a whole rather than one
|
||||
specific window are scoped to the application. These are actions
|
||||
like "about" and "preferences".
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If a particular action is scoped to a window then it is scoped
|
||||
to a specific window. Another way of saying this: if your
|
||||
application has a "fullscreen" action that applies to windows
|
||||
and it has three windows, then it will have three fullscreen
|
||||
actions: one for each window.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Having a separate action per-window allows for each window to
|
||||
have a separate state for each instance of the action as well
|
||||
as being able to control the enabled state of the action on a
|
||||
per-window basis.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Actions are added to their relevant scope (application or
|
||||
window) either using the GActionMap interface, or by using
|
||||
gtk_widget_insert_action_group().
|
||||
</para>
|
||||
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Action groups and action maps</title>
|
||||
|
||||
<para>
|
||||
Actions rarely occurs in isolation. It is common to have groups
|
||||
of related actions, which are represented by instances of the
|
||||
GActionGroup interface.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Action maps are a variant of action groups that allow to change
|
||||
the name of the action as it is looked up. In GTK, the convention
|
||||
is to add a prefix to the action name to indicate the scope of
|
||||
the actions, such as "app." for the actions with application scope
|
||||
or "win." for those with window scope.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When referring to actions on a GActionMap only the name of the
|
||||
action itself is used (ie: "quit", not "app.quit"). The
|
||||
"app.quit" form is only used when referring to actions from
|
||||
places like a GMenu or GtkActionable widget where the scope
|
||||
of the action is not already known.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
GtkApplication and GtkApplicationWindow implement the GActionMap
|
||||
interface, so you can just add actions directly to them. For
|
||||
other widgets, use gtk_widget_insert_action_group() to add
|
||||
actions to it.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If you want to insert several actions at the same time, it is
|
||||
typically faster and easier to use GActionEntry.
|
||||
</para>
|
||||
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Connecting actions to widgets</title>
|
||||
|
||||
<para>
|
||||
Any widget that implements the GtkActionable interface can
|
||||
be connected to an action just by setting the ::action-name
|
||||
property. If the action has a parameter, you will also need
|
||||
to set the ::action-target property.
|
||||
Widgets that implement GtkAction include GtkSwitch, GtkButton,
|
||||
GtkMenuItem and their respective subclasses.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Another of obtaining widgets that are connected to actions is
|
||||
to create a menu using a GMenu menu model. GMenu provides an
|
||||
abstract way to describe typical menus: nested groups of items
|
||||
where each item can have a label, and icon, and an action.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Typical uses of GMenu inside GTK are to set up an application
|
||||
menu or menubar with gtk_application_set_app_menu() or
|
||||
gtk_application_set_menubar(). Another, maybe more common use
|
||||
is to create a popover for a menubutton, using
|
||||
gtk_menu_button_set_menu_model().
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Unlike traditional menus, those created from menu models don't
|
||||
have keyboard accelerators associated with menu items. Instead,
|
||||
GtkApplication offers the gtk_application_set_accels_for_action()
|
||||
API to associate keyboard shortcuts with actions.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Activation</title>
|
||||
|
||||
<para>
|
||||
When a widget with a connected action is activated, GTK finds
|
||||
the action to activate by walking up the widget hierarchy,
|
||||
looking for a matching action, ending up at the GtkApplication.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Built-in Actions</title>
|
||||
|
||||
<para>
|
||||
GTK uses actions for its own purposes in a number places. These
|
||||
built-in actions can sometimes be activated by applications, and
|
||||
you should avoid naming conflicts with them when creating your
|
||||
own actions.
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>default.activate</term>
|
||||
<listitem><para>Activates the default widget in a context
|
||||
(typically a GtkWindow, GtkDialog or GtkPopover)
|
||||
</para></listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</para>
|
||||
|
||||
</refsect2>
|
||||
|
||||
</refsect1>
|
||||
</refentry>
|
@@ -12,7 +12,7 @@
|
||||
<refnamediv>
|
||||
<refname>The GTK Drawing Model</refname>
|
||||
<refpurpose>
|
||||
The GTK drawing model in detail
|
||||
How widgets draw
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
|
@@ -54,16 +54,6 @@ Start your applications like this:
|
||||
<programlisting>
|
||||
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
|
||||
</programlisting>
|
||||
|
||||
You can add password protection for your session by creating a file in
|
||||
<filename>$XDG_CONFIG_HOME/broadway.passwd</filename> or <filename>$HOME/.config/broadway.passwd</filename>
|
||||
with a crypt(3) style password hash.
|
||||
|
||||
A simple way to generate it is with openssl:
|
||||
<programlisting>
|
||||
openssl passwd -1 > ~/.config/broadway.passwd
|
||||
</programlisting>
|
||||
|
||||
</para>
|
||||
</refsect1>
|
||||
|
||||
|
@@ -24,8 +24,9 @@
|
||||
<xi:include href="xml/getting_started.xml"/>
|
||||
<xi:include href="resources.sgml" />
|
||||
<xi:include href="xml/question_index.sgml" />
|
||||
<xi:include href="drawing-model.xml" />
|
||||
<xi:include href="xml/drawing-model.xml" />
|
||||
<xi:include href="xml/input-handling.xml" />
|
||||
<xi:include href="xml/actions.xml" />
|
||||
</part>
|
||||
|
||||
<part id="gtkobjects">
|
||||
@@ -92,7 +93,6 @@
|
||||
<xi:include href="xml/gtkheaderbar.xml" />
|
||||
<xi:include href="xml/gtkoverlay.xml" />
|
||||
<xi:include href="xml/gtkpaned.xml" />
|
||||
<xi:include href="xml/gtklayout.xml" />
|
||||
<xi:include href="xml/gtknotebook.xml" />
|
||||
<xi:include href="xml/gtkexpander.xml" />
|
||||
<xi:include href="xml/gtkorientable.xml" />
|
||||
@@ -104,7 +104,11 @@
|
||||
<title>Layout Managers</title>
|
||||
<xi:include href="xml/gtklayoutmanager.xml" />
|
||||
<xi:include href="xml/gtklayoutchild.xml" />
|
||||
<xi:include href="xml/gtkbinlayout.xml" />
|
||||
<xi:include href="xml/gtkboxlayout.xml" />
|
||||
<xi:include href="xml/gtkcustomlayout.xml" />
|
||||
<xi:include href="xml/gtkfixedlayout.xml" />
|
||||
<xi:include href="xml/gtkgridlayout.xml" />
|
||||
</chapter>
|
||||
|
||||
<chapter id="DisplayWidgets">
|
||||
|
@@ -362,6 +362,8 @@ gtk_list_box_get_selected_row
|
||||
GtkListBoxForeachFunc
|
||||
gtk_list_box_selected_foreach
|
||||
gtk_list_box_get_selected_rows
|
||||
gtk_list_box_set_show_separators
|
||||
gtk_list_box_get_show_separators
|
||||
|
||||
gtk_list_box_set_selection_mode
|
||||
gtk_list_box_get_selection_mode
|
||||
@@ -744,10 +746,8 @@ gtk_combo_box_text_get_type
|
||||
<TITLE>GtkContainer</TITLE>
|
||||
GtkContainer
|
||||
GtkContainerClass
|
||||
GTK_CONTAINER_WARN_INVALID_CHILD_PROPERTY_ID
|
||||
gtk_container_add
|
||||
gtk_container_remove
|
||||
gtk_container_add_with_properties
|
||||
gtk_container_foreach
|
||||
gtk_container_get_children
|
||||
gtk_container_get_path_for_child
|
||||
@@ -756,19 +756,7 @@ gtk_container_set_focus_vadjustment
|
||||
gtk_container_get_focus_hadjustment
|
||||
gtk_container_set_focus_hadjustment
|
||||
gtk_container_child_type
|
||||
gtk_container_child_get
|
||||
gtk_container_child_set
|
||||
gtk_container_child_get_property
|
||||
gtk_container_child_set_property
|
||||
gtk_container_child_get_valist
|
||||
gtk_container_child_set_valist
|
||||
gtk_container_child_notify
|
||||
gtk_container_child_notify_by_pspec
|
||||
gtk_container_forall
|
||||
gtk_container_class_find_child_property
|
||||
gtk_container_class_install_child_property
|
||||
gtk_container_class_install_child_properties
|
||||
gtk_container_class_list_child_properties
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_CONTAINER
|
||||
@@ -1739,27 +1727,6 @@ GtkLabelPrivate
|
||||
GtkLabelSelectionInfo
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtklayout</FILE>
|
||||
<TITLE>GtkLayout</TITLE>
|
||||
GtkLayout
|
||||
gtk_layout_new
|
||||
gtk_layout_put
|
||||
gtk_layout_move
|
||||
gtk_layout_set_size
|
||||
gtk_layout_get_size
|
||||
<SUBSECTION Standard>
|
||||
GTK_LAYOUT
|
||||
GTK_IS_LAYOUT
|
||||
GTK_TYPE_LAYOUT
|
||||
GTK_LAYOUT_CLASS
|
||||
GTK_IS_LAYOUT_CLASS
|
||||
GTK_LAYOUT_GET_CLASS
|
||||
<SUBSECTION Private>
|
||||
GtkLayoutPrivate
|
||||
gtk_layout_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtklinkbutton</FILE>
|
||||
<TITLE>GtkLinkButton</TITLE>
|
||||
@@ -1812,7 +1779,6 @@ GtkMenu
|
||||
GtkArrowPlacement
|
||||
gtk_menu_new
|
||||
gtk_menu_new_from_model
|
||||
gtk_menu_set_display
|
||||
gtk_menu_reorder_child
|
||||
gtk_menu_popup_at_rect
|
||||
gtk_menu_popup_at_widget
|
||||
@@ -1854,11 +1820,6 @@ gtk_menu_get_type
|
||||
GtkMenuBar
|
||||
gtk_menu_bar_new
|
||||
gtk_menu_bar_new_from_model
|
||||
GtkPackDirection
|
||||
gtk_menu_bar_set_pack_direction
|
||||
gtk_menu_bar_get_pack_direction
|
||||
gtk_menu_bar_set_child_pack_direction
|
||||
gtk_menu_bar_get_child_pack_direction
|
||||
<SUBSECTION Standard>
|
||||
GTK_MENU_BAR
|
||||
GTK_IS_MENU_BAR
|
||||
@@ -2514,7 +2475,6 @@ gtk_search_bar_get_search_mode
|
||||
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>
|
||||
@@ -2533,7 +2493,6 @@ gtk_search_bar_get_type
|
||||
<TITLE>GtkSearchEntry</TITLE>
|
||||
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>
|
||||
@@ -4473,13 +4432,10 @@ gtk_widget_event
|
||||
gtk_widget_activate
|
||||
gtk_widget_is_focus
|
||||
gtk_widget_grab_focus
|
||||
gtk_widget_grab_default
|
||||
gtk_widget_set_name
|
||||
gtk_widget_get_name
|
||||
gtk_widget_set_sensitive
|
||||
gtk_widget_set_parent
|
||||
gtk_widget_set_parent_surface
|
||||
gtk_widget_get_parent_surface
|
||||
gtk_widget_get_toplevel
|
||||
gtk_widget_get_root
|
||||
gtk_widget_get_ancestor
|
||||
@@ -4508,8 +4464,6 @@ gtk_widget_class_set_accessible_type
|
||||
gtk_widget_class_set_accessible_role
|
||||
gtk_widget_get_accessible
|
||||
gtk_widget_child_focus
|
||||
gtk_widget_child_notify
|
||||
gtk_widget_freeze_child_notify
|
||||
gtk_widget_get_child_visible
|
||||
gtk_widget_get_parent
|
||||
gtk_widget_get_settings
|
||||
@@ -4519,7 +4473,6 @@ gtk_widget_get_display
|
||||
gtk_widget_get_size_request
|
||||
gtk_widget_set_child_visible
|
||||
gtk_widget_set_size_request
|
||||
gtk_widget_thaw_child_notify
|
||||
gtk_widget_list_mnemonic_labels
|
||||
gtk_widget_add_mnemonic_label
|
||||
gtk_widget_remove_mnemonic_label
|
||||
@@ -4547,16 +4500,15 @@ gtk_widget_compute_bounds
|
||||
gtk_widget_compute_transform
|
||||
gtk_widget_compute_point
|
||||
gtk_widget_contains
|
||||
GtkPickFlags
|
||||
gtk_widget_pick
|
||||
gtk_widget_get_can_default
|
||||
gtk_widget_set_can_default
|
||||
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_can_pick
|
||||
gtk_widget_set_can_pick
|
||||
gtk_widget_get_can_target
|
||||
gtk_widget_set_can_target
|
||||
gtk_widget_get_has_surface
|
||||
gtk_widget_set_has_surface
|
||||
gtk_widget_get_sensitive
|
||||
@@ -4582,13 +4534,15 @@ gtk_widget_get_realized
|
||||
gtk_widget_get_mapped
|
||||
gtk_widget_device_is_shadowed
|
||||
gtk_widget_get_modifier_mask
|
||||
gtk_widget_insert_action_group
|
||||
gtk_widget_get_opacity
|
||||
gtk_widget_set_opacity
|
||||
gtk_widget_get_overflow
|
||||
gtk_widget_set_overflow
|
||||
gtk_widget_insert_action_group
|
||||
gtk_widget_list_action_prefixes
|
||||
gtk_widget_get_action_group
|
||||
gtk_widget_activate_action
|
||||
gtk_widget_activate_default
|
||||
gtk_widget_measure
|
||||
gtk_widget_snapshot_child
|
||||
gtk_widget_get_next_sibling
|
||||
@@ -4691,8 +4645,6 @@ gtk_window_set_resizable
|
||||
gtk_window_get_resizable
|
||||
gtk_window_add_accel_group
|
||||
gtk_window_remove_accel_group
|
||||
gtk_window_activate_focus
|
||||
gtk_window_activate_default
|
||||
gtk_window_set_modal
|
||||
gtk_window_set_default_size
|
||||
gtk_window_set_hide_on_close
|
||||
@@ -4715,7 +4667,7 @@ gtk_window_propagate_key_event
|
||||
gtk_window_get_focus
|
||||
gtk_window_set_focus
|
||||
gtk_window_get_default_widget
|
||||
gtk_window_set_default
|
||||
gtk_window_set_default_widget
|
||||
gtk_window_present
|
||||
gtk_window_present_with_time
|
||||
gtk_window_close
|
||||
@@ -4736,9 +4688,6 @@ gtk_window_set_decorated
|
||||
gtk_window_set_deletable
|
||||
gtk_window_set_mnemonic_modifier
|
||||
gtk_window_set_type_hint
|
||||
gtk_window_set_skip_taskbar_hint
|
||||
gtk_window_set_skip_pager_hint
|
||||
gtk_window_set_urgency_hint
|
||||
gtk_window_set_accept_focus
|
||||
gtk_window_set_focus_on_map
|
||||
gtk_window_set_startup_id
|
||||
@@ -4755,9 +4704,6 @@ gtk_window_get_title
|
||||
gtk_window_get_transient_for
|
||||
gtk_window_get_attached_to
|
||||
gtk_window_get_type_hint
|
||||
gtk_window_get_skip_taskbar_hint
|
||||
gtk_window_get_skip_pager_hint
|
||||
gtk_window_get_urgency_hint
|
||||
gtk_window_get_accept_focus
|
||||
gtk_window_get_focus_on_map
|
||||
gtk_window_get_group
|
||||
@@ -5055,8 +5001,6 @@ gtk_style_context_get_state
|
||||
gtk_style_context_get_valist
|
||||
gtk_style_context_get_section
|
||||
gtk_style_context_get_color
|
||||
gtk_style_context_get_background_color
|
||||
gtk_style_context_get_border_color
|
||||
gtk_style_context_get_border
|
||||
gtk_style_context_get_padding
|
||||
gtk_style_context_get_margin
|
||||
@@ -5120,27 +5064,28 @@ gtk_border_get_type
|
||||
<FILE>gtkcssprovider</FILE>
|
||||
<TITLE>GtkCssProvider</TITLE>
|
||||
GtkCssProvider
|
||||
gtk_css_provider_get_named
|
||||
gtk_css_provider_load_named
|
||||
gtk_css_provider_load_from_data
|
||||
gtk_css_provider_load_from_file
|
||||
gtk_css_provider_load_from_path
|
||||
gtk_css_provider_load_from_resource
|
||||
gtk_css_provider_new
|
||||
gtk_css_provider_to_string
|
||||
GTK_CSS_PROVIDER_ERROR
|
||||
GtkCssProviderError
|
||||
GTK_CSS_PARSER_ERROR
|
||||
GtkCssParserError
|
||||
GtkCssParserWarning
|
||||
<SUBSECTION>
|
||||
GtkCssLocation
|
||||
GtkCssSection
|
||||
GtkCssSectionType
|
||||
gtk_css_section_get_end_line
|
||||
gtk_css_section_get_end_position
|
||||
gtk_css_section_get_file
|
||||
gtk_css_section_get_parent
|
||||
gtk_css_section_get_section_type
|
||||
gtk_css_section_get_start_line
|
||||
gtk_css_section_get_start_position
|
||||
gtk_css_section_new
|
||||
gtk_css_section_ref
|
||||
gtk_css_section_unref
|
||||
gtk_css_section_print
|
||||
gtk_css_section_to_string
|
||||
gtk_css_section_get_file
|
||||
gtk_css_section_get_parent
|
||||
gtk_css_section_get_start_location
|
||||
gtk_css_section_get_end_location
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_CSS_PROVIDER
|
||||
GTK_CSS_PROVIDER
|
||||
@@ -7215,3 +7160,85 @@ gtk_box_layout_get_baseline_position
|
||||
GTK_TYPE_BOX_LAYOUT
|
||||
gtk_box_layout_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkcustomlayout</FILE>
|
||||
GtkCustomLayout
|
||||
|
||||
GtkCustomRequestModeFunc
|
||||
GtkCustomMeasureFunc
|
||||
GtkCustomAllocateFunc
|
||||
|
||||
gtk_custom_layout_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_CUSTOM_LAYOUT
|
||||
gtk_custom_layout_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkbinlayout</FILE>
|
||||
GtkBinLayout
|
||||
|
||||
gtk_bin_layout_new
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_BIN_LAYOUT
|
||||
gtk_bin_layout_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkfixedlayout</FILE>
|
||||
GtkFixedLayout
|
||||
|
||||
gtk_fixed_layout_new
|
||||
|
||||
<SUBSECTION>
|
||||
GtkFixedLayoutChild
|
||||
|
||||
gtk_fixed_layout_child_set_position
|
||||
gtk_fixed_layout_child_get_position
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_FIXED_LAYOUT
|
||||
gtk_fixed_layout_get_type
|
||||
GTK_TYPE_FIXED_LAYOUT_CHILD
|
||||
gtk_fixed_layout_child_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkgridlayout</FILE>
|
||||
GtkGridLayout
|
||||
|
||||
gtk_grid_layout_new
|
||||
gtk_grid_layout_set_row_homogeneous
|
||||
gtk_grid_layout_get_row_homogeneous
|
||||
gtk_grid_layout_set_row_spacing
|
||||
gtk_grid_layout_get_row_spacing
|
||||
gtk_grid_layout_set_column_homogeneous
|
||||
gtk_grid_layout_get_column_homogeneous
|
||||
gtk_grid_layout_set_column_spacing
|
||||
gtk_grid_layout_get_column_spacing
|
||||
gtk_grid_layout_set_row_baseline_position
|
||||
gtk_grid_layout_get_row_baseline_position
|
||||
gtk_grid_layout_set_baseline_row
|
||||
gtk_grid_layout_get_baseline_row
|
||||
|
||||
<SUBSECTION>
|
||||
GtkGridLayoutChild
|
||||
|
||||
gtk_grid_layout_child_set_top_attach
|
||||
gtk_grid_layout_child_get_top_attach
|
||||
gtk_grid_layout_child_set_left_attach
|
||||
gtk_grid_layout_child_get_left_attach
|
||||
gtk_grid_layout_child_set_column_span
|
||||
gtk_grid_layout_child_get_column_span
|
||||
gtk_grid_layout_child_set_row_span
|
||||
gtk_grid_layout_child_get_row_span
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GTK_TYPE_GRID_LAYOUT
|
||||
gtk_grid_layout_get_type
|
||||
GTK_TYPE_GRID_LAYOUT_CHILD
|
||||
gtk_grid_layout_child_get_type
|
||||
</SECTION>
|
||||
|
@@ -16,7 +16,9 @@ gtk_aspect_frame_get_type
|
||||
gtk_assistant_get_type
|
||||
gtk_assistant_page_get_type
|
||||
gtk_bin_get_type
|
||||
gtk_bin_layout_get_type
|
||||
gtk_box_get_type
|
||||
gtk_box_layout_get_type
|
||||
gtk_builder_get_type
|
||||
gtk_buildable_get_type
|
||||
gtk_button_get_type
|
||||
@@ -64,6 +66,7 @@ gtk_file_chooser_get_type
|
||||
gtk_file_chooser_widget_get_type
|
||||
gtk_file_filter_get_type
|
||||
gtk_fixed_get_type
|
||||
gtk_fixed_layout_get_type
|
||||
gtk_flow_box_get_type
|
||||
gtk_flow_box_child_get_type
|
||||
gtk_font_button_get_type
|
||||
@@ -83,6 +86,8 @@ gtk_gesture_swipe_get_type
|
||||
gtk_gesture_zoom_get_type
|
||||
gtk_gl_area_get_type
|
||||
gtk_grid_get_type
|
||||
gtk_grid_layout_child_get_type
|
||||
gtk_grid_layout_get_type
|
||||
gtk_header_bar_get_type
|
||||
gtk_icon_theme_get_type
|
||||
gtk_icon_view_get_type
|
||||
@@ -92,7 +97,8 @@ gtk_im_context_simple_get_type
|
||||
gtk_im_multicontext_get_type
|
||||
gtk_info_bar_get_type
|
||||
gtk_label_get_type
|
||||
gtk_layout_get_type
|
||||
gtk_layout_child_get_type
|
||||
gtk_layout_manager_get_type
|
||||
gtk_link_button_get_type
|
||||
gtk_list_store_get_type
|
||||
gtk_list_box_get_type
|
||||
|
@@ -4,15 +4,15 @@
|
||||
]>
|
||||
<refentry id="chap-input-handling">
|
||||
<refmeta>
|
||||
<refentrytitle>The GTK Input and Event Handling Model</refentrytitle>
|
||||
<refentrytitle>The GTK Input Model</refentrytitle>
|
||||
<manvolnum>3</manvolnum>
|
||||
<refmiscinfo>GTK Library</refmiscinfo>
|
||||
</refmeta>
|
||||
|
||||
<refnamediv>
|
||||
<refname>The GTK Input and Event Handling Model</refname>
|
||||
<refname>The GTK Input Model</refname>
|
||||
<refpurpose>
|
||||
GTK input and event handling in detail
|
||||
input and event handling in detail
|
||||
</refpurpose>
|
||||
</refnamediv>
|
||||
|
||||
@@ -52,13 +52,12 @@
|
||||
with any pointing device or keyboard.
|
||||
</para>
|
||||
|
||||
<!-- input events: button, touch, key, motion, etc -->
|
||||
<para>
|
||||
When a user interacts with an input device (e.g. moves a mouse or presses
|
||||
a key on the keyboard), GTK receives events from the windowing system.
|
||||
These are typically directed at a specific window - for pointer events,
|
||||
the window under the pointer (grabs complicate this), for keyboard events,
|
||||
the window with the keyboard focus.
|
||||
These are typically directed at a specific surface - for pointer events,
|
||||
the surface under the pointer (grabs complicate this), for keyboard events,
|
||||
the surface with the keyboard focus.
|
||||
</para>
|
||||
<para>
|
||||
GDK translates these raw windowing system events into #GdkEvents.
|
||||
@@ -81,9 +80,10 @@
|
||||
</simplelist>
|
||||
</para>
|
||||
<para>
|
||||
When GTK is initialized, it sets up an event handler function with
|
||||
gdk_event_handler_set(), which receives all of these input events
|
||||
(as well as others, for instance window management related events).
|
||||
When GTK creates a GdkSurface, it connects to the ::event signal
|
||||
on it, which receives all of these input events. Surfaces have
|
||||
have signals and properties, e.g. to deal with window management
|
||||
related events.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
@@ -91,8 +91,8 @@
|
||||
<title>Event propagation</title>
|
||||
|
||||
<para>
|
||||
For widgets which have a #GdkSurface set, events are received from the
|
||||
windowing system and passed to gtk_main_do_event(). See its documentation
|
||||
The function which initially receives input events on the GTK
|
||||
side is gtk_main_do_event(). See its documentation
|
||||
for details of what it does: compression of enter/leave events,
|
||||
identification of the widget receiving the event, pushing the event onto a
|
||||
stack for gtk_get_current_event(), and propagating the event to the
|
||||
@@ -120,62 +120,55 @@
|
||||
|
||||
<para>
|
||||
An event is propagated to a widget using gtk_propagate_event().
|
||||
Propagation differs between event types: key events (%GDK_KEY_PRESS,
|
||||
%GDK_KEY_RELEASE) are delivered to the top-level #GtkWindow; other events
|
||||
are propagated down and up the widget hierarchy in three phases (see
|
||||
#GtkPropagationPhase).
|
||||
Propagation goes down and up the widget hierarchy in three phases
|
||||
(see #GtkPropagationPhase) towards a target widget.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For key events, the top-level window’s default #GtkWindow::key-press-event
|
||||
and #GtkWindow::key-release-event signal handlers handle mnemonics and
|
||||
accelerators first. Other key presses are then passed to
|
||||
gtk_window_propagate_key_event() which propagates the event upwards from
|
||||
the window’s current focus widget (gtk_window_get_focus()) to the
|
||||
top-level.
|
||||
For key events, the top-level window gets a first shot at activating
|
||||
mnemonics and accelerators. If that does not consume the events,
|
||||
the target widget for event propagation is window's current focus
|
||||
widget (see gtk_window_get_focus()).
|
||||
</para>
|
||||
|
||||
<para>
|
||||
For other events, in the first phase (the “capture” phase) the event is
|
||||
delivered to each widget from the top-most (for example, the top-level
|
||||
For pointer events, the target widget is determined by picking
|
||||
the widget at the events coordinates (see gtk_window_pick()).
|
||||
</para>
|
||||
|
||||
<para>In the first phase (the “capture” phase) the event is
|
||||
delivered to each widget from the top-most (the top-level
|
||||
#GtkWindow or grab widget) down to the target #GtkWidget.
|
||||
<link linkend="event-controllers-and-gestures">Gestures</link> that are
|
||||
attached with %GTK_PHASE_CAPTURE get a chance to react to the event.
|
||||
<link linkend="event-controllers-and-gestures">Event
|
||||
controllers</link> that are attached with %GTK_PHASE_CAPTURE
|
||||
get a chance to react to the event.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
After the “capture” phase, the widget that was intended to be the
|
||||
destination of the event will run gestures attached to it with
|
||||
%GTK_PHASE_TARGET. This is known as the “target” phase, and only
|
||||
happens on that widget.
|
||||
destination of the event will run event controllers attached to
|
||||
it with %GTK_PHASE_TARGET. This is known as the “target” phase,
|
||||
and only happens on that widget.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Next, the #GtkWidget::event signal is emitted.
|
||||
Handling these signals was the primary way to handle input in GTK widgets
|
||||
before gestures were introduced. The signal is emitted from
|
||||
the target widget up to the top-level, as part of the “bubble” phase.
|
||||
In the last phase (the “bubble” phase), the event is delivered
|
||||
to each widget from the target to the top-most, and event
|
||||
controllers attached with %GTK_PHASE_BUBBLE are run.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
The default handlers for the event signals send the event
|
||||
to gestures that are attached with %GTK_PHASE_BUBBLE. Therefore,
|
||||
gestures in the “bubble” phase are only used if the widget does
|
||||
not have its own event handlers, or takes care to chain up to the
|
||||
default #GtkWidget handlers.
|
||||
Events are not delivered to a widget which is insensitive or
|
||||
unmapped.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Events are not delivered to a widget which is insensitive or unmapped.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Any time during the propagation phase, a widget may indicate that a
|
||||
received event was consumed and propagation should therefore be stopped.
|
||||
In traditional event handlers, this is hinted by returning %GDK_EVENT_STOP.
|
||||
If gestures are used, this may happen when the widget tells the gesture
|
||||
to claim the event touch sequence (or the pointer events) for its own. See the
|
||||
"gesture states" section below to know more of the latter.
|
||||
Any time during the propagation phase, a controller may indicate
|
||||
that a received event was consumed and propagation should
|
||||
therefore be stopped. If gestures are used, this may happen
|
||||
when the gesture claims the event touch sequence (or the
|
||||
pointer events) for its own. See the “gesture states” section
|
||||
below to learn more about gestures and sequences.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
@@ -183,27 +176,10 @@
|
||||
<title>Touch events</title>
|
||||
|
||||
<para>
|
||||
Touch events are emitted as events of type %GDK_TOUCH_BEGIN, %GDK_TOUCH_UPDATE or
|
||||
%GDK_TOUCH_END, those events contain an “event sequence” that univocally identifies
|
||||
the physical touch until it is lifted from the device.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
On some windowing platforms, multitouch devices perform pointer emulation, this works
|
||||
by granting a “pointer emulating” hint to one of the currently interacting touch
|
||||
sequences, which will be reported on every #GdkEventTouch event from that sequence. By
|
||||
default, if a widget didn't request touch events by setting %GDK_TOUCH_MASK on its
|
||||
event mask and didn't override #GtkWidget::touch-event, GTK will transform these
|
||||
“pointer emulating” events into semantically similar #GdkEventButton and #GdkEventMotion
|
||||
events. Depending on %GDK_TOUCH_MASK being in the event mask or not, non-pointer-emulating
|
||||
sequences could still trigger gestures or just get filtered out, regardless of the widget
|
||||
not handling those directly.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
If the widget sets %GDK_TOUCH_MASK on its event mask and doesn't chain up on
|
||||
#GtkWidget::touch-event, only touch events will be received, and no pointer emulation
|
||||
will be performed.
|
||||
Touch events are emitted as events of type %GDK_TOUCH_BEGIN,
|
||||
%GDK_TOUCH_UPDATE or %GDK_TOUCH_END, those events contain an
|
||||
“event sequence” that univocally identifies the physical touch
|
||||
until it is lifted from the device.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
@@ -211,43 +187,66 @@
|
||||
<title>Grabs</title>
|
||||
|
||||
<para>
|
||||
Grabs are a method to claim all input events from a device, they happen
|
||||
either implicitly on pointer and touch devices, or explicitly. Implicit grabs
|
||||
happen on user interaction, when a #GdkEventButtonPress happens, all events from
|
||||
then on, until after the corresponding #GdkEventButtonRelease, will be reported
|
||||
to the widget that got the first event. Likewise, on touch events, every
|
||||
#GdkEventSequence will deliver only events to the widget that received its
|
||||
%GDK_TOUCH_BEGIN event.
|
||||
Grabs are a method to claim all input events from a device,
|
||||
they happen either implicitly on pointer and touch devices,
|
||||
or explicitly. Implicit grabs happen on user interaction, when
|
||||
a #GdkEventButtonPress happens, all events from then on, until
|
||||
after the corresponding #GdkEventButtonRelease, will be reported
|
||||
to the widget that got the first event. Likewise, on touch events,
|
||||
every #GdkEventSequence will deliver only events to the widget
|
||||
that received its %GDK_TOUCH_BEGIN event.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Explicit grabs happen programatically (both activation and deactivation),
|
||||
and can be either system-wide (GDK grabs) or application-wide (GTK grabs).
|
||||
On the windowing platforms that support it, GDK grabs will prevent any
|
||||
interaction with any other application/window/widget than the grabbing one,
|
||||
whereas GTK grabs will be effective only within the application (across all
|
||||
its windows), still allowing for interaction with other applications.
|
||||
Explicit grabs happen programatically (both activation and
|
||||
deactivation), and can be either system-wide (GDK grabs) or
|
||||
application-wide (GTK grabs). On the windowing platforms that
|
||||
support it, GDK grabs will prevent any interaction with any other
|
||||
application/window/widget than the grabbing one, whereas GTK grabs
|
||||
will be effective only within the application (across all its
|
||||
windows), still allowing for interaction with other applications.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
But one important aspect of grabs is that they may potentially happen at any
|
||||
point somewhere else, even while the pointer/touch device is already grabbed.
|
||||
This makes it necessary for widgets to handle the cancellation of any ongoing
|
||||
interaction. Depending on whether a GTK or GDK grab is causing this, the
|
||||
widget will respectively receive a #GtkWidget::grab-notify signal, or a
|
||||
But one important aspect of grabs is that they may potentially
|
||||
happen at any point somewhere else, even while the pointer/touch
|
||||
device is already grabbed. This makes it necessary for widgets to
|
||||
handle the cancellation of any ongoing interaction. Depending on
|
||||
whether a GTK or GDK grab is causing this, the widget will
|
||||
respectively receive a #GtkWidget::grab-notify signal, or a
|
||||
#GdkEventGrabBroken event.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
On gestures, these signals are handled automatically, causing the gesture
|
||||
to cancel all tracked pointer/touch events, and signal the end of recognition.
|
||||
On gestures, these signals are handled automatically, causing the
|
||||
gesture to cancel all tracked pointer/touch events, and signal
|
||||
the end of recognition.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
<refsect2>
|
||||
<title>Keyboard input</title>
|
||||
|
||||
<!-- focus, tab, directional navigation -->
|
||||
<para>
|
||||
Every #GtkWindow maintains a single focus location (in
|
||||
the ::focus-widget property). The focus widget is the
|
||||
target widget for key events sent to the window. Only
|
||||
widgets which have ::can-focus set to %TRUE can become
|
||||
the focus. Typically these are input controls such as
|
||||
entries or text fields, but e.g. buttons can take the
|
||||
focus too.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Input widgets can be given the focus by clicking on them,
|
||||
but focus can also be moved around with certain key
|
||||
events (this is known as “keyboard navigation”). GTK
|
||||
reserves the Tab key to move the focus to the next location,
|
||||
and Shift-Tab to move it back to the previous one. In addition
|
||||
many containers allow “directional navigation” with the
|
||||
arrow keys.
|
||||
</para>
|
||||
|
||||
<!-- mnemonics, accelerators, bindings -->
|
||||
</refsect2>
|
||||
|
||||
@@ -255,37 +254,43 @@
|
||||
<title>Event controllers and gestures</title>
|
||||
|
||||
<para>
|
||||
Event controllers are standalone objects that can perform specific actions
|
||||
upon received #GdkEvents. These are tied to a #GtkWidget, and can be told of
|
||||
the event propagation phase at which they will manage the events.
|
||||
Event controllers are standalone objects that can perform
|
||||
specific actions upon received #GdkEvents. These are tied
|
||||
to a #GtkWidget, and can be told of the event propagation
|
||||
phase at which they will manage the events.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Gestures are a set of specific controllers that are prepared to handle pointer
|
||||
and/or touch events, each gestures implementation attempts to recognize specific
|
||||
actions out the received events, notifying of the state/progress accordingly to
|
||||
let the widget react to those. On multi-touch gestures, every interacting touch
|
||||
sequence will be tracked independently.
|
||||
Gestures are a set of specific controllers that are prepared
|
||||
to handle pointer and/or touch events, each gesture
|
||||
implementation attempts to recognize specific actions out the
|
||||
received events, notifying of the state/progress accordingly to
|
||||
let the widget react to those. On multi-touch gestures, every
|
||||
interacting touch sequence will be tracked independently.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Being gestures “simple” units, it is not uncommon to tie several together to
|
||||
perform higher level actions, grouped gestures handle the same event sequences
|
||||
simultaneously, and those sequences share a same state across all grouped
|
||||
Since gestures are “simple” units, it is not uncommon to tie
|
||||
several together to perform higher level actions, grouped
|
||||
gestures handle the same event sequences simultaneously, and
|
||||
those sequences share a same state across all grouped
|
||||
gestures. Some examples of grouping may be:
|
||||
|
||||
<simplelist>
|
||||
<member>
|
||||
A “drag” and a “swipe” gestures may want grouping. The former will report
|
||||
events as the dragging happens, the latter will tell the swipe X/Y velocities
|
||||
only after gesture has finished.
|
||||
A “drag” and a “swipe” gestures may want grouping.
|
||||
The former will report events as the dragging happens,
|
||||
the latter will tell the swipe X/Y velocities only after
|
||||
recognition has finished.
|
||||
</member>
|
||||
<member>
|
||||
Grouping a “drag” gesture with a “pan” gesture will only effectively allow
|
||||
dragging in the panning orientation, as both gestures share state.
|
||||
Grouping a “drag” gesture with a “pan” gesture will only
|
||||
effectively allow dragging in the panning orientation, as
|
||||
both gestures share state.
|
||||
</member>
|
||||
<member>
|
||||
If “press” and “long press” are wanted simultaneously, those would need grouping.
|
||||
If “press” and “long press” are wanted simultaneously,
|
||||
those would need grouping.
|
||||
</member>
|
||||
</simplelist>
|
||||
</para>
|
||||
@@ -294,34 +299,39 @@
|
||||
<refsect2>
|
||||
<title>Gesture states</title>
|
||||
<para>
|
||||
Gestures have a notion of “state” for each individual touch sequence. When events
|
||||
from a touch sequence are first received, the touch sequence will have “none” state,
|
||||
this means the touch sequence is being handled by the gesture to possibly trigger
|
||||
Gestures have a notion of “state” for each individual touch
|
||||
sequence. When events from a touch sequence are first received,
|
||||
the touch sequence will have “none” state, this means the touch
|
||||
sequence is being handled by the gesture to possibly trigger
|
||||
actions, but the event propagation will not be stopped.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
When the gesture enters recognition, or at a later point in time, the widget may
|
||||
choose to claim the touch sequences (individually or as a group), hence stopping
|
||||
event propagation after the event is run through every gesture in that widget and
|
||||
propagation phase. Anytime this happens, the touch sequences are cancelled downwards
|
||||
the propagation chain, to let these know that no further events will be sent.
|
||||
When the gesture enters recognition, or at a later point in time,
|
||||
the widget may choose to claim the touch sequences (individually
|
||||
or as a group), hence stopping event propagation after the event
|
||||
is run through every gesture in that widget and propagation phase.
|
||||
Anytime this happens, the touch sequences are cancelled downwards
|
||||
the propagation chain, to let these know that no further events
|
||||
will be sent.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Alternatively, or at a later point in time, the widget may choose to deny the touch
|
||||
sequences, thus letting those go through again in event propagation. When this happens
|
||||
in the capture phase, and if there are no other claiming gestures in the widget,
|
||||
Alternatively, or at a later point in time, the widget may choose
|
||||
to deny the touch sequences, thus letting those go through again
|
||||
in event propagation. When this happens in the capture phase, and
|
||||
if there are no other claiming gestures in the widget,
|
||||
a %GDK_TOUCH_BEGIN/%GDK_BUTTON_PRESS event will be emulated and
|
||||
propagated downwards, in order to preserve consistency.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Grouped gestures always share the same state for a given touch sequence, so setting
|
||||
the state on one does transfer the state to the others. They also are mutually exclusive,
|
||||
within a widget there may be only one gesture group claiming a given sequence. If
|
||||
another gesture group claims later that same sequence, the first group will deny the
|
||||
sequence.
|
||||
Grouped gestures always share the same state for a given touch
|
||||
sequence, so setting the state on one does transfer the state to
|
||||
the others. They also are mutually exclusive, within a widget
|
||||
there may be only one gesture group claiming a given sequence.
|
||||
If another gesture group claims later that same sequence, the
|
||||
first group will deny the sequence.
|
||||
</para>
|
||||
</refsect2>
|
||||
|
||||
|
@@ -333,6 +333,7 @@ images = [
|
||||
]
|
||||
|
||||
content_files = [
|
||||
'actions.xml',
|
||||
'broadway.xml',
|
||||
'building.sgml',
|
||||
'compiling.sgml',
|
||||
@@ -368,6 +369,7 @@ content_files = [
|
||||
]
|
||||
|
||||
expand_content_files = [
|
||||
'actions.xml',
|
||||
'compiling.sgml',
|
||||
'drawing-model.xml',
|
||||
'glossary.xml',
|
||||
|